var zHe=Object.defineProperty;var M2e=t=>{throw TypeError(t)};var BHe=(t,e,n)=>e in t?zHe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gn=(t,e,n)=>BHe(t,typeof e!="symbol"?e+"":e,n),zoe=(t,e,n)=>e.has(t)||M2e("Cannot "+n);var er=(t,e,n)=>(zoe(t,e,"read from private field"),n?n.call(t):e.get(t)),ca=(t,e,n)=>e.has(t)?M2e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),us=(t,e,n,s)=>(zoe(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),oi=(t,e,n)=>(zoe(t,e,"access private method"),n);var z6=(t,e,n,s)=>({set _(a){us(t,e,a,n)},get _(){return er(t,e,s)}});function $He(t,e){for(var n=0;ns[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var Ix=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function E5e(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 a=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return t[s]}})}),n}var I5e={exports:{}},lne={},P5e={exports:{}},Pi={};/** * @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 sI=Symbol.for("react.element"),UHe=Symbol.for("react.portal"),qHe=Symbol.for("react.fragment"),VHe=Symbol.for("react.strict_mode"),HHe=Symbol.for("react.profiler"),WHe=Symbol.for("react.provider"),GHe=Symbol.for("react.context"),KHe=Symbol.for("react.forward_ref"),ZHe=Symbol.for("react.suspense"),YHe=Symbol.for("react.memo"),XHe=Symbol.for("react.lazy"),T2e=Symbol.iterator;function QHe(t){return t===null||typeof t!="object"?null:(t=T2e&&t[T2e]||t["@@iterator"],typeof t=="function"?t:null)}var L5e={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O5e=Object.assign,D5e={};function WC(t,e,n){this.props=t,this.context=e,this.refs=D5e,this.updater=n||L5e}WC.prototype.isReactComponent={};WC.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")};WC.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function R5e(){}R5e.prototype=WC.prototype;function Bpe(t,e,n){this.props=t,this.context=e,this.refs=D5e,this.updater=n||L5e}var $pe=Bpe.prototype=new R5e;$pe.constructor=Bpe;O5e($pe,WC.prototype);$pe.isPureReactComponent=!0;var A2e=Array.isArray,F5e=Object.prototype.hasOwnProperty,Upe={current:null},z5e={key:!0,ref:!0,__self:!0,__source:!0};function B5e(t,e,n){var s,a={},o=null,l=null;if(e!=null)for(s in e.ref!==void 0&&(l=e.ref),e.key!==void 0&&(o=""+e.key),e)F5e.call(e,s)&&!z5e.hasOwnProperty(s)&&(a[s]=e[s]);var i=arguments.length-2;if(i===1)a.children=n;else if(1>>1,Se=ue[Ce];if(0>>1;Cea(ke,Ae))Bea(Ee,ke)?(ue[Ce]=Ee,ue[Be]=Ae,Ce=Be):(ue[Ce]=ke,ue[Le]=Ae,Ce=Le);else if(Bea(Ee,Ae))ue[Ce]=Ee,ue[Be]=Ae,Ce=Be;else break e}}return _e}function a(ue,_e){var Ae=ue.sortIndex-_e.sortIndex;return Ae!==0?Ae:ue.id-_e.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var l=Date,i=l.now();t.unstable_now=function(){return l.now()-i}}var h=[],p=[],x=1,y=null,_=3,j=!1,C=!1,N=!1,A=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(ue){for(var _e=n(p);_e!==null;){if(_e.callback===null)s(p);else if(_e.startTime<=ue)s(p),_e.sortIndex=_e.expirationTime,e(h,_e);else break;_e=n(p)}}function z(ue){if(N=!1,P(ue),!C)if(n(h)!==null)C=!0,se(F);else{var _e=n(p);_e!==null&&he(z,_e.startTime-ue)}}function F(ue,_e){C=!1,N&&(N=!1,E(K),K=-1),j=!0;var Ae=_;try{for(P(_e),y=n(h);y!==null&&(!(y.expirationTime>_e)||ue&&!ie());){var Ce=y.callback;if(typeof Ce=="function"){y.callback=null,_=y.priorityLevel;var Se=Ce(y.expirationTime<=_e);_e=t.unstable_now(),typeof Se=="function"?y.callback=Se:y===n(h)&&s(h),P(_e)}else s(h);y=n(h)}if(y!==null)var ge=!0;else{var Le=n(p);Le!==null&&he(z,Le.startTime-_e),ge=!1}return ge}finally{y=null,_=Ae,j=!1}}var q=!1,V=null,K=-1,G=5,te=-1;function ie(){return!(t.unstable_now()-teue||125Ce?(ue.sortIndex=Ae,e(p,ue),n(h)===null&&ue===n(p)&&(N?(E(K),K=-1):N=!0,he(z,Ae-Ce))):(ue.sortIndex=Se,e(h,ue),C||j||(C=!0,se(F))),ue},t.unstable_shouldYield=ie,t.unstable_wrapCallback=function(ue){var _e=_;return function(){var Ae=_;_=_e;try{return ue.apply(this,arguments)}finally{_=Ae}}}})(H5e);V5e.exports=H5e;var cWe=V5e.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 dWe=I,cf=cWe;function Cn(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"),fde=Object.prototype.hasOwnProperty,uWe=/^[: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]*$/,I2e={},P2e={};function hWe(t){return fde.call(P2e,t)?!0:fde.call(I2e,t)?!1:uWe.test(t)?P2e[t]=!0:(I2e[t]=!0,!1)}function fWe(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 pWe(t,e,n,s){if(e===null||typeof e>"u"||fWe(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 Hu(t,e,n,s,a,o,l){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=s,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=l}var $d={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){$d[t]=new Hu(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];$d[e]=new Hu(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){$d[t]=new Hu(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){$d[t]=new Hu(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){$d[t]=new Hu(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){$d[t]=new Hu(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){$d[t]=new Hu(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){$d[t]=new Hu(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){$d[t]=new Hu(t,5,!1,t.toLowerCase(),null,!1,!1)});var Hpe=/[\-:]([a-z])/g;function Wpe(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(Hpe,Wpe);$d[e]=new Hu(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(Hpe,Wpe);$d[e]=new Hu(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(Hpe,Wpe);$d[e]=new Hu(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){$d[t]=new Hu(t,1,!1,t.toLowerCase(),null,!1,!1)});$d.xlinkHref=new Hu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){$d[t]=new Hu(t,1,!1,t.toLowerCase(),null,!0,!0)});function Gpe(t,e,n,s){var a=$d.hasOwnProperty(e)?$d[e]:null;(a!==null?a.type!==0:s||!(2i||a[l]!==o[i]){var h=` `+a[l].replace(" at new "," at ");return t.displayName&&h.includes("")&&(h=h.replace("",t.displayName)),h}while(1<=l&&0<=i);break}}}finally{Uoe=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?tT(t):""}function mWe(t){switch(t.tag){case 5:return tT(t.type);case 16:return tT("Lazy");case 13:return tT("Suspense");case 19:return tT("SuspenseList");case 0:case 2:case 15:return t=qoe(t.type,!1),t;case 11:return t=qoe(t.type.render,!1),t;case 1:return t=qoe(t.type,!0),t;default:return""}}function xde(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 S4:return"Fragment";case N4:return"Portal";case pde:return"Profiler";case Kpe:return"StrictMode";case mde:return"Suspense";case gde:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case K5e:return(t.displayName||"Context")+".Consumer";case G5e: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 Ype:return e=t.displayName||null,e!==null?e:xde(t.type)||"Memo";case y0:e=t._payload,t=t._init;try{return xde(t(e))}catch{}}return null}function gWe(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 xde(e);case 8:return e===Kpe?"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 R1(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Y5e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function xWe(t){var e=Y5e(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 a=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(l){s=""+l,o.call(this,l)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(l){s=""+l},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function U6(t){t._valueTracker||(t._valueTracker=xWe(t))}function X5e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=Y5e(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function pee(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 yde(t,e){var n=e.checked;return Bl({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function O2e(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=R1(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 Q5e(t,e){e=e.checked,e!=null&&Gpe(t,"checked",e,!1)}function vde(t,e){Q5e(t,e);var n=R1(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")?_de(t,e.type,n):e.hasOwnProperty("defaultValue")&&_de(t,e.type,R1(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function D2e(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 _de(t,e,n){(e!=="number"||pee(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var rT=Array.isArray;function H4(t,e,n,s){if(t=t.options,e){e={};for(var a=0;a"+e.valueOf().toString()+"",e=q6.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function TA(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var gT={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},yWe=["Webkit","ms","Moz","O"];Object.keys(gT).forEach(function(t){yWe.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),gT[e]=gT[t]})});function rMe(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||gT.hasOwnProperty(t)&&gT[t]?(""+e).trim():e+"px"}function nMe(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=rMe(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,a):t[n]=a}}var vWe=Bl({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 jde(t,e){if(e){if(vWe[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Cn(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Cn(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Cn(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Cn(62))}}function kde(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 Nde=null;function Xpe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Sde=null,W4=null,G4=null;function z2e(t){if(t=oI(t)){if(typeof Sde!="function")throw Error(Cn(280));var e=t.stateNode;e&&(e=fne(e),Sde(t.stateNode,t.type,e))}}function sMe(t){W4?G4?G4.push(t):G4=[t]:W4=t}function aMe(){if(W4){var t=W4,e=G4;if(G4=W4=null,z2e(t),e)for(t=0;t>>=0,t===0?32:31-(AWe(t)/EWe|0)|0}var V6=64,H6=4194304;function nT(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 yee(t,e){var n=t.pendingLanes;if(n===0)return 0;var s=0,a=t.suspendedLanes,o=t.pingedLanes,l=n&268435455;if(l!==0){var i=l&~a;i!==0?s=nT(i):(o&=l,o!==0&&(s=nT(o)))}else l=n&~a,l!==0?s=nT(l):o!==0&&(s=nT(o));if(s===0)return 0;if(e!==0&&e!==s&&!(e&a)&&(a=s&-s,o=e&-e,a>=o||a===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 aI(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-hm(e),t[e]=n}function OWe(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=yT),K2e=" ",Z2e=!1;function NMe(t,e){switch(t){case"keyup":return cGe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function SMe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var C4=!1;function uGe(t,e){switch(t){case"compositionend":return SMe(e);case"keypress":return e.which!==32?null:(Z2e=!0,K2e);case"textInput":return t=e.data,t===K2e&&Z2e?null:t;default:return null}}function hGe(t,e){if(C4)return t==="compositionend"||!ame&&NMe(t,e)?(t=jMe(),aO=rme=G0=null,C4=!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=J2e(n)}}function AMe(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?AMe(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function EMe(){for(var t=window,e=pee();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=pee(t.document)}return e}function ime(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 bGe(t){var e=EMe(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&AMe(n.ownerDocument.documentElement,n)){if(s!==null&&ime(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 a=n.textContent.length,o=Math.min(s.start,a);s=s.end===void 0?o:Math.min(s.end,a),!t.extend&&o>s&&(a=s,s=o,o=a),a=ebe(n,o);var l=ebe(n,s);a&&l&&(t.rangeCount!==1||t.anchorNode!==a.node||t.anchorOffset!==a.offset||t.focusNode!==l.node||t.focusOffset!==l.offset)&&(e=e.createRange(),e.setStart(a.node,a.offset),t.removeAllRanges(),o>s?(t.addRange(e),t.extend(l.node,l.offset)):(e.setEnd(l.node,l.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,M4=null,Ide=null,_T=null,Pde=!1;function tbe(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pde||M4==null||M4!==pee(s)||(s=M4,"selectionStart"in s&&ime(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}),_T&&OA(_T,s)||(_T=s,s=bee(Ide,"onSelect"),0E4||(t.current=zde[E4],zde[E4]=null,E4--)}function Xo(t,e){E4++,zde[E4]=t.current,t.current=e}var F1={},pu=ev(F1),gh=ev(!1),Ij=F1;function QS(t,e){var n=t.type.contextTypes;if(!n)return F1;var s=t.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===e)return s.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in n)a[o]=e[o];return s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=a),a}function xh(t){return t=t.childContextTypes,t!=null}function jee(){pl(gh),pl(pu)}function lbe(t,e,n){if(pu.current!==F1)throw Error(Cn(168));Xo(pu,e),Xo(gh,n)}function BMe(t,e,n){var s=t.stateNode;if(e=e.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var a in s)if(!(a in e))throw Error(Cn(108,gWe(t)||"Unknown",a));return Bl({},n,s)}function kee(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||F1,Ij=pu.current,Xo(pu,t),Xo(gh,gh.current),!0}function cbe(t,e,n){var s=t.stateNode;if(!s)throw Error(Cn(169));n?(t=BMe(t,e,Ij),s.__reactInternalMemoizedMergedChildContext=t,pl(gh),pl(pu),Xo(pu,t)):pl(gh),Xo(gh,n)}var Sx=null,pne=!1,nle=!1;function $Me(t){Sx===null?Sx=[t]:Sx.push(t)}function PGe(t){pne=!0,$Me(t)}function tv(){if(!nle&&Sx!==null){nle=!0;var t=0,e=So;try{var n=Sx;for(So=1;t>=l,a-=l,Px=1<<32-hm(e)+a|n<K?(G=V,V=null):G=V.sibling;var te=_(E,V,P[K],z);if(te===null){V===null&&(V=G);break}t&&V&&te.alternate===null&&e(E,V),T=o(te,T,K),q===null?F=te:q.sibling=te,q=te,V=G}if(K===P.length)return n(E,V),Nl&&h_(E,K),F;if(V===null){for(;KK?(G=V,V=null):G=V.sibling;var ie=_(E,V,te.value,z);if(ie===null){V===null&&(V=G);break}t&&V&&ie.alternate===null&&e(E,V),T=o(ie,T,K),q===null?F=ie:q.sibling=ie,q=ie,V=G}if(te.done)return n(E,V),Nl&&h_(E,K),F;if(V===null){for(;!te.done;K++,te=P.next())te=y(E,te.value,z),te!==null&&(T=o(te,T,K),q===null?F=te:q.sibling=te,q=te);return Nl&&h_(E,K),F}for(V=s(E,V);!te.done;K++,te=P.next())te=j(V,E,K,te.value,z),te!==null&&(t&&te.alternate!==null&&V.delete(te.key===null?K:te.key),T=o(te,T,K),q===null?F=te:q.sibling=te,q=te);return t&&V.forEach(function(oe){return e(E,oe)}),Nl&&h_(E,K),F}function A(E,T,P,z){if(typeof P=="object"&&P!==null&&P.type===S4&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case $6:e:{for(var F=P.key,q=T;q!==null;){if(q.key===F){if(F=P.type,F===S4){if(q.tag===7){n(E,q.sibling),T=a(q,P.props.children),T.return=E,E=T;break e}}else if(q.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===y0&&hbe(F)===q.type){n(E,q.sibling),T=a(q,P.props),T.ref=SM(E,q,P),T.return=E,E=T;break e}n(E,q);break}else e(E,q);q=q.sibling}P.type===S4?(T=lj(P.props.children,E.mode,z,P.key),T.return=E,E=T):(z=fO(P.type,P.key,P.props,null,E.mode,z),z.ref=SM(E,T,P),z.return=E,E=z)}return l(E);case N4:e:{for(q=P.key;T!==null;){if(T.key===q)if(T.tag===4&&T.stateNode.containerInfo===P.containerInfo&&T.stateNode.implementation===P.implementation){n(E,T.sibling),T=a(T,P.children||[]),T.return=E,E=T;break e}else{n(E,T);break}else e(E,T);T=T.sibling}T=ule(P,E.mode,z),T.return=E,E=T}return l(E);case y0:return q=P._init,A(E,T,q(P._payload),z)}if(rT(P))return C(E,T,P,z);if(bM(P))return N(E,T,P,z);Q6(E,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,T!==null&&T.tag===6?(n(E,T.sibling),T=a(T,P),T.return=E,E=T):(n(E,T),T=dle(P,E.mode,z),T.return=E,E=T),l(E)):n(E,T)}return A}var eC=HMe(!0),WMe=HMe(!1),Cee=ev(null),Mee=null,L4=null,dme=null;function ume(){dme=L4=Mee=null}function hme(t){var e=Cee.current;pl(Cee),t._currentValue=e}function Ude(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 Z4(t,e){Mee=t,dme=L4=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(fh=!0),t.firstContext=null)}function ap(t){var e=t._currentValue;if(dme!==t)if(t={context:t,memoizedValue:e,next:null},L4===null){if(Mee===null)throw Error(Cn(308));L4=t,Mee.dependencies={lanes:0,firstContext:t}}else L4=L4.next=t;return e}var Fw=null;function fme(t){Fw===null?Fw=[t]:Fw.push(t)}function GMe(t,e,n,s){var a=e.interleaved;return a===null?(n.next=n,fme(e)):(n.next=a.next,a.next=n),e.interleaved=n,sy(t,s)}function sy(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 v0=!1;function pme(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function KMe(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 Bx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function o1(t,e,n){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,Qi&2){var a=s.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),s.pending=e,sy(t,n)}return a=s.interleaved,a===null?(e.next=e,fme(s)):(e.next=a.next,a.next=e),s.interleaved=e,sy(t,n)}function oO(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,Jpe(t,n)}}function fbe(t,e){var n=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?a=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?a=o=e:o=o.next=e}else a=o=e;n={baseState:s.baseState,firstBaseUpdate:a,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 Tee(t,e,n,s){var a=t.updateQueue;v0=!1;var o=a.firstBaseUpdate,l=a.lastBaseUpdate,i=a.shared.pending;if(i!==null){a.shared.pending=null;var h=i,p=h.next;h.next=null,l===null?o=p:l.next=p,l=h;var x=t.alternate;x!==null&&(x=x.updateQueue,i=x.lastBaseUpdate,i!==l&&(i===null?x.firstBaseUpdate=p:i.next=p,x.lastBaseUpdate=h))}if(o!==null){var y=a.baseState;l=0,x=p=h=null,i=o;do{var _=i.lane,j=i.eventTime;if((s&_)===_){x!==null&&(x=x.next={eventTime:j,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var C=t,N=i;switch(_=e,j=n,N.tag){case 1:if(C=N.payload,typeof C=="function"){y=C.call(j,y,_);break e}y=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=N.payload,_=typeof C=="function"?C.call(j,y,_):C,_==null)break e;y=Bl({},y,_);break e;case 2:v0=!0}}i.callback!==null&&i.lane!==0&&(t.flags|=64,_=a.effects,_===null?a.effects=[i]:_.push(i))}else j={eventTime:j,lane:_,tag:i.tag,payload:i.payload,callback:i.callback,next:null},x===null?(p=x=j,h=y):x=x.next=j,l|=_;if(i=i.next,i===null){if(i=a.shared.pending,i===null)break;_=i,i=_.next,_.next=null,a.lastBaseUpdate=_,a.shared.pending=null}}while(!0);if(x===null&&(h=y),a.baseState=h,a.firstBaseUpdate=p,a.lastBaseUpdate=x,e=a.shared.interleaved,e!==null){a=e;do l|=a.lane,a=a.next;while(a!==e)}else o===null&&(a.shared.lanes=0);Oj|=l,t.lanes=l,t.memoizedState=y}}function pbe(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var s=ale.transition;ale.transition={};try{t(!1),e()}finally{So=n,ale.transition=s}}function uTe(){return ip().memoizedState}function RGe(t,e,n){var s=c1(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},hTe(t))fTe(e,n);else if(n=GMe(t,e,n,s),n!==null){var a=zu();fm(n,t,s,a),pTe(n,e,s)}}function FGe(t,e,n){var s=c1(t),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(hTe(t))fTe(e,a);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var l=e.lastRenderedState,i=o(l,n);if(a.hasEagerState=!0,a.eagerState=i,bm(i,l)){var h=e.interleaved;h===null?(a.next=a,fme(e)):(a.next=h.next,h.next=a),e.interleaved=a;return}}catch{}finally{}n=GMe(t,e,a,s),n!==null&&(a=zu(),fm(n,t,s,a),pTe(n,e,s))}}function hTe(t){var e=t.alternate;return t===Rl||e!==null&&e===Rl}function fTe(t,e){bT=Eee=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function pTe(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Jpe(t,n)}}var Iee={readContext:ap,useCallback:Zd,useContext:Zd,useEffect:Zd,useImperativeHandle:Zd,useInsertionEffect:Zd,useLayoutEffect:Zd,useMemo:Zd,useReducer:Zd,useRef:Zd,useState:Zd,useDebugValue:Zd,useDeferredValue:Zd,useTransition:Zd,useMutableSource:Zd,useSyncExternalStore:Zd,useId:Zd,unstable_isNewReconciler:!1},zGe={readContext:ap,useCallback:function(t,e){return Jm().memoizedState=[t,e===void 0?null:e],t},useContext:ap,useEffect:gbe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,cO(4194308,4,iTe.bind(null,e,t),n)},useLayoutEffect:function(t,e){return cO(4194308,4,t,e)},useInsertionEffect:function(t,e){return cO(4,2,t,e)},useMemo:function(t,e){var n=Jm();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=Jm();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=RGe.bind(null,Rl,t),[s.memoizedState,t]},useRef:function(t){var e=Jm();return t={current:t},e.memoizedState=t},useState:mbe,useDebugValue:wme,useDeferredValue:function(t){return Jm().memoizedState=t},useTransition:function(){var t=mbe(!1),e=t[0];return t=DGe.bind(null,t[1]),Jm().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=Rl,a=Jm();if(Nl){if(n===void 0)throw Error(Cn(407));n=n()}else{if(n=e(),hd===null)throw Error(Cn(349));Lj&30||QMe(s,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,gbe(eTe.bind(null,s,o,t),[t]),s.flags|=2048,qA(9,JMe.bind(null,s,o,n,e),void 0,null),n},useId:function(){var t=Jm(),e=hd.identifierPrefix;if(Nl){var n=Lx,s=Px;n=(s&~(1<<32-hm(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=$A++,0<\/script>",t=t.removeChild(t.firstChild)):typeof s.is=="string"?t=l.createElement(n,{is:s.is}):(t=l.createElement(n),n==="select"&&(l=t,s.multiple?l.multiple=!0:s.size&&(l.size=s.size))):t=l.createElementNS(t,n),t[og]=e,t[FA]=s,kTe(t,e,!1,!1),e.stateNode=t;e:{switch(l=kde(n,s),n){case"dialog":ll("cancel",t),ll("close",t),a=s;break;case"iframe":case"object":case"embed":ll("load",t),a=s;break;case"video":case"audio":for(a=0;anC&&(e.flags|=128,s=!0,CM(o,!1),e.lanes=4194304)}else{if(!s)if(t=Aee(l),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),CM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Nl)return Yd(e),null}else 2*cc()-o.renderingStartTime>nC&&n!==1073741824&&(e.flags|=128,s=!0,CM(o,!1),e.lanes=4194304);o.isBackwards?(l.sibling=e.child,e.child=l):(n=o.last,n!==null?n.sibling=l:e.child=l,o.last=l)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=cc(),e.sibling=null,n=Il.current,Xo(Il,s?n&1|2:n&1),e):(Yd(e),null);case 22:case 23:return Mme(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?Uh&1073741824&&(Yd(e),e.subtreeFlags&6&&(e.flags|=8192)):Yd(e),null;case 24:return null;case 25:return null}throw Error(Cn(156,e.tag))}function GGe(t,e){switch(lme(e),e.tag){case 1:return xh(e.type)&&jee(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return tC(),pl(gh),pl(pu),xme(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return gme(e),null;case 13:if(pl(Il),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Cn(340));JS()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return pl(Il),null;case 4:return tC(),null;case 10:return hme(e.type._context),null;case 22:case 23:return Mme(),null;case 24:return null;default:return null}}var eL=!1,eu=!1,KGe=typeof WeakSet=="function"?WeakSet:Set,ys=null;function O4(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Wl(t,e,s)}else n.current=null}function Xde(t,e,n){try{n()}catch(s){Wl(t,e,s)}}var Cbe=!1;function ZGe(t,e){if(Lde=vee,t=EMe(),ime(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 a=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,i=-1,h=-1,p=0,x=0,y=t,_=null;t:for(;;){for(var j;y!==n||a!==0&&y.nodeType!==3||(i=l+a),y!==o||s!==0&&y.nodeType!==3||(h=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(j=y.firstChild)!==null;)_=y,y=j;for(;;){if(y===t)break t;if(_===n&&++p===a&&(i=l),_===o&&++x===s&&(h=l),(j=y.nextSibling)!==null)break;y=_,_=y.parentNode}y=j}n=i===-1||h===-1?null:{start:i,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ode={focusedElem:t,selectionRange:n},vee=!1,ys=e;ys!==null;)if(e=ys,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ys=t;else for(;ys!==null;){e=ys;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 N=C.memoizedProps,A=C.memoizedState,E=e.stateNode,T=E.getSnapshotBeforeUpdate(e.elementType===e.type?N:Kp(e.type,N),A);E.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var P=e.stateNode.containerInfo;P.nodeType===1?P.textContent="":P.nodeType===9&&P.documentElement&&P.removeChild(P.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Cn(163))}}catch(z){Wl(e,e.return,z)}if(t=e.sibling,t!==null){t.return=e.return,ys=t;break}ys=e.return}return C=Cbe,Cbe=!1,C}function wT(t,e,n){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var o=a.destroy;a.destroy=void 0,o!==void 0&&Xde(e,n,o)}a=a.next}while(a!==s)}}function xne(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 Qde(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 CTe(t){var e=t.alternate;e!==null&&(t.alternate=null,CTe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[og],delete e[FA],delete e[Fde],delete e[EGe],delete e[IGe])),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 MTe(t){return t.tag===5||t.tag===3||t.tag===4}function Mbe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||MTe(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 Jde(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=wee));else if(s!==4&&(t=t.child,t!==null))for(Jde(t,e,n),t=t.sibling;t!==null;)Jde(t,e,n),t=t.sibling}function eue(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(eue(t,e,n),t=t.sibling;t!==null;)eue(t,e,n),t=t.sibling}var Ad=null,Qp=!1;function l0(t,e,n){for(n=n.child;n!==null;)TTe(t,e,n),n=n.sibling}function TTe(t,e,n){if(pg&&typeof pg.onCommitFiberUnmount=="function")try{pg.onCommitFiberUnmount(cne,n)}catch{}switch(n.tag){case 5:eu||O4(n,e);case 6:var s=Ad,a=Qp;Ad=null,l0(t,e,n),Ad=s,Qp=a,Ad!==null&&(Qp?(t=Ad,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ad.removeChild(n.stateNode));break;case 18:Ad!==null&&(Qp?(t=Ad,n=n.stateNode,t.nodeType===8?rle(t.parentNode,n):t.nodeType===1&&rle(t,n),PA(t)):rle(Ad,n.stateNode));break;case 4:s=Ad,a=Qp,Ad=n.stateNode.containerInfo,Qp=!0,l0(t,e,n),Ad=s,Qp=a;break;case 0:case 11:case 14:case 15:if(!eu&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){a=s=s.next;do{var o=a,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&Xde(n,e,l),a=a.next}while(a!==s)}l0(t,e,n);break;case 1:if(!eu&&(O4(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){Wl(n,e,i)}l0(t,e,n);break;case 21:l0(t,e,n);break;case 22:n.mode&1?(eu=(s=eu)||n.memoizedState!==null,l0(t,e,n),eu=s):l0(t,e,n);break;default:l0(t,e,n)}}function Tbe(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 a=sKe.bind(null,t,s);n.has(s)||(n.add(s),s.then(a,a))})}}function $p(t,e){var n=e.deletions;if(n!==null)for(var s=0;sa&&(a=l),s&=~o}if(s=a,s=cc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*XGe(s/1960))-s,10t?16:t,K0===null)var s=!1;else{if(t=K0,K0=null,Oee=0,Qi&6)throw Error(Cn(331));var a=Qi;for(Qi|=4,ys=t.current;ys!==null;){var o=ys,l=o.child;if(ys.flags&16){var i=o.deletions;if(i!==null){for(var h=0;hcc()-Sme?oj(t,0):Nme|=n),yh(t,e)}function RTe(t,e){e===0&&(t.mode&1?(e=H6,H6<<=1,!(H6&130023424)&&(H6=4194304)):e=1);var n=zu();t=sy(t,e),t!==null&&(aI(t,e,n),yh(t,n))}function nKe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),RTe(t,n)}function sKe(t,e){var n=0;switch(t.tag){case 13:var s=t.stateNode,a=t.memoizedState;a!==null&&(n=a.retryLane);break;case 19:s=t.stateNode;break;default:throw Error(Cn(314))}s!==null&&s.delete(e),RTe(t,n)}var FTe;FTe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||gh.current)fh=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return fh=!1,HGe(t,e,n);fh=!!(t.flags&131072)}else fh=!1,Nl&&e.flags&1048576&&UMe(e,See,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;dO(t,e),t=e.pendingProps;var a=QS(e,pu.current);Z4(e,n),a=vme(null,e,s,t,a,n);var o=_me();return e.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,xh(s)?(o=!0,kee(e)):o=!1,e.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,pme(e),a.updater=gne,e.stateNode=a,a._reactInternals=e,Vde(e,s,t,n),e=Gde(null,e,s,!0,o,n)):(e.tag=0,Nl&&o&&ome(e),Eu(null,e,a,n),e=e.child),e;case 16:s=e.elementType;e:{switch(dO(t,e),t=e.pendingProps,a=s._init,s=a(s._payload),e.type=s,a=e.tag=iKe(s),t=Kp(s,t),a){case 0:e=Wde(null,e,s,t,n);break e;case 1:e=kbe(null,e,s,t,n);break e;case 11:e=wbe(null,e,s,t,n);break e;case 14:e=jbe(null,e,s,Kp(s.type,t),n);break e}throw Error(Cn(306,s,""))}return e;case 0:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Kp(s,a),Wde(t,e,s,a,n);case 1:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Kp(s,a),kbe(t,e,s,a,n);case 3:e:{if(bTe(e),t===null)throw Error(Cn(387));s=e.pendingProps,o=e.memoizedState,a=o.element,KMe(t,e),Tee(e,s,null,n);var l=e.memoizedState;if(s=l.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){a=rC(Error(Cn(423)),e),e=Nbe(t,e,s,n,a);break e}else if(s!==a){a=rC(Error(Cn(424)),e),e=Nbe(t,e,s,n,a);break e}else for(Xh=i1(e.stateNode.containerInfo.firstChild),Qh=e,Nl=!0,rm=null,n=WMe(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(JS(),s===a){e=ay(t,e,n);break e}Eu(t,e,s,n)}e=e.child}return e;case 5:return ZMe(e),t===null&&$de(e),s=e.type,a=e.pendingProps,o=t!==null?t.memoizedProps:null,l=a.children,Dde(s,a)?l=null:o!==null&&Dde(s,o)&&(e.flags|=32),_Te(t,e),Eu(t,e,l,n),e.child;case 6:return t===null&&$de(e),null;case 13:return wTe(t,e,n);case 4:return mme(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=eC(e,null,s,n):Eu(t,e,s,n),e.child;case 11:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Kp(s,a),wbe(t,e,s,a,n);case 7:return Eu(t,e,e.pendingProps,n),e.child;case 8:return Eu(t,e,e.pendingProps.children,n),e.child;case 12:return Eu(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(s=e.type._context,a=e.pendingProps,o=e.memoizedProps,l=a.value,Xo(Cee,s._currentValue),s._currentValue=l,o!==null)if(bm(o.value,l)){if(o.children===a.children&&!gh.current){e=ay(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var i=o.dependencies;if(i!==null){l=o.child;for(var h=i.firstContext;h!==null;){if(h.context===s){if(o.tag===1){h=Bx(-1,n&-n),h.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?h.next=h:(h.next=x.next,x.next=h),p.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Ude(o.return,n,e),i.lanes|=n;break}h=h.next}}else if(o.tag===10)l=o.type===e.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(Cn(341));l.lanes|=n,i=l.alternate,i!==null&&(i.lanes|=n),Ude(l,n,e),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===e){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}Eu(t,e,a.children,n),e=e.child}return e;case 9:return a=e.type,s=e.pendingProps.children,Z4(e,n),a=ap(a),s=s(a),e.flags|=1,Eu(t,e,s,n),e.child;case 14:return s=e.type,a=Kp(s,e.pendingProps),a=Kp(s.type,a),jbe(t,e,s,a,n);case 15:return yTe(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Kp(s,a),dO(t,e),e.tag=1,xh(s)?(t=!0,kee(e)):t=!1,Z4(e,n),mTe(e,s,a),Vde(e,s,a,n),Gde(null,e,s,!0,t,n);case 19:return jTe(t,e,n);case 22:return vTe(t,e,n)}throw Error(Cn(156,e.tag))};function zTe(t,e){return hMe(t,e)}function aKe(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 Hf(t,e,n,s){return new aKe(t,e,n,s)}function Ame(t){return t=t.prototype,!(!t||!t.isReactComponent)}function iKe(t){if(typeof t=="function")return Ame(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Zpe)return 11;if(t===Ype)return 14}return 2}function d1(t,e){var n=t.alternate;return n===null?(n=Hf(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 fO(t,e,n,s,a,o){var l=2;if(s=t,typeof t=="function")Ame(t)&&(l=1);else if(typeof t=="string")l=5;else e:switch(t){case S4:return lj(n.children,a,o,e);case Kpe:l=8,a|=8;break;case pde:return t=Hf(12,n,e,a|2),t.elementType=pde,t.lanes=o,t;case mde:return t=Hf(13,n,e,a),t.elementType=mde,t.lanes=o,t;case gde:return t=Hf(19,n,e,a),t.elementType=gde,t.lanes=o,t;case Z5e:return vne(n,a,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case G5e:l=10;break e;case K5e:l=9;break e;case Zpe:l=11;break e;case Ype:l=14;break e;case y0:l=16,s=null;break e}throw Error(Cn(130,t==null?t:typeof t,""))}return e=Hf(l,n,e,a),e.elementType=t,e.type=s,e.lanes=o,e}function lj(t,e,n,s){return t=Hf(7,t,s,e),t.lanes=n,t}function vne(t,e,n,s){return t=Hf(22,t,s,e),t.elementType=Z5e,t.lanes=n,t.stateNode={isHidden:!1},t}function dle(t,e,n){return t=Hf(6,t,null,e),t.lanes=n,t}function ule(t,e,n){return e=Hf(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function oKe(t,e,n,s,a){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=Hoe(0),this.expirationTimes=Hoe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hoe(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Eme(t,e,n,s,a,o,l,i,h){return t=new oKe(t,e,n,i,h),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Hf(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},pme(o),t}function lKe(t,e,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qTe)}catch(t){console.error(t)}}qTe(),q5e.exports=ff;var gy=q5e.exports;const Ome=Hi(gy);var VTe,Rbe=gy;VTe=Rbe.createRoot,Rbe.hydrateRoot;const fKe=1,pKe=1e6;let hle=0;function mKe(){return hle=(hle+1)%Number.MAX_SAFE_INTEGER,hle.toString()}const fle=new Map,Fbe=t=>{if(fle.has(t))return;const e=setTimeout(()=>{fle.delete(t),NT({type:"REMOVE_TOAST",toastId:t})},pKe);fle.set(t,e)},gKe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,fKe)};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?Fbe(n):t.toasts.forEach(s=>{Fbe(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)}}},pO=[];let mO={toasts:[]};function NT(t){mO=gKe(mO,t),pO.forEach(e=>{e(mO)})}function ma({...t}){const e=mKe(),n=a=>NT({type:"UPDATE_TOAST",toast:{...a,id:e}}),s=()=>NT({type:"DISMISS_TOAST",toastId:e});return NT({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:a=>{a||s()}}}),{id:e,dismiss:s,update:n}}function pi(){const[t,e]=I.useState(mO);return I.useEffect(()=>(pO.push(e),()=>{const n=pO.indexOf(e);n>-1&&pO.splice(n,1)}),[t]),{...t,toast:ma,dismiss:n=>NT({type:"DISMISS_TOAST",toastId:n})}}function on(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function zbe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function iy(...t){return e=>{let n=!1;const s=t.map(a=>{const o=zbe(a,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{const{children:l,...i}=o,h=I.useMemo(()=>i,Object.values(i));return r.jsx(n.Provider,{value:h,children:l})};s.displayName=t+"Provider";function a(o){const l=I.useContext(n);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[s,a]}function rc(t,e=[]){let n=[];function s(o,l){const i=I.createContext(l),h=n.length;n=[...n,l];const p=y=>{var E;const{scope:_,children:j,...C}=y,N=((E=_==null?void 0:_[t])==null?void 0:E[h])||i,A=I.useMemo(()=>C,Object.values(C));return r.jsx(N.Provider,{value:A,children:j})};p.displayName=o+"Provider";function x(y,_){var N;const j=((N=_==null?void 0:_[t])==null?void 0:N[h])||i,C=I.useContext(j);if(C)return C;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[p,x]}const a=()=>{const o=n.map(l=>I.createContext(l));return function(i){const h=(i==null?void 0:i[t])||o;return I.useMemo(()=>({[`__scope${t}`]:{...i,[t]:h}}),[i,h])}};return a.scopeName=t,[s,yKe(a,...e)]}function yKe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=s.reduce((i,{useScope:h,scopeName:p})=>{const y=h(o)[`__scope${p}`];return{...i,...y}},{});return I.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}function z1(t){const e=vKe(t),n=I.forwardRef((s,a)=>{const{children:o,...l}=s,i=I.Children.toArray(o),h=i.find(_Ke);if(h){const p=h.props.children,x=i.map(y=>y===h?I.Children.count(p)>1?I.Children.only(null):I.isValidElement(p)?p.props.children:null:y);return r.jsx(e,{...l,ref:a,children:I.isValidElement(p)?I.cloneElement(p,void 0,x):null})}return r.jsx(e,{...l,ref:a,children:o})});return n.displayName=`${t}.Slot`,n}var Dme=z1("Slot");function vKe(t){const e=I.forwardRef((n,s)=>{const{children:a,...o}=n;if(I.isValidElement(a)){const l=wKe(a),i=bKe(o,a.props);return a.type!==I.Fragment&&(i.ref=s?iy(s,l):l),I.cloneElement(a,i)}return I.Children.count(a)>1?I.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var HTe=Symbol("radix.slottable");function WTe(t){const e=({children:n})=>r.jsx(r.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=HTe,e}function _Ke(t){return I.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===HTe}function bKe(t,e){const n={...e};for(const s in e){const a=t[s],o=e[s];/^on[A-Z]/.test(s)?a&&o?n[s]=(...i)=>{const h=o(...i);return a(...i),h}:a&&(n[s]=a):s==="style"?n[s]={...a,...o}:s==="className"&&(n[s]=[a,o].filter(Boolean).join(" "))}return{...t,...n}}function wKe(t){var s,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function cI(t){const e=t+"CollectionProvider",[n,s]=rc(e),[a,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=N=>{const{scope:A,children:E}=N,T=st.useRef(null),P=st.useRef(new Map).current;return r.jsx(a,{scope:A,itemMap:P,collectionRef:T,children:E})};l.displayName=e;const i=t+"CollectionSlot",h=z1(i),p=st.forwardRef((N,A)=>{const{scope:E,children:T}=N,P=o(i,E),z=ta(A,P.collectionRef);return r.jsx(h,{ref:z,children:T})});p.displayName=i;const x=t+"CollectionItemSlot",y="data-radix-collection-item",_=z1(x),j=st.forwardRef((N,A)=>{const{scope:E,children:T,...P}=N,z=st.useRef(null),F=ta(A,z),q=o(x,E);return st.useEffect(()=>(q.itemMap.set(z,{ref:z,...P}),()=>void q.itemMap.delete(z))),r.jsx(_,{[y]:"",ref:F,children:T})});j.displayName=x;function C(N){const A=o(t+"CollectionConsumer",N);return st.useCallback(()=>{const T=A.collectionRef.current;if(!T)return[];const P=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(A.itemMap.values()).sort((q,V)=>P.indexOf(q.ref.current)-P.indexOf(V.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:l,Slot:p,ItemSlot:j},C,s]}var jKe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=jKe.reduce((t,e)=>{const n=z1(`Primitive.${e}`),s=I.forwardRef((a,o)=>{const{asChild:l,...i}=a,h=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(h,{...i,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Rme(t,e){t&&gy.flushSync(()=>t.dispatchEvent(e))}function Ql(t){const e=I.useRef(t);return I.useEffect(()=>{e.current=t}),I.useMemo(()=>(...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)},[])}function kKe(t,e=globalThis==null?void 0:globalThis.document){const n=Ql(t);I.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[n,e])}var NKe="DismissableLayer",aue="dismissableLayer.update",SKe="dismissableLayer.pointerDownOutside",CKe="dismissableLayer.focusOutside",Bbe,GTe=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),rv=I.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...h}=t,p=I.useContext(GTe),[x,y]=I.useState(null),_=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,j]=I.useState({}),C=ta(e,V=>y(V)),N=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=N.indexOf(A),T=x?N.indexOf(x):-1,P=p.layersWithOutsidePointerEventsDisabled.size>0,z=T>=E,F=TKe(V=>{const K=V.target,G=[...p.branches].some(te=>te.contains(K));!z||G||(a==null||a(V),l==null||l(V),V.defaultPrevented||i==null||i())},_),q=AKe(V=>{const K=V.target;[...p.branches].some(te=>te.contains(K))||(o==null||o(V),l==null||l(V),V.defaultPrevented||i==null||i())},_);return kKe(V=>{T===p.layers.size-1&&(s==null||s(V),!V.defaultPrevented&&i&&(V.preventDefault(),i()))},_),I.useEffect(()=>{if(x)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Bbe=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),$be(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=Bbe)}},[x,_,n,p]),I.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),$be())},[x,p]),I.useEffect(()=>{const V=()=>j({});return document.addEventListener(aue,V),()=>document.removeEventListener(aue,V)},[]),r.jsx(Rn.div,{...h,ref:C,style:{pointerEvents:P?z?"auto":"none":void 0,...t.style},onFocusCapture:on(t.onFocusCapture,q.onFocusCapture),onBlurCapture:on(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:on(t.onPointerDownCapture,F.onPointerDownCapture)})});rv.displayName=NKe;var MKe="DismissableLayerBranch",KTe=I.forwardRef((t,e)=>{const n=I.useContext(GTe),s=I.useRef(null),a=ta(e,s);return I.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Rn.div,{...t,ref:a})});KTe.displayName=MKe;function TKe(t,e=globalThis==null?void 0:globalThis.document){const n=Ql(t),s=I.useRef(!1),a=I.useRef(()=>{});return I.useEffect(()=>{const o=i=>{if(i.target&&!s.current){let h=function(){ZTe(SKe,n,p,{discrete:!0})};const p={originalEvent:i};i.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=h,e.addEventListener("click",a.current,{once:!0})):h()}else e.removeEventListener("click",a.current);s.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",o),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>s.current=!0}}function AKe(t,e=globalThis==null?void 0:globalThis.document){const n=Ql(t),s=I.useRef(!1);return I.useEffect(()=>{const a=o=>{o.target&&!s.current&&ZTe(CKe,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function $be(){const t=new CustomEvent(aue);document.dispatchEvent(t)}function ZTe(t,e,n,{discrete:s}){const a=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),s?Rme(a,o):a.dispatchEvent(o)}var EKe=rv,IKe=KTe,ec=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},PKe="Portal",ZC=I.forwardRef((t,e)=>{var i;const{container:n,...s}=t,[a,o]=I.useState(!1);ec(()=>o(!0),[]);const l=n||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?Ome.createPortal(r.jsx(Rn.div,{...s,ref:e}),l):null});ZC.displayName=PKe;function LKe(t,e){return I.useReducer((n,s)=>e[n][s]??n,t)}var xc=t=>{const{present:e,children:n}=t,s=OKe(e),a=typeof n=="function"?n({present:s.isPresent}):I.Children.only(n),o=ta(s.ref,DKe(a));return typeof n=="function"||s.isPresent?I.cloneElement(a,{ref:o}):null};xc.displayName="Presence";function OKe(t){const[e,n]=I.useState(),s=I.useRef(null),a=I.useRef(t),o=I.useRef("none"),l=t?"mounted":"unmounted",[i,h]=LKe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const p=nL(s.current);o.current=i==="mounted"?p:"none"},[i]),ec(()=>{const p=s.current,x=a.current;if(x!==t){const _=o.current,j=nL(p);t?h("MOUNT"):j==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(x&&_!==j?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,h]),ec(()=>{if(e){let p;const x=e.ownerDocument.defaultView??window,y=j=>{const N=nL(s.current).includes(j.animationName);if(j.target===e&&N&&(h("ANIMATION_END"),!a.current)){const A=e.style.animationFillMode;e.style.animationFillMode="forwards",p=x.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=A)})}},_=j=>{j.target===e&&(o.current=nL(s.current))};return e.addEventListener("animationstart",_),e.addEventListener("animationcancel",y),e.addEventListener("animationend",y),()=>{x.clearTimeout(p),e.removeEventListener("animationstart",_),e.removeEventListener("animationcancel",y),e.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[e,h]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:I.useCallback(p=>{s.current=p?getComputedStyle(p):null,n(p)},[])}}function nL(t){return(t==null?void 0:t.animationName)||"none"}function DKe(t){var s,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var RKe=Vpe[" useInsertionEffect ".trim().toString()]||ec;function $u({prop:t,defaultProp:e,onChange:n=()=>{},caller:s}){const[a,o,l]=FKe({defaultProp:e,onChange:n}),i=t!==void 0,h=i?t:a;{const x=I.useRef(t!==void 0);I.useEffect(()=>{const y=x.current;y!==i&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${i?"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.`),x.current=i},[i,s])}const p=I.useCallback(x=>{var y;if(i){const _=zKe(x)?x(t):x;_!==t&&((y=l.current)==null||y.call(l,_))}else o(x)},[i,t,o,l]);return[h,p]}function FKe({defaultProp:t,onChange:e}){const[n,s]=I.useState(t),a=I.useRef(n),o=I.useRef(e);return RKe(()=>{o.current=e},[e]),I.useEffect(()=>{var l;a.current!==n&&((l=o.current)==null||l.call(o,n),a.current=n)},[n,a]),[n,s,o]}function zKe(t){return typeof t=="function"}var YTe=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"}),BKe="VisuallyHidden",kne=I.forwardRef((t,e)=>r.jsx(Rn.span,{...t,ref:e,style:{...YTe,...t.style}}));kne.displayName=BKe;var $Ke=kne,Fme="ToastProvider",[zme,UKe,qKe]=cI("Toast"),[XTe]=rc("Toast",[qKe]),[VKe,Nne]=XTe(Fme),QTe=t=>{const{__scopeToast:e,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=t,[i,h]=I.useState(null),[p,x]=I.useState(0),y=I.useRef(!1),_=I.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Fme}\`. Expected non-empty \`string\`.`),r.jsx(zme.Provider,{scope:e,children:r.jsx(VKe,{scope:e,label:n,duration:s,swipeDirection:a,swipeThreshold:o,toastCount:p,viewport:i,onViewportChange:h,onToastAdd:I.useCallback(()=>x(j=>j+1),[]),onToastRemove:I.useCallback(()=>x(j=>j-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:_,children:l})})};QTe.displayName=Fme;var JTe="ToastViewport",HKe=["F8"],iue="toast.viewportPause",oue="toast.viewportResume",eAe=I.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:s=HKe,label:a="Notifications ({hotkey})",...o}=t,l=Nne(JTe,n),i=UKe(n),h=I.useRef(null),p=I.useRef(null),x=I.useRef(null),y=I.useRef(null),_=ta(e,y,l.onViewportChange),j=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=l.toastCount>0;I.useEffect(()=>{const A=E=>{var P;s.length!==0&&s.every(z=>E[z]||E.code===z)&&((P=y.current)==null||P.focus())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[s]),I.useEffect(()=>{const A=h.current,E=y.current;if(C&&A&&E){const T=()=>{if(!l.isClosePausedRef.current){const q=new CustomEvent(iue);E.dispatchEvent(q),l.isClosePausedRef.current=!0}},P=()=>{if(l.isClosePausedRef.current){const q=new CustomEvent(oue);E.dispatchEvent(q),l.isClosePausedRef.current=!1}},z=q=>{!A.contains(q.relatedTarget)&&P()},F=()=>{A.contains(document.activeElement)||P()};return A.addEventListener("focusin",T),A.addEventListener("focusout",z),A.addEventListener("pointermove",T),A.addEventListener("pointerleave",F),window.addEventListener("blur",T),window.addEventListener("focus",P),()=>{A.removeEventListener("focusin",T),A.removeEventListener("focusout",z),A.removeEventListener("pointermove",T),A.removeEventListener("pointerleave",F),window.removeEventListener("blur",T),window.removeEventListener("focus",P)}}},[C,l.isClosePausedRef]);const N=I.useCallback(({tabbingDirection:A})=>{const T=i().map(P=>{const z=P.ref.current,F=[z,...sZe(z)];return A==="forwards"?F:F.reverse()});return(A==="forwards"?T.reverse():T).flat()},[i]);return I.useEffect(()=>{const A=y.current;if(A){const E=T=>{var F,q,V;const P=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!P){const K=document.activeElement,G=T.shiftKey;if(T.target===A&&G){(F=p.current)==null||F.focus();return}const oe=N({tabbingDirection:G?"backwards":"forwards"}),ye=oe.findIndex(ae=>ae===K);ple(oe.slice(ye+1))?T.preventDefault():G?(q=p.current)==null||q.focus():(V=x.current)==null||V.focus()}};return A.addEventListener("keydown",E),()=>A.removeEventListener("keydown",E)}},[i,N]),r.jsxs(IKe,{ref:h,role:"region","aria-label":a.replace("{hotkey}",j),tabIndex:-1,style:{pointerEvents:C?void 0:"none"},children:[C&&r.jsx(lue,{ref:p,onFocusFromOutsideViewport:()=>{const A=N({tabbingDirection:"forwards"});ple(A)}}),r.jsx(zme.Slot,{scope:n,children:r.jsx(Rn.ol,{tabIndex:-1,...o,ref:_})}),C&&r.jsx(lue,{ref:x,onFocusFromOutsideViewport:()=>{const A=N({tabbingDirection:"backwards"});ple(A)}})]})});eAe.displayName=JTe;var tAe="ToastFocusProxy",lue=I.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=t,o=Nne(tAe,n);return r.jsx(kne,{"aria-hidden":!0,tabIndex:0,...a,ref:e,style:{position:"fixed"},onFocus:l=>{var p;const i=l.relatedTarget;!((p=o.viewport)!=null&&p.contains(i))&&s()}})});lue.displayName=tAe;var dI="Toast",WKe="toast.swipeStart",GKe="toast.swipeMove",KKe="toast.swipeCancel",ZKe="toast.swipeEnd",rAe=I.forwardRef((t,e)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:o,...l}=t,[i,h]=$u({prop:s,defaultProp:a??!0,onChange:o,caller:dI});return r.jsx(xc,{present:n||i,children:r.jsx(QKe,{open:i,...l,ref:e,onClose:()=>h(!1),onPause:Ql(t.onPause),onResume:Ql(t.onResume),onSwipeStart:on(t.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:on(t.onSwipeMove,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","move"),p.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:on(t.onSwipeCancel,p=>{p.currentTarget.setAttribute("data-swipe","cancel"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:on(t.onSwipeEnd,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),h(!1)})})})});rAe.displayName=dI;var[YKe,XKe]=XTe(dI,{onClose(){}}),QKe=I.forwardRef((t,e)=>{const{__scopeToast:n,type:s="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:h,onResume:p,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:_,onSwipeEnd:j,...C}=t,N=Nne(dI,n),[A,E]=I.useState(null),T=ta(e,ae=>E(ae)),P=I.useRef(null),z=I.useRef(null),F=a||N.duration,q=I.useRef(0),V=I.useRef(F),K=I.useRef(0),{onToastAdd:G,onToastRemove:te}=N,ie=Ql(()=>{var pe;(A==null?void 0:A.contains(document.activeElement))&&((pe=N.viewport)==null||pe.focus()),l()}),oe=I.useCallback(ae=>{!ae||ae===1/0||(window.clearTimeout(K.current),q.current=new Date().getTime(),K.current=window.setTimeout(ie,ae))},[ie]);I.useEffect(()=>{const ae=N.viewport;if(ae){const pe=()=>{oe(V.current),p==null||p()},se=()=>{const he=new Date().getTime()-q.current;V.current=V.current-he,window.clearTimeout(K.current),h==null||h()};return ae.addEventListener(iue,se),ae.addEventListener(oue,pe),()=>{ae.removeEventListener(iue,se),ae.removeEventListener(oue,pe)}}},[N.viewport,F,h,p,oe]),I.useEffect(()=>{o&&!N.isClosePausedRef.current&&oe(F)},[o,F,N.isClosePausedRef,oe]),I.useEffect(()=>(G(),()=>te()),[G,te]);const ye=I.useMemo(()=>A?cAe(A):null,[A]);return N.viewport?r.jsxs(r.Fragment,{children:[ye&&r.jsx(JKe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:ye}),r.jsx(YKe,{scope:n,onClose:ie,children:gy.createPortal(r.jsx(zme.ItemSlot,{scope:n,children:r.jsx(EKe,{asChild:!0,onEscapeKeyDown:on(i,()=>{N.isFocusedToastEscapeKeyDownRef.current||ie(),N.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Rn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":N.swipeDirection,...C,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:on(t.onKeyDown,ae=>{ae.key==="Escape"&&(i==null||i(ae.nativeEvent),ae.nativeEvent.defaultPrevented||(N.isFocusedToastEscapeKeyDownRef.current=!0,ie()))}),onPointerDown:on(t.onPointerDown,ae=>{ae.button===0&&(P.current={x:ae.clientX,y:ae.clientY})}),onPointerMove:on(t.onPointerMove,ae=>{if(!P.current)return;const pe=ae.clientX-P.current.x,se=ae.clientY-P.current.y,he=!!z.current,ue=["left","right"].includes(N.swipeDirection),_e=["left","up"].includes(N.swipeDirection)?Math.min:Math.max,Ae=ue?_e(0,pe):0,Ce=ue?0:_e(0,se),Se=ae.pointerType==="touch"?10:2,ge={x:Ae,y:Ce},Le={originalEvent:ae,delta:ge};he?(z.current=ge,sL(GKe,y,Le,{discrete:!1})):Ube(ge,N.swipeDirection,Se)?(z.current=ge,sL(WKe,x,Le,{discrete:!1}),ae.target.setPointerCapture(ae.pointerId)):(Math.abs(pe)>Se||Math.abs(se)>Se)&&(P.current=null)}),onPointerUp:on(t.onPointerUp,ae=>{const pe=z.current,se=ae.target;if(se.hasPointerCapture(ae.pointerId)&&se.releasePointerCapture(ae.pointerId),z.current=null,P.current=null,pe){const he=ae.currentTarget,ue={originalEvent:ae,delta:pe};Ube(pe,N.swipeDirection,N.swipeThreshold)?sL(ZKe,j,ue,{discrete:!0}):sL(KKe,_,ue,{discrete:!0}),he.addEventListener("click",_e=>_e.preventDefault(),{once:!0})}})})})}),N.viewport)})]}):null}),JKe=t=>{const{__scopeToast:e,children:n,...s}=t,a=Nne(dI,e),[o,l]=I.useState(!1),[i,h]=I.useState(!1);return rZe(()=>l(!0)),I.useEffect(()=>{const p=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(p)},[]),i?null:r.jsx(ZC,{asChild:!0,children:r.jsx(kne,{...s,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},eZe="ToastTitle",nAe=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});nAe.displayName=eZe;var tZe="ToastDescription",sAe=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});sAe.displayName=tZe;var aAe="ToastAction",iAe=I.forwardRef((t,e)=>{const{altText:n,...s}=t;return n.trim()?r.jsx(lAe,{altText:n,asChild:!0,children:r.jsx(Bme,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${aAe}\`. Expected non-empty \`string\`.`),null)});iAe.displayName=aAe;var oAe="ToastClose",Bme=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t,a=XKe(oAe,n);return r.jsx(lAe,{asChild:!0,children:r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:on(t.onClick,a.onClose)})})});Bme.displayName=oAe;var lAe=I.forwardRef((t,e)=>{const{__scopeToast:n,altText:s,...a}=t;return r.jsx(Rn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:e})});function cAe(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),nZe(s)){const a=s.ariaHidden||s.hidden||s.style.display==="none",o=s.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const l=s.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...cAe(s))}}),e}function sL(t,e,n,{discrete:s}){const a=n.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),s?Rme(a,o):a.dispatchEvent(o)}var Ube=(t,e,n=0)=>{const s=Math.abs(t.x),a=Math.abs(t.y),o=s>a;return e==="left"||e==="right"?o&&s>n:!o&&a>n};function rZe(t=()=>{}){const e=Ql(t);ec(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[e])}function nZe(t){return t.nodeType===t.ELEMENT_NODE}function sZe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function ple(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var aZe=QTe,dAe=eAe,uAe=rAe,hAe=nAe,fAe=sAe,pAe=iAe,mAe=Bme;function gAe(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Vbe=si,YC=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return Vbe(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=e,l=Object.keys(a).map(p=>{const x=n==null?void 0:n[p],y=o==null?void 0:o[p];if(x===null)return null;const _=qbe(x)||qbe(y);return a[p][_]}),i=n&&Object.entries(n).reduce((p,x)=>{let[y,_]=x;return _===void 0||(p[y]=_),p},{}),h=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((p,x)=>{let{class:y,className:_,...j}=x;return Object.entries(j).every(C=>{let[N,A]=C;return Array.isArray(A)?A.includes({...o,...i}[N]):{...o,...i}[N]===A})?[...p,y,_]:p},[]);return Vbe(t,l,h,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 iZe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xAe=(...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 oZe={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 yAe=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:l,...i},h)=>I.createElement("svg",{ref:h,...oZe,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:xAe("lucide",a),...i},[...l.map(([p,x])=>I.createElement(p,x)),...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=I.forwardRef(({className:s,...a},o)=>I.createElement(yAe,{ref:o,iconNode:e,className:xAe(`lucide-${iZe(t)}`,s),...a}));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 gO=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 xO=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 yO=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 vO=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 gg=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 _O=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 bO=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 p_=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 m_=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 wO=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 g_=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 jO=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 kO=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 NO=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 SO=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 CO=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 X4=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 MO=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 TO=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 AO=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 EO=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 IO=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 PO=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 LO=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 OO=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 DO=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 RO=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 FO=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 Q4=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 J4=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 zO=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 BO=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 $O=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 UO=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 qO=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 VO=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 HO=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 WO=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 GO=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 KO=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 ZO=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 YO=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 XO=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 QO=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 JO=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 e8=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 t8=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 r8=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 n8=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 s8=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 a8=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 i8=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 o8=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 l8=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 c8=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 d8=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 u8=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 h8=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 f8=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 p8=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 m8=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 g8=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 x8=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 y8=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 v8=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 _8=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 x_=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 b8=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 w8=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 j8=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 k8=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 N8=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 S8=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 C8=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 y_=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 v_=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 $x=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 M8=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 T8=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 A8=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 so=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 E8=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 I8=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 P8=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 hl=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 L8=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 O8=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 __=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 xg=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 D8=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 R8=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 F8=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 b_=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 z8=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 B8=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 $8=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 w_=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 Zf=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 U8=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 q8=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 V8=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 H8=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 W8=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 G8=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 Ol=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 K8=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 j_=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 Z8=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 Y8=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 X8=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 Q8=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 k_=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 J8=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 eD=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 tD=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 rD=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 nD=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 sD=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 aD=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 iD=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 oD=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 lD=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 cD=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 dD=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 uD=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 hD=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 fD=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 pD=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 mD=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 gD=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 yD=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 vD=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 u1=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 _D=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 bD=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 wD=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 jD=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 kD=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 ND=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 SD=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 CD=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 MD=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 TD=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 AD=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 h1=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 ED=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 ID=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 PD=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 LD=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 OD=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 DD=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 cj=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 RD=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 FD=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 yg=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 N_=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 S_=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 zD=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 BD=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 $D=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 UD=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 qD=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 VD=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 HD=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 WD=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 GD=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 KD=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 ZD=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 YD=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 XD=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 QD=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 JD=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 eR=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 eS=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 tR=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 rR=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 nR=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 sR=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 aR=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 iR=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 oR=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 C_=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 lR=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 cR=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 dR=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 uR=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 hR=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 fR=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 pR=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 mR=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 gR=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 xR=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 CT=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 yR=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 vR=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 _R=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 bR=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 wR=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 jR=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 kR=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 NR=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 SR=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 CR=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 MT=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 MR=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 pm=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 TR=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 AR=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 ER=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 tS=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 IR=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 M_=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 LR=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 OR=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 DR=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 TT=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 RR=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 FR=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 zR=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 BR=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 vh=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 $R=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 UR=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 qR=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 VR=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 HR=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 ai=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 dj=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 WR=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 GR=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 KR=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 ZR=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 YR=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 Jh=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 XR=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 QR=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 JR=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 eF=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 tF=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 rF=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 AT=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 nF=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 mm=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 sF=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 aF=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 iF=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 oF=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 lF=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 cF=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 uj=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 dF=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 uF=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 hF=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 fF=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 pF=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 Os=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 mF=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 vg=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 gF=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 xF=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 yF=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 vF=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 _F=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 bF=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 wF=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 jF=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 kF=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 NF=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 SF=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 CF=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 MF=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 TF=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 AF=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 EF=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 IF=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 PF=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 A_=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 E_=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 LF=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 OF=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 DF=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 I_=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 P_=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 L_=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 RF=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 FF=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 dc=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 zF=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 D_=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 BF=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 $F=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 R_=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 F_=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 UF=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 z_=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 B_=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 $_=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 qF=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 VF=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 Ai=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 HF=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 WF=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 Fd=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 GF=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 KF=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 Ac=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 Vi=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 f1=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 ZF=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 YF=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 XF=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 QF=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 JF=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 ez=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 tz=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 p1=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 rz=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 nz=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 sz=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 az=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 iz=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 fl=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 U_=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 q_=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 V_=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 H_=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 W_=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 G_=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 K_=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 Z_=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 Yi=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 Xi=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 Y_=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 X_=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 Q_=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 J_=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 oz=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 e2=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 lz=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 cz=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 dz=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 uz=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 hz=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 fz=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 pz=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 t2=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 Cx=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 r2=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 mz=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 n2=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 s2=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 a2=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 i2=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 $f=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 o2=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 l2=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 c2=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 gz=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 d2=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 u2=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 h2=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 Vc=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 Bu=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 xz=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 yz=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 vz=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 ET=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 _z=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 IT=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 bz=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 wz=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 f2=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 p2=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 jz=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 kz=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 Nz=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 Sz=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 Cz=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 Mz=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 Tz=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 Az=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 Ez=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 Iz=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 Pz=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 Lz=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 Oz=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 Dz=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 Rz=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 Fz=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 zz=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 Bz=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 $z=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 Ya=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 Uz=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 qz=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 m2=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 Vz=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 Hz=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 Wz=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 Gz=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 Kz=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 Zz=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 Yz=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 Xz=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 Qz=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 Jz=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 e7=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 t7=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 g2=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 r7=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 n7=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 Ox=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 s7=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 x2=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 hj=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 a7=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 i7=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 fj=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 o7=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 l7=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 y2=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 v2=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 c7=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 d7=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 u7=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 h7=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 f7=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 p7=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 m7=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 g7=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 x7=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 _2=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 y7=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 v7=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 _7=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 b7=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 w7=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 j7=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 k7=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 N7=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 S7=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 C7=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 Qo=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 M7=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 T7=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 A7=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 E7=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 I7=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 P7=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 L7=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 O7=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 D7=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 R7=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 F7=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 z7=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 gm=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 B7=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 $7=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 U7=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 q7=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 m1=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 V7=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 H7=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 W7=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 G7=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 K7=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 Z7=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 Y7=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 X7=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 Q7=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 J7=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 e9=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 t9=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 b2=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 r9=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 n9=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 s9=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 a9=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 i9=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 o9=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 l9=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 c9=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 d9=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 u9=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 h9=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 f9=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 p9=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 m9=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 g9=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 x9=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 y9=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 v9=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 _9=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 fd=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 b9=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 w9=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 pj=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 j9=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 no=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 k9=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 N9=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 S9=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 C9=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 M9=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 T9=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 A9=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 E9=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 I9=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 P9=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 L9=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 O9=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 w2=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 D9=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 R9=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 F9=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 rS=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 Mx=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 nm=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 z9=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 B9=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 $9=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 U9=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 q9=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 V9=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 H9=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 Ls=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 W9=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 g1=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 el=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 zd=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 G9=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 K9=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 Z9=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 Y9=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 X9=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 Q9=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 J9=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 eB=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 tB=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 rB=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 j2=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 nB=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 sB=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 aB=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 k2=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 N2=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 S2=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 C2=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 iB=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 oB=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 lB=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 cB=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 dB=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 M2=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 uB=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 hB=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 fB=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 pB=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 x1=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 mB=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 gB=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 xB=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 yB=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 vB=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 _B=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 bB=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 wB=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 jB=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 kB=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 NB=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 A2=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 SB=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 CB=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 MB=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 TB=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 AB=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 EB=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 IB=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 y1=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 PB=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 LB=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 OB=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 La=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 DB=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 RB=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 FB=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 zB=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 BB=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 $B=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 UB=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 qB=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 VB=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 HB=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 WB=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 GB=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 KB=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 Id=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 ZB=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 v1=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 YB=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 XB=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 QB=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 JB=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 e$=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 t$=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 r$=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 n$=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 Ux=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 s$=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 ef=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 a$=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 i$=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 o$=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 mj=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 l$=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 c$=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 d$=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 u$=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 h$=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 lm=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 f$=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 p$=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 m$=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 g$=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 x$=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 y$=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 v$=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 _$=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 b$=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 E2=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 w$=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 j$=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 k$=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 N$=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 S$=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 C$=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 M$=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 T$=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 A$=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 E$=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 I$=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 qx=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 P$=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 I2=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 L$=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 O$=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 D$=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 R$=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 F$=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 z$=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 B$=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 $$=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 U$=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 q$=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 V$=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 H$=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 W$=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 G$=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 K$=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 Z$=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 Y$=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 X$=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 Q$=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 J$=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 eU=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 tU=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 rU=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 nU=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 sU=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 aU=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 iU=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 oU=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 lU=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 gj=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 Ki=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 cU=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 dU=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 P2=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 uU=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 hU=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 fU=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 pU=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 mU=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 gU=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 xU=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 yU=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 vU=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 _U=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 bU=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 wU=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 jU=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 kU=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 NU=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 SU=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 CU=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 Vx=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 MU=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 TU=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 _1=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 AU=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 EU=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 L2=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 IU=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 $h=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 PU=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 b1=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 LU=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 OU=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 DU=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 RU=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 FU=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 zU=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 BU=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 D2=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 $U=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 UU=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 qU=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 VU=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 HU=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 WU=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 PT=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 GU=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 nS=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 KU=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 ZU=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 LT=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 OT=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 YU=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 XU=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 QU=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 JU=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 eq=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 tq=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 rq=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 nq=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 sq=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 aq=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 iq=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 oq=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 ci=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 lq=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 cq=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 dq=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 sS=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 uq=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 hq=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 fq=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 pq=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 mq=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 gq=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 xq=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 da=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 R2=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 F2=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 yq=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 vq=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 _q=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 bq=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 wq=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 aS=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 jq=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 kq=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 Pl=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 Nq=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 Sq=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 Cq=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 z2=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 B2=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 Mq=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 Tq=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 Aq=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 Eq=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 du=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 iS=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 Iq=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 Pq=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 Lq=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 Oq=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 Hx=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 xj=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 Dq=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 tf=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 Rq=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 Fq=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 zq=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 Bq=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 $q=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 Uq=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 qq=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 Vq=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 Hq=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 Wq=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 Gq=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 Kq=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 Zq=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 $2=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 Yq=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 Xq=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 Qq=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 Jq=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 eV=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 tV=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 rV=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 yj=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 Yf=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 nV=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 sV=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 aV=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 iV=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 oV=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 lV=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 cV=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 dV=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 uV=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 oS=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 lS=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 hV=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 fV=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 w1=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 pV=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 Co=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 xm=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 mV=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 gV=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 xV=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 yV=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 vV=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 _V=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 bV=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 cS=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 wV=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 jV=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 kV=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 NV=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 SV=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 CV=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 MV=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 Xf=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 en=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 TV=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 AV=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 EV=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 IV=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 DT=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 U2=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 PV=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 q2=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 Qf=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 dS=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 uS=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 LV=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 OV=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 DV=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 RV=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 FV=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 zV=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 BV=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 $V=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 UV=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 qV=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 VV=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 RT=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 ua=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 HV=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 WV=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 GV=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 KV=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 ZV=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 YV=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 XV=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 QV=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 JV=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 eH=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 tH=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 rH=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 Mo=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 nH=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 sH=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 aH=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 iH=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 oH=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 Wx=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 lH=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 ym=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 cH=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 dH=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 FT=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 uH=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 hH=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 fH=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 hS=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 pH=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 mH=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 gH=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 zT=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 xH=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 yH=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 vH=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 Fl=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 _H=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 bH=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 wH=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 jH=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 kH=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 NH=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 SH=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 CH=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 MH=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 BT=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 TH=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 AH=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 EH=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 IH=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 PH=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 Oo=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 LH=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 OH=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 V2=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 $T=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 DH=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 RH=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 FH=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 zH=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 BH=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 $H=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 UH=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 qH=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 j1=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 VH=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 HH=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 WH=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 GH=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 KH=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 YH=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 XH=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 QH=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 JH=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 eW=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 tW=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 vj=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 rW=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 nW=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 sW=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 aW=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 iW=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 oW=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 lW=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 _j=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 cW=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 dW=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 H2=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 uW=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 hW=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 fW=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 pW=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 mW=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 gW=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 xW=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 yW=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 vW=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 _W=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 bW=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 wW=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 jW=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 kW=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 NW=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 SW=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 CW=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 MW=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 TW=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 AW=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 UT=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 EW=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 Gx=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 IW=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 PW=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 LW=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 OW=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 DW=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 RW=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 FW=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 zW=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 BW=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 W2=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 $W=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 G2=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 K2=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 UW=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 qW=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 VW=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 HW=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 WW=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 GW=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 KW=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 ZW=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 YW=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 XW=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 JW=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 zl=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 eG=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 tG=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 Z2=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 rG=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 pd=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 nG=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 Y2=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 sG=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 aG=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 X2=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 Q2=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 J2=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 eb=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 iG=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 tb=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 oG=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 lG=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 cG=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 rb=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 dG=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 uG=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 hG=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 fG=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 _0=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 pG=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 mG=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 gG=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 Ec=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 Jf=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 xG=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 yG=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 nb=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 vG=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 bj=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 b0=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 _G=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 bG=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 wG=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 fi=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 jG=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 fS=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 kG=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 NG=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 SG=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 CG=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 MG=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 TG=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 AG=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 EG=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 bi=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 IG=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 PG=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 LG=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 OG=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 DG=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 RG=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 FG=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 zG=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 BG=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 $G=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 UG=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 qT=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 k1=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 qG=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 VG=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 HG=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 WG=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 GG=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 fc=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 KG=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 sb=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 ZG=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 bn=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 YG=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 XG=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 JG=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 eK=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 tK=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 rK=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 nK=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 sK=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 aK=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 iK=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 oK=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 lK=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 cK=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 dK=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 uK=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 hK=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 VT=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 HT=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 fK=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 pK=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 mK=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 gK=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 xK=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 yK=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 wj=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 vK=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 _K=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 bK=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 wK=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 jK=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 kK=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 NK=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 SK=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 CK=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 MK=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 TK=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 AK=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 EK=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 IK=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 ab=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 PK=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 LK=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 OK=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 DK=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 RK=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 pS=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 FK=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 zK=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 BK=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 Gl=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 $K=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 UK=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 qK=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 VK=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 HK=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 WT=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 WK=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 GK=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 KK=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 GT=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 ZK=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 YK=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 _g=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 XK=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 QK=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 ib=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 JK=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 mS=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 eZ=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 KT=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 tZ=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 rZ=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 nZ=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 ob=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 lb=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 sZ=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 aZ=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 iZ=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 oZ=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 lZ=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 cZ=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 dZ=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 uZ=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 hZ=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 fZ=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 pZ=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 bg=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 cb=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 mZ=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 gZ=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 xZ=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 yZ=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 vZ=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 _Z=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 bZ=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 wZ=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 jZ=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 kZ=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 NZ=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 SZ=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 CZ=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 MZ=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 TZ=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 AZ=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 EZ=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 IZ=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 PZ=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 LZ=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 OZ=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 wa=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 DZ=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 db=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 RZ=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 Do=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 FZ=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 zZ=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 BZ=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 $Z=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 UZ=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 qZ=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 VZ=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 md=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 HZ=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 pc=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 ZT=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 WZ=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 GZ=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 KZ=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 ZZ=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 YT=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 YZ=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 XZ=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 QZ=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 JZ=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 eY=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 tY=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 ub=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 nf=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 rY=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 nY=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 sY=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 wg=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 aY=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 ph=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 iY=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 oY=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 lY=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 cY=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 dY=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 uY=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 hY=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 fY=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 pY=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 mY=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 gY=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 xY=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 yY=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 vY=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 _Y=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 bY=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 wY=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 jY=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 kY=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 NY=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 SY=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 XT=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 hb=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 CY=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 MY=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 jg=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 TY=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 AY=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 EY=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 Z0=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 IY=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 PY=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 LY=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 OY=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 DY=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 Ms=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 RY=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 FY=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 zY=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 BY=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 $Y=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 UY=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 qY=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 VY=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 fb=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 pb=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 mb=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 gb=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 xb=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 yb=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 vb=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 _b=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 bb=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 wb=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 jb=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 kb=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 Nb=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 Sb=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 Cb=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 Qm=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 w0=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 Mb=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 Ab=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 Eb=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 Ib=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 Pb=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 HY=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 WY=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 Lb=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 Db=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 Rb=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 Fb=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 zb=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 Bb=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 $b=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 Ub=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 qb=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 Vb=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 Hb=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 Wb=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 Gb=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 Kb=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 ic=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 Zb=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 Yb=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 Xb=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 Qb=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 Jb=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 ew=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 GY=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 tw=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 rw=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 nw=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 sw=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 aw=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 KY=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 ZY=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 iw=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 ow=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 lw=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 cw=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 kg=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 YY=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 XY=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 QY=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 JY=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 eX=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 vs=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 tX=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 rX=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 nX=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 sX=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 aX=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 iX=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 oX=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 lX=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 cX=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 dX=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 uX=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 hX=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 fX=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 pX=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 N1=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 mX=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 gX=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 xX=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 yX=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 vX=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 _X=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 bX=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 wX=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 jX=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 gS=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 kX=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 NX=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 SX=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 CX=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 MX=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 TX=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 AX=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 EX=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 IX=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 PX=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 Ng=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 LX=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 OX=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 DX=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 RX=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 FX=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 zX=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 BX=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 Kx=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 $X=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 UX=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 qX=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 VX=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 dw=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 HX=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 WX=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 GX=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 KX=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 ZX=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 YX=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 uw=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 XX=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 QX=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 JX=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 eQ=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 tQ=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 QT=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 gd=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 rQ=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 nQ=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 sQ=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 aQ=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 iQ=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 oQ=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 JT=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 lQ=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 cQ=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 dQ=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 uQ=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 hQ=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 fQ=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 pQ=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 mQ=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 gQ=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 xQ=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 yQ=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 vQ=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 _Q=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 bQ=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 wQ=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 jQ=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 kQ=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 NQ=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 SQ=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 hw=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 Vn=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 CQ=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 MQ=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 fw=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 S1=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 TQ=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 AQ=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 jj=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 EQ=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 ep=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 Hh=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 IQ=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 PQ=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 Zi=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 eA=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 LQ=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 OQ=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 pw=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 DQ=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 RQ=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 FQ=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 zQ=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 BQ=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 $Q=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 UQ=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 qQ=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 VQ=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 HQ=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 xS=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 WQ=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 GQ=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 KQ=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 mw=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 ZQ=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 tA=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 YQ=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 uo=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 XQ=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 kj=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 rA=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 QQ=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 JQ=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 sf=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 gw=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 xw=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 yw=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 eJ=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 vw=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 tJ=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 _w=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 bw=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 rJ=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 nJ=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 Ic=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 ww=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 Bn=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 jw=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 kw=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 sJ=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 nA=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 aJ=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 iJ=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 oJ=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 lJ=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 cJ=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 dJ=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 Pa=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 uJ=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 hJ=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 fJ=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 pJ=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 mJ=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 gJ=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 xJ=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 yJ=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 vJ=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 _J=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 bJ=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 Nw=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 wJ=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 jJ=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 Sw=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 kJ=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 NJ=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 SJ=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 CJ=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 MJ=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 TJ=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 AJ=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 EJ=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 IJ=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 PJ=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 LJ=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 OJ=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 DJ=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 RJ=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 FJ=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 zJ=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 BJ=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 $J=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 UJ=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 qJ=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 VJ=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 HJ=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 WJ=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 GJ=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 KJ=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 Zx=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 _s=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 ZJ=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 YJ=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 Sg=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 yS=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 vS=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 lZe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:gO,AArrowUp:xO,ALargeSmall:yO,Accessibility:vO,Activity:gg,AirVent:_O,Airplay:bO,AlarmClock:jO,AlarmClockCheck:p_,AlarmClockMinus:m_,AlarmClockOff:wO,AlarmClockPlus:g_,AlarmSmoke:kO,Album:NO,AlignCenter:X4,AlignCenterHorizontal:SO,AlignCenterVertical:CO,AlignEndHorizontal:MO,AlignEndVertical:TO,AlignHorizontalDistributeCenter:AO,AlignHorizontalDistributeEnd:EO,AlignHorizontalDistributeStart:IO,AlignHorizontalJustifyCenter:PO,AlignHorizontalJustifyEnd:LO,AlignHorizontalJustifyStart:OO,AlignHorizontalSpaceAround:DO,AlignHorizontalSpaceBetween:RO,AlignJustify:FO,AlignLeft:Q4,AlignRight:J4,AlignStartHorizontal:zO,AlignStartVertical:BO,AlignVerticalDistributeCenter:$O,AlignVerticalDistributeEnd:UO,AlignVerticalDistributeStart:qO,AlignVerticalJustifyCenter:VO,AlignVerticalJustifyEnd:HO,AlignVerticalJustifyStart:WO,AlignVerticalSpaceAround:GO,AlignVerticalSpaceBetween:KO,Ambulance:ZO,Ampersand:YO,Ampersands:XO,Amphora:QO,Anchor:JO,Angry:e8,Annoyed:t8,Antenna:r8,Anvil:n8,Aperture:s8,AppWindow:ST,AppWindowMac:a8,Apple:i8,Archive:c8,ArchiveRestore:o8,ArchiveX:l8,Armchair:d8,ArrowBigDown:h8,ArrowBigDownDash:u8,ArrowBigLeft:p8,ArrowBigLeftDash:f8,ArrowBigRight:g8,ArrowBigRightDash:m8,ArrowBigUp:y8,ArrowBigUpDash:x8,ArrowDown:$x,ArrowDown01:v8,ArrowDown10:_8,ArrowDownAZ:x_,ArrowDownFromLine:b8,ArrowDownLeft:w8,ArrowDownNarrowWide:j8,ArrowDownRight:k8,ArrowDownToDot:N8,ArrowDownToLine:S8,ArrowDownUp:C8,ArrowDownWideNarrow:y_,ArrowDownZA:v_,ArrowLeft:so,ArrowLeftFromLine:M8,ArrowLeftRight:T8,ArrowLeftToLine:A8,ArrowRight:hl,ArrowRightFromLine:E8,ArrowRightLeft:I8,ArrowRightToLine:P8,ArrowUp:Zf,ArrowUp01:L8,ArrowUp10:O8,ArrowUpAZ:__,ArrowUpDown:xg,ArrowUpFromDot:D8,ArrowUpFromLine:R8,ArrowUpLeft:F8,ArrowUpNarrowWide:b_,ArrowUpRight:z8,ArrowUpToLine:B8,ArrowUpWideNarrow:$8,ArrowUpZA:w_,ArrowsUpFromLine:U8,Asterisk:q8,AtSign:V8,Atom:H8,AudioLines:W8,AudioWaveform:G8,Award:Ol,Axe:K8,Axis3d:j_,Baby:Z8,Backpack:Y8,Badge:hD,BadgeAlert:X8,BadgeCent:Q8,BadgeCheck:k_,BadgeDollarSign:J8,BadgeEuro:eD,BadgeHelp:tD,BadgeIndianRupee:rD,BadgeInfo:nD,BadgeJapaneseYen:sD,BadgeMinus:aD,BadgePercent:iD,BadgePlus:oD,BadgePoundSterling:lD,BadgeRussianRuble:cD,BadgeSwissFranc:dD,BadgeX:uD,BaggageClaim:fD,Ban:pD,Banana:mD,Bandage:gD,Banknote:xD,Barcode:yD,Baseline:vD,Bath:u1,Battery:ND,BatteryCharging:_D,BatteryFull:bD,BatteryLow:wD,BatteryMedium:jD,BatteryWarning:kD,Beaker:SD,Bean:MD,BeanOff:CD,Bed:h1,BedDouble:TD,BedSingle:AD,Beef:ED,Beer:PD,BeerOff:ID,Bell:yg,BellDot:LD,BellElectric:OD,BellMinus:DD,BellOff:cj,BellPlus:RD,BellRing:FD,BetweenHorizontalEnd:N_,BetweenHorizontalStart:S_,BetweenVerticalEnd:zD,BetweenVerticalStart:BD,BicepsFlexed:$D,Bike:UD,Binary:qD,Binoculars:VD,Biohazard:HD,Bird:WD,Bitcoin:GD,Blend:KD,Blinds:ZD,Blocks:YD,Bluetooth:eR,BluetoothConnected:XD,BluetoothOff:QD,BluetoothSearching:JD,Bold:eS,Bolt:tR,Bomb:rR,Bone:nR,Book:NR,BookA:sR,BookAudio:aR,BookCheck:iR,BookCopy:oR,BookDashed:C_,BookDown:lR,BookHeadphones:cR,BookHeart:dR,BookImage:uR,BookKey:hR,BookLock:fR,BookMarked:pR,BookMinus:mR,BookOpen:CT,BookOpenCheck:gR,BookOpenText:xR,BookPlus:yR,BookText:vR,BookType:_R,BookUp:wR,BookUp2:bR,BookUser:jR,BookX:kR,Bookmark:pm,BookmarkCheck:SR,BookmarkMinus:CR,BookmarkPlus:MT,BookmarkX:MR,BoomBox:TR,Bot:tS,BotMessageSquare:AR,BotOff:ER,Box:IR,Boxes:PR,Braces:M_,Brackets:LR,Brain:TT,BrainCircuit:OR,BrainCog:DR,BrickWall:RR,Briefcase:vh,BriefcaseBusiness:FR,BriefcaseConveyorBelt:zR,BriefcaseMedical:BR,BringToFront:$R,Brush:UR,Bug:HR,BugOff:qR,BugPlay:VR,Building:dj,Building2:ai,Bus:GR,BusFront:WR,Cable:ZR,CableCar:KR,Cake:Jh,CakeSlice:YR,Calculator:XR,Calendar:Os,Calendar1:QR,CalendarArrowDown:JR,CalendarArrowUp:eF,CalendarCheck:rF,CalendarCheck2:tF,CalendarClock:AT,CalendarCog:nF,CalendarDays:mm,CalendarFold:sF,CalendarHeart:aF,CalendarMinus:oF,CalendarMinus2:iF,CalendarOff:lF,CalendarPlus:uj,CalendarPlus2:cF,CalendarRange:dF,CalendarSearch:uF,CalendarSync:hF,CalendarX:pF,CalendarX2:fF,Camera:vg,CameraOff:mF,Candy:yF,CandyCane:gF,CandyOff:xF,Cannabis:vF,Captions:T_,CaptionsOff:_F,Car:jF,CarFront:bF,CarTaxiFront:wF,Caravan:kF,Carrot:NF,CaseLower:SF,CaseSensitive:CF,CaseUpper:MF,CassetteTape:TF,Cast:AF,Castle:EF,Cat:IF,Cctv:PF,ChartArea:A_,ChartBar:I_,ChartBarBig:E_,ChartBarDecreasing:LF,ChartBarIncreasing:OF,ChartBarStacked:DF,ChartCandlestick:P_,ChartColumn:dc,ChartColumnBig:L_,ChartColumnDecreasing:RF,ChartColumnIncreasing:O_,ChartColumnStacked:FF,ChartGantt:zF,ChartLine:D_,ChartNetwork:BF,ChartNoAxesColumn:F_,ChartNoAxesColumnDecreasing:$F,ChartNoAxesColumnIncreasing:R_,ChartNoAxesCombined:UF,ChartNoAxesGantt:z_,ChartPie:B_,ChartScatter:$_,ChartSpline:qF,Check:Ai,CheckCheck:VF,ChefHat:HF,Cherry:WF,ChevronDown:Fd,ChevronFirst:GF,ChevronLast:KF,ChevronLeft:Ac,ChevronRight:Vi,ChevronUp:f1,ChevronsDown:YF,ChevronsDownUp:ZF,ChevronsLeft:JF,ChevronsLeftRight:QF,ChevronsLeftRightEllipsis:XF,ChevronsRight:tz,ChevronsRightLeft:ez,ChevronsUp:rz,ChevronsUpDown:p1,Chrome:nz,Church:sz,Cigarette:iz,CigaretteOff:az,Circle:Bu,CircleAlert:fl,CircleArrowDown:U_,CircleArrowLeft:q_,CircleArrowOutDownLeft:V_,CircleArrowOutDownRight:H_,CircleArrowOutUpLeft:W_,CircleArrowOutUpRight:G_,CircleArrowRight:K_,CircleArrowUp:Z_,CircleCheck:Xi,CircleCheckBig:Yi,CircleChevronDown:Y_,CircleChevronLeft:X_,CircleChevronRight:Q_,CircleChevronUp:J_,CircleDashed:oz,CircleDivide:e2,CircleDollarSign:lz,CircleDot:dz,CircleDotDashed:cz,CircleEllipsis:uz,CircleEqual:hz,CircleFadingArrowUp:fz,CircleFadingPlus:pz,CircleGauge:t2,CircleHelp:Cx,CircleMinus:r2,CircleOff:mz,CircleParking:s2,CircleParkingOff:n2,CirclePause:a2,CirclePercent:i2,CirclePlay:$f,CirclePlus:o2,CirclePower:l2,CircleSlash:gz,CircleSlash2:c2,CircleStop:d2,CircleUser:h2,CircleUserRound:u2,CircleX:Vc,CircuitBoard:xz,Citrus:yz,Clapperboard:vz,Clipboard:Sz,ClipboardCheck:ET,ClipboardCopy:_z,ClipboardList:IT,ClipboardMinus:bz,ClipboardPaste:wz,ClipboardPen:p2,ClipboardPenLine:f2,ClipboardPlus:jz,ClipboardType:kz,ClipboardX:Nz,Clock:Ya,Clock1:Cz,Clock10:Mz,Clock11:Tz,Clock12:Az,Clock2:Ez,Clock3:Iz,Clock4:Pz,Clock5:Lz,Clock6:Oz,Clock7:Dz,Clock8:Rz,Clock9:Fz,ClockAlert:zz,ClockArrowDown:Bz,ClockArrowUp:$z,Cloud:r7,CloudAlert:Uz,CloudCog:qz,CloudDownload:m2,CloudDrizzle:Vz,CloudFog:Hz,CloudHail:Wz,CloudLightning:Gz,CloudMoon:Zz,CloudMoonRain:Kz,CloudOff:Yz,CloudRain:Qz,CloudRainWind:Xz,CloudSnow:Jz,CloudSun:t7,CloudSunRain:e7,CloudUpload:g2,Cloudy:n7,Clover:Ox,Club:s7,Code:hj,CodeXml:x2,Codepen:a7,Codesandbox:i7,Coffee:fj,Cog:o7,Coins:l7,Columns2:y2,Columns3:v2,Columns4:c7,Combine:d7,Command:u7,Compass:h7,Component:f7,Computer:p7,ConciergeBell:m7,Cone:g7,Construction:x7,Contact:y7,ContactRound:_2,Container:v7,Contrast:_7,Cookie:b7,CookingPot:w7,Copy:Qo,CopyCheck:j7,CopyMinus:k7,CopyPlus:N7,CopySlash:S7,CopyX:C7,Copyleft:M7,Copyright:T7,CornerDownLeft:A7,CornerDownRight:E7,CornerLeftDown:I7,CornerLeftUp:P7,CornerRightDown:L7,CornerRightUp:O7,CornerUpLeft:D7,CornerUpRight:R7,Cpu:F7,CreativeCommons:z7,CreditCard:gm,Croissant:B7,Crop:$7,Cross:U7,Crosshair:q7,Crown:m1,Cuboid:V7,CupSoda:H7,Currency:W7,Cylinder:G7,Dam:K7,Database:X7,DatabaseBackup:Z7,DatabaseZap:Y7,Delete:Q7,Dessert:J7,Diameter:e9,Diamond:n9,DiamondMinus:t9,DiamondPercent:b2,DiamondPlus:r9,Dice1:s9,Dice2:a9,Dice3:i9,Dice4:o9,Dice5:l9,Dice6:c9,Dices:d9,Diff:u9,Disc:m9,Disc2:h9,Disc3:f9,DiscAlbum:p9,Divide:g9,Dna:y9,DnaOff:x9,Dock:v9,Dog:_9,DollarSign:fd,Donut:b9,DoorClosed:w9,DoorOpen:pj,Dot:j9,Download:no,DraftingCompass:k9,Drama:N9,Dribbble:S9,Drill:C9,Droplet:M9,Droplets:T9,Drum:A9,Drumstick:E9,Dumbbell:I9,Ear:L9,EarOff:P9,Earth:w2,EarthLock:O9,Eclipse:D9,Egg:rS,EggFried:R9,EggOff:F9,Ellipsis:nm,EllipsisVertical:Mx,Equal:$9,EqualApproximately:z9,EqualNot:B9,Eraser:U9,EthernetPort:q9,Euro:V9,Expand:H9,ExternalLink:Ls,Eye:el,EyeClosed:W9,EyeOff:g1,Facebook:zd,Factory:G9,Fan:K9,FastForward:Z9,Feather:Y9,Fence:X9,FerrisWheel:Q9,Figma:J9,File:GB,FileArchive:eB,FileAudio:rB,FileAudio2:tB,FileAxis3d:j2,FileBadge:sB,FileBadge2:nB,FileBox:aB,FileChartColumn:N2,FileChartColumnIncreasing:k2,FileChartLine:S2,FileChartPie:C2,FileCheck:oB,FileCheck2:iB,FileClock:lB,FileCode:dB,FileCode2:cB,FileCog:M2,FileDiff:uB,FileDigit:hB,FileDown:fB,FileHeart:pB,FileImage:x1,FileInput:mB,FileJson:xB,FileJson2:gB,FileKey:vB,FileKey2:yB,FileLock:bB,FileLock2:_B,FileMinus:jB,FileMinus2:wB,FileMusic:kB,FileOutput:NB,FilePen:A2,FilePenLine:T2,FilePlus:CB,FilePlus2:SB,FileQuestion:MB,FileScan:TB,FileSearch:EB,FileSearch2:AB,FileSliders:IB,FileSpreadsheet:y1,FileStack:PB,FileSymlink:LB,FileTerminal:OB,FileText:La,FileType:RB,FileType2:DB,FileUp:FB,FileUser:zB,FileVideo:$B,FileVideo2:BB,FileVolume:qB,FileVolume2:UB,FileWarning:VB,FileX:WB,FileX2:HB,Files:KB,Film:Id,Filter:v1,FilterX:ZB,Fingerprint:YB,FireExtinguisher:XB,Fish:e$,FishOff:QB,FishSymbol:JB,Flag:Ux,FlagOff:t$,FlagTriangleLeft:r$,FlagTriangleRight:n$,Flame:ef,FlameKindling:s$,Flashlight:i$,FlashlightOff:a$,FlaskConical:mj,FlaskConicalOff:o$,FlaskRound:l$,FlipHorizontal:d$,FlipHorizontal2:c$,FlipVertical:h$,FlipVertical2:u$,Flower:f$,Flower2:lm,Focus:p$,FoldHorizontal:m$,FoldVertical:g$,Folder:q$,FolderArchive:x$,FolderCheck:y$,FolderClock:v$,FolderClosed:_$,FolderCode:b$,FolderCog:E2,FolderDot:w$,FolderDown:j$,FolderGit:N$,FolderGit2:k$,FolderHeart:S$,FolderInput:C$,FolderKanban:M$,FolderKey:T$,FolderLock:A$,FolderMinus:E$,FolderOpen:qx,FolderOpenDot:I$,FolderOutput:P$,FolderPen:I2,FolderPlus:L$,FolderRoot:O$,FolderSearch:R$,FolderSearch2:D$,FolderSymlink:F$,FolderSync:z$,FolderTree:B$,FolderUp:$$,FolderX:U$,Folders:V$,Footprints:H$,Forklift:W$,Forward:G$,Frame:K$,Framer:Z$,Frown:Y$,Fuel:X$,Fullscreen:Q$,GalleryHorizontal:eU,GalleryHorizontalEnd:J$,GalleryThumbnails:tU,GalleryVertical:nU,GalleryVerticalEnd:rU,Gamepad:aU,Gamepad2:sU,Gauge:iU,Gavel:oU,Gem:lU,Ghost:gj,Gift:Ki,GitBranch:dU,GitBranchPlus:cU,GitCommitHorizontal:P2,GitCommitVertical:uU,GitCompare:fU,GitCompareArrows:hU,GitFork:pU,GitGraph:mU,GitMerge:gU,GitPullRequest:wU,GitPullRequestArrow:xU,GitPullRequestClosed:yU,GitPullRequestCreate:_U,GitPullRequestCreateArrow:vU,GitPullRequestDraft:bU,Github:jU,Gitlab:kU,GlassWater:NU,Glasses:SU,Globe:Vx,GlobeLock:CU,Goal:MU,Grab:TU,GraduationCap:_1,Grape:AU,Grid2x2:O2,Grid2x2Check:EU,Grid2x2Plus:L2,Grid2x2X:IU,Grid3x3:$h,Grip:LU,GripHorizontal:PU,GripVertical:b1,Group:OU,Guitar:DU,Ham:RU,Hammer:FU,Hand:qU,HandCoins:zU,HandHeart:BU,HandHelping:D2,HandMetal:$U,HandPlatter:UU,Handshake:VU,HardDrive:PT,HardDriveDownload:HU,HardDriveUpload:WU,HardHat:GU,Hash:nS,Haze:KU,HdmiPort:ZU,Heading:eq,Heading1:LT,Heading2:OT,Heading3:YU,Heading4:XU,Heading5:QU,Heading6:JU,HeadphoneOff:tq,Headphones:rq,Headset:nq,Heart:ci,HeartCrack:sq,HeartHandshake:aq,HeartOff:iq,HeartPulse:oq,Heater:lq,Hexagon:cq,Highlighter:dq,History:sS,Hop:hq,HopOff:uq,Hospital:fq,Hotel:pq,Hourglass:mq,House:da,HousePlug:gq,HousePlus:xq,IceCreamBowl:R2,IceCreamCone:F2,IdCard:yq,Image:Pl,ImageDown:vq,ImageMinus:_q,ImageOff:bq,ImagePlay:wq,ImagePlus:aS,ImageUp:jq,ImageUpscale:kq,Images:Nq,Import:Sq,Inbox:Cq,IndentDecrease:z2,IndentIncrease:B2,IndianRupee:Mq,Infinity:Tq,Info:Aq,InspectionPanel:Eq,Instagram:du,Italic:iS,IterationCcw:Iq,IterationCw:Pq,JapaneseYen:Lq,Joystick:Oq,Kanban:Hx,Key:tf,KeyRound:xj,KeySquare:Dq,Keyboard:zq,KeyboardMusic:Rq,KeyboardOff:Fq,Lamp:Hq,LampCeiling:Bq,LampDesk:$q,LampFloor:Uq,LampWallDown:qq,LampWallUp:Vq,LandPlot:Wq,Landmark:Gq,Languages:Kq,Laptop:Yq,LaptopMinimal:$2,LaptopMinimalCheck:Zq,Lasso:Qq,LassoSelect:Xq,Laugh:Jq,Layers:rV,Layers2:eV,Layers3:tV,LayoutDashboard:yj,LayoutGrid:Yf,LayoutList:nV,LayoutPanelLeft:sV,LayoutPanelTop:aV,LayoutTemplate:iV,Leaf:oV,LeafyGreen:lV,Lectern:cV,LetterText:dV,Library:oS,LibraryBig:uV,LifeBuoy:lS,Ligature:hV,Lightbulb:w1,LightbulbOff:fV,Link:Co,Link2:rf,Link2Off:pV,Linkedin:xm,List:Xf,ListCheck:mV,ListChecks:gV,ListCollapse:xV,ListEnd:yV,ListFilter:vV,ListMinus:_V,ListMusic:bV,ListOrdered:cS,ListPlus:wV,ListRestart:jV,ListStart:kV,ListTodo:NV,ListTree:SV,ListVideo:CV,ListX:MV,Loader:AV,LoaderCircle:en,LoaderPinwheel:TV,Locate:DT,LocateFixed:EV,LocateOff:IV,Lock:Qf,LockKeyhole:PV,LockKeyholeOpen:U2,LockOpen:q2,LogIn:dS,LogOut:uS,Logs:LV,Lollipop:OV,Luggage:DV,Magnet:RV,Mail:ua,MailCheck:FV,MailMinus:zV,MailOpen:BV,MailPlus:$V,MailQuestion:UV,MailSearch:qV,MailWarning:VV,MailX:RT,Mailbox:HV,Mails:WV,Map:sH,MapPin:Mo,MapPinCheck:KV,MapPinCheckInside:GV,MapPinHouse:ZV,MapPinMinus:XV,MapPinMinusInside:YV,MapPinOff:QV,MapPinPlus:eH,MapPinPlusInside:JV,MapPinX:rH,MapPinXInside:tH,MapPinned:nH,Martini:aH,Maximize:oH,Maximize2:iH,Medal:Wx,Megaphone:ym,MegaphoneOff:lH,Meh:cH,MemoryStick:dH,Menu:FT,Merge:uH,MessageCircle:Fl,MessageCircleCode:hH,MessageCircleDashed:fH,MessageCircleHeart:hS,MessageCircleMore:pH,MessageCircleOff:mH,MessageCirclePlus:gH,MessageCircleQuestion:zT,MessageCircleReply:xH,MessageCircleWarning:yH,MessageCircleX:vH,MessageSquare:Oo,MessageSquareCode:_H,MessageSquareDashed:bH,MessageSquareDiff:wH,MessageSquareDot:jH,MessageSquareHeart:kH,MessageSquareLock:NH,MessageSquareMore:SH,MessageSquareOff:CH,MessageSquarePlus:MH,MessageSquareQuote:BT,MessageSquareReply:TH,MessageSquareShare:AH,MessageSquareText:EH,MessageSquareWarning:IH,MessageSquareX:PH,MessagesSquare:LH,Mic:$T,MicOff:OH,MicVocal:V2,Microchip:DH,Microscope:RH,Microwave:FH,Milestone:zH,Milk:$H,MilkOff:BH,Minimize:qH,Minimize2:UH,Minus:j1,Monitor:vj,MonitorCheck:VH,MonitorCog:HH,MonitorDot:WH,MonitorDown:GH,MonitorOff:KH,MonitorPause:ZH,MonitorPlay:YH,MonitorSmartphone:XH,MonitorSpeaker:QH,MonitorStop:JH,MonitorUp:eW,MonitorX:tW,Moon:nW,MoonStar:rW,Mountain:aW,MountainSnow:sW,Mouse:dW,MouseOff:iW,MousePointer:cW,MousePointer2:oW,MousePointerBan:lW,MousePointerClick:_j,Move:jW,Move3d:H2,MoveDiagonal:hW,MoveDiagonal2:uW,MoveDown:mW,MoveDownLeft:fW,MoveDownRight:pW,MoveHorizontal:gW,MoveLeft:xW,MoveRight:yW,MoveUp:bW,MoveUpLeft:vW,MoveUpRight:_W,MoveVertical:wW,Music:CW,Music2:kW,Music3:NW,Music4:SW,Navigation:UT,Navigation2:TW,Navigation2Off:MW,NavigationOff:AW,Network:EW,Newspaper:Gx,Nfc:IW,Notebook:DW,NotebookPen:PW,NotebookTabs:LW,NotebookText:OW,NotepadText:FW,NotepadTextDashed:RW,Nut:BW,NutOff:zW,Octagon:UW,OctagonAlert:W2,OctagonMinus:$W,OctagonPause:G2,OctagonX:K2,Omega:qW,Option:VW,Orbit:HW,Origami:WW,Package:zl,Package2:GW,PackageCheck:KW,PackageMinus:ZW,PackageOpen:YW,PackagePlus:XW,PackageSearch:QW,PackageX:JW,PaintBucket:eG,PaintRoller:tG,Paintbrush:rG,PaintbrushVertical:Z2,Palette:pd,PanelBottom:aG,PanelBottomClose:nG,PanelBottomDashed:Y2,PanelBottomOpen:sG,PanelLeft:eb,PanelLeftClose:X2,PanelLeftDashed:Q2,PanelLeftOpen:J2,PanelRight:lG,PanelRightClose:iG,PanelRightDashed:tb,PanelRightOpen:oG,PanelTop:uG,PanelTopClose:cG,PanelTopDashed:rb,PanelTopOpen:dG,PanelsLeftBottom:hG,PanelsRightBottom:fG,PanelsTopLeft:_0,Paperclip:pG,Parentheses:mG,ParkingMeter:gG,PartyPopper:Ec,Pause:Jf,PawPrint:xG,PcCase:yG,Pen:b0,PenLine:nb,PenOff:vG,PenTool:bj,Pencil:fi,PencilLine:_G,PencilOff:bG,PencilRuler:wG,Pentagon:jG,Percent:fS,PersonStanding:kG,PhilippinePeso:NG,Phone:bi,PhoneCall:SG,PhoneForwarded:CG,PhoneIncoming:MG,PhoneMissed:TG,PhoneOff:AG,PhoneOutgoing:EG,Pi:IG,Piano:PG,Pickaxe:LG,PictureInPicture:DG,PictureInPicture2:OG,PiggyBank:RG,Pilcrow:BG,PilcrowLeft:FG,PilcrowRight:zG,Pill:UG,PillBottle:$G,Pin:k1,PinOff:qT,Pipette:qG,Pizza:VG,Plane:GG,PlaneLanding:HG,PlaneTakeoff:WG,Play:fc,Plug:ZG,Plug2:KG,PlugZap:sb,Plus:bn,Pocket:XG,PocketKnife:YG,Podcast:QG,Pointer:eK,PointerOff:JG,Popcorn:tK,Popsicle:rK,PoundSterling:nK,Power:aK,PowerOff:sK,Presentation:iK,Printer:lK,PrinterCheck:oK,Projector:cK,Proportions:dK,Puzzle:uK,Pyramid:hK,QrCode:VT,Quote:HT,Rabbit:fK,Radar:pK,Radiation:mK,Radical:gK,Radio:wj,RadioReceiver:xK,RadioTower:yK,Radius:vK,RailSymbol:_K,Rainbow:bK,Rat:wK,Ratio:jK,Receipt:IK,ReceiptCent:kK,ReceiptEuro:NK,ReceiptIndianRupee:SK,ReceiptJapaneseYen:CK,ReceiptPoundSterling:MK,ReceiptRussianRuble:TK,ReceiptSwissFranc:AK,ReceiptText:EK,RectangleEllipsis:ab,RectangleHorizontal:PK,RectangleVertical:LK,Recycle:OK,Redo:pS,Redo2:DK,RedoDot:RK,RefreshCcw:zK,RefreshCcwDot:FK,RefreshCw:Gl,RefreshCwOff:BK,Refrigerator:$K,Regex:UK,RemoveFormatting:qK,Repeat:WT,Repeat1:VK,Repeat2:HK,Replace:GK,ReplaceAll:WK,Reply:GT,ReplyAll:KK,Rewind:ZK,Ribbon:YK,Rocket:_g,RockingChair:XK,RollerCoaster:QK,Rotate3d:ib,RotateCcw:mS,RotateCcwSquare:JK,RotateCw:KT,RotateCwSquare:eZ,Route:rZ,RouteOff:tZ,Router:nZ,Rows2:ob,Rows3:lb,Rows4:sZ,Rss:aZ,Ruler:iZ,RussianRuble:oZ,Sailboat:lZ,Salad:cZ,Sandwich:dZ,Satellite:hZ,SatelliteDish:uZ,Save:bg,SaveAll:fZ,SaveOff:pZ,Scale:mZ,Scale3d:cb,Scaling:gZ,Scan:kZ,ScanBarcode:xZ,ScanEye:yZ,ScanFace:vZ,ScanLine:_Z,ScanQrCode:bZ,ScanSearch:wZ,ScanText:jZ,School:NZ,Scissors:CZ,ScissorsLineDashed:SZ,ScreenShare:TZ,ScreenShareOff:MZ,Scroll:EZ,ScrollText:AZ,Search:wa,SearchCheck:IZ,SearchCode:PZ,SearchSlash:LZ,SearchX:OZ,Section:DZ,Send:Do,SendHorizontal:db,SendToBack:RZ,SeparatorHorizontal:FZ,SeparatorVertical:zZ,Server:qZ,ServerCog:BZ,ServerCrash:$Z,ServerOff:UZ,Settings:md,Settings2:VZ,Shapes:HZ,Share:ZT,Share2:pc,Sheet:WZ,Shell:GZ,Shield:nf,ShieldAlert:KZ,ShieldBan:ZZ,ShieldCheck:YT,ShieldEllipsis:YZ,ShieldHalf:XZ,ShieldMinus:QZ,ShieldOff:JZ,ShieldPlus:eY,ShieldQuestion:tY,ShieldX:ub,Ship:nY,ShipWheel:rY,Shirt:sY,ShoppingBag:wg,ShoppingBasket:aY,ShoppingCart:ph,Shovel:iY,ShowerHead:oY,Shrink:lY,Shrub:cY,Shuffle:dY,Sigma:uY,Signal:gY,SignalHigh:hY,SignalLow:fY,SignalMedium:pY,SignalZero:mY,Signature:xY,Signpost:vY,SignpostBig:yY,Siren:_Y,SkipBack:bY,SkipForward:wY,Skull:jY,Slack:kY,Slash:NY,Slice:SY,SlidersHorizontal:XT,SlidersVertical:hb,Smartphone:jg,SmartphoneCharging:CY,SmartphoneNfc:MY,Smile:AY,SmilePlus:TY,Snail:EY,Snowflake:Z0,Sofa:IY,Soup:PY,Space:LY,Spade:OY,Sparkle:DY,Sparkles:Ms,Speaker:RY,Speech:FY,SpellCheck:BY,SpellCheck2:zY,Spline:$Y,Split:UY,SprayCan:qY,Sprout:VY,Square:kg,SquareActivity:fb,SquareArrowDown:gb,SquareArrowDownLeft:pb,SquareArrowDownRight:mb,SquareArrowLeft:xb,SquareArrowOutDownLeft:yb,SquareArrowOutDownRight:vb,SquareArrowOutUpLeft:_b,SquareArrowOutUpRight:bb,SquareArrowRight:wb,SquareArrowUp:Nb,SquareArrowUpLeft:jb,SquareArrowUpRight:kb,SquareAsterisk:Sb,SquareBottomDashedScissors:Cb,SquareChartGantt:Qm,SquareCheck:Mb,SquareCheckBig:w0,SquareChevronDown:Tb,SquareChevronLeft:Ab,SquareChevronRight:Eb,SquareChevronUp:Ib,SquareCode:Pb,SquareDashed:Db,SquareDashedBottom:WY,SquareDashedBottomCode:HY,SquareDashedKanban:Lb,SquareDashedMousePointer:Ob,SquareDivide:Rb,SquareDot:Fb,SquareEqual:zb,SquareFunction:Bb,SquareKanban:$b,SquareLibrary:Ub,SquareM:qb,SquareMenu:Vb,SquareMinus:Hb,SquareMousePointer:Wb,SquareParking:Kb,SquareParkingOff:Gb,SquarePen:ic,SquarePercent:Zb,SquarePi:Yb,SquarePilcrow:Xb,SquarePlay:Qb,SquarePlus:Jb,SquarePower:ew,SquareRadical:GY,SquareScissors:tw,SquareSigma:rw,SquareSlash:nw,SquareSplitHorizontal:sw,SquareSplitVertical:aw,SquareSquare:KY,SquareStack:ZY,SquareTerminal:iw,SquareUser:lw,SquareUserRound:ow,SquareX:cw,Squircle:YY,Squirrel:XY,Stamp:QY,Star:vs,StarHalf:JY,StarOff:eX,StepBack:tX,StepForward:rX,Stethoscope:nX,Sticker:sX,StickyNote:aX,Store:iX,StretchHorizontal:oX,StretchVertical:lX,Strikethrough:cX,Subscript:dX,Sun:N1,SunDim:uX,SunMedium:hX,SunMoon:fX,SunSnow:pX,Sunrise:mX,Sunset:gX,Superscript:xX,SwatchBook:yX,SwissFranc:vX,SwitchCamera:_X,Sword:bX,Swords:wX,Syringe:jX,Table:AX,Table2:gS,TableCellsMerge:kX,TableCellsSplit:NX,TableColumnsSplit:SX,TableOfContents:CX,TableProperties:MX,TableRowsSplit:TX,Tablet:IX,TabletSmartphone:EX,Tablets:PX,Tag:Ng,Tags:LX,Tally1:OX,Tally2:DX,Tally3:RX,Tally4:FX,Tally5:zX,Tangent:BX,Target:Kx,Telescope:$X,Tent:qX,TentTree:UX,Terminal:VX,TestTube:HX,TestTubeDiagonal:dw,TestTubes:WX,Text:XX,TextCursor:KX,TextCursorInput:GX,TextQuote:ZX,TextSearch:YX,TextSelect:uw,Theater:QX,Thermometer:tQ,ThermometerSnowflake:JX,ThermometerSun:eQ,ThumbsDown:QT,ThumbsUp:gd,Ticket:JT,TicketCheck:rQ,TicketMinus:nQ,TicketPercent:sQ,TicketPlus:aQ,TicketSlash:iQ,TicketX:oQ,Tickets:cQ,TicketsPlane:lQ,Timer:hQ,TimerOff:dQ,TimerReset:uQ,ToggleLeft:fQ,ToggleRight:pQ,Toilet:mQ,Tornado:gQ,Torus:xQ,Touchpad:vQ,TouchpadOff:yQ,TowerControl:_Q,ToyBrick:bQ,Tractor:wQ,TrafficCone:jQ,TrainFront:NQ,TrainFrontTunnel:kQ,TrainTrack:SQ,TramFront:hw,Trash:CQ,Trash2:Vn,TreeDeciduous:MQ,TreePalm:fw,TreePine:S1,Trees:TQ,Trello:AQ,TrendingDown:jj,TrendingUp:ep,TrendingUpDown:EQ,Triangle:PQ,TriangleAlert:Hh,TriangleRight:IQ,Trophy:Zi,Truck:eA,Turtle:LQ,Tv:DQ,TvMinimal:pw,TvMinimalPlay:OQ,Twitch:RQ,Twitter:FQ,Type:BQ,TypeOutline:zQ,Umbrella:UQ,UmbrellaOff:$Q,Underline:qQ,Undo:xS,Undo2:VQ,UndoDot:HQ,UnfoldHorizontal:WQ,UnfoldVertical:GQ,Ungroup:KQ,University:mw,Unlink:tA,Unlink2:ZQ,Unplug:YQ,Upload:uo,Usb:XQ,User:Ic,UserCheck:kj,UserCog:rA,UserMinus:QQ,UserPen:JQ,UserPlus:sf,UserRound:bw,UserRoundCheck:gw,UserRoundCog:xw,UserRoundMinus:yw,UserRoundPen:eJ,UserRoundPlus:vw,UserRoundSearch:tJ,UserRoundX:_w,UserSearch:rJ,UserX:nJ,Users:Bn,UsersRound:ww,Utensils:kw,UtensilsCrossed:jw,UtilityPole:sJ,Variable:nA,Vault:aJ,Vegan:iJ,VenetianMask:oJ,Vibrate:cJ,VibrateOff:lJ,Video:Pa,VideoOff:dJ,Videotape:uJ,View:hJ,Voicemail:fJ,Volleyball:pJ,Volume:vJ,Volume1:mJ,Volume2:gJ,VolumeOff:xJ,VolumeX:yJ,Vote:_J,Wallet:wJ,WalletCards:bJ,WalletMinimal:Nw,Wallpaper:jJ,Wand:kJ,WandSparkles:Sw,Warehouse:NJ,WashingMachine:SJ,Watch:CJ,Waves:MJ,Waypoints:TJ,Webcam:AJ,Webhook:IJ,WebhookOff:EJ,Weight:PJ,Wheat:OJ,WheatOff:LJ,WholeWord:DJ,Wifi:$J,WifiHigh:RJ,WifiLow:FJ,WifiOff:zJ,WifiZero:BJ,Wind:qJ,WindArrowDown:UJ,Wine:HJ,WineOff:VJ,Workflow:WJ,Worm:GJ,WrapText:KJ,Wrench:Zx,X:_s,Youtube:ZJ,Zap:Sg,ZapOff:YJ,ZoomIn:yS,ZoomOut:vS},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 vAe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:gO,AArrowDownIcon:gO,AArrowUp:xO,AArrowUpIcon:xO,ALargeSmall:yO,ALargeSmallIcon:yO,Accessibility:vO,AccessibilityIcon:vO,Activity:gg,ActivityIcon:gg,ActivitySquare:fb,ActivitySquareIcon:fb,AirVent:_O,AirVentIcon:_O,Airplay:bO,AirplayIcon:bO,AlarmCheck:p_,AlarmCheckIcon:p_,AlarmClock:jO,AlarmClockCheck:p_,AlarmClockCheckIcon:p_,AlarmClockIcon:jO,AlarmClockMinus:m_,AlarmClockMinusIcon:m_,AlarmClockOff:wO,AlarmClockOffIcon:wO,AlarmClockPlus:g_,AlarmClockPlusIcon:g_,AlarmMinus:m_,AlarmMinusIcon:m_,AlarmPlus:g_,AlarmPlusIcon:g_,AlarmSmoke:kO,AlarmSmokeIcon:kO,Album:NO,AlbumIcon:NO,AlertCircle:fl,AlertCircleIcon:fl,AlertOctagon:W2,AlertOctagonIcon:W2,AlertTriangle:Hh,AlertTriangleIcon:Hh,AlignCenter:X4,AlignCenterHorizontal:SO,AlignCenterHorizontalIcon:SO,AlignCenterIcon:X4,AlignCenterVertical:CO,AlignCenterVerticalIcon:CO,AlignEndHorizontal:MO,AlignEndHorizontalIcon:MO,AlignEndVertical:TO,AlignEndVerticalIcon:TO,AlignHorizontalDistributeCenter:AO,AlignHorizontalDistributeCenterIcon:AO,AlignHorizontalDistributeEnd:EO,AlignHorizontalDistributeEndIcon:EO,AlignHorizontalDistributeStart:IO,AlignHorizontalDistributeStartIcon:IO,AlignHorizontalJustifyCenter:PO,AlignHorizontalJustifyCenterIcon:PO,AlignHorizontalJustifyEnd:LO,AlignHorizontalJustifyEndIcon:LO,AlignHorizontalJustifyStart:OO,AlignHorizontalJustifyStartIcon:OO,AlignHorizontalSpaceAround:DO,AlignHorizontalSpaceAroundIcon:DO,AlignHorizontalSpaceBetween:RO,AlignHorizontalSpaceBetweenIcon:RO,AlignJustify:FO,AlignJustifyIcon:FO,AlignLeft:Q4,AlignLeftIcon:Q4,AlignRight:J4,AlignRightIcon:J4,AlignStartHorizontal:zO,AlignStartHorizontalIcon:zO,AlignStartVertical:BO,AlignStartVerticalIcon:BO,AlignVerticalDistributeCenter:$O,AlignVerticalDistributeCenterIcon:$O,AlignVerticalDistributeEnd:UO,AlignVerticalDistributeEndIcon:UO,AlignVerticalDistributeStart:qO,AlignVerticalDistributeStartIcon:qO,AlignVerticalJustifyCenter:VO,AlignVerticalJustifyCenterIcon:VO,AlignVerticalJustifyEnd:HO,AlignVerticalJustifyEndIcon:HO,AlignVerticalJustifyStart:WO,AlignVerticalJustifyStartIcon:WO,AlignVerticalSpaceAround:GO,AlignVerticalSpaceAroundIcon:GO,AlignVerticalSpaceBetween:KO,AlignVerticalSpaceBetweenIcon:KO,Ambulance:ZO,AmbulanceIcon:ZO,Ampersand:YO,AmpersandIcon:YO,Ampersands:XO,AmpersandsIcon:XO,Amphora:QO,AmphoraIcon:QO,Anchor:JO,AnchorIcon:JO,Angry:e8,AngryIcon:e8,Annoyed:t8,AnnoyedIcon:t8,Antenna:r8,AntennaIcon:r8,Anvil:n8,AnvilIcon:n8,Aperture:s8,ApertureIcon:s8,AppWindow:ST,AppWindowIcon:ST,AppWindowMac:a8,AppWindowMacIcon:a8,Apple:i8,AppleIcon:i8,Archive:c8,ArchiveIcon:c8,ArchiveRestore:o8,ArchiveRestoreIcon:o8,ArchiveX:l8,ArchiveXIcon:l8,AreaChart:A_,AreaChartIcon:A_,Armchair:d8,ArmchairIcon:d8,ArrowBigDown:h8,ArrowBigDownDash:u8,ArrowBigDownDashIcon:u8,ArrowBigDownIcon:h8,ArrowBigLeft:p8,ArrowBigLeftDash:f8,ArrowBigLeftDashIcon:f8,ArrowBigLeftIcon:p8,ArrowBigRight:g8,ArrowBigRightDash:m8,ArrowBigRightDashIcon:m8,ArrowBigRightIcon:g8,ArrowBigUp:y8,ArrowBigUpDash:x8,ArrowBigUpDashIcon:x8,ArrowBigUpIcon:y8,ArrowDown:$x,ArrowDown01:v8,ArrowDown01Icon:v8,ArrowDown10:_8,ArrowDown10Icon:_8,ArrowDownAZ:x_,ArrowDownAZIcon:x_,ArrowDownAz:x_,ArrowDownAzIcon:x_,ArrowDownCircle:U_,ArrowDownCircleIcon:U_,ArrowDownFromLine:b8,ArrowDownFromLineIcon:b8,ArrowDownIcon:$x,ArrowDownLeft:w8,ArrowDownLeftFromCircle:V_,ArrowDownLeftFromCircleIcon:V_,ArrowDownLeftFromSquare:yb,ArrowDownLeftFromSquareIcon:yb,ArrowDownLeftIcon:w8,ArrowDownLeftSquare:pb,ArrowDownLeftSquareIcon:pb,ArrowDownNarrowWide:j8,ArrowDownNarrowWideIcon:j8,ArrowDownRight:k8,ArrowDownRightFromCircle:H_,ArrowDownRightFromCircleIcon:H_,ArrowDownRightFromSquare:vb,ArrowDownRightFromSquareIcon:vb,ArrowDownRightIcon:k8,ArrowDownRightSquare:mb,ArrowDownRightSquareIcon:mb,ArrowDownSquare:gb,ArrowDownSquareIcon:gb,ArrowDownToDot:N8,ArrowDownToDotIcon:N8,ArrowDownToLine:S8,ArrowDownToLineIcon:S8,ArrowDownUp:C8,ArrowDownUpIcon:C8,ArrowDownWideNarrow:y_,ArrowDownWideNarrowIcon:y_,ArrowDownZA:v_,ArrowDownZAIcon:v_,ArrowDownZa:v_,ArrowDownZaIcon:v_,ArrowLeft:so,ArrowLeftCircle:q_,ArrowLeftCircleIcon:q_,ArrowLeftFromLine:M8,ArrowLeftFromLineIcon:M8,ArrowLeftIcon:so,ArrowLeftRight:T8,ArrowLeftRightIcon:T8,ArrowLeftSquare:xb,ArrowLeftSquareIcon:xb,ArrowLeftToLine:A8,ArrowLeftToLineIcon:A8,ArrowRight:hl,ArrowRightCircle:K_,ArrowRightCircleIcon:K_,ArrowRightFromLine:E8,ArrowRightFromLineIcon:E8,ArrowRightIcon:hl,ArrowRightLeft:I8,ArrowRightLeftIcon:I8,ArrowRightSquare:wb,ArrowRightSquareIcon:wb,ArrowRightToLine:P8,ArrowRightToLineIcon:P8,ArrowUp:Zf,ArrowUp01:L8,ArrowUp01Icon:L8,ArrowUp10:O8,ArrowUp10Icon:O8,ArrowUpAZ:__,ArrowUpAZIcon:__,ArrowUpAz:__,ArrowUpAzIcon:__,ArrowUpCircle:Z_,ArrowUpCircleIcon:Z_,ArrowUpDown:xg,ArrowUpDownIcon:xg,ArrowUpFromDot:D8,ArrowUpFromDotIcon:D8,ArrowUpFromLine:R8,ArrowUpFromLineIcon:R8,ArrowUpIcon:Zf,ArrowUpLeft:F8,ArrowUpLeftFromCircle:W_,ArrowUpLeftFromCircleIcon:W_,ArrowUpLeftFromSquare:_b,ArrowUpLeftFromSquareIcon:_b,ArrowUpLeftIcon:F8,ArrowUpLeftSquare:jb,ArrowUpLeftSquareIcon:jb,ArrowUpNarrowWide:b_,ArrowUpNarrowWideIcon:b_,ArrowUpRight:z8,ArrowUpRightFromCircle:G_,ArrowUpRightFromCircleIcon:G_,ArrowUpRightFromSquare:bb,ArrowUpRightFromSquareIcon:bb,ArrowUpRightIcon:z8,ArrowUpRightSquare:kb,ArrowUpRightSquareIcon:kb,ArrowUpSquare:Nb,ArrowUpSquareIcon:Nb,ArrowUpToLine:B8,ArrowUpToLineIcon:B8,ArrowUpWideNarrow:$8,ArrowUpWideNarrowIcon:$8,ArrowUpZA:w_,ArrowUpZAIcon:w_,ArrowUpZa:w_,ArrowUpZaIcon:w_,ArrowsUpFromLine:U8,ArrowsUpFromLineIcon:U8,Asterisk:q8,AsteriskIcon:q8,AsteriskSquare:Sb,AsteriskSquareIcon:Sb,AtSign:V8,AtSignIcon:V8,Atom:H8,AtomIcon:H8,AudioLines:W8,AudioLinesIcon:W8,AudioWaveform:G8,AudioWaveformIcon:G8,Award:Ol,AwardIcon:Ol,Axe:K8,AxeIcon:K8,Axis3D:j_,Axis3DIcon:j_,Axis3d:j_,Axis3dIcon:j_,Baby:Z8,BabyIcon:Z8,Backpack:Y8,BackpackIcon:Y8,Badge:hD,BadgeAlert:X8,BadgeAlertIcon:X8,BadgeCent:Q8,BadgeCentIcon:Q8,BadgeCheck:k_,BadgeCheckIcon:k_,BadgeDollarSign:J8,BadgeDollarSignIcon:J8,BadgeEuro:eD,BadgeEuroIcon:eD,BadgeHelp:tD,BadgeHelpIcon:tD,BadgeIcon:hD,BadgeIndianRupee:rD,BadgeIndianRupeeIcon:rD,BadgeInfo:nD,BadgeInfoIcon:nD,BadgeJapaneseYen:sD,BadgeJapaneseYenIcon:sD,BadgeMinus:aD,BadgeMinusIcon:aD,BadgePercent:iD,BadgePercentIcon:iD,BadgePlus:oD,BadgePlusIcon:oD,BadgePoundSterling:lD,BadgePoundSterlingIcon:lD,BadgeRussianRuble:cD,BadgeRussianRubleIcon:cD,BadgeSwissFranc:dD,BadgeSwissFrancIcon:dD,BadgeX:uD,BadgeXIcon:uD,BaggageClaim:fD,BaggageClaimIcon:fD,Ban:pD,BanIcon:pD,Banana:mD,BananaIcon:mD,Bandage:gD,BandageIcon:gD,Banknote:xD,BanknoteIcon:xD,BarChart:R_,BarChart2:F_,BarChart2Icon:F_,BarChart3:dc,BarChart3Icon:dc,BarChart4:O_,BarChart4Icon:O_,BarChartBig:L_,BarChartBigIcon:L_,BarChartHorizontal:I_,BarChartHorizontalBig:E_,BarChartHorizontalBigIcon:E_,BarChartHorizontalIcon:I_,BarChartIcon:R_,Barcode:yD,BarcodeIcon:yD,Baseline:vD,BaselineIcon:vD,Bath:u1,BathIcon:u1,Battery:ND,BatteryCharging:_D,BatteryChargingIcon:_D,BatteryFull:bD,BatteryFullIcon:bD,BatteryIcon:ND,BatteryLow:wD,BatteryLowIcon:wD,BatteryMedium:jD,BatteryMediumIcon:jD,BatteryWarning:kD,BatteryWarningIcon:kD,Beaker:SD,BeakerIcon:SD,Bean:MD,BeanIcon:MD,BeanOff:CD,BeanOffIcon:CD,Bed:h1,BedDouble:TD,BedDoubleIcon:TD,BedIcon:h1,BedSingle:AD,BedSingleIcon:AD,Beef:ED,BeefIcon:ED,Beer:PD,BeerIcon:PD,BeerOff:ID,BeerOffIcon:ID,Bell:yg,BellDot:LD,BellDotIcon:LD,BellElectric:OD,BellElectricIcon:OD,BellIcon:yg,BellMinus:DD,BellMinusIcon:DD,BellOff:cj,BellOffIcon:cj,BellPlus:RD,BellPlusIcon:RD,BellRing:FD,BellRingIcon:FD,BetweenHorizonalEnd:N_,BetweenHorizonalEndIcon:N_,BetweenHorizonalStart:S_,BetweenHorizonalStartIcon:S_,BetweenHorizontalEnd:N_,BetweenHorizontalEndIcon:N_,BetweenHorizontalStart:S_,BetweenHorizontalStartIcon:S_,BetweenVerticalEnd:zD,BetweenVerticalEndIcon:zD,BetweenVerticalStart:BD,BetweenVerticalStartIcon:BD,BicepsFlexed:$D,BicepsFlexedIcon:$D,Bike:UD,BikeIcon:UD,Binary:qD,BinaryIcon:qD,Binoculars:VD,BinocularsIcon:VD,Biohazard:HD,BiohazardIcon:HD,Bird:WD,BirdIcon:WD,Bitcoin:GD,BitcoinIcon:GD,Blend:KD,BlendIcon:KD,Blinds:ZD,BlindsIcon:ZD,Blocks:YD,BlocksIcon:YD,Bluetooth:eR,BluetoothConnected:XD,BluetoothConnectedIcon:XD,BluetoothIcon:eR,BluetoothOff:QD,BluetoothOffIcon:QD,BluetoothSearching:JD,BluetoothSearchingIcon:JD,Bold:eS,BoldIcon:eS,Bolt:tR,BoltIcon:tR,Bomb:rR,BombIcon:rR,Bone:nR,BoneIcon:nR,Book:NR,BookA:sR,BookAIcon:sR,BookAudio:aR,BookAudioIcon:aR,BookCheck:iR,BookCheckIcon:iR,BookCopy:oR,BookCopyIcon:oR,BookDashed:C_,BookDashedIcon:C_,BookDown:lR,BookDownIcon:lR,BookHeadphones:cR,BookHeadphonesIcon:cR,BookHeart:dR,BookHeartIcon:dR,BookIcon:NR,BookImage:uR,BookImageIcon:uR,BookKey:hR,BookKeyIcon:hR,BookLock:fR,BookLockIcon:fR,BookMarked:pR,BookMarkedIcon:pR,BookMinus:mR,BookMinusIcon:mR,BookOpen:CT,BookOpenCheck:gR,BookOpenCheckIcon:gR,BookOpenIcon:CT,BookOpenText:xR,BookOpenTextIcon:xR,BookPlus:yR,BookPlusIcon:yR,BookTemplate:C_,BookTemplateIcon:C_,BookText:vR,BookTextIcon:vR,BookType:_R,BookTypeIcon:_R,BookUp:wR,BookUp2:bR,BookUp2Icon:bR,BookUpIcon:wR,BookUser:jR,BookUserIcon:jR,BookX:kR,BookXIcon:kR,Bookmark:pm,BookmarkCheck:SR,BookmarkCheckIcon:SR,BookmarkIcon:pm,BookmarkMinus:CR,BookmarkMinusIcon:CR,BookmarkPlus:MT,BookmarkPlusIcon:MT,BookmarkX:MR,BookmarkXIcon:MR,BoomBox:TR,BoomBoxIcon:TR,Bot:tS,BotIcon:tS,BotMessageSquare:AR,BotMessageSquareIcon:AR,BotOff:ER,BotOffIcon:ER,Box:IR,BoxIcon:IR,BoxSelect:Db,BoxSelectIcon:Db,Boxes:PR,BoxesIcon:PR,Braces:M_,BracesIcon:M_,Brackets:LR,BracketsIcon:LR,Brain:TT,BrainCircuit:OR,BrainCircuitIcon:OR,BrainCog:DR,BrainCogIcon:DR,BrainIcon:TT,BrickWall:RR,BrickWallIcon:RR,Briefcase:vh,BriefcaseBusiness:FR,BriefcaseBusinessIcon:FR,BriefcaseConveyorBelt:zR,BriefcaseConveyorBeltIcon:zR,BriefcaseIcon:vh,BriefcaseMedical:BR,BriefcaseMedicalIcon:BR,BringToFront:$R,BringToFrontIcon:$R,Brush:UR,BrushIcon:UR,Bug:HR,BugIcon:HR,BugOff:qR,BugOffIcon:qR,BugPlay:VR,BugPlayIcon:VR,Building:dj,Building2:ai,Building2Icon:ai,BuildingIcon:dj,Bus:GR,BusFront:WR,BusFrontIcon:WR,BusIcon:GR,Cable:ZR,CableCar:KR,CableCarIcon:KR,CableIcon:ZR,Cake:Jh,CakeIcon:Jh,CakeSlice:YR,CakeSliceIcon:YR,Calculator:XR,CalculatorIcon:XR,Calendar:Os,Calendar1:QR,Calendar1Icon:QR,CalendarArrowDown:JR,CalendarArrowDownIcon:JR,CalendarArrowUp:eF,CalendarArrowUpIcon:eF,CalendarCheck:rF,CalendarCheck2:tF,CalendarCheck2Icon:tF,CalendarCheckIcon:rF,CalendarClock:AT,CalendarClockIcon:AT,CalendarCog:nF,CalendarCogIcon:nF,CalendarDays:mm,CalendarDaysIcon:mm,CalendarFold:sF,CalendarFoldIcon:sF,CalendarHeart:aF,CalendarHeartIcon:aF,CalendarIcon:Os,CalendarMinus:oF,CalendarMinus2:iF,CalendarMinus2Icon:iF,CalendarMinusIcon:oF,CalendarOff:lF,CalendarOffIcon:lF,CalendarPlus:uj,CalendarPlus2:cF,CalendarPlus2Icon:cF,CalendarPlusIcon:uj,CalendarRange:dF,CalendarRangeIcon:dF,CalendarSearch:uF,CalendarSearchIcon:uF,CalendarSync:hF,CalendarSyncIcon:hF,CalendarX:pF,CalendarX2:fF,CalendarX2Icon:fF,CalendarXIcon:pF,Camera:vg,CameraIcon:vg,CameraOff:mF,CameraOffIcon:mF,CandlestickChart:P_,CandlestickChartIcon:P_,Candy:yF,CandyCane:gF,CandyCaneIcon:gF,CandyIcon:yF,CandyOff:xF,CandyOffIcon:xF,Cannabis:vF,CannabisIcon:vF,Captions:T_,CaptionsIcon:T_,CaptionsOff:_F,CaptionsOffIcon:_F,Car:jF,CarFront:bF,CarFrontIcon:bF,CarIcon:jF,CarTaxiFront:wF,CarTaxiFrontIcon:wF,Caravan:kF,CaravanIcon:kF,Carrot:NF,CarrotIcon:NF,CaseLower:SF,CaseLowerIcon:SF,CaseSensitive:CF,CaseSensitiveIcon:CF,CaseUpper:MF,CaseUpperIcon:MF,CassetteTape:TF,CassetteTapeIcon:TF,Cast:AF,CastIcon:AF,Castle:EF,CastleIcon:EF,Cat:IF,CatIcon:IF,Cctv:PF,CctvIcon:PF,ChartArea:A_,ChartAreaIcon:A_,ChartBar:I_,ChartBarBig:E_,ChartBarBigIcon:E_,ChartBarDecreasing:LF,ChartBarDecreasingIcon:LF,ChartBarIcon:I_,ChartBarIncreasing:OF,ChartBarIncreasingIcon:OF,ChartBarStacked:DF,ChartBarStackedIcon:DF,ChartCandlestick:P_,ChartCandlestickIcon:P_,ChartColumn:dc,ChartColumnBig:L_,ChartColumnBigIcon:L_,ChartColumnDecreasing:RF,ChartColumnDecreasingIcon:RF,ChartColumnIcon:dc,ChartColumnIncreasing:O_,ChartColumnIncreasingIcon:O_,ChartColumnStacked:FF,ChartColumnStackedIcon:FF,ChartGantt:zF,ChartGanttIcon:zF,ChartLine:D_,ChartLineIcon:D_,ChartNetwork:BF,ChartNetworkIcon:BF,ChartNoAxesColumn:F_,ChartNoAxesColumnDecreasing:$F,ChartNoAxesColumnDecreasingIcon:$F,ChartNoAxesColumnIcon:F_,ChartNoAxesColumnIncreasing:R_,ChartNoAxesColumnIncreasingIcon:R_,ChartNoAxesCombined:UF,ChartNoAxesCombinedIcon:UF,ChartNoAxesGantt:z_,ChartNoAxesGanttIcon:z_,ChartPie:B_,ChartPieIcon:B_,ChartScatter:$_,ChartScatterIcon:$_,ChartSpline:qF,ChartSplineIcon:qF,Check:Ai,CheckCheck:VF,CheckCheckIcon:VF,CheckCircle:Yi,CheckCircle2:Xi,CheckCircle2Icon:Xi,CheckCircleIcon:Yi,CheckIcon:Ai,CheckSquare:w0,CheckSquare2:Mb,CheckSquare2Icon:Mb,CheckSquareIcon:w0,ChefHat:HF,ChefHatIcon:HF,Cherry:WF,CherryIcon:WF,ChevronDown:Fd,ChevronDownCircle:Y_,ChevronDownCircleIcon:Y_,ChevronDownIcon:Fd,ChevronDownSquare:Tb,ChevronDownSquareIcon:Tb,ChevronFirst:GF,ChevronFirstIcon:GF,ChevronLast:KF,ChevronLastIcon:KF,ChevronLeft:Ac,ChevronLeftCircle:X_,ChevronLeftCircleIcon:X_,ChevronLeftIcon:Ac,ChevronLeftSquare:Ab,ChevronLeftSquareIcon:Ab,ChevronRight:Vi,ChevronRightCircle:Q_,ChevronRightCircleIcon:Q_,ChevronRightIcon:Vi,ChevronRightSquare:Eb,ChevronRightSquareIcon:Eb,ChevronUp:f1,ChevronUpCircle:J_,ChevronUpCircleIcon:J_,ChevronUpIcon:f1,ChevronUpSquare:Ib,ChevronUpSquareIcon:Ib,ChevronsDown:YF,ChevronsDownIcon:YF,ChevronsDownUp:ZF,ChevronsDownUpIcon:ZF,ChevronsLeft:JF,ChevronsLeftIcon:JF,ChevronsLeftRight:QF,ChevronsLeftRightEllipsis:XF,ChevronsLeftRightEllipsisIcon:XF,ChevronsLeftRightIcon:QF,ChevronsRight:tz,ChevronsRightIcon:tz,ChevronsRightLeft:ez,ChevronsRightLeftIcon:ez,ChevronsUp:rz,ChevronsUpDown:p1,ChevronsUpDownIcon:p1,ChevronsUpIcon:rz,Chrome:nz,ChromeIcon:nz,Church:sz,ChurchIcon:sz,Cigarette:iz,CigaretteIcon:iz,CigaretteOff:az,CigaretteOffIcon:az,Circle:Bu,CircleAlert:fl,CircleAlertIcon:fl,CircleArrowDown:U_,CircleArrowDownIcon:U_,CircleArrowLeft:q_,CircleArrowLeftIcon:q_,CircleArrowOutDownLeft:V_,CircleArrowOutDownLeftIcon:V_,CircleArrowOutDownRight:H_,CircleArrowOutDownRightIcon:H_,CircleArrowOutUpLeft:W_,CircleArrowOutUpLeftIcon:W_,CircleArrowOutUpRight:G_,CircleArrowOutUpRightIcon:G_,CircleArrowRight:K_,CircleArrowRightIcon:K_,CircleArrowUp:Z_,CircleArrowUpIcon:Z_,CircleCheck:Xi,CircleCheckBig:Yi,CircleCheckBigIcon:Yi,CircleCheckIcon:Xi,CircleChevronDown:Y_,CircleChevronDownIcon:Y_,CircleChevronLeft:X_,CircleChevronLeftIcon:X_,CircleChevronRight:Q_,CircleChevronRightIcon:Q_,CircleChevronUp:J_,CircleChevronUpIcon:J_,CircleDashed:oz,CircleDashedIcon:oz,CircleDivide:e2,CircleDivideIcon:e2,CircleDollarSign:lz,CircleDollarSignIcon:lz,CircleDot:dz,CircleDotDashed:cz,CircleDotDashedIcon:cz,CircleDotIcon:dz,CircleEllipsis:uz,CircleEllipsisIcon:uz,CircleEqual:hz,CircleEqualIcon:hz,CircleFadingArrowUp:fz,CircleFadingArrowUpIcon:fz,CircleFadingPlus:pz,CircleFadingPlusIcon:pz,CircleGauge:t2,CircleGaugeIcon:t2,CircleHelp:Cx,CircleHelpIcon:Cx,CircleIcon:Bu,CircleMinus:r2,CircleMinusIcon:r2,CircleOff:mz,CircleOffIcon:mz,CircleParking:s2,CircleParkingIcon:s2,CircleParkingOff:n2,CircleParkingOffIcon:n2,CirclePause:a2,CirclePauseIcon:a2,CirclePercent:i2,CirclePercentIcon:i2,CirclePlay:$f,CirclePlayIcon:$f,CirclePlus:o2,CirclePlusIcon:o2,CirclePower:l2,CirclePowerIcon:l2,CircleSlash:gz,CircleSlash2:c2,CircleSlash2Icon:c2,CircleSlashIcon:gz,CircleSlashed:c2,CircleSlashedIcon:c2,CircleStop:d2,CircleStopIcon:d2,CircleUser:h2,CircleUserIcon:h2,CircleUserRound:u2,CircleUserRoundIcon:u2,CircleX:Vc,CircleXIcon:Vc,CircuitBoard:xz,CircuitBoardIcon:xz,Citrus:yz,CitrusIcon:yz,Clapperboard:vz,ClapperboardIcon:vz,Clipboard:Sz,ClipboardCheck:ET,ClipboardCheckIcon:ET,ClipboardCopy:_z,ClipboardCopyIcon:_z,ClipboardEdit:p2,ClipboardEditIcon:p2,ClipboardIcon:Sz,ClipboardList:IT,ClipboardListIcon:IT,ClipboardMinus:bz,ClipboardMinusIcon:bz,ClipboardPaste:wz,ClipboardPasteIcon:wz,ClipboardPen:p2,ClipboardPenIcon:p2,ClipboardPenLine:f2,ClipboardPenLineIcon:f2,ClipboardPlus:jz,ClipboardPlusIcon:jz,ClipboardSignature:f2,ClipboardSignatureIcon:f2,ClipboardType:kz,ClipboardTypeIcon:kz,ClipboardX:Nz,ClipboardXIcon:Nz,Clock:Ya,Clock1:Cz,Clock10:Mz,Clock10Icon:Mz,Clock11:Tz,Clock11Icon:Tz,Clock12:Az,Clock12Icon:Az,Clock1Icon:Cz,Clock2:Ez,Clock2Icon:Ez,Clock3:Iz,Clock3Icon:Iz,Clock4:Pz,Clock4Icon:Pz,Clock5:Lz,Clock5Icon:Lz,Clock6:Oz,Clock6Icon:Oz,Clock7:Dz,Clock7Icon:Dz,Clock8:Rz,Clock8Icon:Rz,Clock9:Fz,Clock9Icon:Fz,ClockAlert:zz,ClockAlertIcon:zz,ClockArrowDown:Bz,ClockArrowDownIcon:Bz,ClockArrowUp:$z,ClockArrowUpIcon:$z,ClockIcon:Ya,Cloud:r7,CloudAlert:Uz,CloudAlertIcon:Uz,CloudCog:qz,CloudCogIcon:qz,CloudDownload:m2,CloudDownloadIcon:m2,CloudDrizzle:Vz,CloudDrizzleIcon:Vz,CloudFog:Hz,CloudFogIcon:Hz,CloudHail:Wz,CloudHailIcon:Wz,CloudIcon:r7,CloudLightning:Gz,CloudLightningIcon:Gz,CloudMoon:Zz,CloudMoonIcon:Zz,CloudMoonRain:Kz,CloudMoonRainIcon:Kz,CloudOff:Yz,CloudOffIcon:Yz,CloudRain:Qz,CloudRainIcon:Qz,CloudRainWind:Xz,CloudRainWindIcon:Xz,CloudSnow:Jz,CloudSnowIcon:Jz,CloudSun:t7,CloudSunIcon:t7,CloudSunRain:e7,CloudSunRainIcon:e7,CloudUpload:g2,CloudUploadIcon:g2,Cloudy:n7,CloudyIcon:n7,Clover:Ox,CloverIcon:Ox,Club:s7,ClubIcon:s7,Code:hj,Code2:x2,Code2Icon:x2,CodeIcon:hj,CodeSquare:Pb,CodeSquareIcon:Pb,CodeXml:x2,CodeXmlIcon:x2,Codepen:a7,CodepenIcon:a7,Codesandbox:i7,CodesandboxIcon:i7,Coffee:fj,CoffeeIcon:fj,Cog:o7,CogIcon:o7,Coins:l7,CoinsIcon:l7,Columns:y2,Columns2:y2,Columns2Icon:y2,Columns3:v2,Columns3Icon:v2,Columns4:c7,Columns4Icon:c7,ColumnsIcon:y2,Combine:d7,CombineIcon:d7,Command:u7,CommandIcon:u7,Compass:h7,CompassIcon:h7,Component:f7,ComponentIcon:f7,Computer:p7,ComputerIcon:p7,ConciergeBell:m7,ConciergeBellIcon:m7,Cone:g7,ConeIcon:g7,Construction:x7,ConstructionIcon:x7,Contact:y7,Contact2:_2,Contact2Icon:_2,ContactIcon:y7,ContactRound:_2,ContactRoundIcon:_2,Container:v7,ContainerIcon:v7,Contrast:_7,ContrastIcon:_7,Cookie:b7,CookieIcon:b7,CookingPot:w7,CookingPotIcon:w7,Copy:Qo,CopyCheck:j7,CopyCheckIcon:j7,CopyIcon:Qo,CopyMinus:k7,CopyMinusIcon:k7,CopyPlus:N7,CopyPlusIcon:N7,CopySlash:S7,CopySlashIcon:S7,CopyX:C7,CopyXIcon:C7,Copyleft:M7,CopyleftIcon:M7,Copyright:T7,CopyrightIcon:T7,CornerDownLeft:A7,CornerDownLeftIcon:A7,CornerDownRight:E7,CornerDownRightIcon:E7,CornerLeftDown:I7,CornerLeftDownIcon:I7,CornerLeftUp:P7,CornerLeftUpIcon:P7,CornerRightDown:L7,CornerRightDownIcon:L7,CornerRightUp:O7,CornerRightUpIcon:O7,CornerUpLeft:D7,CornerUpLeftIcon:D7,CornerUpRight:R7,CornerUpRightIcon:R7,Cpu:F7,CpuIcon:F7,CreativeCommons:z7,CreativeCommonsIcon:z7,CreditCard:gm,CreditCardIcon:gm,Croissant:B7,CroissantIcon:B7,Crop:$7,CropIcon:$7,Cross:U7,CrossIcon:U7,Crosshair:q7,CrosshairIcon:q7,Crown:m1,CrownIcon:m1,Cuboid:V7,CuboidIcon:V7,CupSoda:H7,CupSodaIcon:H7,CurlyBraces:M_,CurlyBracesIcon:M_,Currency:W7,CurrencyIcon:W7,Cylinder:G7,CylinderIcon:G7,Dam:K7,DamIcon:K7,Database:X7,DatabaseBackup:Z7,DatabaseBackupIcon:Z7,DatabaseIcon:X7,DatabaseZap:Y7,DatabaseZapIcon:Y7,Delete:Q7,DeleteIcon:Q7,Dessert:J7,DessertIcon:J7,Diameter:e9,DiameterIcon:e9,Diamond:n9,DiamondIcon:n9,DiamondMinus:t9,DiamondMinusIcon:t9,DiamondPercent:b2,DiamondPercentIcon:b2,DiamondPlus:r9,DiamondPlusIcon:r9,Dice1:s9,Dice1Icon:s9,Dice2:a9,Dice2Icon:a9,Dice3:i9,Dice3Icon:i9,Dice4:o9,Dice4Icon:o9,Dice5:l9,Dice5Icon:l9,Dice6:c9,Dice6Icon:c9,Dices:d9,DicesIcon:d9,Diff:u9,DiffIcon:u9,Disc:m9,Disc2:h9,Disc2Icon:h9,Disc3:f9,Disc3Icon:f9,DiscAlbum:p9,DiscAlbumIcon:p9,DiscIcon:m9,Divide:g9,DivideCircle:e2,DivideCircleIcon:e2,DivideIcon:g9,DivideSquare:Rb,DivideSquareIcon:Rb,Dna:y9,DnaIcon:y9,DnaOff:x9,DnaOffIcon:x9,Dock:v9,DockIcon:v9,Dog:_9,DogIcon:_9,DollarSign:fd,DollarSignIcon:fd,Donut:b9,DonutIcon:b9,DoorClosed:w9,DoorClosedIcon:w9,DoorOpen:pj,DoorOpenIcon:pj,Dot:j9,DotIcon:j9,DotSquare:Fb,DotSquareIcon:Fb,Download:no,DownloadCloud:m2,DownloadCloudIcon:m2,DownloadIcon:no,DraftingCompass:k9,DraftingCompassIcon:k9,Drama:N9,DramaIcon:N9,Dribbble:S9,DribbbleIcon:S9,Drill:C9,DrillIcon:C9,Droplet:M9,DropletIcon:M9,Droplets:T9,DropletsIcon:T9,Drum:A9,DrumIcon:A9,Drumstick:E9,DrumstickIcon:E9,Dumbbell:I9,DumbbellIcon:I9,Ear:L9,EarIcon:L9,EarOff:P9,EarOffIcon:P9,Earth:w2,EarthIcon:w2,EarthLock:O9,EarthLockIcon:O9,Eclipse:D9,EclipseIcon:D9,Edit:ic,Edit2:b0,Edit2Icon:b0,Edit3:nb,Edit3Icon:nb,EditIcon:ic,Egg:rS,EggFried:R9,EggFriedIcon:R9,EggIcon:rS,EggOff:F9,EggOffIcon:F9,Ellipsis:nm,EllipsisIcon:nm,EllipsisVertical:Mx,EllipsisVerticalIcon:Mx,Equal:$9,EqualApproximately:z9,EqualApproximatelyIcon:z9,EqualIcon:$9,EqualNot:B9,EqualNotIcon:B9,EqualSquare:zb,EqualSquareIcon:zb,Eraser:U9,EraserIcon:U9,EthernetPort:q9,EthernetPortIcon:q9,Euro:V9,EuroIcon:V9,Expand:H9,ExpandIcon:H9,ExternalLink:Ls,ExternalLinkIcon:Ls,Eye:el,EyeClosed:W9,EyeClosedIcon:W9,EyeIcon:el,EyeOff:g1,EyeOffIcon:g1,Facebook:zd,FacebookIcon:zd,Factory:G9,FactoryIcon:G9,Fan:K9,FanIcon:K9,FastForward:Z9,FastForwardIcon:Z9,Feather:Y9,FeatherIcon:Y9,Fence:X9,FenceIcon:X9,FerrisWheel:Q9,FerrisWheelIcon:Q9,Figma:J9,FigmaIcon:J9,File:GB,FileArchive:eB,FileArchiveIcon:eB,FileAudio:rB,FileAudio2:tB,FileAudio2Icon:tB,FileAudioIcon:rB,FileAxis3D:j2,FileAxis3DIcon:j2,FileAxis3d:j2,FileAxis3dIcon:j2,FileBadge:sB,FileBadge2:nB,FileBadge2Icon:nB,FileBadgeIcon:sB,FileBarChart:k2,FileBarChart2:N2,FileBarChart2Icon:N2,FileBarChartIcon:k2,FileBox:aB,FileBoxIcon:aB,FileChartColumn:N2,FileChartColumnIcon:N2,FileChartColumnIncreasing:k2,FileChartColumnIncreasingIcon:k2,FileChartLine:S2,FileChartLineIcon:S2,FileChartPie:C2,FileChartPieIcon:C2,FileCheck:oB,FileCheck2:iB,FileCheck2Icon:iB,FileCheckIcon:oB,FileClock:lB,FileClockIcon:lB,FileCode:dB,FileCode2:cB,FileCode2Icon:cB,FileCodeIcon:dB,FileCog:M2,FileCog2:M2,FileCog2Icon:M2,FileCogIcon:M2,FileDiff:uB,FileDiffIcon:uB,FileDigit:hB,FileDigitIcon:hB,FileDown:fB,FileDownIcon:fB,FileEdit:A2,FileEditIcon:A2,FileHeart:pB,FileHeartIcon:pB,FileIcon:GB,FileImage:x1,FileImageIcon:x1,FileInput:mB,FileInputIcon:mB,FileJson:xB,FileJson2:gB,FileJson2Icon:gB,FileJsonIcon:xB,FileKey:vB,FileKey2:yB,FileKey2Icon:yB,FileKeyIcon:vB,FileLineChart:S2,FileLineChartIcon:S2,FileLock:bB,FileLock2:_B,FileLock2Icon:_B,FileLockIcon:bB,FileMinus:jB,FileMinus2:wB,FileMinus2Icon:wB,FileMinusIcon:jB,FileMusic:kB,FileMusicIcon:kB,FileOutput:NB,FileOutputIcon:NB,FilePen:A2,FilePenIcon:A2,FilePenLine:T2,FilePenLineIcon:T2,FilePieChart:C2,FilePieChartIcon:C2,FilePlus:CB,FilePlus2:SB,FilePlus2Icon:SB,FilePlusIcon:CB,FileQuestion:MB,FileQuestionIcon:MB,FileScan:TB,FileScanIcon:TB,FileSearch:EB,FileSearch2:AB,FileSearch2Icon:AB,FileSearchIcon:EB,FileSignature:T2,FileSignatureIcon:T2,FileSliders:IB,FileSlidersIcon:IB,FileSpreadsheet:y1,FileSpreadsheetIcon:y1,FileStack:PB,FileStackIcon:PB,FileSymlink:LB,FileSymlinkIcon:LB,FileTerminal:OB,FileTerminalIcon:OB,FileText:La,FileTextIcon:La,FileType:RB,FileType2:DB,FileType2Icon:DB,FileTypeIcon:RB,FileUp:FB,FileUpIcon:FB,FileUser:zB,FileUserIcon:zB,FileVideo:$B,FileVideo2:BB,FileVideo2Icon:BB,FileVideoIcon:$B,FileVolume:qB,FileVolume2:UB,FileVolume2Icon:UB,FileVolumeIcon:qB,FileWarning:VB,FileWarningIcon:VB,FileX:WB,FileX2:HB,FileX2Icon:HB,FileXIcon:WB,Files:KB,FilesIcon:KB,Film:Id,FilmIcon:Id,Filter:v1,FilterIcon:v1,FilterX:ZB,FilterXIcon:ZB,Fingerprint:YB,FingerprintIcon:YB,FireExtinguisher:XB,FireExtinguisherIcon:XB,Fish:e$,FishIcon:e$,FishOff:QB,FishOffIcon:QB,FishSymbol:JB,FishSymbolIcon:JB,Flag:Ux,FlagIcon:Ux,FlagOff:t$,FlagOffIcon:t$,FlagTriangleLeft:r$,FlagTriangleLeftIcon:r$,FlagTriangleRight:n$,FlagTriangleRightIcon:n$,Flame:ef,FlameIcon:ef,FlameKindling:s$,FlameKindlingIcon:s$,Flashlight:i$,FlashlightIcon:i$,FlashlightOff:a$,FlashlightOffIcon:a$,FlaskConical:mj,FlaskConicalIcon:mj,FlaskConicalOff:o$,FlaskConicalOffIcon:o$,FlaskRound:l$,FlaskRoundIcon:l$,FlipHorizontal:d$,FlipHorizontal2:c$,FlipHorizontal2Icon:c$,FlipHorizontalIcon:d$,FlipVertical:h$,FlipVertical2:u$,FlipVertical2Icon:u$,FlipVerticalIcon:h$,Flower:f$,Flower2:lm,Flower2Icon:lm,FlowerIcon:f$,Focus:p$,FocusIcon:p$,FoldHorizontal:m$,FoldHorizontalIcon:m$,FoldVertical:g$,FoldVerticalIcon:g$,Folder:q$,FolderArchive:x$,FolderArchiveIcon:x$,FolderCheck:y$,FolderCheckIcon:y$,FolderClock:v$,FolderClockIcon:v$,FolderClosed:_$,FolderClosedIcon:_$,FolderCode:b$,FolderCodeIcon:b$,FolderCog:E2,FolderCog2:E2,FolderCog2Icon:E2,FolderCogIcon:E2,FolderDot:w$,FolderDotIcon:w$,FolderDown:j$,FolderDownIcon:j$,FolderEdit:I2,FolderEditIcon:I2,FolderGit:N$,FolderGit2:k$,FolderGit2Icon:k$,FolderGitIcon:N$,FolderHeart:S$,FolderHeartIcon:S$,FolderIcon:q$,FolderInput:C$,FolderInputIcon:C$,FolderKanban:M$,FolderKanbanIcon:M$,FolderKey:T$,FolderKeyIcon:T$,FolderLock:A$,FolderLockIcon:A$,FolderMinus:E$,FolderMinusIcon:E$,FolderOpen:qx,FolderOpenDot:I$,FolderOpenDotIcon:I$,FolderOpenIcon:qx,FolderOutput:P$,FolderOutputIcon:P$,FolderPen:I2,FolderPenIcon:I2,FolderPlus:L$,FolderPlusIcon:L$,FolderRoot:O$,FolderRootIcon:O$,FolderSearch:R$,FolderSearch2:D$,FolderSearch2Icon:D$,FolderSearchIcon:R$,FolderSymlink:F$,FolderSymlinkIcon:F$,FolderSync:z$,FolderSyncIcon:z$,FolderTree:B$,FolderTreeIcon:B$,FolderUp:$$,FolderUpIcon:$$,FolderX:U$,FolderXIcon:U$,Folders:V$,FoldersIcon:V$,Footprints:H$,FootprintsIcon:H$,ForkKnife:kw,ForkKnifeCrossed:jw,ForkKnifeCrossedIcon:jw,ForkKnifeIcon:kw,Forklift:W$,ForkliftIcon:W$,FormInput:ab,FormInputIcon:ab,Forward:G$,ForwardIcon:G$,Frame:K$,FrameIcon:K$,Framer:Z$,FramerIcon:Z$,Frown:Y$,FrownIcon:Y$,Fuel:X$,FuelIcon:X$,Fullscreen:Q$,FullscreenIcon:Q$,FunctionSquare:Bb,FunctionSquareIcon:Bb,GalleryHorizontal:eU,GalleryHorizontalEnd:J$,GalleryHorizontalEndIcon:J$,GalleryHorizontalIcon:eU,GalleryThumbnails:tU,GalleryThumbnailsIcon:tU,GalleryVertical:nU,GalleryVerticalEnd:rU,GalleryVerticalEndIcon:rU,GalleryVerticalIcon:nU,Gamepad:aU,Gamepad2:sU,Gamepad2Icon:sU,GamepadIcon:aU,GanttChart:z_,GanttChartIcon:z_,GanttChartSquare:Qm,GanttChartSquareIcon:Qm,Gauge:iU,GaugeCircle:t2,GaugeCircleIcon:t2,GaugeIcon:iU,Gavel:oU,GavelIcon:oU,Gem:lU,GemIcon:lU,Ghost:gj,GhostIcon:gj,Gift:Ki,GiftIcon:Ki,GitBranch:dU,GitBranchIcon:dU,GitBranchPlus:cU,GitBranchPlusIcon:cU,GitCommit:P2,GitCommitHorizontal:P2,GitCommitHorizontalIcon:P2,GitCommitIcon:P2,GitCommitVertical:uU,GitCommitVerticalIcon:uU,GitCompare:fU,GitCompareArrows:hU,GitCompareArrowsIcon:hU,GitCompareIcon:fU,GitFork:pU,GitForkIcon:pU,GitGraph:mU,GitGraphIcon:mU,GitMerge:gU,GitMergeIcon:gU,GitPullRequest:wU,GitPullRequestArrow:xU,GitPullRequestArrowIcon:xU,GitPullRequestClosed:yU,GitPullRequestClosedIcon:yU,GitPullRequestCreate:_U,GitPullRequestCreateArrow:vU,GitPullRequestCreateArrowIcon:vU,GitPullRequestCreateIcon:_U,GitPullRequestDraft:bU,GitPullRequestDraftIcon:bU,GitPullRequestIcon:wU,Github:jU,GithubIcon:jU,Gitlab:kU,GitlabIcon:kU,GlassWater:NU,GlassWaterIcon:NU,Glasses:SU,GlassesIcon:SU,Globe:Vx,Globe2:w2,Globe2Icon:w2,GlobeIcon:Vx,GlobeLock:CU,GlobeLockIcon:CU,Goal:MU,GoalIcon:MU,Grab:TU,GrabIcon:TU,GraduationCap:_1,GraduationCapIcon:_1,Grape:AU,GrapeIcon:AU,Grid:$h,Grid2X2:O2,Grid2X2Icon:O2,Grid2X2Plus:L2,Grid2X2PlusIcon:L2,Grid2x2:O2,Grid2x2Check:EU,Grid2x2CheckIcon:EU,Grid2x2Icon:O2,Grid2x2Plus:L2,Grid2x2PlusIcon:L2,Grid2x2X:IU,Grid2x2XIcon:IU,Grid3X3:$h,Grid3X3Icon:$h,Grid3x3:$h,Grid3x3Icon:$h,GridIcon:$h,Grip:LU,GripHorizontal:PU,GripHorizontalIcon:PU,GripIcon:LU,GripVertical:b1,GripVerticalIcon:b1,Group:OU,GroupIcon:OU,Guitar:DU,GuitarIcon:DU,Ham:RU,HamIcon:RU,Hammer:FU,HammerIcon:FU,Hand:qU,HandCoins:zU,HandCoinsIcon:zU,HandHeart:BU,HandHeartIcon:BU,HandHelping:D2,HandHelpingIcon:D2,HandIcon:qU,HandMetal:$U,HandMetalIcon:$U,HandPlatter:UU,HandPlatterIcon:UU,Handshake:VU,HandshakeIcon:VU,HardDrive:PT,HardDriveDownload:HU,HardDriveDownloadIcon:HU,HardDriveIcon:PT,HardDriveUpload:WU,HardDriveUploadIcon:WU,HardHat:GU,HardHatIcon:GU,Hash:nS,HashIcon:nS,Haze:KU,HazeIcon:KU,HdmiPort:ZU,HdmiPortIcon:ZU,Heading:eq,Heading1:LT,Heading1Icon:LT,Heading2:OT,Heading2Icon:OT,Heading3:YU,Heading3Icon:YU,Heading4:XU,Heading4Icon:XU,Heading5:QU,Heading5Icon:QU,Heading6:JU,Heading6Icon:JU,HeadingIcon:eq,HeadphoneOff:tq,HeadphoneOffIcon:tq,Headphones:rq,HeadphonesIcon:rq,Headset:nq,HeadsetIcon:nq,Heart:ci,HeartCrack:sq,HeartCrackIcon:sq,HeartHandshake:aq,HeartHandshakeIcon:aq,HeartIcon:ci,HeartOff:iq,HeartOffIcon:iq,HeartPulse:oq,HeartPulseIcon:oq,Heater:lq,HeaterIcon:lq,HelpCircle:Cx,HelpCircleIcon:Cx,HelpingHand:D2,HelpingHandIcon:D2,Hexagon:cq,HexagonIcon:cq,Highlighter:dq,HighlighterIcon:dq,History:sS,HistoryIcon:sS,Home:da,HomeIcon:da,Hop:hq,HopIcon:hq,HopOff:uq,HopOffIcon:uq,Hospital:fq,HospitalIcon:fq,Hotel:pq,HotelIcon:pq,Hourglass:mq,HourglassIcon:mq,House:da,HouseIcon:da,HousePlug:gq,HousePlugIcon:gq,HousePlus:xq,HousePlusIcon:xq,IceCream:F2,IceCream2:R2,IceCream2Icon:R2,IceCreamBowl:R2,IceCreamBowlIcon:R2,IceCreamCone:F2,IceCreamConeIcon:F2,IceCreamIcon:F2,Icon:yAe,IdCard:yq,IdCardIcon:yq,Image:Pl,ImageDown:vq,ImageDownIcon:vq,ImageIcon:Pl,ImageMinus:_q,ImageMinusIcon:_q,ImageOff:bq,ImageOffIcon:bq,ImagePlay:wq,ImagePlayIcon:wq,ImagePlus:aS,ImagePlusIcon:aS,ImageUp:jq,ImageUpIcon:jq,ImageUpscale:kq,ImageUpscaleIcon:kq,Images:Nq,ImagesIcon:Nq,Import:Sq,ImportIcon:Sq,Inbox:Cq,InboxIcon:Cq,Indent:B2,IndentDecrease:z2,IndentDecreaseIcon:z2,IndentIcon:B2,IndentIncrease:B2,IndentIncreaseIcon:B2,IndianRupee:Mq,IndianRupeeIcon:Mq,Infinity:Tq,InfinityIcon:Tq,Info:Aq,InfoIcon:Aq,Inspect:Wb,InspectIcon:Wb,InspectionPanel:Eq,InspectionPanelIcon:Eq,Instagram:du,InstagramIcon:du,Italic:iS,ItalicIcon:iS,IterationCcw:Iq,IterationCcwIcon:Iq,IterationCw:Pq,IterationCwIcon:Pq,JapaneseYen:Lq,JapaneseYenIcon:Lq,Joystick:Oq,JoystickIcon:Oq,Kanban:Hx,KanbanIcon:Hx,KanbanSquare:$b,KanbanSquareDashed:Lb,KanbanSquareDashedIcon:Lb,KanbanSquareIcon:$b,Key:tf,KeyIcon:tf,KeyRound:xj,KeyRoundIcon:xj,KeySquare:Dq,KeySquareIcon:Dq,Keyboard:zq,KeyboardIcon:zq,KeyboardMusic:Rq,KeyboardMusicIcon:Rq,KeyboardOff:Fq,KeyboardOffIcon:Fq,Lamp:Hq,LampCeiling:Bq,LampCeilingIcon:Bq,LampDesk:$q,LampDeskIcon:$q,LampFloor:Uq,LampFloorIcon:Uq,LampIcon:Hq,LampWallDown:qq,LampWallDownIcon:qq,LampWallUp:Vq,LampWallUpIcon:Vq,LandPlot:Wq,LandPlotIcon:Wq,Landmark:Gq,LandmarkIcon:Gq,Languages:Kq,LanguagesIcon:Kq,Laptop:Yq,Laptop2:$2,Laptop2Icon:$2,LaptopIcon:Yq,LaptopMinimal:$2,LaptopMinimalCheck:Zq,LaptopMinimalCheckIcon:Zq,LaptopMinimalIcon:$2,Lasso:Qq,LassoIcon:Qq,LassoSelect:Xq,LassoSelectIcon:Xq,Laugh:Jq,LaughIcon:Jq,Layers:rV,Layers2:eV,Layers2Icon:eV,Layers3:tV,Layers3Icon:tV,LayersIcon:rV,Layout:_0,LayoutDashboard:yj,LayoutDashboardIcon:yj,LayoutGrid:Yf,LayoutGridIcon:Yf,LayoutIcon:_0,LayoutList:nV,LayoutListIcon:nV,LayoutPanelLeft:sV,LayoutPanelLeftIcon:sV,LayoutPanelTop:aV,LayoutPanelTopIcon:aV,LayoutTemplate:iV,LayoutTemplateIcon:iV,Leaf:oV,LeafIcon:oV,LeafyGreen:lV,LeafyGreenIcon:lV,Lectern:cV,LecternIcon:cV,LetterText:dV,LetterTextIcon:dV,Library:oS,LibraryBig:uV,LibraryBigIcon:uV,LibraryIcon:oS,LibrarySquare:Ub,LibrarySquareIcon:Ub,LifeBuoy:lS,LifeBuoyIcon:lS,Ligature:hV,LigatureIcon:hV,Lightbulb:w1,LightbulbIcon:w1,LightbulbOff:fV,LightbulbOffIcon:fV,LineChart:D_,LineChartIcon:D_,Link:Co,Link2:rf,Link2Icon:rf,Link2Off:pV,Link2OffIcon:pV,LinkIcon:Co,Linkedin:xm,LinkedinIcon:xm,List:Xf,ListCheck:mV,ListCheckIcon:mV,ListChecks:gV,ListChecksIcon:gV,ListCollapse:xV,ListCollapseIcon:xV,ListEnd:yV,ListEndIcon:yV,ListFilter:vV,ListFilterIcon:vV,ListIcon:Xf,ListMinus:_V,ListMinusIcon:_V,ListMusic:bV,ListMusicIcon:bV,ListOrdered:cS,ListOrderedIcon:cS,ListPlus:wV,ListPlusIcon:wV,ListRestart:jV,ListRestartIcon:jV,ListStart:kV,ListStartIcon:kV,ListTodo:NV,ListTodoIcon:NV,ListTree:SV,ListTreeIcon:SV,ListVideo:CV,ListVideoIcon:CV,ListX:MV,ListXIcon:MV,Loader:AV,Loader2:en,Loader2Icon:en,LoaderCircle:en,LoaderCircleIcon:en,LoaderIcon:AV,LoaderPinwheel:TV,LoaderPinwheelIcon:TV,Locate:DT,LocateFixed:EV,LocateFixedIcon:EV,LocateIcon:DT,LocateOff:IV,LocateOffIcon:IV,Lock:Qf,LockIcon:Qf,LockKeyhole:PV,LockKeyholeIcon:PV,LockKeyholeOpen:U2,LockKeyholeOpenIcon:U2,LockOpen:q2,LockOpenIcon:q2,LogIn:dS,LogInIcon:dS,LogOut:uS,LogOutIcon:uS,Logs:LV,LogsIcon:LV,Lollipop:OV,LollipopIcon:OV,LucideAArrowDown:gO,LucideAArrowUp:xO,LucideALargeSmall:yO,LucideAccessibility:vO,LucideActivity:gg,LucideActivitySquare:fb,LucideAirVent:_O,LucideAirplay:bO,LucideAlarmCheck:p_,LucideAlarmClock:jO,LucideAlarmClockCheck:p_,LucideAlarmClockMinus:m_,LucideAlarmClockOff:wO,LucideAlarmClockPlus:g_,LucideAlarmMinus:m_,LucideAlarmPlus:g_,LucideAlarmSmoke:kO,LucideAlbum:NO,LucideAlertCircle:fl,LucideAlertOctagon:W2,LucideAlertTriangle:Hh,LucideAlignCenter:X4,LucideAlignCenterHorizontal:SO,LucideAlignCenterVertical:CO,LucideAlignEndHorizontal:MO,LucideAlignEndVertical:TO,LucideAlignHorizontalDistributeCenter:AO,LucideAlignHorizontalDistributeEnd:EO,LucideAlignHorizontalDistributeStart:IO,LucideAlignHorizontalJustifyCenter:PO,LucideAlignHorizontalJustifyEnd:LO,LucideAlignHorizontalJustifyStart:OO,LucideAlignHorizontalSpaceAround:DO,LucideAlignHorizontalSpaceBetween:RO,LucideAlignJustify:FO,LucideAlignLeft:Q4,LucideAlignRight:J4,LucideAlignStartHorizontal:zO,LucideAlignStartVertical:BO,LucideAlignVerticalDistributeCenter:$O,LucideAlignVerticalDistributeEnd:UO,LucideAlignVerticalDistributeStart:qO,LucideAlignVerticalJustifyCenter:VO,LucideAlignVerticalJustifyEnd:HO,LucideAlignVerticalJustifyStart:WO,LucideAlignVerticalSpaceAround:GO,LucideAlignVerticalSpaceBetween:KO,LucideAmbulance:ZO,LucideAmpersand:YO,LucideAmpersands:XO,LucideAmphora:QO,LucideAnchor:JO,LucideAngry:e8,LucideAnnoyed:t8,LucideAntenna:r8,LucideAnvil:n8,LucideAperture:s8,LucideAppWindow:ST,LucideAppWindowMac:a8,LucideApple:i8,LucideArchive:c8,LucideArchiveRestore:o8,LucideArchiveX:l8,LucideAreaChart:A_,LucideArmchair:d8,LucideArrowBigDown:h8,LucideArrowBigDownDash:u8,LucideArrowBigLeft:p8,LucideArrowBigLeftDash:f8,LucideArrowBigRight:g8,LucideArrowBigRightDash:m8,LucideArrowBigUp:y8,LucideArrowBigUpDash:x8,LucideArrowDown:$x,LucideArrowDown01:v8,LucideArrowDown10:_8,LucideArrowDownAZ:x_,LucideArrowDownAz:x_,LucideArrowDownCircle:U_,LucideArrowDownFromLine:b8,LucideArrowDownLeft:w8,LucideArrowDownLeftFromCircle:V_,LucideArrowDownLeftFromSquare:yb,LucideArrowDownLeftSquare:pb,LucideArrowDownNarrowWide:j8,LucideArrowDownRight:k8,LucideArrowDownRightFromCircle:H_,LucideArrowDownRightFromSquare:vb,LucideArrowDownRightSquare:mb,LucideArrowDownSquare:gb,LucideArrowDownToDot:N8,LucideArrowDownToLine:S8,LucideArrowDownUp:C8,LucideArrowDownWideNarrow:y_,LucideArrowDownZA:v_,LucideArrowDownZa:v_,LucideArrowLeft:so,LucideArrowLeftCircle:q_,LucideArrowLeftFromLine:M8,LucideArrowLeftRight:T8,LucideArrowLeftSquare:xb,LucideArrowLeftToLine:A8,LucideArrowRight:hl,LucideArrowRightCircle:K_,LucideArrowRightFromLine:E8,LucideArrowRightLeft:I8,LucideArrowRightSquare:wb,LucideArrowRightToLine:P8,LucideArrowUp:Zf,LucideArrowUp01:L8,LucideArrowUp10:O8,LucideArrowUpAZ:__,LucideArrowUpAz:__,LucideArrowUpCircle:Z_,LucideArrowUpDown:xg,LucideArrowUpFromDot:D8,LucideArrowUpFromLine:R8,LucideArrowUpLeft:F8,LucideArrowUpLeftFromCircle:W_,LucideArrowUpLeftFromSquare:_b,LucideArrowUpLeftSquare:jb,LucideArrowUpNarrowWide:b_,LucideArrowUpRight:z8,LucideArrowUpRightFromCircle:G_,LucideArrowUpRightFromSquare:bb,LucideArrowUpRightSquare:kb,LucideArrowUpSquare:Nb,LucideArrowUpToLine:B8,LucideArrowUpWideNarrow:$8,LucideArrowUpZA:w_,LucideArrowUpZa:w_,LucideArrowsUpFromLine:U8,LucideAsterisk:q8,LucideAsteriskSquare:Sb,LucideAtSign:V8,LucideAtom:H8,LucideAudioLines:W8,LucideAudioWaveform:G8,LucideAward:Ol,LucideAxe:K8,LucideAxis3D:j_,LucideAxis3d:j_,LucideBaby:Z8,LucideBackpack:Y8,LucideBadge:hD,LucideBadgeAlert:X8,LucideBadgeCent:Q8,LucideBadgeCheck:k_,LucideBadgeDollarSign:J8,LucideBadgeEuro:eD,LucideBadgeHelp:tD,LucideBadgeIndianRupee:rD,LucideBadgeInfo:nD,LucideBadgeJapaneseYen:sD,LucideBadgeMinus:aD,LucideBadgePercent:iD,LucideBadgePlus:oD,LucideBadgePoundSterling:lD,LucideBadgeRussianRuble:cD,LucideBadgeSwissFranc:dD,LucideBadgeX:uD,LucideBaggageClaim:fD,LucideBan:pD,LucideBanana:mD,LucideBandage:gD,LucideBanknote:xD,LucideBarChart:R_,LucideBarChart2:F_,LucideBarChart3:dc,LucideBarChart4:O_,LucideBarChartBig:L_,LucideBarChartHorizontal:I_,LucideBarChartHorizontalBig:E_,LucideBarcode:yD,LucideBaseline:vD,LucideBath:u1,LucideBattery:ND,LucideBatteryCharging:_D,LucideBatteryFull:bD,LucideBatteryLow:wD,LucideBatteryMedium:jD,LucideBatteryWarning:kD,LucideBeaker:SD,LucideBean:MD,LucideBeanOff:CD,LucideBed:h1,LucideBedDouble:TD,LucideBedSingle:AD,LucideBeef:ED,LucideBeer:PD,LucideBeerOff:ID,LucideBell:yg,LucideBellDot:LD,LucideBellElectric:OD,LucideBellMinus:DD,LucideBellOff:cj,LucideBellPlus:RD,LucideBellRing:FD,LucideBetweenHorizonalEnd:N_,LucideBetweenHorizonalStart:S_,LucideBetweenHorizontalEnd:N_,LucideBetweenHorizontalStart:S_,LucideBetweenVerticalEnd:zD,LucideBetweenVerticalStart:BD,LucideBicepsFlexed:$D,LucideBike:UD,LucideBinary:qD,LucideBinoculars:VD,LucideBiohazard:HD,LucideBird:WD,LucideBitcoin:GD,LucideBlend:KD,LucideBlinds:ZD,LucideBlocks:YD,LucideBluetooth:eR,LucideBluetoothConnected:XD,LucideBluetoothOff:QD,LucideBluetoothSearching:JD,LucideBold:eS,LucideBolt:tR,LucideBomb:rR,LucideBone:nR,LucideBook:NR,LucideBookA:sR,LucideBookAudio:aR,LucideBookCheck:iR,LucideBookCopy:oR,LucideBookDashed:C_,LucideBookDown:lR,LucideBookHeadphones:cR,LucideBookHeart:dR,LucideBookImage:uR,LucideBookKey:hR,LucideBookLock:fR,LucideBookMarked:pR,LucideBookMinus:mR,LucideBookOpen:CT,LucideBookOpenCheck:gR,LucideBookOpenText:xR,LucideBookPlus:yR,LucideBookTemplate:C_,LucideBookText:vR,LucideBookType:_R,LucideBookUp:wR,LucideBookUp2:bR,LucideBookUser:jR,LucideBookX:kR,LucideBookmark:pm,LucideBookmarkCheck:SR,LucideBookmarkMinus:CR,LucideBookmarkPlus:MT,LucideBookmarkX:MR,LucideBoomBox:TR,LucideBot:tS,LucideBotMessageSquare:AR,LucideBotOff:ER,LucideBox:IR,LucideBoxSelect:Db,LucideBoxes:PR,LucideBraces:M_,LucideBrackets:LR,LucideBrain:TT,LucideBrainCircuit:OR,LucideBrainCog:DR,LucideBrickWall:RR,LucideBriefcase:vh,LucideBriefcaseBusiness:FR,LucideBriefcaseConveyorBelt:zR,LucideBriefcaseMedical:BR,LucideBringToFront:$R,LucideBrush:UR,LucideBug:HR,LucideBugOff:qR,LucideBugPlay:VR,LucideBuilding:dj,LucideBuilding2:ai,LucideBus:GR,LucideBusFront:WR,LucideCable:ZR,LucideCableCar:KR,LucideCake:Jh,LucideCakeSlice:YR,LucideCalculator:XR,LucideCalendar:Os,LucideCalendar1:QR,LucideCalendarArrowDown:JR,LucideCalendarArrowUp:eF,LucideCalendarCheck:rF,LucideCalendarCheck2:tF,LucideCalendarClock:AT,LucideCalendarCog:nF,LucideCalendarDays:mm,LucideCalendarFold:sF,LucideCalendarHeart:aF,LucideCalendarMinus:oF,LucideCalendarMinus2:iF,LucideCalendarOff:lF,LucideCalendarPlus:uj,LucideCalendarPlus2:cF,LucideCalendarRange:dF,LucideCalendarSearch:uF,LucideCalendarSync:hF,LucideCalendarX:pF,LucideCalendarX2:fF,LucideCamera:vg,LucideCameraOff:mF,LucideCandlestickChart:P_,LucideCandy:yF,LucideCandyCane:gF,LucideCandyOff:xF,LucideCannabis:vF,LucideCaptions:T_,LucideCaptionsOff:_F,LucideCar:jF,LucideCarFront:bF,LucideCarTaxiFront:wF,LucideCaravan:kF,LucideCarrot:NF,LucideCaseLower:SF,LucideCaseSensitive:CF,LucideCaseUpper:MF,LucideCassetteTape:TF,LucideCast:AF,LucideCastle:EF,LucideCat:IF,LucideCctv:PF,LucideChartArea:A_,LucideChartBar:I_,LucideChartBarBig:E_,LucideChartBarDecreasing:LF,LucideChartBarIncreasing:OF,LucideChartBarStacked:DF,LucideChartCandlestick:P_,LucideChartColumn:dc,LucideChartColumnBig:L_,LucideChartColumnDecreasing:RF,LucideChartColumnIncreasing:O_,LucideChartColumnStacked:FF,LucideChartGantt:zF,LucideChartLine:D_,LucideChartNetwork:BF,LucideChartNoAxesColumn:F_,LucideChartNoAxesColumnDecreasing:$F,LucideChartNoAxesColumnIncreasing:R_,LucideChartNoAxesCombined:UF,LucideChartNoAxesGantt:z_,LucideChartPie:B_,LucideChartScatter:$_,LucideChartSpline:qF,LucideCheck:Ai,LucideCheckCheck:VF,LucideCheckCircle:Yi,LucideCheckCircle2:Xi,LucideCheckSquare:w0,LucideCheckSquare2:Mb,LucideChefHat:HF,LucideCherry:WF,LucideChevronDown:Fd,LucideChevronDownCircle:Y_,LucideChevronDownSquare:Tb,LucideChevronFirst:GF,LucideChevronLast:KF,LucideChevronLeft:Ac,LucideChevronLeftCircle:X_,LucideChevronLeftSquare:Ab,LucideChevronRight:Vi,LucideChevronRightCircle:Q_,LucideChevronRightSquare:Eb,LucideChevronUp:f1,LucideChevronUpCircle:J_,LucideChevronUpSquare:Ib,LucideChevronsDown:YF,LucideChevronsDownUp:ZF,LucideChevronsLeft:JF,LucideChevronsLeftRight:QF,LucideChevronsLeftRightEllipsis:XF,LucideChevronsRight:tz,LucideChevronsRightLeft:ez,LucideChevronsUp:rz,LucideChevronsUpDown:p1,LucideChrome:nz,LucideChurch:sz,LucideCigarette:iz,LucideCigaretteOff:az,LucideCircle:Bu,LucideCircleAlert:fl,LucideCircleArrowDown:U_,LucideCircleArrowLeft:q_,LucideCircleArrowOutDownLeft:V_,LucideCircleArrowOutDownRight:H_,LucideCircleArrowOutUpLeft:W_,LucideCircleArrowOutUpRight:G_,LucideCircleArrowRight:K_,LucideCircleArrowUp:Z_,LucideCircleCheck:Xi,LucideCircleCheckBig:Yi,LucideCircleChevronDown:Y_,LucideCircleChevronLeft:X_,LucideCircleChevronRight:Q_,LucideCircleChevronUp:J_,LucideCircleDashed:oz,LucideCircleDivide:e2,LucideCircleDollarSign:lz,LucideCircleDot:dz,LucideCircleDotDashed:cz,LucideCircleEllipsis:uz,LucideCircleEqual:hz,LucideCircleFadingArrowUp:fz,LucideCircleFadingPlus:pz,LucideCircleGauge:t2,LucideCircleHelp:Cx,LucideCircleMinus:r2,LucideCircleOff:mz,LucideCircleParking:s2,LucideCircleParkingOff:n2,LucideCirclePause:a2,LucideCirclePercent:i2,LucideCirclePlay:$f,LucideCirclePlus:o2,LucideCirclePower:l2,LucideCircleSlash:gz,LucideCircleSlash2:c2,LucideCircleSlashed:c2,LucideCircleStop:d2,LucideCircleUser:h2,LucideCircleUserRound:u2,LucideCircleX:Vc,LucideCircuitBoard:xz,LucideCitrus:yz,LucideClapperboard:vz,LucideClipboard:Sz,LucideClipboardCheck:ET,LucideClipboardCopy:_z,LucideClipboardEdit:p2,LucideClipboardList:IT,LucideClipboardMinus:bz,LucideClipboardPaste:wz,LucideClipboardPen:p2,LucideClipboardPenLine:f2,LucideClipboardPlus:jz,LucideClipboardSignature:f2,LucideClipboardType:kz,LucideClipboardX:Nz,LucideClock:Ya,LucideClock1:Cz,LucideClock10:Mz,LucideClock11:Tz,LucideClock12:Az,LucideClock2:Ez,LucideClock3:Iz,LucideClock4:Pz,LucideClock5:Lz,LucideClock6:Oz,LucideClock7:Dz,LucideClock8:Rz,LucideClock9:Fz,LucideClockAlert:zz,LucideClockArrowDown:Bz,LucideClockArrowUp:$z,LucideCloud:r7,LucideCloudAlert:Uz,LucideCloudCog:qz,LucideCloudDownload:m2,LucideCloudDrizzle:Vz,LucideCloudFog:Hz,LucideCloudHail:Wz,LucideCloudLightning:Gz,LucideCloudMoon:Zz,LucideCloudMoonRain:Kz,LucideCloudOff:Yz,LucideCloudRain:Qz,LucideCloudRainWind:Xz,LucideCloudSnow:Jz,LucideCloudSun:t7,LucideCloudSunRain:e7,LucideCloudUpload:g2,LucideCloudy:n7,LucideClover:Ox,LucideClub:s7,LucideCode:hj,LucideCode2:x2,LucideCodeSquare:Pb,LucideCodeXml:x2,LucideCodepen:a7,LucideCodesandbox:i7,LucideCoffee:fj,LucideCog:o7,LucideCoins:l7,LucideColumns:y2,LucideColumns2:y2,LucideColumns3:v2,LucideColumns4:c7,LucideCombine:d7,LucideCommand:u7,LucideCompass:h7,LucideComponent:f7,LucideComputer:p7,LucideConciergeBell:m7,LucideCone:g7,LucideConstruction:x7,LucideContact:y7,LucideContact2:_2,LucideContactRound:_2,LucideContainer:v7,LucideContrast:_7,LucideCookie:b7,LucideCookingPot:w7,LucideCopy:Qo,LucideCopyCheck:j7,LucideCopyMinus:k7,LucideCopyPlus:N7,LucideCopySlash:S7,LucideCopyX:C7,LucideCopyleft:M7,LucideCopyright:T7,LucideCornerDownLeft:A7,LucideCornerDownRight:E7,LucideCornerLeftDown:I7,LucideCornerLeftUp:P7,LucideCornerRightDown:L7,LucideCornerRightUp:O7,LucideCornerUpLeft:D7,LucideCornerUpRight:R7,LucideCpu:F7,LucideCreativeCommons:z7,LucideCreditCard:gm,LucideCroissant:B7,LucideCrop:$7,LucideCross:U7,LucideCrosshair:q7,LucideCrown:m1,LucideCuboid:V7,LucideCupSoda:H7,LucideCurlyBraces:M_,LucideCurrency:W7,LucideCylinder:G7,LucideDam:K7,LucideDatabase:X7,LucideDatabaseBackup:Z7,LucideDatabaseZap:Y7,LucideDelete:Q7,LucideDessert:J7,LucideDiameter:e9,LucideDiamond:n9,LucideDiamondMinus:t9,LucideDiamondPercent:b2,LucideDiamondPlus:r9,LucideDice1:s9,LucideDice2:a9,LucideDice3:i9,LucideDice4:o9,LucideDice5:l9,LucideDice6:c9,LucideDices:d9,LucideDiff:u9,LucideDisc:m9,LucideDisc2:h9,LucideDisc3:f9,LucideDiscAlbum:p9,LucideDivide:g9,LucideDivideCircle:e2,LucideDivideSquare:Rb,LucideDna:y9,LucideDnaOff:x9,LucideDock:v9,LucideDog:_9,LucideDollarSign:fd,LucideDonut:b9,LucideDoorClosed:w9,LucideDoorOpen:pj,LucideDot:j9,LucideDotSquare:Fb,LucideDownload:no,LucideDownloadCloud:m2,LucideDraftingCompass:k9,LucideDrama:N9,LucideDribbble:S9,LucideDrill:C9,LucideDroplet:M9,LucideDroplets:T9,LucideDrum:A9,LucideDrumstick:E9,LucideDumbbell:I9,LucideEar:L9,LucideEarOff:P9,LucideEarth:w2,LucideEarthLock:O9,LucideEclipse:D9,LucideEdit:ic,LucideEdit2:b0,LucideEdit3:nb,LucideEgg:rS,LucideEggFried:R9,LucideEggOff:F9,LucideEllipsis:nm,LucideEllipsisVertical:Mx,LucideEqual:$9,LucideEqualApproximately:z9,LucideEqualNot:B9,LucideEqualSquare:zb,LucideEraser:U9,LucideEthernetPort:q9,LucideEuro:V9,LucideExpand:H9,LucideExternalLink:Ls,LucideEye:el,LucideEyeClosed:W9,LucideEyeOff:g1,LucideFacebook:zd,LucideFactory:G9,LucideFan:K9,LucideFastForward:Z9,LucideFeather:Y9,LucideFence:X9,LucideFerrisWheel:Q9,LucideFigma:J9,LucideFile:GB,LucideFileArchive:eB,LucideFileAudio:rB,LucideFileAudio2:tB,LucideFileAxis3D:j2,LucideFileAxis3d:j2,LucideFileBadge:sB,LucideFileBadge2:nB,LucideFileBarChart:k2,LucideFileBarChart2:N2,LucideFileBox:aB,LucideFileChartColumn:N2,LucideFileChartColumnIncreasing:k2,LucideFileChartLine:S2,LucideFileChartPie:C2,LucideFileCheck:oB,LucideFileCheck2:iB,LucideFileClock:lB,LucideFileCode:dB,LucideFileCode2:cB,LucideFileCog:M2,LucideFileCog2:M2,LucideFileDiff:uB,LucideFileDigit:hB,LucideFileDown:fB,LucideFileEdit:A2,LucideFileHeart:pB,LucideFileImage:x1,LucideFileInput:mB,LucideFileJson:xB,LucideFileJson2:gB,LucideFileKey:vB,LucideFileKey2:yB,LucideFileLineChart:S2,LucideFileLock:bB,LucideFileLock2:_B,LucideFileMinus:jB,LucideFileMinus2:wB,LucideFileMusic:kB,LucideFileOutput:NB,LucideFilePen:A2,LucideFilePenLine:T2,LucideFilePieChart:C2,LucideFilePlus:CB,LucideFilePlus2:SB,LucideFileQuestion:MB,LucideFileScan:TB,LucideFileSearch:EB,LucideFileSearch2:AB,LucideFileSignature:T2,LucideFileSliders:IB,LucideFileSpreadsheet:y1,LucideFileStack:PB,LucideFileSymlink:LB,LucideFileTerminal:OB,LucideFileText:La,LucideFileType:RB,LucideFileType2:DB,LucideFileUp:FB,LucideFileUser:zB,LucideFileVideo:$B,LucideFileVideo2:BB,LucideFileVolume:qB,LucideFileVolume2:UB,LucideFileWarning:VB,LucideFileX:WB,LucideFileX2:HB,LucideFiles:KB,LucideFilm:Id,LucideFilter:v1,LucideFilterX:ZB,LucideFingerprint:YB,LucideFireExtinguisher:XB,LucideFish:e$,LucideFishOff:QB,LucideFishSymbol:JB,LucideFlag:Ux,LucideFlagOff:t$,LucideFlagTriangleLeft:r$,LucideFlagTriangleRight:n$,LucideFlame:ef,LucideFlameKindling:s$,LucideFlashlight:i$,LucideFlashlightOff:a$,LucideFlaskConical:mj,LucideFlaskConicalOff:o$,LucideFlaskRound:l$,LucideFlipHorizontal:d$,LucideFlipHorizontal2:c$,LucideFlipVertical:h$,LucideFlipVertical2:u$,LucideFlower:f$,LucideFlower2:lm,LucideFocus:p$,LucideFoldHorizontal:m$,LucideFoldVertical:g$,LucideFolder:q$,LucideFolderArchive:x$,LucideFolderCheck:y$,LucideFolderClock:v$,LucideFolderClosed:_$,LucideFolderCode:b$,LucideFolderCog:E2,LucideFolderCog2:E2,LucideFolderDot:w$,LucideFolderDown:j$,LucideFolderEdit:I2,LucideFolderGit:N$,LucideFolderGit2:k$,LucideFolderHeart:S$,LucideFolderInput:C$,LucideFolderKanban:M$,LucideFolderKey:T$,LucideFolderLock:A$,LucideFolderMinus:E$,LucideFolderOpen:qx,LucideFolderOpenDot:I$,LucideFolderOutput:P$,LucideFolderPen:I2,LucideFolderPlus:L$,LucideFolderRoot:O$,LucideFolderSearch:R$,LucideFolderSearch2:D$,LucideFolderSymlink:F$,LucideFolderSync:z$,LucideFolderTree:B$,LucideFolderUp:$$,LucideFolderX:U$,LucideFolders:V$,LucideFootprints:H$,LucideForkKnife:kw,LucideForkKnifeCrossed:jw,LucideForklift:W$,LucideFormInput:ab,LucideForward:G$,LucideFrame:K$,LucideFramer:Z$,LucideFrown:Y$,LucideFuel:X$,LucideFullscreen:Q$,LucideFunctionSquare:Bb,LucideGalleryHorizontal:eU,LucideGalleryHorizontalEnd:J$,LucideGalleryThumbnails:tU,LucideGalleryVertical:nU,LucideGalleryVerticalEnd:rU,LucideGamepad:aU,LucideGamepad2:sU,LucideGanttChart:z_,LucideGanttChartSquare:Qm,LucideGauge:iU,LucideGaugeCircle:t2,LucideGavel:oU,LucideGem:lU,LucideGhost:gj,LucideGift:Ki,LucideGitBranch:dU,LucideGitBranchPlus:cU,LucideGitCommit:P2,LucideGitCommitHorizontal:P2,LucideGitCommitVertical:uU,LucideGitCompare:fU,LucideGitCompareArrows:hU,LucideGitFork:pU,LucideGitGraph:mU,LucideGitMerge:gU,LucideGitPullRequest:wU,LucideGitPullRequestArrow:xU,LucideGitPullRequestClosed:yU,LucideGitPullRequestCreate:_U,LucideGitPullRequestCreateArrow:vU,LucideGitPullRequestDraft:bU,LucideGithub:jU,LucideGitlab:kU,LucideGlassWater:NU,LucideGlasses:SU,LucideGlobe:Vx,LucideGlobe2:w2,LucideGlobeLock:CU,LucideGoal:MU,LucideGrab:TU,LucideGraduationCap:_1,LucideGrape:AU,LucideGrid:$h,LucideGrid2X2:O2,LucideGrid2X2Plus:L2,LucideGrid2x2:O2,LucideGrid2x2Check:EU,LucideGrid2x2Plus:L2,LucideGrid2x2X:IU,LucideGrid3X3:$h,LucideGrid3x3:$h,LucideGrip:LU,LucideGripHorizontal:PU,LucideGripVertical:b1,LucideGroup:OU,LucideGuitar:DU,LucideHam:RU,LucideHammer:FU,LucideHand:qU,LucideHandCoins:zU,LucideHandHeart:BU,LucideHandHelping:D2,LucideHandMetal:$U,LucideHandPlatter:UU,LucideHandshake:VU,LucideHardDrive:PT,LucideHardDriveDownload:HU,LucideHardDriveUpload:WU,LucideHardHat:GU,LucideHash:nS,LucideHaze:KU,LucideHdmiPort:ZU,LucideHeading:eq,LucideHeading1:LT,LucideHeading2:OT,LucideHeading3:YU,LucideHeading4:XU,LucideHeading5:QU,LucideHeading6:JU,LucideHeadphoneOff:tq,LucideHeadphones:rq,LucideHeadset:nq,LucideHeart:ci,LucideHeartCrack:sq,LucideHeartHandshake:aq,LucideHeartOff:iq,LucideHeartPulse:oq,LucideHeater:lq,LucideHelpCircle:Cx,LucideHelpingHand:D2,LucideHexagon:cq,LucideHighlighter:dq,LucideHistory:sS,LucideHome:da,LucideHop:hq,LucideHopOff:uq,LucideHospital:fq,LucideHotel:pq,LucideHourglass:mq,LucideHouse:da,LucideHousePlug:gq,LucideHousePlus:xq,LucideIceCream:F2,LucideIceCream2:R2,LucideIceCreamBowl:R2,LucideIceCreamCone:F2,LucideIdCard:yq,LucideImage:Pl,LucideImageDown:vq,LucideImageMinus:_q,LucideImageOff:bq,LucideImagePlay:wq,LucideImagePlus:aS,LucideImageUp:jq,LucideImageUpscale:kq,LucideImages:Nq,LucideImport:Sq,LucideInbox:Cq,LucideIndent:B2,LucideIndentDecrease:z2,LucideIndentIncrease:B2,LucideIndianRupee:Mq,LucideInfinity:Tq,LucideInfo:Aq,LucideInspect:Wb,LucideInspectionPanel:Eq,LucideInstagram:du,LucideItalic:iS,LucideIterationCcw:Iq,LucideIterationCw:Pq,LucideJapaneseYen:Lq,LucideJoystick:Oq,LucideKanban:Hx,LucideKanbanSquare:$b,LucideKanbanSquareDashed:Lb,LucideKey:tf,LucideKeyRound:xj,LucideKeySquare:Dq,LucideKeyboard:zq,LucideKeyboardMusic:Rq,LucideKeyboardOff:Fq,LucideLamp:Hq,LucideLampCeiling:Bq,LucideLampDesk:$q,LucideLampFloor:Uq,LucideLampWallDown:qq,LucideLampWallUp:Vq,LucideLandPlot:Wq,LucideLandmark:Gq,LucideLanguages:Kq,LucideLaptop:Yq,LucideLaptop2:$2,LucideLaptopMinimal:$2,LucideLaptopMinimalCheck:Zq,LucideLasso:Qq,LucideLassoSelect:Xq,LucideLaugh:Jq,LucideLayers:rV,LucideLayers2:eV,LucideLayers3:tV,LucideLayout:_0,LucideLayoutDashboard:yj,LucideLayoutGrid:Yf,LucideLayoutList:nV,LucideLayoutPanelLeft:sV,LucideLayoutPanelTop:aV,LucideLayoutTemplate:iV,LucideLeaf:oV,LucideLeafyGreen:lV,LucideLectern:cV,LucideLetterText:dV,LucideLibrary:oS,LucideLibraryBig:uV,LucideLibrarySquare:Ub,LucideLifeBuoy:lS,LucideLigature:hV,LucideLightbulb:w1,LucideLightbulbOff:fV,LucideLineChart:D_,LucideLink:Co,LucideLink2:rf,LucideLink2Off:pV,LucideLinkedin:xm,LucideList:Xf,LucideListCheck:mV,LucideListChecks:gV,LucideListCollapse:xV,LucideListEnd:yV,LucideListFilter:vV,LucideListMinus:_V,LucideListMusic:bV,LucideListOrdered:cS,LucideListPlus:wV,LucideListRestart:jV,LucideListStart:kV,LucideListTodo:NV,LucideListTree:SV,LucideListVideo:CV,LucideListX:MV,LucideLoader:AV,LucideLoader2:en,LucideLoaderCircle:en,LucideLoaderPinwheel:TV,LucideLocate:DT,LucideLocateFixed:EV,LucideLocateOff:IV,LucideLock:Qf,LucideLockKeyhole:PV,LucideLockKeyholeOpen:U2,LucideLockOpen:q2,LucideLogIn:dS,LucideLogOut:uS,LucideLogs:LV,LucideLollipop:OV,LucideLuggage:DV,LucideMSquare:qb,LucideMagnet:RV,LucideMail:ua,LucideMailCheck:FV,LucideMailMinus:zV,LucideMailOpen:BV,LucideMailPlus:$V,LucideMailQuestion:UV,LucideMailSearch:qV,LucideMailWarning:VV,LucideMailX:RT,LucideMailbox:HV,LucideMails:WV,LucideMap:sH,LucideMapPin:Mo,LucideMapPinCheck:KV,LucideMapPinCheckInside:GV,LucideMapPinHouse:ZV,LucideMapPinMinus:XV,LucideMapPinMinusInside:YV,LucideMapPinOff:QV,LucideMapPinPlus:eH,LucideMapPinPlusInside:JV,LucideMapPinX:rH,LucideMapPinXInside:tH,LucideMapPinned:nH,LucideMartini:aH,LucideMaximize:oH,LucideMaximize2:iH,LucideMedal:Wx,LucideMegaphone:ym,LucideMegaphoneOff:lH,LucideMeh:cH,LucideMemoryStick:dH,LucideMenu:FT,LucideMenuSquare:Vb,LucideMerge:uH,LucideMessageCircle:Fl,LucideMessageCircleCode:hH,LucideMessageCircleDashed:fH,LucideMessageCircleHeart:hS,LucideMessageCircleMore:pH,LucideMessageCircleOff:mH,LucideMessageCirclePlus:gH,LucideMessageCircleQuestion:zT,LucideMessageCircleReply:xH,LucideMessageCircleWarning:yH,LucideMessageCircleX:vH,LucideMessageSquare:Oo,LucideMessageSquareCode:_H,LucideMessageSquareDashed:bH,LucideMessageSquareDiff:wH,LucideMessageSquareDot:jH,LucideMessageSquareHeart:kH,LucideMessageSquareLock:NH,LucideMessageSquareMore:SH,LucideMessageSquareOff:CH,LucideMessageSquarePlus:MH,LucideMessageSquareQuote:BT,LucideMessageSquareReply:TH,LucideMessageSquareShare:AH,LucideMessageSquareText:EH,LucideMessageSquareWarning:IH,LucideMessageSquareX:PH,LucideMessagesSquare:LH,LucideMic:$T,LucideMic2:V2,LucideMicOff:OH,LucideMicVocal:V2,LucideMicrochip:DH,LucideMicroscope:RH,LucideMicrowave:FH,LucideMilestone:zH,LucideMilk:$H,LucideMilkOff:BH,LucideMinimize:qH,LucideMinimize2:UH,LucideMinus:j1,LucideMinusCircle:r2,LucideMinusSquare:Hb,LucideMonitor:vj,LucideMonitorCheck:VH,LucideMonitorCog:HH,LucideMonitorDot:WH,LucideMonitorDown:GH,LucideMonitorOff:KH,LucideMonitorPause:ZH,LucideMonitorPlay:YH,LucideMonitorSmartphone:XH,LucideMonitorSpeaker:QH,LucideMonitorStop:JH,LucideMonitorUp:eW,LucideMonitorX:tW,LucideMoon:nW,LucideMoonStar:rW,LucideMoreHorizontal:nm,LucideMoreVertical:Mx,LucideMountain:aW,LucideMountainSnow:sW,LucideMouse:dW,LucideMouseOff:iW,LucideMousePointer:cW,LucideMousePointer2:oW,LucideMousePointerBan:lW,LucideMousePointerClick:_j,LucideMousePointerSquareDashed:Ob,LucideMove:jW,LucideMove3D:H2,LucideMove3d:H2,LucideMoveDiagonal:hW,LucideMoveDiagonal2:uW,LucideMoveDown:mW,LucideMoveDownLeft:fW,LucideMoveDownRight:pW,LucideMoveHorizontal:gW,LucideMoveLeft:xW,LucideMoveRight:yW,LucideMoveUp:bW,LucideMoveUpLeft:vW,LucideMoveUpRight:_W,LucideMoveVertical:wW,LucideMusic:CW,LucideMusic2:kW,LucideMusic3:NW,LucideMusic4:SW,LucideNavigation:UT,LucideNavigation2:TW,LucideNavigation2Off:MW,LucideNavigationOff:AW,LucideNetwork:EW,LucideNewspaper:Gx,LucideNfc:IW,LucideNotebook:DW,LucideNotebookPen:PW,LucideNotebookTabs:LW,LucideNotebookText:OW,LucideNotepadText:FW,LucideNotepadTextDashed:RW,LucideNut:BW,LucideNutOff:zW,LucideOctagon:UW,LucideOctagonAlert:W2,LucideOctagonMinus:$W,LucideOctagonPause:G2,LucideOctagonX:K2,LucideOmega:qW,LucideOption:VW,LucideOrbit:HW,LucideOrigami:WW,LucideOutdent:z2,LucidePackage:zl,LucidePackage2:GW,LucidePackageCheck:KW,LucidePackageMinus:ZW,LucidePackageOpen:YW,LucidePackagePlus:XW,LucidePackageSearch:QW,LucidePackageX:JW,LucidePaintBucket:eG,LucidePaintRoller:tG,LucidePaintbrush:rG,LucidePaintbrush2:Z2,LucidePaintbrushVertical:Z2,LucidePalette:pd,LucidePalmtree:fw,LucidePanelBottom:aG,LucidePanelBottomClose:nG,LucidePanelBottomDashed:Y2,LucidePanelBottomInactive:Y2,LucidePanelBottomOpen:sG,LucidePanelLeft:eb,LucidePanelLeftClose:X2,LucidePanelLeftDashed:Q2,LucidePanelLeftInactive:Q2,LucidePanelLeftOpen:J2,LucidePanelRight:lG,LucidePanelRightClose:iG,LucidePanelRightDashed:tb,LucidePanelRightInactive:tb,LucidePanelRightOpen:oG,LucidePanelTop:uG,LucidePanelTopClose:cG,LucidePanelTopDashed:rb,LucidePanelTopInactive:rb,LucidePanelTopOpen:dG,LucidePanelsLeftBottom:hG,LucidePanelsLeftRight:v2,LucidePanelsRightBottom:fG,LucidePanelsTopBottom:lb,LucidePanelsTopLeft:_0,LucidePaperclip:pG,LucideParentheses:mG,LucideParkingCircle:s2,LucideParkingCircleOff:n2,LucideParkingMeter:gG,LucideParkingSquare:Kb,LucideParkingSquareOff:Gb,LucidePartyPopper:Ec,LucidePause:Jf,LucidePauseCircle:a2,LucidePauseOctagon:G2,LucidePawPrint:xG,LucidePcCase:yG,LucidePen:b0,LucidePenBox:ic,LucidePenLine:nb,LucidePenOff:vG,LucidePenSquare:ic,LucidePenTool:bj,LucidePencil:fi,LucidePencilLine:_G,LucidePencilOff:bG,LucidePencilRuler:wG,LucidePentagon:jG,LucidePercent:fS,LucidePercentCircle:i2,LucidePercentDiamond:b2,LucidePercentSquare:Zb,LucidePersonStanding:kG,LucidePhilippinePeso:NG,LucidePhone:bi,LucidePhoneCall:SG,LucidePhoneForwarded:CG,LucidePhoneIncoming:MG,LucidePhoneMissed:TG,LucidePhoneOff:AG,LucidePhoneOutgoing:EG,LucidePi:IG,LucidePiSquare:Yb,LucidePiano:PG,LucidePickaxe:LG,LucidePictureInPicture:DG,LucidePictureInPicture2:OG,LucidePieChart:B_,LucidePiggyBank:RG,LucidePilcrow:BG,LucidePilcrowLeft:FG,LucidePilcrowRight:zG,LucidePilcrowSquare:Xb,LucidePill:UG,LucidePillBottle:$G,LucidePin:k1,LucidePinOff:qT,LucidePipette:qG,LucidePizza:VG,LucidePlane:GG,LucidePlaneLanding:HG,LucidePlaneTakeoff:WG,LucidePlay:fc,LucidePlayCircle:$f,LucidePlaySquare:Qb,LucidePlug:ZG,LucidePlug2:KG,LucidePlugZap:sb,LucidePlugZap2:sb,LucidePlus:bn,LucidePlusCircle:o2,LucidePlusSquare:Jb,LucidePocket:XG,LucidePocketKnife:YG,LucidePodcast:QG,LucidePointer:eK,LucidePointerOff:JG,LucidePopcorn:tK,LucidePopsicle:rK,LucidePoundSterling:nK,LucidePower:aK,LucidePowerCircle:l2,LucidePowerOff:sK,LucidePowerSquare:ew,LucidePresentation:iK,LucidePrinter:lK,LucidePrinterCheck:oK,LucideProjector:cK,LucideProportions:dK,LucidePuzzle:uK,LucidePyramid:hK,LucideQrCode:VT,LucideQuote:HT,LucideRabbit:fK,LucideRadar:pK,LucideRadiation:mK,LucideRadical:gK,LucideRadio:wj,LucideRadioReceiver:xK,LucideRadioTower:yK,LucideRadius:vK,LucideRailSymbol:_K,LucideRainbow:bK,LucideRat:wK,LucideRatio:jK,LucideReceipt:IK,LucideReceiptCent:kK,LucideReceiptEuro:NK,LucideReceiptIndianRupee:SK,LucideReceiptJapaneseYen:CK,LucideReceiptPoundSterling:MK,LucideReceiptRussianRuble:TK,LucideReceiptSwissFranc:AK,LucideReceiptText:EK,LucideRectangleEllipsis:ab,LucideRectangleHorizontal:PK,LucideRectangleVertical:LK,LucideRecycle:OK,LucideRedo:pS,LucideRedo2:DK,LucideRedoDot:RK,LucideRefreshCcw:zK,LucideRefreshCcwDot:FK,LucideRefreshCw:Gl,LucideRefreshCwOff:BK,LucideRefrigerator:$K,LucideRegex:UK,LucideRemoveFormatting:qK,LucideRepeat:WT,LucideRepeat1:VK,LucideRepeat2:HK,LucideReplace:GK,LucideReplaceAll:WK,LucideReply:GT,LucideReplyAll:KK,LucideRewind:ZK,LucideRibbon:YK,LucideRocket:_g,LucideRockingChair:XK,LucideRollerCoaster:QK,LucideRotate3D:ib,LucideRotate3d:ib,LucideRotateCcw:mS,LucideRotateCcwSquare:JK,LucideRotateCw:KT,LucideRotateCwSquare:eZ,LucideRoute:rZ,LucideRouteOff:tZ,LucideRouter:nZ,LucideRows:ob,LucideRows2:ob,LucideRows3:lb,LucideRows4:sZ,LucideRss:aZ,LucideRuler:iZ,LucideRussianRuble:oZ,LucideSailboat:lZ,LucideSalad:cZ,LucideSandwich:dZ,LucideSatellite:hZ,LucideSatelliteDish:uZ,LucideSave:bg,LucideSaveAll:fZ,LucideSaveOff:pZ,LucideScale:mZ,LucideScale3D:cb,LucideScale3d:cb,LucideScaling:gZ,LucideScan:kZ,LucideScanBarcode:xZ,LucideScanEye:yZ,LucideScanFace:vZ,LucideScanLine:_Z,LucideScanQrCode:bZ,LucideScanSearch:wZ,LucideScanText:jZ,LucideScatterChart:$_,LucideSchool:NZ,LucideSchool2:mw,LucideScissors:CZ,LucideScissorsLineDashed:SZ,LucideScissorsSquare:tw,LucideScissorsSquareDashedBottom:Cb,LucideScreenShare:TZ,LucideScreenShareOff:MZ,LucideScroll:EZ,LucideScrollText:AZ,LucideSearch:wa,LucideSearchCheck:IZ,LucideSearchCode:PZ,LucideSearchSlash:LZ,LucideSearchX:OZ,LucideSection:DZ,LucideSend:Do,LucideSendHorizonal:db,LucideSendHorizontal:db,LucideSendToBack:RZ,LucideSeparatorHorizontal:FZ,LucideSeparatorVertical:zZ,LucideServer:qZ,LucideServerCog:BZ,LucideServerCrash:$Z,LucideServerOff:UZ,LucideSettings:md,LucideSettings2:VZ,LucideShapes:HZ,LucideShare:ZT,LucideShare2:pc,LucideSheet:WZ,LucideShell:GZ,LucideShield:nf,LucideShieldAlert:KZ,LucideShieldBan:ZZ,LucideShieldCheck:YT,LucideShieldClose:ub,LucideShieldEllipsis:YZ,LucideShieldHalf:XZ,LucideShieldMinus:QZ,LucideShieldOff:JZ,LucideShieldPlus:eY,LucideShieldQuestion:tY,LucideShieldX:ub,LucideShip:nY,LucideShipWheel:rY,LucideShirt:sY,LucideShoppingBag:wg,LucideShoppingBasket:aY,LucideShoppingCart:ph,LucideShovel:iY,LucideShowerHead:oY,LucideShrink:lY,LucideShrub:cY,LucideShuffle:dY,LucideSidebar:eb,LucideSidebarClose:X2,LucideSidebarOpen:J2,LucideSigma:uY,LucideSigmaSquare:rw,LucideSignal:gY,LucideSignalHigh:hY,LucideSignalLow:fY,LucideSignalMedium:pY,LucideSignalZero:mY,LucideSignature:xY,LucideSignpost:vY,LucideSignpostBig:yY,LucideSiren:_Y,LucideSkipBack:bY,LucideSkipForward:wY,LucideSkull:jY,LucideSlack:kY,LucideSlash:NY,LucideSlashSquare:nw,LucideSlice:SY,LucideSliders:hb,LucideSlidersHorizontal:XT,LucideSlidersVertical:hb,LucideSmartphone:jg,LucideSmartphoneCharging:CY,LucideSmartphoneNfc:MY,LucideSmile:AY,LucideSmilePlus:TY,LucideSnail:EY,LucideSnowflake:Z0,LucideSofa:IY,LucideSortAsc:b_,LucideSortDesc:y_,LucideSoup:PY,LucideSpace:LY,LucideSpade:OY,LucideSparkle:DY,LucideSparkles:Ms,LucideSpeaker:RY,LucideSpeech:FY,LucideSpellCheck:BY,LucideSpellCheck2:zY,LucideSpline:$Y,LucideSplit:UY,LucideSplitSquareHorizontal:sw,LucideSplitSquareVertical:aw,LucideSprayCan:qY,LucideSprout:VY,LucideSquare:kg,LucideSquareActivity:fb,LucideSquareArrowDown:gb,LucideSquareArrowDownLeft:pb,LucideSquareArrowDownRight:mb,LucideSquareArrowLeft:xb,LucideSquareArrowOutDownLeft:yb,LucideSquareArrowOutDownRight:vb,LucideSquareArrowOutUpLeft:_b,LucideSquareArrowOutUpRight:bb,LucideSquareArrowRight:wb,LucideSquareArrowUp:Nb,LucideSquareArrowUpLeft:jb,LucideSquareArrowUpRight:kb,LucideSquareAsterisk:Sb,LucideSquareBottomDashedScissors:Cb,LucideSquareChartGantt:Qm,LucideSquareCheck:Mb,LucideSquareCheckBig:w0,LucideSquareChevronDown:Tb,LucideSquareChevronLeft:Ab,LucideSquareChevronRight:Eb,LucideSquareChevronUp:Ib,LucideSquareCode:Pb,LucideSquareDashed:Db,LucideSquareDashedBottom:WY,LucideSquareDashedBottomCode:HY,LucideSquareDashedKanban:Lb,LucideSquareDashedMousePointer:Ob,LucideSquareDivide:Rb,LucideSquareDot:Fb,LucideSquareEqual:zb,LucideSquareFunction:Bb,LucideSquareGanttChart:Qm,LucideSquareKanban:$b,LucideSquareLibrary:Ub,LucideSquareM:qb,LucideSquareMenu:Vb,LucideSquareMinus:Hb,LucideSquareMousePointer:Wb,LucideSquareParking:Kb,LucideSquareParkingOff:Gb,LucideSquarePen:ic,LucideSquarePercent:Zb,LucideSquarePi:Yb,LucideSquarePilcrow:Xb,LucideSquarePlay:Qb,LucideSquarePlus:Jb,LucideSquarePower:ew,LucideSquareRadical:GY,LucideSquareScissors:tw,LucideSquareSigma:rw,LucideSquareSlash:nw,LucideSquareSplitHorizontal:sw,LucideSquareSplitVertical:aw,LucideSquareSquare:KY,LucideSquareStack:ZY,LucideSquareTerminal:iw,LucideSquareUser:lw,LucideSquareUserRound:ow,LucideSquareX:cw,LucideSquircle:YY,LucideSquirrel:XY,LucideStamp:QY,LucideStar:vs,LucideStarHalf:JY,LucideStarOff:eX,LucideStars:Ms,LucideStepBack:tX,LucideStepForward:rX,LucideStethoscope:nX,LucideSticker:sX,LucideStickyNote:aX,LucideStopCircle:d2,LucideStore:iX,LucideStretchHorizontal:oX,LucideStretchVertical:lX,LucideStrikethrough:cX,LucideSubscript:dX,LucideSubtitles:T_,LucideSun:N1,LucideSunDim:uX,LucideSunMedium:hX,LucideSunMoon:fX,LucideSunSnow:pX,LucideSunrise:mX,LucideSunset:gX,LucideSuperscript:xX,LucideSwatchBook:yX,LucideSwissFranc:vX,LucideSwitchCamera:_X,LucideSword:bX,LucideSwords:wX,LucideSyringe:jX,LucideTable:AX,LucideTable2:gS,LucideTableCellsMerge:kX,LucideTableCellsSplit:NX,LucideTableColumnsSplit:SX,LucideTableOfContents:CX,LucideTableProperties:MX,LucideTableRowsSplit:TX,LucideTablet:IX,LucideTabletSmartphone:EX,LucideTablets:PX,LucideTag:Ng,LucideTags:LX,LucideTally1:OX,LucideTally2:DX,LucideTally3:RX,LucideTally4:FX,LucideTally5:zX,LucideTangent:BX,LucideTarget:Kx,LucideTelescope:$X,LucideTent:qX,LucideTentTree:UX,LucideTerminal:VX,LucideTerminalSquare:iw,LucideTestTube:HX,LucideTestTube2:dw,LucideTestTubeDiagonal:dw,LucideTestTubes:WX,LucideText:XX,LucideTextCursor:KX,LucideTextCursorInput:GX,LucideTextQuote:ZX,LucideTextSearch:YX,LucideTextSelect:uw,LucideTextSelection:uw,LucideTheater:QX,LucideThermometer:tQ,LucideThermometerSnowflake:JX,LucideThermometerSun:eQ,LucideThumbsDown:QT,LucideThumbsUp:gd,LucideTicket:JT,LucideTicketCheck:rQ,LucideTicketMinus:nQ,LucideTicketPercent:sQ,LucideTicketPlus:aQ,LucideTicketSlash:iQ,LucideTicketX:oQ,LucideTickets:cQ,LucideTicketsPlane:lQ,LucideTimer:hQ,LucideTimerOff:dQ,LucideTimerReset:uQ,LucideToggleLeft:fQ,LucideToggleRight:pQ,LucideToilet:mQ,LucideTornado:gQ,LucideTorus:xQ,LucideTouchpad:vQ,LucideTouchpadOff:yQ,LucideTowerControl:_Q,LucideToyBrick:bQ,LucideTractor:wQ,LucideTrafficCone:jQ,LucideTrain:hw,LucideTrainFront:NQ,LucideTrainFrontTunnel:kQ,LucideTrainTrack:SQ,LucideTramFront:hw,LucideTrash:CQ,LucideTrash2:Vn,LucideTreeDeciduous:MQ,LucideTreePalm:fw,LucideTreePine:S1,LucideTrees:TQ,LucideTrello:AQ,LucideTrendingDown:jj,LucideTrendingUp:ep,LucideTrendingUpDown:EQ,LucideTriangle:PQ,LucideTriangleAlert:Hh,LucideTriangleRight:IQ,LucideTrophy:Zi,LucideTruck:eA,LucideTurtle:LQ,LucideTv:DQ,LucideTv2:pw,LucideTvMinimal:pw,LucideTvMinimalPlay:OQ,LucideTwitch:RQ,LucideTwitter:FQ,LucideType:BQ,LucideTypeOutline:zQ,LucideUmbrella:UQ,LucideUmbrellaOff:$Q,LucideUnderline:qQ,LucideUndo:xS,LucideUndo2:VQ,LucideUndoDot:HQ,LucideUnfoldHorizontal:WQ,LucideUnfoldVertical:GQ,LucideUngroup:KQ,LucideUniversity:mw,LucideUnlink:tA,LucideUnlink2:ZQ,LucideUnlock:q2,LucideUnlockKeyhole:U2,LucideUnplug:YQ,LucideUpload:uo,LucideUploadCloud:g2,LucideUsb:XQ,LucideUser:Ic,LucideUser2:bw,LucideUserCheck:kj,LucideUserCheck2:gw,LucideUserCircle:h2,LucideUserCircle2:u2,LucideUserCog:rA,LucideUserCog2:xw,LucideUserMinus:QQ,LucideUserMinus2:yw,LucideUserPen:JQ,LucideUserPlus:sf,LucideUserPlus2:vw,LucideUserRound:bw,LucideUserRoundCheck:gw,LucideUserRoundCog:xw,LucideUserRoundMinus:yw,LucideUserRoundPen:eJ,LucideUserRoundPlus:vw,LucideUserRoundSearch:tJ,LucideUserRoundX:_w,LucideUserSearch:rJ,LucideUserSquare:lw,LucideUserSquare2:ow,LucideUserX:nJ,LucideUserX2:_w,LucideUsers:Bn,LucideUsers2:ww,LucideUsersRound:ww,LucideUtensils:kw,LucideUtensilsCrossed:jw,LucideUtilityPole:sJ,LucideVariable:nA,LucideVault:aJ,LucideVegan:iJ,LucideVenetianMask:oJ,LucideVerified:k_,LucideVibrate:cJ,LucideVibrateOff:lJ,LucideVideo:Pa,LucideVideoOff:dJ,LucideVideotape:uJ,LucideView:hJ,LucideVoicemail:fJ,LucideVolleyball:pJ,LucideVolume:vJ,LucideVolume1:mJ,LucideVolume2:gJ,LucideVolumeOff:xJ,LucideVolumeX:yJ,LucideVote:_J,LucideWallet:wJ,LucideWallet2:Nw,LucideWalletCards:bJ,LucideWalletMinimal:Nw,LucideWallpaper:jJ,LucideWand:kJ,LucideWand2:Sw,LucideWandSparkles:Sw,LucideWarehouse:NJ,LucideWashingMachine:SJ,LucideWatch:CJ,LucideWaves:MJ,LucideWaypoints:TJ,LucideWebcam:AJ,LucideWebhook:IJ,LucideWebhookOff:EJ,LucideWeight:PJ,LucideWheat:OJ,LucideWheatOff:LJ,LucideWholeWord:DJ,LucideWifi:$J,LucideWifiHigh:RJ,LucideWifiLow:FJ,LucideWifiOff:zJ,LucideWifiZero:BJ,LucideWind:qJ,LucideWindArrowDown:UJ,LucideWine:HJ,LucideWineOff:VJ,LucideWorkflow:WJ,LucideWorm:GJ,LucideWrapText:KJ,LucideWrench:Zx,LucideX:_s,LucideXCircle:Vc,LucideXOctagon:K2,LucideXSquare:cw,LucideYoutube:ZJ,LucideZap:Sg,LucideZapOff:YJ,LucideZoomIn:yS,LucideZoomOut:vS,Luggage:DV,LuggageIcon:DV,MSquare:qb,MSquareIcon:qb,Magnet:RV,MagnetIcon:RV,Mail:ua,MailCheck:FV,MailCheckIcon:FV,MailIcon:ua,MailMinus:zV,MailMinusIcon:zV,MailOpen:BV,MailOpenIcon:BV,MailPlus:$V,MailPlusIcon:$V,MailQuestion:UV,MailQuestionIcon:UV,MailSearch:qV,MailSearchIcon:qV,MailWarning:VV,MailWarningIcon:VV,MailX:RT,MailXIcon:RT,Mailbox:HV,MailboxIcon:HV,Mails:WV,MailsIcon:WV,Map:sH,MapIcon:sH,MapPin:Mo,MapPinCheck:KV,MapPinCheckIcon:KV,MapPinCheckInside:GV,MapPinCheckInsideIcon:GV,MapPinHouse:ZV,MapPinHouseIcon:ZV,MapPinIcon:Mo,MapPinMinus:XV,MapPinMinusIcon:XV,MapPinMinusInside:YV,MapPinMinusInsideIcon:YV,MapPinOff:QV,MapPinOffIcon:QV,MapPinPlus:eH,MapPinPlusIcon:eH,MapPinPlusInside:JV,MapPinPlusInsideIcon:JV,MapPinX:rH,MapPinXIcon:rH,MapPinXInside:tH,MapPinXInsideIcon:tH,MapPinned:nH,MapPinnedIcon:nH,Martini:aH,MartiniIcon:aH,Maximize:oH,Maximize2:iH,Maximize2Icon:iH,MaximizeIcon:oH,Medal:Wx,MedalIcon:Wx,Megaphone:ym,MegaphoneIcon:ym,MegaphoneOff:lH,MegaphoneOffIcon:lH,Meh:cH,MehIcon:cH,MemoryStick:dH,MemoryStickIcon:dH,Menu:FT,MenuIcon:FT,MenuSquare:Vb,MenuSquareIcon:Vb,Merge:uH,MergeIcon:uH,MessageCircle:Fl,MessageCircleCode:hH,MessageCircleCodeIcon:hH,MessageCircleDashed:fH,MessageCircleDashedIcon:fH,MessageCircleHeart:hS,MessageCircleHeartIcon:hS,MessageCircleIcon:Fl,MessageCircleMore:pH,MessageCircleMoreIcon:pH,MessageCircleOff:mH,MessageCircleOffIcon:mH,MessageCirclePlus:gH,MessageCirclePlusIcon:gH,MessageCircleQuestion:zT,MessageCircleQuestionIcon:zT,MessageCircleReply:xH,MessageCircleReplyIcon:xH,MessageCircleWarning:yH,MessageCircleWarningIcon:yH,MessageCircleX:vH,MessageCircleXIcon:vH,MessageSquare:Oo,MessageSquareCode:_H,MessageSquareCodeIcon:_H,MessageSquareDashed:bH,MessageSquareDashedIcon:bH,MessageSquareDiff:wH,MessageSquareDiffIcon:wH,MessageSquareDot:jH,MessageSquareDotIcon:jH,MessageSquareHeart:kH,MessageSquareHeartIcon:kH,MessageSquareIcon:Oo,MessageSquareLock:NH,MessageSquareLockIcon:NH,MessageSquareMore:SH,MessageSquareMoreIcon:SH,MessageSquareOff:CH,MessageSquareOffIcon:CH,MessageSquarePlus:MH,MessageSquarePlusIcon:MH,MessageSquareQuote:BT,MessageSquareQuoteIcon:BT,MessageSquareReply:TH,MessageSquareReplyIcon:TH,MessageSquareShare:AH,MessageSquareShareIcon:AH,MessageSquareText:EH,MessageSquareTextIcon:EH,MessageSquareWarning:IH,MessageSquareWarningIcon:IH,MessageSquareX:PH,MessageSquareXIcon:PH,MessagesSquare:LH,MessagesSquareIcon:LH,Mic:$T,Mic2:V2,Mic2Icon:V2,MicIcon:$T,MicOff:OH,MicOffIcon:OH,MicVocal:V2,MicVocalIcon:V2,Microchip:DH,MicrochipIcon:DH,Microscope:RH,MicroscopeIcon:RH,Microwave:FH,MicrowaveIcon:FH,Milestone:zH,MilestoneIcon:zH,Milk:$H,MilkIcon:$H,MilkOff:BH,MilkOffIcon:BH,Minimize:qH,Minimize2:UH,Minimize2Icon:UH,MinimizeIcon:qH,Minus:j1,MinusCircle:r2,MinusCircleIcon:r2,MinusIcon:j1,MinusSquare:Hb,MinusSquareIcon:Hb,Monitor:vj,MonitorCheck:VH,MonitorCheckIcon:VH,MonitorCog:HH,MonitorCogIcon:HH,MonitorDot:WH,MonitorDotIcon:WH,MonitorDown:GH,MonitorDownIcon:GH,MonitorIcon:vj,MonitorOff:KH,MonitorOffIcon:KH,MonitorPause:ZH,MonitorPauseIcon:ZH,MonitorPlay:YH,MonitorPlayIcon:YH,MonitorSmartphone:XH,MonitorSmartphoneIcon:XH,MonitorSpeaker:QH,MonitorSpeakerIcon:QH,MonitorStop:JH,MonitorStopIcon:JH,MonitorUp:eW,MonitorUpIcon:eW,MonitorX:tW,MonitorXIcon:tW,Moon:nW,MoonIcon:nW,MoonStar:rW,MoonStarIcon:rW,MoreHorizontal:nm,MoreHorizontalIcon:nm,MoreVertical:Mx,MoreVerticalIcon:Mx,Mountain:aW,MountainIcon:aW,MountainSnow:sW,MountainSnowIcon:sW,Mouse:dW,MouseIcon:dW,MouseOff:iW,MouseOffIcon:iW,MousePointer:cW,MousePointer2:oW,MousePointer2Icon:oW,MousePointerBan:lW,MousePointerBanIcon:lW,MousePointerClick:_j,MousePointerClickIcon:_j,MousePointerIcon:cW,MousePointerSquareDashed:Ob,MousePointerSquareDashedIcon:Ob,Move:jW,Move3D:H2,Move3DIcon:H2,Move3d:H2,Move3dIcon:H2,MoveDiagonal:hW,MoveDiagonal2:uW,MoveDiagonal2Icon:uW,MoveDiagonalIcon:hW,MoveDown:mW,MoveDownIcon:mW,MoveDownLeft:fW,MoveDownLeftIcon:fW,MoveDownRight:pW,MoveDownRightIcon:pW,MoveHorizontal:gW,MoveHorizontalIcon:gW,MoveIcon:jW,MoveLeft:xW,MoveLeftIcon:xW,MoveRight:yW,MoveRightIcon:yW,MoveUp:bW,MoveUpIcon:bW,MoveUpLeft:vW,MoveUpLeftIcon:vW,MoveUpRight:_W,MoveUpRightIcon:_W,MoveVertical:wW,MoveVerticalIcon:wW,Music:CW,Music2:kW,Music2Icon:kW,Music3:NW,Music3Icon:NW,Music4:SW,Music4Icon:SW,MusicIcon:CW,Navigation:UT,Navigation2:TW,Navigation2Icon:TW,Navigation2Off:MW,Navigation2OffIcon:MW,NavigationIcon:UT,NavigationOff:AW,NavigationOffIcon:AW,Network:EW,NetworkIcon:EW,Newspaper:Gx,NewspaperIcon:Gx,Nfc:IW,NfcIcon:IW,Notebook:DW,NotebookIcon:DW,NotebookPen:PW,NotebookPenIcon:PW,NotebookTabs:LW,NotebookTabsIcon:LW,NotebookText:OW,NotebookTextIcon:OW,NotepadText:FW,NotepadTextDashed:RW,NotepadTextDashedIcon:RW,NotepadTextIcon:FW,Nut:BW,NutIcon:BW,NutOff:zW,NutOffIcon:zW,Octagon:UW,OctagonAlert:W2,OctagonAlertIcon:W2,OctagonIcon:UW,OctagonMinus:$W,OctagonMinusIcon:$W,OctagonPause:G2,OctagonPauseIcon:G2,OctagonX:K2,OctagonXIcon:K2,Omega:qW,OmegaIcon:qW,Option:VW,OptionIcon:VW,Orbit:HW,OrbitIcon:HW,Origami:WW,OrigamiIcon:WW,Outdent:z2,OutdentIcon:z2,Package:zl,Package2:GW,Package2Icon:GW,PackageCheck:KW,PackageCheckIcon:KW,PackageIcon:zl,PackageMinus:ZW,PackageMinusIcon:ZW,PackageOpen:YW,PackageOpenIcon:YW,PackagePlus:XW,PackagePlusIcon:XW,PackageSearch:QW,PackageSearchIcon:QW,PackageX:JW,PackageXIcon:JW,PaintBucket:eG,PaintBucketIcon:eG,PaintRoller:tG,PaintRollerIcon:tG,Paintbrush:rG,Paintbrush2:Z2,Paintbrush2Icon:Z2,PaintbrushIcon:rG,PaintbrushVertical:Z2,PaintbrushVerticalIcon:Z2,Palette:pd,PaletteIcon:pd,Palmtree:fw,PalmtreeIcon:fw,PanelBottom:aG,PanelBottomClose:nG,PanelBottomCloseIcon:nG,PanelBottomDashed:Y2,PanelBottomDashedIcon:Y2,PanelBottomIcon:aG,PanelBottomInactive:Y2,PanelBottomInactiveIcon:Y2,PanelBottomOpen:sG,PanelBottomOpenIcon:sG,PanelLeft:eb,PanelLeftClose:X2,PanelLeftCloseIcon:X2,PanelLeftDashed:Q2,PanelLeftDashedIcon:Q2,PanelLeftIcon:eb,PanelLeftInactive:Q2,PanelLeftInactiveIcon:Q2,PanelLeftOpen:J2,PanelLeftOpenIcon:J2,PanelRight:lG,PanelRightClose:iG,PanelRightCloseIcon:iG,PanelRightDashed:tb,PanelRightDashedIcon:tb,PanelRightIcon:lG,PanelRightInactive:tb,PanelRightInactiveIcon:tb,PanelRightOpen:oG,PanelRightOpenIcon:oG,PanelTop:uG,PanelTopClose:cG,PanelTopCloseIcon:cG,PanelTopDashed:rb,PanelTopDashedIcon:rb,PanelTopIcon:uG,PanelTopInactive:rb,PanelTopInactiveIcon:rb,PanelTopOpen:dG,PanelTopOpenIcon:dG,PanelsLeftBottom:hG,PanelsLeftBottomIcon:hG,PanelsLeftRight:v2,PanelsLeftRightIcon:v2,PanelsRightBottom:fG,PanelsRightBottomIcon:fG,PanelsTopBottom:lb,PanelsTopBottomIcon:lb,PanelsTopLeft:_0,PanelsTopLeftIcon:_0,Paperclip:pG,PaperclipIcon:pG,Parentheses:mG,ParenthesesIcon:mG,ParkingCircle:s2,ParkingCircleIcon:s2,ParkingCircleOff:n2,ParkingCircleOffIcon:n2,ParkingMeter:gG,ParkingMeterIcon:gG,ParkingSquare:Kb,ParkingSquareIcon:Kb,ParkingSquareOff:Gb,ParkingSquareOffIcon:Gb,PartyPopper:Ec,PartyPopperIcon:Ec,Pause:Jf,PauseCircle:a2,PauseCircleIcon:a2,PauseIcon:Jf,PauseOctagon:G2,PauseOctagonIcon:G2,PawPrint:xG,PawPrintIcon:xG,PcCase:yG,PcCaseIcon:yG,Pen:b0,PenBox:ic,PenBoxIcon:ic,PenIcon:b0,PenLine:nb,PenLineIcon:nb,PenOff:vG,PenOffIcon:vG,PenSquare:ic,PenSquareIcon:ic,PenTool:bj,PenToolIcon:bj,Pencil:fi,PencilIcon:fi,PencilLine:_G,PencilLineIcon:_G,PencilOff:bG,PencilOffIcon:bG,PencilRuler:wG,PencilRulerIcon:wG,Pentagon:jG,PentagonIcon:jG,Percent:fS,PercentCircle:i2,PercentCircleIcon:i2,PercentDiamond:b2,PercentDiamondIcon:b2,PercentIcon:fS,PercentSquare:Zb,PercentSquareIcon:Zb,PersonStanding:kG,PersonStandingIcon:kG,PhilippinePeso:NG,PhilippinePesoIcon:NG,Phone:bi,PhoneCall:SG,PhoneCallIcon:SG,PhoneForwarded:CG,PhoneForwardedIcon:CG,PhoneIcon:bi,PhoneIncoming:MG,PhoneIncomingIcon:MG,PhoneMissed:TG,PhoneMissedIcon:TG,PhoneOff:AG,PhoneOffIcon:AG,PhoneOutgoing:EG,PhoneOutgoingIcon:EG,Pi:IG,PiIcon:IG,PiSquare:Yb,PiSquareIcon:Yb,Piano:PG,PianoIcon:PG,Pickaxe:LG,PickaxeIcon:LG,PictureInPicture:DG,PictureInPicture2:OG,PictureInPicture2Icon:OG,PictureInPictureIcon:DG,PieChart:B_,PieChartIcon:B_,PiggyBank:RG,PiggyBankIcon:RG,Pilcrow:BG,PilcrowIcon:BG,PilcrowLeft:FG,PilcrowLeftIcon:FG,PilcrowRight:zG,PilcrowRightIcon:zG,PilcrowSquare:Xb,PilcrowSquareIcon:Xb,Pill:UG,PillBottle:$G,PillBottleIcon:$G,PillIcon:UG,Pin:k1,PinIcon:k1,PinOff:qT,PinOffIcon:qT,Pipette:qG,PipetteIcon:qG,Pizza:VG,PizzaIcon:VG,Plane:GG,PlaneIcon:GG,PlaneLanding:HG,PlaneLandingIcon:HG,PlaneTakeoff:WG,PlaneTakeoffIcon:WG,Play:fc,PlayCircle:$f,PlayCircleIcon:$f,PlayIcon:fc,PlaySquare:Qb,PlaySquareIcon:Qb,Plug:ZG,Plug2:KG,Plug2Icon:KG,PlugIcon:ZG,PlugZap:sb,PlugZap2:sb,PlugZap2Icon:sb,PlugZapIcon:sb,Plus:bn,PlusCircle:o2,PlusCircleIcon:o2,PlusIcon:bn,PlusSquare:Jb,PlusSquareIcon:Jb,Pocket:XG,PocketIcon:XG,PocketKnife:YG,PocketKnifeIcon:YG,Podcast:QG,PodcastIcon:QG,Pointer:eK,PointerIcon:eK,PointerOff:JG,PointerOffIcon:JG,Popcorn:tK,PopcornIcon:tK,Popsicle:rK,PopsicleIcon:rK,PoundSterling:nK,PoundSterlingIcon:nK,Power:aK,PowerCircle:l2,PowerCircleIcon:l2,PowerIcon:aK,PowerOff:sK,PowerOffIcon:sK,PowerSquare:ew,PowerSquareIcon:ew,Presentation:iK,PresentationIcon:iK,Printer:lK,PrinterCheck:oK,PrinterCheckIcon:oK,PrinterIcon:lK,Projector:cK,ProjectorIcon:cK,Proportions:dK,ProportionsIcon:dK,Puzzle:uK,PuzzleIcon:uK,Pyramid:hK,PyramidIcon:hK,QrCode:VT,QrCodeIcon:VT,Quote:HT,QuoteIcon:HT,Rabbit:fK,RabbitIcon:fK,Radar:pK,RadarIcon:pK,Radiation:mK,RadiationIcon:mK,Radical:gK,RadicalIcon:gK,Radio:wj,RadioIcon:wj,RadioReceiver:xK,RadioReceiverIcon:xK,RadioTower:yK,RadioTowerIcon:yK,Radius:vK,RadiusIcon:vK,RailSymbol:_K,RailSymbolIcon:_K,Rainbow:bK,RainbowIcon:bK,Rat:wK,RatIcon:wK,Ratio:jK,RatioIcon:jK,Receipt:IK,ReceiptCent:kK,ReceiptCentIcon:kK,ReceiptEuro:NK,ReceiptEuroIcon:NK,ReceiptIcon:IK,ReceiptIndianRupee:SK,ReceiptIndianRupeeIcon:SK,ReceiptJapaneseYen:CK,ReceiptJapaneseYenIcon:CK,ReceiptPoundSterling:MK,ReceiptPoundSterlingIcon:MK,ReceiptRussianRuble:TK,ReceiptRussianRubleIcon:TK,ReceiptSwissFranc:AK,ReceiptSwissFrancIcon:AK,ReceiptText:EK,ReceiptTextIcon:EK,RectangleEllipsis:ab,RectangleEllipsisIcon:ab,RectangleHorizontal:PK,RectangleHorizontalIcon:PK,RectangleVertical:LK,RectangleVerticalIcon:LK,Recycle:OK,RecycleIcon:OK,Redo:pS,Redo2:DK,Redo2Icon:DK,RedoDot:RK,RedoDotIcon:RK,RedoIcon:pS,RefreshCcw:zK,RefreshCcwDot:FK,RefreshCcwDotIcon:FK,RefreshCcwIcon:zK,RefreshCw:Gl,RefreshCwIcon:Gl,RefreshCwOff:BK,RefreshCwOffIcon:BK,Refrigerator:$K,RefrigeratorIcon:$K,Regex:UK,RegexIcon:UK,RemoveFormatting:qK,RemoveFormattingIcon:qK,Repeat:WT,Repeat1:VK,Repeat1Icon:VK,Repeat2:HK,Repeat2Icon:HK,RepeatIcon:WT,Replace:GK,ReplaceAll:WK,ReplaceAllIcon:WK,ReplaceIcon:GK,Reply:GT,ReplyAll:KK,ReplyAllIcon:KK,ReplyIcon:GT,Rewind:ZK,RewindIcon:ZK,Ribbon:YK,RibbonIcon:YK,Rocket:_g,RocketIcon:_g,RockingChair:XK,RockingChairIcon:XK,RollerCoaster:QK,RollerCoasterIcon:QK,Rotate3D:ib,Rotate3DIcon:ib,Rotate3d:ib,Rotate3dIcon:ib,RotateCcw:mS,RotateCcwIcon:mS,RotateCcwSquare:JK,RotateCcwSquareIcon:JK,RotateCw:KT,RotateCwIcon:KT,RotateCwSquare:eZ,RotateCwSquareIcon:eZ,Route:rZ,RouteIcon:rZ,RouteOff:tZ,RouteOffIcon:tZ,Router:nZ,RouterIcon:nZ,Rows:ob,Rows2:ob,Rows2Icon:ob,Rows3:lb,Rows3Icon:lb,Rows4:sZ,Rows4Icon:sZ,RowsIcon:ob,Rss:aZ,RssIcon:aZ,Ruler:iZ,RulerIcon:iZ,RussianRuble:oZ,RussianRubleIcon:oZ,Sailboat:lZ,SailboatIcon:lZ,Salad:cZ,SaladIcon:cZ,Sandwich:dZ,SandwichIcon:dZ,Satellite:hZ,SatelliteDish:uZ,SatelliteDishIcon:uZ,SatelliteIcon:hZ,Save:bg,SaveAll:fZ,SaveAllIcon:fZ,SaveIcon:bg,SaveOff:pZ,SaveOffIcon:pZ,Scale:mZ,Scale3D:cb,Scale3DIcon:cb,Scale3d:cb,Scale3dIcon:cb,ScaleIcon:mZ,Scaling:gZ,ScalingIcon:gZ,Scan:kZ,ScanBarcode:xZ,ScanBarcodeIcon:xZ,ScanEye:yZ,ScanEyeIcon:yZ,ScanFace:vZ,ScanFaceIcon:vZ,ScanIcon:kZ,ScanLine:_Z,ScanLineIcon:_Z,ScanQrCode:bZ,ScanQrCodeIcon:bZ,ScanSearch:wZ,ScanSearchIcon:wZ,ScanText:jZ,ScanTextIcon:jZ,ScatterChart:$_,ScatterChartIcon:$_,School:NZ,School2:mw,School2Icon:mw,SchoolIcon:NZ,Scissors:CZ,ScissorsIcon:CZ,ScissorsLineDashed:SZ,ScissorsLineDashedIcon:SZ,ScissorsSquare:tw,ScissorsSquareDashedBottom:Cb,ScissorsSquareDashedBottomIcon:Cb,ScissorsSquareIcon:tw,ScreenShare:TZ,ScreenShareIcon:TZ,ScreenShareOff:MZ,ScreenShareOffIcon:MZ,Scroll:EZ,ScrollIcon:EZ,ScrollText:AZ,ScrollTextIcon:AZ,Search:wa,SearchCheck:IZ,SearchCheckIcon:IZ,SearchCode:PZ,SearchCodeIcon:PZ,SearchIcon:wa,SearchSlash:LZ,SearchSlashIcon:LZ,SearchX:OZ,SearchXIcon:OZ,Section:DZ,SectionIcon:DZ,Send:Do,SendHorizonal:db,SendHorizonalIcon:db,SendHorizontal:db,SendHorizontalIcon:db,SendIcon:Do,SendToBack:RZ,SendToBackIcon:RZ,SeparatorHorizontal:FZ,SeparatorHorizontalIcon:FZ,SeparatorVertical:zZ,SeparatorVerticalIcon:zZ,Server:qZ,ServerCog:BZ,ServerCogIcon:BZ,ServerCrash:$Z,ServerCrashIcon:$Z,ServerIcon:qZ,ServerOff:UZ,ServerOffIcon:UZ,Settings:md,Settings2:VZ,Settings2Icon:VZ,SettingsIcon:md,Shapes:HZ,ShapesIcon:HZ,Share:ZT,Share2:pc,Share2Icon:pc,ShareIcon:ZT,Sheet:WZ,SheetIcon:WZ,Shell:GZ,ShellIcon:GZ,Shield:nf,ShieldAlert:KZ,ShieldAlertIcon:KZ,ShieldBan:ZZ,ShieldBanIcon:ZZ,ShieldCheck:YT,ShieldCheckIcon:YT,ShieldClose:ub,ShieldCloseIcon:ub,ShieldEllipsis:YZ,ShieldEllipsisIcon:YZ,ShieldHalf:XZ,ShieldHalfIcon:XZ,ShieldIcon:nf,ShieldMinus:QZ,ShieldMinusIcon:QZ,ShieldOff:JZ,ShieldOffIcon:JZ,ShieldPlus:eY,ShieldPlusIcon:eY,ShieldQuestion:tY,ShieldQuestionIcon:tY,ShieldX:ub,ShieldXIcon:ub,Ship:nY,ShipIcon:nY,ShipWheel:rY,ShipWheelIcon:rY,Shirt:sY,ShirtIcon:sY,ShoppingBag:wg,ShoppingBagIcon:wg,ShoppingBasket:aY,ShoppingBasketIcon:aY,ShoppingCart:ph,ShoppingCartIcon:ph,Shovel:iY,ShovelIcon:iY,ShowerHead:oY,ShowerHeadIcon:oY,Shrink:lY,ShrinkIcon:lY,Shrub:cY,ShrubIcon:cY,Shuffle:dY,ShuffleIcon:dY,Sidebar:eb,SidebarClose:X2,SidebarCloseIcon:X2,SidebarIcon:eb,SidebarOpen:J2,SidebarOpenIcon:J2,Sigma:uY,SigmaIcon:uY,SigmaSquare:rw,SigmaSquareIcon:rw,Signal:gY,SignalHigh:hY,SignalHighIcon:hY,SignalIcon:gY,SignalLow:fY,SignalLowIcon:fY,SignalMedium:pY,SignalMediumIcon:pY,SignalZero:mY,SignalZeroIcon:mY,Signature:xY,SignatureIcon:xY,Signpost:vY,SignpostBig:yY,SignpostBigIcon:yY,SignpostIcon:vY,Siren:_Y,SirenIcon:_Y,SkipBack:bY,SkipBackIcon:bY,SkipForward:wY,SkipForwardIcon:wY,Skull:jY,SkullIcon:jY,Slack:kY,SlackIcon:kY,Slash:NY,SlashIcon:NY,SlashSquare:nw,SlashSquareIcon:nw,Slice:SY,SliceIcon:SY,Sliders:hb,SlidersHorizontal:XT,SlidersHorizontalIcon:XT,SlidersIcon:hb,SlidersVertical:hb,SlidersVerticalIcon:hb,Smartphone:jg,SmartphoneCharging:CY,SmartphoneChargingIcon:CY,SmartphoneIcon:jg,SmartphoneNfc:MY,SmartphoneNfcIcon:MY,Smile:AY,SmileIcon:AY,SmilePlus:TY,SmilePlusIcon:TY,Snail:EY,SnailIcon:EY,Snowflake:Z0,SnowflakeIcon:Z0,Sofa:IY,SofaIcon:IY,SortAsc:b_,SortAscIcon:b_,SortDesc:y_,SortDescIcon:y_,Soup:PY,SoupIcon:PY,Space:LY,SpaceIcon:LY,Spade:OY,SpadeIcon:OY,Sparkle:DY,SparkleIcon:DY,Sparkles:Ms,SparklesIcon:Ms,Speaker:RY,SpeakerIcon:RY,Speech:FY,SpeechIcon:FY,SpellCheck:BY,SpellCheck2:zY,SpellCheck2Icon:zY,SpellCheckIcon:BY,Spline:$Y,SplineIcon:$Y,Split:UY,SplitIcon:UY,SplitSquareHorizontal:sw,SplitSquareHorizontalIcon:sw,SplitSquareVertical:aw,SplitSquareVerticalIcon:aw,SprayCan:qY,SprayCanIcon:qY,Sprout:VY,SproutIcon:VY,Square:kg,SquareActivity:fb,SquareActivityIcon:fb,SquareArrowDown:gb,SquareArrowDownIcon:gb,SquareArrowDownLeft:pb,SquareArrowDownLeftIcon:pb,SquareArrowDownRight:mb,SquareArrowDownRightIcon:mb,SquareArrowLeft:xb,SquareArrowLeftIcon:xb,SquareArrowOutDownLeft:yb,SquareArrowOutDownLeftIcon:yb,SquareArrowOutDownRight:vb,SquareArrowOutDownRightIcon:vb,SquareArrowOutUpLeft:_b,SquareArrowOutUpLeftIcon:_b,SquareArrowOutUpRight:bb,SquareArrowOutUpRightIcon:bb,SquareArrowRight:wb,SquareArrowRightIcon:wb,SquareArrowUp:Nb,SquareArrowUpIcon:Nb,SquareArrowUpLeft:jb,SquareArrowUpLeftIcon:jb,SquareArrowUpRight:kb,SquareArrowUpRightIcon:kb,SquareAsterisk:Sb,SquareAsteriskIcon:Sb,SquareBottomDashedScissors:Cb,SquareBottomDashedScissorsIcon:Cb,SquareChartGantt:Qm,SquareChartGanttIcon:Qm,SquareCheck:Mb,SquareCheckBig:w0,SquareCheckBigIcon:w0,SquareCheckIcon:Mb,SquareChevronDown:Tb,SquareChevronDownIcon:Tb,SquareChevronLeft:Ab,SquareChevronLeftIcon:Ab,SquareChevronRight:Eb,SquareChevronRightIcon:Eb,SquareChevronUp:Ib,SquareChevronUpIcon:Ib,SquareCode:Pb,SquareCodeIcon:Pb,SquareDashed:Db,SquareDashedBottom:WY,SquareDashedBottomCode:HY,SquareDashedBottomCodeIcon:HY,SquareDashedBottomIcon:WY,SquareDashedIcon:Db,SquareDashedKanban:Lb,SquareDashedKanbanIcon:Lb,SquareDashedMousePointer:Ob,SquareDashedMousePointerIcon:Ob,SquareDivide:Rb,SquareDivideIcon:Rb,SquareDot:Fb,SquareDotIcon:Fb,SquareEqual:zb,SquareEqualIcon:zb,SquareFunction:Bb,SquareFunctionIcon:Bb,SquareGanttChart:Qm,SquareGanttChartIcon:Qm,SquareIcon:kg,SquareKanban:$b,SquareKanbanIcon:$b,SquareLibrary:Ub,SquareLibraryIcon:Ub,SquareM:qb,SquareMIcon:qb,SquareMenu:Vb,SquareMenuIcon:Vb,SquareMinus:Hb,SquareMinusIcon:Hb,SquareMousePointer:Wb,SquareMousePointerIcon:Wb,SquareParking:Kb,SquareParkingIcon:Kb,SquareParkingOff:Gb,SquareParkingOffIcon:Gb,SquarePen:ic,SquarePenIcon:ic,SquarePercent:Zb,SquarePercentIcon:Zb,SquarePi:Yb,SquarePiIcon:Yb,SquarePilcrow:Xb,SquarePilcrowIcon:Xb,SquarePlay:Qb,SquarePlayIcon:Qb,SquarePlus:Jb,SquarePlusIcon:Jb,SquarePower:ew,SquarePowerIcon:ew,SquareRadical:GY,SquareRadicalIcon:GY,SquareScissors:tw,SquareScissorsIcon:tw,SquareSigma:rw,SquareSigmaIcon:rw,SquareSlash:nw,SquareSlashIcon:nw,SquareSplitHorizontal:sw,SquareSplitHorizontalIcon:sw,SquareSplitVertical:aw,SquareSplitVerticalIcon:aw,SquareSquare:KY,SquareSquareIcon:KY,SquareStack:ZY,SquareStackIcon:ZY,SquareTerminal:iw,SquareTerminalIcon:iw,SquareUser:lw,SquareUserIcon:lw,SquareUserRound:ow,SquareUserRoundIcon:ow,SquareX:cw,SquareXIcon:cw,Squircle:YY,SquircleIcon:YY,Squirrel:XY,SquirrelIcon:XY,Stamp:QY,StampIcon:QY,Star:vs,StarHalf:JY,StarHalfIcon:JY,StarIcon:vs,StarOff:eX,StarOffIcon:eX,Stars:Ms,StarsIcon:Ms,StepBack:tX,StepBackIcon:tX,StepForward:rX,StepForwardIcon:rX,Stethoscope:nX,StethoscopeIcon:nX,Sticker:sX,StickerIcon:sX,StickyNote:aX,StickyNoteIcon:aX,StopCircle:d2,StopCircleIcon:d2,Store:iX,StoreIcon:iX,StretchHorizontal:oX,StretchHorizontalIcon:oX,StretchVertical:lX,StretchVerticalIcon:lX,Strikethrough:cX,StrikethroughIcon:cX,Subscript:dX,SubscriptIcon:dX,Subtitles:T_,SubtitlesIcon:T_,Sun:N1,SunDim:uX,SunDimIcon:uX,SunIcon:N1,SunMedium:hX,SunMediumIcon:hX,SunMoon:fX,SunMoonIcon:fX,SunSnow:pX,SunSnowIcon:pX,Sunrise:mX,SunriseIcon:mX,Sunset:gX,SunsetIcon:gX,Superscript:xX,SuperscriptIcon:xX,SwatchBook:yX,SwatchBookIcon:yX,SwissFranc:vX,SwissFrancIcon:vX,SwitchCamera:_X,SwitchCameraIcon:_X,Sword:bX,SwordIcon:bX,Swords:wX,SwordsIcon:wX,Syringe:jX,SyringeIcon:jX,Table:AX,Table2:gS,Table2Icon:gS,TableCellsMerge:kX,TableCellsMergeIcon:kX,TableCellsSplit:NX,TableCellsSplitIcon:NX,TableColumnsSplit:SX,TableColumnsSplitIcon:SX,TableIcon:AX,TableOfContents:CX,TableOfContentsIcon:CX,TableProperties:MX,TablePropertiesIcon:MX,TableRowsSplit:TX,TableRowsSplitIcon:TX,Tablet:IX,TabletIcon:IX,TabletSmartphone:EX,TabletSmartphoneIcon:EX,Tablets:PX,TabletsIcon:PX,Tag:Ng,TagIcon:Ng,Tags:LX,TagsIcon:LX,Tally1:OX,Tally1Icon:OX,Tally2:DX,Tally2Icon:DX,Tally3:RX,Tally3Icon:RX,Tally4:FX,Tally4Icon:FX,Tally5:zX,Tally5Icon:zX,Tangent:BX,TangentIcon:BX,Target:Kx,TargetIcon:Kx,Telescope:$X,TelescopeIcon:$X,Tent:qX,TentIcon:qX,TentTree:UX,TentTreeIcon:UX,Terminal:VX,TerminalIcon:VX,TerminalSquare:iw,TerminalSquareIcon:iw,TestTube:HX,TestTube2:dw,TestTube2Icon:dw,TestTubeDiagonal:dw,TestTubeDiagonalIcon:dw,TestTubeIcon:HX,TestTubes:WX,TestTubesIcon:WX,Text:XX,TextCursor:KX,TextCursorIcon:KX,TextCursorInput:GX,TextCursorInputIcon:GX,TextIcon:XX,TextQuote:ZX,TextQuoteIcon:ZX,TextSearch:YX,TextSearchIcon:YX,TextSelect:uw,TextSelectIcon:uw,TextSelection:uw,TextSelectionIcon:uw,Theater:QX,TheaterIcon:QX,Thermometer:tQ,ThermometerIcon:tQ,ThermometerSnowflake:JX,ThermometerSnowflakeIcon:JX,ThermometerSun:eQ,ThermometerSunIcon:eQ,ThumbsDown:QT,ThumbsDownIcon:QT,ThumbsUp:gd,ThumbsUpIcon:gd,Ticket:JT,TicketCheck:rQ,TicketCheckIcon:rQ,TicketIcon:JT,TicketMinus:nQ,TicketMinusIcon:nQ,TicketPercent:sQ,TicketPercentIcon:sQ,TicketPlus:aQ,TicketPlusIcon:aQ,TicketSlash:iQ,TicketSlashIcon:iQ,TicketX:oQ,TicketXIcon:oQ,Tickets:cQ,TicketsIcon:cQ,TicketsPlane:lQ,TicketsPlaneIcon:lQ,Timer:hQ,TimerIcon:hQ,TimerOff:dQ,TimerOffIcon:dQ,TimerReset:uQ,TimerResetIcon:uQ,ToggleLeft:fQ,ToggleLeftIcon:fQ,ToggleRight:pQ,ToggleRightIcon:pQ,Toilet:mQ,ToiletIcon:mQ,Tornado:gQ,TornadoIcon:gQ,Torus:xQ,TorusIcon:xQ,Touchpad:vQ,TouchpadIcon:vQ,TouchpadOff:yQ,TouchpadOffIcon:yQ,TowerControl:_Q,TowerControlIcon:_Q,ToyBrick:bQ,ToyBrickIcon:bQ,Tractor:wQ,TractorIcon:wQ,TrafficCone:jQ,TrafficConeIcon:jQ,Train:hw,TrainFront:NQ,TrainFrontIcon:NQ,TrainFrontTunnel:kQ,TrainFrontTunnelIcon:kQ,TrainIcon:hw,TrainTrack:SQ,TrainTrackIcon:SQ,TramFront:hw,TramFrontIcon:hw,Trash:CQ,Trash2:Vn,Trash2Icon:Vn,TrashIcon:CQ,TreeDeciduous:MQ,TreeDeciduousIcon:MQ,TreePalm:fw,TreePalmIcon:fw,TreePine:S1,TreePineIcon:S1,Trees:TQ,TreesIcon:TQ,Trello:AQ,TrelloIcon:AQ,TrendingDown:jj,TrendingDownIcon:jj,TrendingUp:ep,TrendingUpDown:EQ,TrendingUpDownIcon:EQ,TrendingUpIcon:ep,Triangle:PQ,TriangleAlert:Hh,TriangleAlertIcon:Hh,TriangleIcon:PQ,TriangleRight:IQ,TriangleRightIcon:IQ,Trophy:Zi,TrophyIcon:Zi,Truck:eA,TruckIcon:eA,Turtle:LQ,TurtleIcon:LQ,Tv:DQ,Tv2:pw,Tv2Icon:pw,TvIcon:DQ,TvMinimal:pw,TvMinimalIcon:pw,TvMinimalPlay:OQ,TvMinimalPlayIcon:OQ,Twitch:RQ,TwitchIcon:RQ,Twitter:FQ,TwitterIcon:FQ,Type:BQ,TypeIcon:BQ,TypeOutline:zQ,TypeOutlineIcon:zQ,Umbrella:UQ,UmbrellaIcon:UQ,UmbrellaOff:$Q,UmbrellaOffIcon:$Q,Underline:qQ,UnderlineIcon:qQ,Undo:xS,Undo2:VQ,Undo2Icon:VQ,UndoDot:HQ,UndoDotIcon:HQ,UndoIcon:xS,UnfoldHorizontal:WQ,UnfoldHorizontalIcon:WQ,UnfoldVertical:GQ,UnfoldVerticalIcon:GQ,Ungroup:KQ,UngroupIcon:KQ,University:mw,UniversityIcon:mw,Unlink:tA,Unlink2:ZQ,Unlink2Icon:ZQ,UnlinkIcon:tA,Unlock:q2,UnlockIcon:q2,UnlockKeyhole:U2,UnlockKeyholeIcon:U2,Unplug:YQ,UnplugIcon:YQ,Upload:uo,UploadCloud:g2,UploadCloudIcon:g2,UploadIcon:uo,Usb:XQ,UsbIcon:XQ,User:Ic,User2:bw,User2Icon:bw,UserCheck:kj,UserCheck2:gw,UserCheck2Icon:gw,UserCheckIcon:kj,UserCircle:h2,UserCircle2:u2,UserCircle2Icon:u2,UserCircleIcon:h2,UserCog:rA,UserCog2:xw,UserCog2Icon:xw,UserCogIcon:rA,UserIcon:Ic,UserMinus:QQ,UserMinus2:yw,UserMinus2Icon:yw,UserMinusIcon:QQ,UserPen:JQ,UserPenIcon:JQ,UserPlus:sf,UserPlus2:vw,UserPlus2Icon:vw,UserPlusIcon:sf,UserRound:bw,UserRoundCheck:gw,UserRoundCheckIcon:gw,UserRoundCog:xw,UserRoundCogIcon:xw,UserRoundIcon:bw,UserRoundMinus:yw,UserRoundMinusIcon:yw,UserRoundPen:eJ,UserRoundPenIcon:eJ,UserRoundPlus:vw,UserRoundPlusIcon:vw,UserRoundSearch:tJ,UserRoundSearchIcon:tJ,UserRoundX:_w,UserRoundXIcon:_w,UserSearch:rJ,UserSearchIcon:rJ,UserSquare:lw,UserSquare2:ow,UserSquare2Icon:ow,UserSquareIcon:lw,UserX:nJ,UserX2:_w,UserX2Icon:_w,UserXIcon:nJ,Users:Bn,Users2:ww,Users2Icon:ww,UsersIcon:Bn,UsersRound:ww,UsersRoundIcon:ww,Utensils:kw,UtensilsCrossed:jw,UtensilsCrossedIcon:jw,UtensilsIcon:kw,UtilityPole:sJ,UtilityPoleIcon:sJ,Variable:nA,VariableIcon:nA,Vault:aJ,VaultIcon:aJ,Vegan:iJ,VeganIcon:iJ,VenetianMask:oJ,VenetianMaskIcon:oJ,Verified:k_,VerifiedIcon:k_,Vibrate:cJ,VibrateIcon:cJ,VibrateOff:lJ,VibrateOffIcon:lJ,Video:Pa,VideoIcon:Pa,VideoOff:dJ,VideoOffIcon:dJ,Videotape:uJ,VideotapeIcon:uJ,View:hJ,ViewIcon:hJ,Voicemail:fJ,VoicemailIcon:fJ,Volleyball:pJ,VolleyballIcon:pJ,Volume:vJ,Volume1:mJ,Volume1Icon:mJ,Volume2:gJ,Volume2Icon:gJ,VolumeIcon:vJ,VolumeOff:xJ,VolumeOffIcon:xJ,VolumeX:yJ,VolumeXIcon:yJ,Vote:_J,VoteIcon:_J,Wallet:wJ,Wallet2:Nw,Wallet2Icon:Nw,WalletCards:bJ,WalletCardsIcon:bJ,WalletIcon:wJ,WalletMinimal:Nw,WalletMinimalIcon:Nw,Wallpaper:jJ,WallpaperIcon:jJ,Wand:kJ,Wand2:Sw,Wand2Icon:Sw,WandIcon:kJ,WandSparkles:Sw,WandSparklesIcon:Sw,Warehouse:NJ,WarehouseIcon:NJ,WashingMachine:SJ,WashingMachineIcon:SJ,Watch:CJ,WatchIcon:CJ,Waves:MJ,WavesIcon:MJ,Waypoints:TJ,WaypointsIcon:TJ,Webcam:AJ,WebcamIcon:AJ,Webhook:IJ,WebhookIcon:IJ,WebhookOff:EJ,WebhookOffIcon:EJ,Weight:PJ,WeightIcon:PJ,Wheat:OJ,WheatIcon:OJ,WheatOff:LJ,WheatOffIcon:LJ,WholeWord:DJ,WholeWordIcon:DJ,Wifi:$J,WifiHigh:RJ,WifiHighIcon:RJ,WifiIcon:$J,WifiLow:FJ,WifiLowIcon:FJ,WifiOff:zJ,WifiOffIcon:zJ,WifiZero:BJ,WifiZeroIcon:BJ,Wind:qJ,WindArrowDown:UJ,WindArrowDownIcon:UJ,WindIcon:qJ,Wine:HJ,WineIcon:HJ,WineOff:VJ,WineOffIcon:VJ,Workflow:WJ,WorkflowIcon:WJ,Worm:GJ,WormIcon:GJ,WrapText:KJ,WrapTextIcon:KJ,Wrench:Zx,WrenchIcon:Zx,X:_s,XCircle:Vc,XCircleIcon:Vc,XIcon:_s,XOctagon:K2,XOctagonIcon:K2,XSquare:cw,XSquareIcon:cw,Youtube:ZJ,YoutubeIcon:ZJ,Zap:Sg,ZapIcon:Sg,ZapOff:YJ,ZapOffIcon:YJ,ZoomIn:yS,ZoomInIcon:yS,ZoomOut:vS,ZoomOutIcon:vS,createLucideIcon:U,icons:lZe},Symbol.toStringTag,{value:"Module"})),$me="-",cZe=t=>{const e=uZe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:l=>{const i=l.split($me);return i[0]===""&&i.length!==1&&i.shift(),_Ae(i,e)||dZe(l)},getConflictingClassGroupIds:(l,i)=>{const h=n[l]||[];return i&&s[l]?[...h,...s[l]]:h}}},_Ae=(t,e)=>{var l;if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),a=s?_Ae(t.slice(1),s):void 0;if(a)return a;if(e.validators.length===0)return;const o=t.join($me);return(l=e.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},Hbe=/^\[(.+)\]$/,dZe=t=>{if(Hbe.test(t)){const e=Hbe.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},uZe=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};return fZe(Object.entries(t.classGroups),n).forEach(([o,l])=>{cue(l,s,o,e)}),s},cue=(t,e,n,s)=>{t.forEach(a=>{if(typeof a=="string"){const o=a===""?e:Wbe(e,a);o.classGroupId=n;return}if(typeof a=="function"){if(hZe(a)){cue(a(s),e,n,s);return}e.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,l])=>{cue(l,Wbe(e,o),n,s)})})},Wbe=(t,e)=>{let n=t;return e.split($me).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},hZe=t=>t.isThemeGetter,fZe=(t,e)=>e?t.map(([n,s])=>{const a=s.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,i])=>[e+l,i])):o);return[n,a]}):t,pZe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,s=new Map;const a=(o,l)=>{n.set(o,l),e++,e>t&&(e=0,s=n,n=new Map)};return{get(o){let l=n.get(o);if(l!==void 0)return l;if((l=s.get(o))!==void 0)return a(o,l),l},set(o,l){n.has(o)?n.set(o,l):a(o,l)}}},bAe="!",mZe=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,a=e[0],o=e.length,l=i=>{const h=[];let p=0,x=0,y;for(let A=0;Ax?y-x:void 0;return{modifiers:h,hasImportantModifier:j,baseClassName:C,maybePostfixModifierPosition:N}};return n?i=>n({className:i,parseClassName:l}):l},gZe=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},xZe=t=>({cache:pZe(t.cacheSize),parseClassName:mZe(t),...cZe(t)}),yZe=/\s+/,vZe=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=e,o=[],l=t.trim().split(yZe);let i="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:x,hasImportantModifier:y,baseClassName:_,maybePostfixModifierPosition:j}=n(p);let C=!!j,N=s(C?_.substring(0,j):_);if(!N){if(!C){i=p+(i.length>0?" "+i:i);continue}if(N=s(_),!N){i=p+(i.length>0?" "+i:i);continue}C=!1}const A=gZe(x).join(":"),E=y?A+bAe:A,T=E+N;if(o.includes(T))continue;o.push(T);const P=a(N,C);for(let z=0;z0?" "+i:i)}return i};function _Ze(){let t=0,e,n,s="";for(;t{if(typeof t=="string")return t;let e,n="";for(let s=0;sy(x),t());return n=xZe(p),s=n.cache.get,a=n.cache.set,o=i,i(h)}function i(h){const p=s(h);if(p)return p;const x=vZe(h,n);return a(h,x),x}return function(){return o(_Ze.apply(null,arguments))}}const ol=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},jAe=/^\[(?:([a-z-]+):)?(.+)\]$/i,wZe=/^\d+\/\d+$/,jZe=new Set(["px","full","screen"]),kZe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NZe=/\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$/,SZe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,CZe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MZe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fx=t=>_S(t)||jZe.has(t)||wZe.test(t),c0=t=>XC(t,"length",DZe),_S=t=>!!t&&!Number.isNaN(Number(t)),mle=t=>XC(t,"number",_S),TM=t=>!!t&&Number.isInteger(Number(t)),TZe=t=>t.endsWith("%")&&_S(t.slice(0,-1)),ni=t=>jAe.test(t),d0=t=>kZe.test(t),AZe=new Set(["length","size","percentage"]),EZe=t=>XC(t,AZe,kAe),IZe=t=>XC(t,"position",kAe),PZe=new Set(["image","url"]),LZe=t=>XC(t,PZe,FZe),OZe=t=>XC(t,"",RZe),AM=()=>!0,XC=(t,e,n)=>{const s=jAe.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},DZe=t=>NZe.test(t)&&!SZe.test(t),kAe=()=>!1,RZe=t=>CZe.test(t),FZe=t=>MZe.test(t),zZe=()=>{const t=ol("colors"),e=ol("spacing"),n=ol("blur"),s=ol("brightness"),a=ol("borderColor"),o=ol("borderRadius"),l=ol("borderSpacing"),i=ol("borderWidth"),h=ol("contrast"),p=ol("grayscale"),x=ol("hueRotate"),y=ol("invert"),_=ol("gap"),j=ol("gradientColorStops"),C=ol("gradientColorStopPositions"),N=ol("inset"),A=ol("margin"),E=ol("opacity"),T=ol("padding"),P=ol("saturate"),z=ol("scale"),F=ol("sepia"),q=ol("skew"),V=ol("space"),K=ol("translate"),G=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",ni,e],oe=()=>[ni,e],ye=()=>["",fx,c0],ae=()=>["auto",_S,ni],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>["start","end","center","between","around","evenly","stretch"],_e=()=>["","0",ni],Ae=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ce=()=>[_S,ni];return{cacheSize:500,separator:":",theme:{colors:[AM],spacing:[fx,c0],blur:["none","",d0,ni],brightness:Ce(),borderColor:[t],borderRadius:["none","","full",d0,ni],borderSpacing:oe(),borderWidth:ye(),contrast:Ce(),grayscale:_e(),hueRotate:Ce(),invert:_e(),gap:oe(),gradientColorStops:[t],gradientColorStopPositions:[TZe,c0],inset:ie(),margin:ie(),opacity:Ce(),padding:oe(),saturate:Ce(),scale:Ce(),sepia:_e(),skew:Ce(),space:oe(),translate:oe()},classGroups:{aspect:[{aspect:["auto","square","video",ni]}],container:["container"],columns:[{columns:[d0]}],"break-after":[{"break-after":Ae()}],"break-before":[{"break-before":Ae()}],"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:[...pe(),ni]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",TM,ni]}],basis:[{basis:ie()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ni]}],grow:[{grow:_e()}],shrink:[{shrink:_e()}],order:[{order:["first","last","none",TM,ni]}],"grid-cols":[{"grid-cols":[AM]}],"col-start-end":[{col:["auto",{span:["full",TM,ni]},ni]}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":[AM]}],"row-start-end":[{row:["auto",{span:[TM,ni]},ni]}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ni]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ni]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ue(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[A]}],mx:[{mx:[A]}],my:[{my:[A]}],ms:[{ms:[A]}],me:[{me:[A]}],mt:[{mt:[A]}],mr:[{mr:[A]}],mb:[{mb:[A]}],ml:[{ml:[A]}],"space-x":[{"space-x":[V]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[V]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ni,e]}],"min-w":[{"min-w":[ni,e,"min","max","fit"]}],"max-w":[{"max-w":[ni,e,"none","full","min","max","fit","prose",{screen:[d0]},d0]}],h:[{h:[ni,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ni,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ni,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ni,e,"auto","min","max","fit"]}],"font-size":[{text:["base",d0,c0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",mle]}],"font-family":[{font:[AM]}],"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",ni]}],"line-clamp":[{"line-clamp":["none",_S,mle]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fx,ni]}],"list-image":[{"list-image":["none",ni]}],"list-style-type":[{list:["none","disc","decimal",ni]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fx,c0]}],"underline-offset":[{"underline-offset":["auto",fx,ni]}],"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:oe()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ni]}],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",ni]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),IZe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EZe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},LZe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],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:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:se()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[fx,ni]}],"outline-w":[{outline:[fx,c0]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ye()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[fx,c0]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",d0,OZe]}],"shadow-color":[{shadow:[AM]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...he(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":he()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",d0,ni]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[P]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[P]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ni]}],duration:[{duration:Ce()}],ease:[{ease:["linear","in","out","in-out",ni]}],delay:[{delay:Ce()}],animate:[{animate:["none","spin","ping","pulse","bounce",ni]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[TM,ni]}],"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",ni]}],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",ni]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":oe()}],"scroll-mx":[{"scroll-mx":oe()}],"scroll-my":[{"scroll-my":oe()}],"scroll-ms":[{"scroll-ms":oe()}],"scroll-me":[{"scroll-me":oe()}],"scroll-mt":[{"scroll-mt":oe()}],"scroll-mr":[{"scroll-mr":oe()}],"scroll-mb":[{"scroll-mb":oe()}],"scroll-ml":[{"scroll-ml":oe()}],"scroll-p":[{"scroll-p":oe()}],"scroll-px":[{"scroll-px":oe()}],"scroll-py":[{"scroll-py":oe()}],"scroll-ps":[{"scroll-ps":oe()}],"scroll-pe":[{"scroll-pe":oe()}],"scroll-pt":[{"scroll-pt":oe()}],"scroll-pr":[{"scroll-pr":oe()}],"scroll-pb":[{"scroll-pb":oe()}],"scroll-pl":[{"scroll-pl":oe()}],"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",ni]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[fx,c0,mle]}],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"]}}},BZe=bZe(zZe);function zt(...t){return BZe(si(t))}function Pd(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 Gbe(t){const e=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(e)}function Sne(t){return t?t.replace(/<[^>]*>/g,""):""}const $Ze=aZe,NAe=I.forwardRef(({className:t,...e},n)=>r.jsx(dAe,{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}));NAe.displayName=dAe.displayName;const UZe=YC("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"}}),SAe=I.forwardRef(({className:t,variant:e,...n},s)=>r.jsx(uAe,{ref:s,className:zt(UZe({variant:e}),t),...n}));SAe.displayName=uAe.displayName;const qZe=I.forwardRef(({className:t,...e},n)=>r.jsx(pAe,{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}));qZe.displayName=pAe.displayName;const CAe=I.forwardRef(({className:t,...e},n)=>r.jsx(mAe,{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(_s,{className:"h-4 w-4"})}));CAe.displayName=mAe.displayName;const MAe=I.forwardRef(({className:t,...e},n)=>r.jsx(hAe,{ref:n,className:zt("text-sm font-semibold",t),...e}));MAe.displayName=hAe.displayName;const TAe=I.forwardRef(({className:t,...e},n)=>r.jsx(fAe,{ref:n,className:zt("text-sm opacity-90",t),...e}));TAe.displayName=fAe.displayName;function VZe(){const{toasts:t}=pi();return r.jsxs($Ze,{children:[t.map(function({id:e,title:n,description:s,action:a,...o}){return r.jsxs(SAe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(MAe,{children:n}),s&&r.jsx(TAe,{children:s})]}),a,r.jsx(CAe,{})]},e)}),r.jsx(NAe,{})]})}var Kbe=["light","dark"],HZe="(prefers-color-scheme: dark)",WZe=I.createContext(void 0),GZe={setTheme:t=>{},themes:[]},KZe=()=>{var t;return(t=I.useContext(WZe))!=null?t:GZe};I.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:s,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:h})=>{let p=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(C=>`'${C}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=a?Kbe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",_=(C,N=!1,A=!0)=>{let E=l?l[C]:C,T=N?C+"|| ''":`'${E}'`,P="";return a&&A&&!N&&Kbe.includes(C)&&(P+=`d.style.colorScheme = '${C}';`),n==="class"?N||E?P+=`c.add(${T})`:P+="null":E&&(P+=`d[s](n,${T})`),P},j=t?`!function(){${x}${_(t)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${p})){var t='${HZe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${_("dark")}}else{${_("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${_(l?"x[e]":"e",!0)}}${p?"":"else{"+_(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${e}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${_(l?"x[e]":"e",!0)}}else{${_(o,!1,!1)};}${y}}catch(t){}}();`;return I.createElement("script",{nonce:h,dangerouslySetInnerHTML:{__html:j}})});var ZZe=t=>{switch(t){case"success":return QZe;case"info":return eYe;case"warning":return JZe;case"error":return tYe;default:return null}},YZe=Array(12).fill(0),XZe=({visible:t,className:e})=>st.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},st.createElement("div",{className:"sonner-spinner"},YZe.map((n,s)=>st.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),QZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},st.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"})),JZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},st.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"})),eYe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},st.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"})),tYe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},st.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"})),rYe=st.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"},st.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),st.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nYe=()=>{let[t,e]=st.useState(document.hidden);return st.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},due=1,sYe=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,a=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:due++,o=this.toasts.find(i=>i.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...t,id:a,title:n}),{...i,...t,id:a,dismissible:l,title:n}):i):this.addToast({title:n,...s,dismissible:l,id:a}),a},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(),a=n!==void 0,o,l=s.then(async h=>{if(o=["resolve",h],st.isValidElement(h))a=!1,this.create({id:n,type:"default",message:h});else if(iYe(h)&&!h.ok){a=!1;let p=typeof e.error=="function"?await e.error(`HTTP error! status: ${h.status}`):e.error,x=typeof e.description=="function"?await e.description(`HTTP error! status: ${h.status}`):e.description;this.create({id:n,type:"error",message:p,description:x})}else if(e.success!==void 0){a=!1;let p=typeof e.success=="function"?await e.success(h):e.success,x=typeof e.description=="function"?await e.description(h):e.description;this.create({id:n,type:"success",message:p,description:x})}}).catch(async h=>{if(o=["reject",h],e.error!==void 0){a=!1;let p=typeof e.error=="function"?await e.error(h):e.error,x=typeof e.description=="function"?await e.description(h):e.description;this.create({id:n,type:"error",message:p,description:x})}}).finally(()=>{var h;a&&(this.dismiss(n),n=void 0),(h=e.finally)==null||h.call(e)}),i=()=>new Promise((h,p)=>l.then(()=>o[0]==="reject"?p(o[1]):h(o[1])).catch(p));return typeof n!="string"&&typeof n!="number"?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||due++;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}},ch=new sYe,aYe=(t,e)=>{let n=(e==null?void 0:e.id)||due++;return ch.addToast({title:t,...e,id:n}),n},iYe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",oYe=aYe,lYe=()=>ch.toasts,cYe=()=>ch.getActiveToasts(),ze=Object.assign(oYe,{success:ch.success,info:ch.info,warning:ch.warning,error:ch.error,custom:ch.custom,message:ch.message,promise:ch.promise,dismiss:ch.dismiss,loading:ch.loading},{getHistory:lYe,getToasts:cYe});function dYe(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))}dYe(`: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 aL(t){return t.label!==void 0}var uYe=3,hYe="32px",fYe="16px",Zbe=4e3,pYe=356,mYe=14,gYe=20,xYe=200;function Up(...t){return t.filter(Boolean).join(" ")}function yYe(t){let[e,n]=t.split("-"),s=[];return e&&s.push(e),n&&s.push(n),s}var vYe=t=>{var e,n,s,a,o,l,i,h,p,x,y;let{invert:_,toast:j,unstyled:C,interacting:N,setHeights:A,visibleToasts:E,heights:T,index:P,toasts:z,expanded:F,removeToast:q,defaultRichColors:V,closeButton:K,style:G,cancelButtonStyle:te,actionButtonStyle:ie,className:oe="",descriptionClassName:ye="",duration:ae,position:pe,gap:se,loadingIcon:he,expandByDefault:ue,classNames:_e,icons:Ae,closeButtonAriaLabel:Ce="Close toast",pauseWhenPageIsHidden:Se}=t,[ge,Le]=st.useState(null),[ke,Be]=st.useState(null),[Ee,Ue]=st.useState(!1),[Fe,be]=st.useState(!1),[tt,Te]=st.useState(!1),[Ke,me]=st.useState(!1),[yt,rt]=st.useState(!1),[at,Me]=st.useState(0),[ft,qe]=st.useState(0),Oe=st.useRef(j.duration||ae||Zbe),Qe=st.useRef(null),nt=st.useRef(null),gt=P===0,mt=P+1<=E,Mt=j.type,wt=j.dismissible!==!1,Qt=j.className||"",Cr=j.descriptionClassName||"",cn=st.useMemo(()=>T.findIndex(Ns=>Ns.toastId===j.id)||0,[T,j.id]),jn=st.useMemo(()=>{var Ns;return(Ns=j.closeButton)!=null?Ns:K},[j.closeButton,K]),Qr=st.useMemo(()=>j.duration||ae||Zbe,[j.duration,ae]),Pn=st.useRef(0),js=st.useRef(0),hr=st.useRef(0),xs=st.useRef(null),[ka,xa]=pe.split("-"),zi=st.useMemo(()=>T.reduce((Ns,Fa,Oa)=>Oa>=cn?Ns:Ns+Fa.height,0),[T,cn]),Bi=nYe(),nl=j.invert||_,xo=Mt==="loading";js.current=st.useMemo(()=>cn*se+zi,[cn,zi]),st.useEffect(()=>{Oe.current=Qr},[Qr]),st.useEffect(()=>{Ue(!0)},[]),st.useEffect(()=>{let Ns=nt.current;if(Ns){let Fa=Ns.getBoundingClientRect().height;return qe(Fa),A(Oa=>[{toastId:j.id,height:Fa,position:j.position},...Oa]),()=>A(Oa=>Oa.filter(Ro=>Ro.toastId!==j.id))}},[A,j.id]),st.useLayoutEffect(()=>{if(!Ee)return;let Ns=nt.current,Fa=Ns.style.height;Ns.style.height="auto";let Oa=Ns.getBoundingClientRect().height;Ns.style.height=Fa,qe(Oa),A(Ro=>Ro.find(ir=>ir.toastId===j.id)?Ro.map(ir=>ir.toastId===j.id?{...ir,height:Oa}:ir):[{toastId:j.id,height:Oa,position:j.position},...Ro])},[Ee,j.title,j.description,A,j.id]);let Hs=st.useCallback(()=>{be(!0),Me(js.current),A(Ns=>Ns.filter(Fa=>Fa.toastId!==j.id)),setTimeout(()=>{q(j)},xYe)},[j,q,A,js]);st.useEffect(()=>{if(j.promise&&Mt==="loading"||j.duration===1/0||j.type==="loading")return;let Ns;return F||N||Se&&Bi?(()=>{if(hr.current{var Fa;(Fa=j.onAutoClose)==null||Fa.call(j,j),Hs()},Oe.current)),()=>clearTimeout(Ns)},[F,N,j,Mt,Se,Bi,Hs]),st.useEffect(()=>{j.delete&&Hs()},[Hs,j.delete]);function Xa(){var Ns,Fa,Oa;return Ae!=null&&Ae.loading?st.createElement("div",{className:Up(_e==null?void 0:_e.loader,(Ns=j==null?void 0:j.classNames)==null?void 0:Ns.loader,"sonner-loader"),"data-visible":Mt==="loading"},Ae.loading):he?st.createElement("div",{className:Up(_e==null?void 0:_e.loader,(Fa=j==null?void 0:j.classNames)==null?void 0:Fa.loader,"sonner-loader"),"data-visible":Mt==="loading"},he):st.createElement(XZe,{className:Up(_e==null?void 0:_e.loader,(Oa=j==null?void 0:j.classNames)==null?void 0:Oa.loader),visible:Mt==="loading"})}return st.createElement("li",{tabIndex:0,ref:nt,className:Up(oe,Qt,_e==null?void 0:_e.toast,(e=j==null?void 0:j.classNames)==null?void 0:e.toast,_e==null?void 0:_e.default,_e==null?void 0:_e[Mt],(n=j==null?void 0:j.classNames)==null?void 0:n[Mt]),"data-sonner-toast":"","data-rich-colors":(s=j.richColors)!=null?s:V,"data-styled":!(j.jsx||j.unstyled||C),"data-mounted":Ee,"data-promise":!!j.promise,"data-swiped":yt,"data-removed":Fe,"data-visible":mt,"data-y-position":ka,"data-x-position":xa,"data-index":P,"data-front":gt,"data-swiping":tt,"data-dismissible":wt,"data-type":Mt,"data-invert":nl,"data-swipe-out":Ke,"data-swipe-direction":ke,"data-expanded":!!(F||ue&&Ee),style:{"--index":P,"--toasts-before":P,"--z-index":z.length-P,"--offset":`${Fe?at:js.current}px`,"--initial-height":ue?"auto":`${ft}px`,...G,...j.style},onDragEnd:()=>{Te(!1),Le(null),xs.current=null},onPointerDown:Ns=>{xo||!wt||(Qe.current=new Date,Me(js.current),Ns.target.setPointerCapture(Ns.pointerId),Ns.target.tagName!=="BUTTON"&&(Te(!0),xs.current={x:Ns.clientX,y:Ns.clientY}))},onPointerUp:()=>{var Ns,Fa,Oa,Ro;if(Ke||!wt)return;xs.current=null;let ir=Number(((Ns=nt.current)==null?void 0:Ns.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),fo=Number(((Fa=nt.current)==null?void 0:Fa.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ml=new Date().getTime()-((Oa=Qe.current)==null?void 0:Oa.getTime()),Ao=ge==="x"?ir:fo,ss=Math.abs(Ao)/ml;if(Math.abs(Ao)>=gYe||ss>.11){Me(js.current),(Ro=j.onDismiss)==null||Ro.call(j,j),Be(ge==="x"?ir>0?"right":"left":fo>0?"down":"up"),Hs(),me(!0),rt(!1);return}Te(!1),Le(null)},onPointerMove:Ns=>{var Fa,Oa,Ro,ir;if(!xs.current||!wt||((Fa=window.getSelection())==null?void 0:Fa.toString().length)>0)return;let fo=Ns.clientY-xs.current.y,ml=Ns.clientX-xs.current.x,Ao=(Oa=t.swipeDirections)!=null?Oa:yYe(pe);!ge&&(Math.abs(ml)>1||Math.abs(fo)>1)&&Le(Math.abs(ml)>Math.abs(fo)?"x":"y");let ss={x:0,y:0};ge==="y"?(Ao.includes("top")||Ao.includes("bottom"))&&(Ao.includes("top")&&fo<0||Ao.includes("bottom")&&fo>0)&&(ss.y=fo):ge==="x"&&(Ao.includes("left")||Ao.includes("right"))&&(Ao.includes("left")&&ml<0||Ao.includes("right")&&ml>0)&&(ss.x=ml),(Math.abs(ss.x)>0||Math.abs(ss.y)>0)&&rt(!0),(Ro=nt.current)==null||Ro.style.setProperty("--swipe-amount-x",`${ss.x}px`),(ir=nt.current)==null||ir.style.setProperty("--swipe-amount-y",`${ss.y}px`)}},jn&&!j.jsx?st.createElement("button",{"aria-label":Ce,"data-disabled":xo,"data-close-button":!0,onClick:xo||!wt?()=>{}:()=>{var Ns;Hs(),(Ns=j.onDismiss)==null||Ns.call(j,j)},className:Up(_e==null?void 0:_e.closeButton,(a=j==null?void 0:j.classNames)==null?void 0:a.closeButton)},(o=Ae==null?void 0:Ae.close)!=null?o:rYe):null,j.jsx||I.isValidElement(j.title)?j.jsx?j.jsx:typeof j.title=="function"?j.title():j.title:st.createElement(st.Fragment,null,Mt||j.icon||j.promise?st.createElement("div",{"data-icon":"",className:Up(_e==null?void 0:_e.icon,(l=j==null?void 0:j.classNames)==null?void 0:l.icon)},j.promise||j.type==="loading"&&!j.icon?j.icon||Xa():null,j.type!=="loading"?j.icon||(Ae==null?void 0:Ae[Mt])||ZZe(Mt):null):null,st.createElement("div",{"data-content":"",className:Up(_e==null?void 0:_e.content,(i=j==null?void 0:j.classNames)==null?void 0:i.content)},st.createElement("div",{"data-title":"",className:Up(_e==null?void 0:_e.title,(h=j==null?void 0:j.classNames)==null?void 0:h.title)},typeof j.title=="function"?j.title():j.title),j.description?st.createElement("div",{"data-description":"",className:Up(ye,Cr,_e==null?void 0:_e.description,(p=j==null?void 0:j.classNames)==null?void 0:p.description)},typeof j.description=="function"?j.description():j.description):null),I.isValidElement(j.cancel)?j.cancel:j.cancel&&aL(j.cancel)?st.createElement("button",{"data-button":!0,"data-cancel":!0,style:j.cancelButtonStyle||te,onClick:Ns=>{var Fa,Oa;aL(j.cancel)&&wt&&((Oa=(Fa=j.cancel).onClick)==null||Oa.call(Fa,Ns),Hs())},className:Up(_e==null?void 0:_e.cancelButton,(x=j==null?void 0:j.classNames)==null?void 0:x.cancelButton)},j.cancel.label):null,I.isValidElement(j.action)?j.action:j.action&&aL(j.action)?st.createElement("button",{"data-button":!0,"data-action":!0,style:j.actionButtonStyle||ie,onClick:Ns=>{var Fa,Oa;aL(j.action)&&((Oa=(Fa=j.action).onClick)==null||Oa.call(Fa,Ns),!Ns.defaultPrevented&&Hs())},className:Up(_e==null?void 0:_e.actionButton,(y=j==null?void 0:j.classNames)==null?void 0:y.actionButton)},j.action.label):null))};function Ybe(){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 _Ye(t,e){let n={};return[t,e].forEach((s,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?fYe:hYe;function h(p){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(p=>{s[p]===void 0?n[`${l}-${p}`]=i:n[`${l}-${p}`]=typeof s[p]=="number"?`${s[p]}px`:s[p]}):h(i)}),n}var bYe=I.forwardRef(function(t,e){let{invert:n,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:h,mobileOffset:p,theme:x="light",richColors:y,duration:_,style:j,visibleToasts:C=uYe,toastOptions:N,dir:A=Ybe(),gap:E=mYe,loadingIcon:T,icons:P,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:F}=t,[q,V]=st.useState([]),K=st.useMemo(()=>Array.from(new Set([s].concat(q.filter(Se=>Se.position).map(Se=>Se.position)))),[q,s]),[G,te]=st.useState([]),[ie,oe]=st.useState(!1),[ye,ae]=st.useState(!1),[pe,se]=st.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),he=st.useRef(null),ue=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),_e=st.useRef(null),Ae=st.useRef(!1),Ce=st.useCallback(Se=>{V(ge=>{var Le;return(Le=ge.find(ke=>ke.id===Se.id))!=null&&Le.delete||ch.dismiss(Se.id),ge.filter(({id:ke})=>ke!==Se.id)})},[]);return st.useEffect(()=>ch.subscribe(Se=>{if(Se.dismiss){V(ge=>ge.map(Le=>Le.id===Se.id?{...Le,delete:!0}:Le));return}setTimeout(()=>{Ome.flushSync(()=>{V(ge=>{let Le=ge.findIndex(ke=>ke.id===Se.id);return Le!==-1?[...ge.slice(0,Le),{...ge[Le],...Se},...ge.slice(Le+1)]:[Se,...ge]})})})}),[]),st.useEffect(()=>{if(x!=="system"){se(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?se("dark"):se("light")),typeof window>"u")return;let Se=window.matchMedia("(prefers-color-scheme: dark)");try{Se.addEventListener("change",({matches:ge})=>{se(ge?"dark":"light")})}catch{Se.addListener(({matches:Le})=>{try{se(Le?"dark":"light")}catch(ke){console.error(ke)}})}},[x]),st.useEffect(()=>{q.length<=1&&oe(!1)},[q]),st.useEffect(()=>{let Se=ge=>{var Le,ke;a.every(Be=>ge[Be]||ge.code===Be)&&(oe(!0),(Le=he.current)==null||Le.focus()),ge.code==="Escape"&&(document.activeElement===he.current||(ke=he.current)!=null&&ke.contains(document.activeElement))&&oe(!1)};return document.addEventListener("keydown",Se),()=>document.removeEventListener("keydown",Se)},[a]),st.useEffect(()=>{if(he.current)return()=>{_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null,Ae.current=!1)}},[he.current]),st.createElement("section",{ref:e,"aria-label":`${z} ${ue}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((Se,ge)=>{var Le;let[ke,Be]=Se.split("-");return q.length?st.createElement("ol",{key:Se,dir:A==="auto"?Ybe():A,tabIndex:-1,ref:he,className:i,"data-sonner-toaster":!0,"data-theme":pe,"data-y-position":ke,"data-lifted":ie&&q.length>1&&!o,"data-x-position":Be,style:{"--front-toast-height":`${((Le=G[0])==null?void 0:Le.height)||0}px`,"--width":`${pYe}px`,"--gap":`${E}px`,...j,..._Ye(h,p)},onBlur:Ee=>{Ae.current&&!Ee.currentTarget.contains(Ee.relatedTarget)&&(Ae.current=!1,_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null))},onFocus:Ee=>{Ee.target instanceof HTMLElement&&Ee.target.dataset.dismissible==="false"||Ae.current||(Ae.current=!0,_e.current=Ee.relatedTarget)},onMouseEnter:()=>oe(!0),onMouseMove:()=>oe(!0),onMouseLeave:()=>{ye||oe(!1)},onDragEnd:()=>oe(!1),onPointerDown:Ee=>{Ee.target instanceof HTMLElement&&Ee.target.dataset.dismissible==="false"||ae(!0)},onPointerUp:()=>ae(!1)},q.filter(Ee=>!Ee.position&&ge===0||Ee.position===Se).map((Ee,Ue)=>{var Fe,be;return st.createElement(vYe,{key:Ee.id,icons:P,index:Ue,toast:Ee,defaultRichColors:y,duration:(Fe=N==null?void 0:N.duration)!=null?Fe:_,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:n,visibleToasts:C,closeButton:(be=N==null?void 0:N.closeButton)!=null?be:l,interacting:ye,position:Se,style:N==null?void 0:N.style,unstyled:N==null?void 0:N.unstyled,classNames:N==null?void 0:N.classNames,cancelButtonStyle:N==null?void 0:N.cancelButtonStyle,actionButtonStyle:N==null?void 0:N.actionButtonStyle,removeToast:Ce,toasts:q.filter(tt=>tt.position==Ee.position),heights:G.filter(tt=>tt.position==Ee.position),setHeights:te,expandByDefault:o,gap:E,loadingIcon:T,expanded:ie,pauseWhenPageIsHidden:F,swipeDirections:t.swipeDirections})})):null}))});const wYe=({...t})=>{const{theme:e="system"}=KZe();return r.jsx(bYe,{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 jYe=Vpe[" useId ".trim().toString()]||(()=>{}),kYe=0;function Kc(t){const[e,n]=I.useState(jYe());return ec(()=>{n(s=>s??String(kYe++))},[t]),e?`radix-${e}`:""}const NYe=["top","right","bottom","left"],B1=Math.min,Wh=Math.max,Fee=Math.round,iL=Math.floor,Cg=t=>({x:t,y:t}),SYe={left:"right",right:"left",bottom:"top",top:"bottom"},CYe={start:"end",end:"start"};function uue(t,e,n){return Wh(t,B1(e,n))}function oy(t,e){return typeof t=="function"?t(e):t}function ly(t){return t.split("-")[0]}function QC(t){return t.split("-")[1]}function Ume(t){return t==="x"?"y":"x"}function qme(t){return t==="y"?"height":"width"}const MYe=new Set(["top","bottom"]);function dg(t){return MYe.has(ly(t))?"y":"x"}function Vme(t){return Ume(dg(t))}function TYe(t,e,n){n===void 0&&(n=!1);const s=QC(t),a=Vme(t),o=qme(a);let l=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=zee(l)),[l,zee(l)]}function AYe(t){const e=zee(t);return[hue(t),e,hue(e)]}function hue(t){return t.replace(/start|end/g,e=>CYe[e])}const Xbe=["left","right"],Qbe=["right","left"],EYe=["top","bottom"],IYe=["bottom","top"];function PYe(t,e,n){switch(t){case"top":case"bottom":return n?e?Qbe:Xbe:e?Xbe:Qbe;case"left":case"right":return e?EYe:IYe;default:return[]}}function LYe(t,e,n,s){const a=QC(t);let o=PYe(ly(t),n==="start",s);return a&&(o=o.map(l=>l+"-"+a),e&&(o=o.concat(o.map(hue)))),o}function zee(t){return t.replace(/left|right|bottom|top/g,e=>SYe[e])}function OYe(t){return{top:0,right:0,bottom:0,left:0,...t}}function AAe(t){return typeof t!="number"?OYe(t):{top:t,right:t,bottom:t,left:t}}function Bee(t){const{x:e,y:n,width:s,height:a}=t;return{width:s,height:a,top:n,left:e,right:e+s,bottom:n+a,x:e,y:n}}function Jbe(t,e,n){let{reference:s,floating:a}=t;const o=dg(e),l=Vme(e),i=qme(l),h=ly(e),p=o==="y",x=s.x+s.width/2-a.width/2,y=s.y+s.height/2-a.height/2,_=s[i]/2-a[i]/2;let j;switch(h){case"top":j={x,y:s.y-a.height};break;case"bottom":j={x,y:s.y+s.height};break;case"right":j={x:s.x+s.width,y};break;case"left":j={x:s.x-a.width,y};break;default:j={x:s.x,y:s.y}}switch(QC(e)){case"start":j[l]-=_*(n&&p?-1:1);break;case"end":j[l]+=_*(n&&p?-1:1);break}return j}const DYe=async(t,e,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:l}=n,i=o.filter(Boolean),h=await(l.isRTL==null?void 0:l.isRTL(e));let p=await l.getElementRects({reference:t,floating:e,strategy:a}),{x,y}=Jbe(p,s,h),_=s,j={},C=0;for(let N=0;N({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:a,rects:o,platform:l,elements:i,middlewareData:h}=e,{element:p,padding:x=0}=oy(t,e)||{};if(p==null)return{};const y=AAe(x),_={x:n,y:s},j=Vme(a),C=qme(j),N=await l.getDimensions(p),A=j==="y",E=A?"top":"left",T=A?"bottom":"right",P=A?"clientHeight":"clientWidth",z=o.reference[C]+o.reference[j]-_[j]-o.floating[C],F=_[j]-o.reference[j],q=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let V=q?q[P]:0;(!V||!await(l.isElement==null?void 0:l.isElement(q)))&&(V=i.floating[P]||o.floating[C]);const K=z/2-F/2,G=V/2-N[C]/2-1,te=B1(y[E],G),ie=B1(y[T],G),oe=te,ye=V-N[C]-ie,ae=V/2-N[C]/2+K,pe=uue(oe,ae,ye),se=!h.arrow&&QC(a)!=null&&ae!==pe&&o.reference[C]/2-(aeae<=0)){var ie,oe;const ae=(((ie=o.flip)==null?void 0:ie.index)||0)+1,pe=V[ae];if(pe&&(!(y==="alignment"?T!==dg(pe):!1)||te.every(ue=>ue.overflows[0]>0&&dg(ue.placement)===T)))return{data:{index:ae,overflows:te},reset:{placement:pe}};let se=(oe=te.filter(he=>he.overflows[0]<=0).sort((he,ue)=>he.overflows[1]-ue.overflows[1])[0])==null?void 0:oe.placement;if(!se)switch(j){case"bestFit":{var ye;const he=(ye=te.filter(ue=>{if(q){const _e=dg(ue.placement);return _e===T||_e==="y"}return!0}).map(ue=>[ue.placement,ue.overflows.filter(_e=>_e>0).reduce((_e,Ae)=>_e+Ae,0)]).sort((ue,_e)=>ue[1]-_e[1])[0])==null?void 0:ye[0];he&&(se=he);break}case"initialPlacement":se=i;break}if(a!==se)return{reset:{placement:se}}}return{}}}};function ewe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function twe(t){return NYe.some(e=>t[e]>=0)}const zYe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:s="referenceHidden",...a}=oy(t,e);switch(s){case"referenceHidden":{const o=await HA(e,{...a,elementContext:"reference"}),l=ewe(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:twe(l)}}}case"escaped":{const o=await HA(e,{...a,altBoundary:!0}),l=ewe(o,n.floating);return{data:{escapedOffsets:l,escaped:twe(l)}}}default:return{}}}}},EAe=new Set(["left","top"]);async function BYe(t,e){const{placement:n,platform:s,elements:a}=t,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),l=ly(n),i=QC(n),h=dg(n)==="y",p=EAe.has(l)?-1:1,x=o&&h?-1:1,y=oy(e,t);let{mainAxis:_,crossAxis:j,alignmentAxis:C}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return i&&typeof C=="number"&&(j=i==="end"?C*-1:C),h?{x:j*x,y:_*p}:{x:_*p,y:j*x}}const $Ye=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:a,y:o,placement:l,middlewareData:i}=e,h=await BYe(e,t);return l===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:a+h.x,y:o+h.y,data:{...h,placement:l}}}}},UYe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:a}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:i={fn:A=>{let{x:E,y:T}=A;return{x:E,y:T}}},...h}=oy(t,e),p={x:n,y:s},x=await HA(e,h),y=dg(ly(a)),_=Ume(y);let j=p[_],C=p[y];if(o){const A=_==="y"?"top":"left",E=_==="y"?"bottom":"right",T=j+x[A],P=j-x[E];j=uue(T,j,P)}if(l){const A=y==="y"?"top":"left",E=y==="y"?"bottom":"right",T=C+x[A],P=C-x[E];C=uue(T,C,P)}const N=i.fn({...e,[_]:j,[y]:C});return{...N,data:{x:N.x-n,y:N.y-s,enabled:{[_]:o,[y]:l}}}}}},qYe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:s,placement:a,rects:o,middlewareData:l}=e,{offset:i=0,mainAxis:h=!0,crossAxis:p=!0}=oy(t,e),x={x:n,y:s},y=dg(a),_=Ume(y);let j=x[_],C=x[y];const N=oy(i,e),A=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(h){const P=_==="y"?"height":"width",z=o.reference[_]-o.floating[P]+A.mainAxis,F=o.reference[_]+o.reference[P]-A.mainAxis;jF&&(j=F)}if(p){var E,T;const P=_==="y"?"width":"height",z=EAe.has(ly(a)),F=o.reference[y]-o.floating[P]+(z&&((E=l.offset)==null?void 0:E[y])||0)+(z?0:A.crossAxis),q=o.reference[y]+o.reference[P]+(z?0:((T=l.offset)==null?void 0:T[y])||0)-(z?A.crossAxis:0);Cq&&(C=q)}return{[_]:j,[y]:C}}}},VYe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,s;const{placement:a,rects:o,platform:l,elements:i}=e,{apply:h=()=>{},...p}=oy(t,e),x=await HA(e,p),y=ly(a),_=QC(a),j=dg(a)==="y",{width:C,height:N}=o.floating;let A,E;y==="top"||y==="bottom"?(A=y,E=_===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(E=y,A=_==="end"?"top":"bottom");const T=N-x.top-x.bottom,P=C-x.left-x.right,z=B1(N-x[A],T),F=B1(C-x[E],P),q=!e.middlewareData.shift;let V=z,K=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=P),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(V=T),q&&!_){const te=Wh(x.left,0),ie=Wh(x.right,0),oe=Wh(x.top,0),ye=Wh(x.bottom,0);j?K=C-2*(te!==0||ie!==0?te+ie:Wh(x.left,x.right)):V=N-2*(oe!==0||ye!==0?oe+ye:Wh(x.top,x.bottom))}await h({...e,availableWidth:K,availableHeight:V});const G=await l.getDimensions(i.floating);return C!==G.width||N!==G.height?{reset:{rects:!0}}:{}}}};function Cne(){return typeof window<"u"}function JC(t){return IAe(t)?(t.nodeName||"").toLowerCase():"#document"}function af(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zg(t){var e;return(e=(IAe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function IAe(t){return Cne()?t instanceof Node||t instanceof af(t).Node:!1}function wm(t){return Cne()?t instanceof Element||t instanceof af(t).Element:!1}function Pg(t){return Cne()?t instanceof HTMLElement||t instanceof af(t).HTMLElement:!1}function rwe(t){return!Cne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof af(t).ShadowRoot}const HYe=new Set(["inline","contents"]);function uI(t){const{overflow:e,overflowX:n,overflowY:s,display:a}=jm(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!HYe.has(a)}const WYe=new Set(["table","td","th"]);function GYe(t){return WYe.has(JC(t))}const KYe=[":popover-open",":modal"];function Mne(t){return KYe.some(e=>{try{return t.matches(e)}catch{return!1}})}const ZYe=["transform","translate","scale","rotate","perspective"],YYe=["transform","translate","scale","rotate","perspective","filter"],XYe=["paint","layout","strict","content"];function Hme(t){const e=Wme(),n=wm(t)?jm(t):t;return ZYe.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)||YYe.some(s=>(n.willChange||"").includes(s))||XYe.some(s=>(n.contain||"").includes(s))}function QYe(t){let e=$1(t);for(;Pg(e)&&!sC(e);){if(Hme(e))return e;if(Mne(e))return null;e=$1(e)}return null}function Wme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const JYe=new Set(["html","body","#document"]);function sC(t){return JYe.has(JC(t))}function jm(t){return af(t).getComputedStyle(t)}function Tne(t){return wm(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $1(t){if(JC(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rwe(t)&&t.host||zg(t);return rwe(e)?e.host:e}function PAe(t){const e=$1(t);return sC(e)?t.ownerDocument?t.ownerDocument.body:t.body:Pg(e)&&uI(e)?e:PAe(e)}function WA(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=PAe(t),o=a===((s=t.ownerDocument)==null?void 0:s.body),l=af(a);if(o){const i=fue(l);return e.concat(l,l.visualViewport||[],uI(a)?a:[],i&&n?WA(i):[])}return e.concat(a,WA(a,[],n))}function fue(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function LAe(t){const e=jm(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const a=Pg(t),o=a?t.offsetWidth:n,l=a?t.offsetHeight:s,i=Fee(n)!==o||Fee(s)!==l;return i&&(n=o,s=l),{width:n,height:s,$:i}}function Gme(t){return wm(t)?t:t.contextElement}function bS(t){const e=Gme(t);if(!Pg(e))return Cg(1);const n=e.getBoundingClientRect(),{width:s,height:a,$:o}=LAe(e);let l=(o?Fee(n.width):n.width)/s,i=(o?Fee(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const eXe=Cg(0);function OAe(t){const e=af(t);return!Wme()||!e.visualViewport?eXe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function tXe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==af(t)?!1:e}function Rj(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),o=Gme(t);let l=Cg(1);e&&(s?wm(s)&&(l=bS(s)):l=bS(t));const i=tXe(o,n,s)?OAe(o):Cg(0);let h=(a.left+i.x)/l.x,p=(a.top+i.y)/l.y,x=a.width/l.x,y=a.height/l.y;if(o){const _=af(o),j=s&&wm(s)?af(s):s;let C=_,N=fue(C);for(;N&&s&&j!==C;){const A=bS(N),E=N.getBoundingClientRect(),T=jm(N),P=E.left+(N.clientLeft+parseFloat(T.paddingLeft))*A.x,z=E.top+(N.clientTop+parseFloat(T.paddingTop))*A.y;h*=A.x,p*=A.y,x*=A.x,y*=A.y,h+=P,p+=z,C=af(N),N=fue(C)}}return Bee({width:x,height:y,x:h,y:p})}function Kme(t,e){const n=Tne(t).scrollLeft;return e?e.left+n:Rj(zg(t)).left+n}function DAe(t,e,n){n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=s.left+e.scrollLeft-(n?0:Kme(t,s)),o=s.top+e.scrollTop;return{x:a,y:o}}function rXe(t){let{elements:e,rect:n,offsetParent:s,strategy:a}=t;const o=a==="fixed",l=zg(s),i=e?Mne(e.floating):!1;if(s===l||i&&o)return n;let h={scrollLeft:0,scrollTop:0},p=Cg(1);const x=Cg(0),y=Pg(s);if((y||!y&&!o)&&((JC(s)!=="body"||uI(l))&&(h=Tne(s)),Pg(s))){const j=Rj(s);p=bS(s),x.x=j.x+s.clientLeft,x.y=j.y+s.clientTop}const _=l&&!y&&!o?DAe(l,h,!0):Cg(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+x.x+_.x,y:n.y*p.y-h.scrollTop*p.y+x.y+_.y}}function nXe(t){return Array.from(t.getClientRects())}function sXe(t){const e=zg(t),n=Tne(t),s=t.ownerDocument.body,a=Wh(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=Wh(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+Kme(t);const i=-n.scrollTop;return jm(s).direction==="rtl"&&(l+=Wh(e.clientWidth,s.clientWidth)-a),{width:a,height:o,x:l,y:i}}function aXe(t,e){const n=af(t),s=zg(t),a=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,i=0,h=0;if(a){o=a.width,l=a.height;const p=Wme();(!p||p&&e==="fixed")&&(i=a.offsetLeft,h=a.offsetTop)}return{width:o,height:l,x:i,y:h}}const iXe=new Set(["absolute","fixed"]);function oXe(t,e){const n=Rj(t,!0,e==="fixed"),s=n.top+t.clientTop,a=n.left+t.clientLeft,o=Pg(t)?bS(t):Cg(1),l=t.clientWidth*o.x,i=t.clientHeight*o.y,h=a*o.x,p=s*o.y;return{width:l,height:i,x:h,y:p}}function nwe(t,e,n){let s;if(e==="viewport")s=aXe(t,n);else if(e==="document")s=sXe(zg(t));else if(wm(e))s=oXe(e,n);else{const a=OAe(t);s={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Bee(s)}function RAe(t,e){const n=$1(t);return n===e||!wm(n)||sC(n)?!1:jm(n).position==="fixed"||RAe(n,e)}function lXe(t,e){const n=e.get(t);if(n)return n;let s=WA(t,[],!1).filter(i=>wm(i)&&JC(i)!=="body"),a=null;const o=jm(t).position==="fixed";let l=o?$1(t):t;for(;wm(l)&&!sC(l);){const i=jm(l),h=Hme(l);!h&&i.position==="fixed"&&(a=null),(o?!h&&!a:!h&&i.position==="static"&&!!a&&iXe.has(a.position)||uI(l)&&!h&&RAe(t,l))?s=s.filter(x=>x!==l):a=i,l=$1(l)}return e.set(t,s),s}function cXe(t){let{element:e,boundary:n,rootBoundary:s,strategy:a}=t;const l=[...n==="clippingAncestors"?Mne(e)?[]:lXe(e,this._c):[].concat(n),s],i=l[0],h=l.reduce((p,x)=>{const y=nwe(e,x,a);return p.top=Wh(y.top,p.top),p.right=B1(y.right,p.right),p.bottom=B1(y.bottom,p.bottom),p.left=Wh(y.left,p.left),p},nwe(e,i,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function dXe(t){const{width:e,height:n}=LAe(t);return{width:e,height:n}}function uXe(t,e,n){const s=Pg(e),a=zg(e),o=n==="fixed",l=Rj(t,!0,o,e);let i={scrollLeft:0,scrollTop:0};const h=Cg(0);function p(){h.x=Kme(a)}if(s||!s&&!o)if((JC(e)!=="body"||uI(a))&&(i=Tne(e)),s){const j=Rj(e,!0,o,e);h.x=j.x+e.clientLeft,h.y=j.y+e.clientTop}else a&&p();o&&!s&&a&&p();const x=a&&!s&&!o?DAe(a,i):Cg(0),y=l.left+i.scrollLeft-h.x-x.x,_=l.top+i.scrollTop-h.y-x.y;return{x:y,y:_,width:l.width,height:l.height}}function gle(t){return jm(t).position==="static"}function swe(t,e){if(!Pg(t)||jm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return zg(t)===n&&(n=n.ownerDocument.body),n}function FAe(t,e){const n=af(t);if(Mne(t))return n;if(!Pg(t)){let a=$1(t);for(;a&&!sC(a);){if(wm(a)&&!gle(a))return a;a=$1(a)}return n}let s=swe(t,e);for(;s&&GYe(s)&&gle(s);)s=swe(s,e);return s&&sC(s)&&gle(s)&&!Hme(s)?n:s||QYe(t)||n}const hXe=async function(t){const e=this.getOffsetParent||FAe,n=this.getDimensions,s=await n(t.floating);return{reference:uXe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function fXe(t){return jm(t).direction==="rtl"}const pXe={convertOffsetParentRelativeRectToViewportRelativeRect:rXe,getDocumentElement:zg,getClippingRect:cXe,getOffsetParent:FAe,getElementRects:hXe,getClientRects:nXe,getDimensions:dXe,getScale:bS,isElement:wm,isRTL:fXe};function zAe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function mXe(t,e){let n=null,s;const a=zg(t);function o(){var i;clearTimeout(s),(i=n)==null||i.disconnect(),n=null}function l(i,h){i===void 0&&(i=!1),h===void 0&&(h=1),o();const p=t.getBoundingClientRect(),{left:x,top:y,width:_,height:j}=p;if(i||e(),!_||!j)return;const C=iL(y),N=iL(a.clientWidth-(x+_)),A=iL(a.clientHeight-(y+j)),E=iL(x),P={rootMargin:-C+"px "+-N+"px "+-A+"px "+-E+"px",threshold:Wh(0,B1(1,h))||1};let z=!0;function F(q){const V=q[0].intersectionRatio;if(V!==h){if(!z)return l();V?l(!1,V):s=setTimeout(()=>{l(!1,1e-7)},1e3)}V===1&&!zAe(p,t.getBoundingClientRect())&&l(),z=!1}try{n=new IntersectionObserver(F,{...P,root:a.ownerDocument})}catch{n=new IntersectionObserver(F,P)}n.observe(t)}return l(!0),o}function gXe(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=Gme(t),x=a||o?[...p?WA(p):[],...WA(e)]:[];x.forEach(E=>{a&&E.addEventListener("scroll",n,{passive:!0}),o&&E.addEventListener("resize",n)});const y=p&&i?mXe(p,n):null;let _=-1,j=null;l&&(j=new ResizeObserver(E=>{let[T]=E;T&&T.target===p&&j&&(j.unobserve(e),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var P;(P=j)==null||P.observe(e)})),n()}),p&&!h&&j.observe(p),j.observe(e));let C,N=h?Rj(t):null;h&&A();function A(){const E=Rj(t);N&&!zAe(N,E)&&n(),N=E,C=requestAnimationFrame(A)}return n(),()=>{var E;x.forEach(T=>{a&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),y==null||y(),(E=j)==null||E.disconnect(),j=null,h&&cancelAnimationFrame(C)}}const xXe=$Ye,yXe=UYe,vXe=FYe,_Xe=VYe,bXe=zYe,awe=RYe,wXe=qYe,jXe=(t,e,n)=>{const s=new Map,a={platform:pXe,...n},o={...a.platform,_c:s};return DYe(t,e,{...a,platform:o})};var kXe=typeof document<"u",NXe=function(){},XJ=kXe?I.useLayoutEffect:NXe;function $ee(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,a;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(!$ee(t[s],e[s]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,a[s]))return!1;for(s=n;s--!==0;){const o=a[s];if(!(o==="_owner"&&t.$$typeof)&&!$ee(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function BAe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function iwe(t,e){const n=BAe(t);return Math.round(e*n)/n}function xle(t){const e=I.useRef(t);return XJ(()=>{e.current=t}),e}function SXe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:o,floating:l}={},transform:i=!0,whileElementsMounted:h,open:p}=t,[x,y]=I.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[_,j]=I.useState(s);$ee(_,s)||j(s);const[C,N]=I.useState(null),[A,E]=I.useState(null),T=I.useCallback(ue=>{ue!==q.current&&(q.current=ue,N(ue))},[]),P=I.useCallback(ue=>{ue!==V.current&&(V.current=ue,E(ue))},[]),z=o||C,F=l||A,q=I.useRef(null),V=I.useRef(null),K=I.useRef(x),G=h!=null,te=xle(h),ie=xle(a),oe=xle(p),ye=I.useCallback(()=>{if(!q.current||!V.current)return;const ue={placement:e,strategy:n,middleware:_};ie.current&&(ue.platform=ie.current),jXe(q.current,V.current,ue).then(_e=>{const Ae={..._e,isPositioned:oe.current!==!1};ae.current&&!$ee(K.current,Ae)&&(K.current=Ae,gy.flushSync(()=>{y(Ae)}))})},[_,e,n,ie,oe]);XJ(()=>{p===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,y(ue=>({...ue,isPositioned:!1})))},[p]);const ae=I.useRef(!1);XJ(()=>(ae.current=!0,()=>{ae.current=!1}),[]),XJ(()=>{if(z&&(q.current=z),F&&(V.current=F),z&&F){if(te.current)return te.current(z,F,ye);ye()}},[z,F,ye,te,G]);const pe=I.useMemo(()=>({reference:q,floating:V,setReference:T,setFloating:P}),[T,P]),se=I.useMemo(()=>({reference:z,floating:F}),[z,F]),he=I.useMemo(()=>{const ue={position:n,left:0,top:0};if(!se.floating)return ue;const _e=iwe(se.floating,x.x),Ae=iwe(se.floating,x.y);return i?{...ue,transform:"translate("+_e+"px, "+Ae+"px)",...BAe(se.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_e,top:Ae}},[n,i,se.floating,x.x,x.y]);return I.useMemo(()=>({...x,update:ye,refs:pe,elements:se,floatingStyles:he}),[x,ye,pe,se,he])}const CXe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:a}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?awe({element:s.current,padding:a}).fn(n):{}:s?awe({element:s,padding:a}).fn(n):{}}}},MXe=(t,e)=>({...xXe(t),options:[t,e]}),TXe=(t,e)=>({...yXe(t),options:[t,e]}),AXe=(t,e)=>({...wXe(t),options:[t,e]}),EXe=(t,e)=>({...vXe(t),options:[t,e]}),IXe=(t,e)=>({..._Xe(t),options:[t,e]}),PXe=(t,e)=>({...bXe(t),options:[t,e]}),LXe=(t,e)=>({...CXe(t),options:[t,e]});var OXe="Arrow",$Ae=I.forwardRef((t,e)=>{const{children:n,width:s=10,height:a=5,...o}=t;return r.jsx(Rn.svg,{...o,ref:e,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});$Ae.displayName=OXe;var DXe=$Ae;function hI(t){const[e,n]=I.useState(void 0);return ec(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let l,i;if("borderBoxSize"in o){const h=o.borderBoxSize,p=Array.isArray(h)?h[0]:h;l=p.inlineSize,i=p.blockSize}else l=t.offsetWidth,i=t.offsetHeight;n({width:l,height:i})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}var Zme="Popper",[UAe,Bg]=rc(Zme),[RXe,qAe]=UAe(Zme),VAe=t=>{const{__scopePopper:e,children:n}=t,[s,a]=I.useState(null);return r.jsx(RXe,{scope:e,anchor:s,onAnchorChange:a,children:n})};VAe.displayName=Zme;var HAe="PopperAnchor",WAe=I.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:s,...a}=t,o=qAe(HAe,n),l=I.useRef(null),i=ta(e,l);return I.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Rn.div,{...a,ref:i})});WAe.displayName=HAe;var Yme="PopperContent",[FXe,zXe]=UAe(Yme),GAe=I.forwardRef((t,e)=>{var Ee,Ue,Fe,be,tt,Te;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:_=!1,updatePositionStrategy:j="optimized",onPlaced:C,...N}=t,A=qAe(Yme,n),[E,T]=I.useState(null),P=ta(e,Ke=>T(Ke)),[z,F]=I.useState(null),q=hI(z),V=(q==null?void 0:q.width)??0,K=(q==null?void 0:q.height)??0,G=s+(o!=="center"?"-"+o:""),te=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ie=Array.isArray(p)?p:[p],oe=ie.length>0,ye={padding:te,boundary:ie.filter($Xe),altBoundary:oe},{refs:ae,floatingStyles:pe,placement:se,isPositioned:he,middlewareData:ue}=SXe({strategy:"fixed",placement:G,whileElementsMounted:(...Ke)=>gXe(...Ke,{animationFrame:j==="always"}),elements:{reference:A.anchor},middleware:[MXe({mainAxis:a+K,alignmentAxis:l}),h&&TXe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?AXe():void 0,...ye}),h&&EXe({...ye}),IXe({...ye,apply:({elements:Ke,rects:me,availableWidth:yt,availableHeight:rt})=>{const{width:at,height:Me}=me.reference,ft=Ke.floating.style;ft.setProperty("--radix-popper-available-width",`${yt}px`),ft.setProperty("--radix-popper-available-height",`${rt}px`),ft.setProperty("--radix-popper-anchor-width",`${at}px`),ft.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),z&&LXe({element:z,padding:i}),UXe({arrowWidth:V,arrowHeight:K}),_&&PXe({strategy:"referenceHidden",...ye})]}),[_e,Ae]=YAe(se),Ce=Ql(C);ec(()=>{he&&(Ce==null||Ce())},[he,Ce]);const Se=(Ee=ue.arrow)==null?void 0:Ee.x,ge=(Ue=ue.arrow)==null?void 0:Ue.y,Le=((Fe=ue.arrow)==null?void 0:Fe.centerOffset)!==0,[ke,Be]=I.useState();return ec(()=>{E&&Be(window.getComputedStyle(E).zIndex)},[E]),r.jsx("div",{ref:ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...pe,transform:he?pe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ke,"--radix-popper-transform-origin":[(be=ue.transformOrigin)==null?void 0:be.x,(tt=ue.transformOrigin)==null?void 0:tt.y].join(" "),...((Te=ue.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:r.jsx(FXe,{scope:n,placedSide:_e,onArrowChange:F,arrowX:Se,arrowY:ge,shouldHideArrow:Le,children:r.jsx(Rn.div,{"data-side":_e,"data-align":Ae,...N,ref:P,style:{...N.style,animation:he?void 0:"none"}})})})});GAe.displayName=Yme;var KAe="PopperArrow",BXe={top:"bottom",right:"left",bottom:"top",left:"right"},ZAe=I.forwardRef(function(e,n){const{__scopePopper:s,...a}=e,o=zXe(KAe,s),l=BXe[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]: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(DXe,{...a,ref:n,style:{...a.style,display:"block"}})})});ZAe.displayName=KAe;function $Xe(t){return t!==null}var UXe=t=>({name:"transformOrigin",options:t,fn(e){var A,E,T;const{placement:n,rects:s,middlewareData:a}=e,l=((A=a.arrow)==null?void 0:A.centerOffset)!==0,i=l?0:t.arrowWidth,h=l?0:t.arrowHeight,[p,x]=YAe(n),y={start:"0%",center:"50%",end:"100%"}[x],_=(((E=a.arrow)==null?void 0:E.x)??0)+i/2,j=(((T=a.arrow)==null?void 0:T.y)??0)+h/2;let C="",N="";return p==="bottom"?(C=l?y:`${_}px`,N=`${-h}px`):p==="top"?(C=l?y:`${_}px`,N=`${s.floating.height+h}px`):p==="right"?(C=`${-h}px`,N=l?y:`${j}px`):p==="left"&&(C=`${s.floating.width+h}px`,N=l?y:`${j}px`),{data:{x:C,y:N}}}});function YAe(t){const[e,n="center"]=t.split("-");return[e,n]}var fI=VAe,e3=WAe,pI=GAe,mI=ZAe,[Ane]=rc("Tooltip",[Bg]),Ene=Bg(),XAe="TooltipProvider",qXe=700,pue="tooltip.open",[VXe,Xme]=Ane(XAe),QAe=t=>{const{__scopeTooltip:e,delayDuration:n=qXe,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:o}=t,l=I.useRef(!0),i=I.useRef(!1),h=I.useRef(0);return I.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),r.jsx(VXe,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:I.useCallback(p=>{i.current=p},[]),disableHoverableContent:a,children:o})};QAe.displayName=XAe;var GA="Tooltip",[HXe,Ine]=Ane(GA),JAe=t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=t,h=Xme(GA,t.__scopeTooltip),p=Ene(e),[x,y]=I.useState(null),_=Kc(),j=I.useRef(0),C=l??h.disableHoverableContent,N=i??h.delayDuration,A=I.useRef(!1),[E,T]=$u({prop:s,defaultProp:a??!1,onChange:V=>{V?(h.onOpen(),document.dispatchEvent(new CustomEvent(pue))):h.onClose(),o==null||o(V)},caller:GA}),P=I.useMemo(()=>E?A.current?"delayed-open":"instant-open":"closed",[E]),z=I.useCallback(()=>{window.clearTimeout(j.current),j.current=0,A.current=!1,T(!0)},[T]),F=I.useCallback(()=>{window.clearTimeout(j.current),j.current=0,T(!1)},[T]),q=I.useCallback(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>{A.current=!0,T(!0),j.current=0},N)},[N,T]);return I.useEffect(()=>()=>{j.current&&(window.clearTimeout(j.current),j.current=0)},[]),r.jsx(fI,{...p,children:r.jsx(HXe,{scope:e,contentId:_,open:E,stateAttribute:P,trigger:x,onTriggerChange:y,onTriggerEnter:I.useCallback(()=>{h.isOpenDelayedRef.current?q():z()},[h.isOpenDelayedRef,q,z]),onTriggerLeave:I.useCallback(()=>{C?F():(window.clearTimeout(j.current),j.current=0)},[F,C]),onOpen:z,onClose:F,disableHoverableContent:C,children:n})})};JAe.displayName=GA;var mue="TooltipTrigger",eEe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,a=Ine(mue,n),o=Xme(mue,n),l=Ene(n),i=I.useRef(null),h=ta(e,i,a.onTriggerChange),p=I.useRef(!1),x=I.useRef(!1),y=I.useCallback(()=>p.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),r.jsx(e3,{asChild:!0,...l,children:r.jsx(Rn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:h,onPointerMove:on(t.onPointerMove,_=>{_.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:on(t.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:on(t.onPointerDown,()=>{a.open&&a.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:on(t.onFocus,()=>{p.current||a.onOpen()}),onBlur:on(t.onBlur,a.onClose),onClick:on(t.onClick,a.onClose)})})});eEe.displayName=mue;var WXe="TooltipPortal",[DKt,GXe]=Ane(WXe,{forceMount:void 0}),aC="TooltipContent",tEe=I.forwardRef((t,e)=>{const n=GXe(aC,t.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...o}=t,l=Ine(aC,t.__scopeTooltip);return r.jsx(xc,{present:s||l.open,children:l.disableHoverableContent?r.jsx(rEe,{side:a,...o,ref:e}):r.jsx(KXe,{side:a,...o,ref:e})})}),KXe=I.forwardRef((t,e)=>{const n=Ine(aC,t.__scopeTooltip),s=Xme(aC,t.__scopeTooltip),a=I.useRef(null),o=ta(e,a),[l,i]=I.useState(null),{trigger:h,onClose:p}=n,x=a.current,{onPointerInTransitChange:y}=s,_=I.useCallback(()=>{i(null),y(!1)},[y]),j=I.useCallback((C,N)=>{const A=C.currentTarget,E={x:C.clientX,y:C.clientY},T=JXe(E,A.getBoundingClientRect()),P=eQe(E,T),z=tQe(N.getBoundingClientRect()),F=nQe([...P,...z]);i(F),y(!0)},[y]);return I.useEffect(()=>()=>_(),[_]),I.useEffect(()=>{if(h&&x){const C=A=>j(A,x),N=A=>j(A,h);return h.addEventListener("pointerleave",C),x.addEventListener("pointerleave",N),()=>{h.removeEventListener("pointerleave",C),x.removeEventListener("pointerleave",N)}}},[h,x,j,_]),I.useEffect(()=>{if(l){const C=N=>{const A=N.target,E={x:N.clientX,y:N.clientY},T=(h==null?void 0:h.contains(A))||(x==null?void 0:x.contains(A)),P=!rQe(E,l);T?_():P&&(_(),p())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[h,x,l,p,_]),r.jsx(rEe,{...t,ref:o})}),[ZXe,YXe]=Ane(GA,{isInside:!1}),XXe=WTe("TooltipContent"),rEe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=t,h=Ine(aC,n),p=Ene(n),{onClose:x}=h;return I.useEffect(()=>(document.addEventListener(pue,x),()=>document.removeEventListener(pue,x)),[x]),I.useEffect(()=>{if(h.trigger){const y=_=>{const j=_.target;j!=null&&j.contains(h.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[h.trigger,x]),r.jsx(rv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(pI,{"data-state":h.stateAttribute,...p,...i,ref:e,style:{...i.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(XXe,{children:s}),r.jsx(ZXe,{scope:n,isInside:!0,children:r.jsx($Ke,{id:h.contentId,role:"tooltip",children:a||s})})]})})});tEe.displayName=aC;var nEe="TooltipArrow",QXe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,a=Ene(n);return YXe(nEe,n).isInside?null:r.jsx(mI,{...a,...s,ref:e})});QXe.displayName=nEe;function JXe(t,e){const n=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),a=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,s,a,o)){case o:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function eQe(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 tQe(t){const{top:e,right:n,bottom:s,left:a}=t;return[{x:a,y:e},{x:n,y:e},{x:n,y:s},{x:a,y:s}]}function rQe(t,e){const{x:n,y:s}=t;let a=!1;for(let o=0,l=e.length-1;os!=_>s&&n<(y-p)*(s-x)/(_-x)+p&&(a=!a)}return a}function nQe(t){const e=t.slice();return e.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),sQe(e)}function sQe(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s=2;){const o=e[e.length-1],l=e[e.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))e.pop();else break}e.push(a)}e.pop();const n=[];for(let s=t.length-1;s>=0;s--){const a=t[s];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}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 aQe=QAe,iQe=JAe,oQe=eEe,sEe=tEe;const gI=aQe,Mg=iQe,Tg=oQe,vm=I.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(sEe,{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}));vm.displayName=sEe.displayName;var t3=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(){}},Fj=typeof window>"u"||"Deno"in globalThis;function Iu(){}function lQe(t,e){return typeof t=="function"?t(e):t}function gue(t){return typeof t=="number"&&t>=0&&t!==1/0}function aEe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function C1(t,e){return typeof t=="function"?t(e):t}function Rf(t,e){return typeof t=="function"?t(e):t}function owe(t,e){const{type:n="all",exact:s,fetchStatus:a,predicate:o,queryKey:l,stale:i}=t;if(l){if(s){if(e.queryHash!==Qme(l,e.options))return!1}else if(!KA(e.queryKey,l))return!1}if(n!=="all"){const h=e.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof i=="boolean"&&e.isStale()!==i||a&&a!==e.state.fetchStatus||o&&!o(e))}function lwe(t,e){const{exact:n,status:s,predicate:a,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(zj(e.options.mutationKey)!==zj(o))return!1}else if(!KA(e.options.mutationKey,o))return!1}return!(s&&e.state.status!==s||a&&!a(e))}function Qme(t,e){return((e==null?void 0:e.queryKeyHashFn)||zj)(t)}function zj(t){return JSON.stringify(t,(e,n)=>xue(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function KA(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>KA(t[n],e[n])):!1}function iEe(t,e){if(t===e)return t;const n=cwe(t)&&cwe(e);if(n||xue(t)&&xue(e)){const s=n?t:Object.keys(t),a=s.length,o=n?e:Object.keys(e),l=o.length,i=n?[]:{},h=new Set(s);let p=0;for(let x=0;x{setTimeout(e,t)})}function yue(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?iEe(t,e):e}function dQe(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function uQe(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}var Jme=Symbol();function oEe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Jme?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function lEe(t,e){return typeof t=="function"?t(...e):!!t}var Xw,R0,zS,b5e,hQe=(b5e=class extends t3{constructor(){super();ca(this,Xw);ca(this,R0);ca(this,zS);us(this,zS,e=>{if(!Fj&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){er(this,R0)||this.setEventListener(er(this,zS))}onUnsubscribe(){var e;this.hasListeners()||((e=er(this,R0))==null||e.call(this),us(this,R0,void 0))}setEventListener(e){var n;us(this,zS,e),(n=er(this,R0))==null||n.call(this),us(this,R0,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){er(this,Xw)!==e&&(us(this,Xw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof er(this,Xw)=="boolean"?er(this,Xw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Xw=new WeakMap,R0=new WeakMap,zS=new WeakMap,b5e),ege=new hQe,BS,F0,$S,w5e,fQe=(w5e=class extends t3{constructor(){super();ca(this,BS,!0);ca(this,F0);ca(this,$S);us(this,$S,e=>{if(!Fj&&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(){er(this,F0)||this.setEventListener(er(this,$S))}onUnsubscribe(){var e;this.hasListeners()||((e=er(this,F0))==null||e.call(this),us(this,F0,void 0))}setEventListener(e){var n;us(this,$S,e),(n=er(this,F0))==null||n.call(this),us(this,F0,e(this.setOnline.bind(this)))}setOnline(e){er(this,BS)!==e&&(us(this,BS,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return er(this,BS)}},BS=new WeakMap,F0=new WeakMap,$S=new WeakMap,w5e),qee=new fQe;function vue(){let t,e;const n=new Promise((a,o)=>{t=a,e=o});n.status="pending",n.catch(()=>{});function s(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{s({status:"fulfilled",value:a}),t(a)},n.reject=a=>{s({status:"rejected",reason:a}),e(a)},n}function pQe(t){return Math.min(1e3*2**t,3e4)}function cEe(t){return(t??"online")==="online"?qee.isOnline():!0}var dEe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function yle(t){return t instanceof dEe}function uEe(t){let e=!1,n=0,s=!1,a;const o=vue(),l=N=>{var A;s||(_(new dEe(N)),(A=t.abort)==null||A.call(t))},i=()=>{e=!0},h=()=>{e=!1},p=()=>ege.isFocused()&&(t.networkMode==="always"||qee.isOnline())&&t.canRun(),x=()=>cEe(t.networkMode)&&t.canRun(),y=N=>{var A;s||(s=!0,(A=t.onSuccess)==null||A.call(t,N),a==null||a(),o.resolve(N))},_=N=>{var A;s||(s=!0,(A=t.onError)==null||A.call(t,N),a==null||a(),o.reject(N))},j=()=>new Promise(N=>{var A;a=E=>{(s||p())&&N(E)},(A=t.onPause)==null||A.call(t)}).then(()=>{var N;a=void 0,s||(N=t.onContinue)==null||N.call(t)}),C=()=>{if(s)return;let N;const A=n===0?t.initialPromise:void 0;try{N=A??t.fn()}catch(E){N=Promise.reject(E)}Promise.resolve(N).then(y).catch(E=>{var q;if(s)return;const T=t.retry??(Fj?0:3),P=t.retryDelay??pQe,z=typeof P=="function"?P(n,E):P,F=T===!0||typeof T=="number"&&np()?void 0:j()).then(()=>{e?_(E):C()})})};return{promise:o,cancel:l,continue:()=>(a==null||a(),o),cancelRetry:i,continueRetry:h,canStart:x,start:()=>(x()?C():j().then(C),o)}}var mQe=t=>setTimeout(t,0);function gQe(){let t=[],e=0,n=i=>{i()},s=i=>{i()},a=mQe;const o=i=>{e?t.push(i):a(()=>{n(i)})},l=()=>{const i=t;t=[],i.length&&a(()=>{s(()=>{i.forEach(h=>{n(h)})})})};return{batch:i=>{let h;e++;try{h=i()}finally{e--,e||l()}return h},batchCalls:i=>(...h)=>{o(()=>{i(...h)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{a=i}}}var Hc=gQe(),Qw,j5e,hEe=(j5e=class{constructor(){ca(this,Qw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gue(this.gcTime)&&us(this,Qw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Fj?1/0:5*60*1e3))}clearGcTimeout(){er(this,Qw)&&(clearTimeout(er(this,Qw)),us(this,Qw,void 0))}},Qw=new WeakMap,j5e),US,Jw,Df,ej,Xd,eI,tj,Yp,_x,k5e,xQe=(k5e=class extends hEe{constructor(e){super();ca(this,Yp);ca(this,US);ca(this,Jw);ca(this,Df);ca(this,ej);ca(this,Xd);ca(this,eI);ca(this,tj);us(this,tj,!1),us(this,eI,e.defaultOptions),this.setOptions(e.options),this.observers=[],us(this,ej,e.client),us(this,Df,er(this,ej).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,us(this,US,yQe(this.options)),this.state=e.state??er(this,US),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=er(this,Xd))==null?void 0:e.promise}setOptions(e){this.options={...er(this,eI),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&er(this,Df).remove(this)}setData(e,n){const s=yue(this.state.data,e,this.options);return oi(this,Yp,_x).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e,n){oi(this,Yp,_x).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var s,a;const n=(s=er(this,Xd))==null?void 0:s.promise;return(a=er(this,Xd))==null||a.cancel(e),n?n.then(Iu).catch(Iu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(er(this,US))}isActive(){return this.observers.some(e=>Rf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jme||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>C1(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:!aEe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=er(this,Xd))==null||n.continue()}onOnline(){var n;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=er(this,Xd))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),er(this,Df).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(er(this,Xd)&&(er(this,tj)?er(this,Xd).cancel({revert:!0}):er(this,Xd).cancelRetry()),this.scheduleGc()),er(this,Df).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||oi(this,Yp,_x).call(this,{type:"invalidate"})}fetch(e,n){var p,x,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(er(this,Xd))return er(this,Xd).continueRetry(),er(this,Xd).promise}if(e&&this.setOptions(e),!this.options.queryFn){const _=this.observers.find(j=>j.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,a=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(us(this,tj,!0),s.signal)})},o=()=>{const _=oEe(this.options,n),C=(()=>{const N={client:er(this,ej),queryKey:this.queryKey,meta:this.meta};return a(N),N})();return us(this,tj,!1),this.options.persister?this.options.persister(_,C,this):_(C)},i=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:er(this,ej),state:this.state,fetchFn:o};return a(_),_})();(p=this.options.behavior)==null||p.onFetch(i,this),us(this,Jw,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&oi(this,Yp,_x).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const h=_=>{var j,C,N,A;yle(_)&&_.silent||oi(this,Yp,_x).call(this,{type:"error",error:_}),yle(_)||((C=(j=er(this,Df).config).onError)==null||C.call(j,_,this),(A=(N=er(this,Df).config).onSettled)==null||A.call(N,this.state.data,_,this)),this.scheduleGc()};return us(this,Xd,uEe({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onSuccess:_=>{var j,C,N,A;if(_===void 0){h(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(_)}catch(E){h(E);return}(C=(j=er(this,Df).config).onSuccess)==null||C.call(j,_,this),(A=(N=er(this,Df).config).onSettled)==null||A.call(N,_,this.state.error,this),this.scheduleGc()},onError:h,onFail:(_,j)=>{oi(this,Yp,_x).call(this,{type:"failed",failureCount:_,error:j})},onPause:()=>{oi(this,Yp,_x).call(this,{type:"pause"})},onContinue:()=>{oi(this,Yp,_x).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),er(this,Xd).start()}},US=new WeakMap,Jw=new WeakMap,Df=new WeakMap,ej=new WeakMap,Xd=new WeakMap,eI=new WeakMap,tj=new WeakMap,Yp=new WeakSet,_x=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,...fEe(s.data,this.options),fetchMeta:e.meta??null};case"success":return us(this,Jw,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 a=e.error;return yle(a)&&a.revert&&er(this,Jw)?{...er(this,Jw),fetchStatus:"idle"}:{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=n(this.state),Hc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),er(this,Df).notify({query:this,type:"updated",action:e})})},k5e);function fEe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cEe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function yQe(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 sg,N5e,vQe=(N5e=class extends t3{constructor(e={}){super();ca(this,sg);this.config=e,us(this,sg,new Map)}build(e,n,s){const a=n.queryKey,o=n.queryHash??Qme(a,n);let l=this.get(o);return l||(l=new xQe({client:e,queryKey:a,queryHash:o,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(a)}),this.add(l)),l}add(e){er(this,sg).has(e.queryHash)||(er(this,sg).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=er(this,sg).get(e.queryHash);n&&(e.destroy(),n===e&&er(this,sg).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Hc.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return er(this,sg).get(e)}getAll(){return[...er(this,sg).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>owe(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>owe(e,s)):n}notify(e){Hc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Hc.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Hc.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},sg=new WeakMap,N5e),ag,Tu,rj,ig,p0,S5e,_Qe=(S5e=class extends hEe{constructor(e){super();ca(this,ig);ca(this,ag);ca(this,Tu);ca(this,rj);this.mutationId=e.mutationId,us(this,Tu,e.mutationCache),us(this,ag,[]),this.state=e.state||pEe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){er(this,ag).includes(e)||(er(this,ag).push(e),this.clearGcTimeout(),er(this,Tu).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){us(this,ag,er(this,ag).filter(n=>n!==e)),this.scheduleGc(),er(this,Tu).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){er(this,ag).length||(this.state.status==="pending"?this.scheduleGc():er(this,Tu).remove(this))}continue(){var e;return((e=er(this,rj))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,l,i,h,p,x,y,_,j,C,N,A,E,T,P,z,F,q,V,K;const n=()=>{oi(this,ig,p0).call(this,{type:"continue"})};us(this,rj,uEe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(G,te)=>{oi(this,ig,p0).call(this,{type:"failed",failureCount:G,error:te})},onPause:()=>{oi(this,ig,p0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>er(this,Tu).canRun(this)}));const s=this.state.status==="pending",a=!er(this,rj).canStart();try{if(s)n();else{oi(this,ig,p0).call(this,{type:"pending",variables:e,isPaused:a}),await((l=(o=er(this,Tu).config).onMutate)==null?void 0:l.call(o,e,this));const te=await((h=(i=this.options).onMutate)==null?void 0:h.call(i,e));te!==this.state.context&&oi(this,ig,p0).call(this,{type:"pending",context:te,variables:e,isPaused:a})}const G=await er(this,rj).start();return await((x=(p=er(this,Tu).config).onSuccess)==null?void 0:x.call(p,G,e,this.state.context,this)),await((_=(y=this.options).onSuccess)==null?void 0:_.call(y,G,e,this.state.context)),await((C=(j=er(this,Tu).config).onSettled)==null?void 0:C.call(j,G,null,this.state.variables,this.state.context,this)),await((A=(N=this.options).onSettled)==null?void 0:A.call(N,G,null,e,this.state.context)),oi(this,ig,p0).call(this,{type:"success",data:G}),G}catch(G){try{throw await((T=(E=er(this,Tu).config).onError)==null?void 0:T.call(E,G,e,this.state.context,this)),await((z=(P=this.options).onError)==null?void 0:z.call(P,G,e,this.state.context)),await((q=(F=er(this,Tu).config).onSettled)==null?void 0:q.call(F,void 0,G,this.state.variables,this.state.context,this)),await((K=(V=this.options).onSettled)==null?void 0:K.call(V,void 0,G,e,this.state.context)),G}finally{oi(this,ig,p0).call(this,{type:"error",error:G})}}finally{er(this,Tu).runNext(this)}}},ag=new WeakMap,Tu=new WeakMap,rj=new WeakMap,ig=new WeakSet,p0=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),Hc.batch(()=>{er(this,ag).forEach(s=>{s.onMutationUpdate(e)}),er(this,Tu).notify({mutation:this,type:"updated",action:e})})},S5e);function pEe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Tx,Xp,tI,C5e,bQe=(C5e=class extends t3{constructor(e={}){super();ca(this,Tx);ca(this,Xp);ca(this,tI);this.config=e,us(this,Tx,new Set),us(this,Xp,new Map),us(this,tI,0)}build(e,n,s){const a=new _Qe({mutationCache:this,mutationId:++z6(this,tI)._,options:e.defaultMutationOptions(n),state:s});return this.add(a),a}add(e){er(this,Tx).add(e);const n=oL(e);if(typeof n=="string"){const s=er(this,Xp).get(n);s?s.push(e):er(this,Xp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(er(this,Tx).delete(e)){const n=oL(e);if(typeof n=="string"){const s=er(this,Xp).get(n);if(s)if(s.length>1){const a=s.indexOf(e);a!==-1&&s.splice(a,1)}else s[0]===e&&er(this,Xp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=oL(e);if(typeof n=="string"){const s=er(this,Xp).get(n),a=s==null?void 0:s.find(o=>o.state.status==="pending");return!a||a===e}else return!0}runNext(e){var s;const n=oL(e);if(typeof n=="string"){const a=(s=er(this,Xp).get(n))==null?void 0:s.find(o=>o!==e&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Hc.batch(()=>{er(this,Tx).forEach(e=>{this.notify({type:"removed",mutation:e})}),er(this,Tx).clear(),er(this,Xp).clear()})}getAll(){return Array.from(er(this,Tx))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>lwe(n,s))}findAll(e={}){return this.getAll().filter(n=>lwe(e,n))}notify(e){Hc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Hc.batch(()=>Promise.all(e.map(n=>n.continue().catch(Iu))))}},Tx=new WeakMap,Xp=new WeakMap,tI=new WeakMap,C5e);function oL(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Vee(t){return{onFetch:(e,n)=>{var x,y,_,j,C;const s=e.options,a=(_=(y=(x=e.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:_.direction,o=((j=e.state.data)==null?void 0:j.pages)||[],l=((C=e.state.data)==null?void 0:C.pageParams)||[];let i={pages:[],pageParams:[]},h=0;const p=async()=>{let N=!1;const A=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(e.signal.aborted?N=!0:e.signal.addEventListener("abort",()=>{N=!0}),e.signal)})},E=oEe(e.options,e.fetchOptions),T=async(P,z,F)=>{if(N)return Promise.reject();if(z==null&&P.pages.length)return Promise.resolve(P);const V=(()=>{const ie={client:e.client,queryKey:e.queryKey,pageParam:z,direction:F?"backward":"forward",meta:e.options.meta};return A(ie),ie})(),K=await E(V),{maxPages:G}=e.options,te=F?uQe:dQe;return{pages:te(P.pages,K,G),pageParams:te(P.pageParams,z,G)}};if(a&&o.length){const P=a==="backward",z=P?mEe:_ue,F={pages:o,pageParams:l},q=z(s,F);i=await T(F,q,P)}else{const P=t??o.length;do{const z=h===0?l[0]??s.initialPageParam:_ue(s,i);if(h>0&&z==null)break;i=await T(i,z),h++}while(h{var N,A;return(A=(N=e.options).persister)==null?void 0:A.call(N,p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=p}}}function _ue(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 mEe(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}function wQe(t,e){return e?_ue(t,e)!=null:!1}function jQe(t,e){return!e||!t.getPreviousPageParam?!1:mEe(t,e)!=null}var Hl,z0,B0,qS,VS,$0,HS,WS,M5e,kQe=(M5e=class{constructor(t={}){ca(this,Hl);ca(this,z0);ca(this,B0);ca(this,qS);ca(this,VS);ca(this,$0);ca(this,HS);ca(this,WS);us(this,Hl,t.queryCache||new vQe),us(this,z0,t.mutationCache||new bQe),us(this,B0,t.defaultOptions||{}),us(this,qS,new Map),us(this,VS,new Map),us(this,$0,0)}mount(){z6(this,$0)._++,er(this,$0)===1&&(us(this,HS,ege.subscribe(async t=>{t&&(await this.resumePausedMutations(),er(this,Hl).onFocus())})),us(this,WS,qee.subscribe(async t=>{t&&(await this.resumePausedMutations(),er(this,Hl).onOnline())})))}unmount(){var t,e;z6(this,$0)._--,er(this,$0)===0&&((t=er(this,HS))==null||t.call(this),us(this,HS,void 0),(e=er(this,WS))==null||e.call(this),us(this,WS,void 0))}isFetching(t){return er(this,Hl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return er(this,z0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=er(this,Hl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=er(this,Hl).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(C1(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return er(this,Hl).findAll(t).map(({queryKey:e,state:n})=>{const s=n.data;return[e,s]})}setQueryData(t,e,n){const s=this.defaultQueryOptions({queryKey:t}),a=er(this,Hl).get(s.queryHash),o=a==null?void 0:a.state.data,l=lQe(e,o);if(l!==void 0)return er(this,Hl).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return Hc.batch(()=>er(this,Hl).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=er(this,Hl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=er(this,Hl);Hc.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=er(this,Hl);return Hc.batch(()=>(n.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},s=Hc.batch(()=>er(this,Hl).findAll(t).map(a=>a.cancel(n)));return Promise.all(s).then(Iu).catch(Iu)}invalidateQueries(t,e={}){return Hc.batch(()=>(er(this,Hl).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=Hc.batch(()=>er(this,Hl).findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,n);return n.throwOnError||(o=o.catch(Iu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(Iu)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=er(this,Hl).build(this,e);return n.isStaleByTime(C1(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Iu).catch(Iu)}fetchInfiniteQuery(t){return t.behavior=Vee(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Iu).catch(Iu)}ensureInfiniteQueryData(t){return t.behavior=Vee(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return qee.isOnline()?er(this,z0).resumePausedMutations():Promise.resolve()}getQueryCache(){return er(this,Hl)}getMutationCache(){return er(this,z0)}getDefaultOptions(){return er(this,B0)}setDefaultOptions(t){us(this,B0,t)}setQueryDefaults(t,e){er(this,qS).set(zj(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...er(this,qS).values()],n={};return e.forEach(s=>{KA(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){er(this,VS).set(zj(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...er(this,VS).values()],n={};return e.forEach(s=>{KA(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...er(this,B0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Qme(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===Jme&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...er(this,B0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){er(this,Hl).clear(),er(this,z0).clear()}},Hl=new WeakMap,z0=new WeakMap,B0=new WeakMap,qS=new WeakMap,VS=new WeakMap,$0=new WeakMap,HS=new WeakMap,WS=new WeakMap,M5e),ih,qi,rI,Au,nj,GS,U0,q0,nI,KS,ZS,sj,aj,V0,YS,go,aT,bue,wue,jue,kue,Nue,Sue,Cue,xEe,T5e,gEe=(T5e=class extends t3{constructor(e,n){super();ca(this,go);ca(this,ih);ca(this,qi);ca(this,rI);ca(this,Au);ca(this,nj);ca(this,GS);ca(this,U0);ca(this,q0);ca(this,nI);ca(this,KS);ca(this,ZS);ca(this,sj);ca(this,aj);ca(this,V0);ca(this,YS,new Set);this.options=n,us(this,ih,e),us(this,q0,null),us(this,U0,vue()),this.options.experimental_prefetchInRender||er(this,U0).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&&(er(this,qi).addObserver(this),uwe(er(this,qi),this.options)?oi(this,go,aT).call(this):this.updateResult(),oi(this,go,kue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Mue(er(this,qi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Mue(er(this,qi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,oi(this,go,Nue).call(this),oi(this,go,Sue).call(this),er(this,qi).removeObserver(this)}setOptions(e){const n=this.options,s=er(this,qi);if(this.options=er(this,ih).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rf(this.options.enabled,er(this,qi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");oi(this,go,Cue).call(this),er(this,qi).setOptions(this.options),n._defaulted&&!Uee(this.options,n)&&er(this,ih).getQueryCache().notify({type:"observerOptionsUpdated",query:er(this,qi),observer:this});const a=this.hasListeners();a&&hwe(er(this,qi),s,this.options,n)&&oi(this,go,aT).call(this),this.updateResult(),a&&(er(this,qi)!==s||Rf(this.options.enabled,er(this,qi))!==Rf(n.enabled,er(this,qi))||C1(this.options.staleTime,er(this,qi))!==C1(n.staleTime,er(this,qi)))&&oi(this,go,bue).call(this);const o=oi(this,go,wue).call(this);a&&(er(this,qi)!==s||Rf(this.options.enabled,er(this,qi))!==Rf(n.enabled,er(this,qi))||o!==er(this,V0))&&oi(this,go,jue).call(this,o)}getOptimisticResult(e){const n=er(this,ih).getQueryCache().build(er(this,ih),e),s=this.createResult(n,e);return SQe(this,s)&&(us(this,Au,s),us(this,GS,this.options),us(this,nj,er(this,qi).state)),s}getCurrentResult(){return er(this,Au)}trackResult(e,n){return new Proxy(e,{get:(s,a)=>(this.trackProp(a),n==null||n(a),Reflect.get(s,a))})}trackProp(e){er(this,YS).add(e)}getCurrentQuery(){return er(this,qi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=er(this,ih).defaultQueryOptions(e),s=er(this,ih).getQueryCache().build(er(this,ih),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(e){return oi(this,go,aT).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),er(this,Au)))}createResult(e,n){var G;const s=er(this,qi),a=this.options,o=er(this,Au),l=er(this,nj),i=er(this,GS),p=e!==s?e.state:er(this,rI),{state:x}=e;let y={...x},_=!1,j;if(n._optimisticResults){const te=this.hasListeners(),ie=!te&&uwe(e,n),oe=te&&hwe(e,s,n,a);(ie||oe)&&(y={...y,...fEe(x.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:C,errorUpdatedAt:N,status:A}=y;j=y.data;let E=!1;if(n.placeholderData!==void 0&&j===void 0&&A==="pending"){let te;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(te=o.data,E=!0):te=typeof n.placeholderData=="function"?n.placeholderData((G=er(this,ZS))==null?void 0:G.state.data,er(this,ZS)):n.placeholderData,te!==void 0&&(A="success",j=yue(o==null?void 0:o.data,te,n),_=!0)}if(n.select&&j!==void 0&&!E)if(o&&j===(l==null?void 0:l.data)&&n.select===er(this,nI))j=er(this,KS);else try{us(this,nI,n.select),j=n.select(j),j=yue(o==null?void 0:o.data,j,n),us(this,KS,j),us(this,q0,null)}catch(te){us(this,q0,te)}er(this,q0)&&(C=er(this,q0),j=er(this,KS),N=Date.now(),A="error");const T=y.fetchStatus==="fetching",P=A==="pending",z=A==="error",F=P&&T,q=j!==void 0,K={status:A,fetchStatus:y.fetchStatus,isPending:P,isSuccess:A==="success",isError:z,isInitialLoading:F,isLoading:F,data:j,dataUpdatedAt:y.dataUpdatedAt,error:C,errorUpdatedAt:N,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:T,isRefetching:T&&!P,isLoadingError:z&&!q,isPaused:y.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:z&&q,isStale:tge(e,n),refetch:this.refetch,promise:er(this,U0),isEnabled:Rf(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const te=ye=>{K.status==="error"?ye.reject(K.error):K.data!==void 0&&ye.resolve(K.data)},ie=()=>{const ye=us(this,U0,K.promise=vue());te(ye)},oe=er(this,U0);switch(oe.status){case"pending":e.queryHash===s.queryHash&&te(oe);break;case"fulfilled":(K.status==="error"||K.data!==oe.value)&&ie();break;case"rejected":(K.status!=="error"||K.error!==oe.reason)&&ie();break}}return K}updateResult(){const e=er(this,Au),n=this.createResult(er(this,qi),this.options);if(us(this,nj,er(this,qi).state),us(this,GS,this.options),er(this,nj).data!==void 0&&us(this,ZS,er(this,qi)),Uee(n,e))return;us(this,Au,n);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!er(this,YS).size)return!0;const l=new Set(o??er(this,YS));return this.options.throwOnError&&l.add("error"),Object.keys(er(this,Au)).some(i=>{const h=i;return er(this,Au)[h]!==e[h]&&l.has(h)})};oi(this,go,xEe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&oi(this,go,kue).call(this)}},ih=new WeakMap,qi=new WeakMap,rI=new WeakMap,Au=new WeakMap,nj=new WeakMap,GS=new WeakMap,U0=new WeakMap,q0=new WeakMap,nI=new WeakMap,KS=new WeakMap,ZS=new WeakMap,sj=new WeakMap,aj=new WeakMap,V0=new WeakMap,YS=new WeakMap,go=new WeakSet,aT=function(e){oi(this,go,Cue).call(this);let n=er(this,qi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Iu)),n},bue=function(){oi(this,go,Nue).call(this);const e=C1(this.options.staleTime,er(this,qi));if(Fj||er(this,Au).isStale||!gue(e))return;const s=aEe(er(this,Au).dataUpdatedAt,e)+1;us(this,sj,setTimeout(()=>{er(this,Au).isStale||this.updateResult()},s))},wue=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(er(this,qi)):this.options.refetchInterval)??!1},jue=function(e){oi(this,go,Sue).call(this),us(this,V0,e),!(Fj||Rf(this.options.enabled,er(this,qi))===!1||!gue(er(this,V0))||er(this,V0)===0)&&us(this,aj,setInterval(()=>{(this.options.refetchIntervalInBackground||ege.isFocused())&&oi(this,go,aT).call(this)},er(this,V0)))},kue=function(){oi(this,go,bue).call(this),oi(this,go,jue).call(this,oi(this,go,wue).call(this))},Nue=function(){er(this,sj)&&(clearTimeout(er(this,sj)),us(this,sj,void 0))},Sue=function(){er(this,aj)&&(clearInterval(er(this,aj)),us(this,aj,void 0))},Cue=function(){const e=er(this,ih).getQueryCache().build(er(this,ih),this.options);if(e===er(this,qi))return;const n=er(this,qi);us(this,qi,e),us(this,rI,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},xEe=function(e){Hc.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(er(this,Au))}),er(this,ih).getQueryCache().notify({query:er(this,qi),type:"observerResultsUpdated"})})},T5e);function NQe(t,e){return Rf(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function uwe(t,e){return NQe(t,e)||t.state.data!==void 0&&Mue(t,e,e.refetchOnMount)}function Mue(t,e,n){if(Rf(e.enabled,t)!==!1&&C1(e.staleTime,t)!=="static"){const s=typeof n=="function"?n(t):n;return s==="always"||s!==!1&&tge(t,e)}return!1}function hwe(t,e,n,s){return(t!==e||Rf(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&tge(t,n)}function tge(t,e){return Rf(e.enabled,t)!==!1&&t.isStaleByTime(C1(e.staleTime,t))}function SQe(t,e){return!Uee(t.getCurrentResult(),e)}var CQe=class extends gEe{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Vee()})}getOptimisticResult(t){return t.behavior=Vee(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var C,N;const{state:n}=t,s=super.createResult(t,e),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=s,h=(N=(C=n.fetchMeta)==null?void 0:C.fetchMore)==null?void 0:N.direction,p=l&&h==="forward",x=a&&h==="forward",y=l&&h==="backward",_=a&&h==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:wQe(e,n.data),hasPreviousPage:jQe(e,n.data),isFetchNextPageError:p,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:_,isRefetchError:i&&!p&&!y,isRefetching:o&&!x&&!_}}},H0,W0,oh,Ax,ty,QJ,Tue,A5e,MQe=(A5e=class extends t3{constructor(n,s){super();ca(this,ty);ca(this,H0);ca(this,W0);ca(this,oh);ca(this,Ax);us(this,H0,n),this.setOptions(s),this.bindMethods(),oi(this,ty,QJ).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const s=this.options;this.options=er(this,H0).defaultMutationOptions(n),Uee(this.options,s)||er(this,H0).getMutationCache().notify({type:"observerOptionsUpdated",mutation:er(this,oh),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&zj(s.mutationKey)!==zj(this.options.mutationKey)?this.reset():((a=er(this,oh))==null?void 0:a.state.status)==="pending"&&er(this,oh).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=er(this,oh))==null||n.removeObserver(this)}onMutationUpdate(n){oi(this,ty,QJ).call(this),oi(this,ty,Tue).call(this,n)}getCurrentResult(){return er(this,W0)}reset(){var n;(n=er(this,oh))==null||n.removeObserver(this),us(this,oh,void 0),oi(this,ty,QJ).call(this),oi(this,ty,Tue).call(this)}mutate(n,s){var a;return us(this,Ax,s),(a=er(this,oh))==null||a.removeObserver(this),us(this,oh,er(this,H0).getMutationCache().build(er(this,H0),this.options)),er(this,oh).addObserver(this),er(this,oh).execute(n)}},H0=new WeakMap,W0=new WeakMap,oh=new WeakMap,Ax=new WeakMap,ty=new WeakSet,QJ=function(){var s;const n=((s=er(this,oh))==null?void 0:s.state)??pEe();us(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})},Tue=function(n){Hc.batch(()=>{var s,a,o,l,i,h,p,x;if(er(this,Ax)&&this.hasListeners()){const y=er(this,W0).variables,_=er(this,W0).context;(n==null?void 0:n.type)==="success"?((a=(s=er(this,Ax)).onSuccess)==null||a.call(s,n.data,y,_),(l=(o=er(this,Ax)).onSettled)==null||l.call(o,n.data,null,y,_)):(n==null?void 0:n.type)==="error"&&((h=(i=er(this,Ax)).onError)==null||h.call(i,n.error,y,_),(x=(p=er(this,Ax)).onSettled)==null||x.call(p,void 0,n.error,y,_))}this.listeners.forEach(y=>{y(er(this,W0))})})},A5e),yEe=I.createContext(void 0),Vr=t=>{const e=I.useContext(yEe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},TQe=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),r.jsx(yEe.Provider,{value:t,children:e})),vEe=I.createContext(!1),AQe=()=>I.useContext(vEe);vEe.Provider;function EQe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var IQe=I.createContext(EQe()),PQe=()=>I.useContext(IQe),LQe=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},OQe=t=>{I.useEffect(()=>{t.clearReset()},[t])},DQe=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(a&&t.data===void 0||lEe(n,[t.error,s])),RQe=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,zQe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,fwe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function _Ee(t,e,n){var y,_,j,C,N;const s=AQe(),a=PQe(),o=Vr(),l=o.defaultQueryOptions(t);(_=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||_.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",RQe(l),LQe(l,a),OQe(a);const i=!o.getQueryCache().get(l.queryHash),[h]=I.useState(()=>new e(o,l)),p=h.getOptimisticResult(l),x=!s&&t.subscribed!==!1;if(I.useSyncExternalStore(I.useCallback(A=>{const E=x?h.subscribe(Hc.batchCalls(A)):Iu;return h.updateResult(),E},[h,x]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),I.useEffect(()=>{h.setOptions(l)},[l,h]),zQe(l,p))throw fwe(l,h,a);if(DQe({result:p,errorResetBoundary:a,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw p.error;if((C=(j=o.getDefaultOptions().queries)==null?void 0:j._experimental_afterQuery)==null||C.call(j,l,p),l.experimental_prefetchInRender&&!Fj&&FQe(p,s)){const A=i?fwe(l,h,a):(N=o.getQueryCache().get(l.queryHash))==null?void 0:N.promise;A==null||A.catch(Iu).finally(()=>{h.updateResult()})}return l.notifyOnChangeProps?p:h.trackResult(p)}function Yt(t,e){return _Ee(t,gEe)}function cr(t,e){const n=Vr(),[s]=I.useState(()=>new MQe(n,t));I.useEffect(()=>{s.setOptions(t)},[s,t]);const a=I.useSyncExternalStore(I.useCallback(l=>s.subscribe(Hc.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=I.useCallback((l,i)=>{s.mutate(l,i).catch(Iu)},[s]);if(a.error&&lEe(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function BQe(t,e){return _Ee(t,CQe)}/** * @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 ZA(){return ZA=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function bEe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function UQe(){return Math.random().toString(36).substr(2,8)}function mwe(t,e){return{usr:t.state,key:t.key,idx:e}}function Aue(t,e,n,s){return n===void 0&&(n=null),ZA({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?r3(e):e,{state:n,key:e&&e.key||s||UQe()})}function Hee(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 r3(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 qQe(t,e,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:o=!1}=s,l=a.history,i=Y0.Pop,h=null,p=x();p==null&&(p=0,l.replaceState(ZA({},l.state,{idx:p}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=Y0.Pop;let A=x(),E=A==null?null:A-p;p=A,h&&h({action:i,location:N.location,delta:E})}function _(A,E){i=Y0.Push;let T=Aue(N.location,A,E);p=x()+1;let P=mwe(T,p),z=N.createHref(T);try{l.pushState(P,"",z)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;a.location.assign(z)}o&&h&&h({action:i,location:N.location,delta:1})}function j(A,E){i=Y0.Replace;let T=Aue(N.location,A,E);p=x();let P=mwe(T,p),z=N.createHref(T);l.replaceState(P,"",z),o&&h&&h({action:i,location:N.location,delta:0})}function C(A){let E=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof A=="string"?A:Hee(A);return T=T.replace(/ $/,"%20"),mc(E,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,E)}let N={get action(){return i},get location(){return t(a,l)},listen(A){if(h)throw new Error("A history only accepts one active listener");return a.addEventListener(pwe,y),h=A,()=>{a.removeEventListener(pwe,y),h=null}},createHref(A){return e(a,A)},createURL:C,encodeLocation(A){let E=C(A);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:_,replace:j,go(A){return l.go(A)}};return N}var gwe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(gwe||(gwe={}));function VQe(t,e,n){return n===void 0&&(n="/"),HQe(t,e,n)}function HQe(t,e,n,s){let a=typeof e=="string"?r3(e):e,o=rge(a.pathname||"/",n);if(o==null)return null;let l=wEe(t);WQe(l);let i=null;for(let h=0;i==null&&h{let h={relativePath:i===void 0?o.path||"":i,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};h.relativePath.startsWith("/")&&(mc(h.relativePath.startsWith(s),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(s.length));let p=M1([s,h.relativePath]),x=n.concat(h);o.children&&o.children.length>0&&(mc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),wEe(o.children,e,x,p)),!(o.path==null&&!o.index)&&e.push({path:p,score:JQe(p,o.index),routesMeta:x})};return t.forEach((o,l)=>{var i;if(o.path===""||!((i=o.path)!=null&&i.includes("?")))a(o,l);else for(let h of jEe(o.path))a(o,l,h)}),e}function jEe(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return a?[o,""]:[o];let l=jEe(s.join("/")),i=[];return i.push(...l.map(h=>h===""?o:[o,h].join("/"))),a&&i.push(...l),i.map(h=>t.startsWith("/")&&h===""?"/":h)}function WQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:eJe(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const GQe=/^:[\w-]+$/,KQe=3,ZQe=2,YQe=1,XQe=10,QQe=-2,xwe=t=>t==="*";function JQe(t,e){let n=t.split("/"),s=n.length;return n.some(xwe)&&(s+=QQe),e&&(s+=ZQe),n.filter(a=>!xwe(a)).reduce((a,o)=>a+(GQe.test(o)?KQe:o===""?YQe:XQe),s)}function eJe(t,e){return t.length===e.length&&t.slice(0,-1).every((s,a)=>s===e[a])?t[t.length-1]-e[e.length-1]:0}function tJe(t,e,n){let{routesMeta:s}=t,a={},o="/",l=[];for(let i=0;i{let{paramName:_,isOptional:j}=x;if(_==="*"){let N=i[y]||"";l=o.slice(0,o.length-N.length).replace(/(.)\/+$/,"$1")}const C=i[y];return j&&!C?p[_]=void 0:p[_]=(C||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:t}}function nJe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),bEe(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=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,i,h)=>(s.push({paramName:i,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),s]}function sJe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return bEe(!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 rge(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 aJe(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:a=""}=typeof t=="string"?r3(t):t;return{pathname:n?n.startsWith("/")?n:iJe(n,e):e,search:cJe(s),hash:dJe(a)}}function iJe(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function vle(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 oJe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function nge(t,e){let n=oJe(t);return e?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function sge(t,e,n,s){s===void 0&&(s=!1);let a;typeof t=="string"?a=r3(t):(a=ZA({},t),mc(!a.pathname||!a.pathname.includes("?"),vle("?","pathname","search",a)),mc(!a.pathname||!a.pathname.includes("#"),vle("#","pathname","hash",a)),mc(!a.search||!a.search.includes("#"),vle("#","search","hash",a)));let o=t===""||a.pathname==="",l=o?"/":a.pathname,i;if(l==null)i=n;else{let y=e.length-1;if(!s&&l.startsWith("..")){let _=l.split("/");for(;_[0]==="..";)_.shift(),y-=1;a.pathname=_.join("/")}i=y>=0?e[y]:"/"}let h=aJe(a,i),p=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||x)&&(h.pathname+="/"),h}const M1=t=>t.join("/").replace(/\/\/+/g,"/"),lJe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),cJe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,dJe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function uJe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const kEe=["post","put","patch","delete"];new Set(kEe);const hJe=["get",...kEe];new Set(hJe);/** * 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 YA(){return YA=Object.assign?Object.assign.bind():function(t){for(var e=1;e{i.current=!0}),I.useCallback(function(p,x){if(x===void 0&&(x={}),!i.current)return;if(typeof p=="number"){s.go(p);return}let y=sge(p,JSON.parse(l),o,x.relative==="path");t==null&&e!=="/"&&(y.pathname=y.pathname==="/"?e:M1([e,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[e,s,l,o,t])}const gJe=I.createContext(null);function xJe(t){let e=I.useContext($g).outlet;return e&&I.createElement(gJe.Provider,{value:t},e)}function Yc(){let{matches:t}=I.useContext($g),e=t[t.length-1];return e?e.params:{}}function CEe(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=I.useContext(nv),{matches:a}=I.useContext($g),{pathname:o}=Nm(),l=JSON.stringify(nge(a,s.v7_relativeSplatPath));return I.useMemo(()=>sge(t,JSON.parse(l),o,n==="path"),[t,l,o,n])}function yJe(t,e){return vJe(t,e)}function vJe(t,e,n,s){n3()||mc(!1);let{navigator:a}=I.useContext(nv),{matches:o}=I.useContext($g),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let h=l?l.pathnameBase:"/";l&&l.route;let p=Nm(),x;if(e){var y;let A=typeof e=="string"?r3(e):e;h==="/"||(y=A.pathname)!=null&&y.startsWith(h)||mc(!1),x=A}else x=p;let _=x.pathname||"/",j=_;if(h!=="/"){let A=h.replace(/^\//,"").split("/");j="/"+_.replace(/^\//,"").split("/").slice(A.length).join("/")}let C=VQe(t,{pathname:j}),N=kJe(C&&C.map(A=>Object.assign({},A,{params:Object.assign({},i,A.params),pathname:M1([h,a.encodeLocation?a.encodeLocation(A.pathname).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?h:M1([h,a.encodeLocation?a.encodeLocation(A.pathnameBase).pathname:A.pathnameBase])})),o,n,s);return e&&N?I.createElement(Pne.Provider,{value:{location:YA({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:Y0.Pop}},N):N}function _Je(){let t=MJe(),e=uJe(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return I.createElement(I.Fragment,null,I.createElement("h2",null,"Unexpected Application Error!"),I.createElement("h3",{style:{fontStyle:"italic"}},e),n?I.createElement("pre",{style:a},n):null,null)}const bJe=I.createElement(_Je,null);class wJe extends I.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?I.createElement($g.Provider,{value:this.props.routeContext},I.createElement(NEe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function jJe(t){let{routeContext:e,match:n,children:s}=t,a=I.useContext(age);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),I.createElement($g.Provider,{value:e},s)}function kJe(t,e,n,s){var a;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 l=t,i=(a=n)==null?void 0:a.errors;if(i!=null){let x=l.findIndex(y=>y.route.id&&(i==null?void 0:i[y.route.id])!==void 0);x>=0||mc(!1),l=l.slice(0,Math.min(l.length,x+1))}let h=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((x,y,_)=>{let j,C=!1,N=null,A=null;n&&(j=i&&y.route.id?i[y.route.id]:void 0,N=y.route.errorElement||bJe,h&&(p<0&&_===0?(AJe("route-fallback"),C=!0,A=null):p===_&&(C=!0,A=y.route.hydrateFallbackElement||null)));let E=e.concat(l.slice(0,_+1)),T=()=>{let P;return j?P=N:C?P=A:y.route.Component?P=I.createElement(y.route.Component,null):y.route.element?P=y.route.element:P=x,I.createElement(jJe,{match:y,routeContext:{outlet:x,matches:E,isDataRoute:n!=null},children:P})};return n&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?I.createElement(wJe,{location:n.location,revalidation:n.revalidation,component:N,error:j,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):T()},null)}var MEe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(MEe||{}),TEe=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}(TEe||{});function NJe(t){let e=I.useContext(age);return e||mc(!1),e}function SJe(t){let e=I.useContext(fJe);return e||mc(!1),e}function CJe(t){let e=I.useContext($g);return e||mc(!1),e}function AEe(t){let e=CJe(),n=e.matches[e.matches.length-1];return n.route.id||mc(!1),n.route.id}function MJe(){var t;let e=I.useContext(NEe),n=SJe(),s=AEe();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function TJe(){let{router:t}=NJe(MEe.UseNavigateStable),e=AEe(TEe.UseNavigateStable),n=I.useRef(!1);return SEe(()=>{n.current=!0}),I.useCallback(function(a,o){o===void 0&&(o={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,YA({fromRouteId:e},o)))},[t,e])}const ywe={};function AJe(t,e,n){ywe[t]||(ywe[t]=!0)}function EJe(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function _le(t){let{to:e,replace:n,state:s,relative:a}=t;n3()||mc(!1);let{future:o,static:l}=I.useContext(nv),{matches:i}=I.useContext($g),{pathname:h}=Nm(),p=Zn(),x=sge(e,nge(i,o.v7_relativeSplatPath),h,a==="path"),y=JSON.stringify(x);return I.useEffect(()=>p(JSON.parse(y),{replace:n,state:s,relative:a}),[p,y,a,n,s]),null}function IJe(t){return xJe(t.context)}function an(t){mc(!1)}function PJe(t){let{basename:e="/",children:n=null,location:s,navigationType:a=Y0.Pop,navigator:o,static:l=!1,future:i}=t;n3()&&mc(!1);let h=e.replace(/^\/*/,"/"),p=I.useMemo(()=>({basename:h,navigator:o,static:l,future:YA({v7_relativeSplatPath:!1},i)}),[h,i,o,l]);typeof s=="string"&&(s=r3(s));let{pathname:x="/",search:y="",hash:_="",state:j=null,key:C="default"}=s,N=I.useMemo(()=>{let A=rge(x,h);return A==null?null:{location:{pathname:A,search:y,hash:_,state:j,key:C},navigationType:a}},[h,x,y,_,j,C,a]);return N==null?null:I.createElement(nv.Provider,{value:p},I.createElement(Pne.Provider,{children:n,value:N}))}function LJe(t){let{children:e,location:n}=t;return yJe(Eue(e),n)}new Promise(()=>{});function Eue(t,e){e===void 0&&(e=[]);let n=[];return I.Children.forEach(t,(s,a)=>{if(!I.isValidElement(s))return;let o=[...e,a];if(s.type===I.Fragment){n.push.apply(n,Eue(s.props.children,o));return}s.type!==an&&mc(!1),!s.props.index||!s.props.children||mc(!1);let l={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&&(l.children=Eue(s.props.children,o)),n.push(l)}),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 Iue(){return Iue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function DJe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function RJe(t,e){return t.button===0&&(!e||e==="_self")&&!DJe(t)}function Pue(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(a=>[n,a]):[[n,s]])},[]))}function FJe(t,e){let n=Pue(t);return e&&e.forEach((s,a)=>{n.has(a)||e.getAll(a).forEach(o=>{n.append(a,o)})}),n}const zJe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],BJe="6";try{window.__reactRouterVersion=BJe}catch{}const $Je="startTransition",vwe=Vpe[$Je];function UJe(t){let{basename:e,children:n,future:s,window:a}=t,o=I.useRef();o.current==null&&(o.current=$Qe({window:a,v5Compat:!0}));let l=o.current,[i,h]=I.useState({action:l.action,location:l.location}),{v7_startTransition:p}=s||{},x=I.useCallback(y=>{p&&vwe?vwe(()=>h(y)):h(y)},[h,p]);return I.useLayoutEffect(()=>l.listen(x),[l,x]),I.useEffect(()=>EJe(s),[s]),I.createElement(PJe,{basename:e,children:n,location:i.location,navigationType:i.action,navigator:l,future:s})}const qJe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",VJe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,co=I.forwardRef(function(e,n){let{onClick:s,relative:a,reloadDocument:o,replace:l,state:i,target:h,to:p,preventScrollReset:x,viewTransition:y}=e,_=OJe(e,zJe),{basename:j}=I.useContext(nv),C,N=!1;if(typeof p=="string"&&VJe.test(p)&&(C=p,qJe))try{let P=new URL(window.location.href),z=p.startsWith("//")?new URL(P.protocol+p):new URL(p),F=rge(z.pathname,j);z.origin===P.origin&&F!=null?p=F+z.search+z.hash:N=!0}catch{}let A=pJe(p,{relative:a}),E=HJe(p,{replace:l,state:i,target:h,preventScrollReset:x,relative:a,viewTransition:y});function T(P){s&&s(P),P.defaultPrevented||E(P)}return I.createElement("a",Iue({},_,{href:C||A,onClick:N||o?s:T,ref:n,target:h}))});var _we;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(_we||(_we={}));var bwe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(bwe||(bwe={}));function HJe(t,e){let{target:n,replace:s,state:a,preventScrollReset:o,relative:l,viewTransition:i}=e===void 0?{}:e,h=Zn(),p=Nm(),x=CEe(t,{relative:l});return I.useCallback(y=>{if(RJe(y,n)){y.preventDefault();let _=s!==void 0?s:Hee(p)===Hee(x);h(t,{replace:_,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[p,h,x,s,a,n,t,o,l,i])}function qd(t){let e=I.useRef(Pue(t)),n=I.useRef(!1),s=Nm(),a=I.useMemo(()=>FJe(s.search,n.current?null:e.current),[s.search]),o=Zn(),l=I.useCallback((i,h)=>{const p=Pue(typeof i=="function"?i(a):i);n.current=!0,o("?"+p,h)},[o,a]);return[a,l]}var WJe=typeof Element<"u",GJe=typeof Map=="function",KJe=typeof Set=="function",ZJe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function JJ(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,a;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(s=n;s--!==0;)if(!JJ(t[s],e[s]))return!1;return!0}var o;if(GJe&&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(!JJ(s.value[1],e.get(s.value[0])))return!1;return!0}if(KJe&&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(ZJe&&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(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,a[s]))return!1;if(WJe&&t instanceof Element)return!1;for(s=n;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&t.$$typeof)&&!JJ(t[a[s]],e[a[s]]))return!1;return!0}return t!==t&&e!==e}var YJe=function(e,n){try{return JJ(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 XJe=Hi(YJe);var QJe=function(t,e,n,s,a,o,l,i){if(!t){var h;if(e===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,s,a,o,l,i],x=0;h=new Error(e.replace(/%s/g,function(){return p[x++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}},JJe=QJe;const wwe=Hi(JJe);var eet=function(e,n,s,a){var o=s?s.call(a,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 l=Object.keys(e),i=Object.keys(n);if(l.length!==i.length)return!1;for(var h=Object.prototype.hasOwnProperty.bind(n),p=0;p(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))(EEe||{}),ble={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"]}},jwe=Object.values(EEe),ige={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},ret=Object.entries(ige).reduce((t,[e,n])=>(t[n]=e,t),{}),cm="data-rh",wS={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},jS=(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},net=t=>{let e=jS(t,"title");const n=jS(t,wS.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const s=jS(t,wS.DEFAULT_TITLE);return e||s||void 0},set=t=>jS(t,wS.ON_CHANGE_CLIENT_STATE)||(()=>{}),wle=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,s)=>({...n,...s}),{}),aet=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,s)=>{if(!n.length){const a=Object.keys(s);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(t),EM=(t,e,n)=>{const s={};return n.filter(a=>Array.isArray(a[t])?!0:(typeof a[t]<"u"&&iet(`Helmet: ${t} should be of type "Array". Instead found type "${typeof a[t]}"`),!1)).map(a=>a[t]).reverse().reduce((a,o)=>{const l={};o.filter(h=>{let p;const x=Object.keys(h);for(let _=0;_a.push(h));const i=Object.keys(l);for(let h=0;h{if(Array.isArray(t)&&t.length){for(let n=0;n({baseTag:aet(["href"],t),bodyAttributes:wle("bodyAttributes",t),defer:jS(t,wS.DEFER),encode:jS(t,wS.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:wle("htmlAttributes",t),linkTags:EM("link",["rel","href"],t),metaTags:EM("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:EM("noscript",["innerHTML"],t),onChangeClientState:set(t),scriptTags:EM("script",["src","innerHTML"],t),styleTags:EM("style",["cssText"],t),title:net(t),titleAttributes:wle("titleAttributes",t),prioritizeSeoTags:oet(t,wS.PRIORITIZE_SEO_TAGS)}),IEe=t=>Array.isArray(t)?t.join(""):t,det=(t,e)=>{const n=Object.keys(t);for(let s=0;sArray.isArray(t)?t.reduce((n,s)=>(det(s,e)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:t,priority:[]},kwe=(t,e)=>({...t,[e]:void 0}),uet=["noscript","script","style"],Lue=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),PEe=t=>Object.keys(t).reduce((e,n)=>{const s=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${s}`:s},""),het=(t,e,n,s)=>{const a=PEe(n),o=IEe(e);return a?`<${t} ${cm}="true" ${a}>${Lue(o,s)}`:`<${t} ${cm}="true">${Lue(o,s)}`},fet=(t,e,n=!0)=>e.reduce((s,a)=>{const o=a,l=Object.keys(o).filter(p=>!(p==="innerHTML"||p==="cssText")).reduce((p,x)=>{const y=typeof o[x]>"u"?x:`${x}="${Lue(o[x],n)}"`;return p?`${p} ${y}`:y},""),i=o.innerHTML||o.cssText||"",h=uet.indexOf(t)===-1;return`${s}<${t} ${cm}="true" ${l}${h?"/>":`>${i}`}`},""),LEe=(t,e={})=>Object.keys(t).reduce((n,s)=>{const a=ige[s];return n[a||s]=t[s],n},e),pet=(t,e,n)=>{const s={key:e,[cm]:!0},a=LEe(n,s);return[st.createElement("title",a,e)]},eee=(t,e)=>e.map((n,s)=>{const a={key:s,[cm]:!0};return Object.keys(n).forEach(o=>{const i=ige[o]||o;if(i==="innerHTML"||i==="cssText"){const h=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:h}}else a[i]=n[o]}),st.createElement(t,a)}),Of=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>pet(t,e.title,e.titleAttributes),toString:()=>het(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>LEe(e),toString:()=>PEe(e)};default:return{toComponent:()=>eee(t,e),toString:()=>fet(t,e,n)}}},met=({metaTags:t,linkTags:e,scriptTags:n,encode:s})=>{const a=jle(t,ble.meta),o=jle(e,ble.link),l=jle(n,ble.script);return{priorityMethods:{toComponent:()=>[...eee("meta",a.priority),...eee("link",o.priority),...eee("script",l.priority)],toString:()=>`${Of("meta",a.priority,s)} ${Of("link",o.priority,s)} ${Of("script",l.priority,s)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},get=t=>{const{baseTag:e,bodyAttributes:n,encode:s=!0,htmlAttributes:a,noscriptTags:o,styleTags:l,title:i="",titleAttributes:h,prioritizeSeoTags:p}=t;let{linkTags:x,metaTags:y,scriptTags:_}=t,j={toComponent:()=>{},toString:()=>""};return p&&({priorityMethods:j,linkTags:x,metaTags:y,scriptTags:_}=met(t)),{priority:j,base:Of("base",e,s),bodyAttributes:Of("bodyAttributes",n,s),htmlAttributes:Of("htmlAttributes",a,s),link:Of("link",x,s),meta:Of("meta",y,s),noscript:Of("noscript",o,s),script:Of("script",_,s),style:Of("style",l,s),title:Of("title",{title:i,titleAttributes:h},s)}},Oue=get,lL=[],OEe=!!(typeof window<"u"&&window.document&&window.document.createElement),Due=class{constructor(t,e){Gn(this,"instances",[]);Gn(this,"canUseDOM",OEe);Gn(this,"context");Gn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?lL:this.instances,add:t=>{(this.canUseDOM?lL:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?lL:this.instances).indexOf(t);(this.canUseDOM?lL:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=Oue({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},xet={},DEe=st.createContext(xet),ij,REe=(ij=class extends I.Component{constructor(n){super(n);Gn(this,"helmetData");this.helmetData=new Due(this.props.context||{},ij.canUseDOM)}render(){return st.createElement(DEe.Provider,{value:this.helmetData.value},this.props.children)}},Gn(ij,"canUseDOM",OEe),ij),YN=(t,e)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${t}[${cm}]`),a=[].slice.call(s),o=[];let l;return e&&e.length&&e.forEach(i=>{const h=document.createElement(t);for(const p in i)if(Object.prototype.hasOwnProperty.call(i,p))if(p==="innerHTML")h.innerHTML=i.innerHTML;else if(p==="cssText")h.styleSheet?h.styleSheet.cssText=i.cssText:h.appendChild(document.createTextNode(i.cssText));else{const x=p,y=typeof i[x]>"u"?"":i[x];h.setAttribute(p,y)}h.setAttribute(cm,"true"),a.some((p,x)=>(l=x,h.isEqualNode(p)))?a.splice(l,1):o.push(h)}),a.forEach(i=>{var h;return(h=i.parentNode)==null?void 0:h.removeChild(i)}),o.forEach(i=>n.appendChild(i)),{oldTags:a,newTags:o}},Rue=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const s=n.getAttribute(cm),a=s?s.split(","):[],o=[...a],l=Object.keys(e);for(const i of l){const h=e[i]||"";n.getAttribute(i)!==h&&n.setAttribute(i,h),a.indexOf(i)===-1&&a.push(i);const p=o.indexOf(i);p!==-1&&o.splice(p,1)}for(let i=o.length-1;i>=0;i-=1)n.removeAttribute(o[i]);a.length===o.length?n.removeAttribute(cm):n.getAttribute(cm)!==l.join(",")&&n.setAttribute(cm,l.join(","))},yet=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=IEe(t)),Rue("title",e)},Nwe=(t,e)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:h,scriptTags:p,styleTags:x,title:y,titleAttributes:_}=t;Rue("body",s),Rue("html",a),yet(y,_);const j={baseTag:YN("base",n),linkTags:YN("link",o),metaTags:YN("meta",l),noscriptTags:YN("noscript",i),scriptTags:YN("script",p),styleTags:YN("style",x)},C={},N={};Object.keys(j).forEach(A=>{const{newTags:E,oldTags:T}=j[A];E.length&&(C[A]=E),T.length&&(N[A]=j[A].oldTags)}),e&&e(),h(t,C,N)},IM=null,vet=t=>{IM&&cancelAnimationFrame(IM),t.defer?IM=requestAnimationFrame(()=>{Nwe(t,()=>{IM=null})}):(Nwe(t),IM=null)},_et=vet,Swe=class extends I.Component{constructor(){super(...arguments);Gn(this,"rendered",!1)}shouldComponentUpdate(e){return!tet(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 a=cet(e.get().map(o=>{const l={...o.props};return delete l.context,l}));REe.canUseDOM?_et(a):Oue&&(s=Oue(a)),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}},hde,Sm=(hde=class extends I.Component{shouldComponentUpdate(t){return!XJe(kwe(this.props,"helmetData"),kwe(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 wwe(jwe.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 ${jwe.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),wwe(!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 st.Children.forEach(t,s=>{if(!s||!s.props)return;const{children:a,...o}=s.props,l=Object.keys(o).reduce((h,p)=>(h[ret[p]||p]=o[p],h),{});let{type:i}=s;switch(typeof i=="symbol"?i=i.toString():this.warnOnInvalidChildren(s,a),i){case"Symbol(react.fragment)":e=this.mapChildrenToProps(a,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,l,a);break;default:e=this.mapObjectTypeChildren(s,e,l,a);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 Due)){const a=s;s=new Due(a.context,!0),delete n.helmetData}return s?st.createElement(Swe,{...n,context:s.value}):st.createElement(DEe.Consumer,null,a=>st.createElement(Swe,{...n,context:a}))}},Gn(hde,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),hde),Fue=function(t,e){return Fue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},Fue(t,e)};function FEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Fue(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Uf=function(){return Uf=Object.assign||function(e){for(var n,s=1,a=arguments.length;s=0;i--)(l=t[i])&&(o=(a<3?l(o):a>3?l(e,n,o):l(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}function BEe(t,e){return function(n,s){e(n,s,t)}}function $Ee(t,e,n,s,a,o){function l(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var i=s.kind,h=i==="getter"?"get":i==="setter"?"set":"value",p=!e&&t?s.static?t:t.prototype:null,x=e||(p?Object.getOwnPropertyDescriptor(p,s.name):{}),y,_=!1,j=n.length-1;j>=0;j--){var C={};for(var N in s)C[N]=N==="access"?{}:s[N];for(var N in s.access)C.access[N]=s.access[N];C.addInitializer=function(E){if(_)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(E||null))};var A=(0,n[j])(i==="accessor"?{get:x.get,set:x.set}:x[h],C);if(i==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(y=l(A.get))&&(x.get=y),(y=l(A.set))&&(x.set=y),(y=l(A.init))&&a.unshift(y)}else(y=l(A))&&(i==="field"?a.unshift(y):x[h]=y)}p&&Object.defineProperty(p,s.name,x),_=!0}function UEe(t,e,n){for(var s=arguments.length>2,a=0;a0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[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 oge(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),a,o=[],l;try{for(;(e===void 0||e-- >0)&&!(a=s.next()).done;)o.push(a.value)}catch(i){l={error:i}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(l)throw l.error}}return o}function KEe(){for(var t=[],e=0;e1||h(j,N)})},C&&(a[j]=C(a[j])))}function h(j,C){try{p(s[j](C))}catch(N){_(o[0][3],N)}}function p(j){j.value instanceof iC?Promise.resolve(j.value.v).then(x,y):_(o[0][2],j)}function x(j){h("next",j)}function y(j){h("throw",j)}function _(j,C){j(C),o.shift(),o.length&&h(o[0][0],o[0][1])}}function XEe(t){var e,n;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,o){e[a]=t[a]?function(l){return(n=!n)?{value:iC(t[a](l)),done:!1}:o?o(l):l}:o}}function QEe(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 Wee=="function"?Wee(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(l){return new Promise(function(i,h){l=t[o](l),a(i,h,l.done,l.value)})}}function a(o,l,i,h){Promise.resolve(h).then(function(p){o({value:p,done:i})},l)}}function JEe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var bet=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},zue=function(t){return zue=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},zue(t)};function eIe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=zue(t),s=0;s0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(n.map(h=>{if(h=Cet(h),h in Cwe)return;Cwe[h]=!0;const p=h.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":Net,p||(y.as="script"),y.crossOrigin="",y.href=h,i&&y.setAttribute("nonce",i),document.head.appendChild(y),p)return new Promise((_,j)=>{y.addEventListener("load",_),y.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return a.then(l=>{for(const i of l||[])i.status==="rejected"&&o(i.reason);return e().catch(o)})},Met=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>ik);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)};class cge extends Error{constructor(e,n="FunctionsError",s){super(e),this.name=n,this.context=s}}class Mwe extends cge{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Twe extends cge{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Awe extends cge{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Bue;(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"})(Bue||(Bue={}));class Tet{constructor(e,{headers:n={},customFetch:s,region:a=Bue.Any}={}){this.url=e,this.headers=n,this.region=a,this.fetch=Met(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Is(this,arguments,void 0,function*(n,s={}){var a;try{const{headers:o,method:l,body:i,signal:h}=s;let p={},{region:x}=s;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(p["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let _;i&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&i instanceof Blob||i instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",_=i):typeof i=="string"?(p["Content-Type"]="text/plain",_=i):typeof FormData<"u"&&i instanceof FormData?_=i:(p["Content-Type"]="application/json",_=JSON.stringify(i)):_=i;const j=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),o),body:_,signal:h}).catch(E=>{throw E.name==="AbortError"?E:new Mwe(E)}),C=j.headers.get("x-relay-error");if(C&&C==="true")throw new Twe(j);if(!j.ok)throw new Awe(j);let N=((a=j.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),A;return N==="application/json"?A=yield j.json():N==="application/octet-stream"||N==="application/pdf"?A=yield j.blob():N==="text/event-stream"?A=j:N==="multipart/form-data"?A=yield j.formData():A=yield j.text(),{data:A,error:null,response:j}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new Mwe(o)}:{data:null,error:o,response:o instanceof Awe||o instanceof Twe?o.context:void 0}}})}}var uh={};const a3=E5e(ket);var cL={},dL={},uL={},hL={},fL={},Aet=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")},oC=Aet();const Eet=oC.fetch,lIe=oC.fetch.bind(oC),cIe=oC.Headers,Iet=oC.Request,Pet=oC.Response,ik=Object.freeze(Object.defineProperty({__proto__:null,Headers:cIe,Request:Iet,Response:Pet,default:lIe,fetch:Eet},Symbol.toStringTag,{value:"Module"})),Let=E5e(ik);var pL={},Ewe;function dIe(){if(Ewe)return pL;Ewe=1,Object.defineProperty(pL,"__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 pL.default=t,pL}var Iwe;function uIe(){if(Iwe)return fL;Iwe=1,Object.defineProperty(fL,"__esModule",{value:!0});const t=a3,e=t.__importDefault(Let),n=t.__importDefault(dIe());class s{constructor(o){var l,i;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=(l=o.shouldThrowOnError)!==null&&l!==void 0?l:!1,this.signal=o.signal,this.isMaybeSingle=(i=o.isMaybeSingle)!==null&&i!==void 0?i:!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,l){return this.headers=new Headers(this.headers),this.headers.set(o,l),this}then(o,l){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 i=this.fetch;let h=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async p=>{var x,y,_,j;let C=null,N=null,A=null,E=p.status,T=p.statusText;if(p.ok){if(this.method!=="HEAD"){const q=await p.text();q===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((x=this.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?N=q:N=JSON.parse(q))}const z=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),F=(_=p.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");z&&F&&F.length>1&&(A=parseInt(F[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(N)&&(N.length>1?(C={code:"PGRST116",details:`Results contain ${N.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},N=null,A=null,E=406,T="Not Acceptable"):N.length===1?N=N[0]:N=null)}else{const z=await p.text();try{C=JSON.parse(z),Array.isArray(C)&&p.status===404&&(N=[],C=null,E=200,T="OK")}catch{p.status===404&&z===""?(E=204,T="No Content"):C={message:z}}if(C&&this.isMaybeSingle&&(!((j=C==null?void 0:C.details)===null||j===void 0)&&j.includes("0 rows"))&&(C=null,E=200,T="OK"),C&&this.shouldThrowOnError)throw new n.default(C)}return{error:C,data:N,count:A,status:E,statusText:T}});return this.shouldThrowOnError||(h=h.catch(p=>{var x,y,_;return{error:{message:`${(x=p==null?void 0:p.name)!==null&&x!==void 0?x:"FetchError"}: ${p==null?void 0:p.message}`,details:`${(y=p==null?void 0:p.stack)!==null&&y!==void 0?y:""}`,hint:"",code:`${(_=p==null?void 0:p.code)!==null&&_!==void 0?_:""}`},data:null,count:null,status:0,statusText:""}})),h.then(o,l)}returns(){return this}overrideTypes(){return this}}return fL.default=s,fL}var Pwe;function hIe(){if(Pwe)return hL;Pwe=1,Object.defineProperty(hL,"__esModule",{value:!0});const e=a3.__importDefault(uIe());class n extends e.default{select(a){let o=!1;const l=(a??"*").split("").map(i=>/\s/.test(i)&&!o?"":(i==='"'&&(o=!o),i)).join("");return this.url.searchParams.set("select",l),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:o=!0,nullsFirst:l,foreignTable:i,referencedTable:h=i}={}){const p=h?`${h}.order`:"order",x=this.url.searchParams.get(p);return this.url.searchParams.set(p,`${x?`${x},`:""}${a}.${o?"asc":"desc"}${l===void 0?"":l?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:o,referencedTable:l=o}={}){const i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(i,`${a}`),this}range(a,o,{foreignTable:l,referencedTable:i=l}={}){const h=typeof i>"u"?"offset":`${i}.offset`,p=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(h,`${a}`),this.url.searchParams.set(p,`${o-a+1}`),this}abortSignal(a){return this.signal=a,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:a=!1,verbose:o=!1,settings:l=!1,buffers:i=!1,wal:h=!1,format:p="text"}={}){var x;const y=[a?"analyze":null,o?"verbose":null,l?"settings":null,i?"buffers":null,h?"wal":null].filter(Boolean).join("|"),_=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${p}; for="${_}"; options=${y};`),p==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}}return hL.default=n,hL}var Lwe;function dge(){if(Lwe)return uL;Lwe=1,Object.defineProperty(uL,"__esModule",{value:!0});const e=a3.__importDefault(hIe()),n=new RegExp("[,()]");class s extends e.default{eq(o,l){return this.url.searchParams.append(o,`eq.${l}`),this}neq(o,l){return this.url.searchParams.append(o,`neq.${l}`),this}gt(o,l){return this.url.searchParams.append(o,`gt.${l}`),this}gte(o,l){return this.url.searchParams.append(o,`gte.${l}`),this}lt(o,l){return this.url.searchParams.append(o,`lt.${l}`),this}lte(o,l){return this.url.searchParams.append(o,`lte.${l}`),this}like(o,l){return this.url.searchParams.append(o,`like.${l}`),this}likeAllOf(o,l){return this.url.searchParams.append(o,`like(all).{${l.join(",")}}`),this}likeAnyOf(o,l){return this.url.searchParams.append(o,`like(any).{${l.join(",")}}`),this}ilike(o,l){return this.url.searchParams.append(o,`ilike.${l}`),this}ilikeAllOf(o,l){return this.url.searchParams.append(o,`ilike(all).{${l.join(",")}}`),this}ilikeAnyOf(o,l){return this.url.searchParams.append(o,`ilike(any).{${l.join(",")}}`),this}is(o,l){return this.url.searchParams.append(o,`is.${l}`),this}in(o,l){const i=Array.from(new Set(l)).map(h=>typeof h=="string"&&n.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${i})`),this}contains(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cs.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cs.{${l.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(l)}`),this}containedBy(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cd.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cd.{${l.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(l)}`),this}rangeGt(o,l){return this.url.searchParams.append(o,`sr.${l}`),this}rangeGte(o,l){return this.url.searchParams.append(o,`nxl.${l}`),this}rangeLt(o,l){return this.url.searchParams.append(o,`sl.${l}`),this}rangeLte(o,l){return this.url.searchParams.append(o,`nxr.${l}`),this}rangeAdjacent(o,l){return this.url.searchParams.append(o,`adj.${l}`),this}overlaps(o,l){return typeof l=="string"?this.url.searchParams.append(o,`ov.${l}`):this.url.searchParams.append(o,`ov.{${l.join(",")}}`),this}textSearch(o,l,{config:i,type:h}={}){let p="";h==="plain"?p="pl":h==="phrase"?p="ph":h==="websearch"&&(p="w");const x=i===void 0?"":`(${i})`;return this.url.searchParams.append(o,`${p}fts${x}.${l}`),this}match(o){return Object.entries(o).forEach(([l,i])=>{this.url.searchParams.append(l,`eq.${i}`)}),this}not(o,l,i){return this.url.searchParams.append(o,`not.${l}.${i}`),this}or(o,{foreignTable:l,referencedTable:i=l}={}){const h=i?`${i}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,l,i){return this.url.searchParams.append(o,`${l}.${i}`),this}}return uL.default=s,uL}var Owe;function fIe(){if(Owe)return dL;Owe=1,Object.defineProperty(dL,"__esModule",{value:!0});const e=a3.__importDefault(dge());class n{constructor(a,{headers:o={},schema:l,fetch:i}){this.url=a,this.headers=new Headers(o),this.schema=l,this.fetch=i}select(a,o){const{head:l=!1,count:i}=o??{},h=l?"HEAD":"GET";let p=!1;const x=(a??"*").split("").map(y=>/\s/.test(y)&&!p?"":(y==='"'&&(p=!p),y)).join("");return this.url.searchParams.set("select",x),i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:o,defaultToNull:l=!0}={}){var i;const h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const p=a.reduce((x,y)=>x.concat(Object.keys(y)),[]);if(p.length>0){const x=[...new Set(p)].map(y=>`"${y}"`);this.url.searchParams.set("columns",x.join(","))}}return new e.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(a,{onConflict:o,ignoreDuplicates:l=!1,count:i,defaultToNull:h=!0}={}){var p;const x="POST";if(this.headers.append("Prefer",`resolution=${l?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),i&&this.headers.append("Prefer",`count=${i}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const y=a.reduce((_,j)=>_.concat(Object.keys(j)),[]);if(y.length>0){const _=[...new Set(y)].map(j=>`"${j}"`);this.url.searchParams.set("columns",_.join(","))}}return new e.default({method:x,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(p=this.fetch)!==null&&p!==void 0?p:fetch})}update(a,{count:o}={}){var l;const i="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new e.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}delete({count:a}={}){var o;const l="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return dL.default=n,dL}var Dwe;function Oet(){if(Dwe)return cL;Dwe=1,Object.defineProperty(cL,"__esModule",{value:!0});const t=a3,e=t.__importDefault(fIe()),n=t.__importDefault(dge());class s{constructor(o,{headers:l={},schema:i,fetch:h}={}){this.url=o,this.headers=new Headers(l),this.schemaName=i,this.fetch=h}from(o){const l=new URL(`${this.url}/${o}`);return new e.default(l,{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,l={},{head:i=!1,get:h=!1,count:p}={}){var x;let y;const _=new URL(`${this.url}/rpc/${o}`);let j;i||h?(y=i?"HEAD":"GET",Object.entries(l).filter(([N,A])=>A!==void 0).map(([N,A])=>[N,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([N,A])=>{_.searchParams.append(N,A)})):(y="POST",j=l);const C=new Headers(this.headers);return p&&C.set("Prefer",`count=${p}`),new n.default({method:y,url:_,headers:C,schema:this.schemaName,body:j,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return cL.default=s,cL}Object.defineProperty(uh,"__esModule",{value:!0});var pIe=uh.PostgrestError=kIe=uh.PostgrestBuilder=wIe=uh.PostgrestTransformBuilder=_Ie=uh.PostgrestFilterBuilder=yIe=uh.PostgrestQueryBuilder=gIe=uh.PostgrestClient=void 0;const i3=a3,mIe=i3.__importDefault(Oet());var gIe=uh.PostgrestClient=mIe.default;const xIe=i3.__importDefault(fIe());var yIe=uh.PostgrestQueryBuilder=xIe.default;const vIe=i3.__importDefault(dge());var _Ie=uh.PostgrestFilterBuilder=vIe.default;const bIe=i3.__importDefault(hIe());var wIe=uh.PostgrestTransformBuilder=bIe.default;const jIe=i3.__importDefault(uIe());var kIe=uh.PostgrestBuilder=jIe.default;const NIe=i3.__importDefault(dIe());pIe=uh.PostgrestError=NIe.default;var SIe=uh.default={PostgrestClient:mIe.default,PostgrestQueryBuilder:xIe.default,PostgrestFilterBuilder:vIe.default,PostgrestTransformBuilder:bIe.default,PostgrestBuilder:jIe.default,PostgrestError:NIe.default};const Det=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return kIe},get PostgrestClient(){return gIe},get PostgrestError(){return pIe},get PostgrestFilterBuilder(){return _Ie},get PostgrestQueryBuilder(){return yIe},get PostgrestTransformBuilder(){return wIe},default:SIe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Ret,PostgrestQueryBuilder:FKt,PostgrestFilterBuilder:zKt,PostgrestTransformBuilder:BKt,PostgrestBuilder:$Kt,PostgrestError:UKt}=SIe||Det;class Fet{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,a=parseInt(s.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} 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 zet="2.78.0",Bet=`realtime-js/${zet}`,$et="1.0.0",$ue=1e4,Uet=1e3,qet=100;var sA;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(sA||(sA={}));var Bc;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Bc||(Bc={}));var Jp;(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"})(Jp||(Jp={}));var Uue;(function(t){t.websocket="websocket"})(Uue||(Uue={}));var Iw;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Iw||(Iw={}));class Vet{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 a=n.getUint8(1),o=n.getUint8(2);let l=this.HEADER_LENGTH+2;const i=s.decode(e.slice(l,l+a));l=l+a;const h=s.decode(e.slice(l,l+o));l=l+o;const p=JSON.parse(s.decode(e.slice(l,e.byteLength)));return{ref:null,topic:i,event:h,payload:p}}}class CIe{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 Ko;(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"})(Ko||(Ko={}));const Rwe=(t,e,n={})=>{var s;const a=(s=n.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((o,l)=>(o[l]=Het(l,t,e,a),o),{}):{}},Het=(t,e,n,s)=>{const a=e.find(i=>i.name===t),o=a==null?void 0:a.type,l=n[t];return o&&!s.includes(o)?MIe(o,l):que(l)},MIe=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Zet(e,n)}switch(t){case Ko.bool:return Wet(e);case Ko.float4:case Ko.float8:case Ko.int2:case Ko.int4:case Ko.int8:case Ko.numeric:case Ko.oid:return Get(e);case Ko.json:case Ko.jsonb:return Ket(e);case Ko.timestamp:return Yet(e);case Ko.abstime:case Ko.date:case Ko.daterange:case Ko.int4range:case Ko.int8range:case Ko.money:case Ko.reltime:case Ko.text:case Ko.time:case Ko.timestamptz:case Ko.timetz:case Ko.tsrange:case Ko.tstzrange:return que(e);default:return que(e)}},que=t=>t,Wet=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Get=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Ket=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},Zet=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,s=t[n];if(t[0]==="{"&&s==="}"){let o;const l=t.slice(1,n);try{o=JSON.parse("["+l+"]")}catch{o=l?l.split(","):[]}return o.map(i=>MIe(e,i))}return t},Yet=t=>typeof t=="string"?t.replace(" ","T"):t,TIe=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 kle{constructor(e,n,s={},a=$ue){this.channel=e,this.event=n,this.payload=s,this.timeout=a,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 Fwe;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Fwe||(Fwe={}));class aA{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,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=aA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(h=>{this.state=aA.syncDiff(this.state,h,o,l)}),this.pendingDiffs=[],i()}),this.channel._on(s.diff,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=aA.syncDiff(this.state,a,o,l),i())}),this.onJoin((a,o,l)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:o,newPresences:l})}),this.onLeave((a,o,l)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:o,leftPresences:l})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,s,a){const o=this.cloneDeep(e),l=this.transformState(n),i={},h={};return this.map(o,(p,x)=>{l[p]||(h[p]=x)}),this.map(l,(p,x)=>{const y=o[p];if(y){const _=x.map(A=>A.presence_ref),j=y.map(A=>A.presence_ref),C=x.filter(A=>j.indexOf(A.presence_ref)<0),N=y.filter(A=>_.indexOf(A.presence_ref)<0);C.length>0&&(i[p]=C),N.length>0&&(h[p]=N)}else i[p]=x}),this.syncDiff(o,{joins:i,leaves:h},s,a)}static syncDiff(e,n,s,a){const{joins:o,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(o,(i,h)=>{var p;const x=(p=e[i])!==null&&p!==void 0?p:[];if(e[i]=this.cloneDeep(h),x.length>0){const y=e[i].map(j=>j.presence_ref),_=x.filter(j=>y.indexOf(j.presence_ref)<0);e[i].unshift(..._)}s(i,x,h)}),this.map(l,(i,h)=>{let p=e[i];if(!p)return;const x=h.map(y=>y.presence_ref);p=p.filter(y=>x.indexOf(y.presence_ref)<0),e[i]=p,a(i,p,h),p.length===0&&delete e[i]}),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 a=e[s];return"metas"in a?n[s]=a.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=a,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 zwe;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(zwe||(zwe={}));var iA;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(iA||(iA={}));var jx;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(jx||(jx={}));class uge{constructor(e,n={config:{}},s){var a,o;if(this.topic=e,this.params=n,this.socket=s,this.bindings={},this.state=Bc.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 kle(this,Jp.join,this.params,this.timeout),this.rejoinTimer=new CIe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Bc.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Bc.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Bc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Bc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Bc.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Jp.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new aA(this),this.broadcastEndpointURL=TIe(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(a=this.params.config)===null||a===void 0?void 0:a.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,a,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Bc.closed){const{config:{broadcast:l,presence:i,private:h}}=this.params,p=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(j=>j.filter))!==null&&a!==void 0?a:[],x=!!this.bindings[iA.PRESENCE]&&this.bindings[iA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},_={broadcast:l,presence:Object.assign(Object.assign({},i),{enabled:x}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(j=>e==null?void 0:e(jx.CHANNEL_ERROR,j)),this._onClose(()=>e==null?void 0:e(jx.CLOSED)),this.updateJoinPayload(Object.assign({config:_},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:j})=>{var C;if(this.socket.setAuth(),j===void 0){e==null||e(jx.SUBSCRIBED);return}else{const N=this.bindings.postgres_changes,A=(C=N==null?void 0:N.length)!==null&&C!==void 0?C:0,E=[];for(let T=0;T{this.state=Bc.errored,e==null||e(jx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(j).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(jx.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===Bc.joined&&e===iA.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 a;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(n==null)return Promise.reject("Payload is required for httpSend()");const l={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}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=s.timeout)!==null&&a!==void 0?a:this.timeout);if(i.status===202)return{success:!0};let h=i.statusText;try{const p=await i.json();h=p.error||p.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var s,a;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:l}=e,h={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:l,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=p.body)===null||a===void 0?void 0:a.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,i,h;const p=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(i=(l=this.params)===null||l===void 0?void 0:l.config)===null||i===void 0?void 0:i.broadcast)===null||h===void 0)&&h.ack)&&o("ok"),p.receive("ok",()=>o("ok")),p.receive("error",()=>o("error")),p.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Bc.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Jp.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new kle(this,Jp.leave,{},e),s.receive("ok",()=>{n(),a("ok")}).receive("timeout",()=>{n(),a("timed out")}).receive("error",()=>{a("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=Bc.closed,this.bindings={}}async _fetchWithTimeout(e,n,s){const a=new AbortController,o=setTimeout(()=>a.abort(),s),l=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:a.signal}));return clearTimeout(o),l}_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 a=new kle(this,e,n,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>qet){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 a,o;const l=e.toLocaleLowerCase(),{close:i,error:h,leave:p,join:x}=Jp;if(s&&[i,h,p,x].indexOf(l)>=0&&s!==this._joinRef())return;let _=this._onMessage(l,n,s);if(n&&!_)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(j=>{var C,N,A;return((C=j.filter)===null||C===void 0?void 0:C.event)==="*"||((A=(N=j.filter)===null||N===void 0?void 0:N.event)===null||A===void 0?void 0:A.toLocaleLowerCase())===l}).map(j=>j.callback(_,s)):(o=this.bindings[l])===null||o===void 0||o.filter(j=>{var C,N,A,E,T,P;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in j){const z=j.id,F=(C=j.filter)===null||C===void 0?void 0:C.event;return z&&((N=n.ids)===null||N===void 0?void 0:N.includes(z))&&(F==="*"||(F==null?void 0:F.toLocaleLowerCase())===((A=n.data)===null||A===void 0?void 0:A.type.toLocaleLowerCase()))}else{const z=(T=(E=j==null?void 0:j.filter)===null||E===void 0?void 0:E.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return z==="*"||z===((P=n==null?void 0:n.event)===null||P===void 0?void 0:P.toLocaleLowerCase())}else return j.type.toLocaleLowerCase()===l}).map(j=>{if(typeof _=="object"&&"ids"in _){const C=_.data,{schema:N,table:A,commit_timestamp:E,type:T,errors:P}=C;_=Object.assign(Object.assign({},{schema:N,table:A,commit_timestamp:E,eventType:T,new:{},old:{},errors:P}),this._getPayloadRecords(C))}j.callback(_,s)})}_isClosed(){return this.state===Bc.closed}_isJoined(){return this.state===Bc.joined}_isJoining(){return this.state===Bc.joining}_isLeaving(){return this.state===Bc.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,s){const a=e.toLocaleLowerCase(),o={type:a,filter:n,callback:s};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this}_off(e,n){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(a=>{var o;return!(((o=a.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&uge.isEqual(a.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(Jp.close,{},e)}_onError(e){this._on(Jp.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Bc.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Rwe(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Rwe(e.columns,e.old_record)),n}}const Nle=()=>{},mL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Xet=[1e3,2e3,5e3,1e4],Qet=1e4,Jet=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class ett{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=$ue,this.transport=null,this.heartbeatIntervalMs=mL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Nle,this.ref=0,this.reconnectTimer=null,this.logger=Nle,this.conn=null,this.sendBuffer=[],this.serializer=new Vet,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=a=>{let o;return a?o=a:typeof fetch>"u"?o=(...l)=>s3(async()=>{const{default:i}=await Promise.resolve().then(()=>ik);return{default:i}},void 0).then(({default:i})=>i(...l)).catch(i=>{throw new Error(`Failed to load @supabase/node-fetch: ${i.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...l)=>o(...l)},!(!((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}/${Uue.websocket}`,this.httpEndpoint=TIe(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=Fet.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:$et}))}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 sA.connecting:return Iw.Connecting;case sA.open:return Iw.Open;case sA.closing:return Iw.Closing;default:return Iw.Closed}}isConnected(){return this.connectionState()===Iw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const s=`realtime:${e}`,a=this.getChannels().find(o=>o.topic===s);if(a)return a;{const o=new uge(`realtime:${e}`,n,this);return this.channels.push(o),o}}push(e){const{topic:n,event:s,payload:a,ref:o}=e,l=()=>{this.encode(e,i=>{var h;(h=this.conn)===null||h===void 0||h.send(i)})};this.log("push",`${n} ${s} (${o})`,a),this.isConnected()?l():this.sendBuffer.push(l)}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(Uet,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},mL.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(p){this.log("error","error in heartbeat callback",p)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:a,payload:o,ref:l}=n,i=l?`(${l})`:"",h=o.status||"";this.log("receive",`${h} ${s} ${a} ${i}`.trim(),o),this.channels.filter(p=>p._isMember(s)).forEach(p=>p._trigger(a,o,l)),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(Jp.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const s=e.match(/\?/)?"&":"?",a=new URLSearchParams(n);return`${e}${s}${a}`}_workerObjectUrl(e){let n;if(e)n=e;else{const s=new Blob([Jet],{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 a={access_token:n,version:Bet};n&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(Jp.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(a){this.log("error",`error in ${e} callback`,a)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new CIe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},mL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,s,a,o,l,i,h,p,x;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:$ue,this.heartbeatIntervalMs=(a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:mL.HEARTBEAT_INTERVAL,this.worker=(o=e==null?void 0:e.worker)!==null&&o!==void 0?o:!1,this.accessToken=(l=e==null?void 0:e.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(i=e==null?void 0:e.heartbeatCallback)!==null&&i!==void 0?i:Nle,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=(h=e==null?void 0:e.reconnectAfterMs)!==null&&h!==void 0?h:y=>Xet[y-1]||Qet,this.encode=(p=e==null?void 0:e.encode)!==null&&p!==void 0?p:(y,_)=>_(JSON.stringify(y)),this.decode=(x=e==null?void 0:e.decode)!==null&&x!==void 0?x: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 hge extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function El(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class ttt extends hge{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 Vue extends hge{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}const fge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>ik);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},rtt=()=>Is(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield s3(()=>Promise.resolve().then(()=>ik),void 0)).Response:Response}),Hue=t=>{if(Array.isArray(t))return t.map(n=>Hue(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,s])=>{const a=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[a]=Hue(s)}),e},ntt=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)},Sle=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)},stt=(t,e,n)=>Is(void 0,void 0,void 0,function*(){const s=yield rtt();t instanceof s&&!(n!=null&&n.noResolveJson)?t.json().then(a=>{const o=t.status||500,l=(a==null?void 0:a.statusCode)||o+"";e(new ttt(Sle(a),o,l))}).catch(a=>{e(new Vue(Sle(a),a))}):e(new Vue(Sle(t),t))}),att=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!s?a:(ntt(s)?(a.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),a.body=JSON.stringify(s)):a.body=s,e!=null&&e.duplex&&(a.duplex=e.duplex),Object.assign(Object.assign({},a),n))};function xI(t,e,n,s,a,o){return Is(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(n,att(e,s,a,o)).then(h=>{if(!h.ok)throw h;return s!=null&&s.noResolveJson?h:h.json()}).then(h=>l(h)).catch(h=>stt(h,i,s))})})}function XA(t,e,n,s){return Is(this,void 0,void 0,function*(){return xI(t,"GET",e,n,s)})}function Zp(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return xI(t,"POST",e,s,a,n)})}function Wue(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return xI(t,"PUT",e,s,a,n)})}function itt(t,e,n,s){return Is(this,void 0,void 0,function*(){return xI(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function pge(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return xI(t,"DELETE",e,s,a,n)})}class ott{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return Is(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(El(e))return{data:null,error:e};throw e}})}}var AIe;class ltt{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n,this[AIe]="BlobDownloadBuilder",this.promise=null}asStream(){return new ott(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 Is(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(El(e))return{data:null,error:e};throw e}})}}AIe=Symbol.toStringTag;const ctt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Bwe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class dtt{constructor(e,n={},s,a){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=s,this.fetch=fge(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,s,a){return Is(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},Bwe),a);let i=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(l.upsert)});const h=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h))):(o=s,i["cache-control"]=`max-age=${l.cacheControl}`,i["content-type"]=l.contentType,h&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(h)))),a!=null&&a.headers&&(i=Object.assign(Object.assign({},i),a.headers));const p=this._removeEmptyFolders(n),x=this._getFinalPath(p),y=yield(e=="PUT"?Wue:Zp)(this.fetch,`${this.url}/object/${x}`,o,Object.assign({headers:i},l!=null&&l.duplex?{duplex:l.duplex}:{}));return{data:{path:p,id:y.Id,fullPath:y.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(El(o))return{data:null,error:o};throw o}})}upload(e,n,s){return Is(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,s)})}uploadToSignedUrl(e,n,s,a){return Is(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),l=this._getFinalPath(o),i=new URL(this.url+`/object/upload/sign/${l}`);i.searchParams.set("token",n);try{let h;const p=Object.assign({upsert:Bwe.upsert},a),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(h=new FormData,h.append("cacheControl",p.cacheControl),h.append("",s)):typeof FormData<"u"&&s instanceof FormData?(h=s,h.append("cacheControl",p.cacheControl)):(h=s,x["cache-control"]=`max-age=${p.cacheControl}`,x["content-type"]=p.contentType);const y=yield Wue(this.fetch,i.toString(),h,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(h){if(this.shouldThrowOnError)throw h;if(El(h))return{data:null,error:h};throw h}})}createSignedUploadUrl(e,n){return Is(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const a=Object.assign({},this.headers);n!=null&&n.upsert&&(a["x-upsert"]="true");const o=yield Zp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:a}),l=new URL(this.url+o.url),i=l.searchParams.get("token");if(!i)throw new hge("No token returned by API");return{data:{signedUrl:l.toString(),path:e,token:i},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(El(s))return{data:null,error:s};throw s}})}update(e,n,s){return Is(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,s)})}move(e,n,s){return Is(this,void 0,void 0,function*(){try{return{data:yield Zp(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(a){if(this.shouldThrowOnError)throw a;if(El(a))return{data:null,error:a};throw a}})}copy(e,n,s){return Is(this,void 0,void 0,function*(){try{return{data:{path:(yield Zp(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(a){if(this.shouldThrowOnError)throw a;if(El(a))return{data:null,error:a};throw a}})}createSignedUrl(e,n,s){return Is(this,void 0,void 0,function*(){try{let a=this._getFinalPath(e),o=yield Zp(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:n},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const l=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${l}`)},{data:o,error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(El(a))return{data:null,error:a};throw a}})}createSignedUrls(e,n,s){return Is(this,void 0,void 0,function*(){try{const a=yield Zp(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:a.map(l=>Object.assign(Object.assign({},l),{signedUrl:l.signedURL?encodeURI(`${this.url}${l.signedURL}${o}`):null})),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(El(a))return{data:null,error:a};throw a}})}download(e,n){const a=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),l=o?`?${o}`:"",i=this._getFinalPath(e),h=()=>XA(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new ltt(h,this.shouldThrowOnError)}info(e){return Is(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const s=yield XA(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Hue(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(El(s))return{data:null,error:s};throw s}})}exists(e){return Is(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield itt(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(El(s)&&s instanceof Vue){const a=s.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,n){const s=this._getFinalPath(e),a=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&a.push(o);const i=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",h=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});h!==""&&a.push(h);let p=a.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}${p}`)}}}remove(e){return Is(this,void 0,void 0,function*(){try{return{data:yield pge(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}list(e,n,s){return Is(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},ctt),n),{prefix:e||""});return{data:yield Zp(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(El(a))return{data:null,error:a};throw a}})}listV2(e,n){return Is(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield Zp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(El(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 EIe="2.78.0",IIe={"X-Client-Info":`storage-js/${EIe}`};class utt{constructor(e,n={},s,a){this.shouldThrowOnError=!1;const o=new URL(e);a!=null&&a.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({},IIe),n),this.fetch=fge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Is(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(e);return{data:yield XA(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}getBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield XA(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}createBucket(e){return Is(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield Zp(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(a){if(this.shouldThrowOnError)throw a;if(El(a))return{data:null,error:a};throw a}})}updateBucket(e,n){return Is(this,void 0,void 0,function*(){try{return{data:yield Wue(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(El(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Zp(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield pge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(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 htt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},IIe),n),this.fetch=fge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Zp(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}listBuckets(e){return Is(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(),a=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield XA(this.fetch,a,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield pge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(El(n))return{data:null,error:n};throw n}})}}const mge={"X-Client-Info":`storage-js/${EIe}`,"Content-Type":"application/json"};class PIe extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Gh(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class Cle extends PIe{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 ftt extends PIe{constructor(e,n){super(e),this.name="StorageVectorsUnknownError",this.originalError=n}}var $we;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})($we||($we={}));const gge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>ik);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},ptt=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)},Uwe=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),mtt=(t,e,n)=>Is(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 a=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const i=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||a+"";e(new Cle(Uwe(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;e(new Cle(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;e(new Cle(i,a,l))}}else e(new ftt(Uwe(t),t))}),gtt=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return s?(ptt(s)?(a.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),a.body=JSON.stringify(s)):a.body=s,Object.assign(Object.assign({},a),n)):a};function xtt(t,e,n,s,a,o){return Is(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(n,gtt(e,s,a,o)).then(h=>{if(!h.ok)throw h;if(s!=null&&s.noResolveJson)return h;const p=h.headers.get("content-type");return!p||!p.includes("application/json")?{}:h.json()}).then(h=>l(h)).catch(h=>mtt(h,i,s))})})}function Kh(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return xtt(t,"POST",e,s,a,n)})}class ytt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mge),n),this.fetch=gge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Is(this,void 0,void 0,function*(){try{return{data:(yield Kh(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}getIndex(e,n){return Is(this,void 0,void 0,function*(){try{return{data:yield Kh(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Gh(s))return{data:null,error:s};throw s}})}listIndexes(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Kh(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}deleteIndex(e,n){return Is(this,void 0,void 0,function*(){try{return{data:(yield Kh(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Gh(s))return{data:null,error:s};throw s}})}}class vtt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mge),n),this.fetch=gge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Is(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 Kh(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}getVectors(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Kh(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}listVectors(e){return Is(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 Kh(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}queryVectors(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Kh(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}deleteVectors(e){return Is(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 Kh(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}}class _tt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mge),n),this.fetch=gge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:(yield Kh(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}getBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Kh(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}listBuckets(){return Is(this,arguments,void 0,function*(e={}){try{return{data:yield Kh(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:(yield Kh(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Gh(n))return{data:null,error:n};throw n}})}}class btt extends _tt{constructor(e,n={}){super(e,n.headers||{},n.fetch)}from(e){return new wtt(this.url,this.headers,e,this.fetch)}}class wtt extends ytt{constructor(e,n,s,a){super(e,n,a),this.vectorBucketName=s}createIndex(e){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Is(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 Is(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 Is(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 Is(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new jtt(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class jtt extends vtt{constructor(e,n,s,a,o){super(e,n,o),this.vectorBucketName=s,this.indexName=a}putVectors(e){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Is(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 Is(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 Is(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 Is(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 Is(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class ktt extends utt{constructor(e,n={},s,a){super(e,n,s,a)}from(e){return new dtt(this.url,this.headers,e,this.fetch)}get vectors(){return new btt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new htt(this.url+"/iceberg",this.headers,this.fetch)}}const Ntt="2.78.0";let iT="";typeof Deno<"u"?iT="deno":typeof document<"u"?iT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?iT="react-native":iT="node";const Stt={"X-Client-Info":`supabase-js-${iT}/${Ntt}`},Ctt={headers:Stt},Mtt={schema:"public"},Ttt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Att={},Ett=t=>{let e;return t?e=t:typeof fetch>"u"?e=lIe:e=fetch,(...n)=>e(...n)},Itt=()=>typeof Headers>"u"?cIe:Headers,Ptt=(t,e,n)=>{const s=Ett(n),a=Itt();return async(o,l)=>{var i;const h=(i=await e())!==null&&i!==void 0?i:t;let p=new a(l==null?void 0:l.headers);return p.has("apikey")||p.set("apikey",t),p.has("Authorization")||p.set("Authorization",`Bearer ${h}`),s(o,Object.assign(Object.assign({},l),{headers:p}))}};function Ltt(t){return t.endsWith("/")?t:t+"/"}function Ott(t,e){var n,s;const{db:a,auth:o,realtime:l,global:i}=t,{db:h,auth:p,realtime:x,global:y}=e,_={db:Object.assign(Object.assign({},h),a),auth:Object.assign(Object.assign({},p),o),realtime:Object.assign(Object.assign({},x),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),i),{headers:Object.assign(Object.assign({},(n=y==null?void 0:y.headers)!==null&&n!==void 0?n:{}),(s=i==null?void 0:i.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function Dtt(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(Ltt(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const LIe="2.78.0",x4=30*1e3,Gue=3,Mle=Gue*x4,Rtt="http://localhost:9999",Ftt="supabase.auth.token",ztt={"X-Client-Info":`gotrue-js/${LIe}`},Kue="X-Supabase-Api-Version",OIe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Btt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,$tt=10*60*1e3;class QA extends Error{constructor(e,n,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Js(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Utt extends QA{constructor(e,n,s){super(e,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function qtt(t){return Js(t)&&t.name==="AuthApiError"}class Pw extends QA{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class av extends QA{constructor(e,n,s,a){super(e,s,a),this.name=n,this.status=s}}class Vp extends av{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Vtt(t){return Js(t)&&t.name==="AuthSessionMissingError"}class XN extends av{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class gL extends av{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class xL extends av{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 Htt(t){return Js(t)&&t.name==="AuthImplicitGrantRedirectError"}class qwe extends av{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 Zue extends av{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function Tle(t){return Js(t)&&t.name==="AuthRetryableFetchError"}class Vwe extends av{constructor(e,n,s){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class Yue extends av{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Gee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Hwe=` \r=`.split(""),Wtt=(()=>{const t=new Array(128);for(let e=0;e=6;){const s=e.queue>>e.queuedBits-6&63;n(Gee[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(Gee[s]),e.queuedBits-=6}}function DIe(t,e,n){const s=Wtt[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 Gwe(t){const e=[],n=l=>{e.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{Ztt(l,s,n)};for(let l=0;l>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 Ktt(t,e){for(let n=0;n55295&&s<=56319){const a=(s-55296)*1024&65535;s=(t.charCodeAt(n+1)-56320&65535|a)+65536,n+=1}Gtt(s,e)}}function Ztt(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 kS(t){const e=[],n={queue:0,queuedBits:0},s=a=>{e.push(a)};for(let a=0;ae.push(n)),new Uint8Array(e)}function Bw(t){const e=[],n={queue:0,queuedBits:0},s=a=>{e.push(a)};return t.forEach(a=>Wwe(a,n,s)),Wwe(null,n,s),e.join("")}function Xtt(t){return Math.round(Date.now()/1e3)+t}function Qtt(){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 Mu=()=>typeof window<"u"&&typeof document<"u",a_={tested:!1,writable:!1},RIe=()=>{if(!Mu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(a_.tested)return a_.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),a_.tested=!0,a_.writable=!0}catch{a_.tested=!0,a_.writable=!1}return a_.writable};function Jtt(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((a,o)=>{e[o]=a})}catch{}return n.searchParams.forEach((s,a)=>{e[a]=s}),e}const FIe=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>ik);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},ert=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",y4=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},i_=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},u0=async(t,e)=>{await t.removeItem(e)};class One{constructor(){this.promise=new One.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}One.promiseConstructor=Promise;function Ale(t){const e=t.split(".");if(e.length!==3)throw new Yue("Invalid JWT structure");for(let s=0;s{setTimeout(()=>e(null),t)})}function rrt(t,e){return new Promise((s,a)=>{(async()=>{for(let o=0;o<1/0;o++)try{const l=await t(o);if(!e(o,null,l)){s(l);return}}catch(l){if(!e(o,l)){a(l);return}}})()})}function nrt(t){return("0"+t.toString(16)).substr(-2)}function srt(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let a="";for(let o=0;o<56;o++)a+=n.charAt(Math.floor(Math.random()*s));return a}return crypto.getRandomValues(e),Array.from(e,nrt).join("")}async function art(t){const n=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",n),a=new Uint8Array(s);return Array.from(a).map(o=>String.fromCharCode(o)).join("")}async function irt(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 art(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function QN(t,e,n=!1){const s=srt();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await y4(t,`${e}-code-verifier`,a);const o=await irt(s);return[o,s===o?"plain":"s256"]}const ort=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function lrt(t){const e=t.headers.get(Kue);if(!e||!e.match(ort))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function crt(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 drt(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 urt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function JN(t){if(!urt.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ele(){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 hrt(t,e){return new Proxy(t,{get:(n,s,a)=>{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,a)}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,a)}})}function Kwe(t){return JSON.parse(JSON.stringify(t))}const Cw=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),frt=[502,503,504];async function Zwe(t){var e;if(!ert(t))throw new Zue(Cw(t),0);if(frt.includes(t.status))throw new Zue(Cw(t),t.status);let n;try{n=await t.json()}catch(o){throw new Pw(Cw(o),o)}let s;const a=lrt(t);if(a&&a.getTime()>=OIe["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 Vwe(Cw(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new Vp}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,l)=>o&&typeof l=="string",!0))throw new Vwe(Cw(n),t.status,n.weak_password.reasons);throw new Utt(Cw(n),t.status||500,s)}const prt=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),n))};async function Aa(t,e,n,s){var a;const o=Object.assign({},s==null?void 0:s.headers);o[Kue]||(o[Kue]=OIe["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const l=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(l.redirect_to=s.redirectTo);const i=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",h=await mrt(t,e,n+i,{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(h):{data:Object.assign({},h),error:null}}async function mrt(t,e,n,s,a,o){const l=prt(e,s,a,o);let i;try{i=await t(n,Object.assign({},l))}catch(h){throw console.error(h),new Zue(Cw(h),0)}if(i.ok||await Zwe(i),s!=null&&s.noResolveJson)return i;try{return await i.json()}catch(h){await Zwe(h)}}function Hp(t){var e;let n=null;yrt(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Xtt(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:s},error:null}}function Ywe(t){const e=Hp(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 P0(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function grt(t){return{data:t,error:null}}function xrt(t){const{action_link:e,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o}=t,l=sv(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),i={action_link:e,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o},h=Object.assign({},l);return{data:{properties:i,user:h},error:null}}function Xwe(t){return t}function yrt(t){return t.access_token&&t.refresh_token&&t.expires_in}const Ile=["global","local","others"];class vrt{constructor({url:e="",headers:n={},fetch:s}){this.url=e,this.headers=n,this.fetch=FIe(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=Ile[0]){if(Ile.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ile.join(", ")}`);try{return await Aa(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,n={}){try{return await Aa(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:P0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:n}=e,s=sv(e,["options"]),a=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(a.new_email=s==null?void 0:s.newEmail,delete a.newEmail),await Aa(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:xrt,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Js(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await Aa(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:P0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,s,a,o,l,i,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Aa(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=(a=e==null?void 0:e.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Xwe});if(x.error)throw x.error;const y=await x.json(),_=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(C=>{const N=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(C.split(";")[1].split("=")[1]);p[`${A}Page`]=N}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){JN(e);try{return await Aa(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:P0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){JN(e);try{return await Aa(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:P0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,n=!1){JN(e);try{return await Aa(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:P0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){JN(e.userId);try{const{data:n,error:s}=await Aa(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:s}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _deleteFactor(e){JN(e.userId),JN(e.id);try{return{data:await Aa(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,s,a,o,l,i,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Aa(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=(a=e==null?void 0:e.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Xwe});if(x.error)throw x.error;const y=await x.json(),_=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(C=>{const N=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(C.split(";")[1].split("=")[1]);p[`${A}Page`]=N}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await Aa(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await Aa(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await Aa(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{return await Aa(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await Aa(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}}function Qwe(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const e4={debug:!!(globalThis&&RIe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class zIe extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class _rt extends zIe{}async function brt(t,e,n){e4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),e4.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 a=>{if(a){e4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,a.name);try{return await n()}finally{e4.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,a.name)}}else{if(e===0)throw e4.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new _rt(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(e4.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 wrt(){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 BIe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function jrt(t){return parseInt(t,16)}function krt(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function Nrt(t){var e;const{chainId:n,domain:s,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:h,resources:p,scheme:x,uri:y,version:_}=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(l&&l.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${l}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);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 j=BIe(t.address),C=x?`${x}://${s}`:s,N=t.statement?`${t.statement} `:"",A=`${C} wants you to sign in with your Ethereum account: ${j} ${N}`;let E=`URI: ${y} Version: ${_} Chain ID: ${n}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(a&&(E+=` Expiration Time: ${a.toISOString()}`),i&&(E+=` Not Before: ${i.toISOString()}`),h&&(E+=` Request ID: ${h}`),p){let T=` Resources:`;for(const P of p){if(!P||typeof P!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${P}`);T+=` - ${P}`}E+=T}return`${A} ${E}`}class Sc extends Error{constructor({message:e,code:n,cause:s,name:a}){var o;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(o=a??(s instanceof Error?s.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class Kee extends Sc{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function Srt({error:t,options:e}){var n,s,a;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 Sc({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 Sc({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 Sc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((a=o.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new Sc({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 Sc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Sc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new Sc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Sc({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 l=window.location.hostname;if($Ie(l)){if(o.rp.id!==l)return new Sc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Sc({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 Sc({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 Sc({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 Sc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Crt({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 Sc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Sc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if($Ie(s)){if(n.rpId!==s)return new Sc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Sc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Sc({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 Sc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Mrt{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 Trt=new Mrt;function Art(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,a=sv(t,["challenge","user","excludeCredentials"]),o=kS(e).buffer,l=Object.assign(Object.assign({},n),{id:kS(n.id).buffer}),i=Object.assign(Object.assign({},a),{challenge:o,user:l});if(s&&s.length>0){i.excludeCredentials=new Array(s.length);for(let h=0;h0){o.allowCredentials=new Array(n.length);for(let l=0;la!==null&&typeof a=="object"&&!Array.isArray(a),n=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),s={};for(const a of t)if(a)for(const o in a){const l=a[o];if(l!==void 0)if(Array.isArray(l))s[o]=l;else if(n(l))s[o]=l;else if(e(l)){const i=s[o];e(i)?s[o]=Zee(i,l):s[o]=Zee(l)}else s[o]=l}return s}function Frt(t,e){return Zee(Drt,t,e||{})}function zrt(t,e){return Zee(Rrt,t,e||{})}class Brt{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:a},o){try{const{data:l,error:i}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!l)return{data:null,error:i};const h=a??Trt.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:p}=l.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${s}`),p.displayName||(p.displayName=p.name)}switch(l.webauthn.type){case"create":{const p=Frt(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Lrt({publicKey:p,signal:h});return x?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}case"request":{const p=zrt(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Ort(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:h}));return x?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Pw("Unexpected error in challenge",l)}}}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:a}},o){if(!n)return{data:null,error:new QA("rpId is required for WebAuthn authentication")};try{if(!Jwe())return{data:null,error:new Pw("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:s},signal:a},{request:o});if(!l)return{data:null,error:i};const{webauthn:h}=l;return this._verify({factorId:e,challengeId:l.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:s,credential_response:h.credential_response}})}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Pw("Unexpected error in authenticate",l)}}}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:a},o){if(!n)return{data:null,error:new QA("rpId is required for WebAuthn registration")};try{if(!Jwe())return{data:null,error:new Pw("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this._enroll({friendlyName:e});if(!l)return await this.client.mfa.listFactors().then(x=>{var y;return(y=x.data)===null||y===void 0?void 0:y.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===e&&_.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:i};const{data:h,error:p}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:a},{create:o});return h?this._verify({factorId:l.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:p}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Pw("Unexpected error in register",l)}}}}wrt();const $rt={url:Rtt,storageKey:Ftt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ztt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function eje(t,e,n){return await n()}const t4={};class JA{get jwks(){var e,n;return(n=(e=t4[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){t4[this.storageKey]=Object.assign(Object.assign({},t4[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=t4[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){t4[this.storageKey]=Object.assign(Object.assign({},t4[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=JA.nextInstanceID,JA.nextInstanceID+=1,this.instanceID>0&&Mu()&&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 a=Object.assign(Object.assign({},$rt),e);if(this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.persistSession=a.persistSession,this.storageKey=a.storageKey,this.autoRefreshToken=a.autoRefreshToken,this.admin=new vrt({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=FIe(a.fetch),this.lock=a.lock||eje,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:Mu()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=brt:this.lock=eje,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 Brt(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:RIe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Qwe(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Qwe(this.memoryStorage)),Mu()&&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} (${LIe}) ${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=Jtt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),Mu()&&this.detectSessionInUrl&&s!=="none"){const{data:a,error:o}=await this._getSessionFromURL(n,s);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),Htt(o)){const h=(e=o.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:l,redirectType:i}=a;return this._debug("#_initialize()","detected session in URL",l,"redirect type",i),await this._saveSession(l),setTimeout(async()=>{i==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",l):await this._notifyAllSubscribers("SIGNED_IN",l)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Js(n)?{error:n}:{error:new Pw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,s,a;try{const o=await Aa(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:(a=e==null?void 0:e.options)===null||a===void 0?void 0:a.captchaToken}},xform:Hp}),{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(e){var n,s,a;try{let o;if("email"in e){const{email:x,password:y,options:_}=e;let j=null,C=null;this.flowType==="pkce"&&([j,C]=await QN(this.storage,this.storageKey)),o=await Aa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_==null?void 0:_.emailRedirectTo,body:{email:x,password:y,data:(n=_==null?void 0:_.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken},code_challenge:j,code_challenge_method:C},xform:Hp})}else if("phone"in e){const{phone:x,password:y,options:_}=e;o=await Aa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(s=_==null?void 0:_.data)!==null&&s!==void 0?s:{},channel:(a=_==null?void 0:_.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken}},xform:Hp})}else throw new gL("You must provide either an email or phone number and a password");const{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(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:l,options:i}=e;n=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:l,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Ywe})}else if("phone"in e){const{phone:o,password:l,options:i}=e;n=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:l,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Ywe})}else throw new gL("You must provide either an email or phone number and a password");const{data:s,error:a}=n;return a?{data:{user:null,session:null},error:a}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new XN}:(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:a})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,s,a,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:(a=e.options)===null||a===void 0?void 0:a.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,a,o,l,i,h,p,x,y,_;let j,C;if("message"in e)j=e.message,C=e.signature;else{const{chain:N,wallet:A,statement:E,options:T}=e;let P;if(Mu())if(typeof A=="object")P=A;else{const G=window;if("ethereum"in G&&typeof G.ethereum=="object"&&"request"in G.ethereum&&typeof G.ethereum.request=="function")P=G.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 A!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=A}const z=new URL((n=T==null?void 0:T.url)!==null&&n!==void 0?n:window.location.href),F=await P.request({method:"eth_requestAccounts"}).then(G=>G).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=BIe(F[0]);let V=(s=T==null?void 0:T.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!V){const G=await P.request({method:"eth_chainId"});V=jrt(G)}const K={domain:z.host,address:q,statement:E,uri:z.href,version:"1",chainId:V,nonce:(a=T==null?void 0:T.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(l=(o=T==null?void 0:T.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(i=T==null?void 0:T.signInWithEthereum)===null||i===void 0?void 0:i.expirationTime,notBefore:(h=T==null?void 0:T.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(p=T==null?void 0:T.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(x=T==null?void 0:T.signInWithEthereum)===null||x===void 0?void 0:x.resources};j=Nrt(K),C=await P.request({method:"personal_sign",params:[krt(j),q]})}try{const{data:N,error:A}=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:j,signature:C},!((y=e.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Hp});if(A)throw A;return!N||!N.session||!N.user?{data:{user:null,session:null},error:new XN}:(N.session&&(await this._saveSession(N.session),await this._notifyAllSubscribers("SIGNED_IN",N.session)),{data:Object.assign({},N),error:A})}catch(N){if(Js(N))return{data:{user:null,session:null},error:N};throw N}}async signInWithSolana(e){var n,s,a,o,l,i,h,p,x,y,_,j;let C,N;if("message"in e)C=e.message,N=e.signature;else{const{chain:A,wallet:E,statement:T,options:P}=e;let z;if(Mu())if(typeof E=="object")z=E;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"))z=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 E!="object"||!(P!=null&&P.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=E}const F=new URL((n=P==null?void 0:P.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in z&&z.signIn){const q=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},P==null?void 0:P.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),T?{statement:T}:null));let V;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")V=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)V=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in V&&"signature"in V&&(typeof V.signedMessage=="string"||V.signedMessage instanceof Uint8Array)&&V.signature instanceof Uint8Array)C=typeof V.signedMessage=="string"?V.signedMessage:new TextDecoder().decode(V.signedMessage),N=V.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.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:`,z.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(a=(s=P==null?void 0:P.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((o=P==null?void 0:P.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${P.signInWithSolana.notBefore}`]:[],...!((l=P==null?void 0:P.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${P.signInWithSolana.expirationTime}`]:[],...!((i=P==null?void 0:P.signInWithSolana)===null||i===void 0)&&i.chainId?[`Chain ID: ${P.signInWithSolana.chainId}`]:[],...!((h=P==null?void 0:P.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${P.signInWithSolana.nonce}`]:[],...!((p=P==null?void 0:P.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${P.signInWithSolana.requestId}`]:[],...!((y=(x=P==null?void 0:P.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||y===void 0)&&y.length?["Resources",...P.signInWithSolana.resources.map(V=>`- ${V}`)]:[]].join(` `);const q=await z.signMessage(new TextEncoder().encode(C),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");N=q}}try{const{data:A,error:E}=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:Bw(N)},!((_=e.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(j=e.options)===null||j===void 0?void 0:j.captchaToken}}:null),xform:Hp});if(E)throw E;return!A||!A.session||!A.user?{data:{user:null,session:null},error:new XN}:(A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),{data:Object.assign({},A),error:E})}catch(A){if(Js(A))return{data:{user:null,session:null},error:A};throw A}}async _exchangeCodeForSession(e){const n=await i_(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(n??"").split("/");try{const{data:o,error:l}=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:Hp});if(await u0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new XN}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:a??null}),error:l})}catch(o){if(Js(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(e){try{const{options:n,provider:s,token:a,access_token:o,nonce:l}=e,i=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:a,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Hp}),{data:h,error:p}=i;return p?{data:{user:null,session:null},error:p}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new XN}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),{data:h,error:p})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,s,a,o,l;try{if("email"in e){const{email:i,options:h}=e;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await QN(this.storage,this.storageKey));const{error:y}=await Aa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},create_user:(s=h==null?void 0:h.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:x},redirectTo:h==null?void 0:h.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in e){const{phone:i,options:h}=e,{data:p,error:x}=await Aa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:i,data:(a=h==null?void 0:h.data)!==null&&a!==void 0?a:{},create_user:(o=h==null?void 0:h.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(l=h==null?void 0:h.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:x}}throw new gL("You must provide either an email or phone number.")}catch(i){if(Js(i))return{data:{user:null,session:null},error:i};throw i}}async verifyOtp(e){var n,s;try{let a,o;"options"in e&&(a=(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:l,error:i}=await Aa(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:Hp});if(i)throw i;if(!l)throw new Error("An error occurred on token verification.");const h=l.session,p=l.user;return h!=null&&h.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(a){if(Js(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(e){var n,s,a;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await QN(this.storage,this.storageKey)),await Aa(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}),!((a=e==null?void 0:e.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:grt})}catch(o){if(Js(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 Vp;const{error:a}=await Aa(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:a}})}catch(e){if(Js(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:a,options:o}=e,{error:l}=await Aa(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:a,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:l}}else if("phone"in e){const{phone:s,type:a,options:o}=e,{data:l,error:i}=await Aa(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:i}}throw new gL("You must provide either an email or phone number and a type")}catch(n){if(Js(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(),a=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}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 a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.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 i_(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()await this._getUser()))}async _getUser(e){try{return e?await Aa(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:P0}):await this._useSession(async n=>{var s,a,o;const{data:l,error:i}=n;if(i)throw i;return!(!((s=l.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Vp}:await Aa(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(a=l.session)===null||a===void 0?void 0:a.access_token)!==null&&o!==void 0?o:void 0,xform:P0})})}catch(n){if(Js(n))return Vtt(n)&&(await this._removeSession(),await u0(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:a,error:o}=s;if(o)throw o;if(!a.session)throw new Vp;const l=a.session;let i=null,h=null;this.flowType==="pkce"&&e.email!=null&&([i,h]=await QN(this.storage,this.storageKey));const{data:p,error:x}=await Aa(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:i,code_challenge_method:h}),jwt:l.access_token,xform:P0});if(x)throw x;return l.user=p.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),{data:{user:l.user},error:null}})}catch(s){if(Js(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 Vp;const n=Date.now()/1e3;let s=n,a=!0,o=null;const{payload:l}=Ale(e.access_token);if(l.exp&&(s=l.exp,a=s<=n),a){const{data:i,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return{data:{user:null,session:null},error:h};if(!i)return{data:{user:null,session:null},error:null};o=i}else{const{data:i,error:h}=await this._getUser(e.access_token);if(h)throw h;o={access_token:e.access_token,refresh_token:e.refresh_token,user:i.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(Js(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:l,error:i}=n;if(i)throw i;e=(s=l.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new Vp;const{data:a,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{user:null,session:null},error:o}:a?{data:{user:a.user,session:a},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!Mu())throw new xL("No browser detected.");if(e.error||e.error_description||e.error_code)throw new xL(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 qwe("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new xL("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 qwe("No code detected.");const{data:T,error:P}=await this._exchangeCodeForSession(e.code);if(P)throw P;const z=new URL(window.location.href);return z.searchParams.delete("code"),window.history.replaceState(window.history.state,"",z.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:o,refresh_token:l,expires_in:i,expires_at:h,token_type:p}=e;if(!o||!i||!l||!p)throw new xL("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(i);let _=x+y;h&&(_=parseInt(h));const j=_-x;j*1e3<=x4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${j}s, should have been closer to ${y}s`);const C=_-y;x-C>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",C,_,x):x-C<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",C,_,x);const{data:N,error:A}=await this._getUser(o);if(A)throw A;const E={provider_token:s,provider_refresh_token:a,access_token:o,expires_in:y,expires_at:_,refresh_token:l,token_type:p,user:N.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:E,redirectType:e.type},error:null}}catch(s){if(Js(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 i_(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:a,error:o}=n;if(o)return{error:o};const l=(s=a.session)===null||s===void 0?void 0:s.access_token;if(l){const{error:i}=await this.admin.signOut(l,e);if(i&&!(qtt(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return e!=="others"&&(await this._removeSession(),await u0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=Qtt(),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,a;try{const{data:{session:o},error:l}=n;if(l)throw l;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((a=this.stateChangeEmitters.get(e))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",o),console.error(o)}})}async resetPasswordForEmail(e,n={}){let s=null,a=null;this.flowType==="pkce"&&([s,a]=await QN(this.storage,this.storageKey,!0));try{return await Aa(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(Js(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(Js(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:a}=await this._useSession(async o=>{var l,i,h,p,x;const{data:y,error:_}=o;if(_)throw _;const j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(l=e.options)===null||l===void 0?void 0:l.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await Aa(this.fetch,"GET",j,{headers:this.headers,jwt:(x=(p=y.session)===null||p===void 0?void 0:p.access_token)!==null&&x!==void 0?x:void 0})});if(a)throw a;return Mu()&&!(!((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(Js(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:a,data:{session:o}}=n;if(a)throw a;const{options:l,provider:i,token:h,access_token:p,nonce:x}=e,y=await Aa(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:i,id_token:h,access_token:p,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Hp}),{data:_,error:j}=y;return j?{data:{user:null,session:null},error:j}:!_||!_.session||!_.user?{data:{user:null,session:null},error:new XN}:(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),{data:_,error:j})}catch(a){if(Js(a))return{data:{user:null,session:null},error:a};throw a}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)throw l;return await Aa(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(a=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0})})}catch(n){if(Js(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 rrt(async a=>(a>0&&await trt(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Aa(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Hp})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Tle(o)&&Date.now()+l-s{try{await i.callback(e,n)}catch(h){o.push(h)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),x4);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 a=Math.floor((s.expires_at*1e3-e)/x4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${x4}ms, refresh threshold is ${Gue} ticks`),a<=Gue&&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 zIe)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Mu()||!(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 a=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&a.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&a.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[o,l]=await QN(this.storage,this.storageKey),i=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});a.push(i.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);a.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&a.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${a.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var s;const{data:a,error:o}=n;return o?{data:null,error:o}:await Aa(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)return{data:null,error:l};const i=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:p}=await Aa(this.fetch,"POST",`${this.url}/factors`,{body:i,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return p?{data:null,error:p}:(e.factorType==="totp"&&h.type==="totp"&&(!((a=h==null?void 0:h.totp)===null||a===void 0)&&a.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),{data:h,error:null})})}catch(n){if(Js(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:a,error:o}=n;if(o)return{data:null,error:o};const l=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Irt(e.webauthn.credential_response):Prt(e.webauthn.credential_response)})}:{code:e.code}),{data:i,error:h}=await Aa(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return h?{data:null,error:h}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+i.expires_in},i)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",i),{data:i,error:h})})}catch(n){if(Js(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:a,error:o}=n;if(o)return{data:null,error:o};const l=await Aa(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:i}=l;if(i.type!=="webauthn")return{data:i,error:null};switch(i.webauthn.type){case"create":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:Art(i.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:Ert(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Js(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 a={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])a.all.push(o),o.status==="verified"&&a[o.factor_type].push(o);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:s},error:a}=await this.getSession();if(a)return{data:null,error:a};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ale(s.access_token);let l=null;o.aal&&(l=o.aal);let i=l;((n=(e=s.user.factors)===null||e===void 0?void 0:e.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(i="aal2");const p=o.amr||[];return{data:{currentLevel:l,nextLevel:i,currentAuthenticationMethods:p},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:s},error:a}=n;return a?{data:null,error:a}:s?await Aa(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 Vp}})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:a},error:o}=s;if(o)return{data:null,error:o};if(!a)return{data:null,error:new Vp};const l=await Aa(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Mu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _denyAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:a},error:o}=s;if(o)return{data:null,error:o};if(!a)return{data:null,error:new Vp};const l=await Aa(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Mu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async fetchJwk(e,n={keys:[]}){let s=n.keys.find(i=>i.kid===e);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(i=>i.kid===e),s&&this.jwks_cached_at+$tt>a)return s;const{data:o,error:l}=await Aa(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(l)throw l;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=a,s=o.keys.find(i=>i.kid===e),!s)?null:s}async getClaims(e,n={}){try{let s=e;if(!s){const{data:j,error:C}=await this.getSession();if(C||!j.session)return{data:null,error:C};s=j.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:h}}=Ale(s);n!=null&&n.allowExpired||crt(o.exp);const p=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!p){const{error:j}=await this.getUser(s);if(j)throw j;return{data:{claims:o,header:a,signature:l},error:null}}const x=drt(a.alg),y=await crypto.subtle.importKey("jwk",p,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Ytt(`${i}.${h}`)))throw new Yue("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}}JA.nextInstanceID=0;const Urt=JA;class qrt extends Urt{constructor(e){super(e)}}class Vrt{constructor(e,n,s){var a,o,l;this.supabaseUrl=e,this.supabaseKey=n;const i=Dtt(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const h=`sb-${i.hostname.split(".")[0]}-auth-token`,p={db:Mtt,realtime:Att,auth:Object.assign(Object.assign({},Ttt),{storageKey:h}),global:Ctt},x=Ott(s??{},p);this.storageKey=(a=x.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(o=x.global.headers)!==null&&o!==void 0?o:{},x.accessToken?(this.accessToken=x.accessToken,this.auth=new Proxy({},{get:(y,_)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(_)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=x.auth)!==null&&l!==void 0?l:{},this.headers,x.global.fetch),this.fetch=Ptt(n,this._getAccessToken.bind(this),x.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},x.realtime)),this.rest=new Ret(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new ktt(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new Tet(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:a,userStorage:o,storageKey:l,flowType:i,lock:h,debug:p},x,y){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new qrt({url:this.authUrl.href,headers:Object.assign(Object.assign({},_),x),storageKey:l,autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:a,userStorage:o,flowType:i,lock:h,debug:p,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(j=>j.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new ett(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 Hrt=(t,e,n)=>new Vrt(t,e,n);function Wrt(){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}Wrt()&&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 Grt="https://relzejiswnotikjgvjhz.supabase.co",Krt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",J=Hrt(Grt,Krt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),UIe=I.createContext(void 0),Zrt=({children:t})=>{const[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(!0),[i,h]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState(null),[j,C]=I.useState([]),[N,A]=I.useState(null),E=Zn(),T=async q=>{try{console.log("Checking roles via RPC for user:",q);const[{data:V,error:K},{data:G,error:te}]=await Promise.all([J.rpc("has_role",{_user_id:q,_role:"admin"}),J.rpc("has_role",{_user_id:q,_role:"brokerage_manager"})]);if(K||te)console.error("Role RPC errors:",{isAdminError:K,isBrokerError:te}),h(!1),x(!1);else{const ye=!!V,ae=!!G;console.log("RPC roles result:",{adminValue:ye,brokerValue:ae}),h(ye),x(ae)}const{data:ie,error:oe}=await J.from("profiles").select("brokerage_id").eq("id",q).single();if(_(!oe&&ie?ie.brokerage_id:null),G){console.log("Fetching managed brokerages for user:",q);const{data:ye,error:ae}=await J.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",q);if(console.log("Managed brokerage assignments result:",{assignments:ye,assignmentsError:ae}),ae||!ye){console.error("Error fetching managed brokerage assignments:",ae),C([]);return}const pe=Array.from(new Set(ye.map(_e=>_e.brokerage_id).filter(Boolean)));if(pe.length===0){C([]);return}const{data:se,error:he}=await J.from("brokerages").select("id, name").in("id",pe);if(console.log("Managed brokerages details result:",{brokeragesData:se,brokeragesError:he}),he||!se){console.error("Error fetching managed brokerages details:",he),C([]);return}const ue=se.map(_e=>({id:_e.id,name:_e.name})).sort((_e,Ae)=>pe.indexOf(_e.id)-pe.indexOf(Ae.id));console.log("Parsed managed brokerages:",ue),C(ue),ue.length>0&&!N&&A(ue[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),C([])}catch(V){console.error("Unexpected error in checkRoles:",V),h(!1),x(!1),_(null),C([])}};I.useEffect(()=>{const{data:{subscription:q}}=J.auth.onAuthStateChange((V,K)=>{console.log("Auth event:",V),a(K),n((K==null?void 0:K.user)??null),V==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{E("/profile?reset=true")},100)),K!=null&&K.user?setTimeout(()=>{T(K.user.id)},0):(h(!1),x(!1),_(null),C([]),A(null))});return J.auth.getSession().then(({data:{session:V}})=>{a(V),n((V==null?void 0:V.user)??null),V!=null&&V.user?T(V.user.id).finally(()=>{l(!1)}):l(!1)}),()=>q.unsubscribe()},[]);const P=async(q,V)=>{const{error:K}=await J.auth.signInWithPassword({email:q,password:V});if(K)throw ze.error(K.message),K;ze.success("Welcome back!"),E("/dashboard")},z=async(q,V,K)=>{const G=`${window.location.origin}/dashboard`,{error:te}=await J.auth.signUp({email:q,password:V,options:{emailRedirectTo:G,data:{name:K}}});if(te)throw ze.error(te.message),te;ze.success("Account created! Welcome to LevelUp."),E("/dashboard")},F=async()=>{try{const{data:{session:q}}=await J.auth.getSession();if(q){const{error:V}=await J.auth.signOut();V?V.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",V.message):(console.error("Sign out error:",V),ze.error(V.message)):ze.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),a(null),h(!1),x(!1),_(null),C([]),A(null),E("/auth")}catch(q){console.error("Unexpected sign out error:",q),E("/auth")}};return r.jsx(UIe.Provider,{value:{user:e,session:s,loading:o,signIn:P,signUp:z,signOut:F,isAdmin:i,isBrokerageManager:p,brokerageId:y,managedBrokerages:j,selectedBrokerageId:N,setSelectedBrokerageId:A},children:t})},Xr=()=>{const t=I.useContext(UIe);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},qIe=I.createContext(void 0),r4="levelup_admin_session",o_="levelup_impersonation",Yrt=({children:t})=>{const[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState(!1);I.useEffect(()=>{const p=sessionStorage.getItem(o_);if(p)try{const x=JSON.parse(p);n(!0),a(x)}catch{sessionStorage.removeItem(o_)}},[]);const i=async p=>{l(!0);try{const{data:{session:x}}=await J.auth.getSession();if(!x)return ze.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(r4,JSON.stringify(y));const _=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.access_token}`},body:JSON.stringify({targetUserId:p})}),j=await _.json();if(!_.ok)throw new Error(j.error||"Failed to impersonate user");const C={id:j.targetUser.id,name:j.targetUser.name,email:j.targetUser.email};sessionStorage.setItem(o_,JSON.stringify(C));const{error:N}=await J.auth.verifyOtp({token_hash:j.token_hash,type:"magiclink"});if(N)throw console.error("Verify OTP error:",N),sessionStorage.removeItem(r4),sessionStorage.removeItem(o_),new Error("Failed to establish impersonation session");return n(!0),a(C),ze.success(`Now viewing as ${C.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),ze.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(r4),sessionStorage.removeItem(o_),!1}finally{l(!1)}},h=async()=>{l(!0);try{const p=sessionStorage.getItem(r4);if(!p){await J.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(p);await J.auth.signOut();const{error:y}=await J.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(r4),sessionStorage.removeItem(o_),y){console.error("Failed to restore admin session:",y),ze.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),a(null),ze.success("Returned to admin account"),window.location.href="/admin/members"}catch(p){console.error("Stop impersonation error:",p),ze.error("Failed to restore admin session"),sessionStorage.removeItem(r4),sessionStorage.removeItem(o_),window.location.href="/auth"}finally{l(!1)}};return r.jsx(qIe.Provider,{value:{isImpersonating:e,impersonatedUser:s,startImpersonation:i,stopImpersonation:h,isLoading:o},children:t})},VIe=()=>{const t=I.useContext(qIe);if(t===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return t},eE=YC("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"}}),ee=I.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,...a},o)=>{const l=s?Dme:"button";return r.jsx(l,{className:zt(eE({variant:e,size:n,className:t})),ref:o,...a})});ee.displayName="Button";const Xrt=()=>{const{isImpersonating:t,impersonatedUser:e,stopImpersonation:n,isLoading:s}=VIe();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(Hh,{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(ee,{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(en,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(_s,{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"})]})})]})})},HIe=I.createContext(void 0),PM="levelup_acting_as",Qrt=({children:t})=>{const{user:e}=Xr(),[n,s]=I.useState(!1),[a,o]=I.useState([]),[l,i]=I.useState(null),[h,p]=I.useState({}),[x,y]=I.useState(!0);I.useEffect(()=>{if(!(e!=null&&e.id)){s(!1),o([]),i(null),p({}),y(!1);return}(async()=>{y(!0);try{const{data:A}=await J.rpc("has_role",{_user_id:e.id,_role:"assistant"});if(!A){s(!1),o([]),i(null),p({}),y(!1);return}s(!0);const{data:E,error:T}=await J.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",e.id);if(T||!E||E.length===0){o([]),y(!1);return}const P=E.map(V=>V.agent_id),{data:z}=await J.from("profiles").select("id, name, email, avatar_url").in("id",P),F=(z||[]).map(V=>({id:V.id,name:V.name||V.email||"Unknown",email:V.email||"",avatar_url:V.avatar_url}));o(F);const q=sessionStorage.getItem(PM);if(q){const V=F.find(K=>K.id===q);if(V){i(V);const K=E.find(G=>G.agent_id===q);p((K==null?void 0:K.permissions)||{})}else if(F.length>0){i(F[0]);const K=E.find(G=>G.agent_id===F[0].id);p((K==null?void 0:K.permissions)||{}),sessionStorage.setItem(PM,F[0].id)}}else if(F.length>0){i(F[0]);const V=E.find(K=>K.agent_id===F[0].id);p((V==null?void 0:V.permissions)||{}),sessionStorage.setItem(PM,F[0].id)}}catch(A){console.error("Error loading assistant data:",A)}finally{y(!1)}})()},[e==null?void 0:e.id]);const _=N=>{i(N),N?(sessionStorage.setItem(PM,N.id),J.from("agent_assistant_assignments").select("permissions").eq("assistant_id",(e==null?void 0:e.id)||"").eq("agent_id",N.id).single().then(({data:A})=>{p((A==null?void 0:A.permissions)||{})})):(sessionStorage.removeItem(PM),p({}))},j=N=>n?h[N]===!0:!0,C=n&&l?l.id:(e==null?void 0:e.id)||null;return r.jsx(HIe.Provider,{value:{isAssistant:n,assignedAgents:a,actingAsAgent:l,setActingAsAgent:_,effectiveUserId:C,permissions:h,hasPermission:j,isLoading:x},children:t})},xge=()=>{const t=I.useContext(HIe);if(t===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return t},Lc=()=>{const{effectiveUserId:t}=xge();return t};var WIe={exports:{}},GIe={};/** * @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 lC=I;function Jrt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ent=typeof Object.is=="function"?Object.is:Jrt,tnt=lC.useState,rnt=lC.useEffect,nnt=lC.useLayoutEffect,snt=lC.useDebugValue;function ant(t,e){var n=e(),s=tnt({inst:{value:n,getSnapshot:e}}),a=s[0].inst,o=s[1];return nnt(function(){a.value=n,a.getSnapshot=e,Ple(a)&&o({inst:a})},[t,n,e]),rnt(function(){return Ple(a)&&o({inst:a}),t(function(){Ple(a)&&o({inst:a})})},[t]),snt(n),n}function Ple(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ent(t,n)}catch{return!0}}function int(t,e){return e()}var ont=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?int:ant;GIe.useSyncExternalStore=lC.useSyncExternalStore!==void 0?lC.useSyncExternalStore:ont;WIe.exports=GIe;var lnt=WIe.exports;function cnt(){return lnt.useSyncExternalStore(dnt,()=>!0,()=>!1)}function dnt(){return()=>{}}var yge="Avatar",[unt]=rc(yge),[hnt,KIe]=unt(yge),ZIe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,...s}=t,[a,o]=I.useState("idle");return r.jsx(hnt,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx(Rn.span,{...s,ref:e})})});ZIe.displayName=yge;var YIe="AvatarImage",XIe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...o}=t,l=KIe(YIe,n),i=fnt(s,o),h=Ql(p=>{a(p),l.onImageLoadingStatusChange(p)});return ec(()=>{i!=="idle"&&h(i)},[i,h]),i==="loaded"?r.jsx(Rn.img,{...o,ref:e,src:s}):null});XIe.displayName=YIe;var QIe="AvatarFallback",JIe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:s,...a}=t,o=KIe(QIe,n),[l,i]=I.useState(s===void 0);return I.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>i(!0),s);return()=>window.clearTimeout(h)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Rn.span,{...a,ref:e}):null});JIe.displayName=QIe;function tje(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function fnt(t,{referrerPolicy:e,crossOrigin:n}){const s=cnt(),a=I.useRef(null),o=s?(a.current||(a.current=new window.Image),a.current):null,[l,i]=I.useState(()=>tje(o,t));return ec(()=>{i(tje(o,t))},[o,t]),ec(()=>{const h=y=>()=>{i(y)};if(!o)return;const p=h("loaded"),x=h("error");return o.addEventListener("load",p),o.addEventListener("error",x),e&&(o.referrerPolicy=e),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",p),o.removeEventListener("error",x)}},[o,n,e]),l}var ePe=ZIe,tPe=XIe,rPe=JIe;const Ks=I.forwardRef(({className:t,...e},n)=>r.jsx(ePe,{ref:n,className:zt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Ks.displayName=ePe.displayName;const Ei=I.forwardRef(({className:t,...e},n)=>r.jsx(tPe,{ref:n,className:zt("aspect-square h-full w-full",t),...e}));Ei.displayName=tPe.displayName;const Zs=I.forwardRef(({className:t,...e},n)=>r.jsx(rPe,{ref:n,className:zt("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Zs.displayName=rPe.displayName;const pnt=YC("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 Ot({className:t,variant:e,...n}){return r.jsx("div",{className:zt(pnt({variant:e}),t),...n})}var mnt=I.createContext(void 0);function ok(t){const e=I.useContext(mnt);return t||e||"ltr"}var Lle=0;function Dne(){I.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??rje()),document.body.insertAdjacentElement("beforeend",t[1]??rje()),Lle++,()=>{Lle===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Lle--}},[])}function rje(){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 Ole="focusScope.autoFocusOnMount",Dle="focusScope.autoFocusOnUnmount",nje={bubbles:!1,cancelable:!0},gnt="FocusScope",yI=I.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=t,[i,h]=I.useState(null),p=Ql(a),x=Ql(o),y=I.useRef(null),_=ta(e,N=>h(N)),j=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(s){let N=function(P){if(j.paused||!i)return;const z=P.target;i.contains(z)?y.current=z:m0(y.current,{select:!0})},A=function(P){if(j.paused||!i)return;const z=P.relatedTarget;z!==null&&(i.contains(z)||m0(y.current,{select:!0}))},E=function(P){if(document.activeElement===document.body)for(const F of P)F.removedNodes.length>0&&m0(i)};document.addEventListener("focusin",N),document.addEventListener("focusout",A);const T=new MutationObserver(E);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",A),T.disconnect()}}},[s,i,j.paused]),I.useEffect(()=>{if(i){aje.add(j);const N=document.activeElement;if(!i.contains(N)){const E=new CustomEvent(Ole,nje);i.addEventListener(Ole,p),i.dispatchEvent(E),E.defaultPrevented||(xnt(wnt(nPe(i)),{select:!0}),document.activeElement===N&&m0(i))}return()=>{i.removeEventListener(Ole,p),setTimeout(()=>{const E=new CustomEvent(Dle,nje);i.addEventListener(Dle,x),i.dispatchEvent(E),E.defaultPrevented||m0(N??document.body,{select:!0}),i.removeEventListener(Dle,x),aje.remove(j)},0)}}},[i,p,x,j]);const C=I.useCallback(N=>{if(!n&&!s||j.paused)return;const A=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(A&&E){const T=N.currentTarget,[P,z]=ynt(T);P&&z?!N.shiftKey&&E===z?(N.preventDefault(),n&&m0(P,{select:!0})):N.shiftKey&&E===P&&(N.preventDefault(),n&&m0(z,{select:!0})):E===T&&N.preventDefault()}},[n,s,j.paused]);return r.jsx(Rn.div,{tabIndex:-1,...l,ref:_,onKeyDown:C})});yI.displayName=gnt;function xnt(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(m0(s,{select:e}),document.activeElement!==n)return}function ynt(t){const e=nPe(t),n=sje(e,t),s=sje(e.reverse(),t);return[n,s]}function nPe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function sje(t,e){for(const n of t)if(!vnt(n,{upTo:e}))return n}function vnt(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 _nt(t){return t instanceof HTMLInputElement&&"select"in t}function m0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&_nt(t)&&e&&t.select()}}var aje=bnt();function bnt(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=ije(t,e),t.unshift(e)},remove(e){var n;t=ije(t,e),(n=t[0])==null||n.resume()}}}function ije(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function wnt(t){return t.filter(e=>e.tagName!=="A")}var Rle="rovingFocusGroup.onEntryFocus",jnt={bubbles:!1,cancelable:!0},vI="RovingFocusGroup",[Xue,sPe,knt]=cI(vI),[Nnt,o3]=rc(vI,[knt]),[Snt,Cnt]=Nnt(vI),aPe=I.forwardRef((t,e)=>r.jsx(Xue.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(Xue.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(Mnt,{...t,ref:e})})}));aPe.displayName=vI;var Mnt=I.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...y}=t,_=I.useRef(null),j=ta(e,_),C=ok(o),[N,A]=$u({prop:l,defaultProp:i??null,onChange:h,caller:vI}),[E,T]=I.useState(!1),P=Ql(p),z=sPe(n),F=I.useRef(!1),[q,V]=I.useState(0);return I.useEffect(()=>{const K=_.current;if(K)return K.addEventListener(Rle,P),()=>K.removeEventListener(Rle,P)},[P]),r.jsx(Snt,{scope:n,orientation:s,dir:C,loop:a,currentTabStopId:N,onItemFocus:I.useCallback(K=>A(K),[A]),onItemShiftTab:I.useCallback(()=>T(!0),[]),onFocusableItemAdd:I.useCallback(()=>V(K=>K+1),[]),onFocusableItemRemove:I.useCallback(()=>V(K=>K-1),[]),children:r.jsx(Rn.div,{tabIndex:E||q===0?-1:0,"data-orientation":s,...y,ref:j,style:{outline:"none",...t.style},onMouseDown:on(t.onMouseDown,()=>{F.current=!0}),onFocus:on(t.onFocus,K=>{const G=!F.current;if(K.target===K.currentTarget&&G&&!E){const te=new CustomEvent(Rle,jnt);if(K.currentTarget.dispatchEvent(te),!te.defaultPrevented){const ie=z().filter(se=>se.focusable),oe=ie.find(se=>se.active),ye=ie.find(se=>se.id===N),pe=[oe,ye,...ie].filter(Boolean).map(se=>se.ref.current);lPe(pe,x)}}F.current=!1}),onBlur:on(t.onBlur,()=>T(!1))})})}),iPe="RovingFocusGroupItem",oPe=I.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:o,children:l,...i}=t,h=Kc(),p=o||h,x=Cnt(iPe,n),y=x.currentTabStopId===p,_=sPe(n),{onFocusableItemAdd:j,onFocusableItemRemove:C,currentTabStopId:N}=x;return I.useEffect(()=>{if(s)return j(),()=>C()},[s,j,C]),r.jsx(Xue.ItemSlot,{scope:n,id:p,focusable:s,active:a,children:r.jsx(Rn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...i,ref:e,onMouseDown:on(t.onMouseDown,A=>{s?x.onItemFocus(p):A.preventDefault()}),onFocus:on(t.onFocus,()=>x.onItemFocus(p)),onKeyDown:on(t.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){x.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const E=Ent(A,x.orientation,x.dir);if(E!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let P=_().filter(z=>z.focusable).map(z=>z.ref.current);if(E==="last")P.reverse();else if(E==="prev"||E==="next"){E==="prev"&&P.reverse();const z=P.indexOf(A.currentTarget);P=x.loop?Int(P,z+1):P.slice(z+1)}setTimeout(()=>lPe(P))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:N!=null}):l})})});oPe.displayName=iPe;var Tnt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ant(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Ent(t,e,n){const s=Ant(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Tnt[s]}function lPe(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function Int(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var vge=aPe,_ge=oPe,Pnt=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},n4=new WeakMap,yL=new WeakMap,vL={},Fle=0,cPe=function(t){return t&&(t.host||cPe(t.parentNode))},Lnt=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=cPe(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})},Ont=function(t,e,n,s){var a=Lnt(e,Array.isArray(t)?t:[t]);vL[n]||(vL[n]=new WeakMap);var o=vL[n],l=[],i=new Set,h=new Set(a),p=function(y){!y||i.has(y)||(i.add(y),p(y.parentNode))};a.forEach(p);var x=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(_){if(i.has(_))x(_);else try{var j=_.getAttribute(s),C=j!==null&&j!=="false",N=(n4.get(_)||0)+1,A=(o.get(_)||0)+1;n4.set(_,N),o.set(_,A),l.push(_),N===1&&C&&yL.set(_,!0),A===1&&_.setAttribute(n,"true"),C||_.setAttribute(s,"true")}catch(E){console.error("aria-hidden: cannot operate on ",_,E)}})};return x(e),i.clear(),Fle++,function(){l.forEach(function(y){var _=n4.get(y)-1,j=o.get(y)-1;n4.set(y,_),o.set(y,j),_||(yL.has(y)||y.removeAttribute(s),yL.delete(y)),j||y.removeAttribute(n)}),Fle--,Fle||(n4=new WeakMap,n4=new WeakMap,yL=new WeakMap,vL={})}},Rne=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),a=Pnt(t);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),Ont(s,a,n,"aria-hidden")):function(){return null}},tee="right-scroll-bar-position",ree="width-before-scroll-bar",Dnt="with-scroll-bars-hidden",Rnt="--removed-body-scroll-bar-size";function zle(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Fnt(t,e){var n=I.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=e,n.facade}var znt=typeof window<"u"?I.useLayoutEffect:I.useEffect,oje=new WeakMap;function Bnt(t,e){var n=Fnt(null,function(s){return t.forEach(function(a){return zle(a,s)})});return znt(function(){var s=oje.get(n);if(s){var a=new Set(s),o=new Set(t),l=n.current;a.forEach(function(i){o.has(i)||zle(i,null)}),o.forEach(function(i){a.has(i)||zle(i,l)})}oje.set(n,t)},[t]),n}function $nt(t){return t}function Unt(t,e){e===void 0&&(e=$nt);var n=[],s=!1,a={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 l=e(o,s);return n.push(l),function(){n=n.filter(function(i){return i!==l})}},assignSyncMedium:function(o){for(s=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(i){return o(i)},filter:function(){return n}}},assignMedium:function(o){s=!0;var l=[];if(n.length){var i=n;n=[],i.forEach(o),l=n}var h=function(){var x=l;l=[],x.forEach(o)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(x){l.push(x),p()},filter:function(x){return l=l.filter(x),n}}}};return a}function qnt(t){t===void 0&&(t={});var e=Unt(null);return e.options=Uf({async:!0,ssr:!1},t),e}var dPe=function(t){var e=t.sideCar,n=sv(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 I.createElement(s,Uf({},n))};dPe.isSideCarExport=!0;function Vnt(t,e){return t.useMedium(e),dPe}var uPe=qnt(),Ble=function(){},Fne=I.forwardRef(function(t,e){var n=I.useRef(null),s=I.useState({onScrollCapture:Ble,onWheelCapture:Ble,onTouchMoveCapture:Ble}),a=s[0],o=s[1],l=t.forwardProps,i=t.children,h=t.className,p=t.removeScrollBar,x=t.enabled,y=t.shards,_=t.sideCar,j=t.noRelative,C=t.noIsolation,N=t.inert,A=t.allowPinchZoom,E=t.as,T=E===void 0?"div":E,P=t.gapMode,z=sv(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=_,q=Bnt([n,e]),V=Uf(Uf({},z),a);return I.createElement(I.Fragment,null,x&&I.createElement(F,{sideCar:uPe,removeScrollBar:p,shards:y,noRelative:j,noIsolation:C,inert:N,setCallbacks:o,allowPinchZoom:!!A,lockRef:n,gapMode:P}),l?I.cloneElement(I.Children.only(i),Uf(Uf({},V),{ref:q})):I.createElement(T,Uf({},V,{className:h,ref:q}),i))});Fne.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fne.classNames={fullWidth:ree,zeroRight:tee};var Hnt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Wnt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Hnt();return e&&t.setAttribute("nonce",e),t}function Gnt(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Knt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Znt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Wnt())&&(Gnt(e,n),Knt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Ynt=function(){var t=Znt();return function(e,n){I.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},hPe=function(){var t=Ynt(),e=function(n){var s=n.styles,a=n.dynamic;return t(s,a),null};return e},Xnt={left:0,top:0,right:0,gap:0},$le=function(t){return parseInt(t||"",10)||0},Qnt=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],a=e[t==="padding"?"paddingRight":"marginRight"];return[$le(n),$le(s),$le(a)]},Jnt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Xnt;var e=Qnt(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])}},est=hPe(),NS="data-scroll-locked",tst=function(t,e,n,s){var a=t.left,o=t.top,l=t.right,i=t.gap;return n===void 0&&(n="margin"),` .`.concat(Dnt,` { overflow: hidden `).concat(s,`; padding-right: `).concat(i,"px ").concat(s,`; } body[`).concat(NS,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([e&&"position: relative ".concat(s,";"),n==="margin"&&` padding-left: `.concat(a,`px; padding-top: `).concat(o,`px; padding-right: `).concat(l,`px; margin-left:0; margin-top:0; margin-right: `).concat(i,"px ").concat(s,`; `),n==="padding"&&"padding-right: ".concat(i,"px ").concat(s,";")].filter(Boolean).join(""),` } .`).concat(tee,` { right: `).concat(i,"px ").concat(s,`; } .`).concat(ree,` { margin-right: `).concat(i,"px ").concat(s,`; } .`).concat(tee," .").concat(tee,` { right: 0 `).concat(s,`; } .`).concat(ree," .").concat(ree,` { margin-right: 0 `).concat(s,`; } body[`).concat(NS,`] { `).concat(Rnt,": ").concat(i,`px; } `)},lje=function(){var t=parseInt(document.body.getAttribute(NS)||"0",10);return isFinite(t)?t:0},rst=function(){I.useEffect(function(){return document.body.setAttribute(NS,(lje()+1).toString()),function(){var t=lje()-1;t<=0?document.body.removeAttribute(NS):document.body.setAttribute(NS,t.toString())}},[])},nst=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,a=s===void 0?"margin":s;rst();var o=I.useMemo(function(){return Jnt(a)},[a]);return I.createElement(est,{styles:tst(o,!e,a,n?"":"!important")})},Que=!1;if(typeof window<"u")try{var _L=Object.defineProperty({},"passive",{get:function(){return Que=!0,!0}});window.addEventListener("test",_L,_L),window.removeEventListener("test",_L,_L)}catch{Que=!1}var s4=Que?{passive:!1}:!1,sst=function(t){return t.tagName==="TEXTAREA"},fPe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!sst(t)&&n[e]==="visible")},ast=function(t){return fPe(t,"overflowY")},ist=function(t){return fPe(t,"overflowX")},cje=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=pPe(t,s);if(a){var o=mPe(t,s),l=o[1],i=o[2];if(l>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},ost=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},lst=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},pPe=function(t,e){return t==="v"?ast(e):ist(e)},mPe=function(t,e){return t==="v"?ost(e):lst(e)},cst=function(t,e){return t==="h"&&e==="rtl"?-1:1},dst=function(t,e,n,s,a){var o=cst(t,window.getComputedStyle(e).direction),l=o*s,i=n.target,h=e.contains(i),p=!1,x=l>0,y=0,_=0;do{if(!i)break;var j=mPe(t,i),C=j[0],N=j[1],A=j[2],E=N-A-o*C;(C||E)&&pPe(t,i)&&(y+=E,_+=C);var T=i.parentNode;i=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&i!==document.body||h&&(e.contains(i)||e===i));return(x&&Math.abs(y)<1||!x&&Math.abs(_)<1)&&(p=!0),p},bL=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},dje=function(t){return[t.deltaX,t.deltaY]},uje=function(t){return t&&"current"in t?t.current:t},ust=function(t,e){return t[0]===e[0]&&t[1]===e[1]},hst=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},fst=0,a4=[];function pst(t){var e=I.useRef([]),n=I.useRef([0,0]),s=I.useRef(),a=I.useState(fst++)[0],o=I.useState(hPe)[0],l=I.useRef(t);I.useEffect(function(){l.current=t},[t]),I.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var N=lge([t.lockRef.current],(t.shards||[]).map(uje),!0).filter(Boolean);return N.forEach(function(A){return A.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),N.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var i=I.useCallback(function(N,A){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!l.current.allowPinchZoom;var E=bL(N),T=n.current,P="deltaX"in N?N.deltaX:T[0]-E[0],z="deltaY"in N?N.deltaY:T[1]-E[1],F,q=N.target,V=Math.abs(P)>Math.abs(z)?"h":"v";if("touches"in N&&V==="h"&&q.type==="range")return!1;var K=cje(V,q);if(!K)return!0;if(K?F=V:(F=V==="v"?"h":"v",K=cje(V,q)),!K)return!1;if(!s.current&&"changedTouches"in N&&(P||z)&&(s.current=F),!F)return!0;var G=s.current||F;return dst(G,A,N,G==="h"?P:z)},[]),h=I.useCallback(function(N){var A=N;if(!(!a4.length||a4[a4.length-1]!==o)){var E="deltaY"in A?dje(A):bL(A),T=e.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&ust(F.delta,E)})[0];if(T&&T.should){A.cancelable&&A.preventDefault();return}if(!T){var P=(l.current.shards||[]).map(uje).filter(Boolean).filter(function(F){return F.contains(A.target)}),z=P.length>0?i(A,P[0]):!l.current.noIsolation;z&&A.cancelable&&A.preventDefault()}}},[]),p=I.useCallback(function(N,A,E,T){var P={name:N,delta:A,target:E,should:T,shadowParent:mst(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(z){return z!==P})},1)},[]),x=I.useCallback(function(N){n.current=bL(N),s.current=void 0},[]),y=I.useCallback(function(N){p(N.type,dje(N),N.target,i(N,t.lockRef.current))},[]),_=I.useCallback(function(N){p(N.type,bL(N),N.target,i(N,t.lockRef.current))},[]);I.useEffect(function(){return a4.push(o),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:_}),document.addEventListener("wheel",h,s4),document.addEventListener("touchmove",h,s4),document.addEventListener("touchstart",x,s4),function(){a4=a4.filter(function(N){return N!==o}),document.removeEventListener("wheel",h,s4),document.removeEventListener("touchmove",h,s4),document.removeEventListener("touchstart",x,s4)}},[]);var j=t.removeScrollBar,C=t.inert;return I.createElement(I.Fragment,null,C?I.createElement(o,{styles:hst(a)}):null,j?I.createElement(nst,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function mst(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const gst=Vnt(uPe,pst);var _I=I.forwardRef(function(t,e){return I.createElement(Fne,Uf({},t,{ref:e,sideCar:gst}))});_I.classNames=Fne.classNames;var Jue=["Enter"," "],xst=["ArrowDown","PageUp","Home"],gPe=["ArrowUp","PageDown","End"],yst=[...xst,...gPe],vst={ltr:[...Jue,"ArrowRight"],rtl:[...Jue,"ArrowLeft"]},_st={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bI="Menu",[tE,bst,wst]=cI(bI),[lk,xPe]=rc(bI,[wst,Bg,o3]),zne=Bg(),yPe=o3(),[jst,ck]=lk(bI),[kst,wI]=lk(bI),vPe=t=>{const{__scopeMenu:e,open:n=!1,children:s,dir:a,onOpenChange:o,modal:l=!0}=t,i=zne(e),[h,p]=I.useState(null),x=I.useRef(!1),y=Ql(o),_=ok(a);return I.useEffect(()=>{const j=()=>{x.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>x.current=!1;return document.addEventListener("keydown",j,{capture:!0}),()=>{document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),r.jsx(fI,{...i,children:r.jsx(jst,{scope:e,open:n,onOpenChange:y,content:h,onContentChange:p,children:r.jsx(kst,{scope:e,onClose:I.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:_,modal:l,children:s})})})};vPe.displayName=bI;var Nst="MenuAnchor",bge=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,a=zne(n);return r.jsx(e3,{...a,...s,ref:e})});bge.displayName=Nst;var wge="MenuPortal",[Sst,_Pe]=lk(wge,{forceMount:void 0}),bPe=t=>{const{__scopeMenu:e,forceMount:n,children:s,container:a}=t,o=ck(wge,e);return r.jsx(Sst,{scope:e,forceMount:n,children:r.jsx(xc,{present:n||o.open,children:r.jsx(ZC,{asChild:!0,container:a,children:s})})})};bPe.displayName=wge;var tp="MenuContent",[Cst,jge]=lk(tp),wPe=I.forwardRef((t,e)=>{const n=_Pe(tp,t.__scopeMenu),{forceMount:s=n.forceMount,...a}=t,o=ck(tp,t.__scopeMenu),l=wI(tp,t.__scopeMenu);return r.jsx(tE.Provider,{scope:t.__scopeMenu,children:r.jsx(xc,{present:s||o.open,children:r.jsx(tE.Slot,{scope:t.__scopeMenu,children:l.modal?r.jsx(Mst,{...a,ref:e}):r.jsx(Tst,{...a,ref:e})})})})}),Mst=I.forwardRef((t,e)=>{const n=ck(tp,t.__scopeMenu),s=I.useRef(null),a=ta(e,s);return I.useEffect(()=>{const o=s.current;if(o)return Rne(o)},[]),r.jsx(kge,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:on(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tst=I.forwardRef((t,e)=>{const n=ck(tp,t.__scopeMenu);return r.jsx(kge,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ast=z1("MenuContent.ScrollLock"),kge=I.forwardRef((t,e)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:_,onDismiss:j,disableOutsideScroll:C,...N}=t,A=ck(tp,n),E=wI(tp,n),T=zne(n),P=yPe(n),z=bst(n),[F,q]=I.useState(null),V=I.useRef(null),K=ta(e,V,A.onContentChange),G=I.useRef(0),te=I.useRef(""),ie=I.useRef(0),oe=I.useRef(null),ye=I.useRef("right"),ae=I.useRef(0),pe=C?_I:I.Fragment,se=C?{as:Ast,allowPinchZoom:!0}:void 0,he=_e=>{var Ee,Ue;const Ae=te.current+_e,Ce=z().filter(Fe=>!Fe.disabled),Se=document.activeElement,ge=(Ee=Ce.find(Fe=>Fe.ref.current===Se))==null?void 0:Ee.textValue,Le=Ce.map(Fe=>Fe.textValue),ke=Ust(Le,Ae,ge),Be=(Ue=Ce.find(Fe=>Fe.textValue===ke))==null?void 0:Ue.ref.current;(function Fe(be){te.current=be,window.clearTimeout(G.current),be!==""&&(G.current=window.setTimeout(()=>Fe(""),1e3))})(Ae),Be&&setTimeout(()=>Be.focus())};I.useEffect(()=>()=>window.clearTimeout(G.current),[]),Dne();const ue=I.useCallback(_e=>{var Ce,Se;return ye.current===((Ce=oe.current)==null?void 0:Ce.side)&&Vst(_e,(Se=oe.current)==null?void 0:Se.area)},[]);return r.jsx(Cst,{scope:n,searchRef:te,onItemEnter:I.useCallback(_e=>{ue(_e)&&_e.preventDefault()},[ue]),onItemLeave:I.useCallback(_e=>{var Ae;ue(_e)||((Ae=V.current)==null||Ae.focus(),q(null))},[ue]),onTriggerLeave:I.useCallback(_e=>{ue(_e)&&_e.preventDefault()},[ue]),pointerGraceTimerRef:ie,onPointerGraceIntentChange:I.useCallback(_e=>{oe.current=_e},[]),children:r.jsx(pe,{...se,children:r.jsx(yI,{asChild:!0,trapped:a,onMountAutoFocus:on(o,_e=>{var Ae;_e.preventDefault(),(Ae=V.current)==null||Ae.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(rv,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:_,onDismiss:j,children:r.jsx(vge,{asChild:!0,...P,dir:E.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:q,onEntryFocus:on(h,_e=>{E.isUsingKeyboardRef.current||_e.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(pI,{role:"menu","aria-orientation":"vertical","data-state":FPe(A.open),"data-radix-menu-content":"",dir:E.dir,...T,...N,ref:K,style:{outline:"none",...N.style},onKeyDown:on(N.onKeyDown,_e=>{const Ce=_e.target.closest("[data-radix-menu-content]")===_e.currentTarget,Se=_e.ctrlKey||_e.altKey||_e.metaKey,ge=_e.key.length===1;Ce&&(_e.key==="Tab"&&_e.preventDefault(),!Se&&ge&&he(_e.key));const Le=V.current;if(_e.target!==Le||!yst.includes(_e.key))return;_e.preventDefault();const Be=z().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);gPe.includes(_e.key)&&Be.reverse(),Bst(Be)}),onBlur:on(t.onBlur,_e=>{_e.currentTarget.contains(_e.target)||(window.clearTimeout(G.current),te.current="")}),onPointerMove:on(t.onPointerMove,rE(_e=>{const Ae=_e.target,Ce=ae.current!==_e.clientX;if(_e.currentTarget.contains(Ae)&&Ce){const Se=_e.clientX>ae.current?"right":"left";ye.current=Se,ae.current=_e.clientX}}))})})})})})})});wPe.displayName=tp;var Est="MenuGroup",Nge=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{role:"group",...s,ref:e})});Nge.displayName=Est;var Ist="MenuLabel",jPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});jPe.displayName=Ist;var Yee="MenuItem",hje="menu.itemSelect",Bne=I.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:s,...a}=t,o=I.useRef(null),l=wI(Yee,t.__scopeMenu),i=jge(Yee,t.__scopeMenu),h=ta(e,o),p=I.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const _=new CustomEvent(hje,{bubbles:!0,cancelable:!0});y.addEventListener(hje,j=>s==null?void 0:s(j),{once:!0}),Rme(y,_),_.defaultPrevented?p.current=!1:l.onClose()}};return r.jsx(kPe,{...a,ref:h,disabled:n,onClick:on(t.onClick,x),onPointerDown:y=>{var _;(_=t.onPointerDown)==null||_.call(t,y),p.current=!0},onPointerUp:on(t.onPointerUp,y=>{var _;p.current||(_=y.currentTarget)==null||_.click()}),onKeyDown:on(t.onKeyDown,y=>{const _=i.searchRef.current!=="";n||_&&y.key===" "||Jue.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Bne.displayName=Yee;var kPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...o}=t,l=jge(Yee,n),i=yPe(n),h=I.useRef(null),p=ta(e,h),[x,y]=I.useState(!1),[_,j]=I.useState("");return I.useEffect(()=>{const C=h.current;C&&j((C.textContent??"").trim())},[o.children]),r.jsx(tE.ItemSlot,{scope:n,disabled:s,textValue:a??_,children:r.jsx(_ge,{asChild:!0,...i,focusable:!s,children:r.jsx(Rn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:p,onPointerMove:on(t.onPointerMove,rE(C=>{s?l.onItemLeave(C):(l.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:on(t.onPointerLeave,rE(C=>l.onItemLeave(C))),onFocus:on(t.onFocus,()=>y(!0)),onBlur:on(t.onBlur,()=>y(!1))})})})}),Pst="MenuCheckboxItem",NPe=I.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:s,...a}=t;return r.jsx(APe,{scope:t.__scopeMenu,checked:n,children:r.jsx(Bne,{role:"menuitemcheckbox","aria-checked":Xee(n)?"mixed":n,...a,ref:e,"data-state":Cge(n),onSelect:on(a.onSelect,()=>s==null?void 0:s(Xee(n)?!0:!n),{checkForDefaultPrevented:!1})})})});NPe.displayName=Pst;var SPe="MenuRadioGroup",[Lst,Ost]=lk(SPe,{value:void 0,onValueChange:()=>{}}),CPe=I.forwardRef((t,e)=>{const{value:n,onValueChange:s,...a}=t,o=Ql(s);return r.jsx(Lst,{scope:t.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Nge,{...a,ref:e})})});CPe.displayName=SPe;var MPe="MenuRadioItem",TPe=I.forwardRef((t,e)=>{const{value:n,...s}=t,a=Ost(MPe,t.__scopeMenu),o=n===a.value;return r.jsx(APe,{scope:t.__scopeMenu,checked:o,children:r.jsx(Bne,{role:"menuitemradio","aria-checked":o,...s,ref:e,"data-state":Cge(o),onSelect:on(s.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,n)},{checkForDefaultPrevented:!1})})})});TPe.displayName=MPe;var Sge="MenuItemIndicator",[APe,Dst]=lk(Sge,{checked:!1}),EPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:s,...a}=t,o=Dst(Sge,n);return r.jsx(xc,{present:s||Xee(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{...a,ref:e,"data-state":Cge(o.checked)})})});EPe.displayName=Sge;var Rst="MenuSeparator",IPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:e})});IPe.displayName=Rst;var Fst="MenuArrow",PPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,a=zne(n);return r.jsx(mI,{...a,...s,ref:e})});PPe.displayName=Fst;var zst="MenuSub",[qKt,LPe]=lk(zst),oT="MenuSubTrigger",OPe=I.forwardRef((t,e)=>{const n=ck(oT,t.__scopeMenu),s=wI(oT,t.__scopeMenu),a=LPe(oT,t.__scopeMenu),o=jge(oT,t.__scopeMenu),l=I.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:h}=o,p={__scopeMenu:t.__scopeMenu},x=I.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return I.useEffect(()=>x,[x]),I.useEffect(()=>{const y=i.current;return()=>{window.clearTimeout(y),h(null)}},[i,h]),r.jsx(bge,{asChild:!0,...p,children:r.jsx(kPe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":FPe(n.open),...t,ref:iy(e,a.onTriggerChange),onClick:y=>{var _;(_=t.onClick)==null||_.call(t,y),!(t.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:on(t.onPointerMove,rE(y=>{o.onItemEnter(y),!y.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),x()},100))})),onPointerLeave:on(t.onPointerLeave,rE(y=>{var j,C;x();const _=(j=n.content)==null?void 0:j.getBoundingClientRect();if(_){const N=(C=n.content)==null?void 0:C.dataset.side,A=N==="right",E=A?-5:5,T=_[A?"left":"right"],P=_[A?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+E,y:y.clientY},{x:T,y:_.top},{x:P,y:_.top},{x:P,y:_.bottom},{x:T,y:_.bottom}],side:N}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:on(t.onKeyDown,y=>{var j;const _=o.searchRef.current!=="";t.disabled||_&&y.key===" "||vst[s.dir].includes(y.key)&&(n.onOpenChange(!0),(j=n.content)==null||j.focus(),y.preventDefault())})})})});OPe.displayName=oT;var DPe="MenuSubContent",RPe=I.forwardRef((t,e)=>{const n=_Pe(tp,t.__scopeMenu),{forceMount:s=n.forceMount,...a}=t,o=ck(tp,t.__scopeMenu),l=wI(tp,t.__scopeMenu),i=LPe(DPe,t.__scopeMenu),h=I.useRef(null),p=ta(e,h);return r.jsx(tE.Provider,{scope:t.__scopeMenu,children:r.jsx(xc,{present:s||o.open,children:r.jsx(tE.Slot,{scope:t.__scopeMenu,children:r.jsx(kge,{id:i.contentId,"aria-labelledby":i.triggerId,...a,ref:p,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var y;l.isUsingKeyboardRef.current&&((y=h.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:on(t.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:on(t.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:on(t.onKeyDown,x=>{var j;const y=x.currentTarget.contains(x.target),_=_st[l.dir].includes(x.key);y&&_&&(o.onOpenChange(!1),(j=i.trigger)==null||j.focus(),x.preventDefault())})})})})})});RPe.displayName=DPe;function FPe(t){return t?"open":"closed"}function Xee(t){return t==="indeterminate"}function Cge(t){return Xee(t)?"indeterminate":t?"checked":"unchecked"}function Bst(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function $st(t,e){return t.map((n,s)=>t[(e+s)%t.length])}function Ust(t,e,n){const a=e.length>1&&Array.from(e).every(p=>p===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let l=$st(t,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function qst(t,e){const{x:n,y:s}=t;let a=!1;for(let o=0,l=e.length-1;os!=_>s&&n<(y-p)*(s-x)/(_-x)+p&&(a=!a)}return a}function Vst(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return qst(n,e)}function rE(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Hst=vPe,Wst=bge,Gst=bPe,Kst=wPe,Zst=Nge,Yst=jPe,Xst=Bne,Qst=NPe,Jst=CPe,eat=TPe,tat=EPe,rat=IPe,nat=PPe,sat=OPe,aat=RPe,$ne="DropdownMenu",[iat]=rc($ne,[xPe]),Wu=xPe(),[oat,zPe]=iat($ne),BPe=t=>{const{__scopeDropdownMenu:e,children:n,dir:s,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=t,h=Wu(e),p=I.useRef(null),[x,y]=$u({prop:a,defaultProp:o??!1,onChange:l,caller:$ne});return r.jsx(oat,{scope:e,triggerId:Kc(),triggerRef:p,contentId:Kc(),open:x,onOpenChange:y,onOpenToggle:I.useCallback(()=>y(_=>!_),[y]),modal:i,children:r.jsx(Hst,{...h,open:x,onOpenChange:y,dir:s,modal:i,children:n})})};BPe.displayName=$ne;var $Pe="DropdownMenuTrigger",UPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=t,o=zPe($Pe,n),l=Wu(n);return r.jsx(Wst,{asChild:!0,...l,children:r.jsx(Rn.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,...a,ref:iy(e,o.triggerRef),onPointerDown:on(t.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:on(t.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});UPe.displayName=$Pe;var lat="DropdownMenuPortal",qPe=t=>{const{__scopeDropdownMenu:e,...n}=t,s=Wu(e);return r.jsx(Gst,{...s,...n})};qPe.displayName=lat;var VPe="DropdownMenuContent",HPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=zPe(VPe,n),o=Wu(n),l=I.useRef(!1);return r.jsx(Kst,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...s,ref:e,onCloseAutoFocus:on(t.onCloseAutoFocus,i=>{var h;l.current||(h=a.triggerRef.current)==null||h.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:on(t.onInteractOutside,i=>{const h=i.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,x=h.button===2||p;(!a.modal||x)&&(l.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)"}})});HPe.displayName=VPe;var cat="DropdownMenuGroup",dat=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(Zst,{...a,...s,ref:e})});dat.displayName=cat;var uat="DropdownMenuLabel",WPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(Yst,{...a,...s,ref:e})});WPe.displayName=uat;var hat="DropdownMenuItem",GPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(Xst,{...a,...s,ref:e})});GPe.displayName=hat;var fat="DropdownMenuCheckboxItem",KPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(Qst,{...a,...s,ref:e})});KPe.displayName=fat;var pat="DropdownMenuRadioGroup",mat=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(Jst,{...a,...s,ref:e})});mat.displayName=pat;var gat="DropdownMenuRadioItem",ZPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(eat,{...a,...s,ref:e})});ZPe.displayName=gat;var xat="DropdownMenuItemIndicator",YPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(tat,{...a,...s,ref:e})});YPe.displayName=xat;var yat="DropdownMenuSeparator",XPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(rat,{...a,...s,ref:e})});XPe.displayName=yat;var vat="DropdownMenuArrow",_at=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(nat,{...a,...s,ref:e})});_at.displayName=vat;var bat="DropdownMenuSubTrigger",QPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(sat,{...a,...s,ref:e})});QPe.displayName=bat;var wat="DropdownMenuSubContent",JPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Wu(n);return r.jsx(aat,{...a,...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)"}})});JPe.displayName=wat;var jat=BPe,kat=UPe,Nat=qPe,e6e=HPe,t6e=WPe,r6e=GPe,n6e=KPe,s6e=ZPe,a6e=YPe,i6e=XPe,o6e=QPe,l6e=JPe;const jh=jat,kh=kat,Sat=I.forwardRef(({className:t,inset:e,children:n,...s},a)=>r.jsxs(o6e,{ref:a,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(Vi,{className:"ml-auto h-4 w-4"})]}));Sat.displayName=o6e.displayName;const Cat=I.forwardRef(({className:t,...e},n)=>r.jsx(l6e,{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}));Cat.displayName=l6e.displayName;const Gu=I.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(Nat,{children:r.jsx(e6e,{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})}));Gu.displayName=e6e.displayName;const di=I.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(r6e,{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}));di.displayName=r6e.displayName;const Mat=I.forwardRef(({className:t,children:e,checked:n,...s},a)=>r.jsxs(n6e,{ref:a,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(a6e,{children:r.jsx(Ai,{className:"h-4 w-4"})})}),e]}));Mat.displayName=n6e.displayName;const Tat=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(s6e,{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(a6e,{children:r.jsx(Bu,{className:"h-2 w-2 fill-current"})})}),e]}));Tat.displayName=s6e.displayName;const ehe=I.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(t6e,{ref:s,className:zt("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));ehe.displayName=t6e.displayName;const Bj=I.forwardRef(({className:t,...e},n)=>r.jsx(i6e,{ref:n,className:zt("-mx-1 my-1 h-px bg-muted",t),...e}));Bj.displayName=i6e.displayName;const Aat=()=>{const{isAssistant:t,actingAsAgent:e,assignedAgents:n,setActingAsAgent:s}=xge();if(!(t&&!!e))return null;const o=l=>l.split(" ").map(i=>i[0]).join("").toUpperCase().slice(0,2);return r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[2147483647] bg-primary text-primary-foreground px-4 py-1.5 shadow-lg",style:{height:"40px"},children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4 h-full",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Bn,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),n.length>1?r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"secondary",size:"sm",className:"gap-2 bg-primary-foreground/20 hover:bg-primary-foreground/30 text-primary-foreground border-0",children:[r.jsxs(Ks,{className:"h-5 w-5",children:[r.jsx(Ei,{src:e.avatar_url||void 0}),r.jsx(Zs,{className:"text-[10px] bg-primary-foreground/30",children:o(e.name)})]}),r.jsx("strong",{children:e.name}),r.jsx(Fd,{className:"h-3 w-3"})]})}),r.jsx(Gu,{align:"start",children:n.map(l=>r.jsxs(di,{onClick:()=>s(l),className:"gap-2",children:[r.jsxs(Ks,{className:"h-6 w-6",children:[r.jsx(Ei,{src:l.avatar_url||void 0}),r.jsx(Zs,{className:"text-[10px]",children:o(l.name)})]}),r.jsx("span",{children:l.name}),l.id===e.id&&r.jsx(Ot,{variant:"secondary",className:"ml-auto text-[10px]",children:"Current"})]},l.id))})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ks,{className:"h-5 w-5",children:[r.jsx(Ei,{src:e.avatar_url||void 0}),r.jsx(Zs,{className:"text-[10px] bg-primary-foreground/30",children:o(e.name)})]}),r.jsx("strong",{children:e.name})]})]}),r.jsx(Ot,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Mn=({children:t,requireAdmin:e=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:a,isAdmin:o,isBrokerageManager:l}=Xr();return a?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(_le,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(_le,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:t}):r.jsx(_le,{to:"/auth",replace:!0})};var Mge={};(function t(e,n,s,a){var o=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),l=typeof Path2D=="function"&&typeof DOMMatrix=="function",i=function(){if(!e.OffscreenCanvas)return!1;try{var Ae=new OffscreenCanvas(1,1),Ce=Ae.getContext("2d");Ce.fillRect(0,0,1,1);var Se=Ae.transferToImageBitmap();Ce.createPattern(Se,"no-repeat")}catch{return!1}return!0}();function h(){}function p(Ae){var Ce=n.exports.Promise,Se=Ce!==void 0?Ce:e.Promise;return typeof Se=="function"?new Se(Ae):(Ae(h,h),null)}var x=function(Ae,Ce){return{transform:function(Se){if(Ae)return Se;if(Ce.has(Se))return Ce.get(Se);var ge=new OffscreenCanvas(Se.width,Se.height),Le=ge.getContext("2d");return Le.drawImage(Se,0,0),Ce.set(Se,ge),ge},clear:function(){Ce.clear()}}}(i,new Map),y=function(){var Ae=Math.floor(16.666666666666668),Ce,Se,ge={},Le=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Ce=function(ke){var Be=Math.random();return ge[Be]=requestAnimationFrame(function Ee(Ue){Le===Ue||Le+Ae-1{const{data:e,error:n}=await J.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 Iat(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}function Pat(){const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{error:s}=await J.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 Une="Dialog",[c6e,d6e]=rc(Une),[Lat,Cm]=c6e(Une),u6e=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,i=I.useRef(null),h=I.useRef(null),[p,x]=$u({prop:s,defaultProp:a??!1,onChange:o,caller:Une});return r.jsx(Lat,{scope:e,triggerRef:i,contentRef:h,contentId:Kc(),titleId:Kc(),descriptionId:Kc(),open:p,onOpenChange:x,onOpenToggle:I.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};u6e.displayName=Une;var h6e="DialogTrigger",f6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Cm(h6e,n),o=ta(e,a.triggerRef);return r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Ege(a.open),...s,ref:o,onClick:on(t.onClick,a.onOpenToggle)})});f6e.displayName=h6e;var Tge="DialogPortal",[Oat,p6e]=c6e(Tge,{forceMount:void 0}),m6e=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:a}=t,o=Cm(Tge,e);return r.jsx(Oat,{scope:e,forceMount:n,children:I.Children.map(s,l=>r.jsx(xc,{present:n||o.open,children:r.jsx(ZC,{asChild:!0,container:a,children:l})}))})};m6e.displayName=Tge;var Qee="DialogOverlay",g6e=I.forwardRef((t,e)=>{const n=p6e(Qee,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,o=Cm(Qee,t.__scopeDialog);return o.modal?r.jsx(xc,{present:s||o.open,children:r.jsx(Rat,{...a,ref:e})}):null});g6e.displayName=Qee;var Dat=z1("DialogOverlay.RemoveScroll"),Rat=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Cm(Qee,n);return r.jsx(_I,{as:Dat,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Rn.div,{"data-state":Ege(a.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),$j="DialogContent",x6e=I.forwardRef((t,e)=>{const n=p6e($j,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,o=Cm($j,t.__scopeDialog);return r.jsx(xc,{present:s||o.open,children:o.modal?r.jsx(Fat,{...a,ref:e}):r.jsx(zat,{...a,ref:e})})});x6e.displayName=$j;var Fat=I.forwardRef((t,e)=>{const n=Cm($j,t.__scopeDialog),s=I.useRef(null),a=ta(e,n.contentRef,s);return I.useEffect(()=>{const o=s.current;if(o)return Rne(o)},[]),r.jsx(y6e,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:on(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:on(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:on(t.onFocusOutside,o=>o.preventDefault())})}),zat=I.forwardRef((t,e)=>{const n=Cm($j,t.__scopeDialog),s=I.useRef(!1),a=I.useRef(!1);return r.jsx(y6e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),y6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=t,i=Cm($j,n),h=I.useRef(null),p=ta(e,h);return Dne(),r.jsxs(r.Fragment,{children:[r.jsx(yI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(rv,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Ege(i.open),...l,ref:p,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx($at,{titleId:i.titleId}),r.jsx(qat,{contentRef:h,descriptionId:i.descriptionId})]})]})}),Age="DialogTitle",v6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Cm(Age,n);return r.jsx(Rn.h2,{id:a.titleId,...s,ref:e})});v6e.displayName=Age;var _6e="DialogDescription",b6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Cm(_6e,n);return r.jsx(Rn.p,{id:a.descriptionId,...s,ref:e})});b6e.displayName=_6e;var w6e="DialogClose",j6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Cm(w6e,n);return r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:on(t.onClick,()=>a.onOpenChange(!1))})});j6e.displayName=w6e;function Ege(t){return t?"open":"closed"}var k6e="DialogTitleWarning",[Bat,N6e]=xKe(k6e,{contentName:$j,titleName:Age,docsSlug:"dialog"}),$at=({titleId:t})=>{const e=N6e(k6e),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 I.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Uat="DialogDescriptionWarning",qat=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${N6e(Uat).contentName}}.`;return I.useEffect(()=>{var o;const a=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},qne=u6e,Ige=f6e,Vne=m6e,l3=g6e,c3=x6e,jI=v6e,kI=b6e,Hne=j6e;const Fr=qne,Bo=Ige,Vat=Vne,S6e=I.forwardRef(({className:t,...e},n)=>r.jsx(l3,{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}));S6e.displayName=l3.displayName;const Rr=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(Vat,{children:[r.jsx(S6e,{}),r.jsxs(c3,{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(Hne,{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(_s,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rr.displayName=c3.displayName;const qr=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});qr.displayName="DialogHeader";const ea=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ea.displayName="DialogFooter";const $r=I.forwardRef(({className:t,...e},n)=>r.jsx(jI,{ref:n,className:zt("text-lg font-semibold leading-none tracking-tight",t),...e}));$r.displayName=jI.displayName;const Qn=I.forwardRef(({className:t,...e},n)=>r.jsx(kI,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Qn.displayName=kI.displayName;const Hat={points_earned:Zi,listing_created:da,deal_closed:fd,custom:vs},pje={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 Wat(){const{user:t}=Xr(),e=Vr(),{data:n}=Eat(),s=Iat(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=I.useCallback(()=>{const j=Date.now()+3e3,C={startVelocity:30,spread:360,ticks:60,zIndex:9999},N=(E,T)=>Math.random()*(T-E)+E,A=setInterval(()=>{const E=j-Date.now();if(E<=0){clearInterval(A);return}const T=50*(E/3e3);fje({...C,particleCount:T,origin:{x:N(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),fje({...C,particleCount:T,origin:{x:N(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);I.useEffect(()=>{n&&n.length>0&&!a&&(o(n[0]),i(!0),setTimeout(h,100))},[n,a,h]);const p=async()=>{if(a){const _=a.id;i(!1),o(null),e.setQueryData(["celebrations","pending",t==null?void 0:t.id],j=>(j==null?void 0:j.filter(C=>C.id!==_))??[]),await s.mutateAsync(_)}};if(!a)return null;const x=Hat[a.celebration_type]||vs,y=pje[a.celebration_type]||pje.custom;return r.jsx(Fr,{open:l,onOpenChange:_=>!_&&p(),children:r.jsxs(Rr,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${y} 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 ${y} flex items-center justify-center animate-bounce`,children:r.jsx(x,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[r.jsx(Ms,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Ms,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Ms,{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:["🎉 ",a.title]}),a.points_amount&&a.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",a.points_amount," points!"]}),a.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:a.message}),r.jsx(ee,{onClick:p,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 C6e="/assets/levelup-logo-horizontal-DEFNc0ms.png",Pge="/assets/levelup-logo-white-C2RAgAoG.png",Gat="/assets/listings-hero-BI9Ki9Dq.jpg",dt=I.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}));dt.displayName="Input";var M6e={exports:{}};(function(t,e){(function(n,s){t.exports=s()})(Ix,function(){var n,s,a;function o(i,h){if(!n)n=h;else if(!s)s=h;else{var p="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;",x={};n(x),a=h(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([p],{type:"text/javascript"})))}}o(["exports"],function(i){var h=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=u*k-v*g;return S?(f[0]=k*(S=1/S),f[1]=-g*S,f[2]=-v*S,f[3]=u*S,f):null}function y(){var f=new p(9);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[5]=0,f[6]=0,f[7]=0),f[0]=1,f[4]=1,f[8]=1,f}function _(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=c[4],L=c[5],R=c[6],$=c[7],W=c[8];return f[0]=S*W-L*$,f[1]=v*$-g*W,f[2]=g*L-v*S,f[3]=L*R-k*W,f[4]=u*W-v*R,f[5]=v*k-u*L,f[6]=k*$-S*R,f[7]=g*R-u*$,f[8]=u*S-g*k,f}function j(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],L=c[4],R=c[5],$=c[6],W=c[7],Z=c[8],X=u[0],re=u[1],ne=u[2],fe=u[3],Ne=u[4],je=u[5],Re=u[6],$e=u[7],Ze=u[8];return f[0]=X*g+re*S+ne*$,f[1]=X*v+re*L+ne*W,f[2]=X*k+re*R+ne*Z,f[3]=fe*g+Ne*S+je*$,f[4]=fe*v+Ne*L+je*W,f[5]=fe*k+Ne*R+je*Z,f[6]=Re*g+$e*S+Ze*$,f[7]=Re*v+$e*L+Ze*W,f[8]=Re*k+$e*R+Ze*Z,f}function C(){var f=new p(16);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f}function N(f){var c=new p(16);return c[0]=f[0],c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=f[6],c[7]=f[7],c[8]=f[8],c[9]=f[9],c[10]=f[10],c[11]=f[11],c[12]=f[12],c[13]=f[13],c[14]=f[14],c[15]=f[15],c}function A(f){return f[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function E(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=c[4],L=c[5],R=c[6],$=c[7],W=c[8],Z=c[9],X=c[10],re=c[11],ne=c[12],fe=c[13],Ne=c[14],je=c[15],Re=u*L-g*S,$e=u*R-v*S,Ze=u*$-k*S,ht=g*R-v*L,ot=g*$-k*L,_t=v*$-k*R,Ct=W*fe-Z*ne,Et=W*Ne-X*ne,Kt=W*je-re*ne,Rt=Z*Ne-X*fe,rr=Z*je-re*fe,or=X*je-re*Ne,lr=Re*or-$e*rr+Ze*Rt+ht*Kt-ot*Et+_t*Ct;return lr?(f[0]=(L*or-R*rr+$*Rt)*(lr=1/lr),f[1]=(v*rr-g*or-k*Rt)*lr,f[2]=(fe*_t-Ne*ot+je*ht)*lr,f[3]=(X*ot-Z*_t-re*ht)*lr,f[4]=(R*Kt-S*or-$*Et)*lr,f[5]=(u*or-v*Kt+k*Et)*lr,f[6]=(Ne*Ze-ne*_t-je*$e)*lr,f[7]=(W*_t-X*Ze+re*$e)*lr,f[8]=(S*rr-L*Kt+$*Ct)*lr,f[9]=(g*Kt-u*rr-k*Ct)*lr,f[10]=(ne*ot-fe*Ze+je*Re)*lr,f[11]=(Z*Ze-W*ot-re*Re)*lr,f[12]=(L*Et-S*Rt-R*Ct)*lr,f[13]=(u*Rt-g*Et+v*Ct)*lr,f[14]=(fe*$e-ne*ht-Ne*Re)*lr,f[15]=(W*ht-Z*$e+X*Re)*lr,f):null}function T(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],L=c[4],R=c[5],$=c[6],W=c[7],Z=c[8],X=c[9],re=c[10],ne=c[11],fe=c[12],Ne=c[13],je=c[14],Re=c[15],$e=u[0],Ze=u[1],ht=u[2],ot=u[3];return f[0]=$e*g+Ze*L+ht*Z+ot*fe,f[1]=$e*v+Ze*R+ht*X+ot*Ne,f[2]=$e*k+Ze*$+ht*re+ot*je,f[3]=$e*S+Ze*W+ht*ne+ot*Re,f[4]=($e=u[4])*g+(Ze=u[5])*L+(ht=u[6])*Z+(ot=u[7])*fe,f[5]=$e*v+Ze*R+ht*X+ot*Ne,f[6]=$e*k+Ze*$+ht*re+ot*je,f[7]=$e*S+Ze*W+ht*ne+ot*Re,f[8]=($e=u[8])*g+(Ze=u[9])*L+(ht=u[10])*Z+(ot=u[11])*fe,f[9]=$e*v+Ze*R+ht*X+ot*Ne,f[10]=$e*k+Ze*$+ht*re+ot*je,f[11]=$e*S+Ze*W+ht*ne+ot*Re,f[12]=($e=u[12])*g+(Ze=u[13])*L+(ht=u[14])*Z+(ot=u[15])*fe,f[13]=$e*v+Ze*R+ht*X+ot*Ne,f[14]=$e*k+Ze*$+ht*re+ot*je,f[15]=$e*S+Ze*W+ht*ne+ot*Re,f}function P(f,c,u){var g,v,k,S,L,R,$,W,Z,X,re,ne,fe=u[0],Ne=u[1],je=u[2];return c===f?(f[12]=c[0]*fe+c[4]*Ne+c[8]*je+c[12],f[13]=c[1]*fe+c[5]*Ne+c[9]*je+c[13],f[14]=c[2]*fe+c[6]*Ne+c[10]*je+c[14],f[15]=c[3]*fe+c[7]*Ne+c[11]*je+c[15]):(v=c[1],k=c[2],S=c[3],L=c[4],R=c[5],$=c[6],W=c[7],Z=c[8],X=c[9],re=c[10],ne=c[11],f[0]=g=c[0],f[1]=v,f[2]=k,f[3]=S,f[4]=L,f[5]=R,f[6]=$,f[7]=W,f[8]=Z,f[9]=X,f[10]=re,f[11]=ne,f[12]=g*fe+L*Ne+Z*je+c[12],f[13]=v*fe+R*Ne+X*je+c[13],f[14]=k*fe+$*Ne+re*je+c[14],f[15]=S*fe+W*Ne+ne*je+c[15]),f}function z(f,c,u){var g=u[0],v=u[1],k=u[2];return f[0]=c[0]*g,f[1]=c[1]*g,f[2]=c[2]*g,f[3]=c[3]*g,f[4]=c[4]*v,f[5]=c[5]*v,f[6]=c[6]*v,f[7]=c[7]*v,f[8]=c[8]*k,f[9]=c[9]*k,f[10]=c[10]*k,f[11]=c[11]*k,f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15],f}function F(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[4],S=c[5],L=c[6],R=c[7],$=c[8],W=c[9],Z=c[10],X=c[11];return c!==f&&(f[0]=c[0],f[1]=c[1],f[2]=c[2],f[3]=c[3],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[4]=k*v+$*g,f[5]=S*v+W*g,f[6]=L*v+Z*g,f[7]=R*v+X*g,f[8]=$*v-k*g,f[9]=W*v-S*g,f[10]=Z*v-L*g,f[11]=X*v-R*g,f}function q(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],S=c[1],L=c[2],R=c[3],$=c[8],W=c[9],Z=c[10],X=c[11];return c!==f&&(f[4]=c[4],f[5]=c[5],f[6]=c[6],f[7]=c[7],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v-$*g,f[1]=S*v-W*g,f[2]=L*v-Z*g,f[3]=R*v-X*g,f[8]=k*g+$*v,f[9]=S*g+W*v,f[10]=L*g+Z*v,f[11]=R*g+X*v,f}function V(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],S=c[1],L=c[2],R=c[3],$=c[4],W=c[5],Z=c[6],X=c[7];return c!==f&&(f[8]=c[8],f[9]=c[9],f[10]=c[10],f[11]=c[11],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v+$*g,f[1]=S*v+W*g,f[2]=L*v+Z*g,f[3]=R*v+X*g,f[4]=$*v-k*g,f[5]=W*v-S*g,f[6]=Z*v-L*g,f[7]=X*v-R*g,f}function K(f,c){return f[0]=c[0],f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=c[1],f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=c[2],f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function G(f,c,u){var g,v,k,S=u[0],L=u[1],R=u[2],$=Math.sqrt(S*S+L*L+R*R);return $0&&(k=1/Math.sqrt(k)),f[0]=c[0]*k,f[1]=c[1]*k,f[2]=c[2]*k,f}function be(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function tt(f,c,u){var g=c[0],v=c[1],k=c[2],S=u[0],L=u[1],R=u[2];return f[0]=v*R-k*L,f[1]=k*S-g*R,f[2]=g*L-v*S,f}function Te(f,c,u,g){var v=c[0],k=c[1],S=c[2];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=S+g*(u[2]-S),f}function Ke(f,c,u){var g=c[0],v=c[1],k=c[2],S=u[3]*g+u[7]*v+u[11]*k+u[15];return f[0]=(u[0]*g+u[4]*v+u[8]*k+u[12])/(S=S||1),f[1]=(u[1]*g+u[5]*v+u[9]*k+u[13])/S,f[2]=(u[2]*g+u[6]*v+u[10]*k+u[14])/S,f}function me(f,c,u){var g=c[0],v=c[1],k=c[2];return f[0]=g*u[0]+v*u[3]+k*u[6],f[1]=g*u[1]+v*u[4]+k*u[7],f[2]=g*u[2]+v*u[5]+k*u[8],f}function yt(f,c,u){var g=u[0],v=u[1],k=u[2],S=u[3],L=c[0],R=c[1],$=c[2],W=v*$-k*R,Z=k*L-g*$,X=g*R-v*L;return f[0]=L+S*(W+=W)+v*(X+=X)-k*(Z+=Z),f[1]=R+S*Z+k*W-g*X,f[2]=$+S*X+g*Z-v*W,f}function rt(f){return f[0]=0,f[1]=0,f[2]=0,f}function at(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var Me=_e,ft=Ae,qe=pe;function Oe(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function Qe(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f[2]=c[2]*u,f[3]=c[3]*u,f}function nt(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=u*u+g*g+v*v+k*k;return S>0&&(S=1/Math.sqrt(S)),f[0]=u*S,f[1]=g*S,f[2]=v*S,f[3]=k*S,f}function gt(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3];return f[0]=u[0]*g+u[4]*v+u[8]*k+u[12]*S,f[1]=u[1]*g+u[5]*v+u[9]*k+u[13]*S,f[2]=u[2]*g+u[6]*v+u[10]*k+u[14]*S,f[3]=u[3]*g+u[7]*v+u[11]*k+u[15]*S,f}function mt(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function Mt(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function wt(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],L=Math.sin(u),R=Math.cos(u);return f[0]=g*R+S*L,f[1]=v*R+k*L,f[2]=k*R-v*L,f[3]=S*R-g*L,f}function Qt(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],L=Math.sin(u),R=Math.cos(u);return f[0]=g*R-k*L,f[1]=v*R+S*L,f[2]=k*R+g*L,f[3]=S*R-v*L,f}ye(),Oe();var Cr,cn,jn,Qr=nt,Pn=(Cr=ye(),cn=se(1,0,0),jn=se(0,1,0),function(f,c,u){var g=be(c,u);return g<-.999999?(tt(Cr,cn,c),qe(Cr)<1e-6&&tt(Cr,jn,c),Fe(Cr,Cr),function(v,k,S){S*=.5;var L=Math.sin(S);v[0]=L*k[0],v[1]=L*k[1],v[2]=L*k[2],v[3]=Math.cos(S)}(f,Cr,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(tt(Cr,c,u),f[0]=Cr[0],f[1]=Cr[1],f[2]=Cr[2],f[3]=1+g,Qr(f,f))});function js(){var f=new p(2);return p!=Float32Array&&(f[0]=0,f[1]=0),f}function hr(f,c){var u=new p(2);return u[0]=f,u[1]=c,u}function xs(f,c,u){return f[0]=c,f[1]=u,f}function ka(f,c,u){return f[0]=c[0]+u[0],f[1]=c[1]+u[1],f}function xa(f,c,u){return f[0]=c[0]-u[0],f[1]=c[1]-u[1],f}function zi(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f}function Bi(f){var c=f[0],u=f[1];return Math.sqrt(c*c+u*u)}function nl(f,c){var u=c[0],g=c[1],v=u*u+g*g;return v>0&&(v=1/Math.sqrt(v)),f[0]=c[0]*v,f[1]=c[1]*v,f}function xo(f,c){return f[0]*c[0]+f[1]*c[1]}mt(),mt(),y();var Hs,Xa,Ns=xa;function Fa(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}js();var Oa=function(){if(Xa)return Hs;function f(c,u,g,v){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(v-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=u,this.p2x=g,this.p2y=v}return Xa=1,Hs=f,f.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,u){if(u===void 0&&(u=1e-6),c<0)return 0;if(c>1)return 1;for(var g=c,v=0;v<8;v++){var k=this.sampleCurveX(g)-c;if(Math.abs(k)k?L=g:R=g,g=.5*(R-L)+L;return g},solve:function(c,u){return this.sampleCurveY(this.solveCurveX(c,u))}},Hs}(),Ro=Fa(Oa);function ir(f,c){this.x=f,this.y=c}function fo(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let u=0;u=1)return 1;const c=f*f,u=c*f;return 4*(f<.5?u:3*(f-c)+u-.75)}function yu(f,c,u,g){const v=new Ro(f,c,u,g);return function(k){return v.solve(k)}}const et=yu(.25,.1,.25,1);function xe(f,c,u){return Math.min(u,Math.max(c,f))}function Ie(f,c,u){return(u=xe((u-f)/(c-f),0,1))*u*(3-2*u)}function Ge(f,c,u){const g=u-c,v=((f-c)%g+g)%g+c;return v===c?u:v}function kt(f,c,u){if(!f.length)return u(null,[]);let g=f.length;const v=new Array(f.length);let k=null;f.forEach((S,L)=>{c(S,(R,$)=>{R&&(k=R),v[L]=$,--g==0&&u(k,v)})})}let vt=1;function At(){return vt++}function Bt(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function Pt(f,c){f.forEach(u=>{c[u]&&(c[u]=c[u].bind(c))})}function Ut(f,c,u){const g={};for(const v in f)g[v]=c.call(this,f[v],v,f);return g}function fr(f,c,u){const g={};for(const v in f)c.call(this,f[v],v,f)&&(g[v]=f[v]);return g}function ar(f){return Array.isArray(f)?f.map(ar):typeof f=="object"&&f?Ut(f,ar):f}function Wr(f,c){for(let u=0;u=0)return!0;return!1}const wn={};function Ur(f){wn[f]||(typeof console<"u"&&console.warn(f),wn[f]=!0)}function es(f,c,u){return(u.y-f.y)*(c.x-f.x)>(c.y-f.y)*(u.x-f.x)}function ts(f){let c=0;for(let u,g,v=0,k=f.length,S=k-1;v@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(u,g,v,k)=>{const S=v||k;return c[g]=!S||S.toLowerCase(),""}),c["max-age"]){const u=parseInt(c["max-age"],10);isNaN(u)?delete c["max-age"]:c["max-age"]=u}return c}let po=null;function ha(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function vo(f,c,u,g){for(;c>1;f[v]>1;f[v]<=g?c=v+1:u=v}return c}function Ws(f){return f>0?1/(1.001-f):1+f}function ki(f){return f>0?1-1/(1.001-f):-f}function za(f,c,u){return(f-c.min)*(u.max-u.min)/(c.max-c.min)+u.min}const Ss={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(!Ss.API_URL)return null;try{const f=new URL(Ss.API_URL);return f.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":f.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 Ni(f){return Ss.API_URL_REGEX.test(f)}function gl(f){return Ss.API_SPRITE_REGEX.test(f)}let Cl,Oc,gf,$o,wd,nc;function Zu(){return Cl==null&&(Cl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Cl}const Uo={now:()=>$o!==void 0?$o:performance.now(),setNow(f){$o=f},restoreNow(){$o=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:u,height:g}=f;wd||(wd=document.createElement("canvas"));const v=wd.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return(u>wd.width||g>wd.height)&&(wd.width=u,wd.height=g),v.clearRect(-c,-c,u+2*c,g+2*c),v.drawImage(f,0,0,u,g),v.getImageData(-c,-c,u+2*c,g+2*c)},resolveURL:f=>(Oc||(Oc=document.createElement("a")),Oc.href=f,Oc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(gf==null&&(gf=window.matchMedia("(prefers-reduced-motion: reduce)")),gf.matches)},hasCanvasFingerprintNoise(){if(nc!==void 0)return nc;if(!Zu())return nc=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let u=0;for(let v=0;v0?`?${k}`:""}`}const jy="mapbox-tiles";let ky=500,Ny=50;const Ch=["language","worldview","jobid"];let vu,Dc;function Hd(){try{return caches}catch{}}function Rc(){const f=Hd();f&&vu==null&&(vu=f.open(jy))}let _o=1/0;const jd={supported:!1,testSupport:function(f){!Sy&&yc&&(pp?Cy(f):Yu=f)}};let Yu,yc,Sy=!1,pp=!1;const mp=typeof self<"u"?self:{};function Cy(f){const c=f.createTexture();f.bindTexture(f.TEXTURE_2D,c);try{if(f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,yc),f.isContextLost())return;jd.supported=!0}catch{}f.deleteTexture(c),Sy=!0}mp.document&&(yc=mp.document.createElement("img"),yc.onload=function(){Yu&&Cy(Yu),Yu=null,pp=!0},yc.onerror=function(){Sy=!0,Yu=null},yc.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Hg={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(Hg);class Qc extends Error{constructor(c,u,g){u===401&&Ni(g)&&(c+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(c),this.status=u,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Wg=Ds()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Mh=function(f,c){if(!(/^file:/.test(u=f.url)||/^file:/.test(Wg())&&!/^\w+:/.test(u))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,v){const k=new AbortController,S=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:Wg(),referrerPolicy:g.referrerPolicy,signal:k.signal});let L=!1,R=!1;const $=(W=S.url).indexOf("sku=")>0&&Ni(W);var W;g.type==="json"&&S.headers.set("Accept","application/json");const Z=(re,ne,fe)=>{if(R)return;if(re&&re.message!=="SecurityError"&&Ur(re.toString()),ne&&fe)return X(ne);const Ne=Date.now();fetch(S).then(je=>{if(je.ok){const Re=$?je.clone():null;return X(je,Re,Ne)}return v(new Qc(je.statusText,je.status,g.url))}).catch(je=>{je.name!=="AbortError"&&v(new Error(`${je.message} ${g.url}`))})},X=(re,ne,fe)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(Ne=>{R||(ne&&fe&&function(je,Re,$e){if(Rc(),vu==null)return;const Ze=Li(Re.headers.get("Cache-Control")||"");if(Ze["no-store"])return;const ht={status:Re.status,statusText:Re.statusText,headers:new Headers};Re.headers.forEach((Ct,Et)=>ht.headers.set(Et,Ct)),Ze["max-age"]&&ht.headers.set("Expires",new Date($e+1e3*Ze["max-age"]).toUTCString());const ot=ht.headers.get("Expires");if(!ot||new Date(ot).getTime()-$e<42e4)return;let _t=Em(je.url,{persistentParams:Ch});if(Re.status===206){const Ct=je.headers.get("Range");if(!Ct)return;ht.status=200,_t=fp(_t,{range:Ct})}(function(Ct,Et){if(Dc===void 0)try{new Response(new ReadableStream),Dc=!0}catch{Dc=!1}Dc?Et(Ct.body):Ct.blob().then(Et).catch(Kt=>Ur(Kt.message))})(Re,Ct=>{const Et=new Response((Kt=Re.status)!==200&&Kt!==404&&[101,103,204,205,304].includes(Kt)?null:Ct,ht);var Kt;Rc(),vu!=null&&vu.then(Rt=>Rt.put(_t,Et)).catch(Rt=>Ur(Rt.message))})}(S,ne,fe),L=!0,v(null,Ne,re.headers))}).catch(Ne=>{R||v(new Error(Ne.message))})};return $?function(re,ne){if(Rc(),vu==null)return ne(null);vu.then(fe=>{let Ne=Em(re.url,{persistentParams:Ch});const je=re.headers.get("Range");je&&(Ne=fp(Ne,{range:je})),fe.match(Ne).then(Re=>{const $e=function(Ze){if(!Ze)return!1;const ht=new Date(Ze.headers.get("Expires")||0),ot=Li(Ze.headers.get("Cache-Control")||"");return Number(ht)>Date.now()&&!ot["no-cache"]}(Re);fe.delete(Ne).catch(ne),$e&&fe.put(Ne,Re.clone()).catch(ne),ne(null,Re,$e)}).catch(ne)}).catch(ne)}(S,Z):Z(null,null),{cancel:()=>{R=!0,L||k.abort()}}}(f,c);if(Ds(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var u;return function(g,v){const k=new XMLHttpRequest;k.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(k.responseType="arraybuffer");for(const S in g.headers)k.setRequestHeader(S,g.headers[S]);return g.type==="json"&&(k.responseType="text",k.setRequestHeader("Accept","application/json")),k.withCredentials=g.credentials==="include",k.onerror=()=>{v(new Error(k.statusText))},k.onload=()=>{if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let S=k.response;if(g.type==="json")try{S=JSON.parse(k.response)}catch(R){return v(R)}const L=new Headers;k.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(R=>{const $=R.split(": "),W=$.shift(),Z=$.join(": ");L.append(W,Z)}),v(null,S,L)}else v(new Qc(k.statusText,k.status,g.url))},k.send(g.body),{cancel:()=>k.abort()}}(f,c)},Th=function(f,c){return Mh(Object.assign(f,{type:"arrayBuffer"}),c)};function T3(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const gk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let xf,Ys;xf=[],Ys=0;const My=function(f,c){if(jd.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),Ys>=Ss.MAX_PARALLEL_IMAGE_REQUESTS){const k={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return xf.push(k),k}Ys++;let u=!1;const g=()=>{if(!u)for(u=!0,Ys--;xf.length&&Ys{g(),k?c(k):S&&(self.createImageBitmap?function(R,$){const W=new Blob([new Uint8Array(R)],{type:"image/png"});createImageBitmap(W).then(Z=>{$(null,Z)}).catch(Z=>{$(new Error(`Could not load image because of ${Z.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(S,(R,$)=>c(R,$,L)):function(R,$){const W=new Image;W.onload=()=>{$(null,W),URL.revokeObjectURL(W.src),W.onload=null,requestAnimationFrame(()=>{W.src=gk})},W.onerror=()=>$(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 Z=new Blob([new Uint8Array(R)],{type:"image/png"});W.src=R.byteLength?URL.createObjectURL(Z):gk}(S,(R,$)=>c(R,$,L)))});return{cancel:()=>{v.cancel(),g()}}};var xv,xk,yk,Ah={exports:{}},Gg={exports:{}},jt={exports:{}},gr=function(){if(yk)return Ah.exports;yk=1;var f=(xv||(xv=1,Gg.exports=function(u,g){var v,k,S,L,R,$,W,Z;for(k=u.length-(v=3&u.length),S=g,R=3432918353,$=461845907,Z=0;Z>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295)<<13|S>>>19))+((5*(S>>>16)&65535)<<16)&4294967295))+((58964+(L>>>16)&65535)<<16);switch(W=0,v){case 3:W^=(255&u.charCodeAt(Z+2))<<16;case 2:W^=(255&u.charCodeAt(Z+1))<<8;case 1:S^=W=(65535&(W=(W=(65535&(W^=255&u.charCodeAt(Z)))*R+(((W>>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295}return S^=u.length,S=2246822507*(65535&(S^=S>>>16))+((2246822507*(S>>>16)&65535)<<16)&4294967295,S=3266489909*(65535&(S^=S>>>13))+((3266489909*(S>>>16)&65535)<<16)&4294967295,(S^=S>>>16)>>>0}),Gg.exports),c=(xk||(xk=1,jt.exports=function(u,g){for(var v,k=u.length,S=g^k,L=0;k>=4;)v=1540483477*(65535&(v=255&u.charCodeAt(L)|(255&u.charCodeAt(++L))<<8|(255&u.charCodeAt(++L))<<16|(255&u.charCodeAt(++L))<<24))+((1540483477*(v>>>16)&65535)<<16),S=1540483477*(65535&S)+((1540483477*(S>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),k-=4,++L;switch(k){case 3:S^=(255&u.charCodeAt(L+2))<<16;case 2:S^=(255&u.charCodeAt(L+1))<<8;case 1:S=1540483477*(65535&(S^=255&u.charCodeAt(L)))+((1540483477*(S>>>16)&65535)<<16)}return S=1540483477*(65535&(S^=S>>>13))+((1540483477*(S>>>16)&65535)<<16),(S^=S>>>15)>>>0}),jt.exports);return Ah.exports=f,Ah.exports.murmur3=f,Ah.exports.murmur2=c,Ah.exports}(),Pr=Fa(gr);class Hn{constructor(c,...u){Object.assign(this,u[0]||{}),this.type=c}}class rs extends Hn{constructor(c,u={}){super("error",Object.assign({error:c},u))}}function Na(f,c,u){u[f]&&u[f].indexOf(c)!==-1||(u[f]=u[f]||[],u[f].push(c))}function ra(f,c,u){if(u&&u[f]){const g=u[f].indexOf(c);g!==-1&&u[f].splice(g,1)}}class mi{on(c,u){return this._listeners=this._listeners||{},Na(c,u,this._listeners),this}off(c,u){return ra(c,u,this._listeners),ra(c,u,this._oneTimeListeners),this}once(c,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},Na(c,u,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,u){const g=typeof c=="string"?new Hn(c,u):c,v=g.type;if(this.listens(v)){g.target=this;const k=this._listeners&&this._listeners[v]?this._listeners[v].slice():[];for(const R of k)R.call(this,g);const S=this._oneTimeListeners&&this._oneTimeListeners[v]?this._oneTimeListeners[v].slice():[];for(const R of S)ra(v,R,this._oneTimeListeners),R.call(this,g);const L=this._eventedParent;if(L){const R=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,R),L.fire(g)}}else g instanceof rs&&console.error(g.error);return this}listens(c){return!!(this._listeners&&this._listeners[c]&&this._listeners[c].length>0||this._oneTimeListeners&&this._oneTimeListeners[c]&&this._oneTimeListeners[c].length>0||this._eventedParent&&this._eventedParent.listens(c))}setEventedParent(c,u){return this._eventedParent=c,this._eventedParentData=u,this}}class xl{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new xl(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[u,g]=c.split("");return new xl({name:u,iconsetId:g})}static isEqual(c,u){return c.name===u.name&&c.iconsetId===u.iconsetId}toString(){return xl.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var gp,xp={},Wd=function(){if(gp)return xp;gp=1;var f={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 c(k){return(k=Math.round(k))<0?0:k>255?255:k}function u(k){return c(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function g(k){return(S=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:S>1?1:S;var S}function v(k,S,L){return L<0?L+=1:L>1&&(L-=1),6*L<1?k+(S-k)*L*6:2*L<1?S:3*L<2?k+(S-k)*(2/3-L)*6:k}try{xp.parseCSSColor=function(k){var S,L=k.replace(/ /g,"").toLowerCase();if(L in f)return f[L].slice();if(L[0]==="#")return L.length===4?(S=parseInt(L.substr(1),16))>=0&&S<=4095?[(3840&S)>>4|(3840&S)>>8,240&S|(240&S)>>4,15&S|(15&S)<<4,1]:null:L.length===7&&(S=parseInt(L.substr(1),16))>=0&&S<=16777215?[(16711680&S)>>16,(65280&S)>>8,255&S,1]:null;var R=L.indexOf("("),$=L.indexOf(")");if(R!==-1&&$+1===L.length){var W=L.substr(0,R),Z=L.substr(R+1,$-(R+1)).split(","),X=1;switch(W){case"rgba":if(Z.length!==4)return null;X=g(Z.pop());case"rgb":return Z.length!==3?null:[u(Z[0]),u(Z[1]),u(Z[2]),X];case"hsla":if(Z.length!==4)return null;X=g(Z.pop());case"hsl":if(Z.length!==3)return null;var re=(parseFloat(Z[0])%360+360)%360/360,ne=g(Z[1]),fe=g(Z[2]),Ne=fe<=.5?fe*(ne+1):fe+ne-fe*ne,je=2*fe-Ne;return[c(255*v(je,Ne,re+1/3)),c(255*v(je,Ne,re)),c(255*v(je,Ne,re-1/3)),X];default:return null}}return null}}catch{}return xp}();class Sa{constructor(c,u,g,v=1){this.r=c,this.g=u,this.b=g,this.a=v}static parse(c){if(!c)return;if(c instanceof Sa)return c;if(typeof c!="string")return;const u=Wd.parseCSSColor(c);return u?new Sa(u[0]/255,u[1]/255,u[2]/255,u[3]):void 0}toString(){const[c,u,g,v]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*u)},${Math.round(255*g)},${v})`}toNonPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new GI(c,u,g,v,k)}toPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new KI(c,u*k,g*k,v*k,k)}clone(){return new Sa(this.r,this.g,this.b,this.a)}}class WI{constructor(c,u,g,v,k,S=!1){if(this.premultiplied=!1,this.premultiplied=S,c){const L=c.image.height,R=L*L;this.premultiplied?(u=k===0?0:u/k*(L-1),g=k===0?0:g/k*(L-1),v=k===0?0:v/k*(L-1)):(u*=L-1,g*=L-1,v*=L-1);const $=Math.floor(u),W=Math.floor(g),Z=Math.floor(v),X=Math.ceil(u),re=Math.ceil(g),ne=Math.ceil(v),fe=u-$,Ne=g-W,je=v-Z,Re=c.image.data,$e=4*($+W*R+Z*L),Ze=4*($+W*R+ne*L),ht=4*($+re*R+Z*L),ot=4*($+re*R+ne*L),_t=4*(X+W*R+Z*L),Ct=4*(X+W*R+ne*L),Et=4*(X+re*R+Z*L),Kt=4*(X+re*R+ne*L);if($e<0||Kt>=Re.length)throw new Error("out of range");this.r=Fn(Fn(Fn(Re[$e],Re[Ze],je),Fn(Re[ht],Re[ot],je),Ne),Fn(Fn(Re[_t],Re[Ct],je),Fn(Re[Et],Re[Kt],je),Ne),fe)/255*(this.premultiplied?k:1),this.g=Fn(Fn(Fn(Re[$e+1],Re[Ze+1],je),Fn(Re[ht+1],Re[ot+1],je),Ne),Fn(Fn(Re[_t+1],Re[Ct+1],je),Fn(Re[Et+1],Re[Kt+1],je),Ne),fe)/255*(this.premultiplied?k:1),this.b=Fn(Fn(Fn(Re[$e+2],Re[Ze+2],je),Fn(Re[ht+2],Re[ot+2],je),Ne),Fn(Fn(Re[_t+2],Re[Ct+2],je),Fn(Re[Et+2],Re[Kt+2],je),Ne),fe)/255*(this.premultiplied?k:1),this.a=k}else this.r=u,this.g=g,this.b=v,this.a=k}toArray(){const{r:c,g:u,b:g,a:v}=this;return[255*c,255*u,255*g,v]}toHslaArray(){let{r:c,g:u,b:g,a:v}=this;if(this.premultiplied){if(v===0)return[0,0,0,0];const ne=1/v;c*=ne,u*=ne,g*=ne}const k=Math.min(Math.max(c,0),1),S=Math.min(Math.max(u,0),1),L=Math.min(Math.max(g,0),1),R=Math.min(k,S,L),$=Math.max(k,S,L),W=$-R,Z=.5*(R+$);if(W===0)return[0,0,100*Z,v];const X=Z>.5?W/(2-$-R):W/($+R);let re;switch($){case k:re=60*((S-L)/W+(SFn(g,c[v],u))}Sa.black=new Sa(0,0,0,1),Sa.white=new Sa(1,1,1,1),Sa.transparent=new Sa(0,0,0,0),Sa.red=new Sa(1,0,0,1),Sa.blue=new Sa(0,0,1,1);var yv=Object.freeze({__proto__:null,array:A3,color:function(f,c,u){return new Sa(Fn(f.r,c.r,u),Fn(f.g,c.g,u),Fn(f.b,c.b,u),Fn(f.a,c.a,u))},number:Fn});class Xu extends Error{constructor(c,u){super(u),this.message=u,this.key=c}}class Ty{constructor(c,u=[]){this.parent=c,this.bindings={};for(const[g,v]of u)this.bindings[g]=v}concat(c){return new Ty(this,c)}get(c){if(this.bindings[c])return this.bindings[c];if(this.parent)return this.parent.get(c);throw new Error(`${c} not found in scope.`)}has(c){return!!this.bindings[c]||!!this.parent&&this.parent.has(c)}}const Eh={kind:"null"},mn={kind:"number"},Gs={kind:"string"},Da={kind:"boolean"},kd={kind:"color"},yf={kind:"object"},ja={kind:"value"},vk={kind:"collator"},vv={kind:"formatted"},_v={kind:"resolvedImage"};function vc(f,c){return{kind:"array",itemType:f,N:c}}function Eo(f){if(f.kind==="array"){const c=Eo(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const $ae=[Eh,mn,Gs,Da,kd,vv,yf,vc(ja),_v];function Im(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Im(f.itemType,c.itemType))&&(typeof f.N!="number"||f.N===c.N))return null}else{if(f.kind===c.kind)return null;if(f.kind==="value"){for(const u of $ae)if(!Im(u,c))return null}}return`Expected ${Eo(f)} but found ${Eo(c)} instead.`}function E3(f,c){return c.some(u=>u.kind===f.kind)}function bv(f,c){return c.some(u=>u==="null"?f===null:u==="array"?Array.isArray(f):u==="object"?f&&!Array.isArray(f)&&typeof f=="object":u===typeof f)}function _k(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&_k(f.itemType,c.itemType):f.kind===c.kind}class I3{constructor(c,u,g){this.sensitivity=c?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,u){return this.collator.compare(c,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class bk{constructor(c,u,g,v,k){this.text=c.normalize?c.normalize():c,this.image=u,this.scale=g,this.fontStack=v,this.textColor=k}}class Jc{constructor(c){this.sections=c}static fromString(c){return new Jc([new bk(c,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(c=>c.text.length!==0||!!c.image&&c.image.hasPrimary())}static factory(c){return c instanceof Jc?c:Jc.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const u of this.sections){if(u.image){const v=u.image.getPrimary().id.toString();c.push(["image",v]);continue}c.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())),c.push(g)}return c}}class yp{constructor(c,u={}){this.id=xl.from(c),this.params=u.params,this.sx=u.sx||1,this.sy=u.sy||1}toString(){return JSON.stringify(this)}static parse(c){let u,g,v,k;try{({id:u,params:g,sx:v,sy:k}=JSON.parse(c)||{})}catch{return null}return u?new yp(u,{params:g,sx:v,sy:k}):null}scaleSelf(c,u=c){return this.sx*=c,this.sy*=u,this}}class ed{constructor(c,u,g,v,k=!1){this.primaryId=xl.from(c),this.primaryOptions=u,g&&(this.secondaryId=xl.from(g)),this.secondaryOptions=v,this.available=k}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new yp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new yp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?ed.build({name:c}):c}static build(c,u,g,v){return!c||typeof c=="object"&&!("name"in c)?null:new ed(c,g,u,v)}}function Kg(f,c,u,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,u,g]:[f,c,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ay(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof Sa||f instanceof I3||f instanceof Jc||f instanceof ed)return!0;if(Array.isArray(f)){for(const c of f)if(!Ay(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!Ay(f[c]))return!1;return!0}return!1}function yl(f){if(f===null)return Eh;if(typeof f=="string")return Gs;if(typeof f=="boolean")return Da;if(typeof f=="number")return mn;if(f instanceof Sa)return kd;if(f instanceof I3)return vk;if(f instanceof Jc)return vv;if(f instanceof ed)return _v;if(Array.isArray(f)){const c=f.length;let u;for(const g of f){const v=yl(g);if(u){if(u===v)continue;u=ja;break}u=v}return vc(u||ja,c)}return yf}function Qu(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof Jc||f instanceof ed||f instanceof Sa?f.toString():JSON.stringify(f)}class vp{constructor(c,u){this.type=c,this.value=u}static parse(c,u){if(c.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!Ay(c[1]))return u.error("invalid value");const g=c[1];let v=yl(g);const k=u.expectedType;return v.kind!=="array"||v.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(v=k),new vp(v,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 Sa?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Jc?this.value.serialize():this.value}}class sl{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const P3={string:Gs,number:mn,boolean:Da,object:yf};class Ih{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");let g,v=1;const k=c[0];if(k==="array"){let L,R;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in P3)||$==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);L=P3[$],v++}else L=ja;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return u.error('The length argument to "array" must be a positive integer literal',2);R=c[2],v++}g=vc(L,R)}else g=P3[k];const S=[];for(;vc.outputDefined())}serialize(){const c=this.type,u=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){u.push(g.kind);const v=c.N;(typeof v=="number"||this.args.length>1)&&u.push(v)}}return u.concat(this.args.map(g=>g.serialize()))}}class vf{constructor(c){this.type=vv,this.sections=c}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const v=[];let k=!1;for(let S=1;S<=c.length-1;++S){const L=c[S];if(k&&typeof L=="object"&&!Array.isArray(L)){k=!1;let R=null;if(L["font-scale"]&&(R=u.parseObjectValue(L["font-scale"],S,"font-scale",mn),!R))return null;let $=null;if(L["text-font"]&&($=u.parseObjectValue(L["text-font"],S,"text-font",vc(Gs)),!$))return null;let W=null;if(L["text-color"]&&(W=u.parseObjectValue(L["text-color"],S,"text-color",kd),!W))return null;const Z=v[v.length-1];Z.scale=R,Z.font=$,Z.textColor=W}else{const R=u.parse(c[S],S,ja);if(!R)return null;const $=R.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,v.push({content:R,scale:null,font:null,textColor:null})}}return new vf(v)}evaluate(c){return new Jc(this.sections.map(u=>{const g=u.content.evaluate(c);return _k(yl(g),_v)?new bk("",g,null,null,null):new bk(Qu(g),null,u.scale?u.scale.evaluate(c):null,u.font?u.font.evaluate(c).join(","):null,u.textColor?u.textColor.evaluate(c):null)}))}eachChild(c){for(const u of this.sections)c(u.content),u.scale&&c(u.scale),u.font&&c(u.font),u.textColor&&c(u.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const u of this.sections){c.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()),c.push(g)}return c}}class as{constructor(c,u,g,v){this._imageWarnHistory={},this.type=_v,this.namePrimary=c,this.nameSecondary=u,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),v&&(this.paramsSecondary=v.params,this.iconsetIdSecondary=v.iconset?v.iconset.id:void 0)}static parse(c,u){if(c.length<2)return u.error("Expected two or more arguments.");let g=1;const v=[];function k(){if(gxl.isEqual(S,k)),v.available){const S=v.getSecondary()?v.getSecondary().id:null;S&&(v.available=c.availableImages.some(L=>xl.isEqual(L,S)))}}return v}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const u in this.paramsPrimary)this.paramsPrimary[u]&&c(this.paramsPrimary[u]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const u in this.paramsSecondary)this.paramsSecondary[u]&&c(this.paramsSecondary[u])}outputDefined(){return!1}serializeOptions(c,u){const g={};if(u&&(g.iconset={id:u}),c){g.params={};for(const v in c)c[v]&&(g.params[v]=c[v].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const c=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const u=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);u&&c.push(u)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const u=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);u&&c.push(u)}return c}}function dn(f){return $n(f)?"string":Ey(f)?"number":jk(f)?"boolean":Array.isArray(f)?"array":f===null?"null":wk(f)?"object":typeof f}function wk(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function $n(f){return typeof f=="string"||f instanceof String}function Ey(f){return typeof f=="number"||f instanceof Number}function jk(f){return typeof f=="boolean"||f instanceof Boolean}const zn={"to-boolean":Da,"to-color":kd,"to-number":mn,"to-string":Gs};class _f{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[0],v=[];let k=Eh;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const S=c[1].length;if(u.expectedType){if(u.expectedType.kind!=="array")return u.error(`Expected ${u.expectedType.kind} but found array.`);k=vc(u.expectedType.itemType,S)}else{if(!(S>0&&Ay(c[1][0])))return null;k=vc(yl(c[1][0]),S)}for(let L=0;L4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:Kg(u[0],u[1],u[2],u[3]),!g))return new Sa(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new sl(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(c),u===null)return 0;const v=Number(u);if(!isNaN(v))return v}throw new sl(`Could not convert ${JSON.stringify(u)} to number.`)}return this.type.kind==="formatted"?Jc.fromString(Qu(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?ed.build(Qu(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(u=>u.evaluate(c)):Qu(this.args[0].evaluate(c))}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){if(this.type.kind==="formatted")return new vf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new as(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(u=>{c.push(u.serialize())}),c}}const L3=["Unknown","Point","LineString","Polygon"];class kk{constructor(c,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=c,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"?L3[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(c){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const c=this.featureDistanceData.center,u=this.featureDistanceData.scale,{x:g,y:v}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*u-c[0])+this.featureDistanceData.bearing[1]*(v*u-c[1])}return 0}parseColor(c){let u=this._parseColorCache[c];return u||(u=this._parseColorCache[c]=Sa.parse(c)),u}getConfig(c){return this.options?this.options.get(c):null}}class td{constructor(c,u,g,v,k){this.name=c,this.type=u,this._evaluate=g,this.args=v,this._overloadIndex=k}evaluate(c){if(!this._evaluate){const u=td.definitions[this.name];this._evaluate=Array.isArray(u)?u[2]:u.overloads[this._overloadIndex][1]}return this._evaluate(c,this.args)}eachChild(c){this.args.forEach(c)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(c=>c.serialize()))}static parse(c,u){const g=c[0],v=td.definitions[g];if(!v)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(v)?v[0]:v.type,S=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,L=[];let R=null,$=-1;for(const[W,Z]of S){if(Array.isArray(W)&&W.length!==c.length-1)continue;L.push(W),$++,R=new Dk(u.registry,u.path,null,u.scope,void 0,u._scope,u.options,u.iconImageUseTheme);const X=[];let re=!1;for(let ne=1;neX)).map(Nk).join(" | "),Z=[];for(let X=1;Xu;){if(g-u>600){const R=g-u+1,$=c-u+1,W=Math.log(R),Z=.5*Math.exp(2*W/3),X=.5*Math.sqrt(W*Z*(R-Z)/R)*($-R/2<0?-1:1);Sk(f,c,Math.max(u,Math.floor(c-$*Z/R+X)),Math.min(g,Math.floor(c+(R-$)*Z/R+X)),v)}const k=f[c];let S=u,L=g;for(Ph(f,u,c),v(f[g],k)>0&&Ph(f,u,g);S0;)L--}v(f[u],k)===0?Ph(f,u,L):(L++,Ph(f,L,g)),L<=c&&(u=L+1),c<=L&&(g=L-1)}}function Ph(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function O3(f,c){return fc?1:0}function Pm(f){let c=0;for(let u,g,v=0,k=f.length,S=k-1;v=c[2]||f[1]<=c[1]||f[3]>=c[3])}function Uae(f,c,u){const g=f[0]-c[0],v=f[1]-c[1],k=f[0]-u[0],S=f[1]-u[1];return g*S-k*v==0&&g*k<=0&&v*S<=0}function Iy(f,c,u=!1){let g=!1;for(let L=0,R=c.length;L(v=f)[1]!=(S=ne)[1]>v[1]&&v[0]<(S[0]-k[0])*(v[1]-k[1])/(S[1]-k[1])+k[0]&&(g=!g)}}var v,k,S;return g}function jv(f,c,u,g){const v=g[0]-u[0],k=g[1]-u[1],S=(f[0]-u[0])*k-v*(f[1]-u[1]),L=(c[0]-u[0])*k-v*(c[1]-u[1]);return S>0&&L<0||S<0&&L>0}function kv(f,c,u,g){return(v=[g[0]-u[0],g[1]-u[1]])[0]*(k=[c[0]-f[0],c[1]-f[1]])[1]-v[1]*k[0]!=0&&!(!jv(f,c,u,g)||!jv(u,g,f,c));var v,k}function _p(f){const c=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new ir(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of f[0])c.x>g.x&&(c.x=g.x),c.y>g.y&&(c.y=g.y),u.xu[2]){const v=.5*g;let k=f[0]-u[0]>v?-g:u[0]-f[0]>v?g:0;k===0&&(k=f[0]-u[2]>v?-g:u[2]-f[0]>v?g:0),f[0]+=k}Ju(c,f)}function QI(f,c,u,g){const v=Math.pow(2,g.z)*Lm,k=[g.x*Lm,g.y*Lm],S=[];if(!f)return S;for(const L of f)for(const R of L){const $=[R.x+k[0],R.y+k[1]];XI($,c,u,v),S.push($)}return S}function Ck(f,c,u,g){const v=Math.pow(2,g.z)*Lm,k=[g.x*Lm,g.y*Lm],S=[];if(!f)return S;for(const R of f){const $=[];for(const W of R){const Z=[W.x+k[0],W.y+k[1]];Ju(c,Z),$.push(Z)}S.push($)}if(c[2]-c[0]<=v/2){(L=c)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const R of S)for(const $ of R)XI($,c,u,v)}var L;return S}class Dm{constructor(c,u){this.type=Da,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(Ay(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let v=0;vu)return Mk(k,S,(u-(g-L))/L)}return c[c.length-1]}pointToSegmentDistance(c,u,g){let[v,k]=u,S=_u(g[0]-v)*this.kx,L=(g[1]-k)*this.ky;if(S!==0||L!==0){const R=(_u(c[0]-v)*this.kx*S+(c[1]-k)*this.ky*L)/(S*S+L*L);R>1?(v=g[0],k=g[1]):R>0&&(v+=S/this.kx*R,k+=L/this.ky*R)}return S=_u(c[0]-v)*this.kx,L=(c[1]-k)*this.ky,Math.sqrt(S*S+L*L)}pointOnLine(c,u){let g=1/0,v=c[0][0],k=c[0][1],S=0,L=0;for(let R=0;R1?($=c[R+1][0],W=c[R+1][1]):re>0&&($+=Z/this.kx*re,W+=X/this.ky*re)),Z=_u(u[0]-$)*this.kx,X=(u[1]-W)*this.ky;const ne=Z*Z+X*X;nek.index||v.index===k.index&&v.t>k.t){const $=v;v=k,k=$}const S=[v.point],L=v.index+1,R=k.index;!F3(g[L],S[0])&&L<=R&&S.push(g[L]);for(let $=L+1;$<=R;$++)S.push(g[$]);return F3(g[R],k.point)||S.push(k.point),S}lineSliceAlong(c,u,g){let v=0;const k=[];for(let S=0;Sc&&k.length===0&&k.push(Mk(L,R,(c-(v-$))/$)),v>=u)return k.push(Mk(L,R,(u-(v-$))/$)),k;v>c&&k.push(R)}return k}bufferPoint(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[0]+v,c[1]+g]}bufferBBox(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[2]+v,c[3]+g]}insideBBox(c,u){return _u(c[0]-u[0])>=0&&_u(c[0]-u[2])<=0&&c[1]>=u[1]&&c[1]<=u[3]}}function F3(f,c){return f[0]===c[0]&&f[1]===c[1]}function Mk(f,c,u){const g=_u(c[0]-f[0]);return[f[0]+g*u,f[1]+(c[1]-f[1])*u]}function _u(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class Tk{constructor(c=[],u=(g,v)=>gv?1:0){if(this.data=c,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(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:u,compare:g}=this,v=u[c];for(;c>0;){const k=c-1>>1,S=u[k];if(g(v,S)>=0)break;u[c]=S,c=k}u[c]=v}_down(c){const{data:u,compare:g}=this,v=this.length>>1,k=u[c];for(;c=0)break;u[c]=u[S],c=S}u[c]=k}}var Sr=8192;function z3(f,c){return c.dist-f.dist}const Ak=100,Ek=50;function B3(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let u=0;u=f[0]&&f[1]f[1])return[null,null];const u=Sv(f);if(c){if(u===2)return[f,null];const g=Math.floor(u/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(u===1)return[f,null];const g=Math.floor(u/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function Zg(f,c){const u=[1/0,1/0,-1/0,-1/0];if(!bf(c,f.length))return u;for(let g=c[0];g<=c[1];++g)Ju(u,f[g]);return u}function Yg(f){const c=[1/0,1/0,-1/0,-1/0];for(let u=0;uc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(v=f[1]-c[3]),f[3]=g)return g;if(wv(v,k)){if(q3(f,c))return 0}else if(q3(c,f))return 0;let S=g;for(const L of f)for(let R=0,$=L.length,W=$-1;R<$;W=R++)for(const Z of c)for(let X=0,re=Z.length,ne=re-1;X=k)continue;const W=$.range1;if(Sv(W)<=L){if(!bf(W,f.length))return NaN;if(c){const Z=Kae(f,W,u,g);if((k=Math.min(k,Z))===0)return k}else for(let Z=W[0];Z<=W[1];++Z){const X=Gae(f[Z],u,g);if((k=Math.min(k,X))===0)return k}}else{const Z=$3(W,c);if(Z[0]!==null){const X=Rm(Zg(f,Z[0]),R,g);X=S)continue;const Z=W.range1,X=W.range2;if(Sv(Z)<=R&&Sv(X)<=$){if(!bf(Z,f.length)||!bf(X,u.length))return NaN;if(c&&g?S=Math.min(S,Xs(f,Z,u,X,v)):c||g?c&&!g?S=Math.min(S,U3(u,X,f,Z,v)):!c&&g&&(S=Math.min(S,U3(f,Z,u,X,v))):S=Math.min(S,Wae(f,Z,u,X,v)),S===0)return S}else{const re=$3(Z,c),ne=$3(X,g);Si(L,S,v,f,u,re[0],ne[0]),Si(L,S,v,f,u,re[0],ne[1]),Si(L,S,v,f,u,re[1],ne[0]),Si(L,S,v,f,u,re[1],ne[1])}}return S}function V3(f,c,u,g,v=1/0){let k=v;const S=Zg(f,[0,f.length-1]);for(const L of u)if(!(k!==1/0&&Rm(S,Zg(L,[0,L.length-1]),g)>=k)&&(k=Math.min(k,rP(f,c,L,!0,g,k)),k===0))return k;return k}function Lk(f,c,u,g,v=1/0){let k=v;const S=Zg(f,[0,f.length-1]);for(const L of u){if(k!==1/0&&Rm(S,Yg(L),g)>=k)continue;const R=Yae(f,c,L,g,k);if(isNaN(R))return R;if((k=Math.min(k,R))===0)return k}return k}function H3(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class Xg{constructor(c,u){this.type=mn,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(Ay(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let v=0;v{c&&!Oy(u)&&(c=!1)}),c}function Cv(f){if(f instanceof td&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(u=>{c&&!Cv(u)&&(c=!1)}),c}function Dy(f,c){if(f instanceof td&&c.indexOf(f.name)>=0)return!1;let u=!0;return f.eachChild(g=>{u&&!Dy(g,c)&&(u=!1)}),u}function nP(f,c,u){return[f,c,u].filter(Boolean).join("")}function W3(f,c){switch(f){case"string":return Qu(c);case"number":return+c;case"boolean":return!!c;case"color":return Sa.parse(c);case"formatted":return Jc.fromString(Qu(c));case"resolvedImage":return ed.build(Qu(c))}return c}function sP(f,c,u,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fu&&(f=u),f}class Ry{constructor(c,u,g,v=!1){this.type=c,this.key=u,this.scope=g,this.featureConstant=v}static parse(c,u){let g=u.expectedType;if(g==null&&(g=ja),c.length<2||c.length>3)return u.error("Invalid number of arguments for 'config' expression.");const v=u.parse(c[1],1);if(!(v instanceof vp))return u.error("Key name of 'config' expression must be a string literal.");let k,S=!0;const L=Qu(v.value);if(c.length>=3){const R=u.parse(c[2],2);if(!(R instanceof vp))return u.error("Scope of 'config' expression must be a string literal.");k=Qu(R.value)}if(u.options){const R=nP(L,k,u._scope),$=u.options.get(R);$&&(S=Oy($.value||$.default))}return new Ry(g,L,k,S)}evaluate(c){const u=nP(this.key,this.scope,c.scope),g=c.getConfig(u);if(!g)return null;const{type:v,value:k,values:S,minValue:L,maxValue:R,stepValue:$}=g,W=g.default.evaluate(c);let Z=W;if(k){const X=c.scope;c.scope=(X||"").split("").slice(1).join(""),Z=k.evaluate(c),c.scope=X}return v&&(Z=W3(v,Z)),Z===void 0||L===void 0&&R===void 0&&$===void 0||(typeof Z=="number"?Z=sP(Z,L,R,$):Array.isArray(Z)&&(Z=Z.map(X=>typeof X=="number"?sP(X,L,R,$):X))),k!==void 0&&Z!==void 0&&S&&!S.includes(Z)&&(Z=W,v&&(Z=W3(v,Z))),(v&&v!==this.type||Z!==void 0&&!_k(yl(Z),this.type))&&(Z=W3(this.type.kind,Z)),Z}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class Ok{constructor(c,u){this.type=u.type,this.name=c,this.boundExpression=u}static parse(c,u){if(c.length!==2||typeof c[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=c[1];return u.scope.has(g)?new Ok(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(c){return this.boundExpression.evaluate(c)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Dk{constructor(c,u=[],g,v=new Ty,k=[],S,L,R){this.registry=c,this.path=u,this.key=u.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=v,this.errors=k,this.expectedType=g,this._scope=S,this.options=L,this.iconImageUseTheme=R}parse(c,u,g,v,k={}){return u||g?this.concat(u,null,g,v)._parse(c,k):this._parse(c,k)}parseObjectValue(c,u,g,v,k,S={}){return this.concat(u,g,v,k)._parse(c,S)}_parse(c,u){function g(v,k,S){return S==="assert"?new Ih(k,[v]):S==="coerce"?new _f(k,[v]):v}if(c!==null&&typeof c!="string"&&typeof c!="boolean"&&typeof c!="number"||(c=["literal",c]),Array.isArray(c)){if(c.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const v=typeof c[0]=="string"?this.registry[c[0]]:void 0;if(v){let k=v.parse(c,this);if(!k)return null;if(this.expectedType){const S=this.expectedType,L=k.type;if(S.kind!=="string"&&S.kind!=="number"&&S.kind!=="boolean"&&S.kind!=="object"&&S.kind!=="array"||L.kind!=="value")if(S.kind!=="color"&&S.kind!=="formatted"&&S.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string"){if(this.checkSubtype(S,L))return null}else k=g(k,S,u.typeAnnotation||"coerce");else k=g(k,S,u.typeAnnotation||"assert")}if(!(k instanceof vp)&&k.type.kind!=="resolvedImage"&&G3(k)){const S=new kk(this._scope,this.options,this.iconImageUseTheme);try{k=new vp(k.type,k.evaluate(S))}catch(L){return this.error(L.message),null}}return k}return _f.parse(["to-array",c],this)}return this.error(c===void 0?"'undefined' value invalid. Use null instead.":typeof c=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof c} instead.`)}concat(c,u,g,v){let k=typeof c=="number"?this.path.concat(c):this.path;k=typeof u=="string"?k.concat(u):k;const S=v?this.scope.concat(v):this.scope;return new Dk(this.registry,k,g||null,S,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...u){const g=`${this.key}${u.map(v=>`[${v}]`).join("")}`;this.errors.push(new Xu(g,c))}checkSubtype(c,u){const g=Im(c,u);return g&&this.error(g),g}}function G3(f){if(f instanceof Ok)return G3(f.boundExpression);if(f instanceof td&&f.name==="error"||f instanceof Ml||f instanceof Dm||f instanceof Xg||f instanceof Ry)return!1;const c=f instanceof _f||f instanceof Ih;let u=!0;return f.eachChild(g=>{u=c?u&&G3(g):u&&g instanceof vp}),!!u&&Oy(f)&&Dy(f,["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 Rk(f,c){const u=f.length-1;let g,v,k=0,S=u,L=0;for(;k<=S;)if(L=Math.floor((k+S)/2),g=f[L],v=f[L+1],g<=c){if(L===u||cc))throw new sl("Input is not a number.");S=L-1}return 0}class Mv{constructor(c,u,g){this.type=c,this.input=u,this.labels=[],this.outputs=[];for(const[v,k]of g)this.labels.push(v),this.outputs.push(k)}static parse(c,u){if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(c[1],1,mn);if(!g)return null;const v=[];let k=null;u.expectedType&&u.expectedType.kind!=="value"&&(k=u.expectedType);for(let S=1;S=L)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const Z=u.parse(R,W,k);if(!Z)return null;k=k||Z.type,v.push([L,Z])}return new Mv(k,g,v)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;return v>=u[k-1]?g[k-1].evaluate(c):g[Rk(u,v)].evaluate(c)}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let u=0;u0&&c.push(this.labels[u]),c.push(this.outputs[u].serialize());return c}}const aP=.95047,iP=1.08883,oP=4/29,Fy=6/29,lP=3*Fy*Fy,Xae=Fy*Fy*Fy,Qae=Math.PI/180,Jae=180/Math.PI;function K3(f){return f>Xae?Math.pow(f,1/3):f/lP+oP}function Z3(f){return f>Fy?f*f*f:lP*(f-oP)}function Y3(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function X3(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function cP(f){const c=X3(f.r),u=X3(f.g),g=X3(f.b),v=K3((.4124564*c+.3575761*u+.1804375*g)/aP),k=K3((.2126729*c+.7151522*u+.072175*g)/1);return{l:116*k-16,a:500*(v-k),b:200*(k-K3((.0193339*c+.119192*u+.9503041*g)/iP)),alpha:f.a}}function Fk(f){let c=(f.l+16)/116,u=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*Z3(c),u=aP*Z3(u),g=iP*Z3(g),new Sa(Y3(3.2404542*u-1.5371385*c-.4985314*g),Y3(-.969266*u+1.8760108*c+.041556*g),Y3(.0556434*u-.2040259*c+1.0572252*g),f.alpha)}function zk(f,c,u){const g=c-f;return f+u*(g>180||g<-180?g-360*Math.round(g/360):g)}const zy={forward:cP,reverse:Fk,interpolate:function(f,c,u){return{l:Fn(f.l,c.l,u),a:Fn(f.a,c.a,u),b:Fn(f.b,c.b,u),alpha:Fn(f.alpha,c.alpha,u)}}},Tv={forward:function(f){const{l:c,a:u,b:g}=cP(f),v=Math.atan2(g,u)*Jae;return{h:v<0?v+360:v,c:Math.sqrt(u*u+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*Qae,u=f.c;return Fk({l:f.l,a:Math.cos(c)*u,b:Math.sin(c)*u,alpha:f.alpha})},interpolate:function(f,c,u){return{h:zk(f.h,c.h,u),c:Fn(f.c,c.c,u),l:Fn(f.l,c.l,u),alpha:Fn(f.alpha,c.alpha,u)}}};var dP=Object.freeze({__proto__:null,hcl:Tv,lab:zy});class bu{constructor(c,u,g,v,k){this.type=c,this.operator=u,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[S,L]of k)this.labels.push(S),this.outputs.push(L)}static interpolationFactor(c,u,g,v){let k=0;if(c.name==="exponential")k=Bk(u,c.base,g,v);else if(c.name==="linear")k=Bk(u,1,g,v);else if(c.name==="cubic-bezier"){const S=c.controlPoints;k=new Ro(S[0],S[1],S[2],S[3]).solve(Bk(u,1,g,v))}return k}static parse(c,u){let[g,v,k,...S]=c;if(!Array.isArray(v)||v.length===0)return u.error("Expected an interpolation type expression.",1);if(v[0]==="linear")v={name:"linear"};else if(v[0]==="exponential"){const $=v[1];if(typeof $!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:$}}else{if(v[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const $=v.slice(1);if($.length!==4||$.some(W=>typeof W!="number"||W<0||W>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);v={name:"cubic-bezier",controlPoints:$}}}if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(k=u.parse(k,2,mn),!k)return null;const L=[];let R=null;g==="interpolate-hcl"||g==="interpolate-lab"?R=kd:u.expectedType&&u.expectedType.kind!=="value"&&(R=u.expectedType);for(let $=0;$=W)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const ne=u.parse(Z,re,R);if(!ne)return null;R=R||ne.type,L.push([W,ne])}return R.kind==="number"||R.kind==="color"||R.kind==="array"&&R.itemType.kind==="number"&&typeof R.N=="number"?new bu(R,g,v,k,L):u.error(`Type ${Eo(R)} is not interpolatable.`)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;if(v>=u[k-1])return g[k-1].evaluate(c);const S=Rk(u,v),L=bu.interpolationFactor(this.interpolation,v,u[S],u[S+1]),R=g[S].evaluate(c),$=g[S+1].evaluate(c);return this.operator==="interpolate"?yv[this.type.kind.toLowerCase()](R,$,L):this.operator==="interpolate-hcl"?Tv.reverse(Tv.interpolate(Tv.forward(R),Tv.forward($),L)):zy.reverse(zy.interpolate(zy.forward(R),zy.forward($),L))}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){let c;c=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,c,this.input.serialize()];for(let g=0;gIm(v,L.type));return new Av(S?ja:g,k)}evaluate(c){let u,g=null,v=0;for(const k of this.args){if(v++,g=k.evaluate(c),g&&g instanceof ed&&!g.available&&(u||(u=g),g=null,v===this.args.length))return u;if(g!==null)break}return g}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){const c=["coalesce"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class bp{constructor(c,u){this.type=u.type,this.bindings=[].concat(c),this.result=u}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const u of this.bindings)c(u[1]);c(this.result)}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let k=1;k=g.length)throw new sl("Array index out of bounds: index exceeds array size");if(u!==Math.floor(u))throw new sl("Array index must be an integer. Use at-interpolated for fractional indices");return g[u]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Uk{constructor(c,u,g){this.type=c,this.index=u,this.input=g}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,mn),v=u.parse(c[2],2,vc(u.expectedType||ja));return g&&v?new Uk(v.type.itemType,g,v):null}evaluate(c){const u=this.index.evaluate(c),g=this.input.evaluate(c);if(u<0)throw new sl(`Array index out of bounds: ${u} < 0.`);if(u>g.length-1)throw new sl(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u===Math.floor(u))return g[u];const v=Math.floor(u),k=Math.ceil(u),S=g[v],L=g[k];if(typeof S!="number"||typeof L!="number")throw new sl(`Cannot interpolate between non-number values at index ${u}.`);const R=u-v;return S*(1-R)+L*R}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Q3{constructor(c,u){this.type=Da,this.needle=c,this.haystack=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,ja),v=u.parse(c[2],2,ja);return g&&v?E3(g.type,[Da,Gs,mn,Eh,ja])?new Q3(g,v):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${Eo(g.type)} instead`):null}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!bv(u,["boolean","string","number","null"]))throw new sl(`Expected first argument to be of type boolean, string, number or null, but found ${Eo(yl(u))} instead.`);if(!bv(g,["string","array"]))throw new sl(`Expected second argument to be of type array or string, but found ${Eo(yl(g))} instead.`);return g.indexOf(u)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class By{constructor(c,u,g){this.type=mn,this.needle=c,this.haystack=u,this.fromIndex=g}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,ja),v=u.parse(c[2],2,ja);if(!g||!v)return null;if(!E3(g.type,[Da,Gs,mn,Eh,ja]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${Eo(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,mn);return k?new By(g,v,k):null}return new By(g,v)}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!bv(u,["boolean","string","number","null"]))throw new sl(`Expected first argument to be of type boolean, string, number or null, but found ${Eo(yl(u))} instead.`);if(!bv(g,["string","array"]))throw new sl(`Expected second argument to be of type array or string, but found ${Eo(yl(g))} instead.`);if(this.fromIndex){const v=this.fromIndex.evaluate(c);return g.indexOf(u,v)}return g.indexOf(u)}eachChild(c){c(this.needle),c(this.haystack),this.fromIndex&&c(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const c=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),c]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ev{constructor(c,u,g,v,k,S){this.inputType=c,this.type=u,this.input=g,this.cases=v,this.outputs=k,this.otherwise=S}static parse(c,u){if(c.length<5)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return u.error("Expected an even number of arguments.");let g,v;u.expectedType&&u.expectedType.kind!=="value"&&(v=u.expectedType);const k={},S=[];for(let $=2;$Number.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,yl(ne)))return null}else g=yl(ne);if(k[String(ne)]!==void 0)return X.error("Branch labels must be unique.");k[String(ne)]=S.length}const re=u.parse(Z,$,v);if(!re)return null;v=v||re.type,S.push(re)}const L=u.parse(c[1],1,ja);if(!L)return null;const R=u.parse(c[c.length-1],c.length-1,v);return R?L.type.kind!=="value"&&u.concat(1).checkSubtype(g,L.type)?null:new Ev(g,v,L,k,S,R):null}evaluate(c){const u=this.input.evaluate(c);return(_k(yl(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(c)}eachChild(c){c(this.input),this.outputs.forEach(c),c(this.otherwise)}outputDefined(){return this.outputs.every(c=>c.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),g=[],v={};for(const S of u){const L=v[this.cases[S]];L===void 0?(v[this.cases[S]]=g.length,g.push([this.cases[S],[S]])):g[L][1].push(S)}const k=S=>this.inputType.kind==="number"?Number(S):S;for(const[S,L]of g)c.push(L.length===1?k(L[0]):L.map(k)),c.push(this.outputs[S].serialize());return c.push(this.otherwise.serialize()),c}}class Iv{constructor(c,u,g){this.type=c,this.branches=u,this.otherwise=g}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const v=[];for(let S=1;Su.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class qk{constructor(c,u,g,v){this.type=c,this.input=u,this.beginIndex=g,this.endIndex=v}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,ja),v=u.parse(c[2],2,mn);if(!g||!v)return null;if(!E3(g.type,[vc(ja),Gs,ja]))return u.error(`Expected first argument to be of type array or string, but found ${Eo(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,mn);return k?new qk(g.type,g,v,k):null}return new qk(g.type,g,v)}evaluate(c){const u=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!bv(u,["string","array"]))throw new sl(`Expected first argument to be of type array or string, but found ${Eo(yl(u))} instead.`);if(this.endIndex){const v=this.endIndex.evaluate(c);return u.slice(g,v)}return u.slice(g)}eachChild(c){c(this.input),c(this.beginIndex),this.endIndex&&c(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const c=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),c]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class J3{constructor(c,u){this.type=vc(Gs),this.str=c,this.delimiter=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,Gs),v=u.parse(c[2],2,Gs);return g&&v?new J3(g,v):void 0}evaluate(c){const u=this.str.evaluate(c),g=this.delimiter.evaluate(c);return u.split(g)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function e5(f,c){return f==="=="||f==="!="?c.kind==="boolean"||c.kind==="string"||c.kind==="number"||c.kind==="null"||c.kind==="value":c.kind==="string"||c.kind==="number"||c.kind==="value"}function t5(f,c,u,g){return g.compare(c,u)===0}function $y(f,c,u){const g=f!=="=="&&f!=="!=";return class T6e{constructor(k,S,L){this.type=Da,this.lhs=k,this.rhs=S,this.collator=L,this.hasUntypedArgument=k.type.kind==="value"||S.type.kind==="value"}static parse(k,S){if(k.length!==3&&k.length!==4)return S.error("Expected two or three arguments.");const L=k[0];let R=S.parse(k[1],1,ja);if(!R)return null;if(!e5(L,R.type))return S.concat(1).error(`"${L}" comparisons are not supported for type '${Eo(R.type)}'.`);let $=S.parse(k[2],2,ja);if(!$)return null;if(!e5(L,$.type))return S.concat(2).error(`"${L}" comparisons are not supported for type '${Eo($.type)}'.`);if(R.type.kind!==$.type.kind&&R.type.kind!=="value"&&$.type.kind!=="value")return S.error(`Cannot compare types '${Eo(R.type)}' and '${Eo($.type)}'.`);g&&(R.type.kind==="value"&&$.type.kind!=="value"?R=new Ih($.type,[R]):R.type.kind!=="value"&&$.type.kind==="value"&&($=new Ih(R.type,[$])));let W=null;if(k.length===4){if(R.type.kind!=="string"&&$.type.kind!=="string"&&R.type.kind!=="value"&&$.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(W=S.parse(k[3],3,vk),!W)return null}return new T6e(R,$,W)}evaluate(k){const S=this.lhs.evaluate(k),L=this.rhs.evaluate(k);if(g&&this.hasUntypedArgument){const R=yl(S),$=yl(L);if(R.kind!==$.kind||R.kind!=="string"&&R.kind!=="number")throw new sl(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${R.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const R=yl(S),$=yl(L);if(R.kind!=="string"||$.kind!=="string")return c(k,S,L)}return this.collator?u(k,S,L,this.collator.evaluate(k)):c(k,S,L)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}serialize(){const k=[f];return this.eachChild(S=>{k.push(S.serialize())}),k}}}const eie=$y("==",function(f,c,u){return c===u},t5),tie=$y("!=",function(f,c,u){return c!==u},function(f,c,u,g){return!t5(0,c,u,g)}),uP=$y("<",function(f,c,u){return c",function(f,c,u){return c>u},function(f,c,u,g){return g.compare(c,u)>0}),Vk=$y("<=",function(f,c,u){return c<=u},function(f,c,u,g){return g.compare(c,u)<=0}),rie=$y(">=",function(f,c,u){return c>=u},function(f,c,u,g){return g.compare(c,u)>=0});class Hk{constructor(c,u,g,v,k,S){this.type=Gs,this.number=c,this.locale=u,this.currency=g,this.unit=v,this.minFractionDigits=k,this.maxFractionDigits=S}static parse(c,u){if(c.length!==3)return u.error("Expected two arguments.");const g=u.parse(c[1],1,mn);if(!g)return null;const v=c[2];if(typeof v!="object"||Array.isArray(v))return u.error("NumberFormat options argument must be an object.");let k=null;if(v.locale&&(k=u.parseObjectValue(v.locale,2,"locale",Gs),!k))return null;let S=null;if(v.currency&&(S=u.parseObjectValue(v.currency,2,"currency",Gs),!S))return null;let L=null;if(v.unit&&(L=u.parseObjectValue(v.unit,2,"unit",Gs),!L))return null;let R=null;if(v["min-fraction-digits"]&&(R=u.parseObjectValue(v["min-fraction-digits"],2,"min-fraction-digits",mn),!R))return null;let $=null;return v["max-fraction-digits"]&&($=u.parseObjectValue(v["max-fraction-digits"],2,"max-fraction-digits",mn),!$)?null:new Hk(g,k,S,L,R,$)}evaluate(c){return new Intl.NumberFormat(this.locale?this.locale.evaluate(c):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(c):void 0,unit:this.unit?this.unit.evaluate(c):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(c):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(c):void 0}).format(this.number.evaluate(c))}eachChild(c){c(this.number),this.locale&&c(this.locale),this.currency&&c(this.currency),this.unit&&c(this.unit),this.minFractionDigits&&c(this.minFractionDigits),this.maxFractionDigits&&c(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const c={};return this.locale&&(c.locale=this.locale.serialize()),this.currency&&(c.currency=this.currency.serialize()),this.unit&&(c.unit=this.unit.serialize()),this.minFractionDigits&&(c["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(c["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),c]}}class r5{constructor(c){this.type=mn,this.input=c}static parse(c,u){if(c.length!==2)return u.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=u.parse(c[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 ${Eo(g.type)} instead.`):new r5(g):null}evaluate(c){const u=this.input.evaluate(c);if(typeof u=="string"||Array.isArray(u))return u.length;throw new sl(`Expected value to be of type string or array, but found ${Eo(yl(u))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(u=>{c.push(u.serialize())}),c}}function fP(f){return function(){f=1831565813+(f|=0)|0;let c=Math.imul(f^f>>>15,1|f);return c=c+Math.imul(c^c>>>7,61|c)^c,((c^c>>>14)>>>0)/4294967296}}const Uy={"==":eie,"!=":tie,">":hP,"<":uP,">=":rie,"<=":Vk,array:Ih,at:$k,"at-interpolated":Uk,boolean:Ih,case:Iv,coalesce:Av,collator:Ml,format:vf,image:as,in:Q3,"index-of":By,interpolate:bu,"interpolate-hcl":bu,"interpolate-lab":bu,length:r5,let:bp,literal:vp,match:Ev,number:Ih,"number-format":Hk,object:Ih,slice:qk,step:Mv,string:Ih,"to-boolean":_f,"to-color":_f,"to-number":_f,"to-string":_f,var:Ok,within:Dm,distance:Xg,config:Ry,split:J3};function n5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,S=Kg(c,u,g,k);if(S)throw new sl(S);return new Sa(c/255,u/255,g/255,k)}function s5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,S=function($,W,Z,X){return typeof $=="number"&&$>=0&&$<=360?typeof W=="number"&&W>=0&&W<=100&&typeof Z=="number"&&Z>=0&&Z<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[$,W,Z,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[$,W,Z,X]:[$,W,Z]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[$,W,Z,X]:[$,W,Z]).join(", ")}]: 'h' must be between 0 and 360.`}(c,u,g,k);if(S)throw new sl(S);const L=`hsla(${c}, ${u}%, ${g}%, ${k})`,R=Sa.parse(L);if(!R)throw new sl(`Failed to parse HSLA color: ${L}`);return R}function pP(f,c){return f in c}function a5(f,c){const u=c[f];return u===void 0?null:u}function zm(f){return{type:f}}function Qg(f){if(f instanceof Ry)return new Set([f.key]);let c=new Set;return f.eachChild(u=>{c=new Set([...c,...Qg(u)])}),c}function Wk(f){if(f instanceof td&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(u=>{!c&&Wk(u)&&(c=!0)}),c}function mP(f){return{result:"success",value:f}}function Bm(f){return{result:"error",value:f}}function i5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Pv(f){return f["property-type"]==="data-driven"}function gP(f){return i5(f.expression,"measure-light")}function xP(f){return i5(f.expression,"zoom")}function Gk(f){return!!f.expression&&f.expression.interpolated}function Kk(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function yP(f){return f}function vP(f,c){const u=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",v=g||!(g||f.property!==void 0),k=f.type||(Gk(c)?"exponential":"interval");if(u&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],Sa.parse($[1])])),f.default=Sa.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!dP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let S,L,R;if(k==="exponential")S=_P;else if(k==="interval")S=sie;else if(k==="categorical"){S=nie,L=Object.create(null);for(const $ of f.stops)L[$[0]]=$[1];R=typeof f.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);S=bP}if(g){const $={},W=[];for(let re=0;rere[0]),evaluate:({zoom:re},ne)=>_P({stops:Z,base:f.base},c,re).evaluate(re,ne)}}if(v){const $=k==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:bu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(W=>W[0]),evaluate:({zoom:W})=>S(f,c,W,L,R)}}return{kind:"source",evaluate($,W){const Z=W&&W.properties?W.properties[f.property]:void 0;return Z===void 0?wf(f.default,c.default):S(f,c,Z,L,R)}}}function wf(f,c,u){return f!==void 0?f:c!==void 0?c:u!==void 0?u:void 0}function nie(f,c,u,g,v){return wf(typeof u===v?g[u]:void 0,f.default,c.default)}function sie(f,c,u){if(!Ey(u))return wf(f.default,c.default);const g=f.stops.length;if(g===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[g-1][0])return f.stops[g-1][1];const v=Rk(f.stops.map(k=>k[0]),u);return f.stops[v][1]}function _P(f,c,u){const g=f.base!==void 0?f.base:1;if(!Ey(u))return wf(f.default,c.default);const v=f.stops.length;if(v===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[v-1][0])return f.stops[v-1][1];const k=Rk(f.stops.map(W=>W[0]),u),S=function(W,Z,X,re){const ne=re-X,fe=W-X;return ne===0?0:Z===1?fe/ne:(Math.pow(Z,fe)-1)/(Math.pow(Z,ne)-1)}(u,g,f.stops[k][0],f.stops[k+1][0]),L=f.stops[k][1],R=f.stops[k+1][1];let $=yv[c.type]||yP;if(f.colorSpace&&f.colorSpace!=="rgb"){const W=dP[f.colorSpace];$=(Z,X)=>W.reverse(W.interpolate(W.forward(Z),W.forward(X),S))}return typeof L.evaluate=="function"?{evaluate(...W){const Z=L.evaluate.apply(void 0,W),X=R.evaluate.apply(void 0,W);if(Z!==void 0&&X!==void 0)return $(Z,X,S)}}:$(L,R,S)}function bP(f,c,u){return c.type==="color"?u=Sa.parse(u):c.type==="formatted"?u=Jc.fromString(u.toString()):c.type==="resolvedImage"?u=ed.build(u.toString()):dn(u)===c.type||c.type==="enum"&&c.values[u]||(u=void 0),wf(u,f.default,c.default)}td.register(Uy,{error:[{kind:"error"},[Gs],(f,[c])=>{throw new sl(c.evaluate(f))}],typeof:[Gs,[ja],(f,[c])=>Eo(yl(c.evaluate(f)))],"to-rgba":[vc(mn,4),[kd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[vc(mn,4),[kd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[kd,[mn,mn,mn],n5],rgba:[kd,[mn,mn,mn,mn],n5],hsl:[kd,[mn,mn,mn],s5],hsla:[kd,[mn,mn,mn,mn],s5],has:{type:Da,overloads:[[[Gs],(f,[c])=>pP(c.evaluate(f),f.properties())],[[Gs,yf],(f,[c,u])=>pP(c.evaluate(f),u.evaluate(f))]]},get:{type:ja,overloads:[[[Gs],(f,[c])=>a5(c.evaluate(f),f.properties())],[[Gs,yf],(f,[c,u])=>a5(c.evaluate(f),u.evaluate(f))]]},"feature-state":[ja,[Gs],(f,[c])=>a5(c.evaluate(f),f.featureState||{})],properties:[yf,[],f=>f.properties()],"geometry-type":[Gs,[],f=>f.geometryType()],worldview:[Gs,[],f=>f.globals.worldview||""],"is-active-floor":[Da,zm(Gs),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const u=f.globals.activeFloors;return c.some(g=>{const v=g.evaluate(f);return u.has(v)})}],id:[ja,[],f=>f.id()],zoom:[mn,[],f=>f.globals.zoom],pitch:[mn,[],f=>f.globals.pitch||0],"distance-from-center":[mn,[],f=>f.distanceFromCenter()],"measure-light":[mn,[Gs],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[mn,[],f=>f.globals.heatmapDensity||0],"line-progress":[mn,[],f=>f.globals.lineProgress||0],"raster-value":[mn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[mn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[mn,[],f=>f.globals.skyRadialProgress||0],accumulated:[ja,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[mn,zm(mn),(f,c)=>{let u=0;for(const g of c)u+=g.evaluate(f);return u}],"*":[mn,zm(mn),(f,c)=>{let u=1;for(const g of c)u*=g.evaluate(f);return u}],"-":{type:mn,overloads:[[[mn,mn],(f,[c,u])=>c.evaluate(f)-u.evaluate(f)],[[mn],(f,[c])=>-c.evaluate(f)]]},"/":[mn,[mn,mn],(f,[c,u])=>c.evaluate(f)/u.evaluate(f)],"%":[mn,[mn,mn],(f,[c,u])=>c.evaluate(f)%u.evaluate(f)],ln2:[mn,[],()=>Math.LN2],pi:[mn,[],()=>Math.PI],e:[mn,[],()=>Math.E],"^":[mn,[mn,mn],(f,[c,u])=>Math.pow(c.evaluate(f),u.evaluate(f))],sqrt:[mn,[mn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[mn,[mn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[mn,[mn],(f,[c])=>Math.log(c.evaluate(f))],log2:[mn,[mn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[mn,[mn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[mn,[mn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[mn,[mn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[mn,[mn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[mn,[mn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[mn,[mn],(f,[c])=>Math.atan(c.evaluate(f))],min:[mn,zm(mn),(f,c)=>Math.min(...c.map(u=>u.evaluate(f)))],max:[mn,zm(mn),(f,c)=>Math.max(...c.map(u=>u.evaluate(f)))],abs:[mn,[mn],(f,[c])=>Math.abs(c.evaluate(f))],round:[mn,[mn],(f,[c])=>{const u=c.evaluate(f);return u<0?-Math.round(-u):Math.round(u)}],floor:[mn,[mn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[mn,[mn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Da,[Gs,ja],(f,[c,u])=>f.properties()[c.value]===u.value],"filter-id-==":[Da,[ja],(f,[c])=>f.id()===c.value],"filter-type-==":[Da,[Gs],(f,[c])=>f.geometryType()===c.value],"filter-<":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g{const u=f.id(),g=c.value;return typeof u==typeof g&&u":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>v}],"filter-id->":[Da,[ja],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>g}],"filter-<=":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Da,[ja],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u<=g}],"filter->=":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Da,[ja],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>=g}],"filter-has":[Da,[ja],(f,[c])=>c.value in f.properties()],"filter-has-id":[Da,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Da,[vc(Gs)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Da,[vc(ja)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Da,[Gs,vc(ja)],(f,[c,u])=>u.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Da,[Gs,vc(ja)],(f,[c,u])=>function(g,v,k,S){for(;k<=S;){const L=k+S>>1;if(v[L]===g)return!0;v[L]>g?S=L-1:k=L+1}return!1}(f.properties()[c.value],u.value,0,u.value.length-1)],all:{type:Da,overloads:[[[Da,Da],(f,[c,u])=>c.evaluate(f)&&u.evaluate(f)],[zm(Da),(f,c)=>{for(const u of c)if(!u.evaluate(f))return!1;return!0}]]},any:{type:Da,overloads:[[[Da,Da],(f,[c,u])=>c.evaluate(f)||u.evaluate(f)],[zm(Da),(f,c)=>{for(const u of c)if(u.evaluate(f))return!0;return!1}]]},"!":[Da,[Da],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Da,[Gs],(f,[c])=>{const u=f.globals&&f.globals.isSupportedScript;return!u||u(c.evaluate(f))}],upcase:[Gs,[Gs],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[Gs,[Gs],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[Gs,zm(ja),(f,c)=>c.map(u=>Qu(u.evaluate(f))).join("")],"resolved-locale":[Gs,[vk],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[mn,[mn,mn,ja],(f,c)=>{const[u,g,v]=c.map(S=>S.evaluate(f));if(u>g||u===g)return u;let k;if(typeof v=="string")k=function(S){let L=0;if(S.length===0)return L;for(let R=0;RJSON.stringify(Z)).join(", ")}, but found ${JSON.stringify(W)} instead.`);return W}catch(W){const Z=W;return this._warningHistory[Z.message]||(this._warningHistory[Z.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${Z.message}`)),this._defaultValue}}}function Lv(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in Uy}function $m(f,c,u,g,v){const k=new Dk(Uy,[],c?function(L){const R={color:kd,string:Gs,number:mn,enum:Gs,boolean:Da,formatted:vv,resolvedImage:_v};return L.type==="array"?vc(R[L.value]||ja,L.length):R[L.type]}(c):void 0,void 0,void 0,u,g,v),S=k.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return S?mP(new Zk(S,c,u,g,v)):Bm(k.errors)}class qy{constructor(c,u,g,v){this.kind=c,this._styleExpression=u,this.isLightConstant=g,this.isLineProgressConstant=v,this.isStateDependent=c!=="constant"&&!Cv(u.expression),this.configDependencies=Qg(u.expression),this.isIndoorDependent=Wk(u.expression)}evaluateWithoutErrorHandling(c,u,g,v,k,S){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,S)}evaluate(c,u,g,v,k,S,L){return this._styleExpression.evaluate(c,u,g,v,k,S,void 0,void 0,L)}}class Jg{constructor(c,u,g,v,k,S){this.kind=c,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=c!=="camera"&&!Cv(u.expression),this.isIndoorDependent=Wk(u.expression),this.isLightConstant=k,this.isLineProgressConstant=S,this.configDependencies=Qg(u.expression),this.interpolationType=v}evaluateWithoutErrorHandling(c,u,g,v,k,S){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,S)}evaluate(c,u,g,v,k,S){return this._styleExpression.evaluate(c,u,g,v,k,S)}interpolationFactor(c,u,g){return this.interpolationType?bu.interpolationFactor(this.interpolationType,c,u,g):0}}function o5(f,c,u,g,v){if((f=$m(f,c,u,g,v)).result==="error")return f;const k=f.value.expression,S=Oy(k);if(!S&&!Pv(c))return Bm([new Xu("","data expressions not supported")]);const L=Dy(k,["zoom","pitch","distance-from-center"]);if(!L&&!xP(c))return Bm([new Xu("","zoom expressions not supported")]);const R=Dy(k,["measure-light"]);if(!R&&!gP(c))return Bm([new Xu("","measure-light expression not supported")]);const $=Dy(k,["line-progress"]);if(!$&&!function(X){return i5(X.expression,"line-progress")}(c))return Bm([new Xu("","line-progress expression not supported")]);const W=c.expression&&c.expression.relaxZoomRestriction,Z=Lh(k);return Z||L||W?Z instanceof Xu?Bm([Z]):Z instanceof bu&&!Gk(c)?Bm([new Xu("",'"interpolate" expressions cannot be used with this property')]):mP(Z?new Jg(S&&$?"camera":"composite",f.value,Z.labels,Z instanceof bu?Z.interpolation:void 0,R,$):new qy(S&&$?"constant":"source",f.value,R,$)):Bm([new Xu("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Yk{constructor(c,u){this._parameters=c,this._specification=u,Object.assign(this,vP(this._parameters,this._specification))}static deserialize(c){return new Yk(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Lh(f){let c=null;if(f instanceof bp)c=Lh(f.result);else if(f instanceof Av){for(const u of f.args)if(c=Lh(u),c)break}else(f instanceof Mv||f instanceof bu)&&f.input instanceof td&&f.input.name==="zoom"&&(c=f);return c instanceof Xu||f.eachChild(u=>{const g=Lh(u);g instanceof Xu?c=g:c&&g&&c!==g&&(c=new Xu("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var l5,wP,jP=function(){if(wP)return l5;wP=1,l5=c;var f=3;function c(u,g,v){var k=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var S=new Int32Array(this.arrayBuffer);u=S[0],this.d=(g=S[1])+2*(v=S[2]);for(var L=0;L=X[fe+0]&&k>=X[fe+1])?(R[ne]=!0,L.push(Z[ne])):R[ne]=!1}}},c.prototype._forEachCell=function(u,g,v,k,S,L,R,$){for(var W=this._convertToCellCoord(u),Z=this._convertToCellCoord(g),X=this._convertToCellCoord(v),re=this._convertToCellCoord(k),ne=W;ne<=X;ne++)for(var fe=Z;fe<=re;fe++){var Ne=this.d*fe+ne;if((!$||$(this._convertFromCellCoord(ne),this._convertFromCellCoord(fe),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(fe+1)))&&S.call(this,u,g,v,k,Ne,L,R,$))return}},c.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},c.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,g=f+this.cells.length+1+1,v=0,k=0;k=0||(v[k]=wp(f[k],c)));f instanceof Error&&(v.message=f.message)}if(v.$name)throw new Error("$name property is reserved for worker serialization logic.");return g!=="Object"&&(v.$name=g),v}throw new Error("can't serialize object of type "+typeof f)}function Um(f){if(f==null||typeof f=="boolean"||typeof f=="number"||typeof f=="string"||f instanceof Boolean||f instanceof Number||f instanceof String||f instanceof Date||f instanceof RegExp||Ov(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(Um);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const v=f.entries||[],k=new Map;for(let S=0;Sf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519,Osage:f=>f>=66736&&f<=66815,"CJK Unified Ideographs Extension B":f=>f>=131072&&f<=173791};function Dv(f){for(const c of f)if(Xk(c.charCodeAt(0)))return!0;return!1}function c5(f){for(const c of f)if(!kP(c.charCodeAt(0)))return!1;return!0}function kP(f){return!(An.Arabic(f)||An["Arabic Supplement"](f)||An["Arabic Extended-A"](f)||An["Arabic Presentation Forms-A"](f)||An["Arabic Presentation Forms-B"](f))}function Xk(f){return!(f!==746&&f!==747&&(f<4352||!(An["Bopomofo Extended"](f)||An.Bopomofo(f)||An["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||An["CJK Compatibility Ideographs"](f)||An["CJK Compatibility"](f)||An["CJK Radicals Supplement"](f)||An["CJK Strokes"](f)||!(!An["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||An["CJK Unified Ideographs Extension A"](f)||An["CJK Unified Ideographs"](f)||An["Enclosed CJK Letters and Months"](f)||An["Hangul Compatibility Jamo"](f)||An["Hangul Jamo Extended-A"](f)||An["Hangul Jamo Extended-B"](f)||An["Hangul Jamo"](f)||An["Hangul Syllables"](f)||An.Hiragana(f)||An["Ideographic Description Characters"](f)||An.Kanbun(f)||An["Kangxi Radicals"](f)||An["Katakana Phonetic Extensions"](f)||An.Katakana(f)&&f!==12540||!(!An["Halfwidth and Fullwidth Forms"](f)||f===65288||f===65289||f===65293||f>=65306&&f<=65310||f===65339||f===65341||f===65343||f>=65371&&f<=65503||f===65507||f>=65512&&f<=65519)||!(!An["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||An["Unified Canadian Aboriginal Syllabics"](f)||An["Unified Canadian Aboriginal Syllabics Extended"](f)||An["Vertical Forms"](f)||An["Yijing Hexagram Symbols"](f)||An["Yi Syllables"](f)||An["Yi Radicals"](f))))}function Qk(f){return!(Xk(f)||function(c){return!!(An["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||An["General Punctuation"](c)&&(c===8214||c===8224||c===8225||c===8240||c===8241||c===8251||c===8252||c===8258||c===8263||c===8264||c===8265||c===8273)||An["Letterlike Symbols"](c)||An["Number Forms"](c)||An["Miscellaneous Technical"](c)&&(c>=8960&&c<=8967||c>=8972&&c<=8991||c>=8996&&c<=9e3||c===9003||c>=9085&&c<=9114||c>=9150&&c<=9165||c===9167||c>=9169&&c<=9179||c>=9186&&c<=9215)||An["Control Pictures"](c)&&c!==9251||An["Optical Character Recognition"](c)||An["Enclosed Alphanumerics"](c)||An["Geometric Shapes"](c)||An["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||An["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||An["CJK Symbols and Punctuation"](c)||An.Katakana(c)||An["Private Use Area"](c)||An["CJK Compatibility Forms"](c)||An["Small Form Variants"](c)||An["Halfwidth and Fullwidth Forms"](c)||c===8734||c===8756||c===8757||c>=9984&&c<=10087||c>=10102&&c<=10131||c===65532||c===65533)}(f))}function Jk(f){return An.Arabic(f)||An["Arabic Supplement"](f)||An["Arabic Extended-A"](f)||An["Arabic Presentation Forms-A"](f)||An["Arabic Presentation Forms-B"](f)}function d5(f){return f>=1424&&f<=2303||An["Arabic Presentation Forms-A"](f)||An["Arabic Presentation Forms-B"](f)}function jp(f,c){return!(!c&&d5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||An.Khmer(f))}function aie(f){for(const c of f)if(d5(c.charCodeAt(0)))return!0;return!1}const Gd={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let u5=null,rd=Gd.unavailable,kp=null;const Rv=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(rd=Gd.error),u5&&u5(f)};function eN(){tN.fire(new Hn("pluginStateChange",{pluginStatus:rd,pluginURL:kp}))}const tN=new mi,Fv=function(){return rd},NP=function(){if(rd!==Gd.deferred||!kp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");rd=Gd.loading,eN(),kp&&Th({url:kp},f=>{f?Rv(f):(rd=Gd.loaded,eN())})},Np={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>rd===Gd.loaded||Np.applyArabicShaping!=null,isLoading:()=>rd===Gd.loading,setState(f){rd=f.pluginStatus,kp=f.pluginURL},isParsing:()=>rd===Gd.parsing,isParsed:()=>rd===Gd.parsed,getPluginURL:()=>kp};class ti{constructor(c,u){this.zoom=c,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(c){return function(u,g){for(const v of u)if(!jp(v.charCodeAt(0),g))return!1;return!0}(c,Np.isLoaded())}}class rN{constructor(c,u,g,v,k){this.property=c,this.value=u,this.expression=function(S,L,R,$,W){if(Kk(S))return new Yk(S,L);if(Lv(S)||Array.isArray(S)&&S.length>0){const Z=o5(S,L,R,$,W);if(Z.result==="error")throw new Error(Z.value.map(X=>`${X.key}: ${X.message}`).join(", "));return Z.value}{let Z=S;return typeof S=="string"&&L.type==="color"&&(Z=Sa.parse(S)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>Z}}}(u===void 0?c.specification.default:u,c.specification,g,v,k)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,u,g,v){return this.property.possiblyEvaluate(this,c,u,g,v)}}class h5{constructor(c,u,g,v){this.property=c,this.value=new rN(c,void 0,u,g,v)}transitioned(c,u){return new CP(this.property,this.value,u,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new CP(this.property,this.value,null,{},0)}}class SP{constructor(c,u,g,v){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=u,this._options=g,this._iconImageUseTheme=v,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return ar(this._values[c].value.value)}setValue(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new h5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new rN(this._values[c].property,u===null?void 0:ar(u),this._scope,this._options,this._iconImageUseTheme),this._values[c].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[c].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[c].value.isIndoorDependent())}setTransitionOrValue(c,u){u&&(this._options=u);const g=this._properties.properties;if(c)for(const v in c){const k=c[v];if(v.endsWith("-transition")){const S=v.slice(0,-11);g[S]&&this.setTransition(S,k)}else g.hasOwnProperty(v)&&this.setValue(v,k)}}getTransition(c){return ar(this._values[c].transition)}setTransition(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new h5(this._values[c].property)),this._values[c].transition=ar(u)||void 0}serialize(){const c={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(c[u]=g);const v=this.getTransition(u);v!==void 0&&(c[`${u}-transition`]=v)}return c}transitioned(c,u){const g=new MP(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(c,u._values[v]);return g}untransitioned(){const c=new MP(this._properties);for(const u of Object.keys(this._values))c._values[u]=this._values[u].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class CP{constructor(c,u,g,v,k){const S=v.delay||0,L=v.duration||0;k=k||0,this.property=c,this.value=u,this.begin=k+S,this.end=this.begin+L,c.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(c,u,g){const v=c.now||0,k=this.value.possiblyEvaluate(c,u,g),S=this.prior;if(S){if(v>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(v":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 AP(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function nN(f){if(Array.isArray(f))return f.map(nN);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const u in f)c[u]=nN(f[u]);return c}return AP(f)}function jf(f){if(f===!0||f===!1)return!0;if(!Array.isArray(f)||f.length===0)return!1;switch(f[0]){case"has":return f.length>=2&&f[1]!=="$id"&&f[1]!=="$type";case"in":return f.length>=3&&(typeof f[1]!="string"||Array.isArray(f[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return f.length!==3||Array.isArray(f[1])||Array.isArray(f[2]);case"any":case"all":for(const c of f.slice(1))if(!jf(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function sN(f,c="",u=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};jf(f)||(f=aN(f));const v=f;let k=!0;try{k=function(W){if(!Hy(W))return W;let Z=nN(W);return EP(Z),Z=sx(Z),Z}(v)}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(v,null,2)} `)}let S=null,L=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){L=Ft[`filter_${g}`];const W=$m(k,L,c,u);if(W.result==="error")throw new Error(W.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));S=(Z,X,re)=>W.value.evaluate(Z,X,{},re)}let R=null,$=null;if(k!==v){const W=$m(v,L,c,u);if(W.result==="error")throw new Error(W.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));R=(Z,X,re,ne,fe)=>W.value.evaluate(Z,X,{},re,void 0,void 0,ne,fe),$=!Oy(W.value.expression)}return{filter:S,dynamicFilter:R||void 0,needGeometry:IP(k),needFeature:!!$}}function sx(f){if(!Array.isArray(f))return f;const c=function(u){if(iie.has(u[0])){for(let g=1;gsx(u))}function EP(f){let c=!1;const u=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function oie(f,c){return fc?1:0}function IP(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?iN(f[1],f[2],c):c==="any"?(u=f.slice(1),["any"].concat(u.map(aN))):c==="all"?["all"].concat(f.slice(1).map(aN)):c==="none"?["all"].concat(f.slice(1).map(aN).map(zv)):c==="in"?oN(f[1],f.slice(2)):c==="!in"?zv(oN(f[1],f.slice(2))):c==="has"?lN(f[1]):c!=="!has"||zv(lN(f[1]));var u}function iN(f,c,u){switch(f){case"$type":return[`filter-type-${u}`,c];case"$id":return[`filter-id-${u}`,c];default:return[`filter-${u}`,f,c]}}function oN(f,c){if(c.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some(u=>typeof u!=typeof c[0])?["filter-in-large",f,["literal",c.sort(oie)]]:["filter-in-small",f,["literal",c]]}}function lN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function zv(f){return["!",f]}const ax="";function Oh(f,c){return c?`${f}${ax}${c}`:f}let PP;const LP=()=>PP||(PP=new Wi({"icon-size":new Er(Ft.layout_symbol["icon-size"]),"icon-image":new Er(Ft.layout_symbol["icon-image"]),"icon-rotate":new Er(Ft.layout_symbol["icon-rotate"]),"icon-offset":new Er(Ft.layout_symbol["icon-offset"]),"text-size":new Er(Ft.layout_symbol["text-size"]),"text-rotate":new Er(Ft.layout_symbol["text-rotate"]),"text-offset":new Er(Ft.layout_symbol["text-offset"])}));class OP{constructor(c,u,g,v,k,S){const L=$m(c,Ft.appearance.condition);if(L.result==="success"&&(this.condition=L.value),this.name=u,g){this.properties=new rx(LP()),this.unevaluatedLayout=new TP(LP(),v,k,S);for(const R in g)this.unevaluatedLayout.setValue(R,g[R])}}isActive(c){return!(this.condition||!c.isHidden||this.name!=="hidden")||this.condition.evaluate(c.globals,c.feature,c.featureState,c.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(c){return this.properties.get(c)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(c){return this.unevaluatedLayout._values[c]}recalculate(c,u,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,u,g))}serialize(){const c={};return c.condition=this.condition.expression.serialize(),this.name&&(c.name=this.name),this.unevaluatedLayout&&(c.properties=this.unevaluatedLayout.serialize()),c}hasIconProperties(){const c=this.hasProperty("icon-image"),u=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),v=this.hasProperty("icon-rotate");return c||u||g||v}hasTextProperties(){const c=this.hasProperty("text-size"),u=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||u||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const DP="-transition",kf=new Set(["fill","line","background","hillshade","raster"]);class nd extends mi{constructor(c,u,g,v,k,S){if(super(),this.id=c.id,this.fqid=Oh(this.id,g),this.type=c.type,this.scope=g,this.lut=v,this.options=k,this.iconImageUseTheme=S,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},c.type!=="custom"){if(this.metadata=c.metadata,this.minzoom=c.minzoom,this.maxzoom=c.maxzoom,c.type&&c.type!=="background"&&c.type!=="sky"&&c.type!=="slot"){this.source=c.source,this.sourceLayer=c["source-layer"],this.filter=c.filter;const L=$m(this.filter,Ft[`filter_${c.type}`]);L.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...L.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||L.value.isIndoorDependent)}if(c.slot&&(this.slot=c.slot),c.appearances&&this.setAppearances(c.appearances),u.layout&&(this._unevaluatedLayout=new TP(u.layout,this.scope,k,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 SP(u.paint,this.scope,k);for(const L in c.paint)this.setPaintProperty(L,c.paint[L]);for(const L in c.layout)this.setLayoutProperty(L,c.layout[L]);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 rx(u.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&kf.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,u){if(this.type==="custom"&&c==="visibility")return void(this.visibility=u);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),c==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(c){this.appearances=[],c.forEach(u=>{this.appearances.push(new OP(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(c){return c.endsWith(DP)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,u){const g=this._transitionablePaint,v=g._properties.properties;if(c.endsWith(DP)){const Z=c.slice(0,-11);return v[Z]&&g.setTransition(Z,u||void 0),!1}if(!v[c])return!1;const k=g._values[c],S=k.value.isDataDriven(),L=k.value;g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const R=g._values[c].value,$=R.isDataDriven(),W=c.endsWith("pattern")||c==="line-dasharray";return $||S||W||this._handleOverridablePaintPropertyUpdate(c,L,R)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,u,g){return null}_handleOverridablePaintPropertyUpdate(c,u,g){return!1}isHidden(c){return!!(this.minzoom&&c=this.maxzoom)||this.visibility==="none"}updateTransitions(c){this._transitioningPaint=this._transitionablePaint.transitioned(c,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(c,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,u,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,u)}serialize(){const c={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&&(c.appearances=this.appearances.map(u=>u.serialize())),fr(c,(u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length))}is3D(c){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 c in this.paint._values){const u=this.paint.get(c);if(u instanceof tx&&Pv(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}for(const c of this.appearances)if(!Cv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=sN(this.filter,this.scope,c),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(c){this._stats&&(c.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(c,u,g){return{}}queryRadius(c){}queryIntersectsFeature(c,u,g,v,k,S,L,R,$){}}const RP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Bv{constructor(c,u){this._structArray=c,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const lie=new ArrayBuffer(0);class gi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,u){return c._trim(),u&&c.arrayBuffer&&u.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const u=Object.create(this.prototype);return u.arrayBuffer=c.arrayBuffer,u.length=c.length,c.arrayBuffer?u.capacity=c.arrayBuffer.byteLength/u.bytesPerElement:(u.capacity=0,u.arrayBuffer=lie),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(c){this.reserve(c),this.length=c}reserve(c){if(c>this.capacity){this._reallocCount++,this.capacity=Math.max(c,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(c){this.reserve(this.length+c)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...c){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...c){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 Ts(f,c=1){let u=0,g=0;return{members:f.map(v=>{const k=RP[v.type].BYTES_PER_ELEMENT,S=u=FP(u,Math.max(c,k)),L=v.components||1;return g=Math.max(g,k),u+=k*L,{name:v.name,type:v.type,components:L,offset:S}}),size:FP(u,Math.max(g,c)),alignment:c}}function FP(f,c){return Math.ceil(f/c)*c}class qm extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.int16[v+0]=u,this.int16[v+1]=g,c}}qm.prototype.bytesPerElement=4,Yr(qm,"StructArrayLayout2i4");class Wy extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}Wy.prototype.bytesPerElement=6,Yr(Wy,"StructArrayLayout3i6");class Gy extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.int16[S+0]=u,this.int16[S+1]=g,this.int16[S+2]=v,this.int16[S+3]=k,c}}Gy.prototype.bytesPerElement=8,Yr(Gy,"StructArrayLayout4i8");class Sp extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.float32[1*c+0]=u,c}}Sp.prototype.bytesPerElement=4,Yr(Sp,"StructArrayLayout1f4");class f5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c,S=2*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.float32[S+1]=v,c}}f5.prototype.bytesPerElement=8,Yr(f5,"StructArrayLayout2i1f8");class p5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}p5.prototype.bytesPerElement=8,Yr(p5,"StructArrayLayout3i8");class m5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const L=5*c;return this.int16[L+0]=u,this.int16[L+1]=g,this.int16[L+2]=v,this.int16[L+3]=k,this.int16[L+4]=S,c}}m5.prototype.bytesPerElement=10,Yr(m5,"StructArrayLayout5i10");class cN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,L)}emplace(c,u,g,v,k,S,L,R){const $=6*c,W=12*c,Z=3*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.uint8[W+4]=v,this.uint8[W+5]=k,this.uint8[W+6]=S,this.uint8[W+7]=L,this.float32[Z+2]=R,c}}cN.prototype.bytesPerElement=12,Yr(cN,"StructArrayLayout2i4ub1f12");class wu extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.float32[k+0]=u,this.float32[k+1]=g,this.float32[k+2]=v,c}}wu.prototype.bytesPerElement=12,Yr(wu,"StructArrayLayout3f12");class Nd extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const L=6*c,R=3*c;return this.uint16[L+0]=u,this.uint16[L+1]=g,this.uint16[L+2]=v,this.uint16[L+3]=k,this.float32[R+2]=S,c}}Nd.prototype.bytesPerElement=12,Yr(Nd,"StructArrayLayout4ui1f12");class ix extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.uint16[S+0]=u,this.uint16[S+1]=g,this.uint16[S+2]=v,this.uint16[S+3]=k,c}}ix.prototype.bytesPerElement=8,Yr(ix,"StructArrayLayout4ui8");class dN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const L=this.length;return this.resize(L+1),this.emplace(L,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,L){const R=6*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.int16[R+3]=k,this.int16[R+4]=S,this.int16[R+5]=L,c}}dN.prototype.bytesPerElement=12,Yr(dN,"StructArrayLayout6i12");class g5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L,R,$,W,Z,X){const re=this.length;return this.resize(re+1),this.emplace(re,c,u,g,v,k,S,L,R,$,W,Z,X)}emplace(c,u,g,v,k,S,L,R,$,W,Z,X,re){const ne=12*c;return this.int16[ne+0]=u,this.int16[ne+1]=g,this.int16[ne+2]=v,this.int16[ne+3]=k,this.uint16[ne+4]=S,this.uint16[ne+5]=L,this.uint16[ne+6]=R,this.uint16[ne+7]=$,this.int16[ne+8]=W,this.int16[ne+9]=Z,this.int16[ne+10]=X,this.int16[ne+11]=re,c}}g5.prototype.bytesPerElement=24,Yr(g5,"StructArrayLayout4i4ui4i24");class x5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const L=this.length;return this.resize(L+1),this.emplace(L,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,L){const R=10*c,$=5*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.float32[$+2]=k,this.float32[$+3]=S,this.float32[$+4]=L,c}}x5.prototype.bytesPerElement=20,Yr(x5,"StructArrayLayout3i3f20");class Vm extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.float32[S+0]=u,this.float32[S+1]=g,this.float32[S+2]=v,this.float32[S+3]=k,c}}Vm.prototype.bytesPerElement=16,Yr(Vm,"StructArrayLayout4f16");class uN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint32[1*c+0]=u,c}}uN.prototype.bytesPerElement=4,Yr(uN,"StructArrayLayout1ul4");class ju extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.uint16[v+0]=u,this.uint16[v+1]=g,c}}ju.prototype.bytesPerElement=4,Yr(ju,"StructArrayLayout2ui4");class hN extends gi{_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(c,u,g,v,k,S,L,R,$,W,Z,X,re){const ne=this.length;return this.resize(ne+1),this.emplace(ne,c,u,g,v,k,S,L,R,$,W,Z,X,re)}emplace(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne){const fe=20*c,Ne=10*c;return this.int16[fe+0]=u,this.int16[fe+1]=g,this.int16[fe+2]=v,this.int16[fe+3]=k,this.int16[fe+4]=S,this.float32[Ne+3]=L,this.float32[Ne+4]=R,this.float32[Ne+5]=$,this.float32[Ne+6]=W,this.int16[fe+14]=Z,this.uint32[Ne+8]=X,this.uint16[fe+18]=re,this.uint16[fe+19]=ne,c}}hN.prototype.bytesPerElement=40,Yr(hN,"StructArrayLayout5i4f1i1ul2ui40");class fN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,L)}emplace(c,u,g,v,k,S,L,R){const $=8*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.int16[$+2]=v,this.int16[$+4]=k,this.int16[$+5]=S,this.int16[$+6]=L,this.int16[$+7]=R,c}}fN.prototype.bytesPerElement=16,Yr(fN,"StructArrayLayout3i2i2i16");class pN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const L=4*c,R=8*c;return this.float32[L+0]=u,this.float32[L+1]=g,this.float32[L+2]=v,this.int16[R+6]=k,this.int16[R+7]=S,c}}pN.prototype.bytesPerElement=16,Yr(pN,"StructArrayLayout2f1f2i16");class y5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const L=this.length;return this.resize(L+1),this.emplace(L,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,L){const R=20*c,$=5*c;return this.uint8[R+0]=u,this.uint8[R+1]=g,this.float32[$+1]=v,this.float32[$+2]=k,this.float32[$+3]=S,this.float32[$+4]=L,c}}y5.prototype.bytesPerElement=20,Yr(y5,"StructArrayLayout2ub4f20");class qo extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.uint16[k+0]=u,this.uint16[k+1]=g,this.uint16[k+2]=v,c}}qo.prototype.bytesPerElement=6,Yr(qo,"StructArrayLayout3ui6");class Ky extends gi{_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(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht){const ot=this.length;return this.resize(ot+1),this.emplace(ot,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht)}emplace(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht,ot){const _t=30*c,Ct=15*c,Et=60*c;return this.int16[_t+0]=u,this.int16[_t+1]=g,this.int16[_t+2]=v,this.float32[Ct+2]=k,this.float32[Ct+3]=S,this.uint16[_t+8]=L,this.uint16[_t+9]=R,this.uint32[Ct+5]=$,this.uint32[Ct+6]=W,this.uint32[Ct+7]=Z,this.uint16[_t+16]=X,this.uint16[_t+17]=re,this.uint16[_t+18]=ne,this.float32[Ct+10]=fe,this.float32[Ct+11]=Ne,this.uint8[Et+48]=je,this.uint8[Et+49]=Re,this.uint8[Et+50]=$e,this.uint32[Ct+13]=Ze,this.int16[_t+28]=ht,this.uint8[Et+58]=ot,c}}Ky.prototype.bytesPerElement=60,Yr(Ky,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class v5 extends gi{_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(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht,ot,_t,Ct,Et,Kt,Rt,rr,or,lr,xr,vr,ur){const pr=this.length;return this.resize(pr+1),this.emplace(pr,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht,ot,_t,Ct,Et,Kt,Rt,rr,or,lr,xr,vr,ur)}emplace(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht,ot,_t,Ct,Et,Kt,Rt,rr,or,lr,xr,vr,ur,pr){const tr=20*c,Xt=40*c,mr=80*c;return this.float32[tr+0]=u,this.float32[tr+1]=g,this.int16[Xt+4]=v,this.int16[Xt+5]=k,this.int16[Xt+6]=S,this.int16[Xt+7]=L,this.int16[Xt+8]=R,this.int16[Xt+9]=$,this.int16[Xt+10]=W,this.int16[Xt+11]=Z,this.int16[Xt+12]=X,this.uint16[Xt+13]=re,this.uint16[Xt+14]=ne,this.uint16[Xt+15]=fe,this.uint16[Xt+16]=Ne,this.uint16[Xt+17]=je,this.uint16[Xt+18]=Re,this.uint16[Xt+19]=$e,this.uint16[Xt+20]=Ze,this.uint16[Xt+21]=ht,this.uint16[Xt+22]=ot,this.uint16[Xt+23]=_t,this.uint16[Xt+24]=Ct,this.uint16[Xt+25]=Et,this.uint16[Xt+26]=Kt,this.uint16[Xt+27]=Rt,this.uint32[tr+14]=rr,this.float32[tr+15]=or,this.float32[tr+16]=lr,this.float32[tr+17]=xr,this.float32[tr+18]=vr,this.uint8[mr+76]=ur,this.uint16[Xt+39]=pr,c}}v5.prototype.bytesPerElement=80,Yr(v5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class _5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const L=this.length;return this.resize(L+1),this.emplace(L,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,L){const R=6*c;return this.float32[R+0]=u,this.float32[R+1]=g,this.float32[R+2]=v,this.float32[R+3]=k,this.float32[R+4]=S,this.float32[R+5]=L,c}}_5.prototype.bytesPerElement=24,Yr(_5,"StructArrayLayout6f24");class ox extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const L=5*c;return this.float32[L+0]=u,this.float32[L+1]=g,this.float32[L+2]=v,this.float32[L+3]=k,this.float32[L+4]=S,c}}ox.prototype.bytesPerElement=20,Yr(ox,"StructArrayLayout5f20");class b5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,L)}emplace(c,u,g,v,k,S,L,R){const $=7*c;return this.float32[$+0]=u,this.float32[$+1]=g,this.float32[$+2]=v,this.float32[$+3]=k,this.float32[$+4]=S,this.float32[$+5]=L,this.float32[$+6]=R,c}}b5.prototype.bytesPerElement=28,Yr(b5,"StructArrayLayout7f28");class w5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L,R,$,W,Z){const X=this.length;return this.resize(X+1),this.emplace(X,c,u,g,v,k,S,L,R,$,W,Z)}emplace(c,u,g,v,k,S,L,R,$,W,Z,X){const re=11*c;return this.float32[re+0]=u,this.float32[re+1]=g,this.float32[re+2]=v,this.float32[re+3]=k,this.float32[re+4]=S,this.float32[re+5]=L,this.float32[re+6]=R,this.float32[re+7]=$,this.float32[re+8]=W,this.float32[re+9]=Z,this.float32[re+10]=X,c}}w5.prototype.bytesPerElement=44,Yr(w5,"StructArrayLayout11f44");class Zy extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L,R,$){const W=this.length;return this.resize(W+1),this.emplace(W,c,u,g,v,k,S,L,R,$)}emplace(c,u,g,v,k,S,L,R,$,W){const Z=9*c;return this.float32[Z+0]=u,this.float32[Z+1]=g,this.float32[Z+2]=v,this.float32[Z+3]=k,this.float32[Z+4]=S,this.float32[Z+5]=L,this.float32[Z+6]=R,this.float32[Z+7]=$,this.float32[Z+8]=W,c}}Zy.prototype.bytesPerElement=36,Yr(Zy,"StructArrayLayout9f36");class Nf extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.float32[v+0]=u,this.float32[v+1]=g,c}}Nf.prototype.bytesPerElement=8,Yr(Nf,"StructArrayLayout2f8");class Sd extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=6*c;return this.uint32[3*c+0]=u,this.uint16[S+2]=g,this.uint16[S+3]=v,this.uint16[S+4]=k,c}}Sd.prototype.bytesPerElement=12,Yr(Sd,"StructArrayLayout1ul3ui12");class Hm extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint16[1*c+0]=u,c}}Hm.prototype.bytesPerElement=2,Yr(Hm,"StructArrayLayout1ui2");class j5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne){const je=this.length;return this.resize(je+1),this.emplace(je,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne)}emplace(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je){const Re=16*c;return this.float32[Re+0]=u,this.float32[Re+1]=g,this.float32[Re+2]=v,this.float32[Re+3]=k,this.float32[Re+4]=S,this.float32[Re+5]=L,this.float32[Re+6]=R,this.float32[Re+7]=$,this.float32[Re+8]=W,this.float32[Re+9]=Z,this.float32[Re+10]=X,this.float32[Re+11]=re,this.float32[Re+12]=ne,this.float32[Re+13]=fe,this.float32[Re+14]=Ne,this.float32[Re+15]=je,c}}j5.prototype.bytesPerElement=64,Yr(j5,"StructArrayLayout16f64");class mN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,L){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,L)}emplace(c,u,g,v,k,S,L,R){const $=10*c,W=5*c;return this.uint16[$+0]=u,this.uint16[$+1]=g,this.uint16[$+2]=v,this.uint16[$+3]=k,this.float32[W+2]=S,this.float32[W+3]=L,this.float32[W+4]=R,c}}mN.prototype.bytesPerElement=20,Yr(mN,"StructArrayLayout4ui3f20");class k5 extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.int16[1*c+0]=u,c}}k5.prototype.bytesPerElement=2,Yr(k5,"StructArrayLayout1i2");class gN extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint8[1*c+0]=u,c}}gN.prototype.bytesPerElement=1,Yr(gN,"StructArrayLayout1ub1");class xN extends Bv{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]}}xN.prototype.size=40;class zP extends hN{get(c){return new xN(this,c)}}Yr(zP,"CollisionBoxArray");class yN extends Bv{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(c){this._structArray.uint8[this._pos1+49]=c}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(c){this._structArray.uint8[this._pos1+50]=c}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(c){this._structArray.uint32[this._pos4+13]=c}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(c){this._structArray.uint8[this._pos1+58]=c}}yN.prototype.size=60;class BP extends Ky{get(c){return new yN(this,c)}}Yr(BP,"PlacedSymbolArray");class $P extends Bv{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(c){this._structArray.uint32[this._pos4+14]=c}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(c){this._structArray.float32[this._pos4+18]=c}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}$P.prototype.size=80;class N5 extends v5{get(c){return new $P(this,c)}}Yr(N5,"SymbolInstanceArray");class vN extends Sp{getoffsetX(c){return this.float32[1*c+0]}}Yr(vN,"GlyphOffsetArray");class UP extends qm{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}Yr(UP,"SymbolLineVertexArray");class S5 extends Bv{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]}}S5.prototype.size=12;class C5 extends Sd{get(c){return new S5(this,c)}}Yr(C5,"FeatureIndexArray");class qP extends ju{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}Yr(qP,"FillExtrusionCentroidArray");class _N extends Bv{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]}}_N.prototype.size=6;class $v extends Wy{get(c){return new _N(this,c)}}Yr($v,"FillExtrusionWallArray");const VP=Ts([{name:"a_pos",components:2,type:"Int16"}],4),cie=Ts([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),HP=Ts([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Oi{constructor(c=[]){this.segments=c}_prepareSegment(c,u,g,v){let k=this.segments[this.segments.length-1];return c>Oi.MAX_VERTEX_ARRAY_LENGTH&&Ur(`Max vertices per segment is ${Oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!k||k.vertexLength+c>Oi.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==v)&&(k={vertexOffset:u,primitiveOffset:g,vertexLength:0,primitiveLength:0},v!==void 0&&(k.sortKey=v),this.segments.push(k)),k}prepareSegment(c,u,g,v){return this._prepareSegment(c,u.length,g.length,v)}get(){return this.segments}destroy(){for(const c of this.segments)for(const u in c.vaos)c.vaos[u].destroy()}static simpleSegment(c,u,g,v){return new Oi([{vertexOffset:c,primitiveOffset:u,vertexLength:g,primitiveLength:v,vaos:{},sortKey:0}])}}function bN(f,c){return 256*(f=xe(Math.floor(f),0,255))+xe(Math.floor(c),0,255)}Oi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Yr(Oi,"SegmentVector");const die=Ts([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),uie=Ts([{name:"a_pattern_b",components:4,type:"Uint16"}]),hie=Ts([{name:"a_dash",components:4,type:"Uint16"}]);class Uv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,u,g,v){this.ids.push(M5(c)),this.positions.push(u,g,v)}eachPosition(c,u){const g=M5(c);let v=0,k=this.ids.length-1;for(;v>1;this.ids[S]>=g?k=S:v=S+1}for(;this.ids[v]===g;)u(this.positions[3*v],this.positions[3*v+1],this.positions[3*v+2]),v++}static serialize(c,u){const g=new Float64Array(c.ids),v=new Uint32Array(c.positions);return T5(g,v,0,g.length-1),u&&(u.add(g.buffer),u.add(v.buffer)),{ids:g,positions:v}}static deserialize(c){const u=new Uv;let g;u.ids=c.ids,u.positions=c.positions;for(const v of u.ids)v!==g&&u.uniqueIds.push(v),g=v;return u.indexed=!0,u}}function M5(f){const c=+f;return Number.isSafeInteger(c)?c:Pr(String(f))}function T5(f,c,u,g){for(;u>1];let k=u-1,S=g+1;for(;;){do k++;while(f[k]v);if(k>=S)break;wN(f,k,S),wN(c,3*k,3*S),wN(c,3*k+1,3*S+1),wN(c,3*k+2,3*S+2)}S-u`u_${k}`),this.type=g,this.context=v}setUniform(c,u,g,v,k){const S=v.constantOr(this.value);u.set(c,k,S instanceof Sa?S.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):S)}getBinding(c,u){return this.type==="color"?new Vv(c):new Vo(c)}}class Yy{constructor(c,u){this.uniformNames=u.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,u){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(c,u,g,v,k){let S=null;k!=="u_pattern"&&k!=="u_dash"||(S=this.pattern),k==="u_pattern_b"&&(S=this.patternTransition),k==="u_pixel_ratio"&&(S=this.pixelRatio),S&&u.set(c,k,S)}getBinding(c,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new kN(c):new Vo(c)}}class Mp{constructor(c,u,g,v){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map(k=>({name:`a_${k}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new v}populatePaintArray(c,u,g,v,k,S,L,R){const $=this.paintVertexArray.length,W=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new ti(0,{brightness:S,worldview:R}),u,{},k,v,L):this.expression.kind==="constant"&&this.expression.value,Z=Wv(this.lutExpression,u,{},v,k,S,L,R);this.paintVertexArray.resize(c),this._setPaintValue($,c,W,Z?null:this.context.lut)}updatePaintArray(c,u,g,v,k,S,L,R){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:L,worldview:R},g,v,void 0,k):this.expression.kind==="constant"&&this.expression.value,W=Wv(this.lutExpression,g,v,k,void 0,L,void 0,R);this._setPaintValue(c,u,$,W?null:this.context.lut)}_setPaintValue(c,u,g,v){if(this.type==="color"){const k=A5(g.toPremultipliedRenderColor(v));for(let S=c;S`u_${L}_t`),this.type=g,this.useIntegerZoom=v,this.context=k,this.maxValue=0,this.paintVertexAttributes=u.map(L=>({name:`a_${L}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(c,u,g,v,k,S,L,R){const $=this.expression.evaluate(new ti(this.context.zoom,{brightness:S,worldview:R}),u,{},k,v,L),W=this.expression.evaluate(new ti(this.context.zoom+1,{brightness:S,worldview:R}),u,{},k,v,L),Z=Wv(this.lutExpression,u,{},v,k,S,L,R),X=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(X,c,$,W,Z?null:this.context.lut)}updatePaintArray(c,u,g,v,k,S,L,R){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:L,worldview:R},g,v,void 0,k),W=this.expression.evaluate({zoom:this.context.zoom+1,brightness:L,worldview:R},g,v,void 0,k),Z=Wv(this.lutExpression,g,v,k,void 0,L,void 0,R);this._setPaintValue(c,u,$,W,Z?null:this.context.lut)}_setPaintValue(c,u,g,v,k){if(this.type==="color"){const S=A5(g.toPremultipliedRenderColor(k)),L=A5(g.toPremultipliedRenderColor(k));for(let R=c;R!0){this.binders={},this._buffers=[],this.context=u;const v=[];for(const k in c.paint._values){const S=c.paint.get(k);if(k.endsWith("-use-theme")||!g(k)||!(S instanceof tx&&Pv(S.property.specification)))continue;const L=gie(k,c.type),R=S.value,$=S.property.specification.type,W=!!S.property.useIntegerZoom,Z=k==="line-dasharray"||k.endsWith("pattern"),X=c.paint.get(`${k}-use-theme`),re=k==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(R.kind!=="constant"||re)if(R.kind==="source"||re||Z){const ne=E5(k,$,"source");this.binders[k]=Z?new Ap(R,L,$,ne,c.id):new Mp(R,L,$,ne),v.push(`/a_${k}`)}else{const ne=E5(k,$,"composite");this.binders[k]=new Tp(R,L,$,W,u,ne),v.push(`/z_${k}`)}else this.binders[k]=Z?new Yy(R.value,L):new Gv(R.value,L,$,u),v.push(`/u_${k}`);X&&(this.binders[k].lutExpression=X.value)}this.cacheKey=v.sort().join("")}getMaxValue(c){const u=this.binders[c];return u instanceof Mp||u instanceof Tp?u.maxValue:0}populatePaintArrays(c,u,g,v,k,S,L,R){for(const $ in this.binders){const W=this.binders[$];W.context=this.context,(W instanceof Mp||W instanceof Tp||W instanceof Ap)&&W.populatePaintArray(c,u,g,v,k,S,L,R)}}setConstantPatternPositions(c,u){for(const g in this.binders){const v=this.binders[g];v instanceof Yy&&v.setConstantPatternPositions(c,u)}}getPatternTransitionVertexBuffer(c){const u=this.binders[c];return u instanceof Ap?u.paintTransitionVertexBuffer:null}updatePaintArrays(c,u,g,v,k,S,L,R,$,W){let Z=!1;const X=Object.keys(c),re=X.length!==0&&!R,ne=re?X:u.uniqueIds;this.context.lut=k.lut;for(const fe in this.binders){const Ne=this.binders[fe];if(Ne.context=this.context,(Ne instanceof Mp||Ne instanceof Tp||Ne instanceof Ap)&&Ne.expression&&Ne.expression.kind&&Ne.expression.kind!=="constant"&&(Ne.expression.isStateDependent===!0||Ne.expression.isLightConstant===!1)){const je=k.paint.get(fe);Ne.expression=je.value;for(const Re of ne){const $e=c[Re.toString()];u.eachPosition(Re,(Ze,ht,ot)=>{const _t=v.feature(Ze);Ne.updatePaintArray(ht,ot,_t,$e,S,L,$,W)})}if(!re)for(const Re of g.uniqueIds){const $e=c[Re.toString()];g.eachPosition(Re,(Ze,ht,ot)=>{const _t=v.feature(Ze);Ne.updatePaintArray(ht,ot,_t,$e,S,L,$,W)})}Z=!0}}return Z}defines(){const c=[];for(const u in this.binders){const g=this.binders[u];(g instanceof Gv||g instanceof Yy)&&c.push(...g.uniformNames.map(v=>`#define HAS_UNIFORM_${v}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const u=[];for(const g in this.binders){const v=this.binders[g];if(v instanceof Gv||v instanceof Yy||v instanceof Tp)for(const k of v.uniformNames)u.push({name:k,property:g,binding:v.getBinding(c,k)})}return u}setUniforms(c,u,g,v,k){for(const{name:S,property:L,binding:R}of g)this.binders[L].setUniform(c,R,k,v.get(L),S)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const u=this.binders[c];(u instanceof Mp||u instanceof Tp||u instanceof Ap)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer),u instanceof Ap&&u.paintTransitionVertexBuffer&&this._buffers.push(u.paintTransitionVertexBuffer)}}upload(c){for(const u in this.binders){const g=this.binders[u];(g instanceof Mp||g instanceof Tp||g instanceof Ap)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const u=this.binders[c];(u instanceof Mp||u instanceof Tp||u instanceof Ap)&&u.destroy()}}}class Dh{constructor(c,u,g=()=>!0){this.programConfigurations={};for(const v of c)this.programConfigurations[v.id]=new Wm(v,u,g);this.needsUpload=!1,this._featureMap=new Uv,this._featureMapWithoutIds=new Uv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,u,g,v,k,S,L,R,$){for(const W in this.programConfigurations)this.programConfigurations[W].populatePaintArrays(c,u,v,k,S,L,R,$);u.id!==void 0?this._featureMap.add(u.id,g,this._bufferOffset,c):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,c),this._idlessCounter+=1),this._bufferOffset=c,this.needsUpload=!0}updatePaintArrays(c,u,g,v,k,S,L,R){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,u,$,v,k,S,L||0,R)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const mie={"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 gie(f,c){return mie[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const xie={"line-pattern":{source:Nd,composite:Nd},"fill-pattern":{source:Nd,composite:Nd},"fill-extrusion-pattern":{source:Nd,composite:Nd},"line-dasharray":{source:ix,composite:ix}},yie={color:{source:Nf,composite:Vm},number:{source:Sp,composite:Nf}};function E5(f,c,u){const g=xie[f];return g&&g[u]||yie[c][u]}Yr(Gv,"ConstantBinder"),Yr(Yy,"PatternConstantBinder"),Yr(Mp,"SourceExpressionBinder"),Yr(Ap,"PatternCompositeBinder"),Yr(Tp,"CompositeExpressionBinder"),Yr(Wm,"ProgramConfiguration",{omit:["_buffers"]}),Yr(Dh,"ProgramConfigurationSet");const _c=Sr/Math.PI/2,th=5,CN=6,vie=16383,Xy=64,I5=[Xy,32,16],rh=-_c,nh=_c;function lx(f,c,u,g=_c){return u=ss(u),[f*Math.sin(u)*g,-c*g,f*Math.cos(u)*g]}function Qy(f,c,u){return lx(Math.cos(ss(f)),Math.sin(ss(f)),c,u)}const b=63710088e-1,d=2*Math.PI*b;class m{constructor(c,u){if(isNaN(c)||isNaN(u))throw new Error(`Invalid LngLat object: (${c}, ${u})`);if(this.lng=+c,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 m(Ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const u=Math.PI/180,g=this.lat*u,v=c.lat*u,k=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((c.lng-this.lng)*u);return b*Math.acos(Math.min(k,1))}toBounds(c=0){const u=360*c/40075017,g=u/Math.cos(Math.PI/180*this.lat);return new w({lng:this.lng-g,lat:this.lat-u},{lng:this.lng+g,lat:this.lat+u})}toEcef(c){return Qy(this.lat,this.lng,_c+c*_c/b)}static convert(c){if(c instanceof m)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new m(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new m(Number("lng"in c?c.lng:c.lon),Number(c.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 w{constructor(c,u){c&&(u?this.setSouthWest(c).setNorthEast(u):Array.isArray(c)&&c.length===4?this.setSouthWest([c[0],c[1]]).setNorthEast([c[2],c[3]]):this.setSouthWest(c[0]).setNorthEast(c[1]))}setNorthEast(c){return this._ne=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}setSouthWest(c){return this._sw=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}extend(c){const u=this._sw,g=this._ne;let v,k;if(c instanceof m)v=c,k=c;else{if(!(c instanceof w))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(w.convert(c)):this.extend(m.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(m.convert(c)):this;if(v=c._sw,k=c._ne,!v||!k)return this}return u||g?(u.lng=Math.min(v.lng,u.lng),u.lat=Math.min(v.lat,u.lat),g.lng=Math.max(k.lng,g.lng),g.lat=Math.max(k.lat,g.lat)):(this._sw=new m(v.lng,v.lat),this._ne=new m(k.lng,k.lat)),this}getCenter(){return new m((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 m(this.getWest(),this.getNorth())}getSouthEast(){return new m(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(c){const{lng:u,lat:g}=m.convert(c);let v=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(v=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&v}static convert(c){if(c)return c instanceof w?c:new w(c)}}const M=0,O=25.5;function D(f){return d*Math.cos(f*Math.PI/180)}function B(f){return(180+f)/360}function H(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function Y(f,c){return f/D(c)}function Q(f){return 360*f-180}function ce(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function le(f,c){return f*D(ce(c))}const de=85.051129;function we(f){return Math.cos(ss(xe(f,-de,de)))}function ve(f,c){const u=xe(c,M,O),g=Math.pow(2,u);return we(f)*d/(512*g)}function De(f){return 1/Math.cos(f*Math.PI/180)}function Pe(f,c=0){const u=Math.exp(Math.PI*(1-(f.y+c/Sr)/(1<=R?(Xe(f,c,u,$,W,k,Z,L,R),Xe(f,$,W,g,v,Z,S,L,R)):f.push(S)}function We(f,c,u){let g=f[0],v=g.x,k=g.y;c(g);const S=[g];for(let L=1;Lf.x+1||gf.y+1)&&Ur("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function St(f,c,u){const g=f.loadGeometry(),v=f.extent,k=Sr/v;if(c&&u&&u.projection.isReprojectedInTileSpace){const S=1<{const re=Q((c.x+X.x/v)/S),ne=ce((c.y+X.y/v)/S),fe=W.project(re,ne);X.x=(fe.x*L-R)*v,X.y=(fe.y*L-$)*v};for(let X=0;X=v||ne.y<0||ne.y>=v||(Z(ne),re.push(ne));g[X]=re}}for(const S of g)for(const L of S)it(L,k);return g}function Dt(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?St(f):[]}}class Lt{constructor(c,u,g,v,k){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=v,this._values=k,c.readFields(Ht,this,u)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos,g=[];let v,k=1,S=0,L=0,R=0;for(;c.pos>3}if(S--,k===1||k===2)L+=c.readSVarint(),R+=c.readSVarint(),k===1&&(v&&g.push(v),v=[]),v&&v.push(new ir(L,R));else{if(k!==7)throw new Error(`unknown command ${k}`);v&&v.push(v[0].clone())}}return v&&g.push(v),g}bbox(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos;let g=1,v=0,k=0,S=0,L=1/0,R=-1/0,$=1/0,W=-1/0;for(;c.pos>3}if(v--,g===1||g===2)k+=c.readSVarint(),S+=c.readSVarint(),kR&&(R=k),S<$&&($=S),S>W&&(W=S);else if(g!==7)throw new Error(`unknown command ${g}`)}return[L,$,R,W]}toGeoJSON(c,u,g){const v=this.extent*Math.pow(2,g),k=this.extent*c,S=this.extent*u,L=this.loadGeometry();function R(X){return[360*(X.x+k)/v-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+S)/v)*Math.PI))-90]}function $(X){return X.map(R)}let W;if(this.type===1){const X=[];for(const ne of L)X.push(ne[0]);const re=$(X);W=X.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const X=L.map($);W=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 fe=ne.length;if(fe<=1)return[ne];const Ne=[];let je,Re;for(let $e=0;$e=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const u=this._pbf.readVarint()+this._pbf.pos;return new Lt(this._pbf,u,this.extent,this._keys,this._values)}}function _r(f,c,u){f===15?c.version=u.readVarint():f===1?c.name=u.readString():f===5?c.extent=u.readVarint():f===2?c._features.push(u.pos):f===3?c._keys.push(u.readString()):f===4&&c._values.push(function(g){let v=null;const k=g.readVarint()+g.pos;for(;g.pos>3;v=S===1?g.readString():S===2?g.readFloat():S===3?g.readDouble():S===4?g.readVarint64():S===5?g.readVarint():S===6?g.readSVarint():S===7?g.readBoolean():null}if(v==null)throw new Error("unknown feature value");return v}(u))}class $t{constructor(c,u){this.layers=c.readFields(Tt,{},u)}}function Tt(f,c,u){if(f===3){const g=new sr(u,u.readVarint()+u.pos);g.length&&(c[g.name]=g)}}const Jt="3d_elevation_id",Vt="level";class dr{constructor(){this._valid=!1}reset(c){return this.feature=c,this._valid=!0,this._geometry=c.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(c,u){return this._valid&&c(u(this._geometry)),this}require(c,u,g){return this.get(c,!0,u,g)}optional(c,u,g){return this.get(c,!1,u,g)}success(){return this._valid}get(c,u,g,v){const k=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&k!==void 0&&!Number.isNaN(k)?g(v?v(k):k):u&&(this._valid=!1),this}}class Tr{constructor(c,u){this.featureFunc=c,this.vertexFunc=u}parseFeature(c,u,g){return this.featureFunc(c,u,g)}parseVertex(c,u,g){return this.vertexFunc(c,u,g)}}const Hr=new Tr((f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).optional("fixed_height_relative",g=>{u.constantHeight=g},br.decodeRelativeHeight).geometry(g=>{u.bounds=g},_p).success(),(f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height_relative",g=>{u.height=g},br.decodeRelativeHeight).geometry(g=>{u.position=g},br.getPoint).success()),Nr=new Tr((f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).optional("fixed_height",g=>{u.constantHeight=g},br.decodeMetricHeight).geometry(g=>{u.bounds=g},_p).success(),(f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height",g=>{u.height=g},br.decodeMetricHeight).geometry(g=>{u.position=g},br.getPoint).success());class br{static getPoint(c){return hr(c[0][0].x,c[0][0].y)}static decodeRelativeHeight(c){return 1e-4*c*5}static decodeMetricHeight(c){return 1e-4*c}static getVersionSchema(c){return c?c==="1.0.1"?Nr:void 0:Hr}static parse(c){const u=[],g=[],v=c.length,k=new dr;for(let S=0;S=0);if(k===0)return 0;k!==c.length&&(u=!1)}return u?2:1}function Xn(f,c){for(const u of f.projections){const g=Gr(c,f.points[0],u.axis);if(u.projection[1]g[1])return 0}return 1}function Rs(f,c){let u=0;const g=[0,0,0,0];for(let S=0;S=0&&u++;var v,k;return u}class fa{constructor(c,u){this.points=c||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=ln.fromPoints(this.points),this.projections=[],this.frustumEdges=[Me([],this.points[2],this.points[3]),Me([],this.points[0],this.points[3]),Me([],this.points[4],this.points[0]),Me([],this.points[5],this.points[1]),Me([],this.points[6],this.points[2]),Me([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const v=[0,-g[2],g[1]],k=[g[2],0,-g[0]];this.projections.push({axis:v,projection:Gr(this.points,this.points[0],v)}),this.projections.push({axis:k,projection:Gr(this.points,this.points[0],k)})}}static fromInvProjectionMatrix(c,u,g,v){const k=Math.pow(2,g),S=[[-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($=>{const W=gt([],$,c),Z=1/W[3]/u*k;return(X=W)[0]=(re=W)[0]*(ne=[Z,Z,v?1/W[3]:Z,Z])[0],X[1]=re[1]*ne[1],X[2]=re[2]*ne[2],X[3]=re[3]*ne[3],X;var X,re,ne}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const W=Fe([],tt([],Me([],S[$[0]],S[$[1]]),Me([],S[$[2]],S[$[1]]))),Z=-be(W,S[$[1]]);return W.concat(Z)}),R=[];for(let $=0;$$[1]||$[0]>R[1])return 0}return 1}containsPoint(c){for(const u of this.planes){const g=u[3];if(be([u[0],u[1],u[2]],c)+g<0)return!1}return!0}}class ln{static fromPoints(c){const u=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const v of c)Ce(u,u,v),Se(g,g,v);return new ln(u,g)}static fromTileIdAndHeight(c,u,g){const v=1<c.max[u]||c.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(c){return!(this.min[0]>c.max[0]||c.min[0]>this.max[0]||this.min[1]>c.max[1]||c.min[1]>this.max[1])}encapsulate(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c.min[u]),this.max[u]=Math.max(this.max[u],c.max[u])}encapsulatePoint(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c[u]),this.max[u]=Math.max(this.max[u],c[u])}closestPoint(c){return[Math.max(Math.min(this.max[0],c[0]),this.min[0]),Math.max(Math.min(this.max[1],c[1]),this.min[1]),Math.max(Math.min(this.max[2],c[2]),this.min[2])]}}Yr(ln,"Aabb");class ia{constructor(c,u){this.feature=c,this.metersToTile=u,this.index=0}get(){const c=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,g=u[1],v=-u[0],k=(c.extent+1)*this.metersToTile;return[new ir(Math.trunc(c.position[0]+g*k),Math.trunc(c.position[1]+v*k)),new ir(Math.trunc(c.position[0]-g*k),Math.trunc(c.position[1]-v*k))]}next(){this.index++}valid(){return this.index{return L.a0?ge(R,R,1/$):he(R,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let u=0,g=Number.POSITIVE_INFINITY,v=0;const[k,S,L,R,$,W,Z]=this._tmpVec2;xs(Z,c.x,c.y);const X=new sn(Z,null);for(let re=0;re0?xo(R,L)/Ze:0,ot=xe(ht,0,1),_t=Math.abs((ht-ot)*this.edgeProps[re].len);xa($,Z,Ne),xs(W,fe[1],-fe[0]);const Ct=_t+Math.abs(xo($,W));Ct=0;--S){const L=this.edges[S].a,R=this.edges[S].b,{position:$,height:W,extent:Z}=this.vertices[L],{position:X,height:re,extent:ne}=this.vertices[R],fe=this.vertexProps[L].dir,Ne=this.vertexProps[R].dir;if(he(u,$[0]/c,$[1]/c,W),he(g,X[0]/c,X[1]/c,re),he(v,fe[1],-fe[0],0),ge(v,v,Z),he(k,Ne[1],-Ne[0],0),ge(k,k,ne),this.distSqLines(se(u[0]+.5*v[0],u[1]+.5*v[1],u[2]+.5*v[2]),se(g[0]-.5*k[0],g[1]-.5*k[1],g[2]-.5*k[2]),se(u[0]-.5*v[0],u[1]-.5*v[1],u[2]-.5*v[2]),se(g[0]+.5*k[0],g[1]+.5*k[1],g[2]+.5*k[2]))<=.0025000000000000005)continue;const je=this.vertices.length,Re=ka(js(),$,X);this.vertices.push({position:zi(Re,Re,.5),height:.5*(W+re),extent:.5*(Z+ne)});const $e=ka(js(),fe,Ne);this.vertexProps.push({dir:nl($e,$e)}),this.edges.splice(S,1),this.edgeProps.splice(S,1),this.edges.push({a:L,b:je}),this.edges.push({a:je,b:R});const Ze=xa(js(),this.vertices[je].position,$),ht=Bi(Ze),ot={vec:Ze,dir:zi(js(),Ze,1/ht),len:ht};this.edgeProps.push(ot),this.edgeProps.push(ot)}}distSqLines(c,u,g,v){const k=_e(ye(),u,c),S=_e(ye(),v,g),L=_e(ye(),c,g),R=be(k,k),$=be(k,S),W=be(k,L),Z=be(S,S),X=be(S,L),re=R*Z-$*$;if(re===0)return Be(Te(k,g,v,be(L,S)/be(S,S)),c);const ne=(R*X-$*W)/re;return Be(Te(k,c,u,($*X-W*Z)/re),Te(S,g,v,ne))}}class ya{static parseFrom(c,u){const g=br.parse(c);if(!g)return[];let{vertices:v,features:k}=g;const S=1/Pe(u);k.sort((W,Z)=>W.id-Z.id),v.sort((W,Z)=>W.id-Z.id||W.idx-Z.idx),v=v.filter((W,Z,X)=>Z===X.findIndex(re=>re.id===W.id&&re.idx===W.idx));const L=new Array;let R=0;const $=v.length;for(const W of k){if(W.constantHeight){L.push(new Wn(W.id,W.bounds,W.constantHeight));continue}for(;R!==$&&v[R].idv.id===g)}}class Ra{constructor(c,u){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(u)||(this.zScale=Math.pow(2,u.z-c.z),this.xOffset=(c.x*this.zScale-u.x)*Sr,this.yOffset=(c.y*this.zScale-u.y)*Sr)}constantElevation(c,u){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,u)}pointElevation(c,u,g){const v=this.constantElevation(u,g);return v??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(c),g))}computeBiasedHeight(c,u){return u<=0?c:c+u*Ie(0,u,c>=0?c:Math.abs(.5*c))}}Yr(Wn,"ElevationFeature");class Ca{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new qm,this.indexArray=new qo,this.segments=new Oi,this.programConfigurations=new Dh(c.layers,{zoom:c.zoom,lut:c.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 Sp),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=this.layers[0],S=[];let L=null;k.type==="circle"&&(L=k.layout.get("circle-sort-key"));for(const{feature:$,id:W,index:Z,sourceLayerIndex:X}of c){const re=this.layers[0]._featureFilter.needGeometry,ne=Dt($,re);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),ne,g))continue;const fe=L?L.evaluate(ne,{},g):void 0,Ne={id:W,properties:$.properties,type:$.type,sourceLayerIndex:X,index:Z,geometry:re?ne.geometry:St($,g,v),patterns:{},sortKey:fe};S.push(Ne)}L&&S.sort(($,W)=>$.sortKey-W.sortKey);let R=null;v.projection.name==="globe"&&(this.globeExtVertexArray=new dN,R=v.projection);for(const $ of S){const{geometry:W,index:Z,sourceLayerIndex:X}=$,re=c[Z].feature;this.addFeature($,W,Z,u.availableImages,g,R,u.brightness,u.elevationFeatures),u.featureIndex.insert(re,W,Z,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,u,g,v,k,S,L){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,L,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,VP.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,HP.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,cie.members))),this.programConfigurations.upload(c),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(c,u,g,v,k,S,L,R){let $;this.elevationMode!=="none"&&($=ya.getElevationFeature(c,R));for(const W of u)for(const Z of W){const X=Z.x,re=Z.y;if(X<0||X>=Sr||re<0||re>=Sr)continue;if(S){const Ne=S.projectTilePoint(X,re,k),je=S.upVector(k,X,re);this.addGlobeExtVertex(Ne,je),this.addGlobeExtVertex(Ne,je),this.addGlobeExtVertex(Ne,je),this.addGlobeExtVertex(Ne,je)}const ne=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),fe=ne.vertexLength;if(this.addCircleVertex(X,re,-1,-1),this.addCircleVertex(X,re,1,-1),this.addCircleVertex(X,re,1,1),this.addCircleVertex(X,re,-1,1),this.elevationMode!=="none"){const Ne=$?$.pointElevation(new ir(X,re)):0;this.hasElevation=this.hasElevation||Ne!==0;for(let je=0;je<4;je++)this.elevatedLayoutVertexArray.emplaceBack(Ne)}this.indexArray.emplaceBack(fe,fe+1,fe+2),this.indexArray.emplaceBack(fe,fe+2,fe+3),ne.vertexLength+=4,ne.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},v,k,L,void 0,this.worldview)}addCircleVertex(c,u,g,v){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*u+(v+1)/2)}addGlobeExtVertex(c,u){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function sa(f,c){for(let u=0;u1){if(xi(f,c))return!0;for(let g=0;g1?u:u.sub(c)._mult(v)._add(c))}function Di(f,c){let u,g,v,k=!1;for(let S=0;Sc.y!=v.y>c.y&&c.x<(v.x-g.x)*(c.y-g.y)/(v.y-g.y)+g.x&&(k=!k)}return k}function Ha(f,c){let u=!1;for(let g=0,v=f.length-1;gc.y!=S.y>c.y&&c.x<(S.x-k.x)*(c.y-k.y)/(S.y-k.y)+k.x&&(u=!u)}return u}function sd(f,c,u,g,v){for(const S of f)if(c<=S.x&&u<=S.y&&g>=S.x&&v>=S.y)return!0;const k=[new ir(c,u),new ir(c,v),new ir(g,v),new ir(g,u)];if(f.length>2){for(const S of k)if(Ha(f,S))return!0}for(let S=0;Sv.x&&c.x>v.x||f.yv.y&&c.y>v.y)return!1;const k=es(f,c,u[0]);return k!==es(f,c,u[1])||k!==es(f,c,u[2])||k!==es(f,c,u[3])}function Ho(f,c,u,g,v,k){let S=c.y-f.y,L=f.x-c.x;if(k=k||0){const R=S*S+L*L;if(R===0)return!0;const $=Math.sqrt(R);S/=$,L/=$}return!((u.x-f.x)*S+(u.y-f.y)*L-k<0||(g.x-f.x)*S+(g.y-f.y)*L-k<0||(v.x-f.x)*S+(v.y-f.y)*L-k<0)}function bc(f,c,u,g,v,k,S){return!(Ho(f,c,g,v,k,S)||Ho(c,u,g,v,k,S)||Ho(u,f,g,v,k,S)||Ho(g,v,f,c,u,S)||Ho(v,k,f,c,u,S)||Ho(k,g,f,c,u,S))}function wc(f,c,u){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:u.programConfigurations.get(c.id).getMaxValue(f)}function Ul(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function ku(f,c,u,g,v){if(!c[0]&&!c[1])return f;const k=ir.convert(c)._mult(v);u==="viewport"&&k._rotate(-g);const S=[];for(let L=0;L>u&&c.y===this.y>>u}url(c,u){const g=function(k,S,L){var R=io(256*k,256*(S=Math.pow(2,L)-S-1),L),$=io(256*(k+1),256*(S+1),L);return R[0]+","+R[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),v=function(k,S,L){let R,$="";for(let W=k;W>0;W--)R=1<this.canonical.z?new Ui(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ui(c,this.wrap,c,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(c,u=!0){if(this.overscaledZ===c&&u)return this.key;if(c>this.canonical.z)return Ri(this.wrap*+u,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Ri(this.wrap*+u,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const u=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>u&&c.canonical.y===this.canonical.y>>u}children(c){if(this.overscaledZ>=c)return[new Ui(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,v=2*this.canonical.y;return[new Ui(u,this.wrap,u,g,v),new Ui(u,this.wrap,u,g+1,v),new Ui(u,this.wrap,u,g,v+1),new Ui(u,this.wrap,u,g+1,v+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=f.canonical.x-1,u=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,u=f.wrap;return c===1<new Ui(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Ui(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,v,k,S){const L=Math.sin(k);return g*(Math.sin((1-S)*k)/L)+v*(Math.sin(S*k)/L)}(f.a[c],f.b[c],f.angle,xe(u,0,1))+f.center[c]}function Fh(f){if(f.z<=1)return Ep[f.z+2*f.y+f.x];const c=_ie(WP(f));return ln.fromPoints(c)}function Pp(f,c,u){return ge(f,f,1-u),Le(f,f,c,u)}function I0e(f,c,u){for(const g of f)Ke(g,g,c),ge(g,g,u)}function P0e(f,c,u,g){const v=c/f.worldSize,k=f.globeMatrix;if(u.z<=1){const Et=Fh(u).getCorners();return I0e(Et,k,v),ln.fromPoints(Et)}const S=WP(u,g),L=_ie(S,_c+Cf(f._tileCoverLift));I0e(L,k,v);const R=Number.MAX_VALUE,$=[-R,-R,-R],W=[R,R,R];if(S.contains(f.center)){for(const Rt of L)Ce(W,W,Rt),Se($,$,Rt);$[2]=0;const Et=f.point,Kt=[Et.x*v,Et.y*v,0];return Ce(W,W,Kt),Se($,$,Kt),new ln(W,$)}if(f._tileCoverLift>0){for(const Et of L)Ce(W,W,Et),Se($,$,Et);return new ln(W,$)}const Z=[k[12]*v,k[13]*v,k[14]*v],X=S.getCenter(),re=xe(f.center.lat,-de,de),ne=xe(X.lat,-de,de),fe=B(f.center.lng),Ne=H(re);let je=fe-B(X.lng);const Re=Ne-H(ne);je>.5?je-=1:je<-.5&&(je+=1);let $e=0;Math.abs(je)>Math.abs(Re)?$e=je>=0?1:3:($e=Re>=0?0:2,Le(Z,Z,[k[4]*v,k[5]*v,k[6]*v],-Math.sin(ss(Re>=0?S.getSouth():S.getNorth()))*_c));const Ze=L[$e],ht=L[($e+1)%4],ot=new Gm(Ze,ht,Z),_t=[Ip(ot,0)||Ze[0],Ip(ot,1)||Ze[1],Ip(ot,2)||Ze[2]],Ct=t0(f.zoom);if(Ct>0){const Et=function({x:Rt,y:rr,z:or},lr,xr,vr,ur){const pr=1/(1<.5?wr=-1:un<-.5&&(wr=1),tr=((tr+wr)*lr-(vr*=lr))*xr+vr,Xt=((Xt+wr)*lr-vr)*xr+vr,mr=(mr*lr-(ur*=lr))*xr+ur,Mr=(Mr*lr-ur)*xr+ur,[[tr,Mr,0],[Xt,Mr,0],[Xt,mr,0],[tr,mr,0]]}(u,c,f._pixelsPerMercatorPixel,fe,Ne);for(let Rt=0;RtMath.PI/2*1.01}const F0e=ss(85),tUe=Math.cos(F0e),rUe=Math.sin(F0e),nUe=C(),z0e=f=>{const c=[];return f.paint.get("circle-pitch-alignment")==="map"&&c.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&c.push("SCALE_WITH_MAP"),c};function B0e(f,c,u,g,v,k,S,L,R){if(k&&f.queryGeometry.isAboveHorizon)return!1;k&&(R*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,W=u.projection.upVectorScale($,u.center.lat,u.worldSize).metersToTile;for(const Z of c)for(const X of Z){const re=X.add(L),ne=v&&u.elevation?u.elevation.exaggeration()*v.getElevationAt(re.x,re.y,!0):0,fe=u.projection.projectTilePoint(re.x,re.y,$);if(ne>0){const $e=u.projection.upVector($,re.x,re.y);fe.x+=$e[0]*W*ne,fe.y+=$e[1]*W*ne,fe.z+=$e[2]*W*ne}const Ne=k?re:sUe(fe.x,fe.y,fe.z,g),je=k?f.tilespaceRays.map($e=>iUe($e,ne)):f.queryGeometry.screenGeometry,Re=gt([],[fe.x,fe.y,fe.z,1],g);if(!S&&k?R*=Re[3]/u.cameraToCenterDistance:S&&!k&&(R*=u.cameraToCenterDistance/Re[3]),k){const $e=ce((X.y/Sr+$.y)/(1<<$.z));R/=u.projection.pixelsPerMeter($e,1)/Y(1,$e)}if(is(je,Ne,R))return!0}return!1}function sUe(f,c,u,g){const v=gt([],[f,c,u,1],g);return new ir(v[0]/v[3],v[1]/v[3])}const $0e=se(0,0,0),aUe=se(0,0,1);function iUe(f,c){const u=ye();return $0e[2]=c,f.intersectsPlane($0e,aUe,u),new ir(u[0],u[1])}class U0e extends Ca{}let q0e,V0e,H0e,W0e;function G0e(f,{width:c,height:u},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==c*u*g)throw new RangeError("mismatched image size")}else v=new Uint8Array(c*u*g);return f.width=c,f.height=u,f.data=v,f}function K0e(f,c,u){const{width:g,height:v}=c;g===f.width&&v===f.height||(kie(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,v)},u,null),f.width=g,f.height=v,f.data=c.data)}function kie(f,c,u,g,v,k,S,L){if(v.width===0||v.height===0)return c;if(v.width>f.width||v.height>f.height||u.x>f.width-v.width||u.y>f.height-v.height)throw new RangeError("out of range source coordinates for image copy");if(v.width>c.width||v.height>c.height||g.x>c.width-v.width||g.y>c.height-v.height)throw new RangeError("out of range destination coordinates for image copy");const R=f.data,$=c.data,W=k===4&&L;for(let Z=0;Z{c[f.evaluationKey]=R;const $=f.expression.evaluate(c),W=$?$.toNonPremultipliedRenderColor(null):null;W&&(v.data[S+L+0]=Math.floor(255*W.r),v.data[S+L+1]=Math.floor(255*W.g),v.data[S+L+2]=Math.floor(255*W.b),v.data[S+L+3]=Math.floor(255*W.a))};if(f.clips)for(let S=0,L=0;S80*u){L=f[0],R=f[1];let W=L,Z=R;for(let X=u;XW&&(W=re),ne>Z&&(Z=ne)}$=Math.max(W-L,Z-R),$=$!==0?32767/$:0}return O5(k,S,u,L,R,$,0),S}function Y0e(f,c,u,g,v){let k;if(v===function(S,L,R,$){let W=0;for(let Z=L,X=R-$;Z0)for(let S=c;S=c;S-=g)k=e1e(S/g|0,f[S],f[S+1],k);return k&&TN(k,k.next)&&(F5(k),k=k.next),k}function Yv(f,c){if(!f)return f;c||(c=f);let u,g=f;do if(u=!1,g.steiner||!TN(g,g.next)&&Tl(g.prev,g,g.next)!==0)g=g.next;else{if(F5(g),g=c=g.prev,g===g.next)break;u=!0}while(u||g!==c);return c}function O5(f,c,u,g,v,k,S){if(!f)return;!S&&k&&function(R,$,W,Z){let X=R;do X.z===0&&(X.z=Nie(X.x,X.y,$,W,Z)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==R);X.prevZ.nextZ=null,X.prevZ=null,function(re){let ne,fe=1;do{let Ne,je=re;re=null;let Re=null;for(ne=0;je;){ne++;let $e=je,Ze=0;for(let ot=0;ot0||ht>0&&$e;)Ze!==0&&(ht===0||!$e||je.z<=$e.z)?(Ne=je,je=je.nextZ,Ze--):(Ne=$e,$e=$e.nextZ,ht--),Re?Re.nextZ=Ne:re=Ne,Ne.prevZ=Re,Re=Ne;je=$e}Re.nextZ=null,fe*=2}while(ne>1)}(X)}(f,g,v,k);let L=f;for(;f.prev!==f.next;){const R=f.prev,$=f.next;if(k?hUe(f,g,v,k):uUe(f))c.push(R.i,f.i,$.i),F5(f),f=$.next,L=$.next;else if((f=$)===L){S?S===1?O5(f=fUe(Yv(f),c),c,u,g,v,k,2):S===2&&pUe(f,c,u,g,v,k):O5(Yv(f),c,u,g,v,k,1);break}}}function uUe(f){const c=f.prev,u=f,g=f.next;if(Tl(c,u,g)>=0)return!1;const v=c.x,k=u.x,S=g.x,L=c.y,R=u.y,$=g.y,W=Math.min(v,k,S),Z=Math.min(L,R,$),X=Math.max(v,k,S),re=Math.max(L,R,$);let ne=g.next;for(;ne!==c;){if(ne.x>=W&&ne.x<=X&&ne.y>=Z&&ne.y<=re&&D5(v,L,k,R,S,$,ne.x,ne.y)&&Tl(ne.prev,ne,ne.next)>=0)return!1;ne=ne.next}return!0}function hUe(f,c,u,g){const v=f.prev,k=f,S=f.next;if(Tl(v,k,S)>=0)return!1;const L=v.x,R=k.x,$=S.x,W=v.y,Z=k.y,X=S.y,re=Math.min(L,R,$),ne=Math.min(W,Z,X),fe=Math.max(L,R,$),Ne=Math.max(W,Z,X),je=Nie(re,ne,c,u,g),Re=Nie(fe,Ne,c,u,g);let $e=f.prevZ,Ze=f.nextZ;for(;$e&&$e.z>=je&&Ze&&Ze.z<=Re;){if($e.x>=re&&$e.x<=fe&&$e.y>=ne&&$e.y<=Ne&&$e!==v&&$e!==S&&D5(L,W,R,Z,$,X,$e.x,$e.y)&&Tl($e.prev,$e,$e.next)>=0||($e=$e.prevZ,Ze.x>=re&&Ze.x<=fe&&Ze.y>=ne&&Ze.y<=Ne&&Ze!==v&&Ze!==S&&D5(L,W,R,Z,$,X,Ze.x,Ze.y)&&Tl(Ze.prev,Ze,Ze.next)>=0))return!1;Ze=Ze.nextZ}for(;$e&&$e.z>=je;){if($e.x>=re&&$e.x<=fe&&$e.y>=ne&&$e.y<=Ne&&$e!==v&&$e!==S&&D5(L,W,R,Z,$,X,$e.x,$e.y)&&Tl($e.prev,$e,$e.next)>=0)return!1;$e=$e.prevZ}for(;Ze&&Ze.z<=Re;){if(Ze.x>=re&&Ze.x<=fe&&Ze.y>=ne&&Ze.y<=Ne&&Ze!==v&&Ze!==S&&D5(L,W,R,Z,$,X,Ze.x,Ze.y)&&Tl(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.nextZ}return!0}function fUe(f,c){let u=f;do{const g=u.prev,v=u.next.next;!TN(g,v)&&Q0e(g,u,u.next,v)&&R5(g,v)&&R5(v,g)&&(c.push(g.i,u.i,v.i),F5(u),F5(u.next),u=f=v),u=u.next}while(u!==f);return Yv(u)}function pUe(f,c,u,g,v,k){let S=f;do{let L=S.next.next;for(;L!==S.prev;){if(S.i!==L.i&&vUe(S,L)){let R=J0e(S,L);return S=Yv(S,S.next),R=Yv(R,R.next),O5(S,c,u,g,v,k,0),void O5(R,c,u,g,v,k,0)}L=L.next}S=S.next}while(S!==f)}function mUe(f,c){let u=f.x-c.x;return u===0&&(u=f.y-c.y,u===0)&&(u=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),u}function gUe(f,c){const u=function(v,k){let S=k;const L=v.x,R=v.y;let $,W=-1/0;if(TN(v,S))return S;do{if(TN(v,S.next))return S.next;if(R<=S.y&&R>=S.next.y&&S.next.y!==S.y){const fe=S.x+(R-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(fe<=L&&fe>W&&(W=fe,$=S.x=S.x&&S.x>=X&&L!==S.x&&X0e(R$.x||S.x===$.x&&xUe($,S)))&&($=S,ne=fe)}S=S.next}while(S!==Z);return $}(f,c);if(!u)return c;const g=J0e(u,f);return Yv(g,g.next),Yv(u,u.next)}function xUe(f,c){return Tl(f.prev,f,c.prev)<0&&Tl(c.next,f,f.next)<0}function Nie(f,c,u,g,v){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-u)*v|0)|f<<8))|f<<4))|f<<2))|f<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*v|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function yUe(f){let c=f,u=f;do(c.x=(f-S)*(k-L)&&(f-S)*(g-L)>=(u-S)*(c-L)&&(u-S)*(k-L)>=(v-S)*(g-L)}function D5(f,c,u,g,v,k,S,L){return!(f===S&&c===L)&&X0e(f,c,u,g,v,k,S,L)}function vUe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(u,g){let v=u;do{if(v.i!==u.i&&v.next.i!==u.i&&v.i!==g.i&&v.next.i!==g.i&&Q0e(v,v.next,u,g))return!0;v=v.next}while(v!==u);return!1}(f,c)&&(R5(f,c)&&R5(c,f)&&function(u,g){let v=u,k=!1;const S=(u.x+g.x)/2,L=(u.y+g.y)/2;do v.y>L!=v.next.y>L&&v.next.y!==v.y&&S<(v.next.x-v.x)*(L-v.y)/(v.next.y-v.y)+v.x&&(k=!k),v=v.next;while(v!==u);return k}(f,c)&&(Tl(f.prev,f,c.prev)||Tl(f,c.prev,c))||TN(f,c)&&Tl(f.prev,f,f.next)>0&&Tl(c.prev,c,c.next)>0)}function Tl(f,c,u){return(c.y-f.y)*(u.x-c.x)-(c.x-f.x)*(u.y-c.y)}function TN(f,c){return f.x===c.x&&f.y===c.y}function Q0e(f,c,u,g){const v=YP(Tl(f,c,u)),k=YP(Tl(f,c,g)),S=YP(Tl(u,g,f)),L=YP(Tl(u,g,c));return v!==k&&S!==L||!(v!==0||!ZP(f,u,c))||!(k!==0||!ZP(f,g,c))||!(S!==0||!ZP(u,f,g))||!(L!==0||!ZP(u,c,g))}function ZP(f,c,u){return c.x<=Math.max(f.x,u.x)&&c.x>=Math.min(f.x,u.x)&&c.y<=Math.max(f.y,u.y)&&c.y>=Math.min(f.y,u.y)}function YP(f){return f>0?1:f<0?-1:0}function R5(f,c){return Tl(f.prev,f,f.next)<0?Tl(f,c,f.next)>=0&&Tl(f,f.prev,c)>=0:Tl(f,c,f.prev)<0||Tl(f,f.next,c)<0}function J0e(f,c){const u=Sie(f.i,f.x,f.y),g=Sie(c.i,c.x,c.y),v=f.next,k=c.prev;return f.next=c,c.prev=f,u.next=v,v.prev=u,g.next=u,u.prev=g,k.next=g,g.prev=k,g}function e1e(f,c,u,g){const v=Sie(f,c,u);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function F5(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function Sie(f,c,u){return{i:f,x:c,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function z5(f,c){const u=f.length;if(u<=1)return[f];const g=[];let v,k;for(let S=0;S1)for(let S=0;S=Sr&&u>=Sr}static evaluate(c){if(c.length===0)return new cx;let u=[];for(const R of c)u.push(...R.portals);if(u.length===0)return new cx;for(const R of u){const $=R.va,W=R.vb;(cx.isOnBorder($.x,W.x)||cx.isOnBorder($.y,W.y))&&(R.type="border")}const g=u.filter(R=>R.type!=="unevaluated"),v=u.filter(R=>R.type==="unevaluated");if(v.length===0)return new cx;v.sort((R,$)=>R.hash===$.hash?R.isTunnel===$.isTunnel?0:R.isTunnel?-1:1:R.hash<$.hash?1:-1),u=g.concat(v);let k=g.length,S=k,L=k;do if(S++,S===u.length||u[k].hash!==u[S].hash){if(S-k==2){LR.hash<$.hash?1:-1),{portals:u}}}Yr(cx,"ElevationPortalGraph"),Yr(r1e,"ElevationPolygons");class bUe{constructor(c,u,g){this.outPositions=c,this.outNormals=u,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,u,g){let v=c[2];g!=null&&(v*=g);const k=`${c[0]},${c[1]},${c[2]},${u[0]},${u[1]},${u[2]}`,S=this.vertexLookup.get(k);if(S!=null)return S;const L=this.outPositions.length;this.vertexLookup.set(k,L);const R=Math.trunc(16384*u[0]),$=Math.trunc(16384*u[1]),W=Math.trunc(16384*u[2]);return this.outPositions.emplaceBack(c[0],c[1],v),this.outNormals.emplaceBack(R,$,W),L}addTriangle(c,u,g){this.outIndices.emplaceBack(c,u,g)}addTriangles(c,u,g){if(c.length===0)return;const v=g.length===1,k=ye(),S=ye();for(let L=0;Lk!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Dh(u,{zoom:g,lut:v},k=>k!=="fill-bridge-guard-rail-color")}addVertices(c,u){const g=this.unevalVertices.length;for(let v=0;v=k.min.x&&Z.x<=k.max.x&&Z.y>=k.min.y&&Z.y<=k.max.y||X.x>=k.min.x&&X.x<=k.max.x&&X.y>=k.min.y&&X.y<=k.max.y||sc(Z,X,L))||this.isOnBorder(Z.x,X.x)||this.isOnBorder(Z.y,X.y))continue;const re=Nu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[W]);let ne,fe=this.vertexHashLookup.get(Nu.computePosHash(Z));fe!=null?ne=fe.next:(fe=this.vertexHashLookup.get(Nu.computePosHash(X)),ne=fe!=null?fe.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:W,hash:re,portalHash:ne,isTunnel:v,type:"unevaluated",featureInfo:S})}}addPortalCandidates(c,u,g,v,k){if(u.length===0)return;this.portalPolygons.add(c,{geometry:u,zLevel:k});const S=u[0];this.vertexHashLookup.clear();let L=Nu.computeEdgeHash(S[S.length-2],S[S.length-1]);for(let R=0;R({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},v=new bUe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const k=u(),S=u(),L=u(),R=(X,re)=>{X.sort((fe,Ne)=>fe.type===re&&Ne.type!==re?-1:fe.type!==re&&Ne.type===re?1:0);const ne=X.findIndex(fe=>fe.type!==re);return ne>=0?ne:X.length};let $=0;this.unevalEdges.length>0&&($=R(this.unevalEdges,"none"),this.constructBridgeStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(L);const W=u(),Z=u();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice($),re=R(X,"tunnel")+$;this.unevalEdges.push(...X),this.constructTunnelStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:re})}g(W),v.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(Z),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(S),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(k),this.maskSegments=Oi.simpleSegment(0,Z.primitiveOffset,0,Z.primitiveLength),this.depthSegments=Oi.simpleSegment(0,S.primitiveOffset,0,S.primitiveLength),this.renderableBridgeSegments=Oi.simpleSegment(0,L.primitiveOffset,0,L.primitiveLength),this.renderableTunnelSegments=Oi.simpleSegment(0,W.primitiveOffset,0,W.primitiveLength),this.shadowCasterSegments=Oi.simpleSegment(0,k.primitiveOffset,0,k.primitiveLength)}update(c,u,g,v,k,S,L,R){this.bridgeProgramConfigurations.updatePaintArrays(c,u,k,g,v,S,L,R),this.tunnelProgramConfigurations.updatePaintArrays(c,u,k,g,v,S,L,R)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,cUe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,dUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(c),this.tunnelProgramConfigurations.upload(c))}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(c,u,g,v,k){const S=(L,R)=>{for(let $=0;$he(xr,u[vr].x,u[vr].y,g[vr]*R),Z=ye(),X=ye(),re=ye(),ne=ye(),fe=ye(),Ne=(xr,vr)=>{const ur=L.get(Nu.computePosHash(u[vr])),pr=ur.from,tr=ur.to;if(!pr||!tr)return;W(Z,pr),W(X,vr),W(re,tr),rt(ne),at(Z,X)||(Me(fe,X,Z),Fe(ne,fe)),at(re,X)||(Me(fe,re,X),ue(ne,ne,Fe(fe,fe)));const Xt=qe(ne);return Xt>0?ge(xr,ne,1/Xt):void 0};let je=Number.POSITIVE_INFINITY;this.sortSubarray(v,k.min,k.max,(xr,vr)=>xr.featureInfo.featureIndex-vr.featureInfo.featureIndex);const Re=ye(),$e=ye(),Ze=ye(),ht=ye(),ot=ye(),_t=ye(),Ct=ye(),Et=ye(),Kt=ye(),Rt=[ye(),ye(),ye(),ye()],rr=[ye(),ye(),ye(),ye()],or=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],lr=(xr,vr)=>xr>vr;for(let xr=k.min;xrje.featureInfo.featureIndex-Re.featureInfo.featureIndex;this.sortSubarray(v,k.min,k.max,R),this.sortSubarray(v,S.min,S.max,R);const $=je=>Fe(je,je),W=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],Z=(je,Re)=>jeL.hash===R.hash?R.polygonIdx-L.polygonIdx:R.hash>L.hash?1:-1);let g=0,v=0,k=0,S=u[g].polygonIdx;do v++,(v===u.length||u[g].hash!==u[v].hash)&&((v-g==1||u[v-1].polygonIdx!==S)&&(k$.portalHashW.hash?L++:W.hash>$.portalHash?R++:($.type=W.type,L++)}}}isOnBorder(c,u){return c<=0&&u<=0||c>=Sr&&u>=Sr}addFeatureSection(c,u,g,v){return c!==u&&(u=c,g.push({featureIndex:c,vertexStart:v.getVertexCount()}),v.clearVertexLookup()),u}sortSubarray(c,u,g,v){const k=c.slice(u,g);k.sort(v),c.splice(u,k.length,...k)}static computeEdgeHash(c,u){return(c.y===u.y&&c.x>u.x||c.y>u.y)&&([c,u]=[u,c]),BigInt(Nu.computePosHash(c))<<32n|BigInt(Nu.computePosHash(u))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var n1e,s1e={exports:{}},a1e=(n1e||(n1e=1,function(f){function c(lt,pt){return lt>pt?1:lt0){var hn=yr+Math.floor(Dr/2),vn={key:pt[hn],data:nr[hn],parent:lt};return vn.left=v(vn,pt,nr,yr,hn),vn.right=v(vn,pt,nr,hn+1,Or),vn}return null}function k(lt,pt,nr,yr,Or){if(!(nr>=yr)){for(var Dr=lt[nr+yr>>1],hn=nr-1,vn=yr+1;;){do hn++;while(Or(lt[hn],Dr)<0);do vn--;while(Or(lt[vn],Dr)>0);if(hn>=vn)break;var Jn=lt[hn];lt[hn]=lt[vn],lt[vn]=Jn,Jn=pt[hn],pt[hn]=pt[vn],pt[vn]=Jn}k(lt,pt,nr,vn,Or),k(lt,pt,vn+1,yr,Or)}}u.prototype.rotateLeft=function(lt){var pt=lt.right;pt&&(lt.right=pt.left,pt.left&&(pt.left.parent=lt),pt.parent=lt.parent),lt.parent?lt===lt.parent.left?lt.parent.left=pt:lt.parent.right=pt:this._root=pt,pt&&(pt.left=lt),lt.parent=pt},u.prototype.rotateRight=function(lt){var pt=lt.left;pt&&(lt.left=pt.right,pt.right&&(pt.right.parent=lt),pt.parent=lt.parent),lt.parent?lt===lt.parent.left?lt.parent.left=pt:lt.parent.right=pt:this._root=pt,pt&&(pt.right=lt),lt.parent=pt},u.prototype._splay=function(lt){for(;lt.parent;){var pt=lt.parent;pt.parent?pt.left===lt&&pt.parent.left===pt?(this.rotateRight(pt.parent),this.rotateRight(pt)):pt.right===lt&&pt.parent.right===pt?(this.rotateLeft(pt.parent),this.rotateLeft(pt)):pt.left===lt&&pt.parent.right===pt?(this.rotateRight(pt),this.rotateLeft(pt)):(this.rotateLeft(pt),this.rotateRight(pt)):pt.left===lt?this.rotateRight(pt):this.rotateLeft(pt)}},u.prototype.splay=function(lt){for(var pt,nr,yr,Or,Dr;lt.parent;)(nr=(pt=lt.parent).parent)&&nr.parent?((yr=nr.parent).left===nr?yr.left=lt:yr.right=lt,lt.parent=yr):(lt.parent=null,this._root=lt),Or=lt.left,Dr=lt.right,lt===pt.left?(nr&&(nr.left===pt?(pt.right?(nr.left=pt.right,nr.left.parent=nr):nr.left=null,pt.right=nr,nr.parent=pt):(Or?(nr.right=Or,Or.parent=nr):nr.right=null,lt.left=nr,nr.parent=lt)),Dr?(pt.left=Dr,Dr.parent=pt):pt.left=null,lt.right=pt,pt.parent=lt):(nr&&(nr.right===pt?(pt.left?(nr.right=pt.left,nr.right.parent=nr):nr.right=null,pt.left=nr,nr.parent=pt):(Dr?(nr.left=Dr,Dr.parent=nr):nr.left=null,lt.right=nr,nr.parent=lt)),Or?(pt.right=Or,Or.parent=pt):pt.right=null,lt.left=pt,pt.parent=lt)},u.prototype.replace=function(lt,pt){lt.parent?lt===lt.parent.left?lt.parent.left=pt:lt.parent.right=pt:this._root=pt,pt&&(pt.parent=lt.parent)},u.prototype.minNode=function(lt){if(lt===void 0&&(lt=this._root),lt)for(;lt.left;)lt=lt.left;return lt},u.prototype.maxNode=function(lt){if(lt===void 0&&(lt=this._root),lt)for(;lt.right;)lt=lt.right;return lt},u.prototype.insert=function(lt,pt){var nr=this._root,yr=null,Or=this._compare;if(this._noDuplicates)for(;nr;){if(yr=nr,Or(nr.key,lt)===0)return;nr=Or(nr.key,lt)<0?nr.right:nr.left}else for(;nr;)yr=nr,nr=Or(nr.key,lt)<0?nr.right:nr.left;return nr={key:lt,data:pt,left:null,right:null,parent:yr},yr?Or(yr.key,nr.key)<0?yr.right=nr:yr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},u.prototype.find=function(lt){for(var pt=this._root,nr=this._compare;pt;){var yr=nr(pt.key,lt);if(yr<0)pt=pt.right;else{if(!(yr>0))return pt;pt=pt.left}}return null},u.prototype.contains=function(lt){for(var pt=this._root,nr=this._compare;pt;){var yr=nr(lt,pt.key);if(yr===0)return!0;pt=yr<0?pt.left:pt.right}return!1},u.prototype.remove=function(lt){var pt=this.find(lt);if(!pt)return!1;if(this.splay(pt),pt.left)if(pt.right){var nr=this.minNode(pt.right);nr.parent!==pt&&(this.replace(nr,nr.right),nr.right=pt.right,nr.right.parent=nr),this.replace(pt,nr),nr.left=pt.left,nr.left.parent=nr}else this.replace(pt,pt.left);else this.replace(pt,pt.right);return this._size--,!0},u.prototype.removeNode=function(lt){if(!lt)return!1;if(this.splay(lt),lt.left)if(lt.right){var pt=this.minNode(lt.right);pt.parent!==lt&&(this.replace(pt,pt.right),pt.right=lt.right,pt.right.parent=pt),this.replace(lt,pt),pt.left=lt.left,pt.left.parent=pt}else this.replace(lt,lt.left);else this.replace(lt,lt.right);return this._size--,!0},u.prototype.erase=function(lt){var pt=this.find(lt);if(pt){this.splay(pt);var nr=pt.left,yr=pt.right,Or=null;nr&&(nr.parent=null,Or=this.maxNode(nr),this.splay(Or),this._root=Or),yr&&(nr?Or.right=yr:this._root=yr,yr.parent=Or),this._size--}},u.prototype.pop=function(){var lt=this._root,pt=null;if(lt){for(;lt.left;)lt=lt.left;pt={key:lt.key,data:lt.data},this.remove(lt.key)}return pt},u.prototype.next=function(lt){var pt=lt;if(pt)if(pt.right)for(pt=pt.right;pt&&pt.left;)pt=pt.left;else for(pt=lt.parent;pt&&pt.right===lt;)lt=pt,pt=pt.parent;return pt},u.prototype.prev=function(lt){var pt=lt;if(pt)if(pt.left)for(pt=pt.left;pt&&pt.right;)pt=pt.right;else for(pt=lt.parent;pt&&pt.left===lt;)lt=pt,pt=pt.parent;return pt},u.prototype.forEach=function(lt){for(var pt=this._root,nr=[],yr=!1,Or=0;!yr;)pt?(nr.push(pt),pt=pt.left):nr.length>0?(lt(pt=nr.pop(),Or++),pt=pt.right):yr=!0;return this},u.prototype.range=function(lt,pt,nr,yr){for(var Or=[],Dr=this._compare,hn=this._root;Or.length!==0||hn;)if(hn)Or.push(hn),hn=hn.left;else{if(Dr((hn=Or.pop()).key,pt)>0)break;if(Dr(hn.key,lt)>=0&&nr.call(yr,hn))return this;hn=hn.right}return this},u.prototype.keys=function(){for(var lt=this._root,pt=[],nr=[],yr=!1;!yr;)lt?(pt.push(lt),lt=lt.left):pt.length>0?(lt=pt.pop(),nr.push(lt.key),lt=lt.right):yr=!0;return nr},u.prototype.values=function(){for(var lt=this._root,pt=[],nr=[],yr=!1;!yr;)lt?(pt.push(lt),lt=lt.left):pt.length>0?(lt=pt.pop(),nr.push(lt.data),lt=lt.right):yr=!0;return nr},u.prototype.at=function(lt){for(var pt=this._root,nr=[],yr=!1,Or=0;!yr;)if(pt)nr.push(pt),pt=pt.left;else if(nr.length>0){if(pt=nr.pop(),Or===lt)return pt;Or++,pt=pt.right}else yr=!0;return null},u.prototype.load=function(lt,pt,nr){if(lt===void 0&&(lt=[]),pt===void 0&&(pt=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var yr=lt.length;return nr&&k(lt,pt,0,yr-1,this._compare),this._root=v(null,lt,pt,0,yr),this._size=yr,this},u.prototype.min=function(){var lt=this.minNode(this._root);return lt?lt.key:null},u.prototype.max=function(){var lt=this.maxNode(this._root);return lt?lt.key:null},u.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},u.createTree=function(lt,pt,nr,yr,Or){return new u(nr,Or).load(lt,pt,yr)},Object.defineProperties(u.prototype,g);var S=0,L=1,R=2,$=3,W=0,Z=1,X=2,re=3;function ne(lt,pt,nr){pt===null?(lt.inOut=!1,lt.otherInOut=!0):(lt.isSubject===pt.isSubject?(lt.inOut=!pt.inOut,lt.otherInOut=pt.otherInOut):(lt.inOut=!pt.otherInOut,lt.otherInOut=pt.isVertical()?!pt.inOut:pt.inOut),pt&&(lt.prevInResult=!fe(pt,nr)||pt.isVertical()?pt.prevInResult:pt));var yr=fe(lt,nr);lt.resultTransition=yr?function(Or,Dr){var hn,vn=!Or.inOut,Jn=!Or.otherInOut;switch(Dr){case W:hn=vn&&Jn;break;case Z:hn=vn||Jn;break;case re:hn=vn^Jn;break;case X:hn=Or.isSubject?vn&&!Jn:Jn&&!vn}return hn?1:-1}(lt,nr):0}function fe(lt,pt){switch(lt.type){case S:switch(pt){case W:return!lt.otherInOut;case Z:return lt.otherInOut;case X:return lt.isSubject&<.otherInOut||!lt.isSubject&&!lt.otherInOut;case re:return!0}break;case R:return pt===W||pt===Z;case $:return pt===X;case L:return!1}return!1}var Ne=function(lt,pt,nr,yr,Or){this.left=pt,this.point=lt,this.otherEvent=nr,this.isSubject=yr,this.type=Or||S,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},je={inResult:{configurable:!0}};function Re(lt,pt){return lt[0]===pt[0]&<[1]===pt[1]}Ne.prototype.isBelow=function(lt){var pt=this.point,nr=this.otherEvent.point;return this.left?(pt[0]-lt[0])*(nr[1]-lt[1])-(nr[0]-lt[0])*(pt[1]-lt[1])>0:(nr[0]-lt[0])*(pt[1]-lt[1])-(pt[0]-lt[0])*(nr[1]-lt[1])>0},Ne.prototype.isAbove=function(lt){return!this.isBelow(lt)},Ne.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},je.inResult.get=function(){return this.resultTransition!==0},Ne.prototype.clone=function(){var lt=new Ne(this.point,this.left,this.otherEvent,this.isSubject,this.type);return lt.contourId=this.contourId,lt.resultTransition=this.resultTransition,lt.prevInResult=this.prevInResult,lt.isExteriorRing=this.isExteriorRing,lt.inOut=this.inOut,lt.otherInOut=this.otherInOut,lt},Object.defineProperties(Ne.prototype,je);var $e=11102230246251565e-32,Ze=134217729,ht=(3+8*$e)*$e;function ot(lt,pt,nr,yr,Or){var Dr,hn,vn,Jn,cs=pt[0],ms=yr[0],As=0,Ln=0;ms>cs==ms>-cs?(Dr=cs,cs=pt[++As]):(Dr=ms,ms=yr[++Ln]);var Un=0;if(Ascs==ms>-cs?(vn=Dr-((hn=cs+Dr)-cs),cs=pt[++As]):(vn=Dr-((hn=ms+Dr)-ms),ms=yr[++Ln]),Dr=hn,vn!==0&&(Or[Un++]=vn);Ascs==ms>-cs?(vn=Dr-((hn=Dr+cs)-(Jn=hn-Dr))+(cs-Jn),cs=pt[++As]):(vn=Dr-((hn=Dr+ms)-(Jn=hn-Dr))+(ms-Jn),ms=yr[++Ln]),Dr=hn,vn!==0&&(Or[Un++]=vn);for(;As0!=As>0)return Ln;var Un=Math.abs(ms+As);return Math.abs(Ln)>=Ct*Un?Ln:-function(na,oa,la,Ma,Ga,$a,pa){var _a,ds,Bs,Ci,En,Es,qa,Qa,ri,oo,Ja,In,Fi,Ta,yi,Wo,_l,Io,Po=na-Ga,il=la-Ga,Md=oa-$a,ei=Ma-$a;Rt[0]=(yi=(Qa=Po-(qa=(Es=Ze*Po)-(Es-Po)))*(oo=ei-(ri=(Es=Ze*ei)-(Es-ei)))-((Ta=Po*ei)-qa*ri-Qa*ri-qa*oo))-((Ja=yi-(_l=(Qa=Md-(qa=(Es=Ze*Md)-(Es-Md)))*(oo=il-(ri=(Es=Ze*il)-(Es-il)))-((Wo=Md*il)-qa*ri-Qa*ri-qa*oo)))+(En=yi-Ja))+(En-_l),Rt[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Wo)+(En=Fi-Ja))+(En-Wo),Rt[2]=In-((Io=In+Ja)-(En=Io-In))+(Ja-En),Rt[3]=Io;var to=function(Ym,ac){for(var ad=ac[0],Cu=1;Cu<4;Cu++)ad+=ac[Cu];return ad}(0,Rt),lo=Et*pa;if(to>=lo||-to>=lo||(_a=na-(Po+(En=na-Po))+(En-Ga),Bs=la-(il+(En=la-il))+(En-Ga),ds=oa-(Md+(En=oa-Md))+(En-$a),Ci=Ma-(ei+(En=Ma-ei))+(En-$a),_a===0&&ds===0&&Bs===0&&Ci===0)||(lo=Kt*pa+ht*Math.abs(to),(to+=Po*Ci+ei*_a-(Md*Bs+il*ds))>=lo||-to>=lo))return to;xr[0]=(yi=(Qa=_a-(qa=(Es=Ze*_a)-(Es-_a)))*(oo=ei-(ri=(Es=Ze*ei)-(Es-ei)))-((Ta=_a*ei)-qa*ri-Qa*ri-qa*oo))-((Ja=yi-(_l=(Qa=ds-(qa=(Es=Ze*ds)-(Es-ds)))*(oo=il-(ri=(Es=Ze*il)-(Es-il)))-((Wo=ds*il)-qa*ri-Qa*ri-qa*oo)))+(En=yi-Ja))+(En-_l),xr[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Wo)+(En=Fi-Ja))+(En-Wo),xr[2]=In-((Io=In+Ja)-(En=Io-In))+(Ja-En),xr[3]=Io;var Kd=ot(4,Rt,4,xr,rr);xr[0]=(yi=(Qa=Po-(qa=(Es=Ze*Po)-(Es-Po)))*(oo=Ci-(ri=(Es=Ze*Ci)-(Es-Ci)))-((Ta=Po*Ci)-qa*ri-Qa*ri-qa*oo))-((Ja=yi-(_l=(Qa=Md-(qa=(Es=Ze*Md)-(Es-Md)))*(oo=Bs-(ri=(Es=Ze*Bs)-(Es-Bs)))-((Wo=Md*Bs)-qa*ri-Qa*ri-qa*oo)))+(En=yi-Ja))+(En-_l),xr[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Wo)+(En=Fi-Ja))+(En-Wo),xr[2]=In-((Io=In+Ja)-(En=Io-In))+(Ja-En),xr[3]=Io;var Go=ot(Kd,rr,4,xr,or);xr[0]=(yi=(Qa=_a-(qa=(Es=Ze*_a)-(Es-_a)))*(oo=Ci-(ri=(Es=Ze*Ci)-(Es-Ci)))-((Ta=_a*Ci)-qa*ri-Qa*ri-qa*oo))-((Ja=yi-(_l=(Qa=ds-(qa=(Es=Ze*ds)-(Es-ds)))*(oo=Bs-(ri=(Es=Ze*Bs)-(Es-Bs)))-((Wo=ds*Bs)-qa*ri-Qa*ri-qa*oo)))+(En=yi-Ja))+(En-_l),xr[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Wo)+(En=Fi-Ja))+(En-Wo),xr[2]=In-((Io=In+Ja)-(En=Io-In))+(Ja-En),xr[3]=Io;var Tf=ot(Go,or,4,xr,lr);return lr[Tf-1]}(Or,Dr,hn,vn,Jn,cs,Un)}(lt[0],lt[1],pt[0],pt[1],nr[0],nr[1]);return yr>0?-1:yr<0?1:0}function ur(lt,pt){var nr=lt.point,yr=pt.point;return nr[0]>yr[0]?1:nr[0]yr[1]?1:-1:function(Or,Dr,hn,vn){return Or.left!==Dr.left?Or.left?1:-1:vr(hn,Or.otherEvent.point,Dr.otherEvent.point)!==0?Or.isBelow(Dr.otherEvent.point)?-1:1:!Or.isSubject&&Dr.isSubject?1:-1}(lt,pt,nr)}function pr(lt,pt,nr){var yr=new Ne(pt,!1,lt,lt.isSubject),Or=new Ne(pt,!0,lt.otherEvent,lt.isSubject);return Re(lt.point,lt.otherEvent.point)&&console.warn("what is that, a collapsed segment?",lt),yr.contourId=Or.contourId=lt.contourId,ur(Or,lt.otherEvent)>0&&(lt.otherEvent.left=!0,Or.left=!1),lt.otherEvent.otherEvent=Or,lt.otherEvent=yr,nr.push(Or),nr.push(yr),nr}function tr(lt,pt){return lt[0]*pt[1]-lt[1]*pt[0]}function Xt(lt,pt){return lt[0]*pt[0]+lt[1]*pt[1]}function mr(lt,pt,nr){var yr=function(Jn,cs,ms,As,Ln){var Un=[cs[0]-Jn[0],cs[1]-Jn[1]],na=[As[0]-ms[0],As[1]-ms[1]];function oa(Es,qa,Qa){return[Es[0]+qa*Qa[0],Es[1]+qa*Qa[1]]}var la=[ms[0]-Jn[0],ms[1]-Jn[1]],Ma=tr(Un,na),Ga=Ma*Ma,$a=Xt(Un,Un);if(Ga>0){var pa=tr(la,na)/Ma;if(pa<0||pa>1)return null;var _a=tr(la,Un)/Ma;return _a<0||_a>1?null:pa===0||pa===1?[oa(Jn,pa,Un)]:_a===0||_a===1?[oa(ms,_a,na)]:[oa(Jn,pa,Un)]}if((Ga=(Ma=tr(la,Un))*Ma)>0)return null;var ds=Xt(Un,la)/$a,Bs=ds+Xt(Un,na)/$a,Ci=Math.min(ds,Bs),En=Math.max(ds,Bs);return Ci<=1&&En>=0?Ci===1?[oa(Jn,Ci>0?Ci:0,Un)]:En===0?[oa(Jn,En<1?En:1,Un)]:[oa(Jn,Ci>0?Ci:0,Un),oa(Jn,En<1?En:1,Un)]:null}(lt.point,lt.otherEvent.point,pt.point,pt.otherEvent.point),Or=yr?yr.length:0;if(Or===0||Or===1&&(Re(lt.point,pt.point)||Re(lt.otherEvent.point,pt.otherEvent.point))||Or===2&<.isSubject===pt.isSubject)return 0;if(Or===1)return Re(lt.point,yr[0])||Re(lt.otherEvent.point,yr[0])||pr(lt,yr[0],nr),Re(pt.point,yr[0])||Re(pt.otherEvent.point,yr[0])||pr(pt,yr[0],nr),1;var Dr=[],hn=!1,vn=!1;return Re(lt.point,pt.point)?hn=!0:ur(lt,pt)===1?Dr.push(pt,lt):Dr.push(lt,pt),Re(lt.otherEvent.point,pt.otherEvent.point)?vn=!0:ur(lt.otherEvent,pt.otherEvent)===1?Dr.push(pt.otherEvent,lt.otherEvent):Dr.push(lt.otherEvent,pt.otherEvent),hn&&vn||hn?(pt.type=L,lt.type=pt.inOut===lt.inOut?R:$,hn&&!vn&&pr(Dr[1].otherEvent,Dr[0].point,nr),2):vn?(pr(Dr[0],Dr[1].point,nr),3):Dr[0]!==Dr[3].otherEvent?(pr(Dr[0],Dr[1].point,nr),pr(Dr[1],Dr[2].point,nr),3):(pr(Dr[0],Dr[1].point,nr),pr(Dr[3].otherEvent,Dr[2].point,nr),3)}function Mr(lt,pt){if(lt===pt)return 0;if(vr(lt.point,lt.otherEvent.point,pt.point)!==0||vr(lt.point,lt.otherEvent.point,pt.otherEvent.point)!==0)return Re(lt.point,pt.point)?lt.isBelow(pt.otherEvent.point)?-1:1:lt.point[0]===pt.point[0]?lt.point[1]pt.contourId?1:-1:ur(lt,pt)===1?1:-1}var wr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function un(lt,pt,nr,yr){var Or,Dr=lt+1,hn=pt[lt].point,vn=pt.length;for(Dryr;)Dr--;return Dr}wr.prototype.isExterior=function(){return this.holeOf==null};var Br=tn,Kr=tn;function tn(lt,pt){if(!(this instanceof tn))return new tn(lt,pt);if(this.data=lt||[],this.length=this.data.length,this.compare=pt||gs,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function gs(lt,pt){return ltpt?1:0}tn.prototype={push:function(lt){this.data.push(lt),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var lt=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),lt}},peek:function(){return this.data[0]},_up:function(lt){for(var pt=this.data,nr=this.compare,yr=pt[lt];lt>0;){var Or=lt-1>>1,Dr=pt[Or];if(nr(yr,Dr)>=0)break;pt[lt]=Dr,lt=Or}pt[lt]=yr},_down:function(lt){for(var pt=this.data,nr=this.compare,yr=this.length>>1,Or=pt[lt];lt=0)break;pt[lt]=vn,lt=Dr}pt[lt]=Or}},Br.default=Kr;var jr=Math.max,rn=Math.min,qn=0;function Fs(lt,pt,nr,yr,Or,Dr){var hn,vn,Jn,cs,ms,As;for(hn=0,vn=lt.length-1;hn0?As.left=!0:ms.left=!0;var Ln=Jn[0],Un=Jn[1];Or[0]=rn(Or[0],Ln),Or[1]=rn(Or[1],Un),Or[2]=jr(Or[2],Ln),Or[3]=jr(Or[3],Un),yr.push(ms),yr.push(As)}}var $s=[];function ns(lt,pt,nr){typeof lt[0][0][0]=="number"&&(lt=[lt]),typeof pt[0][0][0]=="number"&&(pt=[pt]);var yr=function(Un,na,oa){var la=null;return Un.length*na.length==0&&(oa===W?la=$s:oa===X?la=Un:oa!==Z&&oa!==re||(la=Un.length===0?na:Un)),la}(lt,pt,nr);if(yr)return yr===$s?null:yr;var Or=[1/0,1/0,-1/0,-1/0],Dr=[1/0,1/0,-1/0,-1/0],hn=function(Un,na,oa,la,Ma){var Ga,$a,pa,_a,ds,Bs,Ci=new Br(null,ur);for(pa=0,_a=Un.length;pa<_a;pa++)for(ds=0,Bs=(Ga=Un[pa]).length;dsla[2]||la[0]>oa[2]||oa[1]>la[3]||la[1]>oa[3])&&(Ma===W?Ga=$s:Ma===X?Ga=Un:Ma!==Z&&Ma!==re||(Ga=Un.concat(na))),Ga}(lt,pt,Or,Dr,nr))return yr===$s?null:yr;for(var vn=function(Un){var na,oa,la=function(pa){var _a,ds,Bs,Ci,En=[];for(ds=0,Bs=pa.length;ds0){var Ja=Es[oo];if(Ja.holeOf!=null){var In=Ja.holeOf;Es[In].holeIds.push(qa),Qa.holeOf=In,Qa.depth=Es[oo].depth}else Es[oo].holeIds.push(qa),Qa.holeOf=oo,Qa.depth=Es[oo].depth+1}else Qa.holeOf=null,Qa.depth=Es[oo].depth}else Qa.holeOf=null,Qa.depth=0;return Qa}(la[na],Ga,pa),ds=function(En){Ma[En]=!0,En=la.length)&&la[Bs];);Ga.push(_a)}};for(na=0,oa=la.length;naCi||Ga===X&&En.point[0]>la[2])break;if(En.left){pa=$a=ds.insert(En),$a=$a!==(_a=ds.minNode())?ds.prev($a):null,pa=ds.next(pa);var Es=$a?$a.key:null;if(ne(En,Es,Ga),pa&&mr(En,pa.key,Un)===2&&(ne(En,Es,Ga),ne(pa.key,En,Ga)),$a&&mr($a.key,En,Un)===2){var qa=$a;ne(Es,(qa=qa!==_a?ds.prev(qa):null)?qa.key:null,Ga),ne(En,Es,Ga)}}else pa=$a=ds.find(En=En.otherEvent),$a&&pa&&($a=$a!==_a?ds.prev($a):null,pa=ds.next(pa),ds.remove(En),pa&&$a&&mr($a.key,pa.key,Un))}return Bs}(hn,0,0,Or,Dr,nr)),Jn=[],cs=0;cs * @license MIT * @preserve */function XP(f,c,u,g){const v=[],k=g===0?(S,L,R,$,W,Z)=>{S.push(new ir(Z,R+(Z-L)/($-L)*(W-R)))}:(S,L,R,$,W,Z)=>{S.push(new ir(L+(Z-R)/(W-R)*($-L),Z))};for(const S of f){const L=[];for(const R of S){if(R.length<=2)continue;const $=[];for(let X=0;Xc&&k($,re,ne,fe,Ne,c):je>u?Re=c&&k($,re,ne,fe,Ne,c),Re>u&&je<=u&&k($,re,ne,fe,Ne,u)}let W=R[R.length-1];const Z=g===0?W.x:W.y;Z>=c&&Z<=u&&$.push(W),$.length&&(W=$[$.length-1],$[0].x===W.x&&$[0].y===W.y||$.push($[0]),L.push($))}L.length&&v.push(L)}return v}function wUe(f,c){const u=Tie(f),g=Tie([c]),v=a1e.intersection(u,g);return v==null?[]:i1e(v)}function jUe(f,c){let g=Tie(f,65536);const v=[];for(;c.valid();c.next()){const[k,S]=c.get(),L=k.x*65536,R=k.y*65536,$=S.x*65536,W=S.y*65536,Z=$-L,X=W-R,re=Math.hypot(Z,X);if(re===0)continue;const ne=Math.trunc(X/re*3),fe=-Math.trunc(Z/re*3);v.push([[[L,R],[$,W],[$+ne,W+fe],[L+ne,R+fe],[L,R]]])}return v.length>0&&(g=a1e.diff(g,v)),i1e(g,1/65536)}function Tie(f,c=1){return[f.map(u=>u.map(g=>[g.x*c,g.y*c]))]}function i1e(f,c=1){return f.map(u=>u.map((g,v)=>{const k=g.map(S=>new ir(S[0]*c,S[1]*c).round());return v>0&&k.reverse(),k}))}class Aie{constructor(c,u){this.layoutVertexArray=new qm,this.indexArray=new qo,this.lineIndexArray=new ju,this.triangleSegments=new Oi,this.lineSegments=new Oi,this.programConfigurations=new Dh(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new Sp)}update(c,u,g,v,k,S,L,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,L,R)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,oUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.lineIndexBuffer=c.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,lUe.members))),this.programConfigurations.upload(c),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(c,u,g,v,k,S,L){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,u,g,v,k,S,void 0,L)}}class Eie{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Aie(c,!1),this.elevationBufferData=new Aie(c,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=c.sourceLayerIndex,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Cie("fill",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("fill-sort-key"),S=[];for(const{feature:L,id:R,index:$,sourceLayerIndex:W}of c){const Z=this.layers[0]._featureFilter.needGeometry,X=Dt(L,Z);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),X,g))continue;const re=k?k.evaluate(X,{},g,u.availableImages):void 0,ne={id:R,properties:L.properties,type:L.type,sourceLayerIndex:W,index:$,geometry:Z?X.geometry:St(L,g,v),patterns:{},sortKey:re};S.push(ne)}k&&S.sort((L,R)=>L.sortKey-R.sortKey);for(const L of S){const{geometry:R,index:$,sourceLayerIndex:W}=L;if(this.hasPattern){const Z=Mie("fill",this.layers,L,this.zoom,this.pixelRatio,u);this.patternFeatures.push(Z)}else this.addFeature(L,R,$,g,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(c[$].feature,R,$,W,this.index)}}update(c,u,g,v,k,S,L){this.bufferData.update(c,u,g,v,k,S,L,this.worldview),this.elevationBufferData.update(c,u,g,v,k,S,L,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,u,g,v,k,S,L,this.worldview)}addFeatures(c,u,g,v,k,S){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,u,g,v,S,c.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(c){this.bufferData.upload(c),this.elevationBufferData.upload(c),this.elevatedStructures&&this.elevatedStructures.upload(c)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(c,u,g,v,k,S=[],L,R){const $=z5(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,v,g,R):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,k,S,v,L,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,k,S,v,L,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,u,g,v,k){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(u,g,v,k,this.worldview))}addElevatedRoadFeature(c,u,g,v,k){const S=new Array,L=ya.getElevationFeature(c,k);if(!L)return void this.addGeometry(u,this.bufferData);{const $=this.clipPolygonsToTile(u,1);$.length>0&&S.push({polygons:$,elevationFeature:L,elevationTileID:g})}const R={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:v};for(const $ of S)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Nu($.elevationTileID,this.layers,this.zoom,this.lut));const Z=$.elevationFeature.isTunnel();let X=0;c.properties.hasOwnProperty(Vt)&&(X=+c.properties[Vt]);for(const re of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,re,Z,$.elevationFeature,X)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const W=new Ra(g,$.elevationTileID);this.addElevatedGeometry($.polygons,W,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,v,R)}}addElevatedGeometry(c,u,g,v,k,S){const L={elevation:g,elevationSampler:u,bias:v,index:k,featureInfo:S},[R,$]=this.addGeometry(c,this.elevationBufferData,L);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:R,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,R),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,u,g){let v=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,S=null;g&&(S=g.elevationSampler.constantElevation(g.elevation,g.bias),S!=null&&(v=S,k=S));const L=(R,$,W)=>{if(g!=null)if($.push(R),S!=null)u.elevatedLayoutVertexArray.emplaceBack(S),W.push(S);else{const Z=g.elevationSampler.pointElevation(R,g.elevation,g.bias);u.elevatedLayoutVertexArray.emplaceBack(Z),W.push(Z),v=Math.min(v,Z),k=Math.max(k,Z)}};for(const R of c){let $=0;for(const $e of R)$+=$e.length;const W=u.triangleSegments.prepareSegment($,u.layoutVertexArray,u.indexArray),Z=W.vertexLength,X=[],re=[],ne=[],fe=[],Ne=[],je=u.layoutVertexArray.length;for(const $e of R){if($e.length===0)continue;$e!==R[0]&&re.push(X.length/2);const Ze=u.lineSegments.prepareSegment($e.length,u.layoutVertexArray,u.lineIndexArray),ht=Ze.vertexLength;g&&Ne.push(u.layoutVertexArray.length-je),L($e[0],ne,fe),u.layoutVertexArray.emplaceBack($e[0].x,$e[0].y),u.lineIndexArray.emplaceBack(ht+$e.length-1,ht),X.push($e[0].x),X.push($e[0].y);for(let ot=1;ot<$e.length;ot++)L($e[ot],ne,fe),u.layoutVertexArray.emplaceBack($e[ot].x,$e[ot].y),u.lineIndexArray.emplaceBack(ht+ot-1,ht+ot),X.push($e[ot].x),X.push($e[ot].y);Ze.vertexLength+=$e.length,Ze.primitiveLength+=$e.length}const Re=MN(X,re);for(let $e=0;$e0&&g&&this.elevationMode==="hd-road-base"){const $e=g.elevation.isTunnel(),Ze=g.elevation.safeArea,ht=this.elevatedStructures.addVertices(ne,fe);this.elevatedStructures.addTriangles(Re,ht,$e);const ot=Ne.length;if(ot>0){for(let _t=0;_t=g&&re.max.x<=k&&re.min.y>=v&&re.max.y<=S?R:$).push(X)}if(R.length===c.length)return c;const W=[new ir(g,v),new ir(k,v),new ir(k,S),new ir(g,S),new ir(g,v)],Z=R;for(const X of $)Z.push(...wUe(X,W));return Z}}let o1e,l1e,c1e,d1e;Yr(Eie,"FillBucket",{omit:["layers","patternFeatures"]}),Yr(Aie,"FillBufferData"),Yr(Nu,"ElevatedStructures");class QP{constructor(c,u,g,v){if(this.triangleCount=u.length/3,this.min=new ir(0,0),this.max=new ir(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||c.length===0)return;const[k,S]=[c[0].clone(),c[0].clone()];for(let Z=1;ZZ.cellIdx-X.cellIdx||Z.triIdx-X.triIdx);let W=0;for(;W<$.length;){const Z=$[W].cellIdx,X={start:this.payload.length,len:0};for(;W<$.length&&$[W].cellIdx===Z;)++X.len,this.payload.push($[W++].triIdx);this.cells[Z]=X}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,u){if(this.triangleCount===0||this.cells.length===0||c.x>this.max.x||this.min.x>c.x||c.y>this.max.y||this.min.y>c.y)return;const g=Km(c.x-this.min.x,this.xScale,this.cellsX),v=Km(c.y-this.min.y,this.yScale,this.cellsY),k=this.cells[v*this.cellsX+g];if(k){this._lazyInitLookup();for(let S=0;Sthis.max.x||this.min.x>u.x||c.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();const v=Km(c.x-this.min.x,this.xScale,this.cellsX),k=Km(u.x-this.min.x,this.xScale,this.cellsX),S=Km(c.y-this.min.y,this.yScale,this.cellsY),L=Km(u.y-this.min.y,this.yScale,this.cellsY);for(let R=S;R<=L;R++)for(let $=v;$<=k;$++){const W=this.cells[R*this.cellsX+$];if(W)for(let Z=0;Zu.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){for(const g of this.footprints)u.push({footprint:g,id:c})}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=[];for(const{feature:S,id:L,index:R,sourceLayerIndex:$}of c){const W=this.layers[0]._featureFilter.needGeometry,Z=Dt(S,W);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),Z,g))continue;const X={id:L,properties:S.properties,type:S.type,sourceLayerIndex:$,index:R,geometry:W?Z.geometry:St(S,g,v),patterns:{}};k.push(X)}for(const S of k){const{geometry:L,index:R,sourceLayerIndex:$}=S;this.addFeature(S,L,R,g,{},u.availableImages,u.brightness),u.featureIndex.insert(c[R].feature,L,R,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,u,g,v,k,S,L){}destroy(){}addFeature(c,u,g,v,k,S=[],L){for(const R of z5(u,2)){const $=[],W=[],Z=[],X=new ir(1/0,1/0),re=new ir(-1/0,-1/0);for(const Ne of R)if(Ne.length!==0){Ne!==R[0]&&Z.push(W.length/2);for(let je=0;jeS===v)===void 0}(g,f.clipScope)}function JP(f,c){return f.x-c.x||f.y-c.y}function p1e(f,c){return JP(f.min,c.min)===0&&JP(f.max,c.max)===0}function Iie(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew ir((R.x+k.x*Sr)*L-S.x*Sr,(R.y+k.y*Sr)*L-S.y*Sr))}return Pie(u,v,f.indices,0,f.indices.length,0,0)}function x1e(f,c,u,g){const v=Math.pow(2,g.z-u.z);return new ir((f+u.x*Sr)*v-g.x*Sr,(c+u.y*Sr)*v-g.y*Sr)}function y1e(f,c){const u=[];c.grid.queryPoint(f,u);const g=c.indices,v=c.vertices;for(let k=0;k0&&(g.length>1&&u.push(g),g=[])}return g.length>1&&u.push(g),u}const Oie=Lt.types,PUe=["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"],LUe=["fill-extrusion-flood-light-ground-radius"],OUe=Math.pow(2,13),DUe=Math.pow(2,15)-1,_1e=new ir(0,1),dx=2147483648,b1e=7,w1e=450;function $5(f,c,u,g,v,k,S,L){f.emplaceBack((c<<1)+S,(u<<1)+k,(Math.floor(g*OUe)<<1)+v,Math.round(L))}function U5(f,c,u){f.emplaceBack(c.x*Sr,c.y*Sr,u?1:0)}function t6(f,c,u,g,v,k){f.emplaceBack(c.x,c.y,(u.x<<1)+g,(u.y<<1)+v,k)}function q5(f,c,u){f.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}class j1e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class k1e{constructor(){this.centroidXY=new ir(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 ir(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ir(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new ir(this.max.x-this.min.x,this.max.y-this.min.y)}}class N1e{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,u){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=u.x,c.min.y=c.max.y=u.y)}appendEdge(c,u,g){this.accCount++,this.acc._add(u);let v=!!this.borders;u.xc.max.x&&(c.max.x=u.x,v=!0),u.yc.max.y&&(c.max.y=u.y,v=!0),((u.x===0||u.x===Sr)&&u.x===g.x)!=((u.y===0||u.y===Sr)&&u.y===g.y)&&this.processBorderOverlap(u,g),v&&this.checkBorderIntersection(u,g)}checkBorderIntersection(c,u){u.x<0!=c.x<0&&this.addBorderIntersection(0,Fn(u.y,c.y,(0-u.x)/(c.x-u.x))),u.x>Sr!=c.x>Sr&&this.addBorderIntersection(1,Fn(u.y,c.y,(Sr-u.x)/(c.x-u.x))),u.y<0!=c.y<0&&this.addBorderIntersection(2,Fn(u.x,c.x,(0-u.y)/(c.y-u.y))),u.y>Sr!=c.y>Sr&&this.addBorderIntersection(3,Fn(u.x,c.x,(Sr-u.y)/(c.y-u.y)))}addBorderIntersection(c,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[c];ug[1]&&(g[1]=u)}processBorderOverlap(c,u){if(c.x===u.x){if(c.y===u.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,u.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,u.x),this.addBorderIntersection(g,c.x)}}centroid(){return this.accCount===0?new ir(0,0):new ir(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((c,u)=>c+ +(u[0]!==Number.MAX_VALUE),0):0}}function S1e(f,c){const u=f.add(c)._unit(),g=xe(f.x*u.x+f.y*u.y,-1,1);var v,k,S;return v=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(v)))/4*DUe*((k=f).x*(S=c).y-k.y*S.x<0?-1:1)}const RUe=[f=>f.x<0,f=>f.x>Sr,f=>f.y<0,f=>f.y>Sr];function FUe(f,c,u,g){const v=[4];if(g===0)return v;u._mult(g);const k=f.sub(u),S=c.sub(u),L=[f,c,k,S];for(let R=0;R<4;R++)for(const $ of L)if(RUe[R]($)){v.push(R);break}return v}class Die{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new m5,this.indexArray=new qo,this.programConfigurations=new Dh(c.layers,{zoom:c.zoom,lut:c.lut},u=>LUe.includes(u)),this._segments=new Oi,this.hiddenByLandmarkVertexArray=new gN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Oi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,u,g,v=!1){const k=c.length;if(k>2){let S=Math.max(0,this._segments.get().length-1);const L=this._segments._prepareSegment(4*k,this.vertexArray.length,2*this._segmentToGroundQuads[S].length);let R;S!==this._segments.get().length-1&&(S++,this._segmentToGroundQuads[S]=[],this._segmentToRegionTriCounts[S]=[0,0,0,0,0]);{const $=c[0],W=c[1];R=S1e($.sub(c[k-1])._perp()._unit(),W.sub($)._perp()._unit())}for(let $=0;$v.region-k.region);for(let g=0;gR+$,0);let L=0;for(let R=0;R<=4;R++){const $=S[R];if($!==0){let W=this.regionSegments[R];W||(W=this.regionSegments[R]=new Oi);const Z={vertexOffset:k.vertexOffset,primitiveOffset:k.primitiveOffset+L,vertexLength:k.vertexLength,primitiveLength:$};W.get().push(Z)}L+=$}for(let R=0;R0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,TUe.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 c=0;c<=4;c++){const u=this.regionSegments[c];u&&u.destroy()}}}}class r6{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaling=c.overscaling,this.layers=c.layers,this.pixelRatio=c.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=c.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new qo,this.footprintVertices=new qm,this.footprintSegments=[],this.layoutVertexArray=new Gy,this.centroidVertexArray=new qP,this.wallVertexArray=new $v,this.indexArray=new qo,this.programConfigurations=new Dh(c.layers,{zoom:c.zoom,lut:c.lut},u=>PUe.includes(u)),this.segments=new Oi,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new Die(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.features=[],this.hasPattern=Cie("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=Pe(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:k,id:S,index:L,sourceLayerIndex:R}of c){const $=this.layers[0]._featureFilter.needGeometry,W=Dt(k,$);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),W,g))continue;const Z={id:S,sourceLayerIndex:R,index:L,geometry:$?W.geometry:St(k,g,v),properties:k.properties,type:k.type,patterns:{}},X=this.layoutVertexArray.length,re=Oie[Z.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:k.id,feature:Mie("fill-extrusion",this.layers,Z,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(const ne of Z.geometry)for(const fe of v1e(ne,re))this.addFeature(k.id,Z,[fe],L,g,{},u.availableImages,v,u.brightness);else this.addFeature(k.id,Z,Z.geometry,L,g,{},u.availableImages,v,u.brightness);u.featureIndex.insert(k,Z.geometry,L,R,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,u,g,v,k,S){for(const{featureId:L,feature:R}of this.features){const $=Oie[R.type]==="Polygon",{geometry:W}=R;if(this.wallMode)for(const Z of W)for(const X of v1e(Z,$))this.addFeature(L,R,[X],R.index,u,g,v,k,S);else this.addFeature(L,R,W,R.index,u,g,v,k,S)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,u,g,v,k,S,L){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,L,this.worldview),this.groundEffect.update(c,u,k,g,v,S,L,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,EUe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,MUe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,AUe.members,!0)),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}uploadCentroid(c){this.groundEffect.uploadHiddenByLandmark(c),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=c.createVertexBuffer(this.centroidVertexArray,CUe.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(c,u,g,v,k,S,L,R,$){const W=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,Z=[new ir(0,0),new ir(Sr,Sr)],X=R.projection,re=X.name==="globe",ne=this.wallMode||Oie[u.type]==="Polygon",fe=new N1e;fe.centroidDataIndex=this.centroidData.length;const Ne=new k1e;Ne.buildingId=c,u.properties&&u.properties.hasOwnProperty("building_id")&&(Ne.buildingId=u.properties.building_id);const je=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},k)<=0,Re=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},k);let $e;if(Ne.height=Re,Ne.vertexArrayOffset=this.layoutVertexArray.length,Ne.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new dN),this.wallMode){if(re)return void Ur("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;$e=function(Rt){const rr=Rt[0].x===Rt[Rt.length-1].x&&Rt[0].y===Rt[Rt.length-1].y;(function(Kr){let tn=0;const gs=Kr.length;for(let jr=0;jr=0})(Rt)||(Rt=Rt.reverse());const lr={geometry:[],joinNormals:[],indices:[]},xr=[],vr=[],ur=[];let pr=Rt.length;for(;pr>=2&&Rt[pr-1].equals(Rt[pr-2]);)pr--;if(pr<(rr?3:2))return lr;let tr,Xt,mr,Mr,wr,un=0;for(;un0;let qn="miter";const Fs=2;qn==="miter"&&jr>Fs&&(qn="bevel"),qn==="bevel"&&(jr>100&&(qn="flipbevel"),jr{const nr=new ir(ns.x,ns.y),yr=new ir(ns.x,ns.y);nr.x+=Ba.x*pt,nr.y+=Ba.y*pt,yr.x-=Ba.x*Math.max(lt,1),yr.y-=Ba.y*Math.max(lt,1),ur.push(Ba),xr.push(nr),vr.push(yr)};if(qn==="miter")tn._mult(jr),$s(tr,tn,0,0);else if(qn==="flipbevel")tn=wr.mult(-1),$s(tr,tn,0,0),$s(tr,tn.mult(-1),0,0);else{const ns=-Math.sqrt(jr*jr-1),Ba=rn?ns:0,lt=rn?0:ns;Xt&&$s(tr,Mr,Ba,lt),mr&&$s(tr,wr,Ba,lt)}}lr.geometry=[...xr,...vr.reverse(),xr[0]],lr.joinNormals=[...ur,...ur.reverse(),ur[ur.length-1]];const Br=lr.geometry.length-1;for(let Kr=0;Kr
Rt<(rr.length-1)/2||Rt===rr.length-1,ht=this.wallMode?[g]:z5(g,500);for(let Rt=ht.length-1;Rt>=0;Rt--){const rr=ht[Rt];(rr.length===0||(ot=rr[0]).every(or=>or.x<=0)||ot.every(or=>or.x>=Sr)||ot.every(or=>or.y<=0)||ot.every(or=>or.y>=Sr))&&ht.splice(Rt,1)}var ot;let _t;if(re)_t=P1e(ht,Z,k);else{_t=[];for(const Rt of ht)_t.push({polygon:Rt,bounds:Z})}const Ct=ne?this.edgeRadius:0,Et=Ct>0&&this.zoom<17,Kt=(Rt,rr)=>{if(Rt.length===0)return!1;const or=Rt[Rt.length-1];return rr.x===or.x&&rr.y===or.y};for(const{polygon:Rt,bounds:rr}of _t){let or=0,lr=0;for(const pr of Rt)ne&&!pr[0].equals(pr[pr.length-1])&&pr.push(pr[0]),lr+=ne?pr.length-1:pr.length;const xr=this.segments.prepareSegment((ne?5:4)*lr,this.layoutVertexArray,this.indexArray);Ne.footprintSegIdx<0&&(Ne.footprintSegIdx=this.footprintSegments.length),Ne.polygonSegIdx<0&&(Ne.polygonSegIdx=this.polygonSegments.length);const vr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ur=new j1e;if(ur.vertexOffset=this.footprintVertices.length,ur.indexOffset=3*this.footprintIndices.length,ur.ringIndices=[],ne){const pr=[],tr=[];or=xr.vertexLength;for(let mr=0;mr4&&A1e(tr[tr.length-2],tr[0],tr[1]),mr=Ct?zUe(tr[tr.length-2],tr[0],tr[1],Ct):0;const Mr=[];let wr,un,Br;un=tr[1].sub(tr[0])._perp()._unit();let Kr=!0;for(let tn=1,gs=0;tn0?1:0,Ba=jr.dist(rn);if(gs+Ba>32768&&(gs=0),Ct){Br=qn.sub(rn)._perp()._unit();let yr=M1e(jr,rn,qn,C1e(un,Br),Ct);isNaN(yr)&&(yr=0);const Or=rn.sub(jr)._unit();jr=jr.add(Or.mult(mr))._round(),rn=rn.add(Or.mult(-yr))._round(),mr=yr,un=Br,je&&this.zoom>=17&&(Kt(Mr,jr)||Mr.push(jr),Kt(Mr,rn)||Mr.push(rn))}const lt=xr.vertexLength,pt=tr.length>4&&A1e(jr,rn,qn);let nr=E1e(gs,Xt,Kr);if($5(this.layoutVertexArray,jr.x,jr.y,$s,ns,0,0,nr),$5(this.layoutVertexArray,jr.x,jr.y,$s,ns,0,1,nr),this.wallMode){const yr=Ze(tn-1,tr),Or=$e.joinNormals[tn-1];U5(this.wallVertexArray,Or,yr),U5(this.wallVertexArray,Or,yr)}if(gs+=Ba,nr=E1e(gs,pt,!Kr),Xt=pt,$5(this.layoutVertexArray,rn.x,rn.y,$s,ns,0,0,nr),$5(this.layoutVertexArray,rn.x,rn.y,$s,ns,0,1,nr),this.wallMode){const yr=Ze(tn,tr),Or=$e.joinNormals[tn];U5(this.wallVertexArray,Or,yr),U5(this.wallVertexArray,Or,yr)}if(xr.vertexLength+=4,this.indexArray.emplaceBack(lt+0,lt+1,lt+2),this.indexArray.emplaceBack(lt+1,lt+3,lt+2),xr.primitiveLength+=2,Ct){const yr=or+(tn===1?tr.length-2:tn-2),Or=tn===1?or:yr+1;if(this.indexArray.emplaceBack(lt+1,yr,lt+3),this.indexArray.emplaceBack(yr,Or,lt+3),xr.primitiveLength+=2,wr===void 0&&(wr=lt),!Rie(qn,tr[tn],rr)){const Dr=tn===tr.length-1?wr:xr.vertexLength;this.indexArray.emplaceBack(lt+2,lt+3,Dr),this.indexArray.emplaceBack(lt+3,Dr+1,Dr),this.indexArray.emplaceBack(lt+3,Or,Dr+1),xr.primitiveLength+=3}Kr=!Kr}if(re){const yr=this.layoutVertexExtArray,Or=X.projectTilePoint(jr.x,jr.y,k),Dr=X.projectTilePoint(rn.x,rn.y,k),hn=X.upVector(k,jr.x,jr.y),vn=X.upVector(k,rn.x,rn.y);q5(yr,Or,hn),q5(yr,Or,hn),q5(yr,Dr,vn),q5(yr,Dr,vn)}}ne&&(or+=tr.length-1),je&&Ct&&this.zoom>=17&&(Mr.length!==0&&Kt(Mr,Mr[0])&&Mr.pop(),this.groundEffect.addData(Mr,rr,W,Ct>0))}this.footprintSegments.push(ur),vr.triangleCount=this.indexArray.length-vr.triangleArrayOffset,this.polygonSegments.push(vr),++Ne.footprintSegLen,++Ne.polygonSegLen}if(Ne.vertexCount=this.layoutVertexArray.length-Ne.vertexArrayOffset,Ne.groundVertexCount=this.groundEffect.vertexArray.length-Ne.groundVertexArrayOffset,Ne.vertexCount!==0){if(Ne.centroidXY=fe.borders?_1e:this.encodeCentroid(fe,Ne),this.centroidData.push(Ne),fe.borders){this.featuresOnBorder.push(fe);const Rt=this.featuresOnBorder.length-1;for(let rr=0;rrthis.featuresOnBorder[u].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let L=0;LSr),W=2*$+(+(R.min.x+R.max.x>Sr)^$);for(let Z=0;ZL.triangleSegmentIdx===R.triangleSegmentIdx?L.subtile-R.subtile:L.triangleSegmentIdx-R.triangleSegmentIdx);let g=0,v=0,k=0;for(const L of c){if(L.triangleSegmentIdx!==g)break;k++}const S=c.length;for(;v!==c.length;){g=c[v].triangleSegmentIdx;let L=0,R=v,$=v;for(let W=R;W0&&this.triangleSubSegments.push({segment:re,min:Z,max:X}),R=$;for(let ne=R;ne[fe[0]*(1-je[0])+Ne[0]*je[0],fe[1]*(1-je[1])+Ne[1]*je[1]],re=[],ne=[];for(const fe of this.triangleSubSegments){re[0]=fe.min.x/Sr,re[1]=fe.min.y/Sr,ne[0]=fe.max.x/Sr,ne[1]=fe.max.y/Sr;const Ne=X(W,Z,re),je=X(W,Z,ne);if(new ln([Ne[0],Ne[1],k],[je[0],je[1],S]).intersectsPrecise(g)===0){$&&(v.segments.push($),$=void 0);continue}const Re=fe.segment;$&&$.vertexOffset!==Re.vertexOffset&&(v.segments.push($),$=void 0),$?($.vertexLength+=Re.vertexLength,$.primitiveLength+=Re.primitiveLength):$={vertexOffset:Re.vertexOffset,primitiveLength:Re.primitiveLength,vertexLength:Re.vertexLength,primitiveOffset:Re.primitiveOffset,sortKey:void 0,vaos:{}}}return $&&v.segments.push($),v}encodeCentroid(c,u){const g=c.centroid(),v=u.span(),k=Math.min(7,Math.round(v.x*this.tileToMeter/10)),S=Math.min(7,Math.round(v.y*this.tileToMeter/10));return new ir(xe(g.x,1,Sr-1)<<3|k,xe(g.y,1,Sr-1)<<3|S)}encodeBorderCentroid(c){if(!c.borders)return new ir(0,0);const u=c.borders,g=Number.MAX_VALUE;if(u[0][0]!==g||u[1][0]!==g){const v=u[0][0]!==g?0:1;return new ir(6|(u[0][0]!==g?0:65528),(u[v][0]+u[v][1])/2<<3|6)}{const v=u[2][0]!==g?2:3;return new ir((u[v][0]+u[v][1])/2<<3|6,6|(u[2][0]!==g?0:65528))}}showCentroid(c){const u=this.centroidData[c.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const u=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,v=c.flags&dx?_1e:c.centroidXY,k=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==v.y||k!==v.x){for(let S=u;SR.max.x||R.min.x>S.max.x||S.min.y>R.max.y||R.min.y>S.max.y||S.footprint.buildingIds.has(R.buildingId)&&(R.flags|=dx);else for(const R of this.centroidData)if(!(R.flags&dx||S.min.x>R.max.x||R.min.x>S.max.x||S.min.y>R.max.y||R.min.y>S.max.y))for(let $=0;$u!=re>u&&c<(this.footprintVertices.int16[2*(W+S.vertexOffset)+0]-Z)*(u-X)/(re-X)+Z&&(v=!v)}L=R}}return v}getHeightAtTileCoord(c,u){let g=Number.NEGATIVE_INFINITY,v=!0;const k=4*(c+Sr)*Sr+(u+Sr);if(this.partLookup.hasOwnProperty(k)){const S=this.partLookup[k];return S?{height:S.height,hidden:!!(S.flags&dx)}:void 0}for(const S of this.centroidData)c>S.max.x||S.min.x>c||u>S.max.y||S.min.y>u||S.height<=g||this.footprintContainsPoint(c,u,S)&&(g=S.height,this.partLookup[k]=S,v=!!(S.flags&dx));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.partLookup[k]=void 0}}function C1e(f,c){const u=f.add(c)._unit();return f.x*u.x+f.y*u.y}function zUe(f,c,u,g){const v=c.sub(f)._perp()._unit(),k=u.sub(c)._perp()._unit();return M1e(f,c,u,C1e(v,k),g)}function M1e(f,c,u,g,v){const k=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(u)/3,v*k/g)}function Rie(f,c,u){return f.xu[1].x&&c.x>u[1].x||f.yu[1].y&&c.y>u[1].y}function T1e(f,c){return f.xc[1].x||f.yc[1].y}function A1e(f,c,u){if(f.x<0||f.x>=Sr||c.x<0||c.x>=Sr||u.x<0||u.x>=Sr)return!1;const g=u.sub(c),v=g.perp(),k=f.sub(c);return(g.x*k.x+g.y*k.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(k.x*k.x+k.y*k.y))>-.866&&v.x*k.x+v.y*k.y<0}function E1e(f,c,u){const g=c?2|f:-3&f;return u?1|g:-2&g}function I1e(){const f=Math.PI/32,c=Math.tan(f),u=b;return u*Math.sqrt(1+2*c*c)-u}function P1e(f,c,u){const g=1<{for(const Ct of ot)ne.push({polygon:Ct,bounds:_t})},Ne=Math.ceil(Math.log2(W)),je=Math.ceil(Math.log2(Z)),Re=Ne-je,$e=[];for(let ot=0;ot0?0:1);for(let ot=0;ot_t+1?ht.push({polygons:lr,bounds:vr,depth:_t+1}):fe(lr,vr)}if(xr.length){const vr=[new ir(Ct===0?or:Et.x,Ct===1?or:Et.y),Kt];$e.length>_t+1?ht.push({polygons:xr,bounds:vr,depth:_t+1}):fe(xr,vr)}}return ne}(f,c,Math.ceil((k-v)/11.25),Math.ceil((S-L)/11.25),1,(R,$,W)=>{if(R===0)return .5*($+W);{const Z=ce((u.y+$/Sr)/g);return(H(.5*(ce((u.y+W/Sr)/g)+Z))*g-u.y)*Sr}})}function BUe(f,c,u,g,v,k){const S=Math.pow(2,g.z-v.z);for(let L=0;L=R[S]&&(L=c,R=f),L[S]v&&R1e(L,R,S,v),L[S]k&&R1e(R,L,S,k)}}function n6(f,c,u,g,v,k){const S=[];for(let L=0;L=g&&ne.x>=g||(re.x>=g?re=new ir(g,re.y+(g-re.x)/(ne.x-re.x)*(ne.y-re.y))._round():ne.x>=g&&(ne=new ir(g,re.y+(g-re.x)/(ne.x-re.x)*(ne.y-re.y))._round()),re.y>=v&&ne.y>=v||(re.y>=v?re=new ir(re.x+(v-re.y)/(ne.y-re.y)*(ne.x-re.x),v)._round():ne.y>=v&&(ne=new ir(re.x+(v-re.y)/(ne.y-re.y)*(ne.x-re.x),v)._round()),$&&re.equals($[$.length-1])||($=[re],S.push($),k&&k.push({progress:{min:Ne+z1e(je,Re,re)*fe,max:1},parentIndex:L,prevPoint:je,nextPoint:Re})),$.push(ne),k&&(k[k.length-1].progress.max=Ne+z1e(je,Re,ne)*fe,k[k.length-1].nextPoint=Re)))))}if(k&&Z>0)for(let X=W;X$.t-W.t);let S=0,L=0,R=[];for(g.push(R);S!==f.length;){if(L===k.length){for(;S!==f.length;)R.length!==0&&R[R.length-1].equals(f[S])||R.push(f[S]),S++;break}k[L].t<=S?(R.length!==0&&R[R.length-1].equals(k[L].point)||R.push(k[L].point),Math.trunc(k[L].t),L++):(R.length!==0&&R[R.length-1].equals(f[S])||R.push(f[S]),S++)}}function z1e(f,c,u){return f.x!==c.x?(u.x-f.x)/(c.x-f.x):f.y!==c.y?(u.y-f.y)/(c.y-f.y):0}function V5(f,c){return f.x*c.x+f.y*c.y}function B1e(f,c){if(f.length===1){let u=0;const g=c[u++];let v;for(;!v||g.equals(v);)if(v=c[u++],!v)return 1/0;for(;u{or[0]=lr,or[1]=xr,or[2]=vr,or[3]=1},rr=I1e();re>0&&(re+=rr),ne+=rr;for(const or of X){const lr=[],xr=[];for(const vr of or){const ur=vr.x+fe.x,pr=vr.y+fe.y,tr=Z.projection.projectTilePoint(ur,pr,ht),Xt=Z.projection.upVector(ht,vr.x,vr.y);let mr=re,Mr=ne;if(je){const wr=q1e(ur,pr,re,ne,je,Re,$e,Ze);mr+=wr.base,Mr+=wr.top}re!==0?Rt(Et,tr.x+Xt[0]*Ct*mr,tr.y+Xt[1]*Ct*mr,tr.z+Xt[2]*Ct*mr):Rt(Et,tr.x,tr.y,tr.z),Rt(Kt,tr.x+Xt[0]*Ct*Mr,tr.y+Xt[1]*Ct*Mr,tr.z+Xt[2]*Ct*Mr),Ke(Et,Et,Ne),Ke(Kt,Kt,Ne),lr.push(new Xv(Et[0],Et[1],Et[2])),xr.push(new Xv(Kt[0],Kt[1],Kt[2]))}ot.push(lr),_t.push(xr)}return[ot,_t]}(f,c,u,g,v,k,S,L,R,$,W):S?function(Z,X,re,ne,fe,Ne,je,Re,$e){const Ze=[],ht=[],ot=[0,0,0,1];for(const _t of Z){const Ct=[],Et=[];for(const Kt of _t){const Rt=Kt.x+ne.x,rr=Kt.y+ne.y,or=q1e(Rt,rr,X,re,Ne,je,Re,$e);ot[0]=Rt,ot[1]=rr,ot[2]=or.base,ot[3]=1,gt(ot,ot,fe),ot[3]=Math.max(ot[3],1e-5);const lr=new Xv(ot[0]/ot[3],ot[1]/ot[3],ot[2]/ot[3]);ot[0]=Rt,ot[1]=rr,ot[2]=or.top,ot[3]=1,gt(ot,ot,fe),ot[3]=Math.max(ot[3],1e-5);const xr=new Xv(ot[0]/ot[3],ot[1]/ot[3],ot[2]/ot[3]);Ct.push(lr),Et.push(xr)}Ze.push(Ct),ht.push(Et)}return[Ze,ht]}(c,u,g,v,k,S,L,R,$):function(Z,X,re,ne,fe){const Ne=[],je=[],Re=fe[8]*X,$e=fe[9]*X,Ze=fe[10]*X,ht=fe[11]*X,ot=fe[8]*re,_t=fe[9]*re,Ct=fe[10]*re,Et=fe[11]*re;for(const Kt of Z){const Rt=[],rr=[];for(const or of Kt){const lr=or.x+ne.x,xr=or.y+ne.y,vr=fe[0]*lr+fe[4]*xr+fe[12],ur=fe[1]*lr+fe[5]*xr+fe[13],pr=fe[2]*lr+fe[6]*xr+fe[14],tr=fe[3]*lr+fe[7]*xr+fe[15],Xt=vr+Re,mr=ur+$e,Mr=pr+Ze,wr=Math.max(tr+ht,1e-5),un=vr+ot,Br=ur+_t,Kr=pr+Ct,tn=Math.max(tr+Et,1e-5);Rt.push(new Xv(Xt/wr,mr/wr,Mr/wr)),rr.push(new Xv(un/tn,Br/tn,Kr/tn))}Ne.push(Rt),je.push(rr)}return[Ne,je]}(c,u,g,v,k)}function q1e(f,c,u,g,v,k,S,L){const R=S*v.getElevationAt(f,c,!0,!0),$=k[0]!==0,W=$?k[1]===0?S*(k[0]/b1e-w1e):S*function(Z,X,re){const ne=Math.floor(X[0]/8),fe=Math.floor(X[1]/8),Ne=10*(X[0]-8*ne),je=10*(X[1]-8*fe),Re=Z.getElevationAt(ne,fe,!0,!0),$e=Z.getMeterToDEM(re),Ze=Math.floor(.5*(Ne*$e-1)),ht=Math.floor(.5*(je*$e-1)),ot=Z.tileCoordToPixel(ne,fe),_t=2*Ze+1,Ct=2*ht+1,Et=function(xr,vr,ur,pr,tr){return[xr.getElevationAtPixel(vr,ur,!0),xr.getElevationAtPixel(vr+tr,ur,!0),xr.getElevationAtPixel(vr,ur+tr,!0),xr.getElevationAtPixel(vr+pr,ur+tr,!0)]}(Z,ot.x-Ze,ot.y-ht,_t,Ct),Kt=Math.abs(Et[0]-Et[1]),Rt=Math.abs(Et[2]-Et[3]),rr=Math.abs(Et[0]-Et[2])+Math.abs(Et[1]-Et[3]),or=Math.min(.25,.5*$e*(Kt+Rt)/_t),lr=Math.min(.25,.5*$e*rr/Ct);return Re+Math.max(or*Ne,lr*je)}(v,k,L):R;return{base:R+(u===0?-1:u),top:$?Math.max(W+g,R+u+2):R+g}}class UUe{constructor(c){this._callback=c,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 qUe{constructor(){this.tasks={},this.taskQueue=[],Pt(["process"],this),this.invoker=new UUe(this.process),this.nextId=0}add(c,u){const g=this.nextId++,v=function({type:k,isSymbolTile:S,zoom:L}){return L=L||0,k==="message"?0:k!=="maybePrepare"||S?k!=="parseTile"||S?k==="parseTile"&&S?300-L:k==="maybePrepare"&&S?400-L:500:200-L:100-L}(u);if(v===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:u,priority:v,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 c=this.pick();if(c===null)return;const u=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let c=null,u=1/0;for(let v=0;v{g&&delete this.callbacks[L],this.target.postMessage({id:L,type:"",targetMapId:v,sourceMapId:this.mapId})}}}receive(c){const u=c.data;if(!u)return;const g=u.id;if(g&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){const v=this.cancelCallbacks[g];delete this.cancelCallbacks[g],v&&v.cancel()}else if(u.mustQueue||Ds(self)){const v=this.callbacks[g],k=this.scheduler.add(()=>this.processTask(g,u),v&&v.metadata||{type:"message"});k&&(this.cancelCallbacks[g]=k)}else this.processTask(g,u)}processTask(c,u){if(delete this.cancelCallbacks[c],u.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(u.error?g(Um(u.error)):g(null,Um(u.data)))}else{const g=new Set,v=u.hasCallback?(S,L)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:S?wp(S):null,data:wp(L,g)},g)}:()=>{},k=Um(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,k,v);else if(this.parent.getWorkerSource){const S=u.type.split("."),{source:L,scope:R}=k;this.parent.getWorkerSource(u.sourceMapId,S[0],L,R)[S[1]](k,v)}else v(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var H5={workerUrl:"",workerClass:null,workerParams:void 0};const Fie="mapboxgl_preloaded_worker_pool";class Qv{constructor(c){this.active={},this.name=c}acquire(c,u=Qv.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Fie]}numActive(){return Object.keys(this.active).length}}Qv.workerCount=2;class AN{constructor(c,u,g="Worker",v=Qv.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=At();const k=this.workerPool.acquire(this.id,v);for(let S=0;S{this.ready=!0})}broadcast(c,u,g){kt(this.actors,(v,k)=>{v.send(c,u,k)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(c=>{c.remove()}),this.actors=[],this.workerPool.release(this.id)}}let W5,zie;function s6(){return W5||(W5=new Qv),W5}AN.Actor=V1e;const Bie=4096;class VUe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Bie),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Bie?-1:(new Int32Array(this.module.heap32.buffer,u,c.length).set(c),u)}createFloatArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Bie?-1:(new Float32Array(this.module.heapF32.buffer,u,c.length).set(c),u)}readStringBuffer(c){let u="";for(;this.module.heapU8[c]!==0;)u+=String.fromCharCode(this.module.heapU8[c]),++c;return u}setStyle(c){const u=c.normalScale;this.module.setStyle(u[0],u[1],u[2],c.tileToMeters)}setAOOptions(c,u){this.module.setAOOptions(c?1:0,u)}setMetricOptions(c,u){this.module.setMetricOptions(c?1:0,u)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,u){this.module.setFacadeOptions(c,u?1:0)}setFauxFacadeOptions(c,u,g){this.module.setFauxFacadeOptions(c?1:0,u?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,u){this.memoryStackNextFree=this.memoryStack;for(const L of c){const R=this.createIntArray(L.ringIndices),$=this.createFloatArray(L.coordinates);if(R===-1||$===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(L.id,L.sourceId,L.minHeight,L.height,L.roofType,$,R,L.ringIndices.length-1)}for(const L of u){let R;R=L.entrances?JSON.parse(L.entrances):[];const $=this.createFloatArray(R),W=this.createFloatArray(L.coordinates);if($===-1||W===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(L.sourceId,L.crossPerc,L.distanceToRoad,$,R.length,W,L.coordinates.length)}if(!this.module.generateMesh()){const L=this.module.getLastError();return this.readStringBuffer(L)}const g=this.module.getMeshCount(),v=new Array(g);for(let L=0;Lv.arrayBuffer()).then(v=>{c.buffers[u]=v})}function Q1e(f,c){const u=f.json.bufferViews[c];return new Uint8Array(f.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function YUe(f,c,u,g){if(f.uri){const v=X1e(f.uri,g);return fetch(v).then(k=>k.blob()).then(k=>createImageBitmap(k)).then(k=>{c.images[u]=k})}if(f.bufferView!==void 0){const v=Q1e(c,f.bufferView),k=new Blob([v],{type:f.mimeType});return createImageBitmap(k).then(S=>{c.images[u]=S})}}function J1e(f,c=0,u){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===Z1e){const W=new Uint32Array(f,c);let Z=2;const X=(W[Z++]>>2)-3,re=W[Z++]>>2;if(Z++,g.json=JSON.parse(Y1e.decode(W.subarray(Z,Z+re))),Z+=re,Z{const W=[],Z=L&&L.includes(qie),X=L&&L.includes(o6);if(Z&&W.push(function(){if(!Lp)return G5??(G5=function(re){let ne,fe=null;function Ne(){ne=new Uint8Array(fe.buffer)}function je(){throw new Error("Unexpected Draco error.")}const Re={a:{a:je,d:function($e,Ze,ht){return ne.copyWithin($e,Ze,Ze+ht)},c:function($e){const Ze=ne.length,ht=Math.max($e>>>0,Math.ceil(1.2*Ze)),ot=Math.ceil((ht-Ze)/65536);try{return fe.grow(ot),Ne(),!0}catch{return!1}},b:je}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Re):re.then($e=>$e.arrayBuffer()).then($e=>WebAssembly.instantiate($e,Re))).then($e=>{const{Rb:Ze,Qb:ht,P:ot,T:_t,X:Ct,Ja:Et,La:Kt,Qa:Rt,Va:rr,Wa:or,eb:lr,jb:xr,f:vr,e:ur,yb:pr,zb:tr,Ab:Xt,Bb:mr,Db:Mr,Gb:wr}=$e.instance.exports;fe=ur;const un=(()=>{let Br=0,Kr=0,tn=0,gs=0;return jr=>{tn&&(Ze(gs),Ze(Br),Kr+=tn,tn=Br=0),Br||(Kr+=128,Br=ht(Kr));const rn=jr.length+7&-8;let qn=Br;rn>=Kr&&(tn=rn,qn=gs=ht(rn));for(let Fs=0;Fs{Lp=re,G5=void 0}))}()),X&&W.push(function(){if(Uie)return;const re=function(ne){let fe;const Ne=WebAssembly.instantiateStreaming(ne,{}).then($e=>{fe=$e.instance,fe.exports.__wasm_call_ctors()}),je={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Re={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Ne,supported:!0,decodeGltfBuffer($e,Ze,ht,ot,_t,Ct){(function(Et,Kt,Rt,rr,or,lr,xr){const vr=Et.exports.sbrk,ur=rr+3&-4,pr=vr(ur*or),tr=vr(lr.length),Xt=new Uint8Array(Et.exports.memory.buffer);Xt.set(lr,tr);const mr=Kt(pr,rr,or,tr,lr.length);if(mr===0&&xr&&xr(pr,ur,or),Rt.set(Xt.subarray(pr,pr+rr*or)),vr(pr-vr(0)),mr!==0)throw new Error(`Malformed buffer data: ${mr}`)})(fe,fe.exports[Re[_t]],$e,Ze,ht,ot,fe.exports[je[Ct]])}}}(fetch(G1e()));return re.ready.then(()=>{Uie=re})}()),k)for(let re=0;re{if(Z&&S)for(const{primitives:re}of S)for(const ne of re)GUe(ne,g);if(X&&S&&R)for(const re of R)KUe(re,g);return g})})}function eve(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>J1e(c,0,f))}function Vie(f){switch(f){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 Hie(f){switch(f){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 Wie{constructor(c,u,g,v){this.context=c,this.format=g,this.useMipmap=v&&v.useMipmap,this.texture=c.gl.createTexture(),this.update(u,{premultiply:v&&v.premultiply})}update(c,u){const g=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,v=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:k}=this,{gl:S}=k,{x:L,y:R}=u&&u.position?u.position:{x:0,y:0},$=L+g,W=R+v;!this.size||this.size[0]===$&&this.size[1]===W||(S.bindTexture(S.TEXTURE_2D,null),S.deleteTexture(this.texture),this.texture=S.createTexture(),this.size=null),S.bindTexture(S.TEXTURE_2D,this.texture),k.pixelStoreUnpackFlipY.set(!1),k.pixelStoreUnpack.set(1),k.pixelStoreUnpackPremultiplyAlpha.set(this.format===S.RGBA8&&(!u||u.premultiply!==!1));const Z=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&W>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max($,W)))+1:1;S.texStorage2D(S.TEXTURE_2D,X,this.format,$,W),this.size=[$,W]}this.size&&(Z?S.texSubImage2D(S.TEXTURE_2D,0,L,R,Vie(this.format),Hie(this.format),c):"data"in c&&c.data&&S.texSubImage2D(S.TEXTURE_2D,0,L,R,g,v,Vie(this.format),Hie(this.format),c.data)),this.useMipmap&&S.generateMipmap(S.TEXTURE_2D)}bind(c,u,g=!1){const{context:v}=this,{gl:k}=v;k.bindTexture(k.TEXTURE_2D,this.texture),c!==this.minFilter&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,c),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,this.useMipmap&&!g?c===k.NEAREST?k.NEAREST_MIPMAP_NEAREST:k.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),u!==this.wrapS&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,u),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(c,u,g,v,k){const{context:S}=this,{gl:L}=S;L.bindTexture(L.TEXTURE_2D,this.texture),u!==this.magFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,u),this.magFilter=u),c!==this.minFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,this.useMipmap?c===L.NEAREST?L.NEAREST_MIPMAP_NEAREST:L.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),g!==this.wrapS&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,g),this.wrapS=g),v!==this.wrapT&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,v),this.wrapT=v),k!==this.compareMode&&(k?(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.COMPARE_REF_TO_TEXTURE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_FUNC,k)):L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.NONE),this.compareMode=k)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class Z5{constructor(c,u){this.context=c,this.texture=u}bind(c,u){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),c!==this.minFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,c),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,c),this.minFilter=c),u!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,u),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,u),this.wrapS=u)}}const XUe=Ts([{name:"a_pos_3f",components:3,type:"Float32"}]),QUe=Ts([{name:"a_color_3f",components:3,type:"Float32"}]),JUe=Ts([{name:"a_color_4f",components:4,type:"Float32"}]),eqe=Ts([{name:"a_uv_2f",components:2,type:"Float32"}]),tqe=Ts([{name:"a_normal_3f",components:3,type:"Float32"}]),rqe=Ts([{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"}]),nqe=Ts([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function tve(f,c){const u=l6(f.projection,f.zoom,f.width,f.height),g=function(k,S,L,R,$){const W=new m(L.lng-180*n0,L.lat),Z=new m(L.lng+180*n0,L.lat),X=k.project(W.lng,W.lat),re=k.project(Z.lng,Z.lat),ne=-Math.atan2(re.y-X.y,re.x-X.x),fe=Ve.fromLngLat(L);fe.y=xe(fe.y,-1+n0,1-n0);const Ne=fe.toLngLat(),je=k.project(Ne.lng,Ne.lat),Re=Ve.fromLngLat(Ne);Re.x+=n0;const $e=Re.toLngLat(),Ze=k.project($e.lng,$e.lat),ht=nve(Ze.x-je.x,Ze.y-je.y,ne),ot=Ve.fromLngLat(Ne);ot.y+=n0;const _t=ot.toLngLat(),Ct=k.project(_t.lng,_t.lat),Et=nve(Ct.x-je.x,Ct.y-je.y,ne),Kt=Math.abs(ht.x)/Math.abs(Et.y),Rt=A([]);V(Rt,Rt,-ne*(1-($?0:R)));const rr=A([]);return z(rr,rr,[1,1-(1-Kt)*R,1]),rr[4]=-Et.x/Et.y*R,V(rr,rr,ne),T(rr,Rt,rr),rr}(f.projection,0,f.center,u,c),v=rve(f);return z(g,g,[v,v,1]),g}function rve(f){const c=f.projection,u=l6(f.projection,f.zoom,f.width,f.height),g=Gie(c,f.center),v=Gie(c,m.convert(c.center));return Math.pow(2,g*u+(1-u)*v)}function l6(f,c,u,g,v=1/0){const k=f.range;if(!k)return 0;const S=Math.min(v,Math.max(u,g)),L=Math.log2(S/1024);return Ie(k[0]+L,k[1]+L,c)}const n0=1/4e4;function Gie(f,c){const u=xe(c.lat,-de,de),g=new m(c.lng-180*n0,u),v=new m(c.lng+180*n0,u),k=f.project(g.lng,u),S=f.project(v.lng,u),L=Ve.fromLngLat(g),R=Ve.fromLngLat(v),$=S.x-k.x,W=S.y-k.y,Z=R.x-L.x,X=R.y-L.y,re=Math.sqrt((Z*Z+X*X)/($*$+W*W));return Math.log2(re)}function nve(f,c,u){const g=Math.cos(u),v=Math.sin(u);return{x:f*g-c*v,y:f*v+c*g}}function sve(f,c,u){A(f),V(f,f,ss(c[2])),F(f,f,ss(c[0])),q(f,f,ss(c[1])),z(f,f,u),T(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function c6(f,c,u,g,v,k,S,L){const R=[u[0]-c[0],u[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(pe(R)<1e-12||pe($)<1e-12)return Mt(f);const W=tt([],R,$);Fe(W,W),_e($,g,c),R[2]=(k-v)*L,$[2]=(S-v)*L;const Z=R;return tt(Z,R,$),Fe(Z,Z),Pn(f,W,Z)}function d6(f,c,u=!1){const g=t0(c.zoom),v=function(k,S,L){const R=S.worldSize,$=[k[12],k[13],k[14]],W=ce($[1]/R),Z=Q($[0]/R),X=A([]),re=Y(1,W)*R,ne=Y(1,0)*R*ve(W,S.zoom),fe=1/wie(R);let Ne=ne*fe;if(L){const Ze=l6(S.projection,S.zoom,S.width,S.height,1024);Ne=fe*S.projection.pixelSpaceConversion(S.center.lat,R,Ze)}const je=Qy(W,Z);ue(je,je,ge([],Fe([],je),re*Ne*$[2]));const Re=function(Ze){const ht=[Ze[0],Ze[1],Ze[2]];let ot=[0,1,0];const _t=tt([],ot,ht);return tt(ot,ht,_t),Ee(ot)===0&&(ot=[0,1,0],tt(_t,ht,ot)),Fe(_t,_t),Fe(ot,ot),Fe(ht,ht),[_t[0],_t[1],_t[2],0,ot[0],ot[1],ot[2],0,ht[0],ht[1],ht[2],0,Ze[0],Ze[1],Ze[2],1]}(je);z(X,X,[Ne,Ne,Ne*re]),P(X,X,[-$[0],-$[1],-$[2]]);const $e=T([],S.globeMatrix,Re);return T($e,$e,X),T($e,$e,k),$e}(f,c,u);if(g>0){const k=function(S,L){const R=L.worldSize,$=Y(1,0)*R*ve(L.center.lat,L.zoom)/wie(R),W=Y(1,L.center.lat)*R,Z=A([]);q(Z,Z,ss(L.center.lng)),F(Z,Z,ss(L.center.lat)),P(Z,Z,[0,0,_c]),z(Z,Z,[$,$,$*W]);const X=L.point;return P(Z,Z,[-X.x,-X.y,0]),T(Z,Z,S),T(Z,L.globeMatrix,Z)}(f,c);return function(S,L,R){const $=(ne,fe,Ne)=>{const je=pe(ne),Re=pe(fe),$e=Pp(ne,fe,Ne);return ge($e,$e,1/pe($e)*Fn(je,Re,Ne))},W=$([S[0],S[1],S[2]],[L[0],L[1],L[2]],R),Z=$([S[4],S[5],S[6]],[L[4],L[5],L[6]],R),X=$([S[8],S[9],S[10]],[L[8],L[9],L[10]],R),re=Pp([S[12],S[13],S[14]],[L[12],L[13],L[14]],R);return[W[0],W[1],W[2],0,Z[0],Z[1],Z[2],0,X[0],X[1],X[2],0,re[0],re[1],re[2],1]}(v,k,g)}return v}function Kie(f,c,u,g){const v=ln.projectAabbCorners(g,u);let k=Number.MAX_VALUE;for(let L=0;L0||Ne===0&&ne[0]*fe[0]+ne[1]*fe[1]>=0&&ne[0]*ne[0]+ne[1]*ne[1]>fe[0]*fe[0]+fe[1]*fe[1])&&(W=re)}Z=W}while(Z!==$);return R.length>0&&R.push(R[0]),R}(v);if(sa(f,S))return k}const Jv=64,LN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function u6(f,c,u,g,v,k,S,L,R,$=!1){const W=u.zoom,Z=u.project(g),X=ve(g.lat,W),re=1/X;A(f),P(f,f,[Z.x+S[0]*re,Z.y+S[1]*re,S[2]]);let ne=1,fe=1;const Ne=u.worldSize;if($){if(u.projection.name==="mercator"){let Ze=0;u.elevation&&(Ze=u.elevation.getAtPointOrZero(new Ve(Z.x/Ne,Z.y/Ne),0));const ht=gt([],[Z.x,Z.y,Ze,1],u.projMatrix)[3]/u.cameraToCenterDistance;ne=ht,fe=ht*ve(u.center.lat,W)}else if(u.projection.name==="globe"){const Ze=d6(f,u),ht=[0,0,0,1];gt(ht,ht,T([],u.projMatrix,Ze));const ot=ht[3]/u.cameraToCenterDistance,_t=t0(W),Ct=u.projection.pixelsPerMeter(g.lat,Ne)*ve(g.lat,W),Et=u.projection.pixelsPerMeter(u.center.lat,Ne)*ve(u.center.lat,W);ne=ot/Fn(Ct,we(u.center.lat),_t),fe=ot*X/Ct,ne*=Et,fe*=Et}}else ne=re;z(f,f,[ne,ne,fe]);const je=[...f],Re=c.orientation,$e=[];if(sve($e,[Re[0]+(v?v[0]:0),Re[1]+(v?v[1]:0),Re[2]+(v?v[2]:0)],k),T(f,je,$e),L&&u.elevation){let Ze=0;const ht=[];if(R&&u.elevation){Ze=function(_t,Ct,Et,Kt,Rt){const rr=Ct.elevation;if(!rr)return 0;const or=ln.projectAabbCorners(Et,Kt),lr=Y(1,Rt.lat)*Ct.worldSize,xr=function(Kr,tn){const gs=[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 qn=Kr[rn.corners[0]],Fs=Kr[rn.corners[1]],$s=Kr[rn.corners[2]],ns=[Fs[0]-qn[0],Fs[1]-qn[1],tn*(Fs[2]-qn[2])],Ba=tt(ns,ns,[$s[0]-qn[0],$s[1]-qn[1],tn*($s[2]-qn[2])]);Fe(Ba,Ba),rn.dotProductWithUp=be(Ba,gs)}return jr.sort((rn,qn)=>rn.dotProductWithUp-qn.dotProductWithUp),jr[0].corners}(or,lr),vr=or[xr[0]],ur=or[xr[1]],pr=or[xr[2]],tr=or[xr[3]],Xt=rr.getAtPointOrZero(new Ve(vr[0]/Ct.worldSize,vr[1]/Ct.worldSize),0),mr=rr.getAtPointOrZero(new Ve(ur[0]/Ct.worldSize,ur[1]/Ct.worldSize),0),Mr=rr.getAtPointOrZero(new Ve(pr[0]/Ct.worldSize,pr[1]/Ct.worldSize),0),wr=rr.getAtPointOrZero(new Ve(tr[0]/Ct.worldSize,tr[1]/Ct.worldSize),0),un=(Xt+wr)/2,Br=(mr+Mr)/2;return un>Br?mr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function sqe(f,c,u){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,XUe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,tqe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,eqe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?QUe:JUe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,nqe.members,!0)),f.segments=Oi.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&Y5(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&Y5(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&Y5(g.normalTexture,c),g.occlusionTexture&&Y5(g.occlusionTexture,c,u),g.emissionTexture&&Y5(g.emissionTexture,c)}function Zie(f,c,u){if(f.meshes)for(const g of f.meshes)sqe(g,c,u);if(f.children)for(const g of f.children)Zie(g,c,u)}function h6(f){if(f.meshes)for(const c of f.meshes)c.indexArray.destroy(),c.vertexArray.destroy(),c.colorArray&&c.colorArray.destroy(),c.normalArray&&c.normalArray.destroy(),c.texcoordArray&&c.texcoordArray.destroy(),c.featureArray&&c.featureArray.destroy();if(f.children)for(const c of f.children)h6(c)}function Yie(f){if(f.meshes)for(const u of f.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&&((c=u.material).pbrMetallicRoughness.baseColorTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),c.pbrMetallicRoughness.metallicRoughnessTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),c.normalTexture&&c.normalTexture.gfxTexture&&c.normalTexture.gfxTexture.destroy(),c.emissionTexture&&c.emissionTexture.gfxTexture&&c.emissionTexture.gfxTexture.destroy(),c.occlusionTexture&&c.occlusionTexture.gfxTexture&&c.occlusionTexture.gfxTexture.destroy()));var c;if(f.children)for(const u of f.children)Yie(u)}function e_(f,c){const u=f.json.bufferViews[c.bufferView],g=i6[c.componentType];return new g(f.buffers[u.buffer],(c.byteOffset||0)+(u.byteOffset||0),c.count*(u.byteStride&&u.byteStride!==K5[c.type]*g.BYTES_PER_ELEMENT?u.byteStride/g.BYTES_PER_ELEMENT:K5[c.type]))}function Xie(f,c,u,g){const v=i6[c.componentType],k=function(W){switch(W){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(v),S=f.json.bufferViews[c.bufferView],L=S.byteStride?S.byteStride/v.BYTES_PER_ELEMENT:K5[c.type],R=u.float32,$=R.length/u.capacity;for(let W=0,Z=0;W0){for(let Ne=0;Ne0){k.texcoordArray=new Nf;const X=c.json.accessors[v.TEXCOORD_0];k.texcoordArray.resize(X.count);const re=e_(c,X);Xie(c,X,k.texcoordArray,re)}if(v._FEATURE_ID_RGBA4444!==void 0){const X=c.json.accessors[v._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(k.featureData=e_(c,X))}v._FEATURE_RGBA4444!==void 0&&(k.featureData=new Uint32Array(e_(c,c.json.accessors[v._FEATURE_RGBA4444]).buffer));const Z=f.material;return k.material=function(X,re){const{emissiveFactor:ne=[0,0,0],alphaMode:fe="OPAQUE",alphaCutoff:Ne=.5,normalTexture:je,occlusionTexture:Re,emissiveTexture:$e,doubleSided:Ze,name:ht}=X,{baseColorFactor:ot=[1,1,1,1],metallicFactor:_t=1,roughnessFactor:Ct=1,baseColorTexture:Et,metallicRoughnessTexture:Kt}=X.pbrMetallicRoughness||{},Rt=Re?re[Re.index]:void 0;if(Re&&Re.extensions&&Re.extensions.KHR_texture_transform&&Rt){const rr=Re.extensions.KHR_texture_transform;Rt.offsetScale=[rr.offset[0],rr.offset[1],rr.scale[0],rr.scale[1]]}return{name:ht,pbrMetallicRoughness:{baseColorFactor:new Sa(...ot),metallicFactor:_t,roughnessFactor:Ct,baseColorTexture:Et?re[Et.index]:void 0,metallicRoughnessTexture:Kt?re[Kt.index]:void 0},doubleSided:Ze,emissiveFactor:new Sa(...ne),alphaMode:fe,alphaCutoff:Ne,normalTexture:je?re[je.index]:void 0,occlusionTexture:Rt,emissionTexture:$e?re[$e.index]:void 0,defined:X.defined===void 0}}(Z!==void 0?c.json.materials[Z]:{defined:!1},u),k}function ive(f,c,u){const{matrix:g,rotation:v,translation:k,scale:S,mesh:L,extras:R,children:$,name:W}=f,Z={};if(Z.name=W,Z.localMatrix=g||function(X,re,ne,fe){var Ne=re[0],je=re[1],Re=re[2],$e=re[3],Ze=Ne+Ne,ht=je+je,ot=Re+Re,_t=Ne*Ze,Ct=Ne*ht,Et=Ne*ot,Kt=je*ht,Rt=je*ot,rr=Re*ot,or=$e*Ze,lr=$e*ht,xr=$e*ot,vr=fe[0],ur=fe[1],pr=fe[2];return X[0]=(1-(Kt+rr))*vr,X[1]=(Ct+xr)*vr,X[2]=(Et-lr)*vr,X[3]=0,X[4]=(Ct-xr)*ur,X[5]=(1-(_t+rr))*ur,X[6]=(Rt+or)*ur,X[7]=0,X[8]=(Et+lr)*pr,X[9]=(Rt-or)*pr,X[10]=(1-(_t+Kt))*pr,X[11]=0,X[12]=ne[0],X[13]=ne[1],X[14]=ne[2],X[15]=1,X}([],v||[0,0,0,1],k||[0,0,0],S||[1,1,1]),Z.globalMatrix=N(Z.localMatrix),L!==void 0){Z.meshes=u[L];const X=Z.anchor=[0,0];for(const re of Z.meshes){const{min:ne,max:fe}=re.aabb;X[0]+=ne[0]+fe[0],X[1]+=ne[1]+fe[1]}X[0]=Math.floor(X[0]/Z.meshes.length/2),X[1]=Math.floor(X[1]/Z.meshes.length/2)}if(R&&(R.id&&(Z.id=R.id),R.lights&&(Z.lights=function(X){if(!X.length)return[];const re=function(Re){const $e=atob(Re),Ze=new Uint8Array($e.length);for(let ht=0;ht<$e.length;ht++)Ze[ht]=$e.codePointAt(ht);return Ze}(X),ne=[],fe=re.length/24,Ne=new Uint16Array(re.buffer),je=new Float32Array(re.buffer);for(let Re=0;Re1&&g[g.length-1].equals(g[0])&&g.pop();let v=0;for(let S=0;S0&&g.reverse();const k=MN(g.flatMap(S=>[S.x,S.y]),[]);return k.length===0?null:{vertices:g,indices:k}}function lqe(f,c){const u=[],g=[];let v=0;const k=[];for(const S of f){v=u.length;const L=S.vertexArray.float32,R=S.indexArray.uint16;for(let $=0;$0&&([g[S+1],g[S+2]]=[g[S+2],g[S+1]])}return{vertices:u,indices:g}}function Qie(f){const c=function(R,$){const W=[],Z=WebGL2RenderingContext;if(R.json.textures)for(const X of R.json.textures){const re={magFilter:Z.LINEAR,minFilter:Z.NEAREST,wrapS:Z.REPEAT,wrapT:Z.REPEAT};X.sampler!==void 0&&Object.assign(re,R.json.samplers[X.sampler]),W.push({image:$[X.source],sampler:re,uploaded:!1})}return W}(f,f.images),u=function(R,$){const W=[];for(const Z of R.json.meshes){const X=[];for(const re of Z.primitives)X.push(aqe(re,R,$));W.push(X)}return W}(f,c),{scenes:g,scene:v,nodes:k}=f.json,S=g?g[v||0].nodes:[...k.keys()],L=[];for(const R of S)L.push(ive(k[R],f,u));return function(R,$,W){const Z={},X=new Set;for(let re=0;re0){const re=Array.from(X.values()).sort((ne,fe)=>ne-fe);for(let ne=re.length-1;ne>=0;ne--)R.splice(re[ne],1)}}(L,S,f.json.nodes),L}function cqe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,u=f.aabb.min[0]-1,g=f.aabb.min[1]-1,v=Jv/(f.aabb.max[0]-u+2),k=Jv/(f.aabb.max[1]-g+2);for(let S=0;Sf.heightmap[$*Jv+R]&&(f.heightmap[$*Jv+R]=L)}}function ove(f,c,u,g,v){u.reserve(u.length+4*f.length),g.reserve(g.length+10*f.length),v.reserve(v.length+10*f.length);let k=g.length;for(const S of f){const L=Math.min(10,Math.max(4,1.3*S.height))*c,R=[-S.normal[1],S.normal[0],0],$=Math.min(.29,.1*S.width/S.depth),W=S.width-2*S.depth*c*($+.01),Z=Le([],S.pos,R,W/2),X=Le([],S.pos,R,-W/2),re=[Z[0],Z[1],Z[2]+S.height],ne=[X[0],X[1],X[2]+S.height],fe=Le([],S.normal,R,$);ge(fe,fe,L);const Ne=Le([],S.normal,R,-$);ge(Ne,Ne,L),ue(fe,Z,fe),ue(Ne,X,Ne),Z[2]+=.1,X[2]+=.1,g.emplaceBack(fe[0],fe[1],fe[2]),g.emplaceBack(Ne[0],Ne[1],Ne[2]),g.emplaceBack(Z[0],Z[1],Z[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(re[0],re[1],re[2]),g.emplaceBack(ne[0],ne[1],ne[2]),g.emplaceBack(Z[0],Z[1],Z[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(fe[0],fe[1],fe[2]),g.emplaceBack(Ne[0],Ne[1],Ne[2]);const je=W/L/2;v.emplaceBack(-je-$,-1,je,.8),v.emplaceBack(je+$,-1,je,.8),v.emplaceBack(-je,0,je,1.3),v.emplaceBack(je,0,je,1.3),v.emplaceBack(je+$,-.8,je,.7),v.emplaceBack(je+$,-.8,je,.7),v.emplaceBack(0,0,je,1.3),v.emplaceBack(0,0,je,1.3),v.emplaceBack(je+$,-1.2,je,.8),v.emplaceBack(je+$,-1.2,je,.8),u.emplaceBack(6+k,4+k,8+k),u.emplaceBack(7+k,9+k,5+k),u.emplaceBack(0+k,1+k,2+k),u.emplaceBack(1+k,3+k,2+k),k+=10}}function dqe(f,c){const u={};u.indexArray=new qo,u.vertexArray=new wu,u.colorArray=new Vm,ove(f,c,u.indexArray,u.vertexArray,u.colorArray);const g={defined:!0};g.emissiveFactor=Sa.black;const v={};return v.baseColorFactor=Sa.white,g.pbrMetallicRoughness=v,u.material=g,u.aabb=new ln([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}const lve=Ts([{name:"a_pos_3f",components:3,type:"Float32"}]),uqe=Ts([{name:"a_normal_3",components:3,type:"Int16"}]),hqe=Ts([{name:"a_centroid_3",components:3,type:"Int16"}]),cve=Ts([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),fqe=Ts([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),pqe=Ts([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),mqe=Ts([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),gqe=Ts([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),xqe=Ts([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),dve=Lt.types,f6=32767;function yqe(f,c){const u=Sr+c;for(const g of f)for(const v of g)if(v.x<-c||v.x>u||v.y<-c||v.y>u)return!1;return!0}function vqe(f){switch(f){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: ${f}`)}}class Jie{constructor(){this.layoutVertexArray=new wu,this.layoutAttenuationArray=new Vm,this.layoutColorArray=new ju,this.indexArray=new qo,this.indexArrayForConflation=new qo,this.segmentsBucket=new Oi}}class eoe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Oi,this.entranceBloom=new Jie;const u=66560;this.layoutVertexArray=new wu,this.layoutVertexArray.reserve(u),this.layoutNormalArray=new Wy,this.layoutNormalArray.reserve(u),this.layoutCentroidArray=new Wy,this.layoutCentroidArray.reserve(u),this.layoutColorArray=new ju,this.layoutColorArray.reserve(u),this.layoutFloodLightDataArray=new Hm,this.layoutFloodLightDataArray.reserve(u),this.layoutAOArray=new gN,this.layoutAOArray.reserve(u),this.indexArray=new qo,this.indexArray.reserve(66560),this.indexArrayForConflation=new qo,this.segmentsBucket=new Oi,this.entranceBloom=new Jie,c&&(this.layoutFacadePaintArray=new ju,this.layoutFacadeDataArray=new ix,this.layoutFacadeVerticalRangeArray=new ju)}reserve(c,u,g){this.layoutVertexArray.reserveForAdditional(c),this.layoutCentroidArray.reserveForAdditional(c),this.layoutFloodLightDataArray.reserveForAdditional(c),this.layoutNormalArray.reserveForAdditional(c),this.layoutAOArray.reserveForAdditional(c),this.layoutColorArray.reserveForAdditional(c),this.indexArray.reserveForAdditional(u),g&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class uve{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Nf,this.footprintsIndices=new Hm,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new eoe(!1),this.buildingWithFacade=new eoe(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=c.zoom,this.canonical=c.canonical,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Dh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.groundEffect=new Die(c),this.groundEffect.groundRadiusArray=new Sp,this.hasAppearances=null}updateFootprints(c,u){const g=new QP([],[],1),v={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};u.push({footprint:v,id:c})}updateAppearances(c,u,g,v){}prepare(){return function(){if(a6!=null||H1e!=null)return null;if(PN!=null)return PN;const c=fetch(Ss.BUILDING_GEN_URL);return PN=function(u){let g,v,k,S,L;function R(){g=new Uint8Array(L.buffer),v=new Int16Array(L.buffer),k=new Int32Array(L.buffer),S=new Float32Array(L.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const W=()=>{},Z={a:{a:$,f:function(X){const re=g.length,ne=Math.max(X>>>0,Math.ceil(1.2*re)),fe=Math.ceil((ne-re)/65536);try{return L.grow(fe),R(),!0}catch{return!1}},g:$,b:W,c:W,d:W,e:W}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,Z):u.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,Z))).then(X=>{const re=X.instance.exports;return(0,re.g)(),L=re.f,R(),new VUe({setStyle:re.h,setAOOptions:re.i,setMetricOptions:re.j,setStructuralOptions:re.k,setFacadeOptions:re.l,setFauxFacadeOptions:re.m,setFacadeClassifierOptions:re.n,addFeature:re.o,addFacade:re.p,generateMesh:re.q,getLastError:re.r,getOuterRingLength:re.s,getMeshCount:re.t,getPositionsPtr:re.u,getPositionsLength:re.v,getNormalsPtr:re.w,getNormalsLength:re.x,getAOPtr:re.y,getAOLength:re.z,getUVPtr:re.A,getUVLength:re.B,getFauxFacadePtr:re.C,getFauxFacadeLength:re.D,getIndicesPtr:re.E,getIndicesLength:re.F,getBuildingPart:re.G,getRingCount:re.H,getRingPtr:re.I,getRingLength:re.J,malloc:re.K,free:re.L,heapU8:g,heap16:v,heap32:k,heapF32:S})})}(c).then(u=>(PN=null,a6=u,a6)).catch(u=>{Ur("Could not load building-gen"),PN=null,H1e=u}),PN}()}populate(c,u,g,v){const k=HUe();if(!k)return;const S=Pe(g);this.tileToMeter=S,this.brightness=u.brightness,k.setStyle({normalScale:[1,-1,S],tileToMeters:S}),k.setAOOptions(!1,.3),k.setMetricOptions(!1,16),k.setStructuralOptions(!0),k.setFacadeClassifierOptions(3);const L=new Map,R=new Map;let $=0;for(const{feature:je}of c){if(dve[je.type]!=="LineString"){L.set(je.id,je.properties.source_id);continue}const Re=this.layers[0]._featureFilter.needGeometry;if(Re&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),je,g))continue;const $e=Dt(je,Re);if(!Re&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),$e,g))continue;const Ze=Re?$e.geometry:St(je,g,v),ht=[];for(const Et of Ze)for(const Kt of Et)ht.push(Kt.x),ht.push(Kt.y);const ot={coordinates:ht,crossPerc:je.properties.cross_perc,distanceToRoad:je.properties.distance_to_road,entrances:je.properties.entrances,sourceId:0},_t=je.properties.source_id;let Ct=R.get(_t);Ct||(Ct=[],R.set(_t,Ct)),Ct.push(ot),++$}this.maxHeight=0;const W=new Array,Z=new Set,X=je=>{je!=null&&Z.add(je)},re=(je,Re)=>{je!=null&&W.push({buildingId:je,footprintIndex:Re})},ne=64*(c.length-$),fe=ne/2;this.buildingWithFacade.reserve(ne,fe,!0),this.buildingWithoutFacade.reserve(2*ne,2*fe,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:je,id:Re,index:$e,sourceLayerIndex:Ze}of c){if(dve[je.type]==="LineString")continue;const ht=this.layers[0]._featureFilter.needGeometry;if(ht&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),je,g))continue;let ot=null;if(je.properties&&je.properties.hasOwnProperty("building_id")&&(ot=je.properties.building_id,Z.has(ot)))continue;const _t=Dt(je,ht);if(!ht&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),_t,g))continue;const Ct=ht?_t.geometry:St(je,g,v),Et=z5(Ct,500);let Kt=!1;for(const In of Et)if(In.length!==1){Kt=!0;break}if(Kt){X(ot);continue}if(!yqe(Ct,163)){X(ot);continue}const Rt=this.layers[0],rr=vqe(Rt.layout.get("building-roof-shape").evaluate(je,{},g)),or=Rt.layout.get("building-base").evaluate(je,{},g),lr=Rt.layout.get("building-height").evaluate(je,{},g),xr=Rt.layout.get("building-flood-light-ground-radius").evaluate(je,{},g),vr=Rt.paint.get("building-ambient-occlusion-intensity"),ur=xr/this.tileToMeter;je.properties["building-part"]="roof";const pr=Rt.paint.get("building-color").evaluate(je,{},this.canonical).toPremultipliedRenderColor(this.lut),tr=Rt.paint.get("building-emissive-strength").evaluate(je,{},this.canonical);je.properties["building-part"]="wall";const Xt=Rt.paint.get("building-color").evaluate(je,{},this.canonical).toPremultipliedRenderColor(this.lut),mr=Rt.paint.get("building-emissive-strength").evaluate(je,{},this.canonical);je.properties["building-part"]="window";const Mr=Rt.paint.get("building-color").evaluate(je,{},this.canonical).toPremultipliedRenderColor(this.lut),wr=Rt.paint.get("building-emissive-strength").evaluate(je,{},this.canonical);je.properties["building-part"]="door";const un=Rt.paint.get("building-color").evaluate(je,{},this.canonical).toPremultipliedRenderColor(this.lut),Br=Rt.paint.get("building-emissive-strength").evaluate(je,{},this.canonical);let Kr=Rt.layout.get("building-flood-light-wall-radius").evaluate(je,{},g);Kr=xe(Kr,0,2048);const tn=Kr/2048*f6,gs=L.get(Re),jr=R.get(gs)||[],rn=jr.length!==0&&Rt.layout.get("building-facade").evaluate(je,{},g);k.setFacadeOptions(4,!0),k.setFauxFacadeOptions(rn,!1,1);let qn=0,Fs=0,$s=0,ns=0,Ba=0,lt=0,pt=0,nr=0,yr=0,Or=0,Dr=0;if(rn){let In=Math.round(Rt.layout.get("building-facade-floors").evaluate(je,{},g));if(or===0){In=Math.max(1,In-(jr.length>0?1:0));let Ta=4;if(lr>100){const yi=[10,13,15];Ta=yi[je.id?je.id%yi.length:0]}else lr<=10&&(Ta=3);k.setFacadeOptions(Ta,!0),Ba=(lr<15?1.3:1.61803)*Ta/S}else Ba=or/S;lt=lr/S,Ba=Math.min(Ba,lt),$s=Rt.layout.get("building-facade-unit-width").evaluate(je,{},g)/S,ns=(lt-Ba)/In,k.setFauxFacadeOptions(!0,!0,$s);const Fi=Rt.layout.get("building-facade-window").evaluate(je,{},g);qn=Fi[0],Fs=Fi[1],pt=Math.floor(65535*Math.min(1,Ba/Sr)),nr=Math.floor(65535*Math.min(1,lt/Sr)),yr=Math.floor(255*qn)<<8|Math.floor(255*Fs),Or=Math.floor(65535*Math.min(1,$s/Sr)),Dr=Math.floor(65535*Math.min(1,ns/Sr))}const hn=Array(Et.length),vn={x:1/0,y:1/0},Jn={x:-1/0,y:-1/0},cs={x:0,y:0};let ms=0;for(let In=0;In0){const Ta=[],yi=Array(Fi.length+1);yi[0]=0;for(let Wo=0;WoSr||vn.y<0||Jn.y>Sr)&&this.featuresOnBorder.push({featureId:je.id,footprintIndex:this.footprints.length});{const In=MN(qa,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+In.length),this.footprintsIndices.uint16.set(In,En),this.buildingIds.add(ot??je.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Qa.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Qa.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ri.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ri.y);const Fi={footprintVertexOffset:Es,footprintVertexLength:this.footprintsVertices.length-Es,footprintIndexOffset:En,footprintIndexLength:this.footprintsIndices.length-En,min:Qa,max:ri,hiddenFlags:0,indicesOffset:_a,indicesLength:Ci,bloomIndicesOffset:Ma,bloomIndicesLength:Ga,groundEffectVertexOffset:oo,groundEffectVertexLength:Ja,hasFauxFacade:rn,height:ds,promoteId:Re,feature:_t,parts:oa,buildingBloom:la},Ta=this.footprints.length;je.id!==void 0&&this.featureFootprintLookup.set(je.id,Ta),re(ot,Ta),this.footprints.push(Fi)}this.programConfigurations.populatePaintArrays(Ln.layoutVertexArray.length,je,$e,{},u.availableImages,g,u.brightness),this.groundEffect.addPaintPropertiesData(je,$e,{},u.availableImages,g,u.brightness),u.featureIndex.insert(je,Ct,$e,Ze,this.index,$a)}W.forEach(({buildingId:je,footprintIndex:Re})=>{Z.has(je)&&(this.footprints[Re].hiddenFlags|=4)});const Ne=new Set;this.buildingIds.forEach((je,Re,$e)=>{Z.has(je)||Ne.add(je)}),this.buildingIds=Ne,this.groundEffect.prepareBorderSegments()}update(c,u,g,v,k,S,L){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,L),this.groundEffect.update(c,u,k,g,v,S,L),this.evaluate(this.layers[0],c),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(c){const u=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,lve.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,uqe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,hqe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,xqe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,pqe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,mqe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,lve.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,gqe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=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()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,u,g=!0){let v=!1;const k=g?u:0,S=0|(g?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const L of c){const R=this.footprints[L],$=R.hiddenFlags&S|k;R.hiddenFlags!==$&&(R.hiddenFlags=$,v=!0,this.groundEffect.updateHiddenByLandmarkRange(R.groundEffectVertexOffset,R.groundEffectVertexLength,R.hiddenFlags!==0))}return v&&(this.indexArrayForConflationUploaded=!1),v}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const u=v=>{v.indexArray.length!==0&&(v.indexArrayForConflation.resize(v.indexArray.length),v.indexArrayForConflation.uint16.set(v.indexArray.uint16),v.entranceBloom.indexArrayForConflation.resize(v.entranceBloom.indexArray.length),v.entranceBloom.indexArrayForConflation.uint16.set(v.entranceBloom.indexArray.uint16))};u(this.buildingWithoutFacade),u(this.buildingWithFacade);for(const v of this.footprints){const k=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,S=v.indicesOffset+v.indicesLength;if(v.hiddenFlags!==0){for(let R=v.indicesOffset;R{v.indexArray.length!==0&&(v.indexBuffer?v.indexBuffer.updateData(v.indexArrayForConflation):v.indexBuffer=c.createIndexBuffer(v.indexArrayForConflation,!0),v.entranceBloom.indexBuffer?v.entranceBloom.indexBuffer.updateData(v.entranceBloom.indexArrayForConflation):v.entranceBloom.indexBuffer=c.createIndexBuffer(v.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const u=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,cve.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,fqe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,cve.members,!0)};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,u){const g=c.paint.get("building-ambient-occlusion-intensity");for(const v of this.footprints){if(4&v.hiddenFlags)continue;const k=u[v.promoteId],S=v.feature;S.properties["building-part"]="roof";const L=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),R=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),W=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="window";const Z=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),X=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),ne=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical),fe=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const je of v.parts){let Re,$e=L;je.part===1?($e=L,Re=R):je.part===0?($e=$,Re=W):je.part===2?($e=Z,Re=X):je.part===3&&($e=re,Re=ne),Re=xe(Re,0,1);for(let Ze=0;ZeS.max.x||R.max.xS.max.y||R.max.yL.max.x||L.min.x>c||u>L.max.y||L.min.y>u||L.height<=g||_qe(S,this.footprintsVertices.float32.subarray(2*L.footprintVertexOffset,2*(L.footprintVertexOffset+L.footprintVertexLength)),this.footprintsIndices.uint16.subarray(L.footprintIndexOffset,L.footprintIndexOffset+L.footprintIndexLength))&&(g=L.height,this.footprintLookup[k]=L,v=L.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.footprintLookup[k]=void 0}}function _qe(f,c,u){for(let g=0;g1&&(R=c[++L]);const W=Math.abs($-R.left),Z=Math.abs($-R.right),X=Math.min(W,Z);let re;const ne=k/g*(v+1);if(R.isDash){const fe=v-Math.abs(ne);re=Math.sqrt(X*X+fe*fe)}else re=v-Math.sqrt(X*X+ne*ne);this.image.data[S+$]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,u){for(let R=c.length-1;R>=0;--R){const $=c[R],W=c[R+1];$.zeroLength?c.splice(R,1):W&&W.isDash===$.isDash&&(W.left=$.left,c.splice(R,1))}const g=c[0],v=c[c.length-1];g.isDash===v.isDash&&(g.left=v.left-this.width,v.right=g.right+this.width);const k=this.width*this.nextRow;let S=0,L=c[S];for(let R=0;R1&&(L=c[++S]);const $=Math.abs(R-L.left),W=Math.abs(R-L.right),Z=Math.min($,W);this.image.data[k+R]=Math.max(0,Math.min(255,(L.isDash?Z:-Z)+u+128))}}addDash(c,u){const g=this.getKey(c,u);if(this.positions[g])return this.positions[g];const v=u==="round",k=v?7:0,S=2*k+1;if(this.nextRow+S>this.height)return Ur("LineAtlas out of space"),null;c.length===0&&c.push(1);let L=0;for(let W=0;Wu.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new cN,this.layoutVertexArray2=new wu,this.patternVertexArray=new wu,this.indexArray=new qo,this.programConfigurations=new Dh(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Oi,this.maxLineLength=0,this.zOffsetVertexArray=new wu,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Sr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Cie("line",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Pe(g);const S=this.layers[0].layout.get("line-elevation-reference");if(S==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),re=X.isConstant()&&!X.constantOr(0);this.elevationType=S!=="sea"&&S!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&S==="none"&&Ur(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const L=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&L!==void 0;const R=[];for(const{feature:X,id:re,index:ne,sourceLayerIndex:fe}of c){const Ne=this.layers[0]._featureFilter.needGeometry,je=Dt(X,Ne);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),je,g))continue;const Re=k?k.evaluate(je,{},g):void 0,$e={id:re,properties:X.properties,type:X.type,sourceLayerIndex:fe,index:ne,geometry:Ne?je.geometry:St(X,g,v),patterns:{},sortKey:Re};R.push($e)}k&&R.sort((X,re)=>X.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:W}=u,Z=this.addConstantDashes($);for(const X of R){const{geometry:re,index:ne,sourceLayerIndex:fe}=X;if(Z&&this.addFeatureDashes(X,$),this.hasPattern){const Ne=Mie("line",this.layers,X,this.zoom,this.pixelRatio,u);this.patternFeatures.push(Ne)}else this.addFeature(X,re,ne,g,$.positions,u.availableImages,u.brightness,u.elevationFeatures);W.insert(c[ne].feature,re,ne,fe,this.index)}}addConstantDashes(c){let u=!1;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,k=g.layout.get("line-cap").value;if(v.kind!=="constant"||k.kind!=="constant")u=!0;else{const S=k.value,L=v.value;if(!L)continue;c.addDash(L,S)}}return u}addFeatureDashes(c,u){const g=this.zoom;for(const v of this.layers){const k=v.paint.get("line-dasharray").value,S=v.layout.get("line-cap").value;if(k.kind==="constant"&&S.kind==="constant")continue;let L,R;if(k.kind==="constant"){if(L=k.value,!L)continue}else L=k.evaluate({zoom:g},c);R=S.kind==="constant"?S.value:S.evaluate({zoom:g},c),u.addDash(L,R),c.patterns[v.id]=[u.getKey(L,R)]}}update(c,u,g,v,k,S,L,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,L,R)}addFeatures(c,u,g,v,k,S){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,u,g,v,S,c.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=c.createVertexBuffer(this.layoutVertexArray2,Sqe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,Mqe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,jqe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,kqe),this.indexBuffer=c.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(c,u){let g,v;if(u&&u>0?(g=`mapbox_clip_start_${u}`,v=`mapbox_clip_end_${u}`):(g="mapbox_clip_start",v="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(g)&&c.properties.hasOwnProperty(v))return{start:+c.properties[g],end:+c.properties[v]}}addFeature(c,u,g,v,k,S,L,R){const $=this.layers[0].layout,W=$.get("line-join").evaluate(c,{}),Z=$.get("line-cap").evaluate(c,{}),X=$.get("line-miter-limit"),re=$.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const ne=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=$.get("line-z-offset").value;const fe=this.layers[0].paint.get("line-width").value;if(fe.kind!=="constant"&&fe.isLineProgressConstant===!1&&(this.variableWidthValue=fe),this.elevationType==="road"){const Ne=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,u,v,R,W,Z,X,re)){const[je,Re]=this.clipRuntimeLinesToTile(u,1);for(let $e=0;$e0?ht.parentIndex:null)}this.fillNonElevatedRoadSegment(Ne)}}else for(let Ne=0;Ne0?Ne:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,k,S,v,L,void 0,this.worldview)}computeSegNextDir(c,u){return c.nextPoint.sub(u.at(-2)).unit()}computeSegPrevDir(c,u){return u[1].sub(c.prevPoint).unit()}clipLinesToTile(c,u){return n6(c,-u,-u,Sr+u,Sr+u)}clipRuntimeLinesToTile(c,u){const g=[];return[n6(c,-u,-u,Sr+u,Sr+u,g),g]}addElevatedRoadFeature(c,u,g,v,k,S,L,R){const $=[],W=ya.getElevationFeature(c,v);if(W){const Z=this.clipLinesToTile(u,1),X=this.prepareElevatedLines(Z,W,g);for(const re of X)$.push({geometry:re,elevation:W,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if($.length===0)return!1;for(const Z of $){const X=this.layoutVertexArray.length;this.addLine(Z.geometry,c,g,k,S,L,R);const re=new Ra(g,Z.elevationTileID);if(Z.elevation)for(let ne=X;ne>1,this.layoutVertexArray.int16[6*ne+1]>>1),Ne=re.pointElevation(fe,Z.elevation,.05);this.updateHeightRange(Ne),this.zOffsetVertexArray.emplaceBack(Ne,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(c,u,g){if(u.constantHeight!=null)return c;const v=[],k=1/Pe(g);for(const S of c)$Ue(S,new ia(u,k),0,v);return v}fillNonElevatedRoadSegment(c){for(let u=c;u0,X=R&&R.progress.max<1;if(this.lineClips){let Et={min:this.lineClips.start,max:this.lineClips.end},Kt=1;if(R){const or=this.lineClips.end-this.lineClips.start;Et=function(lr,xr,vr){return{min:za(lr.min,xr,vr),max:za(lr.max,xr,vr)}}(R.progress,{min:0,max:1},Et),or>0&&(Kt=(Et.max-Et.min)/or)}const Rt=+u.properties.mapbox_clip_feature_len,rr=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(Rt)||Number.isNaN(rr)){for(let lr=0;lr=2&&c[ne-1].equals(c[ne-2]);)ne--;let fe=0;for(;fe0,tr=this.overscaling<=16?15*Sr/(512*this.overscaling):0;if(Kt&&Rt==="round"){if(xrS&&(Rt="bevel"),Rt==="bevel"&&(xr>2&&(Rt="flipbevel"),xr2*tr){const Mr=je.sub(je.sub(Re)._mult(tr/Xt)._round());this.updateDistance(Re,Mr),this.addCurrentVertex(Mr,Ze,0,0,Ne,Ct),Re=Mr}this.updateDistance(Re,je),or._mult(xr),this.addCurrentVertex(je,or,0,0,Ne,Ct);const mr=je.dist($e);if(mr>2*tr){const Mr=je.add($e.sub(je)._mult(tr/mr)._round());this.updateDistance(je,Mr),this.addCurrentVertex(Mr,ht,0,0,Ne,Ct),je=Mr}}else or._mult(xr),this.addCurrentVertex(je,or,0,0,Ne,Ct);else if(Rt==="flipbevel"){if(xr>100)or=ht.mult(-1);else{const Xt=xr*Ze.add(ht).mag()/Ze.sub(ht).mag();or._perp()._mult(Xt*(pr?-1:1))}this.addCurrentVertex(je,or,0,0,Ne,Ct),this.addCurrentVertex(je,or.mult(-1),0,0,Ne,Ct)}else if(Rt==="bevel"||Rt==="fakeround"){Ct!=null&&Re&&this.addCurrentVertex(je,_t||Ze,-1,-1,Ne,Ct);const Xt=je.dist(Re)<=2*tr&&Rt!=="bevel",mr=or.mult(pr?1:-1);mr._mult(xr);const Mr=ht.mult(pr?-1:1),wr=Ze.mult(pr?-1:1),un=this.evaluateLineProgressFeatures(this.distance);if(Ct==null&&(this.addHalfVertex(je,mr.x,mr.y,!1,!pr,0,Ne,un),Xt||this.addHalfVertex(je,mr.x+2*wr.x,mr.y+2*wr.y,!1,pr,0,Ne,un)),Rt==="fakeround"){const Br=Math.round(180*vr/Math.PI/20);this.addHalfVertex(je,wr.x,wr.y,!1,pr,0,Ne,un);for(let Kr=0;Kr1){this.lineSoFar=c.w;const fe=(u.x-c.x)/Z,Ne=(u.y-c.y)/Z,je=(u.z-c.z)/Z,Re=(u.w-c.w)/Z;for(let $e=1;$e=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,W),R.primitiveLength++),S?this.e2=W:this.e1=W,$!=null&&this.zOffsetVertexArray.emplaceBack($.zOffset,$.variableWidth,$.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(c,u){this.prevDistance=this.distance,this.distance+=c.dist(u),this.updateScaledDistance()}}function roe(f,c,u){return f.xu||f.yu}let mve,gve;function xve(f,c,u){return c*(Sr/(f.tileSize*Math.pow(2,u-f.tileID.overscaledZ)))}Yr(toe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const yve=(f,c,u)=>(1-u)*f+u*c;function vve(f,c){return 1/xve(f,1,c.tileZoom)}function _ve(f,c,u,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const bve=f=>{const c=[];wve(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const u=f.paint.get("line-trim-offset");u[0]===0&&u[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),f.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const g=f.layout.get("line-join").constantOr("miter")==="none",v=!!f.paint.get("line-pattern").constantOr(1);return g&&v&&c.push("LINE_JOIN_NONE"),c};function wve(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let noe;const jve=()=>noe||(noe={layout:mve||(mve=new Wi({"line-cap":new Er(Ft.layout_line["line-cap"]),"line-join":new Er(Ft.layout_line["line-join"]),"line-miter-limit":new kr(Ft.layout_line["line-miter-limit"]),"line-round-limit":new kr(Ft.layout_line["line-round-limit"]),"line-sort-key":new Er(Ft.layout_line["line-sort-key"]),"line-z-offset":new Er(Ft.layout_line["line-z-offset"]),"line-elevation-reference":new kr(Ft.layout_line["line-elevation-reference"]),"line-cross-slope":new kr(Ft.layout_line["line-cross-slope"]),visibility:new kr(Ft.layout_line.visibility),"line-width-unit":new kr(Ft.layout_line["line-width-unit"])})),paint:gve||(gve=new Wi({"line-opacity":new Er(Ft.paint_line["line-opacity"]),"line-color":new Er(Ft.paint_line["line-color"]),"line-translate":new kr(Ft.paint_line["line-translate"]),"line-translate-anchor":new kr(Ft.paint_line["line-translate-anchor"]),"line-width":new Er(Ft.paint_line["line-width"]),"line-gap-width":new Er(Ft.paint_line["line-gap-width"]),"line-offset":new Er(Ft.paint_line["line-offset"]),"line-blur":new Er(Ft.paint_line["line-blur"]),"line-dasharray":new Er(Ft.paint_line["line-dasharray"]),"line-pattern":new Er(Ft.paint_line["line-pattern"]),"line-pattern-cross-fade":new kr(Ft.paint_line["line-pattern-cross-fade"]),"line-gradient":new nx(Ft.paint_line["line-gradient"]),"line-trim-offset":new kr(Ft.paint_line["line-trim-offset"]),"line-trim-fade-range":new kr(Ft.paint_line["line-trim-fade-range"]),"line-trim-color":new kr(Ft.paint_line["line-trim-color"]),"line-emissive-strength":new Er(Ft.paint_line["line-emissive-strength"]),"line-border-width":new Er(Ft.paint_line["line-border-width"]),"line-border-color":new Er(Ft.paint_line["line-border-color"]),"line-occlusion-opacity":new kr(Ft.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"})}))},noe);class Iqe extends Er{possiblyEvaluate(c,u){return u=new ti(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(c,u)}evaluate(c,u,g,v){return u=Object.assign({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(c,u,g,v)}}let X5;function kve(f,c){return c>0?c+2*f:f}const Pqe=Ts([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Lqe=Ts([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Oqe=Ts([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ts([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Dqe=Ts([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Rqe=Ts([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Fqe=Ts([{name:"a_texb",components:2,type:"Uint16"}]),zqe=Ts([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Bqe=Ts([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Ts([{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 Nve=Ts([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),$qe=Ts([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ts([{name:"triangle",components:3,type:"Uint16"}]),Ts([{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"}]),Ts([{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"}]),Ts([{type:"Float32",name:"offsetX"}]),Ts([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var vl=24;function Uqe(f,c,u){return f.sections.forEach(g=>{g.text=function(v,k,S){const L=k.layout.get("text-transform").evaluate(S,{});return L==="uppercase"?v=v.toLocaleUpperCase():L==="lowercase"&&(v=v.toLocaleLowerCase()),Np.applyArabicShaping&&(v=Np.applyArabicShaping(v)),v}(g.text,c,u)}),f}const Q5={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function qqe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function Vqe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const soe=4294967296,Sve=1/soe,Cve=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let p6=class{constructor(f=new Uint8Array(16)){this.buf=ArrayBuffer.isView(f)?f:new Uint8Array(f),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(f,c,u=this.length){for(;this.pos>3,k=this.pos;this.type=7&g,f(v,c,this),this.pos===k&&this.skip(g)}return c}readMessage(f,c){return this.readFields(f,c,this.readVarint()+this.pos)}readFixed32(){const f=this.dataView.getUint32(this.pos,!0);return this.pos+=4,f}readSFixed32(){const f=this.dataView.getInt32(this.pos,!0);return this.pos+=4,f}readFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*soe;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*soe;return this.pos+=8,f}readFloat(){const f=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,f}readDouble(){const f=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,f}readVarint(f){const c=this.buf;let u,g;return g=c[this.pos++],u=127&g,g<128?u:(g=c[this.pos++],u|=(127&g)<<7,g<128?u:(g=c[this.pos++],u|=(127&g)<<14,g<128?u:(g=c[this.pos++],u|=(127&g)<<21,g<128?u:(g=c[this.pos],u|=(15&g)<<28,function(v,k,S){const L=S.buf;let R,$;if($=L[S.pos++],R=(112&$)>>4,$<128||($=L[S.pos++],R|=(127&$)<<3,$<128)||($=L[S.pos++],R|=(127&$)<<10,$<128)||($=L[S.pos++],R|=(127&$)<<17,$<128)||($=L[S.pos++],R|=(127&$)<<24,$<128)||($=L[S.pos++],R|=(1&$)<<31,$<128))return ON(v,R,k);throw new Error("Expected varint not more than 10 bytes")}(u,f,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const f=this.readVarint();return f%2==1?(f+1)/-2:f/2}readBoolean(){return!!this.readVarint()}readString(){const f=this.readVarint()+this.pos,c=this.pos;return this.pos=f,f-c>=12&&Cve?Cve.decode(this.buf.subarray(c,f)):function(u,g,v){let k="",S=g;for(;S239?4:L>223?3:L>191?2:1;if(S+X>v)break;X===1?L<128&&(Z=L):X===2?(R=u[S+1],(192&R)==128&&(Z=(31&L)<<6|63&R,Z<=127&&(Z=null))):X===3?(R=u[S+1],$=u[S+2],(192&R)==128&&(192&$)==128&&(Z=(15&L)<<12|(63&R)<<6|63&$,(Z<=2047||Z>=55296&&Z<=57343)&&(Z=null))):X===4&&(R=u[S+1],$=u[S+2],W=u[S+3],(192&R)==128&&(192&$)==128&&(192&W)==128&&(Z=(15&L)<<18|(63&R)<<12|(63&$)<<6|63&W,(Z<=65535||Z>=1114112)&&(Z=null))),Z===null?(Z=65533,X=1):Z>65535&&(Z-=65536,k+=String.fromCharCode(Z>>>10&1023|55296),Z=56320|1023&Z),k+=String.fromCharCode(Z),S+=X}return k}(this.buf,c,f)}readBytes(){const f=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,f);return this.pos=f,c}readPackedVarint(f=[],c){const u=this.readPackedEnd();for(;this.pos127;);else if(c===2)this.pos=this.readVarint()+this.pos;else if(c===5)this.pos+=4;else{if(c!==1)throw new Error(`Unimplemented type: ${c}`);this.pos+=8}}writeTag(f,c){this.writeVarint(f<<3|c)}realloc(f){let c=this.length||16;for(;c268435455||f<0?function(c,u){let g,v;if(c>=0?(g=c%4294967296|0,v=c/4294967296|0):(g=~(-c%4294967296),v=~(-c/4294967296),4294967295^g?g=g+1|0:(g=0,v=v+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),function(k,S,L){L.buf[L.pos++]=127&k|128,k>>>=7,L.buf[L.pos++]=127&k|128,k>>>=7,L.buf[L.pos++]=127&k|128,k>>>=7,L.buf[L.pos++]=127&k|128,L.buf[L.pos]=127&(k>>>=7)}(g,0,u),function(k,S){const L=(7&k)<<4;S.buf[S.pos++]|=L|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(v,u)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))}writeSVarint(f){this.writeVarint(f<0?2*-f-1:2*f)}writeBoolean(f){this.writeVarint(+f)}writeString(f){f=String(f),this.realloc(4*f.length),this.pos++;const c=this.pos;this.pos=function(g,v,k){for(let S,L,R=0;R55295&&S<57344){if(!L){S>56319||R+1===v.length?(g[k++]=239,g[k++]=191,g[k++]=189):L=S;continue}if(S<56320){g[k++]=239,g[k++]=191,g[k++]=189,L=S;continue}S=L-55296<<10|S-56320|65536,L=null}else L&&(g[k++]=239,g[k++]=191,g[k++]=189,L=null);S<128?g[k++]=S:(S<2048?g[k++]=S>>6|192:(S<65536?g[k++]=S>>12|224:(g[k++]=S>>18|240,g[k++]=S>>12&63|128),g[k++]=S>>6&63|128),g[k++]=63&S|128)}return k}(this.buf,f,this.pos);const u=this.pos-c;u>=128&&Mve(c,u,this),this.pos=c-1,this.writeVarint(u),this.pos+=u}writeFloat(f){this.realloc(4),this.dataView.setFloat32(this.pos,f,!0),this.pos+=4}writeDouble(f){this.realloc(8),this.dataView.setFloat64(this.pos,f,!0),this.pos+=8}writeBytes(f){const c=f.length;this.writeVarint(c),this.realloc(c);for(let u=0;u=128&&Mve(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,u){this.writeTag(f,2),this.writeRawMessage(c,u)}writePackedVarint(f,c){c.length&&this.writeMessage(f,Hqe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,Wqe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,Zqe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,Gqe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,Kqe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,Yqe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,Xqe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,Qqe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,Jqe,c)}writeBytesField(f,c){this.writeTag(f,2),this.writeBytes(c)}writeFixed32Field(f,c){this.writeTag(f,5),this.writeFixed32(c)}writeSFixed32Field(f,c){this.writeTag(f,5),this.writeSFixed32(c)}writeFixed64Field(f,c){this.writeTag(f,1),this.writeFixed64(c)}writeSFixed64Field(f,c){this.writeTag(f,1),this.writeSFixed64(c)}writeVarintField(f,c){this.writeTag(f,0),this.writeVarint(c)}writeSVarintField(f,c){this.writeTag(f,0),this.writeSVarint(c)}writeStringField(f,c){this.writeTag(f,2),this.writeString(c)}writeFloatField(f,c){this.writeTag(f,5),this.writeFloat(c)}writeDoubleField(f,c){this.writeTag(f,1),this.writeDouble(c)}writeBooleanField(f,c){this.writeVarintField(f,+c)}};function ON(f,c,u){return u?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function Mve(f,c,u){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));u.realloc(g);for(let v=u.pos-1;v>=f;v--)u.buf[v+g]=u.buf[v]}function Hqe(f,c){for(let u=0;u=0&&g>=c&&m6[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(c,u),this.sectionIndex=this.sectionIndex.slice(c,u)}substring(c,u){const g=new DN;return g.text=this.text.substring(c,u),g.sectionIndex=this.sectionIndex.slice(c,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,u)=>Math.max(c,this.sections[u].scale),0)}addTextSection(c,u){this.text+=c.text,this.sections.push(J5.forText(c.scale,c.fontStack||u));const g=this.sections.length-1;for(let v=0;v=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ioe(f,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe=1){const Ne=DN.fromFeature(f,v,fe);Z===Su.vertical&&Ne.verticalizePunctuation(X);let je=[];const Re=function(_t,Ct,Et,Kt,Rt,rr){if(!_t)return[];const or=[],lr=function(pr,tr,Xt,mr,Mr,wr){let un=0;for(let Br=0;Br=0;let vr=0;for(let pr=0;pr<_t.length();pr++){const tr=_t.getSection(pr),Xt=_t.getCodePoint(pr);if(m6[Xt]||(vr+=Ave(Xt,tr,Kt,Rt,Ct,rr)),pr<_t.length()-1){const mr=!((ur=Xt)<11904||!(An["Bopomofo Extended"](ur)||An.Bopomofo(ur)||An["CJK Compatibility Forms"](ur)||An["CJK Compatibility Ideographs"](ur)||An["CJK Compatibility"](ur)||An["CJK Radicals Supplement"](ur)||An["CJK Strokes"](ur)||An["CJK Symbols and Punctuation"](ur)||An["CJK Unified Ideographs Extension A"](ur)||An["CJK Unified Ideographs"](ur)||An["Enclosed CJK Letters and Months"](ur)||An["Halfwidth and Fullwidth Forms"](ur)||An.Hiragana(ur)||An["Ideographic Description Characters"](ur)||An["Kangxi Radicals"](ur)||An["Katakana Phonetic Extensions"](ur)||An.Katakana(ur)||An["Vertical Forms"](ur)||An["Yi Radicals"](ur)||An["Yi Syllables"](ur)));(nVe[Xt]||mr||tr.image)&&or.push(Ive(pr+1,vr,lr,or,sVe(Xt,_t.getCodePoint(pr+1),mr&&xr),!1))}}var ur;return Pve(Ive(_t.length(),vr,lr,or,0,!0))}(Ne,$,k,c,g,re),{processBidirectionalText:$e,processStyledBidirectionalText:Ze}=Np;if($e&&Ne.sections.length===1){const _t=$e(Ne.toString(),Re);for(const Ct of _t){const Et=new DN;Et.text=Ct,Et.sections=Ne.sections;for(let Kt=0;Kt0&&la>ns&&(ns=la)}else{const na=Et[yr.fontStack];if(!na)continue;na[Dr]&&(Jn=na[Dr]);const oa=Ct[yr.fontStack];if(!oa)continue;const la=oa.glyphs[Dr];if(!la)continue;if(vn=la.metrics,ms=Dr!==8203?vl:0,wr){const Ma=oa.ascender!==void 0?Math.abs(oa.ascender):0,Ga=oa.descender!==void 0?Math.abs(oa.descender):0,$a=(Ma+Ga)*hn;Ba<$a&&(Ba=$a,lt=(Ma-Ga)/2*hn),As=-Ma*hn}else As=(rn-hn)*vl-17}Un?(_t.verticalizable=!0,$s.push({glyph:Dr,image:cs,x:tr,y:Xt+As,vertical:Un,scale:hn,localGlyph:vn.localGlyph,fontStack:yr.fontStack,sectionIndex:Or,metrics:vn,rect:Jn}),tr+=ms*hn+vr):($s.push({glyph:Dr,image:cs,x:tr,y:Xt+As,vertical:Un,scale:hn,localGlyph:vn.localGlyph,fontStack:yr.fontStack,sectionIndex:Or,metrics:vn,rect:Jn}),tr+=vn.advance*hn+vr)}$s.length!==0&&(mr=Math.max(tr-vr,mr),wr?Lve($s,Mr,ns,lt,rr*rn/2):Lve($s,Mr,ns,0,rr/2)),tr=0;const pt=rr*rn+ns;Fs.lineOffset=Math.max(ns,qn),Xt+=pt,++un}var Br;const Kr=Xt,{horizontalAlign:tn,verticalAlign:gs}=ooe(or);(function(jr,rn,qn,Fs,$s,ns){const Ba=(rn-qn)*$s,lt=-ns*Fs;for(const pt of jr)for(const nr of pt.positionedGlyphs)nr.x+=Ba,nr.y+=lt})(_t.positionedLines,Mr,tn,gs,mr,Kr),_t.top+=-gs*Kr,_t.bottom=_t.top+Kr,_t.left+=-tn*mr,_t.right=_t.left+mr,_t.hasBaseline=wr}(ot,c,u,g,je,S,L,R,Z,$,X,ne),!function(_t){for(const Ct of _t)if(Ct.positionedGlyphs.length!==0)return!1;return!0}(ht))return ot}const m6={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},nVe={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Ave(f,c,u,g,v,k){if(c.image){const S=g.get(c.image.toString());return S?S.displaySize[0]*c.scale*vl/k+v:0}{const S=u[c.fontStack],L=S&&S.glyphs[f];return L?L.metrics.advance*c.scale+v:0}}function Eve(f,c,u,g){const v=Math.pow(f-c,2);return g?f-u/2;){if(S--,S<0)return!1;L-=f[S].dist(k),k=f[S]}L+=f[S].dist(f[S+1]),S++;const R=[];let $=0;for(;Lg;)$-=R.shift().angleDelta;if($>v)return!1;S++,L+=W.dist(Z)}return!0}function zve(f){let c=0;for(let u=0;u$){const ne=($-R)/re,fe=Fn(Z.x,X.x,ne),Ne=Fn(Z.y,X.y,ne),je=new ux(fe,Ne,0,X.angleTo(Z),W);return!S||Fve(f,je,L,S,c)?je:void 0}R+=re}}function iVe(f,c,u,g,v,k,S,L,R){const $=Bve(g,k,S),W=$ve(g,v),Z=W*S,X=f[0].x===0||f[0].x===R||f[0].y===0||f[0].y===R;return c-Z=0&&Ze=0&&ht=0&&X+$<=W){const ot=new ux(Ze,ht,0,Re,ne);g&&!Fve(f,ot,k,g,v)||re.push(ot)}}Z+=je}return L||re.length||S||(re=Uve(f,Z/2,u,g,v,k,S,!0,R)),re}function qve(f){let c=0,u=0;for(const S of f)c+=S.w*S.h,u=Math.max(u,S.w);f.sort((S,L)=>L.h-S.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),u),h:1/0}];let v=0,k=0;for(const S of f)for(let L=g.length-1;L>=0;L--){const R=g[L];if(!(S.w>R.w||S.h>R.h)){if(S.x=R.x,S.y=R.y,k=Math.max(k,S.y+S.h),v=Math.max(v,S.x+S.w),S.w===R.w&&S.h===R.h){const $=g.pop();$&&L1?ne-1:ne,jc.copy(Z.data,$,{x:0,y:0},{x:fe,y:Ne},Z.data,g),jc.copy(Z.data,$,{x:0,y:Re-ne},{x:fe,y:Ne-ne},{width:je,height:ne},g),jc.copy(Z.data,$,{x:0,y:0},{x:fe,y:Ne+Re},{width:je,height:ne},g),jc.copy(Z.data,$,{x:je-ne,y:0},{x:fe-ne,y:Ne},{width:ne,height:Re},g),jc.copy(Z.data,$,{x:0,y:0},{x:fe+je,y:Ne},{width:ne,height:Re},g),jc.copy(Z.data,$,{x:je-ne,y:Re-ne},{x:fe-ne,y:Ne-ne},{width:ne,height:ne},g),jc.copy(Z.data,$,{x:0,y:Re-ne},{x:fe+je,y:Ne-ne},{width:ne,height:ne},g),jc.copy(Z.data,$,{x:0,y:0},{x:fe+je,y:Ne+Re},{width:ne,height:ne},g),jc.copy(Z.data,$,{x:je-ne,y:0},{x:fe-ne,y:Ne+Re},{width:ne,height:ne},g)}this.lut=g,this.image=$,this.iconPositions=v,this.patternPositions=k}addImages(c,u,g,v){for(const[k,S]of c.entries()){const{bin:L,imagePosition:R,imageVariant:$}=uoe(k,S,g);u.set(k,R),v.push(L),S.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,u,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(v=>c.hasImage(v,g)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const v of c.getUpdatedImages(g)){for(const k of this.iconPositions.keys()){const S=yp.parse(k);if(xl.isEqual(S.id,v)){const L=c.getImage(v,g);this.patchUpdatedImage(this.iconPositions.get(k),L,u,null)}}for(const k of this.patternPositions.keys()){const S=yp.parse(k);if(xl.isEqual(S.id,v)){const L=c.getImage(v,g);this.patchUpdatedImage(this.patternPositions.get(k),L,u,this.lut)}}}}patchUpdatedImage(c,u,g,v=null){if(!c||!u||c.version===u.version)return;c.version=u.version;const[k,S]=c.tl,L=c.sdf;if(this.lut||L){const R={width:u.data.width,height:u.data.height},$=new jc(R);jc.copy(u.data,$,{x:0,y:0},{x:0,y:0},R,v,L),g.update($,{position:{x:k,y:S}})}else g.update(u.data,{position:{x:k,y:S}})}}Yr(eM,"ImagePosition"),Yr(Vve,"ImageAtlas");const tM=1e20;function Hve(f,c,u,g,v,k,S,L,R){for(let $=c;$-1);R++,k[R]=L,S[R]=$,S[R+1]=tM}for(let L=0,R=0;L{let R=this.entries[k];R||(R=this.entries[k]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=R.glyphs[S];if($!==void 0)return void L(null,{stack:k,id:S,glyph:$});if($=this._tinySDF(R,k,S),$)return R.glyphs[S]=$,void L(null,{stack:k,id:S,glyph:$});const W=Math.floor(S/256);if(256*W>65535)return Ur("glyphs > 65535 not supported"),void L(null,{stack:k,id:S,glyph:$});if(R.ranges[W])return void L(null,{stack:k,id:S,glyph:$});let Z=R.requests[W];Z||(Z=R.requests[W]=[],zN.loadGlyphRange(k,W,v,this.requestManager,(X,re)=>{if(re){R.ascender=re.ascender,R.descender=re.descender;for(const ne in re.glyphs)this._doesCharSupportLocalGlyph(+ne)||(R.glyphs[+ne]=re.glyphs[+ne]);R.ranges[W]=!0}for(const ne of Z)ne(X,re);delete R.requests[W]})),Z.push((X,re)=>{X?L(X):re&&L(null,{stack:k,id:S,glyph:re.glyphs[S]||null})})},(k,S)=>{if(k)u(k);else if(S){const L={};for(const{stack:R,id:$,glyph:W}of S)L[R]===void 0&&(L[R]={}),L[R].glyphs===void 0&&(L[R].glyphs={}),L[R].glyphs[$]=W&&{id:W.id,bitmap:W.bitmap.clone(),metrics:W.metrics},L[R].ascender=this.entries[R].ascender,L[R].descender=this.entries[R].descender;u(null,L)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==hoe.none&&(this.localGlyphMode===hoe.all?!!this.localFontFamily:!!this.localFontFamily&&(An["CJK Unified Ideographs"](c)||An["Hangul Syllables"](c)||An.Hiragana(c)||An.Katakana(c)||An["CJK Symbols and Punctuation"](c)||An["CJK Unified Ideographs Extension A"](c)||An["CJK Unified Ideographs Extension B"](c)||An.Osage(c)))}_tinySDF(c,u,g){const v=this.localFontFamily;if(!v||!this._doesCharSupportLocalGlyph(g))return;let k=c.tinySDF;if(!k){let fe="400";/bold/i.test(u)?fe="900":/medium/i.test(u)?fe="500":/light/i.test(u)&&(fe="200"),k=c.tinySDF=new zN.TinySDF({fontFamily:v,fontWeight:fe,fontSize:24*Dp,buffer:3*Dp,radius:8*Dp}),k.fontWeight=fe}if(this.localGlyphs[k.fontWeight][g])return this.localGlyphs[k.fontWeight][g];const S=String.fromCodePoint(g),{data:L,width:R,height:$,glyphWidth:W,glyphHeight:Z,glyphLeft:X,glyphTop:re,glyphAdvance:ne}=k.draw(S);return this.localGlyphs[k.fontWeight][g]={id:g,bitmap:new r0({width:R,height:$},L),metrics:{width:W/Dp,height:Z/Dp,left:X/Dp,top:re/Dp-27,advance:ne/Dp,localGlyph:!0}}}}zN.loadGlyphRange=function(f,c,u,g,v){const k=256*c,S=k+255,L=g.transformRequest(g.normalizeGlyphsURL(u).replace("{fontstack}",f).replace("{range}",`${k}-${S}`),Hg.Glyphs);Th(L,(R,$)=>{if(R)v(R);else if($){const W={},Z=function(X){return new p6(X).readFields(eVe,{})}($);for(const X of Z.glyphs)W[X.id]=X;v(null,{glyphs:W,ascender:Z.ascender,descender:Z.descender})}})},zN.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:u=8,cutoff:g=.25,fontFamily:v="sans-serif",fontWeight:k="normal",fontStyle:S="normal",lang:L=null}={}){this.buffer=c,this.cutoff=g,this.radius=u,this.lang=L;const R=this.size=f+4*c,$=this._createCanvas(R),W=this.ctx=$.getContext("2d",{willReadFrequently:!0});W.font=`${S} ${k} ${f}px ${v}`,W.textBaseline="alphabetic",W.textAlign="left",W.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(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:u,actualBoundingBoxDescent:g,actualBoundingBoxLeft:v,actualBoundingBoxRight:k}=this.ctx.measureText(f),S=Math.ceil(u),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(k-v))),R=Math.min(this.size-this.buffer,S+Math.ceil(g)),$=L+2*this.buffer,W=R+2*this.buffer,Z=Math.max($*W,0),X=new Uint8ClampedArray(Z),re={data:X,width:$,height:W,glyphWidth:L,glyphHeight:R,glyphTop:S,glyphLeft:0,glyphAdvance:c};if(L===0||R===0)return re;const{ctx:ne,buffer:fe,gridInner:Ne,gridOuter:je}=this;this.lang&&(ne.lang=this.lang),ne.clearRect(fe,fe,L,R),ne.fillText(f,fe,fe+S);const Re=ne.getImageData(fe,fe,L,R);je.fill(tM,0,Z),Ne.fill(0,0,Z);for(let $e=0;$e0?_t*_t:0,Ne[ot]=_t<0?_t*_t:0}}Hve(je,0,0,$,W,$,this.f,this.v,this.z),Hve(Ne,fe,fe,L,R,$,this.f,this.v,this.z);for(let $e=0;$e{const xr=y6(Rt.stretch-Re,$e,W,f.left*v),vr=v6(Rt.fixed-ot,_t,Rt.stretch,ne),ur=y6(rr.stretch-Ze,ht,Z,f.top*v),pr=v6(rr.fixed-Ct,Et,rr.stretch,fe),tr=y6(or.stretch-Re,$e,W,f.left*v),Xt=v6(or.fixed-ot,_t,or.stretch,ne),mr=y6(lr.stretch-Ze,ht,Z,f.top*v),Mr=v6(lr.fixed-Ct,Et,lr.stretch,fe),wr=new ir(xr,ur),un=new ir(tr,ur),Br=new ir(tr,mr),Kr=new ir(xr,mr),tn=new ir(vr/L,pr/L),gs=new ir(Xt/L,Mr/L),jr=c*Math.PI/180;if(jr){const Ba=Math.sin(jr),lt=Math.cos(jr),pt=[lt,-Ba,Ba,lt];wr._matMult(pt),un._matMult(pt),Kr._matMult(pt),Br._matMult(pt)}const rn=Rt.stretch+Rt.fixed,qn=or.stretch+or.fixed,Fs=rr.stretch+rr.fixed,$s=lr.stretch+lr.fixed,ns=f.imageSecondary;return{tl:wr,tr:un,bl:Kr,br:Br,texPrimary:{x:S.paddedRect.x+Zm+rn,y:S.paddedRect.y+Zm+Fs,w:qn-rn,h:$s-Fs},texSecondary:ns?{x:ns.paddedRect.x+Zm+rn,y:ns.paddedRect.y+Zm+Fs,w:qn-rn,h:$s-Fs}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:tn,pixelOffsetBR:gs,minFontScaleX:_t/L/W,minFontScaleY:Et/L/Z,isSDF:u}};if(g&&(S.stretchX||S.stretchY)){const Rt=Kve(X,Ne,ne),rr=Kve(re,je,fe);for(let or=0;ork)&&(k=ne.x),(!re||ne.y>S)&&(S=ne.y)}const R=Math.min(k-g,S-v);let $=R/2;const W=new Tk([],dVe);if(R===0)return new ir(g,v);for(let re=g;reZ.d||!Z.d)&&(Z=re,u&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,X)),re.max-Z.d<=c||($=re.h/2,W.push(new BN(re.p.x-$,re.p.y-$,$,f)),W.push(new BN(re.p.x+$,re.p.y-$,$,f)),W.push(new BN(re.p.x-$,re.p.y+$,$,f)),W.push(new BN(re.p.x+$,re.p.y+$,$,f)),X+=4)}return u&&(console.log(`num probes: ${X}`),console.log(`best distance: ${Z.d}`)),Z.p}function dVe(f,c){return c.max-f.max}class BN{constructor(c,u,g,v){this.p=new ir(c,u),this.h=g,this.d=function(k,S){let L=!1,R=1/0;for(let $=0;$k.y!=fe.y>k.y&&k.x<(fe.x-ne.x)*(k.y-ne.y)/(fe.y-ne.y)+ne.x&&(L=!L),R=Math.min(R,eo(k,ne,fe))}}return(L?1:-1)*Math.sqrt(R)}(this.p,v),this.max=this.d+this.h*Math.SQRT2}}const uVe=Object.keys,poe=Number.POSITIVE_INFINITY,hVe=Math.sqrt(2);function s0(f,c,u,g,v){const k=loe(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],S={top:f.top-k[1],bottom:f.bottom+k[3],left:f.left-k[0],right:f.right+k[2],scaled:!1};return g!==void 0&&function(L,R){L.top*=R,L.bottom*=R,L.left*=R,L.right*=R,L.scaled=!0}(S,g),u&&function(L,R){if(!R)return;const $=ss(R),W=new ir(L.left,L.top),Z=new ir(L.right,L.top),X=new ir(L.left,L.bottom),re=new ir(L.right,L.bottom),ne=new ir(0,0);W._rotateAround($,ne),Z._rotateAround($,ne),X._rotateAround($,ne),re._rotateAround($,ne),L.left=Math.min(W.x,Z.x,X.x,re.x),L.right=Math.max(W.x,Z.x,X.x,re.x),L.top=Math.min(W.y,Z.y,X.y,re.y),L.bottom=Math.max(W.y,Z.y,X.y,re.y)}(S,u),v&&(S.left+=v[0],S.right+=v[0],S.top+=v[1],S.bottom+=v[1]),c?{top:Math.min(c.top,S.top),bottom:Math.max(c.bottom,S.bottom),left:Math.min(c.left,S.left),right:Math.max(c.right,S.right),scaled:c.scaled||S.scaled}:S}function Yve(f,[c,u]){let g=0,v=0;if(u===poe){c<0&&(c=0);const k=c/hVe;switch(f){case"top-right":case"top-left":v=k-7;break;case"bottom-right":case"bottom-left":v=7-k;break;case"bottom":v=7-c;break;case"top":v=c-7}switch(f){case"top-right":case"bottom-right":g=-k;break;case"top-left":case"bottom-left":g=k;break;case"left":g=c;break;case"right":g=-c}}else{switch(c=Math.abs(c),u=Math.abs(u),f){case"top-right":case"top-left":case"top":v=u-7;break;case"bottom-right":case"bottom-left":case"bottom":v=7-u}switch(f){case"top-right":case"bottom-right":case"right":g=-c;break;case"top-left":case"bottom-left":case"left":g=c}}return[g,v]}function fVe(f,c,u,g,v,k,S,L,R,$,W,Z,X,re){const ne=f.layers[0],fe=ne.appearances;if(fe.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Ne={iconBBox:null,iconVerticalBBox:null},je={textBBox:null,textVerticalBBox:null},{baseIconRotate:Re,baseTextRotate:$e,iconScaleFactor:Ze}=function(ot,_t,Ct){const Et=ot.get("icon-rotate").evaluate(_t,{},Ct),Kt=ot.get("text-rotate").evaluate(_t,{},Ct),[Rt,rr]=ot.get("icon-size-scale-range");return{baseIconRotate:Et,baseTextRotate:Kt,iconScaleFactor:xe(1,Rt,rr)}}(g,v,k);c&&(Ne.iconBBox=s0(c,Ne.iconBBox,Re,S),u)&&(Ne.iconVerticalBBox=s0(u,Ne.iconVerticalBBox,Re+90,S));const ht=b6(Z.horizontal);ht&&(je.textBBox=s0(ht,je.textBBox,$e,1,re)),Z.vertical&&(je.textVerticalBBox=s0(Z.vertical,je.textVerticalBBox,$e+90,1,re));for(const ot of fe)ot.hasIconProperties()&&pVe(Ne,f,ne,ot,v,k,L,Re,S,R,c,$,Ze,W),ot.hasTextProperties()&&mVe(je,ne,ot,v,k,re,$e,X,ht,Z.vertical);return{iconBBox:Ne.iconBBox,iconVerticalBBox:Ne.iconVerticalBBox,textBBox:je.textBBox,textVerticalBBox:je.textVerticalBBox}}function pVe(f,c,u,g,v,k,S,L,R,$,W,Z,X,re){const{appearanceIconOffset:ne,appearanceIconRotate:fe,appearanceIconSize:Ne}=function(Ze,ht,ot,_t,Ct,Et,Kt,Rt){const rr=Ze.hasProperty("icon-offset")?ht.getAppearanceValueAndResolveTokens(Ze,"icon-offset",ot,_t,[]):null,or=rr&&Array.isArray(rr)?rr:Ct,lr=Ze.hasProperty("icon-rotate")?ht.getAppearanceValueAndResolveTokens(Ze,"icon-rotate",ot,_t,[]):null,xr=typeof lr=="number"?lr:Et,vr=Ze.hasProperty("icon-size")?ht.getAppearanceValueAndResolveTokens(Ze,"icon-size",ot,_t,[]):null;return{appearanceIconOffset:or,appearanceIconRotate:xr,appearanceIconSize:typeof vr=="number"?vr*Rt.iconScaleFactor:Kt}}(g,u,v,k,S,L,R,$);let je=null,Re=null,$e=null;g.hasProperty("icon-image")?$e=function(Ze,ht,ot,_t,Ct,Et,Kt){let Rt=null;const rr=ht.getAppearanceValueAndResolveTokens(ot,"icon-image",_t,Ct,[]);if(rr){const or=Ze.getResolvedImageFromTokens(rr),lr=ot.getUnevaluatedProperty("icon-size"),xr=rM(or,RN(Ze.zoom,lr,Ze.worldview),lr,Ct,Ze.zoom,_t,Ze.pixelRatio,Kt,Ze.worldview);Rt=Et.get(xr.iconPrimary.toString())}return Rt}(c,u,g,v,k,Z,X):W&&($e=W.imagePrimary),$e&&(je=g6($e,null,ne,re),c.allowVerticalPlacement&&(Re=g6($e,null,ne,re))),je&&(f.iconBBox=s0(je,f.iconBBox,fe,Ne)),Re&&(f.iconVerticalBBox=s0(Re,f.iconVerticalBBox,fe+90,Ne))}function mVe(f,c,u,g,v,k,S,L,R,$){const{appearanceTextOffset:W,appearanceTextRotate:Z,appearanceTextSize:X}=function(ne,fe,Ne,je,Re,$e,Ze){const ht=ne.hasProperty("text-offset")?fe.getAppearanceValueAndResolveTokens(ne,"text-offset",Ne,je,[]):null,ot=ht&&Array.isArray(ht)?[ht[0]*vl,ht[1]*vl]:Re,_t=ne.hasProperty("text-rotate")?fe.getAppearanceValueAndResolveTokens(ne,"text-rotate",Ne,je,[]):null,Ct=typeof _t=="number"?_t:$e,Et=ne.hasProperty("text-size")?fe.getAppearanceValueAndResolveTokens(ne,"text-size",Ne,je,[]):null;return{appearanceTextOffset:ot,appearanceTextRotate:Ct,appearanceTextSize:typeof Et=="number"?Et:Ze}}(u,c,g,v,k,S,L),re=X/L;R&&(f.textBBox=s0(R,f.textBBox,Z,re,W)),$&&(f.textVerticalBBox=s0($,f.textVerticalBBox,Z+90,re,W))}function _6(f,c,u,g,v,k,S,L,R){if(!c||!c.usvg)return;const $=Rve(g),W=Rve(v),Z=k!=="both"&&k!=="width"||!Ove(g)?1:W.width/$.width,X=k!=="both"&&k!=="height"||!Dve(g)?1:W.height/$.height;u.scaleSelf(Z,X);const re=u.toString();S.set(re,u),L.set(re,c);const{imagePosition:ne}=uoe(re,c,t_);R.set(re,ne)}function Xve(f,c,u,g,v,k,S,L,R){if(!f)return;const $=function(W,Z,X,re,ne,fe){if(W.kind==="camera")return W.maxSize;if(W.kind==="composite"){const Ne=Z.possiblyEvaluate(new ti(W.maxZoom,{worldview:fe}),X).evaluate(ne,{},X),je=Z.possiblyEvaluate(new ti(W.minZoom,{worldview:fe}),X).evaluate(ne,{},X);return Math.max(Ne,je)}return Z.possiblyEvaluate(new ti(re,{worldview:fe})).evaluate(ne,{},X)}(c,u,g,v,k,R);return f.scaleSelf($*L*S)}function rM(f,c,u,g,v,k,S,L,R){return{iconPrimary:Xve(f.getPrimary(),c,u,g,v,k,S,L,R),iconSecondary:Xve(f.getSecondary(),c,u,g,v,k,S,L,R)}}function gVe(f,c,u){if(!c)return;const g=u.get(f.toString()),v=u.get(c.toString());g&&v&&(g.paddedRect.w===v.paddedRect.w&&g.paddedRect.h===v.paddedRect.h||Ur(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==v.usvg&&Ur(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function Qve(f,c,u,g){if(!f)return;const v=c.get(u.toString());if(f.imagePrimary=v,g){const k=c.get(g.toString());f.imageSecondary=k}}function xVe(f,c){for(const u in f.horizontal)Jve(f.horizontal[u],c);Jve(f.vertical,c)}function Jve(f,c){if(f){for(const u of f.positionedLines)for(const g of u.positionedGlyphs)if(g.image!==null){const v=g.image.toString();g.rect=c.get(v).paddedRect}}}function moe(f){switch(f){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function yVe(f,c,u,g,v,k,S,L,R){const $=b6(k.horizontal)||k.vertical,W=u.get("icon-text-fit-padding").evaluate(g,{},v);let Z,X=c;return c&&R!=="none"&&(f.allowVerticalPlacement&&k.vertical&&(Z=coe(c,k.vertical,R,W,L,S)),$&&(X=coe(c,$,R,W,L,S))),{defaultShapedIcon:X,verticallyShapedIcon:Z}}function vVe(f,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re,$e,Ze,ht,ot,_t){let Ct=S.textMaxSize.evaluate(c,{},X);Ct===void 0?Ct=L*S.textScaleFactor:Ct*=S.textScaleFactor;const Et=f.layers[0].layout,Kt=vl,Rt=L*S.textScaleFactor/Kt,rr=b6(u.horizontal)||u.vertical;if(Ne!=="none"&&f.appearanceFeatureData&&c.index18&&mr>2&&(mr>>=1),Math.max(Sr/(512*mr),1)*Et.get("symbol-spacing")),vr=Et.get("text-padding")*f.tilePixelRatio,ur=Et.get("icon-padding")*f.tilePixelRatio,pr=ss(Et.get("text-max-angle")),tr=Et.get("icon-rotation-alignment")==="map"&&$e!=="point",Xt=xr/2;var mr;f.hasAnyIconTextFit===!1&&Ne!=="none"&&(f.hasAnyIconTextFit=!0);const Mr=c.properties?+c.properties[Jt]:null,wr=Mr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Mr):65535,un=(Br,Kr,tn)=>{if(Kr.x<0||Kr.x>=Sr||Kr.y<0||Kr.y>=Sr)return;let gs=null;if(or){const{x:jr,y:rn,z:qn}=re.projectTilePoint(Kr.x,Kr.y,tn);gs={anchor:new ux(jr,rn,qn,0,void 0),up:re.upVector(tn,Kr.x,Kr.y)}}(function(jr,rn,qn,Fs,$s,ns,Ba,lt,pt,nr,yr,Or,Dr,hn,vn,Jn,cs,ms,As,Ln,Un,na,oa,la,Ma,Ga,$a,pa,_a,ds,Bs,Ci,En){const Es=jr.addToLineVertexArray(rn,Fs);let qa,Qa,ri,oo,Ja,In,Fi,Ta=0,yi=0,Wo=0,_l=0,Io=-1,Po=-1;const il={};let Md=Pr("");const ei=qn?qn.anchor:rn,to=pa!=="none";let lo=0,Kd=0;if(pt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const ac=pt.layout.get("text-offset").evaluate(Un,{},Ma);lo=ac[0]*vl,Kd=ac[1]*vl}else lo=pt.layout.get("text-radial-offset").evaluate(Un,{},Ma)*vl,Kd=poe;if(jr.allowVerticalPlacement&&$s.vertical){const ac=$s.vertical;if(vn)In=goe(ac),lt&&(Fi=goe(lt));else{const ad=pt.layout.get("text-rotate").evaluate(Un,{},Ma)+90;ri=w6(nr,ei,rn,yr,Or,Dr,ac,hn,ad,Jn,Ci),lt&&(oo=w6(nr,ei,rn,yr,Or,Dr,lt,ms,ad,null,Bs))}}if(ns){const ac=jr.iconSizeData,ad=pt.layout.get("icon-rotate").evaluate(Un,{},Ma),Cu=foe(ns,ad,oa,to,na.iconScaleFactor),o0=lt?foe(lt,ad,oa,to,na.iconScaleFactor):void 0;Qa=w6(nr,ei,rn,yr,Or,Dr,ns,ms,ad,null,ds);const GN=function(Bp,_M,y2e,EHe,v2e,_2e,IHe,PHe){const b2e=Bp.layers[0],w2e=b2e.appearances;let KN=_M.length;if(y2e&&(KN=Math.max(KN,y2e.length)),w2e.length===0)return KN;const[LHe,OHe]=EHe.get("icon-size-scale-range"),DHe=xe(1,LHe,OHe);for(const j2e of w2e){const k2e=j2e.getUnevaluatedProperties();if(k2e._values["icon-image"].value!==void 0){const N2e=b2e.getAppearanceValueAndResolveTokens(j2e,"icon-image",v2e,_2e,[]);if(N2e){const S2e=Bp.getResolvedImageFromTokens(N2e);if(S2e){const C2e=k2e._values["icon-size"],RHe=rM(S2e,RN(Bp.zoom,C2e,Bp.worldview),C2e,_2e,Bp.zoom,v2e,Bp.pixelRatio,DHe,Bp.worldview),FHe=IHe.get(RHe.iconPrimary.toString());KN=Math.max(KN,oVe(FHe,PHe))}}}}return KN}(jr,Cu,o0,pt.layout,Un,Ma,jr.iconAtlasPositions,to);Ta=4*GN;let zp=null;ac.kind==="source"?(zp=[Op*pt.layout.get("icon-size").evaluate(Un,{},Ma)*na.iconScaleFactor],zp[0]>hx&&Ur(`${jr.layerIds[0]}: Value for "icon-size" is >= ${nM}. Reduce your "icon-size".`)):ac.kind==="composite"&&(zp=[Op*na.compositeIconSizes[0].evaluate(Un,{},Ma)*na.iconScaleFactor,Op*na.compositeIconSizes[1].evaluate(Un,{},Ma)*na.iconScaleFactor],(zp[0]>hx||zp[1]>hx)&&Ur(`${jr.layerIds[0]}: Value for "icon-size" is >= ${nM}. Reduce your "icon-size".`)),jr.addSymbols(jr.icon,Cu,zp,Ln,As,Un,void 0,qn,rn,Es.lineStartIndex,Es.lineLength,-1,la,Ma,Ga,$a,jr.symbolInstances.length,GN),Io=jr.icon.placedSymbolArray.length-1,o0&&(yi=4*GN,jr.addSymbols(jr.icon,o0,zp,Ln,As,Un,Su.vertical,qn,rn,Es.lineStartIndex,Es.lineLength,-1,la,Ma,Ga,$a,jr.symbolInstances.length,GN),Po=jr.icon.placedSymbolArray.length-1)}for(const ac in $s.horizontal){const ad=ac,Cu=$s.horizontal[ad];qa||(Md=Pr(Cu.text),vn?Ja=goe(Cu):qa=w6(nr,ei,rn,yr,Or,Dr,Cu,hn,pt.layout.get("text-rotate").evaluate(Un,{},Ma),Jn,Ci));const o0=Cu.positionedLines.length===1;if(Wo+=e_e(jr,qn,rn,Cu,Ba,pt,vn,Un,Jn,Es,$s.vertical?Su.horizontal:Su.horizontalOnly,o0?uVe($s.horizontal):[ad],il,Io,na,la,Ma,jr.symbolInstances.length,Ga),o0)break}$s.vertical&&(_l+=e_e(jr,qn,rn,$s.vertical,Ba,pt,vn,Un,Jn,Es,Su.vertical,["vertical"],il,Po,na,la,Ma,jr.symbolInstances.length,Ga));let Go=-1;const Tf=(ac,ad)=>ac?Math.max(ac,ad):ad;Go=Tf(Ja,Go),Go=Tf(In,Go),Go=Tf(Fi,Go);const Ym=Go>-1?1:0;jr.glyphOffsetArray.length>=65535&&Ur("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Un.sortKey!==void 0&&jr.addToSortKeyRanges(jr.symbolInstances.length,Un.sortKey),jr.symbolInstances.emplaceBack(rn.x,rn.y,ei.x,ei.y,ei.z,il.right>=0?il.right:-1,il.center>=0?il.center:-1,il.left>=0?il.left:-1,il.vertical>=0?il.vertical:-1,Io,Po,Md,qa!==void 0?qa:jr.collisionBoxArray.length,qa!==void 0?qa+1:jr.collisionBoxArray.length,ri!==void 0?ri:jr.collisionBoxArray.length,ri!==void 0?ri+1:jr.collisionBoxArray.length,Qa!==void 0?Qa:jr.collisionBoxArray.length,Qa!==void 0?Qa+1:jr.collisionBoxArray.length,oo||jr.collisionBoxArray.length,oo?oo+1:jr.collisionBoxArray.length,yr,Wo,_l,Ta,yi,Ym,0,lo,Kd,Go,0,to?1:0,_a)})(f,Kr,gs,Br,u,g,k,v,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,vr,Re,$,0,ur,tr,je,c,S,W,Z,X,ne,fe,Ne,wr,Ze,ht,ot)};if($e==="line")for(const Br of n6(c.geometry,0,0,Sr,Sr)){const Kr=iVe(Br,xr,pr,u.vertical||rr,g,Kt,lr,f.overscaling,Sr);for(const tn of Kr)rr&&_Ve(f,rr.text,Xt,tn)||un(Br,tn,X)}else if($e==="line-center"){for(const Br of c.geometry)if(Br.length>1){const Kr=aVe(Br,pr,u.vertical||rr,g,Kt,lr);Kr&&un(Br,Kr,X)}}else if(c.type==="Polygon")for(const Br of z5(c.geometry,0)){const Kr=cVe(Br,16);un(Br[0],new ux(Kr.x,Kr.y,0,0,void 0),X)}else if(c.type==="LineString")for(const Br of c.geometry)un(Br,new ux(Br[0].x,Br[0].y,0,0,void 0),X);else if(c.type==="Point")for(const Br of c.geometry)for(const Kr of Br)un([Kr],new ux(Kr.x,Kr.y,0,0,void 0),X)}const nM=255,hx=nM*Op;function e_e(f,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re){const $e=function(ot,_t,Ct,Et,Kt,Rt,rr,or){const lr=[];if(_t.positionedLines.length===0)return lr;const xr=Et.layout.get("text-rotate").evaluate(Rt,{})*Math.PI/180,vr=function(mr){const Mr=mr[0],wr=mr[1],un=Mr*wr;return un>0?[Mr,-wr]:un<0?[-Mr,wr]:Mr===0?[wr,Mr]:[wr,-Mr]}(Ct);let ur=Math.abs(_t.top-_t.bottom);for(const mr of _t.positionedLines)ur-=mr.lineOffset;const pr=_t.positionedLines.length,tr=ur/pr;let Xt=_t.top-Ct[1];for(let mr=0;mrhx&&Ur(`${f.layerIds[0]}: Value for "text-size" is >= ${nM}. Reduce your "text-size".`)):Ze.kind==="composite"&&(ht=[Op*ne.compositeTextSizes[0].evaluate(L,{},Ne)*ne.textScaleFactor,Op*ne.compositeTextSizes[1].evaluate(L,{},Ne)*ne.textScaleFactor],(ht[0]>hx||ht[1]>hx)&&Ur(`${f.layerIds[0]}: Value for "text-size" is >= ${nM}. Reduce your "text-size".`)),f.addSymbols(f.text,$e,ht,R,S,L,W,c,u,$.lineStartIndex,$.lineLength,re,fe,Ne,Re,!1,je,$e.length);for(const ot of Z)X[ot]=f.text.placedSymbolArray.length-1;return 4*$e.length}function b6(f){for(const c in f)return f[c];return null}function w6(f,c,u,g,v,k,S,L,R,$,W){let Z,X,re,ne;if(Z=W?W.top:S.top,X=W?W.bottom:S.bottom,re=W?W.left:S.left,ne=W?W.right:S.right,loe(S)&&S.collisionPadding){const fe=S.collisionPadding;re-=fe[0],Z-=fe[1],ne+=fe[2],X+=fe[3]}if(R){const fe=new ir(re,Z),Ne=new ir(ne,Z),je=new ir(re,X),Re=new ir(ne,X),$e=ss(R);let Ze=new ir(0,0);$&&(Ze=new ir($[0],$[1])),fe._rotateAround($e,Ze),Ne._rotateAround($e,Ze),je._rotateAround($e,Ze),Re._rotateAround($e,Ze),re=Math.min(fe.x,Ne.x,je.x,Re.x),ne=Math.max(fe.x,Ne.x,je.x,Re.x),Z=Math.min(fe.y,Ne.y,je.y,Re.y),X=Math.max(fe.y,Ne.y,je.y,Re.y)}return f.emplaceBack(c.x,c.y,c.z,u.x,u.y,re,Z,ne,X,L,g,v,k),f.length-1}function goe(f){loe(f)&&f.collisionPadding&&(f.top-=f.collisionPadding[1],f.bottom+=f.collisionPadding[3]);const c=f.bottom-f.top;return c>0?Math.max(10,c):null}function _Ve(f,c,u,g){const v=f.compareText;if(c in v){const k=v[c];for(let S=k.length-1;S>=0;S--)if(g.dist(k[S])$e&&(Ze(ot,lr,Ct,Et,rr,or),Ze(lr,_t,rr,or,Kt,Rt))}Ze(Z,X,g,k,v,k),Ze(X,re,v,k,v,S),Ze(re,ne,v,S,g,S),Ze(ne,Z,g,S,g,k),fe-=$e,Ne-=$e,je+=$e,Re+=$e;const ht=1/Math.max(je-fe,Re-Ne);return{scale:ht,x:fe*ht,y:Ne*ht,x2:je*ht,y2:Re*ht,projection:c}}function r_e(f,{x:c,y:u},g=0){return new ir(((c-g)*f.scale-f.x)*Sr,(u*f.scale-f.y)*Sr)}const bVe=A(new Float32Array(16));class a0{constructor(c){this.spec=c,this.name=c.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(c,u){return{x:0,y:0,z:0}}unproject(c,u){return new m(0,0)}projectTilePoint(c,u,g){return{x:c,y:u,z:0}}locationPoint(c,u,g,v=!0){return c._coordinatePoint(c.locationCoordinate(u,g),v)}pixelsPerMeter(c,u){return Y(1,c)*u}pixelSpaceConversion(c,u,g){return 1}farthestPixelDistance(c){return t_e(c,c.pixelsPerMeter)}pointCoordinate(c,u,g,v){const k=c.horizonLineFromTop(!1),S=new ir(u,Math.max(k,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(S,v))}pointCoordinate3D(c,u,g){const v=new ir(u,g);if(c.elevation)return c.elevation.pointCoordinate(v);{const k=this.pointCoordinate(c,v.x,v.y,0);return[k.x,k.y,k.z]}}isPointAboveHorizon(c,u){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,u.x,u.y);const g=c.horizonLineFromTop();return u.y0?u<-$N+g&&(u=-$N+g):u>$N-g&&(u=$N-g);const S=k/Math.pow(k6(u),v);let L=S*Math.sin(v*c),R=k-S*Math.cos(v*c);return L=.5*(L/Math.PI+.5),R=.5*(R/Math.PI+.5),{x:L,y:this.southernCenter?R:1-R,z:0}}unproject(c,u){c=(2*c-.5)*Math.PI,this.southernCenter&&(u=1-u),u=(2*(1-u)-.5)*Math.PI;const{n:g,f:v}=this,k=v-u,S=Math.sign(k),L=Math.sign(g)*Math.sqrt(c*c+k*k);let R=Math.atan2(c,Math.abs(k))*S;k*g<0&&(R-=Math.PI*Math.sign(c)*S);const $=xe(yo(R/g)+this.center[0],-180,180),W=xe(yo(2*Math.atan(Math.pow(v/L,1/g))-$N),-de,de);return new m($,this.southernCenter?-W:W)}}class n_e extends a0{constructor(c){super(c),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(c,u){return{x:B(c),y:H(u),z:0}}unproject(c,u){const g=Q(c),v=ce(u);return new m(g,v)}}const s_e=ss(de);class SVe extends a0{project(c,u){const g=(u=ss(u))*u,v=g*g;return{x:.5*((c=ss(c))*(.8707-.131979*g+v*(v*(.003971*g-.001529*v)-.013791))/Math.PI+.5),y:1-.5*(u*(1.007226+g*(.015085+v*(.028874*g-.044475-.005916*v)))/Math.PI+1),z:0}}unproject(c,u){c=(2*c-.5)*Math.PI;let g=u=(2*(1-u)-1)*Math.PI,v=25,k=0,S=g*g;do{S=g*g;const $=S*S;k=(g*(1.007226+S*(.015085+$*(.028874*S-.044475-.005916*$)))-u)/(1.007226+S*(.045255+$*(.259866*S-.311325-.005916*11*$))),g=xe(g-k,-s_e,s_e)}while(Math.abs(k)>1e-6&&--v>0);S=g*g;const L=xe(yo(c/(.8707+S*(S*(S*S*S*(.003971-.001529*S)-.013791)-.131979))),-180,180),R=yo(g);return new m(L,R)}}const a_e=ss(de);class CVe extends a0{project(c,u){u=ss(u),c=ss(c);const g=Math.cos(u),v=2/Math.PI,k=Math.acos(g*Math.cos(c/2)),S=Math.sin(k)/k,L=.5*(c*v+2*g*Math.sin(c/2)/S)||0,R=.5*(u+Math.sin(u)/S)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(R/Math.PI+1),z:0}}unproject(c,u){let g=c=(2*c-.5)*Math.PI,v=u=(2*(1-u)-1)*Math.PI,k=25;const S=1e-6;let L=0,R=0;do{const $=Math.cos(v),W=Math.sin(v),Z=2*W*$,X=W*W,re=$*$,ne=Math.cos(g/2),fe=Math.sin(g/2),Ne=2*ne*fe,je=fe*fe,Re=1-re*ne*ne,$e=Re?1/Re:0,Ze=Re?Math.acos($*ne)*Math.sqrt(1/Re):0,ht=.5*(2*Ze*$*fe+2*g/Math.PI)-c,ot=.5*(Ze*W+v)-u,_t=.5*$e*(re*je+Ze*$*ne*X)+1/Math.PI,Ct=$e*(Ne*Z/4-Ze*W*fe),Et=.125*$e*(Z*fe-Ze*W*re*Ne),Kt=.5*$e*(X*ne+Ze*je*$)+.5,Rt=Ct*Et-Kt*_t;L=(ot*Ct-ht*Kt)/Rt,R=(ht*Et-ot*_t)/Rt,g=xe(g-L,-Math.PI,Math.PI),v=xe(v-R,-a_e,a_e)}while((Math.abs(L)>S||Math.abs(R)>S)&&--k>0);return new m(yo(g),yo(v))}}class i_e extends a0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ss(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,u){const{scale:g,cosPhi:v}=this;return{x:ss(c)*v*g+.5,y:-Math.sin(ss(u))/v*g+.5,z:0}}unproject(c,u){const{scale:g,cosPhi:v}=this,k=-(u-.5)/g,S=xe(yo((c-.5)/g)/v,-180,180),L=Math.asin(xe(k*v,-1,1)),R=xe(yo(L),-de,de);return new m(S,R)}}class MVe extends n_e{constructor(c){super(c),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(c,u,g){const v=P5(c,u,g);return Ke(v,v,KP(Fh(g))),{x:v[0],y:v[1],z:v[2]}}locationPoint(c,u,g){const v=Qy(u.lat,u.lng),k=Fe([],v),S=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(u),c._centerAltitude):c._centerAltitude;Le(v,v,k,Y(1,0)*Sr*S);const L=A(new Float64Array(16));return T(L,c.pixelMatrix,c.globeMatrix),Ke(v,v,L),new ir(v[0],v[1])}pixelsPerMeter(c,u){return Y(1,0)*u}pixelSpaceConversion(c,u,g){const v=Y(1,c)*u,k=Fn(Y(1,45)*u,v,g);return this.pixelsPerMeter(c,u)/k}createTileMatrix(c,u,g){const v=bie(Fh(g.canonical));return T(new Float64Array(16),c.globeMatrix,v)}createInversionMatrix(c,u){const{center:g}=c,v=KP(Fh(u));return q(v,v,ss(g.lng)),F(v,v,ss(g.lat)),z(v,v,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(v)}pointCoordinate(c,u,g,v){return e0(c,u,g,!0)||new Ve(0,0)}pointCoordinate3D(c,u,g){const v=this.pointCoordinate(c,u,g,0);return[v.x,v.y,v.z]}isPointAboveHorizon(c,u){return!e0(c,u.x,u.y,!1)}farthestPixelDistance(c){const u=function(v,k){const S=v.cameraToCenterDistance,L=v._centerAltitude*k,R=v._camera,$=v._camera.forward(),W=ue([],ge([],$,-S),[0,0,L]),Z=v.worldSize/(2*Math.PI),X=[0,0,-Z],re=v.width/v.height,ne=Math.tan(v.fovAboveCenter),fe=ge([],R.up(),ne),Ne=ge([],R.right(),ne*re),je=Fe([],ue([],ue([],$,fe),Ne)),Re=[];let $e;if(new Jr(W,je).closestPointOnSphere(X,Z,Re)){const Ze=ue([],Re,X),ht=Me([],Ze,W);$e=Math.cos(v.fovAboveCenter)*pe(ht)}else{const Ze=Me([],W,X),ht=Me([],X,W);Fe(ht,ht);const ot=pe(Ze)-Z;$e=Math.sqrt(ot*(ot+2*Z));const _t=Math.acos($e/(Z+ot))-Math.acos(be($,ht));$e*=Math.cos(_t)}return 1.01*$e}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=t0(c.zoom);if(g>0){const v=t_e(c,Y(1,c.center.lat)*c.worldSize),k=c.worldSize/(2*Math.PI),S=Math.max(c.width,c.height)/c.worldSize*Math.PI;return Fn(u,v+k*(1-Math.cos(S)),Math.pow(g,10))}return u}upVector(c,u,g){return P5(u,g,c,1)}upVectorScale(c){return{metersToTile:Cf(GP(Fh(c)))}}}function o_e(f){const c=f.parallels,u=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new n_e(f);case"equirectangular":return new kVe(f);case"naturalEarth":return new SVe(f);case"equalEarth":return new jVe(f);case"winkelTripel":return new CVe(f);case"albers":return u?new i_e(f):new wVe(f);case"lambertConformalConic":return u?new i_e(f):new NVe(f);case"globe":return new MVe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const TVe=Lt.types,AVe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cM(f,c,u,g,v,k,S,L,R,$,W,Z,X){const re=L?Math.min(hx,Math.round(L[0])):0,ne=L?Math.min(hx,Math.round(L[1])):0;f.emplaceBack(c,u,Math.round(32*g),Math.round(32*v),k,S,(re<<1)+(R?1:0),0+(ne<<1),16*$,16*W,256*Z,256*X)}function dM(f,c,u){f.emplaceBack(c,u)}function uM(f,c,u,g,v,k,S){f.emplaceBack(c,u,g,v,k,S)}const N6=(f,c,u,g)=>{for(let v=0;v0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,Fqe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,Lqe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||k)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,Dqe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,Rqe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||v)&&this.programConfigurations.upload(c))}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(xoe,"SymbolBuffers");class yoe{constructor(c,u,g){this.layoutVertexArray=new c,this.layoutAttributes=u,this.indexArray=new g,this.segments=new Oi,this.collisionVertexArray=new y5,this.collisionVertexArrayExt=new Vm}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,zqe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,Bqe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Yr(yoe,"CollisionBuffers");class S6{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(S=>S.fqid),this.index=c.index,this.pixelRatio=c.pixelRatio,this.sourceLayerIndex=c.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=A([]),this.placementViewportMatrix=A([]);const u=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=RN(this.zoom,u["text-size"],this.worldview),this.iconSizeData=RN(this.zoom,u["icon-size"],this.worldview);const g=this.layers[0].layout,v=g.get("symbol-sort-key"),k=g.get("symbol-z-order");this.lut=c.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=k!=="viewport-y"&&v.constantOr(1)!==void 0,this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(S=>Su[S]),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=c.sourceID,this.projection=c.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(c){const u=this.layers[0].getAppearances();return!(!u||u.length===0)&&u.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new xoe(new Dh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new xoe(new Dh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new vN,this.lineVertexArray=new UP,this.symbolInstances=new N5}calculateGlyphDependencies(c,u,g,v,k){for(const S of c){const L=S.codePointAt(0);if(L===void 0)break;if(u[L]=!0,v&&k&&L<=65535){const R=Q5[S];R&&(u[R.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,u,g,v,k,S){let L=1;const R=c.getUnevaluatedProperties()._values["icon-size"],$=RN(this.zoom,R,this.worldview),W=FN($,u);if($.kind!=="constant"&&$.kind!=="camera"||(L=W.uSize),$.kind==="composite"){const{minZoom:Z,maxZoom:X}=$,re=R.possiblyEvaluate(new ti(Z,{worldview:this.worldview}),v),ne=R.possiblyEvaluate(new ti(X,{worldview:this.worldview}),v),fe=re.evaluate(g,{},v,k);L=fe+(ne.evaluate(g,{},v,k)-fe)*W.uSizeT}return $.kind==="source"&&(L=R.possiblyEvaluate(new ti(this.zoom,{worldview:this.worldview}),v).evaluate(g,{},v,k)),L*S}updateFootprints(c,u){}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!e6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?ed.build(c):c}populate(c,u,g,v){const k=this.layers[0],S=k.layout,L=this.projection.name==="globe",R=S.get("text-font"),$=S.get("text-field"),W=S.get("icon-image"),[Z,X]=S.get("icon-size-scale-range"),re=xe(u.scaleFactor||1,Z,X),ne=($.value.kind!=="constant"||$.value.value instanceof Jc&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(R.value.kind!=="constant"||R.value.value.length>0),fe=W.value.kind!=="constant"||!!W.value.value||Object.keys(W.parameters).length>0,Ne=this.hasAnyAppearanceProperty("icon-image"),je=S.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!ne&&!fe&&!Ne)return;const Re=u.iconDependencies,$e=u.glyphDependencies,Ze=u.availableImages,ht=new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),ot=_t=>{const Ct=_t.id.toString();Re.has(Ct)?Re.get(Ct).push(_t):Re.set(Ct,[_t])};for(const _t of c){const{feature:Ct,id:Et,index:Kt,sourceLayerIndex:Rt}=_t,rr=k._featureFilter.needGeometry,or=Dt(Ct,rr);if(!k._featureFilter.filter(ht,or,g))continue;if(rr||(or.geometry=St(Ct,g,v)),L&&Ct.type!==1&&g.z<=5){const mr=or.geometry,Mr=.98078528056,wr=(un,Br)=>be(P5(un.x,un.y,g,1),P5(Br.x,Br.y,g,1)){if(!mr.getProperty("icon-image"))return;const Mr=this.getCombinedIconPrimary(mr,vr,or,g,Ze,tr,re);Mr&&ot(Mr)}),lr){const mr=R.evaluate(or,{},g).join(","),Mr=S.get("text-rotation-alignment")==="map"&&S.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Su.vertical)>=0;for(const wr of lr.sections)if(wr.image){const un=wr.image.getPrimary().scaleSelf(this.pixelRatio),Br=un.id.toString(),Kr=Re.get(Br)||[];Kr.push(un),Re.set(Br,Kr)}else{const un=Dv(lr.toString()),Br=wr.fontStack||mr,Kr=$e[Br]=$e[Br]||{};this.calculateGlyphDependencies(wr.text,Kr,Mr,this.allowVerticalPlacement,un)}}}if(S.get("symbol-placement")==="line"&&(this.features=function(_t){const Ct={},Et={},Kt=[];let Rt=0;function rr(vr){Kt.push(_t[vr]),Rt++}function or(vr,ur,pr){const tr=Et[vr];return delete Et[vr],Et[ur]=tr,Kt[tr].geometry[0].pop(),Kt[tr].geometry[0]=Kt[tr].geometry[0].concat(pr[0]),tr}function lr(vr,ur,pr){const tr=Ct[ur];return delete Ct[ur],Ct[vr]=tr,Kt[tr].geometry[0].shift(),Kt[tr].geometry[0]=pr[0].concat(Kt[tr].geometry[0]),tr}function xr(vr,ur,pr){const tr=pr?ur[0][ur[0].length-1]:ur[0][0];return`${vr}:${tr.x}:${tr.y}`}for(let vr=0;vr<_t.length;vr++){const ur=_t[vr],pr=ur.geometry,tr=ur.text?ur.text.toString():null;if(!tr){rr(vr);continue}const Xt=xr(tr,pr),mr=xr(tr,pr,!0);if(Xt in Et&&mr in Ct&&Et[Xt]!==Ct[mr]){const Mr=lr(Xt,mr,pr),wr=or(Xt,mr,Kt[Mr].geometry);delete Ct[Xt],delete Et[mr],Et[xr(tr,Kt[wr].geometry,!0)]=wr,Kt[Mr].geometry=null}else Xt in Et?or(Xt,mr,pr):mr in Ct?lr(Xt,mr,pr):(rr(vr),Ct[Xt]=Rt-1,Et[mr]=Rt-1)}return Kt.filter(vr=>vr.geometry)}(this.features)),S.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 _t of u.elevationFeatures)this.elevationFeatureIdToIndex.set(_t.id,this.elevationFeatures.length),this.elevationFeatures.push(_t)}}else S.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((_t,Ct)=>_t.sortKey-Ct.sortKey)}getCombinedIconPrimary(c,u,g,v,k,S,L){let R,$;const W=c.getUnevaluatedProperties();if(W._values["icon-image"].value!==void 0){const Z=u.getAppearanceValueAndResolveTokens(c,"icon-image",g,v,k);R=this.getResolvedImageFromTokens(Z)}else{const Z=u.getValueAndResolveTokens("icon-image",g,v,k);R=this.getResolvedImageFromTokens(Z)}if(R){const Z=W._values["icon-size"]||u._unevaluatedLayout._values["icon-size"];$=rM(R,RN(this.zoom,Z,this.worldview),Z,v,this.zoom,S,this.pixelRatio,L,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,u,g,v){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const k=this.layers[0];let S=!1,L=0;const R=k.layout,[$,W]=R.get("icon-size-scale-range"),Z=xe(1,$,W);for(let X=0;X=0){const Ne=fe.id,je=u&&Ne!==void 0?u[String(Ne)]:void 0,Re={type:"Point",id:fe.id,properties:fe.properties,geometry:[]},$e=this.layers[0].appearances&&this.layers[0].appearances.find(Ze=>Ze.isActive({globals:v,feature:Re,canonical:c,featureState:je}));if(fe.activeAppearance===$e){L+=re.numIconVertices;continue}if($e){fe.activeAppearance=$e;const Ze=this.getCombinedIconPrimary($e,k,Re,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:fe.properties,type:"Point",id:fe.id},Z);if(!Ze)continue;const ht=Ze.toString(),ot=this.iconAtlasPositions&&this.iconAtlasPositions.get(ht);if(ot){const _t=k.getAppearanceValueAndResolveTokens($e,"icon-offset",Re,c,g),Ct=_t&&Array.isArray(_t)?_t:[0,0];let Et=g6(ot,void 0,Ct,k.layout.get("icon-anchor").evaluate(Re,{},c));const Kt=k.getAppearanceValueAndResolveTokens($e,"icon-rotate",Re,c,g),Rt=typeof Kt=="number"?Kt:0,rr=ot.sdf,or=k.layout.get("icon-text-fit").constantOr("none");or!=="none"&&fe.textShaping&&fe.iconTextFitPadding&&fe.fontScale&&(Et=coe(Et,fe.textShaping,or,fe.iconTextFitPadding,Ct,fe.fontScale));const lr=this.calculateEffectiveAppearanceIconSize($e,v.zoom,Re,c,g,Z),xr=0,vr=1+(Math.min(hx,Math.round(lr*Op))<<1),ur=foe(Et,Rt,rr,or!=="none",Z);fe.isUsingAppearanceVertexData||(fe.isUsingAppearanceVertexData=!0,fe.layoutBasedVertexData=this.icon.getIconVertexData(L,re.numIconVertices));for(let tr=0;tr0&&(this.icon.updateIconVertexData(L,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+3,0,0,0,0,0,0,0,0,0,0,0,0),S=!0),L+=re.numIconVertices,fe.activeAppearance=null;else if(fe.isUsingAppearanceVertexData){const ht=fe.layoutBasedVertexData.length/12;for(let ot=0;ot0||X>0,Ne=re>0,je=this.elevationFeatures[R.elevationFeatureIndex];if(je){const Re=new ir(R.tileAnchorX,R.tileAnchorY),$e=.075+je.pointElevation(Re);R.zOffset!==$e&&(u=!0,R.zOffset=$e),$e!==0&&(this.hasAnyZOffset=!0);const Ze=je.computeSlopeNormal(Re,v),ht=Pn(mt(),se(0,0,1),Ze);yt($,$,ht),yt(W,W,ht),$[2]*=g,W[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&W[0]===0&&W[1]===1&&W[2]===0||(k=k||fe,S=S||Ne)}if(fe&&(N6(this.text.orientationVertexArray,Z,$,W),N6(this.text.orientationVertexArray,X,$,W)),Ne){const{placedIconSymbolIndex:Re,verticalPlacedIconSymbolIndex:$e}=R;Re>=0&&N6(this.icon.orientationVertexArray,re,$,W),$e>=0&&N6(this.icon.orientationVertexArray,ne,$,W)}}k||(this.text.orientationVertexArray=void 0),S||(this.icon.orientationVertexArray=void 0),u&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(k,S,L)=>{g+=S,g>k.length&&k.resize(g);for(let R=-S;R<0;R++)k.emplace(R+g,L)},u=(k,S,L)=>{v+=S,v>k.length&&k.resize(v);for(let R=-S;R<0;R++)k.emplace(R+v,L)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,v=0;for(let k=0;k0;if((L>0||R>0)&&(c(this.text.zOffsetVertexArray,L,W),c(this.text.zOffsetVertexArray,R,W)),Z){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:re}=S;X>=0&&u(this.icon.zOffsetVertexArray,$,W),re>=0&&u(this.icon.zOffsetVertexArray,S.numVerticalIconVertices,W)}}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(c,u,g,v,k){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(c),this.iconCollisionBox.upload(c)),this.text.upload(c,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(S=>S.appearances&&S.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,u,g,v){return!!(c&&u&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,u,g,v)&&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=o_e(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,u){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:v,y:k}of u)this.lineVertexArray.emplaceBack(v,k);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe,Ne,je,Re){const $e=c.indexArray,Ze=c.layoutVertexArray,ht=c.globeExtVertexArray,ot=c.segments.prepareSegment(4*Re,Ze,$e,this.canOverlap?S.sortKey:void 0),_t=this.glyphOffsetArray.length,Ct=ot.vertexLength,Et=this.allowVerticalPlacement&&L===Su.vertical?Math.PI/2:0,Kt=S.text&&S.text.sections;for(let or=0;or=0?u.rightJustifiedTextSymbolIndex:u.centerJustifiedTextSymbolIndex>=0?u.centerJustifiedTextSymbolIndex:u.leftJustifiedTextSymbolIndex>=0?u.leftJustifiedTextSymbolIndex:u.verticalPlacedTextSymbolIndex>=0?u.verticalPlacedTextSymbolIndex:v),S=doe(this.textSizeData,c,k)/vl;return this.tilePixelRatio*S}getSymbolInstanceIconSize(c,u,g){const v=this.icon.placedSymbolArray.get(g),k=doe(this.iconSizeData,c,v);return this.tilePixelRatio*k}_commitDebugCollisionVertexUpdate(c,u,g,v){c.emplaceBack(u,-g,-g,v),c.emplaceBack(u,g,-g,v),c.emplaceBack(u,g,g,v),c.emplaceBack(u,-g,g,v)}_updateTextDebugCollisionBoxes(c,u,g,v,k,S,L){for(let R=v;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(c,u){const g=c.placedSymbolArray.get(u),v=g.vertexStartIndex+4*g.numGlyphs;for(let k=g.vertexStartIndex;kv[L]-v[R]||k[R]-k[L]),S}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(u).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:c,symbolInstanceEnd:c+1})}sortFeatures(c){if(this.sortFeaturesByY&&this.sortedAngle!==c&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(c),this.sortedAngle=c,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:v,centerJustifiedTextSymbolIndex:k,leftJustifiedTextSymbolIndex:S,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:$}=g;v>=0&&this.addIndicesForPlacedSymbol(this.text,v),k>=0&&k!==v&&this.addIndicesForPlacedSymbol(this.text,k),S>=0&&S!==k&&S!==v&&this.addIndicesForPlacedSymbol(this.text,S),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),R>=0&&this.addIndicesForPlacedSymbol(this.icon,R),$>=0&&this.addIndicesForPlacedSymbol(this.icon,$)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(c){const u=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&ug in f?String(f[g]):"")}let c_e,d_e,voe;Yr(S6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),S6.addDynamicAttributes=UN;class u_e{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Eh,this.defaultValue=c}evaluate(c){if(c.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(c.formattedSection))return u.getOverride(c.formattedSection)}return c.feature&&c.featureState?this.defaultValue.evaluate(c.feature,c.featureState):this.defaultValue.property.specification.default}eachChild(c){this.defaultValue.isConstant()||c(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Yr(u_e,"FormatSectionOverride",{omit:["defaultValue"]});const _oe=()=>voe||(voe={layout:c_e||(c_e=new Wi({"symbol-placement":new kr(Ft.layout_symbol["symbol-placement"]),"symbol-spacing":new kr(Ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new kr(Ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Er(Ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new kr(Ft.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new kr(Ft.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new kr(Ft.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new kr(Ft.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new kr(Ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new kr(Ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new kr(Ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Er(Ft.layout_symbol["icon-size"]),"icon-size-scale-range":new kr(Ft.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Er(Ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Er(Ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Er(Ft.layout_symbol["icon-image"]),"icon-image-use-theme":new kr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Er(Ft.layout_symbol["icon-rotate"]),"icon-padding":new kr(Ft.layout_symbol["icon-padding"]),"icon-keep-upright":new kr(Ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Er(Ft.layout_symbol["icon-offset"]),"icon-anchor":new Er(Ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new kr(Ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new kr(Ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new kr(Ft.layout_symbol["text-rotation-alignment"]),"text-field":new Er(Ft.layout_symbol["text-field"]),"text-font":new Er(Ft.layout_symbol["text-font"]),"text-size":new Er(Ft.layout_symbol["text-size"]),"text-size-scale-range":new kr(Ft.layout_symbol["text-size-scale-range"]),"text-max-width":new Er(Ft.layout_symbol["text-max-width"]),"text-line-height":new Er(Ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Er(Ft.layout_symbol["text-letter-spacing"]),"text-justify":new Er(Ft.layout_symbol["text-justify"]),"text-radial-offset":new Er(Ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new kr(Ft.layout_symbol["text-variable-anchor"]),"text-anchor":new Er(Ft.layout_symbol["text-anchor"]),"text-max-angle":new kr(Ft.layout_symbol["text-max-angle"]),"text-writing-mode":new kr(Ft.layout_symbol["text-writing-mode"]),"text-rotate":new Er(Ft.layout_symbol["text-rotate"]),"text-padding":new kr(Ft.layout_symbol["text-padding"]),"text-keep-upright":new kr(Ft.layout_symbol["text-keep-upright"]),"text-transform":new Er(Ft.layout_symbol["text-transform"]),"text-offset":new Er(Ft.layout_symbol["text-offset"]),"text-allow-overlap":new kr(Ft.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new kr(Ft.layout_symbol["text-ignore-placement"]),"text-optional":new kr(Ft.layout_symbol["text-optional"]),visibility:new kr(Ft.layout_symbol.visibility)})),paint:d_e||(d_e=new Wi({"icon-opacity":new Er(Ft.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Er(Ft.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Er(Ft.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Er(Ft.paint_symbol["text-emissive-strength"]),"icon-color":new Er(Ft.paint_symbol["icon-color"]),"icon-halo-color":new Er(Ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Er(Ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Er(Ft.paint_symbol["icon-halo-blur"]),"icon-translate":new kr(Ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new kr(Ft.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new kr(Ft.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Er(Ft.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Er(Ft.paint_symbol["text-occlusion-opacity"]),"text-color":new Er(Ft.paint_symbol["text-color"],{runtimeType:kd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Er(Ft.paint_symbol["text-halo-color"]),"text-halo-width":new Er(Ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Er(Ft.paint_symbol["text-halo-blur"]),"text-translate":new kr(Ft.paint_symbol["text-translate"]),"text-translate-anchor":new kr(Ft.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new kr(Ft.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new kr(Ft.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new kr(Ft.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new kr(Ft.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Er(Ft.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"})}))},voe);class C6 extends nd{constructor(c,u,g,v){super(c,_oe(),u,g,v,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=A([]),this.hasOcclusionOpacityProperties=c.paint!==void 0&&("icon-occlusion-opacity"in c.paint||"text-occlusion-opacity"in c.paint)}_handleSpecialPaintPropertyUpdate(c){c!=="icon-occlusion-opacity"&&c!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(c,u){super.recalculate(c,u),this.appearances&&this.appearances.forEach(v=>{v.recalculate(c,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 v=[];for(const k of g)v.indexOf(k)<0&&v.push(k);this.layout._values["text-writing-mode"]=v}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,u,g,v){return this._saturation===c&&this._contrast===u&&this._brightnessMin===g&&this._brightnessMax===v||(this._colorAdjustmentMatrix=function(k,S,L,R){k=ki(k),S=Ws(S);const $=C(),W=k/3,Z=1-2*W,X=[Z,W,W,0,W,Z,W,0,W,W,Z,0,0,0,0,1],re=.5-.5*S,ne=R-L;return T($,[ne,0,0,0,0,ne,0,0,0,0,ne,0,L,L,L,1],[S,0,0,0,0,S,0,0,0,0,S,0,re,re,re,1]),T($,$,X),$}(c,u,g,v),this._saturation=c,this._contrast=u,this._brightnessMin=g,this._brightnessMax=v),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,u,g,v){const k=this.layout.get(c).evaluate(u,{},g,v),S=this._unevaluatedLayout._values[c];return S.isDataDriven()||Lv(S.value)||!k?k:l_e(u.properties,k)}getAppearanceValueAndResolveTokens(c,u,g,v,k){const S=c.getProperty(u);if(!S)return;const L=S.evaluate(g,{},v,k),R=c.getUnevaluatedProperties()._values[u];return R.isDataDriven()||Lv(R.value)||!L||typeof L!="string"?L:l_e(g.properties,L)}createBucket(c){return new S6(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of _oe().paint.overridableProperties){if(!C6.hasPaintOverride(this.layout,c))continue;const u=this.paint.get(c),g=new u_e(u),v=new Zk(g,u.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let k=null;k=u.value.kind==="constant"||u.value.kind==="source"?new qy("source",v):new Jg("composite",v,u.value.zoomStops,u.value.interpolationType),this.paint._values[c]=new tx(u.property,k,u.parameters)}}_handleOverridablePaintPropertyUpdate(c,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&C6.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,u){const g=c.get("text-field"),v=_oe().paint.properties[u];let k=!1;const S=L=>{for(const R of L)if(v.overrides&&v.overrides.hasOverride(R))return void(k=!0)};if(g.value.kind==="constant"&&g.value.value instanceof Jc)S(g.value.value.sections);else if(g.value.kind==="source"){const L=$=>{k||($ instanceof vp&&yl($.value)===vv?S($.value.sections):$ instanceof vf?S($.sections):$.eachChild(L))},R=g.value;R._styleExpression&&L(R._styleExpression.expression)}return k}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,u,g){return{config:new Wm(this,{zoom:u,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let h_e,f_e,p_e,m_e;var boe=Ts([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function M6(f,c,u,g,v,k,S,L){const R=[f,c,1,u,g,1,v,k,1],$=[S,L,1],W=_([],R),[Z,X,re]=me($,$,W);return j(R,R,[Z,0,0,0,X,0,0,0,re])}function g_e(f,c,u,g,v,k,S,L){const R=function($,W,Z,X,re,ne,fe,Ne){const je=M6(0,0,1,0,1,1,0,1),Re=M6($,W,Z,X,re,ne,fe,Ne);return j(Re,Re,_([],je))}(f,c,u,g,v,k,S,L);return[R[2]/R[8]/Sr,R[5]/R[8]/Sr]}function T6(f){return[f[0],Math.min(Math.max(f[1],-de),de)]}class x_e extends mi{constructor(c,u,g,v){super(),this.id=c,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(v),this.options=u,this._dirty=!1}load(c,u){if(this._loaded=u||!1,this.fire(new Hn("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=My(this.map._requestManager.transformRequest(this.url,Hg.Image),(g,v)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new rs(g)):v&&(this.image=v instanceof HTMLImageElement?Uo.getImageData(v):v,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,c&&(this.coordinates=c),this._finishLoading())})}loaded(){return this._loaded}updateImage(c){return c.url?(this._imageRequest&&c.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=c.url,this.load(c.coordinates,this._loaded),this):this}setTexture(c){if(!(c.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Z5(this.map.painter.context,c.handle),this.width=c.dimensions[0],this.height=c.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(c){this.map=c,this.load()}onRemove(c){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Z5||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(c){if(this.coordinates=c,this._boundsArray=void 0,this._unsupportedCoords=!1,!c.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let u=c[0][1],g=c[0][1];for(const k of c)k[1]>g&&(g=k[1]),k[1]de?this.onNorthPole=!0:v<-de&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const k=c.map(Ve.fromLngLat);this.tileID=function(S){let L=1/0,R=1/0,$=-1/0,W=-1/0;for(const fe of S)L=Math.min(L,fe.x),R=Math.min(R,fe.y),$=Math.max($,fe.x),W=Math.max(W,fe.y);const Z=Math.max($-L,W-R),X=Math.max(0,Math.floor(-Math.log2(Z))),re=Math.pow(2,X);let ne=Math.floor((L+$)/2*re);return ne>1&&(ne-=1),new Wa(X,ne,Math.floor((R+W)/2*re))}(k),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Hn("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Z5||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(c){for(const je in this.tiles){const Re=this.tiles[je];Re.state!=="loaded"&&(Re.state="loaded",Re.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const u=sM(new Wa(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(je){const Re=je[1].x-je[0].x,$e=je[1].y-je[0].y,Ze=je[2].x-je[1].x,ht=je[2].y-je[1].y,ot=je[3].x-je[2].x,_t=je[3].y-je[2].y,Ct=je[0].x-je[3].x,Et=je[0].y-je[3].y,Kt=Re*ht-Ze*$e,Rt=Ze*_t-ot*ht,rr=ot*Et-Ct*_t,or=Ct*$e-Re*Et;return Kt>0&&Rt>0&&rr>0&&or>0||Kt<0&&Rt<0&&rr<0&&or<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const v=sM(this.tileID,this.map.transform.projection),[k,S,L,R]=this.coordinates.map(je=>{const Re=v.projection.project(je[0],je[1]);return r_e(v,Re)._round()});this.perspectiveTransform=g_e(k.x,k.y,S.x,S.y,L.x,L.y,R.x,R.y);const $=this._boundsArray=new Gy;$.emplaceBack(k.x,k.y,0,0),$.emplaceBack(S.x,S.y,Sr,0),$.emplaceBack(R.x,R.y,0,Sr),$.emplaceBack(L.x,L.y,Sr,Sr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,boe.members),this.boundsSegments=Oi.simpleSegment(0,0,4,2);const W=[],Z=[T6((X=this.coordinates)[0]),T6(X[1]),T6(X[2]),T6(X[3])];var X;const[re,ne,fe,Ne]=function(je){let Re=je[0][0],$e=Re,Ze=je[0][1],ht=Ze;for(let ot=1;ot$e&&($e=je[ot][0]),je[ot][1]ht&&(ht=je[ot][1]);return[Re,Ze,$e-Re,ht-Ze]}(Z);{const je=new Gy,[Re,$e,Ze,ht]=function(ur){let pr=ur[0].x,tr=pr,Xt=ur[0].y,mr=Xt;for(let Mr=1;Mrtr&&(tr=ur[Mr].x),ur[Mr].ymr&&(mr=ur[Mr].y);return[pr,Xt,tr-pr,mr-Xt]}(g),ot=ur=>[(ur.x-Re)/Ze,(ur.y-$e)/ht],[_t,Ct,Et,Kt]=g.map(ot),Rt=function(ur,pr,tr,Xt,mr,Mr,wr,un){const Br=M6(0,0,1,0,1,1,0,1);return j(Br,Br,_([],M6(ur,pr,tr,Xt,mr,Mr,wr,un)))}(_t[0],_t[1],Ct[0],Ct[1],Et[0],Et[1],Kt[0],Kt[1]);this.elevatedGlobePerspectiveTransform=g_e(_t[0],_t[1],Ct[0],Ct[1],Et[0],Et[1],Kt[0],Kt[1]);const rr=(ur,pr)=>{W.push(ur.lng);const tr=Math.round((ur.lng-re)/fe*Sr),Xt=Math.round((ur.lat-ne)/Ne*Sr),mr=ot(pr),Mr=me([],[mr[0],mr[1],1],Rt),wr=Math.round(Mr[0]/Mr[2]*Sr),un=Math.round(Mr[1]/Mr[2]*Sr);je.emplaceBack(tr,Xt,wr,un)},or=g[3].x-g[0].x,lr=g[3].y-g[0].y,xr=g[2].x-g[1].x,vr=g[2].y-g[1].y;for(let ur=0;ur<65;ur++){const pr=ur/64,tr=[g[0].x+pr*or,g[0].y+pr*lr],Xt=[g[1].x+pr*xr,g[1].y+pr*vr],mr=Xt[0]-tr[0],Mr=Xt[1]-tr[1];for(let wr=0;wr<65;wr++){const un=wr/64,Br={x:tr[0]+mr*un,y:tr[1]+Mr*un};rr(u.projection.unproject(Br.x,Br.y),Br)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(je,boe.members)}{this.maxLongitudeTriangleSize=0;let je=[],Re=new qo;const $e=(Ze,ht,ot)=>{Re.emplaceBack(Ze,ht,ot);const _t=W[Ze],Ct=W[ht],Et=W[ot],Kt=Math.min(Math.min(_t,Ct),Et),Rt=Math.max(Math.max(_t,Ct),Et)-Kt;Rt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Rt),je.push(Kt+Rt/2)};for(let Ze=0;Ze<64;Ze++)for(let ht=0;ht<64;ht++){const ot=65*Ze+ht,_t=ot+1,Ct=ot+65,Et=Ct+1;$e(ot,Ct,_t),$e(_t,Ct,Et)}[je,Re]=function(Ze,ht){const ot=Array.from({length:Ze.length},(Et,Kt)=>Kt);ot.sort((Et,Kt)=>Ze[Et]-Ze[Kt]);const _t=[],Ct=new qo;for(let Et=0;Et{S.segments.push({vertexOffset:0,primitiveOffset:Z,vertexLength:u.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},R=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-v)<=R){const Z=ji(g,0,g.length,v+R);return Z===g.length||L(Z,vo(g,Z+1,g.length,v+360-R)-Z),S}vSr?v-Sr:v,new ir(Math.trunc(v),Math.trunc(g[u+1]))}translationForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+4],g[u+5],g[u+6]]}rotationScaleForInstance(c){const u=16*c,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(c){const u=16*c,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 koe{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaledZ=this.canonical.z+Math.log2(c.overscaling),this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.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=c.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.tileToMeter=Pe(g);const k=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:S,id:L,index:R,sourceLayerIndex:$}of c){const W=L??(S.properties&&S.properties.hasOwnProperty("id")?S.properties.id:void 0),Z=Dt(S,k);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),Z,g))continue;const X={id:W,sourceLayerIndex:$,index:R,geometry:k?Z.geometry:St(S,g,v),properties:S.properties,type:S.type,patterns:{}},re=this.addFeature(X,X.geometry,Z);re&&u.featureIndex.insert(S,X.geometry,R,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Sr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,u=this.layers[0].scope;let g=0;for(const v of this.modelUris){const k=c.getModel(v,u);if(!k)continue;const S=this.instancesPerModel[v];if(S){const L=.5*ke(k.aabb.max,k.aabb.min)*S.maxScale+S.maxXYTranslationDistance,R=Math.min(Sr,Math.max(L/this.tileToMeter,Sr/32));g=Math.max(R,g)}}return g}update(c,u,g,v){for(const k in this.instancesPerModel){const S=this.instancesPerModel[k];for(const L in c)S.idToFeaturesIndex.hasOwnProperty(L)&&(this.evaluate(S.features[S.idToFeaturesIndex[L]],c[L],S,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];for(const v of g.features){const k=this.layers[0],S=v.feature,L=this.canonical,R=k.paint.get("model-rotation").evaluate(S,{},L),$=k.paint.get("model-scale").evaluate(S,{},L),W=k.paint.get("model-translation").evaluate(S,{},L);at(v.rotation,R)&&at(v.scale,$)&&at(v.translation,W)||(this.evaluate(v,v.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,u,g,v){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const k=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(e6(this.activeReplacements,k))return!1;this.activeReplacements=k;let S=!1;for(const L in this.instancesPerModel){const R=this.instancesPerModel[L],$=R.instancedDataArray;for(const W of R.features){const Z=W.instancedDataOffset,X=W.instancedDataCount;for(let re=0;reSr;fe=Ne?fe-Sr:fe;const je=Math.floor(fe),Re=Math.floor($.float32[ne+1]);let $e=!1;for(const Ze of this.activeReplacements)if(!f1e(Ze,g,N_e.Model,v)&&!(Ze.min.x>je||je>Ze.max.x||Ze.min.y>Re||Re>Ze.max.y)&&($e=y1e(x1e(je,Re,c.canonical,Ze.footprintTileId.canonical),Ze.footprint),$e))break;$.float32[ne]=$e?fe+Sr:fe,S=S||$e!==Ne}}}return S}isEmpty(){for(const c in this.instancesPerModel)if(this.instancesPerModel[c].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(c){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=c.createVertexBuffer(g.instancedDataArray,rqe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const g in this.instancesPerModel){const v=this.instancesPerModel[g];v.instancedDataArray.length!==0&&v.instancedDataBuffer&&v.instancedDataBuffer.destroy()}const u=this.layers[0].modelManager;if(c&&u&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)u.removeModel(g,"",!0)}addFeature(c,u,g){const v=this.layers[0],k=v.layout.get("model-id").evaluate(g,{},this.canonical);if(!k)return Ur(`modelId is not evaluated for layer ${v.id} and it is not going to get rendered.`),k;(joe(k,!1)||this.styleDefinedModelURLs[k]!==void 0)&&(this.modelUris.includes(k)||this.modelUris.push(k)),this.instancesPerModel[k]||(this.instancesPerModel[k]=new C_e);const S=this.instancesPerModel[k],L=S.instancedDataArray,R=new S_e(g,L.length);for(const $ of u)for(const W of $){if(W.x<0||W.x>=Sr||W.y<0||W.y>=Sr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Sr,re=this.lookupDim*(W.y*X|0)+W.x*X|0;if(this.lookup){if(this.lookup[re]!==0)continue;this.lookup[re]=1}}this.instanceCount++;const Z=L.length;L.resize(Z+1),S.instancesEvaluatedElevation.push(0),L.float32[16*Z]=W.x,L.float32[16*Z+1]=W.y}return R.instancedDataCount=S.instancedDataArray.length-R.instancedDataOffset,R.instancedDataCount>0&&(c.id&&(S.idToFeaturesIndex[c.id]=S.features.length),S.features.push(R),this.evaluate(R,{},S,!1)),k}getModelUris(){return this.modelUris}evaluate(c,u,g,v){const k=this.layers[0],S=c.feature,L=this.canonical,R=c.rotation=k.paint.get("model-rotation").evaluate(S,u,L),$=c.scale=k.paint.get("model-scale").evaluate(S,u,L),W=c.translation=k.paint.get("model-translation").evaluate(S,u,L),Z=Object.assign({},k.paint.get("model-color").evaluate(S,u,L));Z.a=k.paint.get("model-color-mix-intensity").evaluate(S,u,L);const X=[];this.maxVerticalOffset0?Math.sqrt(re):0;g.maxScale=Math.max(Math.max(g.maxScale,$[0]),Math.max($[1],$[2])),g.maxXYTranslationDistance=Math.max(g.maxXYTranslationDistance,ne),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),sve(X,R,$);const fe=Math.round(100*Z.a)+Z.b/1.05;for(let Ne=0;Ne10?this.tileToMeter:Pe(L,ht)),$e[Re+4]=W[0],$e[Re+5]=W[1],$e[Re+6]=W[2]+Ze,$e[Re+7]=X[0],$e[Re+8]=X[1],$e[Re+9]=X[2],$e[Re+10]=X[4],$e[Re+11]=X[5],$e[Re+12]=X[6],$e[Re+13]=X[8],$e[Re+14]=X[9],$e[Re+15]=X[10],g.instancesEvaluatedElevation[je]=W[2]}}}let M_e,T_e;Yr(koe,"ModelBucket",{omit:["layers"]}),Yr(C_e,"PerModelAttributes"),Yr(S_e,"ModelFeature");class qN{constructor(c,u,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=u,this._offset=g}static create(c,u,g){const v=g||c.findDEMTileFor(u);if(!v||!v.dem)return;const k=v.dem,S=v.tileID,L=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=LN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,v&&(this.modelTraits|=LN.HasMapboxMeshFeatures),k&&(this.modelTraits|=LN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=S,this.worldview=R,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of u)this.nodesInfo.push(new P_e($)),E_e($,L.featureIndexArray.length,L.grid),L.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,L.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(c,u){for(const g of this.getNodesInfo()){const v=g.node;v.footprint&&u.push({footprint:v.footprint,id:c})}}updateAppearances(c,u,g,v){}update(c){const u=Object.keys(c).length!==0;if(u&&!this.stateDependentLayers.length)return;const g=u?this.stateDependentLayers:this.layers;if(!fo(c,this.states))for(const v of g)this.evaluate(v,c);this.states=structuredClone(c)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(c){if(!this.needsUpload)return;const u=this.getNodesInfo();for(const g of u){const v=g.node;this.uploaded?this.updatePbrBuffer(v):Zie(v,c,!0)}for(const g of u)h6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let u=!1;if(!c.meshes)return u;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),u=!0);return u}needsReEvaluation(c,u,g){const v=c.transform.projectionOptions,k=c.style.getBrightness(),S=this.brightness!==k;if(!this.uploaded||this.dirty||v.name!==this.projection.name||hM(g.paint.get("model-color").value,S)||hM(g.paint.get("model-color-mix-intensity").value,S)||hM(g.paint.get("model-roughness").value,S)||hM(g.paint.get("model-emissive-strength").value,S)||hM(g.paint.get("model-height-based-emissive-strength-multiplier").value,S)){this.projection=v,this.brightness=k;const L=this.getNodesInfo();for(const R of L)R.state=null;return!0}return!1}evaluateTransform(c,u){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const g=this.getNodesInfo(),v=this.id.canonical;for(const k of g){const S=k.feature;k.evaluatedTranslation=u.paint.get("model-translation").evaluate(S,{},v),k.evaluatedScale=u.paint.get("model-scale").evaluate(S,{},v)}}evaluate(c,u){const g=this.getNodesInfo();for(const v of g){if(!v.node.meshes)continue;const k=v.feature,S=u&&u[k.id];if(fo(S,v.state))continue;v.state=structuredClone(S);const L=v.node.meshes&&v.node.meshes[0].featureData,R=v.evaluatedColor[2],$=v.evaluatedRMEA[2],W=this.id.canonical;if(v.hasTranslucentParts=!1,L){for(let Z=0;Z=ot)continue;const ur=Noe[vr],pr=Math.abs(ur);pr>Rt&&(Kt=ur,Rt=pr,rr=xr,or=lr)}if(Rt>.1){const lr=1-(ot+.5*Math.abs(rr*or))/ne;let xr=u._dem.get(Ct,_t)+Kt*lr;const vr=u._dem.get(Ct+rr,_t+or),ur=u._dem.get(Ct-rr,_t-or,!0);(xr-vr)*(xr-ur)>0&&(xr=(vr+ur)/2),Noe[Et]=u._dem.set(Ct,_t,xr),r_[Et]=ot}}}}}L&&(u._demTile.needsDEMTextureUpload=!0,u._dem._timestamp=Uo.now())}setFilter(c){this.filter=c?sN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new ti(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const u of c)h6(u.node),Yie(u.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped());for(const v of this.getNodesInfo()){const k=v.node.footprint;v.hiddenByReplacement=!!k&&!g.find(S=>S.footprint===k)}}getHeightAtTileCoord(c,u){const g=[],v=[0,0,0],k=A([]);for(const S of this.getNodesInfo()){const L=S.node.meshes[0],R=L.transformedAabb;if(cR.max[0]||u>R.max[1])continue;if(S.node.hidden===!0)return{height:1/0,maxHeight:S.feature.properties.height,hidden:!1,verticalScale:S.evaluatedScale[2]};E(k,S.node.globalMatrix),v[0]=c,v[1]=u,Ke(v,v,k);const $=(v[0]-L.aabb.min[0])/(L.aabb.max[0]-L.aabb.min[0])*Jv|0,W=Math.min(63,(v[1]-L.aabb.min[1])/(L.aabb.max[1]-L.aabb.min[1])*Jv|0)*Jv+Math.min(63,$),Z=L.heightmap[W];if(!(Z<0&&S.node.footprint))return S.hiddenByReplacement?void 0:{height:Z,maxHeight:S.feature.properties.height,hidden:!1,verticalScale:S.evaluatedScale[2]};if(S.node.footprint.grid.query(new ir(c,u),new ir(c,u),g),g.length>0)return{height:void 0,maxHeight:S.feature.properties.height,hidden:S.hiddenByReplacement,verticalScale:S.evaluatedScale[2]}}}}function hM(f,c){return f instanceof qy&&!f.isLightConstant&&c}function LVe(f,c,u,g,v,k,S,L){let R=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,W=240&c|(240&c)>>4;u[3]>0&&(R=Fn(R,255*u[0],u[3]),$=Fn($,255*u[1],u[3]),W=Fn(W,255*u[2],u[3]));const Z=R<<8|$,X=W<<8|Math.floor(255*g[3]),re=function(ot){const _t=xe(ot,0,2);return Math.min(Math.round(.5*_t*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],ne=xe(v[0],0,1),fe=xe(v[1],0,1),Ne=xe(v[2],0,1),je=xe(v[3],0,1);let Re,$e,Ze,ht;if(ne!==fe&&S!==k&&fe!==ne){const ot=S-k;$e=1/(ot*(fe-ne)),Ze=-(k+ot*ne)/(ot*(fe-ne));const _t=xe(v[4],-1,1);ht=Math.pow(10,_t),Re=255*Ne<<8|255*je}else Re=65535,$e=0,Ze=1,ht=1;if(f.emplaceBack(Z,X,re,Re,$e,Ze,ht),L){const ot=L.length;L.clear();for(let _t=0;_t>16&65535,W=k?R>>16&65535:65535&R,Z=(15&W)<8?15&W:0,X=f.evaluatedRMEA[Z],re=f.evaluatedColor[Z],ne=f.emissionHeightBasedParams[Z];let fe;if(L&&Z===2&&g.lights&&(fe=new mN,fe.resize(10*g.lights.length)),LVe(S.featureArray,$,re,X,ne,S.aabb.min[2],S.aabb.max[2],fe),fe&&L){L=!1;const Ne=g.meshes[g.lightMeshIndex];Ne.featureArray=fe,Ne.featureArray._trim()}}S.featureArray._trim(),v++}}Yr(E6,"Tiled3dModelBucket",{omit:["layers"]}),Yr(P_e,"Tiled3dModelFeature");const DVe=["id","tile","layer","source","sourceLayer","state"];class n_{constructor(c,u,g,v,k){this.type="Feature",this._vectorTileFeature=c,this._z=u,this._x=g,this._y=v,this.properties=c?c.properties:{},this.id=k}clone(){const c=new n_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(c.state=Object.assign({},this.state)),this.layer&&(c.layer=Object.assign({},this.layer)),this.source&&(c.source=this.source),this.sourceLayer&&(c.sourceLayer=this.sourceLayer),c}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(c){this._geometry=c}toJSON(){const c={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const u of DVe)this[u]!==void 0&&(c[u]=this[u]);return c}}class s_ extends mi{constructor(c,u,g,v){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=u,this._modelsInfo=new Map}load(){const c=[];for(const u in this._options.models){const g=this._options.models[u],v=this._modelsInfo.get(u);if(v){const k=v.model;k.position=g.position!=null?new m(g.position[0],g.position[1]):new m(0,0),k.orientation=g.orientation!=null?g.orientation:[0,0,0],v.modelSpec=g,s_.applyModelSpecification(k,g),k.computeBoundsAndApplyParent(),this.models.push(k)}else{const k=eve(this.map._requestManager.transformRequest(g.uri,Hg.Model).url).then(S=>{if(!S)return;const L=Qie(S),R=new ave(u,g.uri,g.position,g.orientation,L);s_.applyModelSpecification(R,g),R.computeBoundsAndApplyParent(),this.models.push(R),this._modelsInfo.set(u,{modelSpec:g,model:R})}).catch(S=>{this.fire(new rs(new Error(`Could not load model ${u} from ${g.uri}: ${S.message}`)))});c.push(k)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(u=>{this._loaded=!0,this.fire(new rs(new Error(`Could not load models: ${u.message}`)))})}static applyModelSpecification(c,u){u.nodeOverrides&&s_.convertNodeOverrides(c,u.nodeOverrides),u.materialOverrides&&s_.convertMaterialOverrides(c,u.materialOverrides),u.nodeOverrideNames&&(c.nodeOverrideNames=[...u.nodeOverrideNames]),u.materialOverrideNames&&(c.materialOverrideNames=[...u.materialOverrideNames]),u.featureProperties&&(c.featureProperties=u.featureProperties)}static convertNodeOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of u)c.nodeOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={orientation:[0,0,0]};if(v.hasOwnProperty("orientation")){const S=v.orientation;S&&(k.orientation=S)}c.nodeOverrides.set(g,k)})}static convertMaterialOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of u)c.materialOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={color:new Sa(1,1,1),colorMix:0,emissionStrength:0,opacity:1},S=v["model-color"];S!==void 0&&(k.color.r=S[0],k.color.g=S[1],k.color.b=S[2]);const L=v["model-color-mix-intensity"];L!==void 0&&(k.colorMix=L);const R=v["model-emissive-strength"];R!==void 0&&(k.emissionStrength=R);const $=v["model-opacity"];$!==void 0&&(k.opacity=$),c.materialOverrides.set(g,k)})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,u){}serialize(){return this._options}setProperty(c,u){return!1}reload(){const c=Oh(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const u=new Map;for(const g in c){const v=c[g];if(this._modelsInfo.has(g)){const k=this._modelsInfo.get(g);k&&k.modelSpec.uri===v.uri&&u.set(g,k)}}this._modelsInfo=u,this._options.models=c,this._loaded=!1,this.load()}}function Soe(f,c,u,g){const v=1<Ze.polygon).flat());const Ne=re?L:null,[je,Re]=U1e(k,g,Z,W,$,S,Ne,X,ne,k.center.lat,f.tileID.canonical),$e=f.queryGeometry;return $1e(je,Re,$e.isPointQuery()?$e.screenBounds:$e.screenGeometry)}},building:class extends nd{constructor(f,c,u,g){super(f,{layout:hve||(hve=new Wi({visibility:new kr(Ft.layout_building.visibility),"building-facade":new Er(Ft.layout_building["building-facade"]),"building-facade-floors":new Er(Ft.layout_building["building-facade-floors"]),"building-facade-unit-width":new Er(Ft.layout_building["building-facade-unit-width"]),"building-facade-window":new Er(Ft.layout_building["building-facade-window"]),"building-roof-shape":new Er(Ft.layout_building["building-roof-shape"]),"building-height":new Er(Ft.layout_building["building-height"]),"building-base":new Er(Ft.layout_building["building-base"]),"building-flood-light-wall-radius":new Er(Ft.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Er(Ft.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Er(Ft.layout_building["building-flip-roof-orientation"])})),paint:fve||(fve=new Wi({"building-opacity":new kr(Ft.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new kr(Ft.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new kr(Ft.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new kr(Ft.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new kr(Ft.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new kr(Ft.paint_building["building-vertical-scale"]),"building-cast-shadows":new kr(Ft.paint_building["building-cast-shadows"]),"building-color":new Er(Ft.paint_building["building-color"]),"building-emissive-strength":new Er(Ft.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new kr(Ft.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new kr(Ft.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new kr(Ft.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new kr(Ft.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new kr(Ft.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"})}))},c,u,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new uve(f)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(f){return!0}queryRadius(f){return 0}queryIntersectsFeature(f,c,u,g,v,k,S,L,R){let $=this.layout.get("building-height").evaluate(c,u);const W=this.layout.get("building-base").evaluate(c,u),Z=f.tile.getBucket(this).getFootprint(c);if(Z){if(Z.hiddenFlags!==0)return!1;$=Z.height}const[X,re]=U1e(k,g,W,$,new ir(0,0),S,null,[0,0],1,k.center.lat,f.tileID.canonical),ne=f.queryGeometry;return $1e(X,re,ne.isPointQuery()?ne.screenBounds:ne.screenGeometry)}},line:class extends nd{constructor(f,c,u,g){const v=jve();super(f,v,c,u,g),v.layout&&(this.layout=new rx(v.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(f){if(f==="line-gradient"){const c=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=c._styleExpression&&c._styleExpression.expression instanceof Mv,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(f,c){super.recalculate(f,c),this.paint._values["line-floorwidth"]=(()=>{if(X5)return X5;const u=jve();return X5=new Iqe(u.paint.properties["line-width"].specification),X5.useIntegerZoom=!0,X5})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new toe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,u){const g=bve(this);return{config:new Wm(this,{zoom:c,lut:u}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,u=kve(wc("line-width",this,c),wc("line-gap-width",this,c)),g=wc("line-offset",this,c);return u/2+Math.abs(g)+Ul(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,u,g,v,k){if(f.queryGeometry.isAboveHorizon)return!1;const S=ku(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,f.pixelToTileUnitsFactor),L=f.pixelToTileUnitsFactor/2*kve(this.paint.get("line-width").evaluate(c,u),this.paint.get("line-gap-width").evaluate(c,u)),R=this.paint.get("line-offset").evaluate(c,u);return R&&(g=function($,W){const Z=[],X=new ir(0,0);for(let re=0;re<$.length;re++){const ne=$[re],fe=[];for(let Ne=0;Ne=3){for(let ne=0;ne>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function XVe(f,c,u){f===1?(c.rgb_color=O6(u.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=u.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=u.readVarint(),c.paint="radial_gradient_idx"):f===5?u.readPackedFloat(c.dasharray):f===6?c.dashoffset=u.readFloat():f===7?c.miterlimit=u.readFloat():f===8?c.opacity=u.readVarint():f===9?c.width=u.readFloat():f===10?c.linecap=u.readVarint():f===11&&(c.linejoin=u.readVarint())}function QVe(f,c,u){f===1?c.transform=L6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(R_e(u,u.readVarint()+u.pos)):f===4?c.x1=u.readFloat():f===5?c.y1=u.readFloat():f===6?c.x2=u.readFloat():f===7&&(c.y2=u.readFloat())}function R_e(f,c){return f.readFields(JVe,{offset:0,opacity:255,rgb_color:Coe},c)}function JVe(f,c,u){f===1?c.offset=u.readFloat():f===2?c.opacity=u.readVarint():f===3&&(c.rgb_color=O6(u.readVarint()))}function eHe(f,c,u){f===1?c.transform=L6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(R_e(u,u.readVarint()+u.pos)):f===4?c.cx=u.readFloat():f===5?c.cy=u.readFloat():f===6?c.r=u.readFloat():f===7?c.fx=u.readFloat():f===8?c.fy=u.readFloat():f===9&&(c.fr=u.readFloat())}function tHe(f,c,u){f===1?c.transform=L6(u,u.readVarint()+u.pos):f===2?c.clip_path_idx=u.readVarint():f===3&&c.children.push(P6(u,u.readVarint()+u.pos))}function rHe(f,c,u){f===1?c.left=c.top=u.readFloat():f===2?c.width=c.height=u.readFloat():f===3?c.top=u.readFloat():f===4?c.height=u.readFloat():f===5?c.mask_type=u.readVarint():f===6?c.mask_idx=u.readVarint():f===7&&c.children.push(P6(u,u.readVarint()+u.pos))}class nHe{static calculate(c={},u=[]){const g=new Map,v=new Map;if(Object.keys(c).length===0)return g;u.forEach(k=>{v.set(k.name,k.rgb_color||new Sa(0,0,0))});for(const[k,S]of Object.entries(c))v.has(k)?g.set(v.get(k).toString(),S):console.warn(`Ignoring unknown image variable "${k}"`);return g}}function VN(f,c=255,u){const g=c/255,v=f.toString(),k=u.has(v)?u.get(v).clone():f.clone();return k.a*=g,k.toString()}function pM(f,c){if(!Zu()){const u=document.createElement("canvas");return u.width=f,u.height=c,u}return new OffscreenCanvas(f,c)}let Aoe,mM=null;function Eoe(f,c,u,g,v){for(const k of g.children)F_e(f,c,u,k,v)}function F_e(f,c,u,g,v){g.group?(f.save(),function(k,S,L,R,$){const W=R.mask_idx!=null?L.masks[R.mask_idx]:null,Z=R.clip_path_idx!=null?L.clip_paths[R.clip_path_idx]:null;if(R.transform&&(S=HN(R.transform).preMultiplySelf(S)),!function(ne,fe,Ne){return ne.opacity!==255||fe||Ne}(R,Z!=null,W!=null))return void Eoe(k,S,L,R,$);const X=pM(k.canvas.width,k.canvas.height),re=X.getContext("2d");Eoe(re,S,L,R,$),Z&&H_e(re,S,L,Z),W&&W_e(re,S,L,W,$),k.globalAlpha=R.opacity/255,k.drawImage(X,0,0)}(f,c,u,g.group,v),f.restore()):g.path&&(f.save(),function(k,S,L,R,$){k.setTransform(S),R.paint_order===zVe.PAINT_ORDER_FILL_AND_STROKE?(z_e(k,L,R,$),$_e(k,L,R,$)):($_e(k,L,R,$),z_e(k,L,R,$))}(f,c,u,g.path,v),f.restore())}function z_e(f,c,u,g){const v=u.fill;if(!v)return;const k=v.opacity/255;switch(f.save(),f.beginPath(),G_e(u,f),v.paint){case"rgb_color":f.fillStyle=VN(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":{const S=c.linear_gradients[v.linear_gradient_idx];S.transform&&f.setTransform(HN(S.transform).preMultiplySelf(f.getTransform())),f.fillStyle=U_e(f,S,k,g);break}case"radial_gradient_idx":{const S=c.radial_gradients[v.radial_gradient_idx];S.transform&&f.setTransform(HN(S.transform).preMultiplySelf(f.getTransform())),f.fillStyle=q_e(f,S,k,g)}}f.fill(B_e(u)),f.restore()}function B_e(f){return f.rule===Moe.PATH_RULE_NON_ZERO?"nonzero":f.rule===Moe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function $_e(f,c,u,g){const v=u.stroke;if(!v)return;const k=K_e(u);f.lineWidth=v.width,f.miterLimit=v.miterlimit,f.setLineDash(v.dasharray),f.lineDashOffset=v.dashoffset;const S=v.opacity/255;switch(v.paint){case"rgb_color":f.strokeStyle=VN(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=U_e(f,c.linear_gradients[v.linear_gradient_idx],S,g,!0);break;case"radial_gradient_idx":f.strokeStyle=q_e(f,c.radial_gradients[v.radial_gradient_idx],S,g,!0)}switch(v.linejoin){case I6.LINE_JOIN_MITER_CLIP:case I6.LINE_JOIN_MITER:f.lineJoin="miter";break;case I6.LINE_JOIN_ROUND:f.lineJoin="round";break;case I6.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(v.linecap){case Toe.LINE_CAP_BUTT:f.lineCap="butt";break;case Toe.LINE_CAP_ROUND:f.lineCap="round";break;case Toe.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(k)}function U_e(f,c,u,g,v=!1){if(c.stops.length===1){const X=c.stops[0];return VN(X.rgb_color,X.opacity*u,g)}const{x1:k,y1:S,x2:L,y2:R}=c;let $=new DOMPoint(k,S),W=new DOMPoint(L,R);if(v){const X=HN(c.transform);$=X.transformPoint($),W=X.transformPoint(W)}const Z=f.createLinearGradient($.x,$.y,W.x,W.y);for(const X of c.stops)Z.addColorStop(X.offset,VN(X.rgb_color,X.opacity*u,g));return Z}function q_e(f,c,u,g,v=!1){if(c.stops.length===1){const je=c.stops[0];return VN(je.rgb_color,je.opacity*u,g)}const k=HN(c.transform),{fx:S,fy:L,fr:R,cx:$,cy:W,r:Z}=c;let X=new DOMPoint(S,L),re=new DOMPoint($,W),ne=R,fe=Z;if(v){X=k.transformPoint(X),re=k.transformPoint(re);const je=(k.a+k.d)/2;ne=R*je,fe=c.r*je}const Ne=f.createRadialGradient(X.x,X.y,ne,re.x,re.y,fe);for(const je of c.stops)Ne.addColorStop(je.offset,VN(je.rgb_color,je.opacity*u,g));return Ne}function V_e(f,c,u,g){const v=g.transform?HN(g.transform).preMultiplySelf(c):c,k=pM(f.canvas.width,f.canvas.height),S=k.getContext("2d");for(const R of g.children)if(R.group)V_e(S,v,u,R.group);else if(R.path){const $=R.path,W=new Path2D;W.addPath(K_e($),v),S.fill(W,B_e($))}const L=g.clip_path_idx!=null?u.clip_paths[g.clip_path_idx]:null;L&&H_e(S,v,u,L),f.globalCompositeOperation="source-over",f.drawImage(k,0,0)}function H_e(f,c,u,g){const v=pM(f.canvas.width,f.canvas.height);V_e(v.getContext("2d"),c,u,g),f.globalCompositeOperation="destination-in",f.drawImage(v,0,0)}function W_e(f,c,u,g,v){if(g.children.length===0)return;const k=g.mask_idx!=null?u.masks[g.mask_idx]:null;k&&W_e(f,c,u,k,v);const S=f.canvas.width,L=f.canvas.height,R=pM(S,L),$=R.getContext("2d"),W=g.width,Z=g.height,X=g.left,re=g.top,ne=new Path2D,fe=new Path2D;fe.rect(X,re,W,Z),ne.addPath(fe,c),$.clip(ne);for(const Re of g.children)F_e($,c,u,Re,v);const Ne=$.getImageData(0,0,S,L),je=Ne.data;if(g.mask_type===L_e.MASK_TYPE_LUMINANCE)for(let Re=0;Rec[S])return null}else{const L=1/g[S];let R=(f[S]-u[S])*L,$=(c[S]-u[S])*L;if(R>$){const W=R;R=$,$=W}if(R>v&&(v=R),$k)return null}return v}function X_e(f,c,u,g,v,k,S,L,R,$,W){const Z=g-f,X=v-c,re=k-u,ne=S-f,fe=L-c,Ne=R-u,je=W[1]*Ne-W[2]*fe,Re=W[2]*ne-W[0]*Ne,$e=W[0]*fe-W[1]*ne,Ze=Z*je+X*Re+re*$e;if(Math.abs(Ze)<1e-15)return null;const ht=1/Ze,ot=$[0]-f,_t=$[1]-c,Ct=$[2]-u,Et=(ot*je+_t*Re+Ct*$e)*ht;if(Et<0||Et>1)return null;const Kt=_t*re-Ct*X,Rt=Ct*Z-ot*re,rr=ot*X-_t*Z,or=(W[0]*Kt+W[1]*Rt+W[2]*rr)*ht;return or<0||Et+or>1?null:(ne*Kt+fe*Rt+Ne*rr)*ht}function Q_e(f,c,u){return(f-c)/(u-c)}function J_e(f,c,u,g,v,k,S,L,R){const $=1<{const Re=Ne?1:0,$e=(re+1)*fe-Re,Ze=ne*fe,ht=(ne+1)*fe-Re;je[0]=re*fe,je[1]=Ze,je[2]=$e,je[3]=ht};let Z=new Z_e(R);const X=[];for(let re=0;re=1;R/=2){const re=L[L.length-1];Z=new Z_e(R);for(let ne=0;ne0;){const{idx:ne,t:fe,nodex:Ne,nodey:je,depth:Re}=re.pop();if(this.leaves[ne]){J_e(Ne,je,Re,c,u,g,v,Z,X);const Ze=1<=vr[2])return fe}continue}let $e=0;for(let Ze=0;Ze=$[W[Ct]]&&(W.splice(Ct,0,Ze),_t=!0);_t||(W[$e]=Ze),$e++}}for(let Ze=0;Ze<$e;Ze++){const ht=W[Ze];re.push({idx:this.childOffsets[ne]+ht,t:$[ht],nodex:(Ne<<1)+this._siblingOffset[ht][0],nodey:(je<<1)+this._siblingOffset[ht][1],depth:Re+1})}}return null}_addNode(c,u,g){return this.minimums.push(c),this.maximums.push(u),this.leaves.push(g),this.childOffsets.push(0),this.nodeCount++}_construct(c,u,g,v,k){if(c[v].isLeaf(u,g)===1)return;this.childOffsets[k]||(this.childOffsets[k]=this.nodeCount);const S=v-1,L=c[S];let R=0,$=0;for(let W=0;W=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+(c+1)}static pack(c,u){const g=[0,0,0,0],v=R6.getUnpackVector(u);let k=Math.floor((c+v[3])/v[2]);return g[2]=k%256,k=Math.floor(k/256),g[1]=k%256,k=Math.floor(k/256),g[0]=k,g}getPixels(){return new Z0e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,u,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let v=u*this.dim,k=u*this.dim+this.dim,S=g*this.dim,L=g*this.dim+this.dim;switch(u){case-1:v=k-1;break;case 1:k=v+1}switch(g){case-1:S=L-1;break;case 1:L=S+1}const R=-u*this.dim,$=-g*this.dim;for(let W=S;W=1;g--){const v=g===1?1:0,k=g===2?1:0;for(let S=0;S>>1^-(1&f[c]);return f}function xHe(f,c){switch(c){case"uint32":return f;case"uint16":for(let u=0;u>4|(61440&g)>>8|(240&v)<<4|61440&v,f[u+1]=15&g|(3840&g)>>4|(15&v)<<8|(3840&v)<<4}return f;case"uint8":for(let u=0;u>6|(192&v)>>4|(192&k)>>2|192&S,f[u+1]=(48&g)>>4|(48&v)>>2|48&k|(48&S)<<2,f[u+2]=(12&g)>>2|12&v|(12&k)<<2|(12&S)<<4,f[u+3]=3&g|(3&v)<<2|(3&k)<<4|(3&S)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}Yr(R6,"DEMData"),Yr(e2e,"DemMinMaxQuadTree",{omit:["dem"]});var zh=Uint8Array,gM=Uint16Array,yHe=Int32Array,r2e=new zh([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]),n2e=new zh([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]),vHe=new zh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s2e=function(f,c){for(var u=new gM(31),g=0;g<31;++g)u[g]=c+=1<>1|(21845&al)<<1;o2e[al]=((65280&(WN=(61680&(WN=(52428&WN)>>2|(13107&WN)<<2))>>4|(3855&WN)<<4))>>8|(255&WN)<<8)>>1}var xM=function(f,c,u){for(var g=f.length,v=0,k=new gM(c);v>R]=$;return S},yM=new zh(288);for(al=0;al<144;++al)yM[al]=8;for(al=144;al<256;++al)yM[al]=9;for(al=256;al<280;++al)yM[al]=7;for(al=280;al<288;++al)yM[al]=8;var l2e=new zh(32);for(al=0;al<32;++al)l2e[al]=5;var wHe=xM(yM,9),jHe=xM(l2e,5),Poe=function(f){for(var c=f[0],u=1;uc&&(c=f[u]);return c},Rp=function(f,c,u){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&u},Loe=function(f,c){var u=c/8|0;return(f[u]|f[u+1]<<8|f[u+2]<<16)>>(7&c)},kHe=["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"],Fp=function(f,c,u){var g=new Error(c||kHe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Fp),!u)throw g;return g},NHe=new zh(0),SHe=typeof TextDecoder<"u"&&new TextDecoder;try{SHe.decode(NHe,{stream:!0})}catch{}const CHe={gzip_data:"gzip"};class Mf extends Error{constructor(c){super(c),this.name="MRTError"}}const MHe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},c2e={uint32:1,uint16:2,uint8:4},THe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Ooe;class F6{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const u=this.layers[c];if(!u)throw new Mf(`Layer '${c}' not found`);return u}getHeaderLength(c){const u=new Uint8Array(c),g=new DataView(c);if(u[0]!==13)throw new Mf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const u=new Uint8Array(c),g=this.getHeaderLength(c);if(u.length= ${g} but got buffer of length ${u.length}`);const v=new Ooe(u.subarray(0,g)).readFields(oHe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==v.x||this.y!==v.y||this.z!==v.z))throw new Mf(`Invalid attempt to parse header ${v.z}/${v.x}/${v.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=v.x,this.y=v.y,this.z=v.z;for(const k of v.layers)this.layers[k.name]=new d2e(k,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const u=[],g=this.getLayer(c.layerName);for(let v of c.blockIndices){const k=g.dataIndex[v],S=k.firstByte-c.firstByte,L=k.lastByte-c.firstByte;if(g._blocksInProgress.has(v))continue;const R={layerName:g.name,firstByte:S,lastByte:L,pixelFormat:g.pixelFormat,blockIndex:v,blockShape:[k.bands.length].concat(g.bandShape),buffer:g.buffer,codec:k.codec.codec,filters:k.filters.map($=>$.filter)};g._blocksInProgress.add(v),u.push(R)}return new u2e(u,()=>{u.forEach(v=>g._blocksInProgress.delete(v.blockIndex))},(v,k)=>{if(u.forEach(S=>g._blocksInProgress.delete(S.blockIndex)),v)throw v;k.forEach(S=>{this.getLayer(S.layerName).processDecodedData(S)})})}}class d2e{constructor({version:c,name:u,units:g,tileSize:v,pixelFormat:k,buffer:S,dataIndex:L},R){if(this.version=c,this.version!==1)throw new Mf(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=u,this.units=g,this.tileSize=v,this.buffer=S,this.pixelFormat=MHe[k],this.dataIndex=L,this.bandShape=[v+2*S,v+2*S,c2e[this.pixelFormat]],this._decodedBlocks=new D6(R?R.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return c2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const u=c.blockIndex.toString();this._decodedBlocks.get(u)||this._decodedBlocks.put(u,c.data)}getBlockForBand(c){let u=0;switch(typeof c){case"string":for(const[g,v]of this.dataIndex.entries()){for(const[k,S]of v.bands.entries())if(S===c)return{bandIndex:u+k,blockIndex:g,blockBandIndex:k};u+=v.bands.length}break;case"number":for(const[g,v]of this.dataIndex.entries()){if(c>=u&&cthis.cacheSize)throw new Mf(`Number of blocks to decode (${k.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:u,lastByte:g,blockIndices:v}}hasBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0}hasDataForBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0&&!!this._decodedBlocks.get(u.toString())}getBandView(c){const{blockIndex:u,blockBandIndex:g}=this.getBlockForBand(c);if(u<0)throw new Mf(`Band not found: ${JSON.stringify(c)}`);const v=this._decodedBlocks.get(u.toString());if(!v)throw new Mf(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const k=this.dataIndex[u],S=this.bandShape.reduce(($,W)=>$*W,1),L=g*S,R=v.subarray(L,L+S);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:k.offset,scale:k.scale}}}F6.setPbf=function(f){Ooe=f};class u2e{constructor(c,u,g){this.tasks=c,this._onCancel=u,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,u){this._finalized||(this._onComplete(c,u),this._finalized=!0)}}F6.performDecoding=function(f,c){const u=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:v,firstByte:k,lastByte:S,pixelFormat:L,blockShape:R,blockIndex:$,filters:W,codec:Z}=g,X=u.subarray(k,S+1),re=new Uint32Array(R[0]*R[1]*R[2]);let ne;if(Z!=="gzip_data")throw new Mf(`Unhandled codec: ${Z}`);return ne=function(fe,Ne){if(!globalThis.DecompressionStream&&Ne==="gzip_data")return Promise.resolve(((Ze=function(_t){_t[0]==31&&_t[1]==139&&_t[2]==8||Fp(6,"invalid gzip data");var Ct=_t[3],Et=10;4&Ct&&(Et+=2+(_t[10]|_t[11]<<8));for(var Kt=(Ct>>3&1)+(Ct>>4&1);Kt>0;Kt-=!_t[Et++]);return Et+(2&Ct)}($e=fe))+8>$e.length&&Fp(6,"invalid gzip data"),function(_t,Ct,Et,Kt){var Rt=_t.length;if(!Rt||Ct.f&&!Ct.l)return Et||new zh(0);var rr=!Et,or=rr||Ct.i!=2,lr=Ct.i;rr&&(Et=new zh(3*Rt));var xr,vr,ur=function($a){var pa=Et.length;if($a>pa){var _a=new zh(Math.max(2*pa,$a));_a.set(Et),Et=_a}},pr=Ct.f||0,tr=Ct.p||0,Xt=Ct.b||0,mr=Ct.l,Mr=Ct.d,wr=Ct.m,un=Ct.n,Br=8*Rt;do{if(!mr){pr=Rp(_t,tr,1);var Kr=Rp(_t,tr+1,3);if(tr+=3,!Kr){var tn=_t[(nr=4+((tr+7)/8|0))-4]|_t[nr-3]<<8,gs=nr+tn;if(gs>Rt){lr&&Fp(0);break}or&&ur(Xt+tn),Et.set(_t.subarray(nr,gs),Xt),Ct.b=Xt+=tn,Ct.p=tr=8*gs,Ct.f=pr;continue}if(Kr==1)mr=wHe,Mr=jHe,wr=9,un=5;else if(Kr==2){var jr=Rp(_t,tr,31)+257,rn=Rp(_t,tr+10,15)+4,qn=jr+Rp(_t,tr+5,31)+1;tr+=14;for(var Fs=new zh(qn),$s=new zh(19),ns=0;ns>4)<16)Fs[ns++]=nr;else{var Or=0,Dr=0;for(nr==16?(Dr=3+Rp(_t,tr,3),tr+=2,Or=Fs[ns-1]):nr==17?(Dr=3+Rp(_t,tr,7),tr+=3):nr==18&&(Dr=11+Rp(_t,tr,127),tr+=7);Dr--;)Fs[ns++]=Or}}var hn=Fs.subarray(0,jr),vn=Fs.subarray(jr);wr=Poe(hn),un=Poe(vn),mr=xM(hn,wr),Mr=xM(vn,un)}else Fp(1);if(tr>Br){lr&&Fp(0);break}}or&&ur(Xt+131072);for(var Jn=(1<>4;if((tr+=15&Or)>Br){lr&&Fp(0);break}if(Or||Fp(2),As<256)Et[Xt++]=As;else{if(As==256){ms=tr,mr=null;break}var Ln=As-254;As>264&&(Ln=Rp(_t,tr,(1<<(oa=r2e[ns=As-257]))-1)+i2e[ns],tr+=oa);var Un=Mr[Loe(_t,tr)&cs],na=Un>>4;if(Un||Fp(3),tr+=15&Un,vn=bHe[na],na>3){var oa=n2e[na];vn+=Loe(_t,tr)&(1<Br){lr&&Fp(0);break}or&&ur(Xt+131072);var la=Xt+Ln;if(Xtxr.length)&&(vr=xr.length),new zh(xr.subarray(0,vr))):Et.subarray(0,Xt)}($e.subarray(Ze,-8),{i:2},new zh(((je=$e)[(Re=je.length)-4]|je[Re-3]<<8|je[Re-2]<<16|je[Re-1]<<24)>>>0))));var je,Re,$e,Ze;const ht=CHe[Ne];if(!ht)throw new Error(`Unhandled codec: ${Ne}`);const ot=new globalThis.DecompressionStream(ht);return new Response(new Blob([fe]).stream().pipeThrough(ot)).arrayBuffer().then(_t=>new Uint8Array(_t))}(X,Z).then(fe=>(function(Ne,je){Ne.readFields(fHe,je)}(new Ooe(fe),re),new THe[L](re.buffer))),ne.then(fe=>{for(let Ne=W.length-1;Ne>=0;Ne--)switch(W[Ne]){case"delta_filter":mHe(fe,R);break;case"zigzag_filter":gHe(fe);break;case"bitshuffle_filter":xHe(fe,L);break;default:throw new Mf(`Unhandled filter "${W[Ne]}"`)}return{layerName:v,blockIndex:$,data:fe}}).catch(fe=>{throw fe})}))},Yr(u2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Yr(F6,"MapboxRasterTile"),Yr(d2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class h2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let u=0;u=0&&X[3]>=0&&$.insert(R,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new $t(new p6(this.rawTileData)).layers,this.sourceLayerCoder=new h2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,u){const{tilespaceGeometry:g,transform:v,tileTransform:k,pixelPosMatrix:S,availableImages:L,worldview:R}=u;this.loadVTLayers(),this.serializedLayersCache.clear();const $=u.queryRadius?u.queryRadius:0,W=g.bufferedTilespaceBounds,Z=this.grid.query(W.min.x,W.min.y,W.max.x,W.max.y,(fe,Ne,je,Re)=>sd(g.bufferedTilespaceGeometry,fe-$,Ne-$,je+$,Re+$));Z.sort(AHe);let X=null;v.elevation&&Z.length>0&&(X=qN.create(v.elevation,this.tileID));const re={};let ne;for(let fe=0;fe(Re||(Re=St($e,this.tileID.canonical,k)),Ze.queryIntersectsFeature(g,$e,ht,Re,this.z,v,S,X,ot)))}return re}loadMatchingFeature(c,u,g,v,k,S){const{featureIndex:L,bucketIndex:R,sourceLayerIndex:$,layoutVertexArrayOffset:W}=u,Z=this.bucketLayerIDs[R],X=g.layers,re=Object.keys(X);if(re.length&&!Wr(re,Z))return;const ne=g.sourceCache,fe=this.sourceLayerCoder.decode($),Ne=this.vtLayers[fe].feature(L),je=this.getId(Ne,fe);for(let Re=0;Re`${L.key}: ${L.message}`).join(", ");return void Ur(`Failed to create expression for promoteId: ${S}`)}this.promoteIdExpression=k.value}g=this.promoteIdExpression.evaluate({zoom:0},c)}else g=c.properties[v];typeof g=="boolean"&&(g=Number(g))}return g}}function p2e(f,c,u,g,v){return Ut(f,(k,S)=>{const L=c instanceof rx?c.get(S):null;return L&&L.evaluate?L.evaluate(u,g,void 0,v):L})}function AHe(f,c){return c-f}Yr(f2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const m2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Doe{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(c,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const v=g>>4;if(v!==1)throw new Error(`Got v${v} data when expected v1.`);const k=m2e[15&g];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(c,2,1),[L]=new Uint32Array(c,4,1);return new Doe(L,S,k,c)}constructor(c,u=64,g=Float64Array,v){if(isNaN(c)||c<0)throw new Error(`Unpexpected numItems value: ${c}.`);this.numItems=+c,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const k=m2e.indexOf(this.ArrayType),S=2*c*this.ArrayType.BYTES_PER_ELEMENT,L=c*this.IndexArrayType.BYTES_PER_ELEMENT,R=(8-L%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${g}.`);v&&v instanceof ArrayBuffer?(this.data=v,this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+R,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+S+L+R),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+R,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=c)}add(c,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=u,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return Roe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,u,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:L}=this,R=[0,k.length-1,0],$=[];for(;R.length;){const W=R.pop()||0,Z=R.pop()||0,X=R.pop()||0;if(Z-X<=L){for(let Ne=X;Ne<=Z;Ne++){const je=S[2*Ne],Re=S[2*Ne+1];je>=c&&je<=g&&Re>=u&&Re<=v&&$.push(k[Ne])}continue}const re=X+Z>>1,ne=S[2*re],fe=S[2*re+1];ne>=c&&ne<=g&&fe>=u&&fe<=v&&$.push(k[re]),(W===0?c<=ne:u<=fe)&&(R.push(X),R.push(re-1),R.push(1-W)),(W===0?g>=ne:v>=fe)&&(R.push(re+1),R.push(Z),R.push(1-W))}return $}within(c,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:k,nodeSize:S}=this,L=[0,v.length-1,0],R=[],$=g*g;for(;L.length;){const W=L.pop()||0,Z=L.pop()||0,X=L.pop()||0;if(Z-X<=S){for(let Ne=X;Ne<=Z;Ne++)x2e(k[2*Ne],k[2*Ne+1],c,u)<=$&&R.push(v[Ne]);continue}const re=X+Z>>1,ne=k[2*re],fe=k[2*re+1];x2e(ne,fe,c,u)<=$&&R.push(v[re]),(W===0?c-g<=ne:u-g<=fe)&&(L.push(X),L.push(re-1),L.push(1-W)),(W===0?c+g>=ne:u+g>=fe)&&(L.push(re+1),L.push(Z),L.push(1-W))}return R}}function Roe(f,c,u,g,v,k){if(v-g<=u)return;const S=g+v>>1;g2e(f,c,S,g,v,k),Roe(f,c,u,g,S-1,1-k),Roe(f,c,u,S+1,v,1-k)}function g2e(f,c,u,g,v,k){for(;v>g;){if(v-g>600){const $=v-g+1,W=u-g+1,Z=Math.log($),X=.5*Math.exp(2*Z/3),re=.5*Math.sqrt(Z*X*($-X)/$)*(W-$/2<0?-1:1);g2e(f,c,u,Math.max(g,Math.floor(u-W*X/$+re)),Math.min(v,Math.floor(u+($-W)*X/$+re)),k)}const S=c[2*u+k];let L=g,R=v;for(vM(f,c,g,u),c[2*v+k]>S&&vM(f,c,g,v);LS;)R--}c[2*g+k]===S?vM(f,c,g,R):(R++,vM(f,c,R,v)),R<=u&&(g=R+1),u<=R&&(v=R-1)}}function vM(f,c,u,g){Foe(f,u,g),Foe(c,2*u,2*g),Foe(c,2*u+1,2*g+1)}function Foe(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function x2e(f,c,u,g){const v=f-u,k=c-g;return v*v+k*k}i.$=jk,i.A=yp,i.B=Oh,i.C=2,i.D=AN,i.E=mi,i.F=eM,i.G=qve,i.H=wk,i.I=xl,i.J=AP,i.K=dn,i.L=Ey,i.M=Gk,i.N=Pv,i.O=xP,i.P=ir,i.Q=Lv,i.R=Hg,i.S=nN,i.T=Wie,i.U=$m,i.V=A6,i.W=o5,i.X=Dy,i.Y=Oy,i.Z=Cv,i._=td,i.a=function(f){return Ss.API_CDN_URL_REGEX.test(f)},i.a$=ce,i.a0=$n,i.a1=Wd,i.a2=jf,i.a3=class extends A6{},i.a4=Kk,i.a5=gP,i.a6=Ft,i.a7=function(f){const c=f.value;return c?$n(c)?joe(c,!0)?[]:[new A6(f.key,c,`invalid url "${c}"`)]:[new A6(f.key,c,`string expected, "${dn(c)}" found`)]:[]},i.a8=SP,i.a9=Wi,i.aA=xe,i.aB=T,i.aC=gt,i.aD=_c,i.aE=Ha,i.aF=B,i.aG=We,i.aH=function(f,c){const u={};for(let g=0;g{g(k,S)},c):g(k,S),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=u((k,S)=>{v.result=[k,S];for(const L of v.callbacks)this.scheduler?this.scheduler.add(()=>{L(k,S)},c):L(k,S);setTimeout(()=>delete this.entries[f],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(k=>k!==g),v.callbacks.length||(v.cancel(),delete this.entries[f]))}}},i.aL=function(f,c,u){const g=JSON.stringify(f.request);return f.data&&(this.deduped.entries[g]={result:[null,f.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:f.isSymbolTile,zoom:f.tileZoom},v=>{const k=Th(f.request,(S,L,R)=>{S?v(S):L&&v(null,{rawData:L,vectorTile:u?void 0:new $t(new p6(L)),responseHeaders:new Map(R.entries())})});return()=>{k.cancel(),v()}},c)},i.aM=function(f){return f?{cacheControl:f.get("Cache-Control"),expires:f.get("Expires")}:{cacheControl:void 0,expires:void 0}},i.aN=Qc,i.aO=function(f){_o++,_o>Ny&&(f.getActor().send("enforceCacheSizeLimit",ky),_o=0)},i.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},i.aQ=Ui,i.aR=y_e,i.aS=k_e,i.aT=m,i.aU=x_e,i.aV=function(f,c){const u=document.createElement("video");u.muted=!0,u.onloadstart=function(){c(null,u)};for(let g=0;g{}}},i.aW=Z5,i.aX=s_,i.aY=Pt,i.aZ=sM,i.a_=Q,i.aa=kr,i.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return Yn(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u),azimuthal:Fn(f.azimuthal,c.azimuthal,u),polar:Fn(f.polar,c.polar,u)}}},i.ac=ti,i.ad=Jg,i.ae=Ve,i.af=Ke,i.ag=pe,i.ah=Ie,i.ai=rx,i.aj=t0,i.ak=Fn,i.al=Sr,i.am=A3,i.an=ss,i.ao=Sa,i.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([u,g]){const v=Yn([1,u,g]);return{x:v.x,y:v.y,z:v.z}}(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u)}}},i.aq=function(f,c,u=0,g=!0){const v=new ir(u,u),k=f.sub(v),S=c.add(v),L=[k,new ir(S.x,k.y),S,new ir(k.x,S.y)];return g&&L.push(k.clone()),L},i.ar=function(f,c){const u=[];for(let g=0;g1)return!1;const u=c.getSource().maxzoom,g=1<1)return c;const v=g.getSource().maxzoom,k=1<{const L=this.getAtTileOffset(f,v,k,S),R=g.upVector(f.canonical,v.x,v.y);return ge(R,R,L*g.upVectorScale(f.canonical,c,u).metersToTile),R}}getForTilePoints(f,c,u,g){if(this.isUsingMockSource())return!1;const v=qN.create(this,f,g);return!!v&&(c.forEach(k=>{k[2]=this.exaggeration()*v.getElevationAt(k[0],k[1],u)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const u=c.dem.tree,g=c.tileID,v=1<0&&(g+=(f[v]-0)*(f[v]-0)),c[v]<0&&(g+=(0-c[v])*(0-c[v]));return g},i.c0=y1e,i.c1=ooe,i.c2=Yve,i.c3=moe,i.c4=Doe,i.c5=ge,i.c6=qe,i.c7=Mt,i.c8=function(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],L=Math.sin(u),R=Math.cos(u);return f[0]=g*R+v*L,f[1]=v*R-g*L,f[2]=k*R+S*L,f[3]=S*R-k*L,f},i.c9=wt,i.cA=ye,i.cB=fa,i.cC=rve,i.cD=Wa,i.cE=P0e,i.cF=function(f,c,u,g,v,k,S,L,R){if(R.name==="globe")return P0e(f,c,new Wa(u,g,v),!1);const $=sM({z:u,x:g,y:v},R);return new ln([(k+$.x/$.scale)*c,c*($.y/$.scale),S],[(k+$.x2/$.scale)*c,c*($.y2/$.scale),L])},i.cG=function(f,c,u){return f[0]=Math.min(c[0],u[0]),f[1]=Math.min(c[1],u[1]),f[2]=Math.min(c[2],u[2]),f[3]=Math.min(c[3],u[3]),f},i.cH=function(f,c,u){return f[0]=Math.max(c[0],u[0]),f[1]=Math.max(c[1],u[1]),f[2]=Math.max(c[2],u[2]),f[3]=Math.max(c[3],u[3]),f},i.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return xu[c]},i.cJ=de,i.cK=Qe,i.cL=CN,i.cM=function(f){const c=A(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const u=[0,rh,0],g=[0,nh,0];return Ke(u,u,c),Ke(g,g,c),[u[0]>0&&u[0]<=f.width&&u[1]>0&&u[1]<=f.height&&!jie(f,new m(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!jie(f,new m(f.center.lat,-90))]},i.cN=function(f,c){const{scale:u}=f.tileTransform,g=u*Sr/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(v,k,S){var L=k[1],R=k[2],$=k[3],W=S[0],Z=S[1];return v[0]=k[0]*W,v[1]=L*W,v[2]=R*Z,v[3]=$*Z,v}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},i.cO=l6,i.cP=oe,i.cQ=tve,i.cR=function(f){const c=tve(f,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=z,i.cT=zr,i.cU=F,i.cV=function(f){const{x:c,y:u}=f.point,{lng:g,lat:v}=f._center;return D0e(c,u,f.worldSize,g,v)},i.cW=Ae,i.cX=yo,i.cY=Ri,i.cZ=sc,i.c_=th,i.ca=ha,i.cb=function(f,c){return f[0]=-c[0],f[1]=-c[1],f[2]=-c[2],f[3]=c[3],f},i.cc=ie,i.cd=function(f,c,u,g,v){var k=1/Math.tan(c/2);if(f[0]=k/u,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=k,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,v!=null&&v!==1/0){var S=1/(g-v);f[10]=(v+g)*S,f[14]=2*v*g*S}else f[10]=-1,f[14]=-2*g;return f},i.ce=function(f,c,u,g,v,k,S){var L=1/(c-u),R=1/(g-v),$=1/(k-S);return f[0]=-2*L,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*R,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+u)*L,f[13]=(v+g)*R,f[14]=(S+k)*$,f[15]=1,f},i.cf=Y,i.cg=function(f,c,u){f[4*c+0]=u[0],f[4*c+1]=u[1],f[4*c+2]=u[2],f[4*c+3]=u[3]},i.ch=jN,i.ci=qv,i.cj=Vo,i.ck=Sf,i.cl=Hv,i.cm=o_e,i.cn=function(){var f=new p(4);return p!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},i.co=function(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],L=Math.sin(u),R=Math.cos(u);return f[0]=g*R+k*L,f[1]=v*R+S*L,f[2]=g*-L+k*R,f[3]=v*-L+S*R,f},i.cp=function(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]},i.cq=at,i.cr=function(f){var c=f[0],u=f[1],g=f[2],v=f[3];return Math.sqrt(c*c+u*u+g*g+v*v)},i.cs=Qr,i.ct=yt,i.cu=bo,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Te,i.d=function(f){return Ss.API_TILEJSON_REGEX.test(f)},i.d$=class{constructor(f,c,u,g){this.context=f,this.format=g,this.size=u,this.texture=f.gl.createTexture();const[v,k,S]=this.size,{gl:L}=f;L.bindTexture(L.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&L.texImage3D(L.TEXTURE_3D,0,this.format,v,k,S,0,Vie(this.format),Hie(this.format),c.data)}bind(f,c){const{context:u}=this,{gl:g}=u;g.bindTexture(g.TEXTURE_3D,this.texture),f!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,f),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,f),this.minFilter=f),c!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,c),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,c),this.wrapS=c)}destroy(){const{gl:f}=this.context;f.deleteTexture(this.texture),this.texture=null}},i.d0=function(f){return f*f*f*f*f},i.d1=D,i.d2=45,i.d3=kN,i.d4=function(f,c,u){const g=Math.sqrt(f*f+c*c+u*u),v=g>0?Math.acos(u/g)*Ao:0;let k=f!==0||c!==0?Math.atan2(-c,-f)*Ao+90:0;return k<0&&(k+=360),[g,k,v]},i.d5=se,i.d6=Yn,i.d7=Pe,i.d8=ue,i.d9=ln,i.dA=function(f){return f({pluginStatus:rd,pluginURL:kp}),tN.on("pluginStateChange",f),f},i.dB=Vv,i.dC=class extends Cp{constructor(f){super(f),this.current=NN}set(f,c,u){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(u[g]!==this.current[g]){this.current=u,this.gl.uniformMatrix3fv(this.location,!1,u);break}}}},i.dD=$l,i.dE=function(f,c,u){const g=t0(u.zoom),v=f.style.map._antialias,k=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!v&&!k},i.dF=function(f){const c=f.pixelsPerMeter,u=c/Y(1,f.center.lat),g=A(new Float64Array(16));return P(g,g,[f.point.x,f.point.y,0]),z(g,g,[u,u,c]),Float32Array.from(g)},i.dG=WP,i.dH=function(f){const c=de-5;f=xe(f,-c,c)/c*90;const u=Math.pow(Math.abs(Math.sin(ss(f))),3);return Math.round(u*(I5.length-1))},i.dI=function(f,c,u,g){const v=c.getNorth(),k=c.getSouth(),S=c.getWest(),L=c.getEast(),R=1<0){const ne=180/g;j(re,re,[ne/$+1,0,0,0,ne/W+1,0,-.5*ne/Z,.5*ne/X,1])}return re[2]=R,re[5]=f.x,re[8]=f.y,re},i.dJ=Fh,i.dK=function(f,c,u){const g=A(new Float64Array(16)),v=(c/(1<({u_matrix:new Hv(f),u_texsize:new Sf(f),u_pixels_to_tile_units:new SN(f),u_device_pixel_ratio:new Vo(f),u_width_scale:new Vo(f),u_floor_width_scale:new Vo(f),u_image:new jN(f),u_units_to_pixels:new Sf(f),u_tile_units_to_pixels:new Vo(f),u_alpha_discard_threshold:new Vo(f),u_trim_offset:new Sf(f),u_trim_fade_range:new Sf(f),u_trim_color:new kN(f),u_zbias_factor:new Vo(f),u_tile_to_meter:new Vo(f),u_ground_shadow_factor:new qv(f),u_pattern_transition:new Vo(f)}),i.dX=f=>({u_matrix:new Hv(f),u_pixels_to_tile_units:new SN(f),u_device_pixel_ratio:new Vo(f),u_width_scale:new Vo(f),u_floor_width_scale:new Vo(f),u_units_to_pixels:new Sf(f),u_dash_image:new jN(f),u_gradient_image:new jN(f),u_image_height:new Vo(f),u_texsize:new Sf(f),u_tile_units_to_pixels:new Vo(f),u_alpha_discard_threshold:new Vo(f),u_trim_offset:new Sf(f),u_trim_fade_range:new Sf(f),u_trim_color:new kN(f),u_zbias_factor:new Vo(f),u_tile_to_meter:new Vo(f),u_ground_shadow_factor:new qv(f)}),i.dY=f=>({u_camera_to_center_distance:new Vo(f),u_extrude_scale:new SN(f),u_device_pixel_ratio:new Vo(f),u_matrix:new Hv(f),u_inv_rot_matrix:new Hv(f),u_merc_center:new Sf(f),u_tile_id:new qv(f),u_zoom_transition:new Vo(f),u_up_dir:new qv(f),u_emissive_strength:new Vo(f)}),i.dZ=pN,i.d_=$qe,i.da=_e,i.db=function(f){return[Math.pow(f[0],1/2.2),Math.pow(f[1],1/2.2),Math.pow(f[2],1/2.2)]},i.dc=eve,i.dd=Qie,i.de=ave,i.df=joe,i.dg=function(f,c){return f.readFields(BVe,{icons:[]},c)},i.dh=s6,i.di=zN,i.dj=hoe,i.dk=Wg,i.dl=Rv,i.dm=Em,i.dn=Pr,i.dp=ar,i.dq=function(f){const c=f.indexOf(ax);return c>=0?f.slice(0,c):f},i.dr=function(f){return f.indexOf(ax)>=0},i.ds=function(f){const c=f.lastIndexOf(ax);return c>=0?f.slice(c+1):""},i.dt=function(f){const c=[],u=f.id;return u===void 0&&c.push({message:`layers.${u}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${u}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(f,c,u,g){return f.type==="custom"?new PVe(f,c):new FVe[f.type](f,c,u,g)},i.dv=fr,i.dw=function(f){const c=f.indexOf(ax);return c>=0?f.slice(c+1):""},i.dx=class extends n_{constructor(f,c){super(f._vectorTileFeature,f._z,f._x,f._y,f.id),f.state&&(this.state=Object.assign({},f.state)),this.target=c.target,this.namespace=c.namespace,c.properties&&(this.properties=c.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=f.source,this.sourceLayer=f.sourceLayer,this.layer=f.layer)}toJSON(){const f=super.toJSON();return f.target=this.target,f.namespace=this.namespace,f}},i.dy=tN,i.dz=Mh,i.e=Ss,i.e$=he,i.e0=z0e,i.e1=(f,c,u,g,v,k)=>{const S=f.transform,L=S.projection.name==="globe";let R;if(k.paint.get("circle-pitch-alignment")==="map")if(L){const W=O0e(S.zoom,c.canonical)*S._pixelsPerMercatorPixel;R=Float32Array.from([W,0,0,W])}else R=S.calculatePixelsToTileUnitsMatrix(u);else R=new Float32Array([S.pixelsToGLUnits[0],0,0,S.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(S.projection),u_matrix:f.translatePosMatrix(c.projMatrix,u,k.paint.get("circle-translate"),k.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Uo.devicePixelRatio,u_extrude_scale:R,u_inv_rot_matrix:nUe,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:k.paint.get("circle-emissive-strength")};if(L){$.u_inv_rot_matrix=g,$.u_merc_center=v,$.u_tile_id=[c.canonical.x,c.canonical.y,1<{const W=f.transform,Z=W.pitch<15?yve(.07,.7,xe((14-W.zoom)/5,0,1)):.07,X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:_ve(f,c,u,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:W.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:v,u_width_scale:k,u_floor_width_scale:S,u_image:0,u_tile_units_to_pixels:vve(c,W),u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:L,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:Z,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:R,u_pattern_transition:$}},i.e5=(f,c,u,g,v,k,S,L,R,$)=>{const W=f.transform,Z=W.calculatePixelsToTileUnitsMatrix(c),X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=W.pitch<15?yve(.07,.7,xe((14-W.zoom)/5,0,1)):.07;return{u_matrix:_ve(f,c,u,g),u_pixels_to_tile_units:Z,u_device_pixel_ratio:k,u_width_scale:S,u_floor_width_scale:L,u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:wve(u)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:vve(c,f.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:re,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:$}},i.e6=Bt,i.e7=L5,i.e8=le,i.e9=ah,i.eA=function(f,c){var u=2*Math.acos(c[3]),g=Math.sin(u/2);return g>h?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),u},i.eB=Soe,i.eC=u6,i.eD=d6,i.eE=[1,1,1],i.eF=qN,i.eG=Oe,i.eH=function(f,c,u,g){var v=c[0],k=c[1],S=c[2],L=c[3];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=S+g*(u[2]-S),f[3]=L+g*(u[3]-L),f},i.eI=LN,i.eJ=ju,i.eK=Nf,i.eL=function(f,c,u,g,v,k,S,L,R,$,W,Z,X,re,ne,fe){var Ne=new p(16);return Ne[0]=f,Ne[1]=c,Ne[2]=u,Ne[3]=g,Ne[4]=v,Ne[5]=k,Ne[6]=S,Ne[7]=L,Ne[8]=R,Ne[9]=$,Ne[10]=W,Ne[11]=Z,Ne[12]=X,Ne[13]=re,Ne[14]=ne,Ne[15]=fe,Ne},i.eM=b,i.eN=Zy,i.eO=w5,i.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ir(1/0,1/0),max:new ir(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(f,c=!1){const u=m1e(new ir(0,0),new ir(Sr,Sr),f),g=[];if(c&&!Iie(u,this._globalClipBounds))return g;for(const v of this._activeRegions){if(v.hiddenByOverlap||!Iie(u,v))continue;const k=IUe(v.min,v.max,f);g.push({min:k.min,max:k.max,sourceId:this._sourceIds[v.priority],footprint:v.footprint,footprintTileId:v.tileId,order:v.order,clipMask:v.clipMask,clipScope:v.clipScope})}return g}setSources(f){this._setSources(f.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const u=[];for(const g of c.cache.getVisibleCoordinates()){const v=c.cache.getTile(g).buckets[c.layer];v&&v.updateFootprints(g.toUnwrapped(),u)}return u},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const u=f.getOrder(),g=f.getClipMask(),v=f.getClipScope();for(const k of c){if(!k.footprint)continue;const S=m1e(k.footprint.min,k.footprint.max,k.id);this._activeRegions.push({min:S.min,max:S.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:k.id,footprint:k.footprint,order:u,clipMask:g,clipScope:v})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,u)=>c.priority-u.priority||JP(c.min,u.min)||JP(c.max,u.max)||c.order-u.order||c.clipMask-u.clipMask||function(g,v){const k=(S,L)=>S+L;return g.length-v.length||g.reduce(k,"").localeCompare(v.reduce(k,""))}(c.clipScope,u.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const u=this._activeRegions[c],g=this._prevRegions[c];f=u.priority!==g.priority||!p1e(u,g)||u.order!==g.order||u.clipMask!==g.clipMask||!fo(u.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const u of this._activeRegions)u.order!==B5&&(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 c=u=>{const g=this._activeRegions;if(u>=g.length)return u;const v=g[u].priority;for(;u1){let u=0,g=c(u);for(;u!==g;){let v=u;const k=u;for(;v!==g;){const S=this._activeRegions[v];S.hiddenByOverlap=!1;for(let L=0;L=0;c--)this._addSource(f[c]);this._computeReplacement()}},i.eQ=B5,i.eR=class{constructor(f){this._createGrid(f),this._createPoles(f)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const f of this._poleSegments)f.destroy();for(const f of this._gridSegments)f.withSkirts.destroy(),f.withoutSkirts.destroy()}_fillGridMeshWithLods(f,c){const u=new qm,g=new qo,v=[],k=f+1+2,S=c[0]+1,L=c[0]+1+(1+c.length),R=($,W,Z)=>{let X=$===k-1?$-2:$===0?$:$-1;return X+=Z?24575:0,[X,W]};for(let $=0;$0?(Ne=2*Math.sqrt(fe+1),f[3]=.25*Ne,f[0]=(Z-re)/Ne,f[1]=(X-R)/Ne,f[2]=(L-$)/Ne):S>W&&S>ne?(Ne=2*Math.sqrt(1+S-W-ne),f[3]=(Z-re)/Ne,f[0]=.25*Ne,f[1]=(L+$)/Ne,f[2]=(X+R)/Ne):W>ne?(Ne=2*Math.sqrt(1+W-S-ne),f[3]=(X-R)/Ne,f[0]=(L+$)/Ne,f[1]=.25*Ne,f[2]=(Z+re)/Ne):(Ne=2*Math.sqrt(1+ne-S-W),f[3]=(L-$)/Ne,f[0]=(X+R)/Ne,f[1]=(Z+re)/Ne,f[2]=.25*Ne),f},i.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,u)=>String.fromCharCode(+("0x"+u))))},i.f0=function([f,c,u]){const g=Math.hypot(f,c,u),v=Math.atan2(f,u),k=.5*Math.PI-Math.acos(-c/g);return new m(yo(v),yo(k))},i.f1=nt,i.f2=Gie,i.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(u){if(po==null){const g=u.navigator?u.navigator.userAgent:null;po=!!u.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return po}(f)&&!(!c||!(c.match("Version/15.4")||c.match("Version/15.5")||c.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},i.f4=function(f,c){ky=f,Ny=c},i.f5=jie,i.f6=R0e,i.f7=function(f){const c=[0,0,0],u=A(new Float64Array(16));return T(u,f.pixelMatrix,f.globeMatrix),Ke(c,c,u),new ir(c[0],c[1])},i.f8=function(){const f=W5;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Fie),W5=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()"))},i.f9=function(){s6().acquire(Fie)},i.fA=R6,i.fB=Lt,i.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==Z1e){const u=new Uint32Array(f,0,7),[,,g,v,k,S]=u;c=u.byteLength+v+k+S+k,(g!==f.byteLength||c>=f.byteLength)&&Ur("Invalid b3dm header information.")}return J1e(f,c)},i.fD=function(f,c){const u=Qie(f);for(const g of u){for(const v of g.meshes)cqe(v);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(dqe(g.lights,c)))}return u},i.fE=E6,i.fF=Ds,i.fG=V1e,i.fH=Np,i.fI=Gd,i.fJ=function(f){Rc(),vu!=null&&vu.then(c=>{c.keys().then(u=>{for(let g=0;gUr(v.message))}).catch(u=>Ur(u.message))}).catch(c=>Ur(c.message))},i.fa=Fv,i.fb=function(f,c,u=!1){if(rd===Gd.deferred||rd===Gd.loading||rd===Gd.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");kp=Uo.resolveURL(f),rd=Gd.deferred,u5=c,eN(),u||NP()},i.fc=function(f){EN=Uo.resolveURL(f),IN||(IN=new AN(s6(),new mi)),IN.broadcast("setMeshoptUrl",EN)},i.fd=G1e,i.fe=function(f){$ie=Uo.resolveURL(f),IN||(IN=new AN(s6(),new mi)),IN.broadcast("setDracoUrl",$ie)},i.ff=W1e,i.fg=H5,i.fh=function(f){const c=Hd();if(!c)return;const u=c.delete(jy);f&&u.then(()=>f()).catch(f)},i.fi=Qv,i.fj=Yr,i.fk=r0,i.fl=Dp,i.fm=h2e,i.fn=f2e,i.fo=pve,i.fp=Jt,i.fq="hd_road_elevation",i.fr=ya,i.fs=Ut,i.ft=cx,i.fu=uoe,i.fv=t_,i.fw=function(f,c,u,g,v,k,S,L=1,R,$,W){f.createArrays(),f.tilePixelRatio=Sr/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const Z=f.layers[0].layout,X=f.layers[0]._unevaluatedLayout._values,re={};re.scaleFactor=L,re.textSizeScaleRange=Z.get("text-size-scale-range"),re.iconSizeScaleRange=Z.get("icon-size-scale-range");const[ne,fe]=re.textSizeScaleRange,[Ne,je]=re.iconSizeScaleRange;re.textScaleFactor=xe(re.scaleFactor,ne,fe),re.iconScaleFactor=xe(re.scaleFactor,Ne,je);const Re=X["text-size"],$e=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Kt}=f.textSizeData;re.compositeTextSizes=[Re.possiblyEvaluate(new ti(Et,{worldview:W}),k),Re.possiblyEvaluate(new ti(Kt,{worldview:W}),k)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Kt}=f.iconSizeData;re.compositeIconSizes=[$e.possiblyEvaluate(new ti(Et,{worldview:W}),k),$e.possiblyEvaluate(new ti(Kt,{worldview:W}),k)]}re.layoutTextSize=Re.possiblyEvaluate(new ti(S+1,{worldview:W}),k),re.layoutIconSize=$e.possiblyEvaluate(new ti(S+1,{worldview:W}),k),re.textMaxSize=Re.possiblyEvaluate(new ti(18,{worldview:W}),k);const Ze=Z.get("symbol-placement"),ht=Z.get("text-rotation-alignment")==="map"&&Ze!=="point",ot=Z.get("text-size");let _t=!1;const Ct=[];for(const Et of f.features){const Kt=Z.get("text-font").evaluate(Et,{},k).join(","),Rt=ot.evaluate(Et,{},k)*re.textScaleFactor,rr=re.layoutTextSize.evaluate(Et,{},k)*re.textScaleFactor,or=re.layoutIconSize.evaluate(Et,{},k)*re.iconScaleFactor,lr={horizontal:{},vertical:void 0},xr=Et.text;let vr,ur=[0,0];if(xr){const ns=xr.toString(),Ba=Z.get("text-letter-spacing").evaluate(Et,{},k)*vl,lt=Z.get("text-line-height").evaluate(Et,{},k)*vl,pt=c5(ns)?Ba:0,nr=Z.get("text-anchor").evaluate(Et,{},k),yr=Z.get("text-variable-anchor");if(!yr){const Jn=Z.get("text-radial-offset").evaluate(Et,{},k);if(Jn)ur=Yve(nr,[Jn*vl,poe]);else{const cs=Z.get("text-offset").evaluate(Et,{},k);ur=[cs[0]*vl,cs[1]*vl]}}let Or=ht?"center":Z.get("text-justify").evaluate(Et,{},k);const Dr=Ze==="point",hn=Dr?Z.get("text-max-width").evaluate(Et,{},k)*vl:1/0,vn=Jn=>{f.allowVerticalPlacement&&Dv(ns)&&(lr.vertical=ioe(xr,c,u,v,Kt,hn,lt,nr,Jn,pt,ur,Su.vertical,!0,rr,Rt,R))};if(!ht&&yr){const Jn=Or==="auto"?yr.map(ms=>moe(ms)):[Or];let cs=!1;for(let ms=0;ms=0||!Dv(ns)){const Jn=ioe(xr,c,u,v,Kt,hn,lt,nr,Or,pt,ur,Su.horizontal,!1,rr,Rt,R);Jn&&(lr.horizontal[Or]=Jn)}vn(Dr?"left":Or)}}let pr,tr,Xt,mr,Mr,wr,un=!1;const Br=Z.get("icon-text-fit").evaluate(Et,{},k);if(Et.icon&&Et.icon.hasPrimary()){const ns=rM(Et.icon,f.iconSizeData,X["icon-size"],k,f.zoom,Et,R,re.iconScaleFactor,W);pr=ns.iconPrimary,Xt=ns.iconSecondary;const Ba=pr.toString();if(tr=g.get(Ba),tr&&(Mr=Z.get("icon-offset").evaluate(Et,{},k),wr=Z.get("icon-anchor").evaluate(Et,{},k),vr=g6(v.get(Ba),Xt?v.get(Xt.toString()):void 0,Mr,wr),un=tr.sdf,f.sdfIcons===void 0?f.sdfIcons=tr.sdf:f.sdfIcons!==tr.sdf&&Ur("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(tr.pixelRatio!==f.pixelRatio||Z.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Xt){const lt=Xt.toString();mr=g.get(lt)}}_t=_t||!(!Et.icon||!Et.icon.hasSecondary());const Kr=b6(lr.horizontal)||lr.vertical;f.iconsInText||(f.iconsInText=!!Kr&&Kr.iconsInText);const tn=rr*re.textScaleFactor/vl,{defaultShapedIcon:gs,verticallyShapedIcon:jr}=yVe(f,vr,Z,Et,k,lr,tn,Mr,Br);Br!=="none"&&vr&&(Ove(vr)||Dve(vr))&&(_6(0,tr,pr,vr,gs,Br,$,g,v),_6(0,mr,Xt,vr,gs,Br,$,g,v),jr&&(_6(0,tr,pr,vr,jr,Br,$,g,v),_6(0,mr,Xt,vr,jr,Br,$,g,v))),vr=gs;const{iconBBox:rn,iconVerticalBBox:qn,textBBox:Fs,textVerticalBBox:$s}=fVe(f,vr,jr,Z,Et,k,or,Mr,re,v,wr,lr,rr,ur);Ct.push({feature:Et,shapedTextOrientations:lr,shapedText:Kr,shapedIcon:vr,iconPrimary:pr,iconSecondary:Xt,iconOffset:Mr,iconAnchor:wr,verticallyShapedIcon:jr,layoutTextSize:rr,layoutIconSize:or,textOffset:ur,isSDFIcon:un,iconTextFit:Br,iconCollisionBounds:rn,iconVerticalCollisionBounds:qn,textCollisionBounds:Fs,textVerticalCollisionBounds:$s})}return{featureData:Ct,sizes:re,hasAnySecondaryIcon:_t,textAlongLine:ht,symbolPlacement:Ze}},i.fx=Vve,i.fy=function(f,c,u,g,v,k,S,L,R,$){f.iconAtlasPositions=$.iconPositions;const{featureData:W,hasAnySecondaryIcon:Z,sizes:X,textAlongLine:re,symbolPlacement:ne}=c;for(const fe of W){const{shapedIcon:Ne,verticallyShapedIcon:je,feature:Re,shapedTextOrientations:$e,shapedText:Ze,layoutTextSize:ht,textOffset:ot,isSDFIcon:_t,iconPrimary:Ct,iconSecondary:Et,iconTextFit:Kt,iconOffset:Rt,iconCollisionBounds:rr,iconVerticalCollisionBounds:or,textCollisionBounds:lr}=fe;Qve(Ne,$.iconPositions,Ct,Et),Qve(je,$.iconPositions,Ct,Et),xVe($e,$.iconPositions),gVe(Ct,Et,$.iconPositions),(Ze||Ne)&&vVe(f,Re,$e,Ne,je,R,X,ht,0,ot,_t,g,v,S,L,Z,Kt,Rt,re,ne,rr,or,lr)}u&&f.generateCollisionDebugBuffers(k,f.collisionBoxArray,X.textScaleFactor)},i.fz=$t,i.g=function(f,c){return Mh(Object.assign(f,{method:"GET"}),c)},i.h=function(f){return f.indexOf("mapbox:")===0},i.i=function(f){return Ss.API_STYLE_REGEX.test(f)&&!gl(f)},i.j=Ni,i.k=jd,i.l=function(f){return decodeURIComponent(atob(f).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))},i.m=function(f,c){return Mh(Object.assign(f,{type:"json"}),c)},i.n=My,i.o=Uo,i.p=function(f,c){return Mh(Object.assign(f,{method:"POST"}),c)},i.q=jc,i.r=Zu,i.s=function(f){try{const c=self[f];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},i.t=function(){return zie||(zie=new Qv("ImageRasterizer")),zie},i.u=function(){return function f(c){return c?(c^Math.random()*(16>>c/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,f)}()},i.v=function(f){return!!f&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(f)},i.w=Ur,i.x=Ioe,i.y=rs,i.z=Hn}),o(["./shared"],function(i){function h(et){const xe=et?et.url.toString():void 0;return xe?performance.getEntriesByName(xe):[]}function p(et){if(typeof et=="number"||typeof et=="boolean"||typeof et=="string"||et==null)return JSON.stringify(et);if(Array.isArray(et)){let Ie="[";for(const Ge of et)Ie+=`${p(Ge)},`;return`${Ie}]`}let xe="{";for(const Ie of Object.keys(et).sort())xe+=`${Ie}:${p(et[Ie])},`;return`${xe}}`}function x(et){let xe="";for(const Ie of i.bx)xe+=`/${p(et[Ie])}`;return xe}class y{constructor(xe){this.keyCache={},this._layers={},this._layerConfigs={},xe&&this.replace(xe)}replace(xe,Ie){this._layerConfigs={},this._layers={},this.update(xe,[],Ie)}update(xe,Ie,Ge){this._options=Ge;for(const vt of xe)this._layerConfigs[vt.id]=vt,(this._layers[vt.id]=i.du(vt,this.scope,null,this._options)).compileFilter(Ge),this.keyCache[vt.id]&&delete this.keyCache[vt.id];for(const vt of Ie)delete this.keyCache[vt],delete this._layerConfigs[vt],delete this._layers[vt];this.familiesBySource={};const kt=function(vt,At){const Bt={};for(let Ut=0;Utthis._layers[Wr.id]),Bt=At[0];if(Bt.visibility==="none")continue;const Pt=Bt.source||"";let Ut=this.familiesBySource[Pt];Ut||(Ut=this.familiesBySource[Pt]={});const fr=Bt.sourceLayer||"_geojsonTileLayer";let ar=Ut[fr];ar||(ar=Ut[fr]=[]),ar.push(At)}}}const _=1*i.fl;class j{constructor(xe){const Ie={},Ge=[];for(const Bt in xe){const Pt=xe[Bt],Ut=Ie[Bt]={};for(const fr in Pt.glyphs){const ar=Pt.glyphs[+fr];if(!ar||ar.bitmap.width===0||ar.bitmap.height===0)continue;const Wr=ar.metrics.localGlyph?_:1,wn={x:0,y:0,w:ar.bitmap.width+2*Wr,h:ar.bitmap.height+2*Wr};Ge.push(wn),Ut[fr]=wn}}const{w:kt,h:vt}=i.G(Ge),At=new i.fk({width:kt||1,height:vt||1});for(const Bt in xe){const Pt=xe[Bt];for(const Ut in Pt.glyphs){const fr=Pt.glyphs[+Ut];if(!fr||fr.bitmap.width===0||fr.bitmap.height===0)continue;const ar=Ie[Bt][Ut],Wr=fr.metrics.localGlyph?_:1;i.fk.copy(fr.bitmap,At,{x:0,y:0},{x:ar.x+Wr,y:ar.y+Wr},fr.bitmap)}}this.image=At,this.positions=Ie}}function C(et,xe,Ie){et[xe]?Ie&&(et[xe].center=Ie):et[xe]={floorIds:new Set,center:Ie||[0,0],floors:{}}}function N(et,xe,Ie,Ge){for(const kt of xe)C(et,kt),et[kt].floors[Ie]=Ge,et[kt].floorIds.add(Ie)}function A(et){return{id:et.properties.id.toString(),center:et.properties.center.toString().split(";").map(Number)}}function E(et){return{id:et.properties.id.toString(),isDefault:!!et.properties.is_default&&et.properties.is_default,connections:et.properties.connected_floor_ids?new Set(et.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:et.properties.conflicted_floor_ids?new Set(et.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:et.properties.building_ids?new Set(et.properties.building_ids.toString().split(";")):new Set,name:et.properties.name.toString(),zIndex:et.properties.z_index}}function T(et,xe){return xe.every(Ie=>et.properties&&et.properties[Ie]!=null)}function P(et){return T(et,["type","id","name"])&&et.properties.type==="building"}function z(et){return T(et,["type","id","name","z_index"])&&et.properties.type==="floor"}i.fj(j,"GlyphAtlas");class F{constructor(xe){this.tileID=new i.aQ(xe.tileID.overscaledZ,xe.tileID.wrap,xe.tileID.canonical.z,xe.tileID.canonical.x,xe.tileID.canonical.y),this.tileZoom=xe.tileZoom,this.uid=xe.uid,this.zoom=xe.zoom,this.lut=xe.lut,this.canonical=xe.tileID.canonical,this.pixelRatio=xe.pixelRatio,this.tileSize=xe.tileSize,this.source=xe.source,this.scope=xe.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=xe.showCollisionBoxes,this.collectResourceTiming=!!xe.request&&xe.request.collectResourceTiming,this.promoteId=xe.promoteId,this.isSymbolTile=xe.isSymbolTile,this.tileTransform=i.aZ(xe.tileID.canonical,xe.projection),this.projection=xe.projection,this.worldview=xe.worldview,this.localizableLayerIds=xe.localizableLayerIds,this.brightness=xe.brightness,this.extraShadowCaster=!!xe.extraShadowCaster,this.tessellationStep=xe.tessellationStep,this.scaleFactor=xe.scaleFactor,this.worldview=xe.worldview,this.indoor=xe.indoor}parse(xe,Ie,Ge,kt,vt,At){this.status="parsing",this.data=xe,this.collisionBoxArray=new i.b3;const Bt=new i.fm(Object.keys(xe.layers).sort()),Pt=new i.fn(this.tileID,this.promoteId);Pt.bucketLayerIDs=[];const Ut={},fr=new i.fo(256,256),ar={featureIndex:Pt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:fr,availableImages:Ge,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const es=this.indoor.indoorState.activeFloorsVisible,ts=function(Yn,Ds,Li){const po=function(ji,Ws){if(!ji)return i.w("No source layers defined in indoor specification"),Ws;if(ji.size===0)return Ws;const ki=ji.difference(Ws);for(const za of ki)i.w(`Missing source layer required in indoor specification: ${za}`);return Ws.intersection(Ws)}(Ds.sourceLayers,new Set(Object.keys(Yn.layers))),ha=Ds.indoorState,vo=function(ji,Ws,ki,za){const Ss=new Set,Ni=new Set,gl=new Set,Cl=new Map,Oc={},gf=$o=>{const wd=Cl.get($o)||new Set;for(const nc of Ss)if((Cl.get(nc)||new Set).has($o)||wd.has(nc))return!0;return!1};for(const $o of Ws){const wd=ji.layers[$o];if(wd)for(let nc=0;nc=ki.maxzoom||ki.visibility==="none")continue;q(Ws,this.zoom,ar.brightness,Ge,this.worldview);const za=Ut[ki.id]=ki.createBucket({index:Pt.bucketLayerIDs.length,layers:Ws,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:po,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:kt,worldview:this.worldview,localizable:vo});Pt.bucketLayerIDs.push(Ws.map(Ni=>i.B(Ni.id,Ni.scope)));let Ss=za.prepare?za.prepare():null;Ss!=null?(Ss=Ss.then(()=>za.populate(ha,ar,this.tileID.canonical,this.tileTransform)),Wr.push(Ss)):za.populate(ha,ar,this.tileID.canonical,this.tileTransform)}}const Ur=()=>{let es,ts,Yn,Ds,Li,po;fr.trim();const ha={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},vo=()=>{if(es)return this.status="done",At(es);if(this.extraShadowCaster)this.status="done",At(null,{buckets:Object.values(Ut).filter(Ws=>!Ws.isEmpty()),featureIndex:Pt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ar.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(ts&&Yn&&Ds){const Ws=new j(ts),ki=new Map;for(const[Ni,gl]of Yn.entries()){const{imagePosition:Cl}=i.fu(Ni,gl,i.fv);ki.set(Ni,Cl)}const za={};for(const Ni in Ut){const gl=Ut[Ni];gl instanceof i.b4&&(q(gl.layers,this.zoom,ar.brightness,Ge,this.worldview),za[Ni]=i.fw(gl,ts,Ws.positions,Yn,ki,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Li,this.worldview))}const Ss={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(vt,Yn,Li,()=>{Ss.iconsPending=!1,ji(za,Ws,Ss)}),this.rasterizeIfNeeded(vt,Ds,po,()=>{Ss.patternsPending=!1,ji(za,Ws,Ss)})}},ji=(Ws,ki,za,Ss)=>{if(za.iconsPending||za.patternsPending)return;const Ni=new i.fx(Yn,Ds,this.lut);for(const gl in Ut){const Cl=Ut[gl];if(gl in Ws)i.fy(Cl,Ws[gl],this.showCollisionBoxes,Ge,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Yn,Ni);else if(Cl.hasPattern&&(Cl instanceof i.ba||Cl instanceof i.bb||Cl instanceof i.ea)){q(Cl.layers,this.zoom,ar.brightness,Ge,this.worldview);const Oc=Object.fromEntries(Ni.patternPositions);Cl.addFeatures(ar,this.tileID.canonical,Oc,Ge,this.tileTransform,this.brightness)}}this.status="done",At(null,{buckets:Object.values(Ut).filter(gl=>!gl.isEmpty()),featureIndex:Pt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ki.image,lineAtlas:fr,imageAtlas:Ni,brightness:ar.brightness})};if(!this.extraShadowCaster){const Ws=i.fs(ar.glyphDependencies,Ss=>Object.keys(Ss).map(Number));Object.keys(Ws).length?vt.send("getGlyphs",{uid:this.uid,stacks:Ws},(Ss,Ni)=>{es||(es=Ss,ts=Ni,vo())},void 0,!1,ha):ts={};const ki=Array.from(ar.iconDependencies.keys()).map(Ss=>i.I.parse(Ss));ki.length?vt.send("getImages",{images:ki,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ss,Ni)=>{es||(es=Ss,Yn=new Map,Li=this.updateImageMapAndGetImageTaskQueue(Yn,Ni,ar.iconDependencies),vo())},void 0,!1,ha):(Yn=new Map,Li=new Map);const za=Array.from(ar.patternDependencies.keys()).map(Ss=>i.I.parse(Ss));za.length?vt.send("getImages",{images:za,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ss,Ni)=>{es||(es=Ss,Ds=new Map,po=this.updateImageMapAndGetImageTaskQueue(Ds,Ni,ar.patternDependencies),vo())},void 0,!1,ha):(Ds=new Map,po=new Map)}if(ar.elevationFeatures&&ar.elevationFeatures.length>0){const Ws=[];for(const za of Object.values(Ut))if(za instanceof i.bb){const Ss=za.getUnevaluatedPortalGraph();Ss&&Ws.push(Ss)}const ki=i.ft.evaluate(Ws);for(const za of Object.values(Ut))if(za instanceof i.bb){const Ss=xe.layers[Bt.decode(za.sourceLayerIndex)];za.setEvaluatedPortalGraph(ki,Ss,this.tileID.canonical,ar.availableImages,ar.brightness)}}vo()};Wr.length>0?Promise.allSettled(Wr).then(Ur).catch(At):Ur()}updateParameters(xe){this.scaleFactor=xe.scaleFactor,this.showCollisionBoxes=xe.showCollisionBoxes,this.projection=xe.projection,this.brightness=xe.brightness,this.tileTransform=i.aZ(xe.tileID.canonical,xe.projection),this.extraShadowCaster=xe.extraShadowCaster,this.lut=xe.lut,this.worldview=xe.worldview,this.indoor=xe.indoor}rasterizeIfNeeded(xe,Ie,Ge,kt){Array.from(Ie.values()).some(vt=>vt.usvg)?this.rasterize(xe,Ie,Ge,kt):kt()}updateImageMapAndGetImageTaskQueue(xe,Ie,Ge){const kt=new Map;for(const vt of Ie.keys()){const At=Ge.get(vt)||[];for(const Bt of At){const Pt=Bt.toString(),Ut=Ie.get(Bt.id.toString());Ut.usvg?kt.has(Pt)||(kt.set(Pt,Bt),xe.set(Pt,Object.assign({},Ut))):xe.set(Pt,Ut)}}return kt}rasterize(xe,Ie,Ge,kt){this.rasterizeTask=xe.send("rasterizeImages",{scope:this.scope,tasks:Ge},(vt,At)=>{if(!vt)for(const[Bt,Pt]of At.entries()){const Ut=Object.assign(Ie.get(Bt),{data:Pt});Ie.set(Bt,Ut)}kt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function q(et,xe,Ie,Ge,kt){const vt=new i.ac(xe,{brightness:Ie,worldview:kt});for(const At of et)At.recalculate(vt,Ge)}class V extends i.E{constructor(xe,Ie,Ge,kt,vt,At,Bt){super(),this.actor=xe,this.layerIndex=Ie,this.availableImages=Ge,this.availableModels=kt,this.loadVectorData=At||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(xe.scheduler),this.isSpriteLoaded=vt,this.scheduler=xe.scheduler,this.brightness=Bt}loadTile(xe,Ie){const Ge=xe.uid,kt=xe&&xe.request,vt=kt&&kt.collectResourceTiming,At=this.loading[Ge]=new F(xe);At.abort=this.loadVectorData(xe,(Bt,Pt)=>{const Ut=!this.loading[Ge];if(delete this.loading[Ge],At.cancelRasterize(),Ut||Bt||!Pt)return At.status="done",Ut||(this.loaded[Ge]=At),Ie(Bt);const fr=Pt.rawData,ar={},Wr=i.aM(Pt.responseHeaders);Wr&&Wr.expires&&(ar.expires=Wr.expires),Wr&&Wr.cacheControl&&(ar.cacheControl=Wr.cacheControl),At.vectorTile=Pt.vectorTile||new i.fz(new i.bt(fr));const wn=()=>{At.parse(At.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Ur,es)=>{if(Ur||!es)return Ie(Ur);const ts={};if(vt){const Yn=h(kt);Yn.length>0&&(ts.resourceTiming=JSON.parse(JSON.stringify(Yn)))}Ie(null,Object.assign({rawTileData:fr.slice(0),responseHeaders:Pt.responseHeaders},es,ar,ts))})};this.isSpriteLoaded?wn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(wn,{type:"parseTile",isSymbolTile:xe.isSymbolTile,zoom:xe.tileZoom}):wn()}),this.loaded=this.loaded||{},this.loaded[Ge]=At})}reloadTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;if(Ge&&Ge[kt]){const vt=Ge[kt];vt.updateParameters(xe);const At=(Bt,Pt)=>{const Ut=vt.reloadCallback;Ut&&(delete vt.reloadCallback,vt.parse(vt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ut)),Ie(Bt,Pt)};vt.status==="parsing"?vt.reloadCallback=At:vt.status==="done"&&(vt.vectorTile?vt.parse(vt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,At):At())}else Ie(null,void 0)}abortTile(xe,Ie){const Ge=xe.uid,kt=this.loading[Ge];kt&&(kt.abort&&kt.abort(),delete this.loading[Ge]),Ie()}removeTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;Ge&&Ge[kt]&&delete Ge[kt],Ie()}}class K{loadTile(xe,Ie){const{uid:Ge,encoding:kt,rawImageData:vt,padding:At}=xe,Bt=ImageBitmap&&vt instanceof ImageBitmap?this.getImageData(vt,At):vt;Ie(null,new i.fA(Ge,Bt,kt,At<1))}reloadTile(xe,Ie){Ie(null,null)}abortTile(xe,Ie){Ie()}removeTile(xe,Ie){Ie()}getImageData(xe,Ie){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(xe.width,xe.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=xe.width,this.offscreenCanvas.height=xe.height,this.offscreenCanvasContext.drawImage(xe,0,0,xe.width,xe.height);const Ge=this.offscreenCanvasContext.getImageData(-Ie,-Ie,xe.width+2*Ie,xe.height+2*Ie);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ge}}i.bs.setPbf(i.bt);class G{constructor(xe){this._mrt=new i.bs(xe.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=xe.uid,this.tileID=xe.tileID,this.source=xe.source}parse(xe,Ie){const Ge=this._mrt;this.status="parsing",this._entireBuffer=xe;try{Ge.parseHeader(xe),this._isHeaderLoaded=!0;const kt=[];for(const vt in Ge.layers){const At=Ge.getLayer(vt),Bt=At.getDataRange(At.getBandList()),Pt=Ge.createDecodingTask(Bt),Ut=xe.slice(Bt.firstByte,Bt.lastByte+1),fr=i.bs.performDecoding(Ut,Pt).then(ar=>Pt.complete(null,ar)).catch(ar=>Pt.complete(ar,null));kt.push(fr)}Promise.allSettled(kt).then(()=>Ie(null,Ge)).catch(vt=>Ie(vt))}catch(kt){Ie(kt)}}}class te{constructor(xe){this.actor=xe,this.loading={},this.loaded={}}loadTile(xe,Ie){const Ge=xe.uid,kt=xe.request,vt=this.loading[Ge]=new G(xe),{cancel:At}=i.bu(kt,(Bt,Pt,Ut)=>{const fr=!this.loading[Ge];if(delete this.loading[Ge],fr||Bt||!Pt)return vt.status="done",fr||(this.loaded[Ge]=vt),Ie(Bt);vt.parse(Pt,(ar,Wr)=>{if(ar||!Wr)return Ie(ar);Ie(null,Wr,Ut)}),this.loaded[Ge]=vt});vt.abort=At}reloadTile(xe,Ie){Ie(null,void 0)}abortTile(xe,Ie){const Ge=xe.uid,kt=this.loading[Ge];kt&&(kt.abort&&kt.abort(),delete this.loading[Ge]),Ie()}removeTile(xe,Ie){const Ge=xe.uid;this.loaded[Ge]&&delete this.loaded[Ge],Ie()}decodeRasterArray(xe,Ie){i.bs.performDecoding(xe.buffer,xe.task).then(Ge=>Ie(null,Ge)).catch(Ge=>Ie(Ge))}}const ie=i.fB.prototype.toGeoJSON;class oe{constructor(xe){this._feature=xe,this.extent=i.al,this.type=xe.type,this.properties=xe.tags,"id"in xe&&!isNaN(xe.id)&&(this.id=parseInt(xe.id,10))}loadGeometry(){if(this._feature.type===1){const xe=[];for(const Ie of this._feature.geometry)xe.push([new i.P(Ie[0],Ie[1])]);return xe}{const xe=[];for(const Ie of this._feature.geometry){const Ge=[];for(const kt of Ie)Ge.push(new i.P(kt[0],kt[1]));xe.push(Ge)}return xe}}toGeoJSON(xe,Ie,Ge){return ie.call(this,xe,Ie,Ge)}}class ye{constructor(xe,Ie){this.name=xe,this.extent=i.al,this.length=Ie.length,this._jsonFeatures=Ie}feature(xe){return new oe(this._jsonFeatures[xe])}}class ae{constructor(xe){this.layers={},this.extent=i.al;for(const Ie of Object.keys(xe))this.layers[Ie]=new ye(Ie,xe[Ie])}}const pe=64/4096,se=128;class he{constructor(){this.features=new Map}clear(){this.features.clear()}load(xe=[],Ie){for(const Ge of xe){const kt=Ge.id;if(kt==null)continue;let vt=this.features.get(kt);vt&&this.updateCache(vt,Ie),Ge.geometry?(vt=_e(Ge),this.updateCache(vt,Ie),this.features.set(kt,vt)):this.features.delete(kt),this.updateCache(vt,Ie)}}updateCache(xe,Ie){for(const{canonical:Ge,uid:kt}of Object.values(Ie)){const{z:vt,x:At,y:Bt}=Ge;ue(xe,Math.pow(2,vt),At,Bt)&&delete Ie[kt]}}getTile(xe,Ie,Ge){const kt=Math.pow(2,xe),vt=[];for(const At of this.features.values())ue(At,kt,Ie,Ge)&&vt.push(ge(At,kt,Ie,Ge));return{features:vt}}getFeatures(){return[...this.features.values()]}}function ue({minX:et,minY:xe,maxX:Ie,maxY:Ge},kt,vt,At){return et<(vt+1+pe)/kt&&xe<(At+1+pe)/kt&&Ie>(vt-pe)/kt&&Ge>(At-pe)/kt}function _e(et){const{id:xe,geometry:Ie,properties:Ge}=et;if(!Ie)return;if(Ie.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:kt,coordinates:vt}=Ie,At={id:xe,type:1,geometry:[],tags:Ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Bt=At.geometry;if(kt==="Point")Ae(vt,Bt,At);else if(kt==="MultiPoint")for(const Pt of vt)Ae(Pt,Bt,At);else if(kt==="LineString")At.type=2,Ce(vt,Bt,At);else if(kt==="MultiLineString")At.type=2,Se(vt,Bt,At);else if(kt==="Polygon")At.type=3,Se(vt,Bt,At,!0);else{if(kt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");At.type=3;for(const Pt of vt)Se(Pt,Bt,At,!0)}return At}function Ae([et,xe],Ie,Ge){const kt=i.aF(et);let vt=i.aJ(xe);vt=vt<0?0:vt>1?1:vt,Ie.push(kt,vt),Ge.minX=Math.min(Ge.minX,kt),Ge.minY=Math.min(Ge.minY,vt),Ge.maxX=Math.max(Ge.maxX,kt),Ge.maxY=Math.max(Ge.maxY,vt)}function Ce(et,xe,Ie,Ge=!1,kt=!1){const vt=[];for(const At of et)Ae(At,vt,Ie);xe.push(vt),Ge&&function(At,Bt){let Pt=0;for(let Ut=0,fr=At.length,ar=fr-2;Ut0===Bt)for(let Ut=0,fr=At.length;Ut=At&&ar>=At||(Ut>=At?(fr+=Math.round(Ur*((At-Ut)/wn)),Ut=At):ar>=At&&(Wr=fr+Math.round(Ur*((At-Ut)/wn)),ar=At),fr>=At&&Wr>=At||(fr>=At?(Ut+=Math.round(wn*((At-fr)/Ur)),fr=At):Wr>=At&&(ar=Ut+Math.round(wn*((At-fr)/Ur)),Wr=At),Bt&&Ut===Bt[Bt.length-1][0]&&fr===Bt[Bt.length-1][1]||(Bt=[[Ut,fr]],kt.push(Bt)),Bt.push([ar,Wr])))))}}function ke(et,xe,Ie,Ge,kt){const vt=(Ie-pe)/xe,At=(Ge-pe)/xe,Bt=(Ie+1+pe)/xe,Pt=(Ge+1+pe)/xe;function Ut(Wr,wn){let Ur=0;return WrBt&&(Ur|=2),wnPt&&(Ur|=8),Ur}let fr=[];for(let Wr=1;Wr<=8;Wr*=2){let wn=et[et.length-2],Ur=et[et.length-1],es=!(Ut(wn,Ur)&Wr);for(let ts=0;ts>31}function tt(et,xe){const{geometry:Ie,type:Ge}=et;let kt=0,vt=0;if(Ge===1){xe.writeVarint(Fe(1,Ie.length));for(const At of Ie){const Bt=At[0]-kt,Pt=At[1]-vt;xe.writeVarint(be(Bt)),xe.writeVarint(be(Pt)),kt+=Bt,vt+=Pt}}else for(const At of Ie){xe.writeVarint(Fe(1,1));const Bt=At.length-(Ge===3?1:0);for(let Pt=0;Ptet},me=Math.fround||(yt=new Float32Array(1),et=>(yt[0]=+et,yt[0]));var yt;const rt=3,at=5,Me=6;class ft{constructor(xe){this.options=Object.assign(Object.create(Ke),xe),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(xe){const{log:Ie,minZoom:Ge,maxZoom:kt}=this.options;Ie&&console.time("total time");const vt=`prepare ${xe.length} points`;Ie&&console.time(vt),this.points=xe;const At=[];for(let Pt=0;Pt=Ge;Pt--){const Ut=+Date.now();Bt=this.trees[Pt]=this._createTree(this._cluster(Bt,Pt)),Ie&&console.log("z%d: %d clusters in %dms",Pt,Bt.numItems,+Date.now()-Ut)}return Ie&&console.timeEnd("total time"),this}getClusters(xe,Ie){let Ge=((xe[0]+180)%360+360)%360-180;const kt=Math.max(-90,Math.min(90,xe[1]));let vt=xe[2]===180?180:((xe[2]+180)%360+360)%360-180;const At=Math.max(-90,Math.min(90,xe[3]));if(xe[2]-xe[0]>=360)Ge=-180,vt=180;else if(Ge>vt){const ar=this.getClusters([Ge,kt,180,At],Ie),Wr=this.getClusters([-180,kt,vt,At],Ie);return ar.concat(Wr)}const Bt=this.trees[this._limitZoom(Ie)],Pt=Bt.range(Qe(Ge),nt(At),Qe(vt),nt(kt)),Ut=Bt.data,fr=[];for(const ar of Pt){const Wr=this.stride*ar;fr.push(Ut[Wr+at]>1?qe(Ut,Wr,this.clusterProps):this.points[Ut[Wr+rt]])}return fr}getChildren(xe){const Ie=this._getOriginId(xe),Ge=this._getOriginZoom(xe),kt="No cluster with the specified id.",vt=this.trees[Ge];if(!vt)throw new Error(kt);const At=vt.data;if(Ie*this.stride>=At.length)throw new Error(kt);const Bt=this.options.radius/(this.options.extent*Math.pow(2,Ge-1)),Pt=vt.within(At[Ie*this.stride],At[Ie*this.stride+1],Bt),Ut=[];for(const fr of Pt){const ar=fr*this.stride;At[ar+4]===xe&&Ut.push(At[ar+at]>1?qe(At,ar,this.clusterProps):this.points[At[ar+rt]])}if(Ut.length===0)throw new Error(kt);return Ut}getLeaves(xe,Ie,Ge){const kt=[];return this._appendLeaves(kt,xe,Ie=Ie||10,Ge=Ge||0,0),kt}getTile(xe,Ie,Ge){const kt=this.trees[this._limitZoom(xe)],vt=Math.pow(2,xe),{extent:At,radius:Bt}=this.options,Pt=Bt/At,Ut=(Ge-Pt)/vt,fr=(Ge+1+Pt)/vt,ar={features:[]};return this._addTileFeatures(kt.range((Ie-Pt)/vt,Ut,(Ie+1+Pt)/vt,fr),kt.data,Ie,Ge,vt,ar),Ie===0&&this._addTileFeatures(kt.range(1-Pt/vt,Ut,1,fr),kt.data,vt,Ge,vt,ar),Ie===vt-1&&this._addTileFeatures(kt.range(0,Ut,Pt/vt,fr),kt.data,-1,Ge,vt,ar),ar.features.length?ar:null}getClusterExpansionZoom(xe){let Ie=this._getOriginZoom(xe)-1;for(;Ie<=this.options.maxZoom;){const Ge=this.getChildren(xe);if(Ie++,Ge.length!==1)break;xe=Ge[0].properties.cluster_id}return Ie}_appendLeaves(xe,Ie,Ge,kt,vt){const At=this.getChildren(Ie);for(const Bt of At){const Pt=Bt.properties;if(Pt&&Pt.cluster?vt+Pt.point_count<=kt?vt+=Pt.point_count:vt=this._appendLeaves(xe,Pt.cluster_id,Ge,kt,vt):vt1;let fr,ar,Wr;if(Ut)fr=Oe(Ie,Pt,this.clusterProps),ar=Ie[Pt],Wr=Ie[Pt+1];else{const es=this.points[Ie[Pt+rt]];fr=es.properties;const[ts,Yn]=es.geometry.coordinates;ar=Qe(ts),Wr=nt(Yn)}const wn={type:1,geometry:[[Math.round(this.options.extent*(ar*vt-Ge)),Math.round(this.options.extent*(Wr*vt-kt))]],tags:fr};let Ur;Ur=Ut||this.options.generateId?Ie[Pt+rt]:this.points[Ie[Pt+rt]].id,Ur!==void 0&&(wn.id=Ur),At.features.push(wn)}}_limitZoom(xe){return Math.max(this.options.minZoom,Math.min(Math.floor(+xe),this.options.maxZoom+1))}_cluster(xe,Ie){const{radius:Ge,extent:kt,reduce:vt,minPoints:At}=this.options,Bt=Ge/(kt*Math.pow(2,Ie)),Pt=xe.data,Ut=[],fr=this.stride;for(let ar=0;arIe&&(ts+=Pt[Ds+at])}if(ts>es&&ts>=At){let Yn,Ds=Wr*es,Li=wn*es,po=-1;const ha=(ar/fr<<5)+(Ie+1)+this.points.length;for(const vo of Ur){const ji=vo*fr;if(Pt[ji+2]<=Ie)continue;Pt[ji+2]=Ie;const Ws=Pt[ji+at];Ds+=Pt[ji]*Ws,Li+=Pt[ji+1]*Ws,Pt[ji+4]=ha,vt&&(Yn||(Yn=this._map(Pt,ar,!0),po=this.clusterProps.length,this.clusterProps.push(Yn)),vt(Yn,this._map(Pt,ji)))}Pt[ar+4]=ha,Ut.push(Ds/ts,Li/ts,1/0,ha,-1,ts),vt&&Ut.push(po)}else{for(let Yn=0;Yn1)for(const Yn of Ur){const Ds=Yn*fr;if(!(Pt[Ds+2]<=Ie)){Pt[Ds+2]=Ie;for(let Li=0;Li>5}_getOriginZoom(xe){return(xe-this.points.length)%32}_map(xe,Ie,Ge){if(xe[Ie+at]>1){const At=this.clusterProps[xe[Ie+Me]];return Ge?Object.assign({},At):At}const kt=this.points[xe[Ie+rt]].properties,vt=this.options.map(kt);return Ge&&vt===kt?Object.assign({},vt):vt}}function qe(et,xe,Ie){return{type:"Feature",id:et[xe+rt],properties:Oe(et,xe,Ie),geometry:{type:"Point",coordinates:[(Ge=et[xe],360*(Ge-.5)),gt(et[xe+1])]}};var Ge}function Oe(et,xe,Ie){const Ge=et[xe+at],kt=Ge>=1e4?`${Math.round(Ge/1e3)}k`:Ge>=1e3?Math.round(Ge/100)/10+"k":Ge,vt=et[xe+Me],At=vt===-1?{}:Object.assign({},Ie[vt]);return Object.assign(At,{cluster:!0,cluster_id:et[xe+rt],point_count:Ge,point_count_abbreviated:kt})}function Qe(et){return et/360+.5}function nt(et){const xe=Math.sin(et*Math.PI/180),Ie=.5-.25*Math.log((1+xe)/(1-xe))/Math.PI;return Ie<0?0:Ie>1?1:Ie}function gt(et){const xe=(180-360*et)*Math.PI/180;return 360*Math.atan(Math.exp(xe))/Math.PI-90}function mt(et,xe,Ie,Ge){let kt=Ge;const vt=xe+(Ie-xe>>1);let At,Bt=Ie-xe;const Pt=et[xe],Ut=et[xe+1],fr=et[Ie],ar=et[Ie+1];for(let Wr=xe+3;Wrkt)At=Wr,kt=wn;else if(wn===kt){const Ur=Math.abs(Wr-vt);UrGe&&(At-xe>3&&mt(et,xe,At,Ge),et[At+2]=kt,Ie-At>3&&mt(et,At,Ie,Ge))}function Mt(et,xe,Ie,Ge,kt,vt){let At=kt-Ie,Bt=vt-Ge;if(At!==0||Bt!==0){const Pt=((et-Ie)*At+(xe-Ge)*Bt)/(At*At+Bt*Bt);Pt>1?(Ie=kt,Ge=vt):Pt>0&&(Ie+=At*Pt,Ge+=Bt*Pt)}return At=et-Ie,Bt=xe-Ge,At*At+Bt*Bt}function wt(et,xe,Ie,Ge){const kt={id:et??null,type:xe,geometry:Ie,tags:Ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(xe==="Point"||xe==="MultiPoint"||xe==="LineString")Qt(kt,Ie);else if(xe==="Polygon")Qt(kt,Ie[0]);else if(xe==="MultiLineString")for(const vt of Ie)Qt(kt,vt);else if(xe==="MultiPolygon")for(const vt of Ie)Qt(kt,vt[0]);return kt}function Qt(et,xe){for(let Ie=0;Ie0&&(At+=Ge?(kt*fr-Ut*vt)/2:Math.sqrt(Math.pow(Ut-kt,2)+Math.pow(fr-vt,2))),kt=Ut,vt=fr}const Bt=xe.length-3;xe[2]=1,mt(xe,0,Bt,Ie),xe[Bt+2]=1,xe.size=Math.abs(At),xe.start=0,xe.end=xe.size}function Qr(et,xe,Ie,Ge){for(let kt=0;kt1?1:Ie}function hr(et,xe,Ie,Ge,kt,vt,At,Bt){if(Ge/=xe,vt>=(Ie/=xe)&&At=Ge)return null;const Pt=[];for(const Ut of et){const fr=Ut.geometry;let ar=Ut.type;const Wr=kt===0?Ut.minX:Ut.minY,wn=kt===0?Ut.maxX:Ut.maxY;if(Wr>=Ie&&wn=Ge)continue;let Ur=[];if(ar==="Point"||ar==="MultiPoint")xs(fr,Ur,Ie,Ge,kt);else if(ar==="LineString")ka(fr,Ur,Ie,Ge,kt,!1,Bt.lineMetrics);else if(ar==="MultiLineString")zi(fr,Ur,Ie,Ge,kt,!1);else if(ar==="Polygon")zi(fr,Ur,Ie,Ge,kt,!0);else if(ar==="MultiPolygon")for(const es of fr){const ts=[];zi(es,ts,Ie,Ge,kt,!0),ts.length&&Ur.push(ts)}if(Ur.length){if(Bt.lineMetrics&&ar==="LineString"){for(const es of Ur)Pt.push(wt(Ut.id,ar,es,Ut.tags));continue}ar!=="LineString"&&ar!=="MultiLineString"||(Ur.length===1?(ar="LineString",Ur=Ur[0]):ar="MultiLineString"),ar!=="Point"&&ar!=="MultiPoint"||(ar=Ur.length===3?"Point":"MultiPoint"),Pt.push(wt(Ut.id,ar,Ur,Ut.tags))}}return Pt.length?Pt:null}function xs(et,xe,Ie,Ge,kt){for(let vt=0;vt=Ie&&At<=Ge&&Bi(xe,et[vt],et[vt+1],et[vt+2])}}function ka(et,xe,Ie,Ge,kt,vt,At){let Bt=xa(et);const Pt=kt===0?nl:xo;let Ut,fr,ar=et.start;for(let ts=0;tsIe&&(fr=Pt(Bt,Yn,Ds,po,ha,Ie),At&&(Bt.start=ar+Ut*fr)):vo>Ge?ji=Ie&&(fr=Pt(Bt,Yn,Ds,po,ha,Ie),Ws=!0),ji>Ge&&vo<=Ge&&(fr=Pt(Bt,Yn,Ds,po,ha,Ge),Ws=!0),!vt&&Ws&&(At&&(Bt.end=ar+Ut*fr),xe.push(Bt),Bt=xa(et)),At&&(ar+=Ut)}let Wr=et.length-3;const wn=et[Wr],Ur=et[Wr+1],es=kt===0?wn:Ur;es>=Ie&&es<=Ge&&Bi(Bt,wn,Ur,et[Wr+2]),Wr=Bt.length-3,vt&&Wr>=3&&(Bt[Wr]!==Bt[0]||Bt[Wr+1]!==Bt[1])&&Bi(Bt,Bt[0],Bt[1],Bt[2]),Bt.length&&xe.push(Bt)}function xa(et){const xe=[];return xe.size=et.size,xe.start=et.start,xe.end=et.end,xe}function zi(et,xe,Ie,Ge,kt,vt){for(const At of et)ka(At,xe,Ie,Ge,kt,vt,!1)}function Bi(et,xe,Ie,Ge){et.push(xe,Ie,Ge)}function nl(et,xe,Ie,Ge,kt,vt){const At=(vt-xe)/(Ge-xe);return Bi(et,vt,Ie+(kt-Ie)*At,1),At}function xo(et,xe,Ie,Ge,kt,vt){const At=(vt-Ie)/(kt-Ie);return Bi(et,xe+(Ge-xe)*At,vt,1),At}function Hs(et,xe){const Ie=[];for(let Ge=0;Ge0&&xe.size<(kt?At:Ge))return void(Ie.numPoints+=xe.length/3);const Bt=[];for(let Pt=0;PtAt)&&(Ie.numSimplified++,Bt.push(xe[Pt],xe[Pt+1])),Ie.numPoints++;kt&&function(Pt,Ut){let fr=0;for(let ar=0,Wr=Pt.length,wn=Wr-2;ar0===Ut)for(let ar=0,Wr=Pt.length;ar24)throw new Error("maxZoom should be in the 0-24 range");if(Ie.promoteId&&Ie.generateId)throw new Error("promoteId and generateId cannot be used together.");let kt=function(vt,At){const Bt=[];if(vt.type==="FeatureCollection")for(let Pt=0;Pt1&&console.time("creation"),wn=this.tiles[Wr]=Oa(xe,Ie,Ge,kt,Ut),this.tileCoords.push({z:Ie,x:Ge,y:kt}),fr)){fr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ie,Ge,kt,wn.numFeatures,wn.numPoints,wn.numSimplified),console.timeEnd("creation"));const Ws=`z${Ie}`;this.stats[Ws]=(this.stats[Ws]||0)+1,this.total++}if(wn.source=xe,vt==null){if(Ie===Ut.indexMaxZoom||wn.numPoints<=Ut.indexMaxPoints)continue}else{if(Ie===Ut.maxZoom||Ie===vt)continue;if(vt!=null){const Ws=vt-Ie;if(Ge!==At>>Ws||kt!==Bt>>Ws)continue}}if(wn.source=null,xe.length===0)continue;fr>1&&console.time("clipping");const Ur=.5*Ut.buffer/Ut.extent,es=.5-Ur,ts=.5+Ur,Yn=1+Ur;let Ds=null,Li=null,po=null,ha=null,vo=hr(xe,ar,Ge-Ur,Ge+ts,0,wn.minX,wn.maxX,Ut),ji=hr(xe,ar,Ge+es,Ge+Yn,0,wn.minX,wn.maxX,Ut);xe=null,vo&&(Ds=hr(vo,ar,kt-Ur,kt+ts,1,wn.minY,wn.maxY,Ut),Li=hr(vo,ar,kt+es,kt+Yn,1,wn.minY,wn.maxY,Ut),vo=null),ji&&(po=hr(ji,ar,kt-Ur,kt+ts,1,wn.minY,wn.maxY,Ut),ha=hr(ji,ar,kt+es,kt+Yn,1,wn.minY,wn.maxY,Ut),ji=null),fr>1&&console.timeEnd("clipping"),Pt.push(Ds||[],Ie+1,2*Ge,2*kt),Pt.push(Li||[],Ie+1,2*Ge,2*kt+1),Pt.push(po||[],Ie+1,2*Ge+1,2*kt),Pt.push(ha||[],Ie+1,2*Ge+1,2*kt+1)}}getTile(xe,Ie,Ge){xe=+xe,Ie=+Ie,Ge=+Ge;const kt=this.options,{extent:vt,debug:At}=kt;if(xe<0||xe>24)return null;const Bt=1<1&&console.log("drilling down to z%d-%d-%d",xe,Ie,Ge);let Ut,fr=xe,ar=Ie,Wr=Ge;for(;!Ut&&fr>0;)fr--,ar>>=1,Wr>>=1,Ut=this.tiles[Ao(fr,ar,Wr)];return Ut&&Ut.source?(At>1&&(console.log("found parent tile z%d-%d-%d",fr,ar,Wr),console.time("drilling down")),this.splitTile(Ut.source,fr,ar,Wr,xe,Ie,Ge),At>1&&console.timeEnd("drilling down"),this.tiles[Pt]?Ns(this.tiles[Pt],vt):null):null}}function Ao(et,xe,Ie){return 32*((1<Ut.tags&&"3d_elevation_id"in Ut.tags&&"source"in Ut.tags&&Ut.tags.source==="elevation",vt=Ge.features.filter(Ut=>kt(Ut));let At={_geojsonTileLayer:Ge.features};vt.length>0&&(At={_geojsonTileLayer:Ge.features.filter(Ut=>!kt(Ut)),hd_road_elevation:vt});const Bt=new ae(At),Pt=function(Ut){const fr=new i.bt;for(const ar of Object.keys(Ut))fr.writeMessage(3,Be,{name:ar,features:Ut[ar]});return fr.finish()}(At).buffer;xe(null,{vectorTile:Bt,rawData:Pt})}class yo extends V{constructor(xe,Ie,Ge,kt,vt,At,Bt){super(xe,Ie,Ge,kt,vt,ss,Bt),At&&(this.loadGeoJSON=At),this._dynamicIndex=new he}loadData(xe,Ie){const Ge=xe&&xe.request,kt=Ge&&Ge.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(xe,(vt,At)=>{if(vt||!At)return Ie(vt);if(typeof At!="object")return Ie(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`));{try{if(xe.filter){const Pt=i.U(xe.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Pt.result==="error")throw new Error(Pt.value.map(Ut=>`${Ut.key}: ${Ut.message}`).join(", "));At.features=At.features.filter(Ut=>Pt.value.evaluate({zoom:0},Ut))}xe.dynamic?(At.type==="Feature"&&(At={type:"FeatureCollection",features:[At]}),xe.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(At.features,this.loaded),xe.cluster&&(At.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=xe.cluster?new ft(function({superclusterOptions:Pt,clusterProperties:Ut}){if(!Ut||!Pt)return Pt;const fr={},ar={},Wr={accumulated:null,zoom:0},wn={properties:null},Ur=Object.keys(Ut);for(const es of Ur){const[ts,Yn]=Ut[es],Ds=i.U(Yn),Li=i.U(typeof ts=="string"?[ts,["accumulated"],["get",es]]:ts);fr[es]=Ds.value,ar[es]=Li.value}return Pt.map=es=>{wn.properties=es;const ts={};for(const Yn of Ur)ts[Yn]=fr[Yn].evaluate(Wr,wn);return ts},Pt.reduce=(es,ts)=>{wn.properties=ts;for(const Yn of Ur)Wr.accumulated=es[Yn],es[Yn]=ar[Yn].evaluate(Wr,wn)},Pt}(xe)).load(At.features):xe.dynamic?this._dynamicIndex:function(Pt,Ut){return new ml(Pt,Ut)}(At,xe.geojsonVtOptions)}catch(Pt){return Ie(Pt)}const Bt={};if(kt){const Pt=h(Ge);Pt&&(Bt.resourceTiming={},Bt.resourceTiming[xe.source]=JSON.parse(JSON.stringify(Pt)))}Ie(null,Bt)}})}reloadTile(xe,Ie){const Ge=this.loaded;return Ge&&Ge[xe.uid]?xe.partial?Ie(null,void 0):super.reloadTile(xe,Ie):this.loadTile(xe,Ie)}loadGeoJSON(xe,Ie){if(xe.request)i.m(xe.request,Ie);else{if(typeof xe.data!="string")return Ie(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Ie(null,JSON.parse(xe.data))}catch{return Ie(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(xe,Ie){try{Ie(null,this._geoJSONIndex.getClusterExpansionZoom(xe.clusterId))}catch(Ge){Ie(Ge)}}getClusterChildren(xe,Ie){try{Ie(null,this._geoJSONIndex.getChildren(xe.clusterId))}catch(Ge){Ie(Ge)}}getClusterLeaves(xe,Ie){try{Ie(null,this._geoJSONIndex.getLeaves(xe.clusterId,xe.limit,xe.offset))}catch(Ge){Ie(Ge)}}}class xu{constructor(xe,Ie,Ge){this.tileID=new i.aQ(xe.tileID.overscaledZ,xe.tileID.wrap,xe.tileID.canonical.z,xe.tileID.canonical.x,xe.tileID.canonical.y),this.tileZoom=xe.tileZoom,this.uid=xe.uid,this.zoom=xe.zoom,this.canonical=xe.tileID.canonical,this.pixelRatio=xe.pixelRatio,this.tileSize=xe.tileSize,this.source=xe.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=xe.projection,this.brightness=Ie,this.worldview=Ge}parse(xe,Ie,Ge,kt){this.status="parsing";const vt=new i.aQ(Ge.tileID.overscaledZ,Ge.tileID.wrap,Ge.tileID.canonical.z,Ge.tileID.canonical.x,Ge.tileID.canonical.y),At=[],Bt=Ie.familiesBySource[Ge.source],Pt=new i.fn(vt,Ge.promoteId);Pt.bucketLayerIDs=[],Pt.is3DTile=!0,i.fC(xe).then(Ut=>{if(!Ut)return kt(new Error("Could not parse tile"));const fr=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ut.json.asset.extras&&Ut.json.asset.extras.MAPBOX_mesh_features,ar=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("EXT_meshopt_compression"),Wr=new i.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const wn in Bt)for(const Ur of Bt[wn]){const es=Ur[0];Pt.bucketLayerIDs.push(Ur.map(Ds=>i.B(Ds.id,Ds.scope))),es.recalculate(Wr,[]);const ts=i.fD(Ut,1/i.d7(Ge.tileID.canonical)),Yn=new i.fE(Ur,ts,vt,fr,ar,this.brightness,Pt,this.worldview);fr||(Yn.needsUpload=!0),At.push(Yn),Yn.evaluate(es)}this.status="done",kt(null,{buckets:At,featureIndex:Pt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ut=>kt(new Error(Ut.message)))}}class $l{constructor(xe,Ie,Ge,kt,vt,At,Bt,Pt){this.actor=xe,this.layerIndex=Ie,this.availableImages=Ge,this.availableModels=kt,this.brightness=Bt,this.loading={},this.loaded={},this.worldview=Pt}loadTile(xe,Ie){const Ge=xe.uid,kt=this.loading[Ge]=new xu(xe,this.brightness,this.worldview);i.bu(xe.request,(vt,At)=>{const Bt=!this.loading[Ge];return delete this.loading[Ge],Bt||vt?(kt.status="done",Bt||(this.loaded[Ge]=kt),Ie(vt)):At&&At.byteLength!==0?void kt.parse(At,this.layerIndex,xe,(Pt,Ut)=>{kt.status="done",this.loaded=this.loaded||{},this.loaded[Ge]=kt,Pt||!Ut?Ie(Pt):Ie(null,Ut)}):(kt.status="done",this.loaded[Ge]=kt,Ie())})}reloadTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;if(Ge&&Ge[kt]){const vt=Ge[kt];vt.projection=xe.projection,vt.brightness=xe.brightness;const At=(Bt,Pt)=>{vt.reloadCallback&&(delete vt.reloadCallback,this.loadTile(xe,Ie)),Ie(Bt,Pt)};vt.status==="parsing"?vt.reloadCallback=At:vt.status==="done"&&this.loadTile(xe,Ie)}}abortTile(xe,Ie){const Ge=xe.uid;this.loading[Ge]&&delete this.loading[Ge],Ie()}removeTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;Ge&&Ge[kt]&&delete Ge[kt],Ie()}}class yu{constructor(xe){this.self=xe,this.actor=new i.fG(xe,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new i.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=i.cm({name:"mercator"}),this.workerSourceTypes={vector:V,geojson:yo,"raster-dem":K,"raster-array":te,"batched-model":$l},this.workerSources={},this.self.registerWorkerSource=(Ie,Ge)=>{if(this.workerSourceTypes[Ie])throw new Error(`Worker source with name "${Ie}" already registered.`);this.workerSourceTypes[Ie]=Ge},this.self.registerRTLTextPlugin=Ie=>{if(i.fH.isParsed())throw new Error("RTL text plugin already registered.");i.fH.setState({pluginStatus:i.fI.parsed,pluginURL:i.fH.getPluginURL()}),i.fH.applyArabicShaping=Ie.applyArabicShaping,i.fH.processBidirectionalText=Ie.processBidirectionalText,i.fH.processStyledBidirectionalText=Ie.processStyledBidirectionalText;for(const Ge of this.rtlPluginParsingListeners)Ge(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(xe,Ie,Ge){delete this.layerIndexes[xe],delete this.availableImages[xe],delete this.availableModels[xe],delete this.workerSources[xe],Ge()}checkIfReady(xe,Ie,Ge){Ge()}setReferrer(xe,Ie){this.referrer=Ie}spriteLoaded(xe,Ie){this.isSpriteLoaded[xe]||(this.isSpriteLoaded[xe]={});const{scope:Ge,isLoaded:kt}=Ie;if(this.isSpriteLoaded[xe][Ge]=kt,this.workerSources[xe]&&this.workerSources[xe][Ge])for(const vt in this.workerSources[xe][Ge]){const At=this.workerSources[xe][Ge][vt];for(const Bt in At){const Pt=At[Bt];Pt instanceof V&&(Pt.isSpriteLoaded=kt,Pt.fire(new i.z("isSpriteLoaded")))}}}setImages(xe,Ie,Ge){this.availableImages[xe]||(this.availableImages[xe]={});const{scope:kt,images:vt}=Ie;if(this.availableImages[xe][kt]=vt,this.workerSources[xe]&&this.workerSources[xe][kt]){for(const At in this.workerSources[xe][kt]){const Bt=this.workerSources[xe][kt][At];for(const Pt in Bt)Bt[Pt].availableImages=vt}Ge()}else Ge()}setModels(xe,{scope:Ie,models:Ge},kt){if(this.availableModels[xe]||(this.availableModels[xe]={}),this.availableModels[xe][Ie]=Ge,this.workerSources[xe]&&this.workerSources[xe][Ie]){for(const vt in this.workerSources[xe][Ie]){const At=this.workerSources[xe][Ie][vt];for(const Bt in At)At[Bt].availableModels=Ge}kt()}else kt()}setProjection(xe,Ie){this.projections[xe]=i.cm(Ie)}setBrightness(xe,Ie,Ge){this.brightness=Ie,Ge()}setWorldview(xe,Ie,Ge){this.worldview=Ie,Ge()}setLayers(xe,Ie,Ge){this.getLayerIndex(xe,Ie.scope).replace(Ie.layers,Ie.options),Ge()}updateLayers(xe,Ie,Ge){this.getLayerIndex(xe,Ie.scope).update(Ie.layers,Ie.removedIds,Ie.options),Ge()}loadTile(xe,Ie,Ge){Ie.projection=this.projections[xe]||this.defaultProjection,this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).loadTile(Ie,Ge)}decodeRasterArray(xe,Ie,Ge){this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).decodeRasterArray(Ie,Ge)}reloadTile(xe,Ie,Ge){Ie.projection=this.projections[xe]||this.defaultProjection,this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).reloadTile(Ie,Ge)}abortTile(xe,Ie,Ge){this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).abortTile(Ie,Ge)}removeTile(xe,Ie,Ge){this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).removeTile(Ie,Ge)}removeSource(xe,Ie,Ge){if(!(this.workerSources[xe]&&this.workerSources[xe][Ie.scope]&&this.workerSources[xe][Ie.scope][Ie.type]&&this.workerSources[xe][Ie.scope][Ie.type][Ie.source]))return;const kt=this.workerSources[xe][Ie.scope][Ie.type][Ie.source];delete this.workerSources[xe][Ie.scope][Ie.type][Ie.source],kt.removeSource!==void 0?kt.removeSource(Ie,Ge):Ge()}loadWorkerSource(xe,Ie,Ge){try{this.self.importScripts(Ie.url),Ge()}catch(kt){Ge(kt)}}syncRTLPluginState(xe,Ie,Ge){if(i.fH.isParsed())Ge(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ge);else try{i.fH.setState(Ie);const kt=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||kt==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(kt),i.fH.isParsed()?Ge(null,!0):this.rtlPluginParsingListeners.push(Ge))}catch(kt){Ge(kt)}}setDracoUrl(xe,Ie){this.dracoUrl=Ie}getAvailableImages(xe,Ie){this.availableImages[xe]||(this.availableImages[xe]={});let Ge=this.availableImages[xe][Ie];return Ge||(Ge=[]),Ge}getAvailableModels(xe,Ie){this.availableModels[xe]||(this.availableModels[xe]={});let Ge=this.availableModels[xe][Ie];return Ge||(Ge={}),Ge}getLayerIndex(xe,Ie){this.layerIndexes[xe]||(this.layerIndexes[xe]={});let Ge=this.layerIndexes[xe][Ie];return Ge||(Ge=this.layerIndexes[xe][Ie]=new y,Ge.scope=Ie),Ge}getWorkerSource(xe,Ie,Ge,kt){const vt=this.workerSources;return vt[xe]||(vt[xe]={}),vt[xe][kt]||(vt[xe][kt]={}),vt[xe][kt][Ie]||(vt[xe][kt][Ie]={}),this.isSpriteLoaded[xe]||(this.isSpriteLoaded[xe]={}),vt[xe][kt][Ie][Ge]||(vt[xe][kt][Ie][Ge]=new this.workerSourceTypes[Ie]({send:(At,Bt,Pt,Ut,fr,ar)=>this.actor.send(At,Bt,Pt,xe,fr,ar),scheduler:this.actor.scheduler},this.getLayerIndex(xe,kt),this.getAvailableImages(xe,kt),this.getAvailableModels(xe,kt),this.isSpriteLoaded[xe][kt],void 0,this.brightness,this.worldview)),vt[xe][kt][Ie][Ge]}rasterizeImagesWorker(xe,Ie,Ge){const kt=new Map;for(const[vt,{image:At,imageVariant:Bt}]of Ie.tasks.entries()){const Pt=this.imageRasterizer.rasterize(Bt,At,Ie.scope,xe);kt.set(vt,Pt)}Ge(void 0,kt)}removeRasterizedImages(xe,Ie,Ge){this.imageRasterizer.removeImagesFromCacheByIds(Ie.imageIds,Ie.scope,xe),Ge()}enforceCacheSizeLimit(xe,Ie){i.fJ(Ie)}getWorkerPerformanceMetrics(xe,Ie,Ge){Ge(void 0,void 0)}}return i.fF(self)&&(self.worker=new yu(self)),yu}),o(["./shared"],function(i){var h="3.17.0";const p={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(b){performance.mark(b)},measure(b,d,m){performance.measure(b,d,m)}};function y(b){const d=b.name.split("?")[0];return i.a(d)&&d.includes("mapbox-gl.js")?"javascript":i.a(d)&&d.includes("mapbox-gl.css")?"css":i.b(d)?"fontRange":i.c(d)?"sprite":i.i(d)?"style":i.d(d)?"tilejson":"other"}var _,j={},C=function(){if(_)return j;function b(w){return!d(w)}function d(w){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var O,D,B=new Blob([""],{type:"text/javascript"}),H=URL.createObjectURL(B);try{D=new Worker(H),O=!0}catch{O=!1}return D&&D.terminate(),URL.revokeObjectURL(H),O}()?function(){var O=document.createElement("canvas");O.width=O.height=1;var D=O.getContext("2d");if(!D)return!1;var B=D.getImageData(0,0,1,1);return B&&B.width===O.width}()?(m[M=w&&w.failIfMajorPerformanceCaveat]===void 0&&(m[M]=function(O){var D,B=function(H){var Y=document.createElement("canvas"),Q=Object.create(b.webGLContextAttributes);return Q.failIfMajorPerformanceCaveat=H,Y.getContext("webgl2",Q)}(O);if(!B)return!1;try{D=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!D||B.isContextLost())&&(B.shaderSource(D,"void main() {}"),B.compileShader(D),B.getShaderParameter(D,B.COMPILE_STATUS)===!0)}(M)),m[M]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var M}_=1,j.supported=b,j.notSupportedReason=d;var m={};return b.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},j}();function N(b,d,m){const w=document.createElement(b);return d!=null&&(w.className=d),m&&m.appendChild(w),w}function A(b,d,m){const w=document.createElementNS("http://www.w3.org/2000/svg",b);for(const M of Object.keys(d))w.setAttributeNS(null,M,String(d[M]));return m&&m.appendChild(w),w}const E=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=E&&E.userSelect!==void 0?"userSelect":"WebkitUserSelect";let P;function z(){E&&T&&(P=E[T],E[T]="none")}function F(){E&&T&&(E[T]=P)}function q(b){b.preventDefault(),b.stopPropagation(),window.removeEventListener("click",q,!0)}function V(){window.addEventListener("click",q,!0),window.setTimeout(()=>{window.removeEventListener("click",q,!0)},0)}function K(b,d){const m=b.getBoundingClientRect();return ie(b,m,d)}function G(b,d){const m=b.getBoundingClientRect(),w=[];for(let M=0;Mthis._skuTokenExpiresAt}transformRequest(d,m){return this._transformRequestFn&&this._transformRequestFn(d,m)||{url:d}}normalizeStyleURL(d,m){if(!i.h(d))return d;const w=se(d);return w.params.push(`sdk=js-${h}`),w.path=`/styles/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeGlyphsURL(d,m){if(!i.h(d))return d;const w=se(d);return w.path=`/fonts/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeModelURL(d,m){if(!i.h(d))return d;const w=se(d);return w.path=`/models/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeSourceURL(d,m,w,M){if(!i.h(d))return d;const O=se(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),w&&O.params.push(`language=${w}`),M&&O.params.push(`worldview=${M}`),this._makeAPIURL(O,this._customAccessToken||m)}normalizeIconsetURL(d,m){const w=se(d);return i.h(d)?(w.path=`/styles/v1${w.path}/iconset.pbf`,this._makeAPIURL(w,this._customAccessToken||m)):he(w)}normalizeSpriteURL(d,m,w,M){const O=se(d);return i.h(d)?(O.path=`/styles/v1${O.path}/sprite${m}${w}`,this._makeAPIURL(O,this._customAccessToken||M)):(O.path+=`${m}${w}`,he(O))}normalizeTileURL(d,m,w){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!i.h(d))return d;const M=se(d);M.path=M.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${m||w&&M.authority!=="raster"&&w===512?"@2x":""}${i.k.supported?".webp":"$1"}`),M.authority==="raster"?M.path=`/${i.e.RASTER_URL_PREFIX}${M.path}`:M.authority==="rasterarrays"?M.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${M.path}`:M.authority==="3dtiles"?M.path=`/${i.e.TILES3D_URL_PREFIX}${M.path}`:(M.path=M.path.replace(/^.+\/v4\//,"/"),M.path=`/${i.e.TILE_URL_VERSION}${M.path}`);const O=this._customAccessToken||function(D){for(const B of D){const H=B.match(/^access_token=(.*)$/);if(H)return H[1]}return null}(M.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&M.params.push(`sku=${this._skuToken}`),this._makeAPIURL(M,O)}canonicalizeTileURL(d,m){const w=se(d);if(!w.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!w.path.match(/\.[\w]+$/))return d;let M="mapbox://";w.path.match(/^\/raster\/v1\//)?M+=`raster/${w.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:w.path.match(/^\/rasterarrays\/v1\//)?M+=`rasterarrays/${w.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:M+=`tiles/${w.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let O=w.params;return m&&(O=O.filter(D=>!D.match(/^access_token=/))),O.length&&(M+=`?${O.join("&")}`),M}canonicalizeTileset(d,m){const w=!!m&&i.h(m),M=[];for(const O of d.tiles||[])i.j(O)?M.push(this.canonicalizeTileURL(O,w)):M.push(O);return M}_makeAPIURL(d,m){const w="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",M=se(i.e.API_URL);if(d.protocol=M.protocol,d.authority=M.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(M.path!=="/"&&(d.path=`${M.path}${d.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return he(d);if(m=m||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!m)throw new Error(`An API access token is required to use Mapbox GL. ${w}`);if(m[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${w}`)}return d.params=d.params.filter(O=>O.indexOf("access_token")===-1),d.params.push(`access_token=${m||""}`),he(d)}}const pe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function se(b){const d=b.match(pe);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 he(b){const d=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${d}`}const ue="mapbox.eventData";function _e(b){if(!b)return null;const d=b.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(i.l(d[1]))}catch{return null}}class Ae{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const m=_e(i.e.ACCESS_TOKEN);let w="";return w=m&&m.u?i.f(m.u):i.e.ACCESS_TOKEN||"",d?`${ue}.${d}:${w}`:`${ue}:${w}`}fetchEventData(){const d=i.s("localStorage"),m=this.getStorageKey(),w=this.getStorageKey("uuid"),M=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(m);O&&(this.eventData=JSON.parse(O));const D=localStorage.getItem(w);D&&(this.anonId=D);const B=localStorage.getItem(M);B&&(this.anonIdTimestamp=Number(B));const H=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(m,JSON.stringify(this.eventData)),D&&localStorage.setItem(M,D.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,m,w,M){if(!i.e.EVENTS_URL)return;const O=se(i.e.EVENTS_URL);O.params.push(`access_token=${M||i.e.ACCESS_TOKEN||""}`);const D={event:this.type,created:new Date(d).toISOString()},B=m?Object.assign(D,m):D,H={url:he(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=i.p(H,Y=>{this.pendingRequest=null,w(Y),this.saveEventData(),this.processRequests(M)})}queueRequest(d,m){this.queue.push(d),this.processRequests(m)}}class Ce extends Ae{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!i.e.EVENTS_URL||!d&&!i.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID();const m=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:m},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:m,payload:w}=this.queue.shift();this.postEvent(m,w,()=>{},d)}}const Se=new class extends Ae{constructor(b){super("appUserTurnstile"),this._customAccessToken=b}postTurnstileEvent(b,d){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(b)&&b.some(m=>i.h(m)||i.j(m))&&this.queueRequest(Date.now(),d)}processRequests(b){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=_e(i.e.ACCESS_TOKEN),m=d?d.u:i.e.ACCESS_TOKEN;let w=m!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),w=!0);const M=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),D=new Date(M),B=(M-this.eventData.lastSuccess)/864e5;w=w||B>=1||B<-1||O.getDate()!==D.getDate()}else w=!0;w?this.postEvent(M,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:oe,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=M,this.eventData.tokenU=m)},b):this.processRequests()}},ge=Se.postTurnstileEvent.bind(Se),Le=new class extends Ae{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(b,d,m,w){this.skuToken=d,this.errorCb=w,i.e.EVENTS_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},m):this.errorCb(new Error(ye)))}processRequests(b){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(m,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:oe,skuToken:this.skuToken,userId:this.anonId},w=>{w?this.errorCb(w):d&&(this.success[d]=!0)},b))}remove(){this.errorCb=null}},ke=Le.postMapLoadEvent.bind(Le),Be=new class extends Ae{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(b){let d=this.mapInstanceIdMap.get(b);return d||(d=i.u(),this.mapInstanceIdMap.set(b,d)),d}getEventId(b){const d=this.eventIdPerMapInstanceMap.get(b)||0;return this.eventIdPerMapInstanceMap.set(b,d+1),d}postStyleLoadEvent(b,d){const{map:m,style:w,importedStyles:M}=d;if(!i.e.EVENTS_URL||!b&&!i.e.ACCESS_TOKEN)return;const O=this.getMapInstanceId(m),D={mapInstanceId:O,eventId:this.getEventId(O),style:w};M.length&&(D.importedStyles=M),this.queueRequest({timestamp:Date.now(),payload:D},b)}processRequests(b){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:m}=this.queue.shift();this.postEvent(d,m,()=>{},b)}},Ee=Be.postStyleLoadEvent.bind(Be),Ue=new Ce({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Fe=Ue.postMetricsEvent.bind(Ue),be=new Ce({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),tt=be.postMetricsEvent.bind(be),Te=new class extends Ae{constructor(){super("gljs.performance")}postPerformanceEvent(b,d){i.e.EVENTS_URL&&(b||i.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},b)}processRequests(b){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:m}=this.queue.shift(),w=function(M){const O=performance.getEntriesByType("resource"),D=performance.getEntriesByType("mark"),B=function(de){const we={};if(de){for(const ve in de)if(ve!=="other")for(const De of de[ve]){const Pe=`${ve}ResolveRangeMin`,Ve=`${ve}ResolveRangeMax`,Xe=`${ve}RequestCount`,We=`${ve}RequestCachedCount`;we[Pe]=Math.min(we[Pe]||1/0,De.startTime),we[Ve]=Math.max(we[Ve]||-1/0,De.responseEnd);const bt=ut=>{we[ut]===void 0&&(we[ut]=0),++we[ut]};De.transferSize!==void 0&&De.transferSize===0&&bt(We),bt(Xe)}}return we}(function(de,we){const ve={};if(de)for(const De of de){const Pe=we(De);ve[Pe]===void 0&&(ve[Pe]=[]),ve[Pe].push(De)}return ve}(O,y)),H=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,Q=Y?Y.effectiveType:void 0,ce={counters:[],metadata:[],attributes:[]},le=(de,we,ve)=>{ve!=null&&de.push({name:we,value:ve.toString()})};for(const de in B)le(ce.counters,de,B[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])),D)for(const de of Object.values(p)){const we=D.find(ve=>ve.name===de);we&&le(ce.counters,de,we.startTime)}return le(ce.counters,"visibilityHidden",M.visibilityHidden),le(ce.attributes,"style",function(de){if(de)for(const we of de){const ve=we.name.split("?")[0];if(i.i(ve)){const De=ve.split("/").slice(-2);if(De.length===2)return`mapbox://styles/${De[0]}/${De[1]}`}}}(O)),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",H),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/H),le(ce.metadata,"mapHeight",M.height/H),le(ce.metadata,"webglRenderer",M.renderer),le(ce.metadata,"webglVendor",M.vendor),le(ce.metadata,"sdkVersion",h),le(ce.metadata,"sdkIdentifier","mapbox-gl-js"),ce}(m);for(const M of w.metadata);for(const M of w.counters);for(const M of w.attributes);this.postEvent(d,w,()=>{},b)}},Ke=Te.postPerformanceEvent.bind(Te),me=new class extends Ae{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(b,d,m,w){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const M=se(i.e.API_URL+i.e.SESSION_PATH);M.params.push(`sku=${d||""}`),M.params.push(`access_token=${w||i.e.ACCESS_TOKEN||""}`);const O={url:he(M),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(O,D=>{this.pendingRequest=null,m(D),this.saveEventData(),this.processRequests(w)})}getSessionAPI(b,d,m,w){this.skuToken=d,this.errorCb=w,i.e.SESSION_PATH&&i.e.API_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},m):this.errorCb(new Error(ye)))}processRequests(b){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||this.getSession(m,this.skuToken,w=>{w?this.errorCb(w):d&&(this.success[d]=!0)},b)}remove(){this.errorCb=null}},yt=me.getSessionAPI.bind(me),rt=new Set;function at(b,d){d?rt.add(b):rt.delete(b)}class Me{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,m){this._updatedSourceCaches[d]=m,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const m=d.scope;this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._updatedLayers[m].add(d.id),this.setDirty()}removeLayer(d){const m=d.scope;this._removedLayers[m]=this._removedLayers[m]||{},this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._removedLayers[m][d.id]=d,this._updatedLayers[m].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 m in this._updatedLayers)d[m]=d[m]||{},d[m].updatedIds=Array.from(this._updatedLayers[m].values());for(const m in this._removedLayers)d[m]=d[m]||{},d[m].removedIds=Object.keys(this._removedLayers[m]);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,m){this._updatedImages[m]=this._updatedImages[m]||new Set,this._updatedImages[m].add(i.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 ft(b){const{userImage:d}=b;return!!(d&&d.render&&d.render())&&(b.data.replace(new Uint8Array(d.data.buffer)),!0)}class qe extends i.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"&&i.r()&&(this.imageRasterizerDispatcher=new i.D(i.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 i.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 m=this.atlasTexture.get(d);m&&(m.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,m){this.imageProviders.has(m)||this.imageProviders.set(m,new Map),this.imageProviders.get(m).set(d.id,d)}removeImageProvider(d,m){this.imageProviders.has(m)&&this.imageProviders.get(m).delete(d)}getPendingImageProviders(){const d=[];for(const m of this.imageProviders.values())for(const w of m.values())w.hasPendingRequests()&&d.push(w);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new i.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,m){if(this.loaded.get(m)!==d&&(this.loaded.set(m,d),d)){for(const{ids:w,callback:M}of this.requestors)this._notify(w,m,M);this.requestors=[]}}hasImage(d,m){return!!this.getImage(d,m)}getImage(d,m){return this.images.get(m).get(d.toString())}addImage(d,m,w){this._validate(d,w)&&this.images.get(m).set(d.toString(),w)}_validate(d,m){let w=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),w=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),w=!1),this._validateContent(m.content,m)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "content" value`))),w=!1),w}_validateStretch(d,m){if(!d)return!0;let w=0;for(const M of d){if(M[0]i.I.from(m))}getImages(d,m,w){const M=[],O=[],D=this.imageProviders.get(m);for(const Q of d){if(!Q.iconsetId){M.push(Q);continue}const ce=D.get(Q.iconsetId);ce&&(this.getImage(Q,m)?O.push(Q):ce.addPendingRequest(Q))}if(M.length===0)return void this._notify(O,m,w);let B=!0;const H=!!this.loaded.get(m),Y=this.images.get(m);if(!H)for(const Q of M)Y.has(Q.toString())||(B=!1);H||B?this._notify(M,m,w):this.requestors.push({ids:M,scope:m,callback:w})}rasterizeImages(d,m){const w=new Map,{tasks:M,scope:O}=d;for(const[D,B]of M.entries()){const H=this.getImage(B.id,O);H&&w.set(D,{image:H,imageVariant:B})}this._rasterizeImages(O,w,m)}_rasterizeImages(d,m,w){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:m,scope:d},w);else{const M=new Map;for(const[O,{image:D,imageVariant:B}]of m.entries())M.set(O,this.imageRasterizer.rasterize(B,D,d,0));w(void 0,M)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,m,w){const M=this.images.get(m),O=new Map;for(const D of d){if(!M.get(D.toString())){if(D.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:D.name}))}const B=M.get(D.toString());if(!B){i.w(`Image "${D.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 H={data:B.usvg?null:B.data.clone(),pixelRatio:B.pixelRatio,sdf:B.sdf,usvg:B.usvg,version:B.version,stretchX:B.stretchX,stretchY:B.stretchY,content:B.content,hasRenderCallback:!!(B.userImage&&B.userImage.render)};B.usvg&&Object.assign(H,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),O.set(i.I.toString(D),H)}w(null,O)}getPixelSize(d){const{width:m,height:w}=this.atlasImage.get(d);return{width:m,height:w}}getPattern(d,m,w){const M=d.toString(),O=this.patterns.get(m),D=O.get(M),B=this.getImage(d,m);if(!B)return null;if(D){if(D.position.version===B.version)return D.position;D.position.version=B.version}else{if(B.usvg&&!B.data){const H=this.getPatternInFlightId(M,m);if(this.patternsInFlight.has(H))return null;this.patternsInFlight.add(H);const Y=new i.A(d).scaleSelf(i.o.devicePixelRatio),Q=new Map([[Y.toString(),{image:B,imageVariant:Y}]]);return this._rasterizeImages(m,Q,(ce,le)=>this.storePatternImage(Y,m,B,w,le)),null}this.storePattern(d,m,B)}return this._updatePatternAtlas(m,w),O.get(M).position}getPatternInFlightId(d,m){return i.B(d,m)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,m,w,M,O){const D=d.toString(),B=O?O.get(D):void 0;B&&(w.data=B,this.storePattern(d.id,m,w),this._updatePatternAtlas(m,M),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),m)))}storePattern(d,m,w){const M={w:w.data.width+2*i.C,h:w.data.height+2*i.C,x:0,y:0},O=new i.F(M,w,i.C);this.patterns.get(m).set(d.toString(),{bin:M,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,m){const w=d.gl;let M=this.atlasTexture.get(m);M?this.dirty&&(M.update(this.atlasImage.get(m)),this.dirty=!1):(M=new i.T(d,this.atlasImage.get(m),w.RGBA8),this.atlasTexture.set(m,M)),M.bind(w.LINEAR,w.CLAMP_TO_EDGE)}_updatePatternAtlas(d,m){const w=this.patterns.get(d),M=Array.from(w.values()).map(({bin:Y})=>Y),{w:O,h:D}=i.G(M),B=this.atlasImage.get(d);B.resize({width:O||1,height:D||1});const H=this.images.get(d);for(const[Y,{bin:Q,position:ce}]of w.entries()){let le=ce.padding;const de=Q.x+le,we=Q.y+le,ve=H.get(Y).data,De=ve.width,Pe=ve.height;le=le>1?le-1:le,i.q.copy(ve,B,{x:0,y:0},{x:de,y:we},{width:De,height:Pe},m),i.q.copy(ve,B,{x:0,y:Pe-le},{x:de,y:we-le},{width:De,height:le},m),i.q.copy(ve,B,{x:0,y:0},{x:de,y:we+Pe},{width:De,height:le},m),i.q.copy(ve,B,{x:De-le,y:0},{x:de-le,y:we},{width:le,height:Pe},m),i.q.copy(ve,B,{x:0,y:0},{x:de+De,y:we},{width:le,height:Pe},m),i.q.copy(ve,B,{x:De-le,y:Pe-le},{x:de-le,y:we-le},{width:le,height:le},m),i.q.copy(ve,B,{x:0,y:Pe-le},{x:de+De,y:we-le},{width:le,height:le},m),i.q.copy(ve,B,{x:0,y:0},{x:de+De,y:we+Pe},{width:le,height:le},m),i.q.copy(ve,B,{x:De-le,y:0},{x:de-le,y:we+Pe},{width:le,height:le},m)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,m){const w=this.images.get(m);for(const M of d){if(this.callbackDispatchedThisFrame.get(m).has(M.toString()))continue;this.callbackDispatchedThisFrame.get(m).add(M.toString());const O=w.get(M.toString());ft(O)&&this.updateImage(M,m,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Oe(b){const d=b.value,m=b.valueSpec,w=b.style,M=b.styleSpec,O=b.key,D=b.arrayElementValidator||Hs;if(!Array.isArray(d))return[new i.V(O,d,`array expected, ${i.K(d)} found`)];if(m.length&&d.length!==m.length)return[new i.V(O,d,`array length ${m.length} expected, length ${d.length} found`)];if(m["min-length"]&&d.lengthM)return[new i.V(d,m,`${m} is greater than the maximum value ${M}`)]}return[]}function nt(b){const d=b.key,m=b.value;if(!i.H(m))return[new i.V(d,m,`object expected, ${i.K(m)} found`)];const w=b.valueSpec,M=i.J(m.type);let O,D,B,H={};const Y=M!=="categorical"&&m.property===void 0,Q=!Y,ce=function(ve){const De=ve.stops;return Array.isArray(De)&&Array.isArray(De[0])&&i.H(De[0][0])}(m),le=Xa({key:b.key,value:b.value,valueSpec:b.styleSpec.function,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{stops:function(ve){if(M==="identity")return[new i.V(ve.key,ve.value,'identity function may not have a "stops" property')];let De=[];const Pe=ve.value;return De=De.concat(Oe({key:ve.key,value:Pe,valueSpec:ve.valueSpec,style:ve.style,styleSpec:ve.styleSpec,arrayElementValidator:de})),Array.isArray(Pe)&&Pe.length===0&&De.push(new i.V(ve.key,Pe,"array must have at least one stop")),De},default:function(ve){return Hs({key:ve.key,value:ve.value,valueSpec:w,style:ve.style,styleSpec:ve.styleSpec})}}});return M==="identity"&&Y&&le.push(new i.V(b.key,b.value,'missing required property "property"')),M==="identity"||m.stops||le.push(new i.V(b.key,b.value,'missing required property "stops"')),M==="exponential"&&w.expression&&!i.M(w)&&le.push(new i.V(b.key,b.value,"exponential functions not supported")),b.styleSpec.$version>=8&&(Q&&!i.N(w)?le.push(new i.V(b.key,b.value,"property functions not supported")):Y&&!i.O(w)&&le.push(new i.V(b.key,b.value,"zoom functions not supported"))),M!=="categorical"&&!ce||m.property!==void 0||le.push(new i.V(b.key,b.value,'"property" property is required')),le;function de(ve){let De=[];const Pe=ve.value,Ve=ve.key;if(!Array.isArray(Pe))return[new i.V(Ve,Pe,`array expected, ${i.K(Pe)} found`)];if(Pe.length!==2)return[new i.V(Ve,Pe,`array length 2 expected, length ${Pe.length} found`)];if(ce){if(!i.H(Pe[0]))return[new i.V(Ve,Pe,`object expected, ${i.K(Pe[0])} found`)];const Xe=Pe[0];if(Xe.zoom===void 0)return[new i.V(Ve,Pe,"object stop key must have zoom")];if(Xe.value===void 0)return[new i.V(Ve,Pe,"object stop key must have value")];const We=i.J(Xe.zoom);if(typeof We!="number")return[new i.V(Ve,Xe.zoom,"stop zoom values must be numbers")];if(B&&B>We)return[new i.V(Ve,Xe.zoom,"stop zoom values must appear in ascending order")];We!==B&&(B=We,D=void 0,H={}),De=De.concat(Xa({key:`${Ve}[0]`,value:Pe[0],valueSpec:{zoom:{}},style:ve.style,styleSpec:ve.styleSpec,objectElementValidators:{zoom:Qe,value:we}}))}else De=De.concat(we({key:`${Ve}[0]`,value:Pe[0],style:ve.style,styleSpec:ve.styleSpec},Pe));return i.Q(i.S(Pe[1]))?De.concat([new i.V(`${Ve}[1]`,Pe[1],"expressions are not allowed in function stops.")]):De.concat(Hs({key:`${Ve}[1]`,value:Pe[1],valueSpec:w,style:ve.style,styleSpec:ve.styleSpec}))}function we(ve,De){const Pe=i.K(ve.value),Ve=i.J(ve.value),Xe=ve.value!==null?ve.value:De;if(O){if(Pe!==O)return[new i.V(ve.key,Xe,`${Pe} stop domain type must match previous stop domain type ${O}`)]}else O=Pe;if(Pe!=="number"&&Pe!=="string"&&Pe!=="boolean"&&typeof Ve!="number"&&typeof Ve!="string"&&typeof Ve!="boolean")return[new i.V(ve.key,Xe,"stop domain value must be a number, string, or boolean")];if(Pe!=="number"&&M!=="categorical"){let We=`number expected, ${Pe} found`;return i.N(w)&&M===void 0&&(We+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(ve.key,Xe,We)]}return M!=="categorical"||Pe!=="number"||typeof Ve=="number"&&isFinite(Ve)&&Math.floor(Ve)===Ve?M!=="categorical"&&Pe==="number"&&typeof Ve=="number"&&typeof D=="number"&&D!==void 0&&Venew i.V(`${b.key}${w.key}`,b.value,w.message));const m=d.value.expression||d.value._styleExpression.expression;if(b.expressionContext==="property"&&b.propertyKey==="text-font"&&!m.outputDefined())return[new i.V(b.key,b.value,`Invalid data expression for "${b.propertyKey}". Output values must be contained as literals within the expression.`)];if(b.expressionContext==="property"&&b.propertyType==="layout"&&!i.Z(m))return[new i.V(b.key,b.value,'"feature-state" data expressions are not supported with layout properties.')];if(b.expressionContext==="filter")return mt(m,b);if(b.expressionContext==="appearance")return Mt(m,b);if(b.expressionContext&&b.expressionContext.indexOf("cluster")===0){if(!i.X(m,["zoom","feature-state"]))return[new i.V(b.key,b.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(b.expressionContext==="cluster-initial"&&!i.Y(m))return[new i.V(b.key,b.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function mt(b,d){const m=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.delete(M);if(m.size===0)return[];const w=[];return b instanceof i._&&m.has(b.name)?[new i.V(d.key,d.value,`["${b.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(b.eachChild(M=>{w.push(...mt(M,d))}),w)}function Mt(b,d){const m=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.add(M);if(m.size===0)return[];const w=[];return b instanceof i._&&!m.has(b.name)?[new i.V(d.key,d.value,`["${b.name}"] is not an allowed parameter`)]:(b.eachChild(M=>{w.push(...Mt(M,d))}),w)}function wt(b){const d=b.key,m=b.value,w=b.valueSpec,M=[];return Array.isArray(w.values)?w.values.indexOf(i.J(m))===-1&&M.push(new i.V(d,m,`expected one of [${w.values.join(", ")}], ${JSON.stringify(m)} found`)):Object.keys(w.values).indexOf(i.J(m))===-1&&M.push(new i.V(d,m,`expected one of [${Object.keys(w.values).join(", ")}], ${JSON.stringify(m)} found`)),M}function Qt(b){return i.a2(i.S(b.value))?gt(Object.assign({},b,{expressionContext:"filter",valueSpec:b.styleSpec[`filter_${b.layerType||"fill"}`]})):Cr(b)}function Cr(b){const d=b.value,m=b.key;if(!Array.isArray(d))return[new i.V(m,d,`array expected, ${i.K(d)} found`)];if(d.length<1)return[new i.V(m,d,"filter array must have at least 1 element")];const w=b.styleSpec;let M=wt({key:`${m}[0]`,value:d[0],valueSpec:w.filter_operator});const O=()=>{d.length>=2&&(i.a0(d[1])||M.push(new i.V(`${m}[1]`,d[1],`string expected, ${i.K(d[1])} found`)));for(let D=2;D":case">=":d.length>=2&&i.J(d[1])==="$type"&&M.push(new i.V(m,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&M.push(new i.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&M.push(new i.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"in":case"!in":O();break;case"any":case"all":case"none":for(let D=1;D{Y in m&&d.push(new i.V(w,m[Y],`"${Y}" is prohibited for ref layers`))}),M.layers.forEach(Y=>{i.J(Y.id)===B&&(H=Y)}),H?H.ref?d.push(new i.V(w,m.ref,"ref cannot reference another ref layer")):D=i.J(H.type):typeof B=="string"&&d.push(new i.V(w,m.ref,`ref layer "${B}" not found`))}else if(D!=="background"&&D!=="sky"&&D!=="slot")if(m.source)if(i.a0(m.source)){const H=M.sources&&M.sources[m.source],Y=H&&i.J(H.type);H?Y==="vector"&&D==="raster"?d.push(new i.V(w,m.source,`layer "${m.id}" requires a raster source`)):Y==="raster"&&D!=="raster"?d.push(new i.V(w,m.source,`layer "${m.id}" requires a vector source`)):Y!=="vector"||m["source-layer"]?Y==="raster-dem"&&D!=="hillshade"?d.push(new i.V(w,m.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(D)?D==="line"&&m.paint&&(m.paint["line-gradient"]||m.paint["line-trim-offset"])&&Y==="geojson"&&!H.lineMetrics?d.push(new i.V(w,m,`layer "${m.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):D==="raster-particle"&&Y!=="raster-array"&&d.push(new i.V(w,m.source,`layer "${m.id}" requires a 'raster-array' source.`)):d.push(new i.V(w,m.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new i.V(w,m,`layer "${m.id}" must specify a "source-layer"`)):d.push(new i.V(w,m.source,`source "${m.source}" not found`))}else d.push(new i.V(`${w}.source`,m.source,'"source" must be a string'));else d.push(new i.V(w,m,'missing required property "source"'));return d=d.concat(Xa({key:w,value:m,valueSpec:O.layer,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Hs({key:`${w}.type`,value:m.type,valueSpec:O.layer.type,style:b.style,styleSpec:b.styleSpec,object:m,objectKey:"type"}),filter:H=>Qt(Object.assign({layerType:D},H)),layout:H=>Xa({layer:m,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":Y=>Qr(Object.assign({layerType:D},Y))}}),paint:H=>Xa({layer:m,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":Y=>jn(Object.assign({layerType:D,layer:m},Y))}}),appearances(H){const Y=Oe({key:H.key,value:H.value,valueSpec:H.valueSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:le=>function(de){const{key:we,layer:ve,layerType:De}=de,Pe=i.J(de.value),Ve=i.J(Pe.name),Xe=i.J(Pe.condition),We=Xa({key:we,value:Pe,valueSpec:de.styleSpec.appearance,style:de.style,styleSpec:de.styleSpec,objectElementValidators:{condition:bt=>function(ut){const xt=[];return xt.push(...gt({key:ut.key,value:ut.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),xt}(Object.assign({layer:ve,layerType:De},bt)),properties:bt=>function(ut){const xt=[],{styleSpec:ct,layer:it,layerType:St}=ut,Dt=ct[`paint_${St}`],Lt=ct[`layout_${St}`],Ht=ut.object[ut.objectKey];for(const Wt in Ht){const sr=Wt in Dt?"paint":Wt in Lt?"layout":void 0;if(!sr){xt.push(new i.V(ut.key,Wt,`unknown property "${Wt}" for layer type "${St}"`));continue}const _r=Object.assign({},ut,{key:`${ut.key}.${Wt}`,object:Ht,objectKey:Wt,layer:it,layerType:St,value:Ht[Wt],valueSpec:sr==="paint"?Dt[Wt]:Lt[Wt]});xt.push(...cn(_r,sr))}return xt}(Object.assign({layer:ve,layerType:De},bt))}});return Ve!=="hidden"&&Xe===void 0&&We.push(new i.V(de.key,"name",'Appearance with name different than "hidden" must have a condition')),We}(Object.assign({layerType:D,layer:m},le))}),Q=Array.isArray(H.value)?H.value:[],ce=new Set;return Q.forEach((le,de)=>{const we=i.J(le.name);if(we)if(ce.has(we)){const ve=i.J(m.id);Y.push(new i.V(H.key,we,`Duplicated appearance name "${we}" for layer "${ve}"`))}else ce.add(we)}),Y}}})),d}function js({key:b,value:d}){return i.a0(d)?[]:[new i.V(b,d,`string expected, ${i.K(d)} found`)]}const hr={promoteId:function b({key:d,value:m}){if(i.a0(m))return js({key:d,value:m});if(Array.isArray(m)){const M=[],O=i.S(m),D=i.U(O);return D.result==="error"&&D.value.forEach(B=>{M.push(new i.V(`${d}${B.key}`,null,`${B.message}`))}),i.X(D.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 i.V(`${d}`,null,"promoteId expression should be only feature dependent")),M}if(!i.H(m))return[new i.V(d,m,`string, expression or object expected, "${i.K(m)}" found`)];const w=[];for(const M in m)w.push(...b({key:`${d}.${M}`,value:m[M]}));return w}};function xs(b){const d=b.value,m=b.key,w=b.styleSpec,M=b.style;if(!i.H(d))return[new i.V(m,d,`object expected, ${i.K(d)} found`)];if(!("type"in d))return[new i.V(m,d,'"type" is required')];const O=i.J(d.type);let D=[];switch(["vector","raster","raster-dem","raster-array"].includes(O)&&("url"in d||"tiles"in d||D.push(new i.a3(m,d,'Either "url" or "tiles" is required.'))),O){case"vector":case"raster":case"raster-dem":case"raster-array":return D=D.concat(Xa({key:m,value:d,valueSpec:w[`source_${O.replace("-","_")}`],style:b.style,styleSpec:w,objectElementValidators:hr})),D;case"geojson":if(D=Xa({key:m,value:d,valueSpec:w.source_geojson,style:M,styleSpec:w,objectElementValidators:hr}),"cluster"in d&&"clusterProperties"in d){if(!i.H(d.clusterProperties))return[new i.V(`${m}.clusterProperties`,d,`object expected, ${i.K(d)} found`)];for(const B in d.clusterProperties){const H=d.clusterProperties[B];if(!Array.isArray(H))return[new i.V(`${m}.clusterProperties.${B}`,H,"array expected")];const[Y,Q]=H,ce=typeof Y=="string"?[Y,["accumulated"],["get",B]]:Y;D.push(...gt({key:`${m}.${B}.map`,value:Q,expressionContext:"cluster-map"})),D.push(...gt({key:`${m}.${B}.reduce`,value:ce,expressionContext:"cluster-reduce"}))}}return D;case"video":return Xa({key:m,value:d,valueSpec:w.source_video,style:M,styleSpec:w});case"image":return Xa({key:m,value:d,valueSpec:w.source_image,style:M,styleSpec:w});case"canvas":return[new i.V(m,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return wt({key:`${m}.type`,value:d.type,valueSpec:{values:ka(w)}})}}function ka(b){return b.source.reduce((d,m)=>{const w=b[m];return w.type.type==="enum"&&(d=d.concat(Object.keys(w.type.values||{}))),d},[])}function xa(b){const d=b.value,m=b.styleSpec,w=m.light,M=b.style;if(d===void 0)return[];if(!i.H(d))return[new i.V("light",d,`object expected, ${i.K(d)} found`)];let O=[];for(const D in d){const B=D.match(/^(.*)-transition$/),H=D.match(/^(.*)-use-theme$/);O=O.concat(H&&w[H[1]]?Hs({key:D,value:d[D],valueSpec:{type:"string"},style:M,styleSpec:m}):B&&w[B[1]]&&w[B[1]].transition?Hs({key:D,value:d[D],valueSpec:m.transition,style:M,styleSpec:m}):w[D]?Hs({key:D,value:d[D],valueSpec:w[D],style:M,styleSpec:m}):[new i.V(D,d[D],`unknown property "${D}"`)])}return O}function zi(b){const d=b.value;if(!d)return[];const m=b.key;if(!i.H(d))return[new i.V(m,d,`object expected, ${i.K(d)} found`)];let w=[];const M=b.styleSpec,O=M["light-3d"],D=b.style,B=b.style.lights;for(const Q of["type","id"])if(!(Q in d))return w=w.concat([new i.V(m,d,`missing property "${Q}"`)]),w;if(!i.a0(d.type))return w=w.concat([new i.V(`${m}.type`,d.type,"string expected")]),w;if(B)for(let Q=0;Q[],array:Oe,boolean:function(b){const d=b.value,m=b.key;return i.$(d)?[]:[new i.V(m,d,`boolean expected, ${i.K(d)} found`)]},number:Qe,color:function({key:b,value:d}){return i.a0(d)?i.a1.parseCSSColor(d)===null?[new i.V(b,d,`color expected, "${d}" found`)]:[]:[new i.V(b,d,`color expected, ${i.K(d)} found`)]},enum:wt,filter:Qt,function:nt,layer:Pn,object:Xa,source:xs,model:i.a7,light:xa,"light-3d":zi,terrain:Bi,fog:nl,string:js,formatted:function(b){return js(b).length===0?[]:gt(b)},resolvedImage:function(b){return js(b).length===0?[]:gt(b)},projection:function(b){const d=b.value,m=b.styleSpec,w=m.projection,M=b.style;if(i.H(d)){let O=[];for(const D in d)O=O.concat(Hs({key:D,value:d[D],valueSpec:w[D],style:M,styleSpec:m}));return O}return i.a0(d)?[]:[new i.V("projection",d,`object or string expected, ${i.K(d)} found`)]},import:function(b){const d=b.key,{value:m,styleSpec:w}=b;if(!i.H(m))return[new i.V(d,m,"import must be an object")];const{data:M,...O}=m;Object.defineProperty(O,"__line__",{value:m.__line__,enumerable:!1});let D=Xa(Object.assign({},b,{value:O,valueSpec:w.import}));return i.J(O.id)===""&&D.push(new i.V(`${b.key}.id`,O,"import id can't be an empty string")),M&&(D=D.concat(Fa(M,w,{key:`${b.key}.data`}))),D},iconset:function(b){const d=b.value,m=b.key,w=b.styleSpec,M=b.style;if(!i.H(d))return[new i.V(m,d,"object expected")];if(!d.type)return[new i.V(m,d,'"type" is required')];const O=i.J(d.type);let D=[];if(D=D.concat(Xa({key:m,value:d,valueSpec:w[`iconset_${O}`],style:M,styleSpec:w})),function(B,H){return!(B!=="source"||!H.source)}(O,d)){const B=M.sources&&M.sources[d.source],H=B&&i.J(B.type);B?H!=="raster-array"&&D.push(new i.V(m,d.source,`iconset cannot be used with a source of type ${String(H)}, it only be used with a "raster-array" source type`)):D.push(new i.V(m,d.source,`source "${d.source}" not found`))}return D}};function Hs(b,d=!1){const m=b.value,w=b.valueSpec,M=b.styleSpec;if(w.expression){if(i.a4(i.J(m)))return nt(b);if(i.Q(i.S(m)))return gt(b)}if(w.type&&xo[w.type]){const O=xo[w.type](b);return d===!0&&O.length>0&&Array.isArray(b.value)?gt(b):O}return Xa(Object.assign({},b,{valueSpec:w.type?M[w.type]:w}))}function Xa(b){const d=b.key,m=b.value,w=b.valueSpec||{},M=b.objectElementValidators||{},O=b.style,D=b.styleSpec;if(!i.H(m))return[new i.V(d,m,`object expected, ${i.K(m)} found`)];let B=[];for(const H in m){const Y=H.split(".")[0];let Q;M[Y]?Q=M[Y]:w[Y]?Q=Hs:M["*"]?Q=M["*"]:w["*"]&&(Q=Hs),Q?B=B.concat(Q({key:(d&&`${d}.`)+H,value:m[H],valueSpec:w[Y]||w["*"],style:O,styleSpec:D,object:m,objectKey:H},m)):B.push(new i.a3(d,m[H],`unknown property "${H}"`))}for(const H in w){if(M[H])continue;const Y=w[H];Y.required&&Y.default===void 0&&m[H]===void 0&&B.push(new i.V(d,m,`missing required property "${H}"`))}return B}function Ns({key:b,value:d}){const m=js({key:b,value:d});if(m.length)return m;const w=d;return w.indexOf("{fontstack}")===-1&&m.push(new i.V(b,d,'"glyphs" url must include a "{fontstack}" token')),w.indexOf("{range}")===-1&&m.push(new i.V(b,d,'"glyphs" url must include a "{range}" token')),m}function Fa(b,d=i.a6,m={}){return Xa({key:m.key||"",value:b,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:b,objectElementValidators:{glyphs:Ns}})}function Oa(b,d=i.a6){return Ie(Fa(b,d))}const Ro=b=>Ie(xs(b)),ir=b=>Ie(xa(b)),fo=b=>Ie(zi(b)),ml=b=>Ie(Bi(b)),Ao=b=>Ie(nl(b)),ss=b=>Ie(function(d){const m=d.value,w=d.style,M=d.styleSpec,O=M.snow;if(m===void 0)return[];if(!i.H(m))return[new i.V("snow",m,`object expected, ${i.K(m)} found`)];let D=[];for(const B in m){const H=B.match(/^(.*)-transition$/);D=D.concat(H&&O[H[1]]&&O[H[1]].transition?Hs({key:B,value:m[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Hs({key:B,value:m[B],valueSpec:O[B],style:w,styleSpec:M}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return D}(b)),yo=b=>Ie(function(d){const m=d.value,w=d.style,M=d.styleSpec,O=M.rain;if(m===void 0)return[];if(!i.H(m))return[new i.V("rain",m,`object expected, ${i.K(m)} found`)];let D=[];for(const B in m){const H=B.match(/^(.*)-transition$/);D=D.concat(H&&O[H[1]]&&O[H[1]].transition?Hs({key:B,value:m[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Hs({key:B,value:m[B],valueSpec:O[B],style:w,styleSpec:M}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return D}(b)),xu=b=>Ie(Pn(b)),$l=b=>Ie(Qt(b)),yu=b=>Ie(jn(b)),et=b=>Ie(Qr(b)),xe=b=>Ie(i.a7(b));function Ie(b){return b.slice().sort((d,m)=>d.line&&m.line?d.line-m.line:0)}function Ge(b,d){let m=!1;if(d&&d.length)for(const w of d)w instanceof i.a3?i.w(w.message):(b.fire(new i.y(new Error(w.message))),m=!0);return m}const kt=i.a6.light;let vt;class At extends i.E{constructor(d,m="flat"){super(),this._transitionable=new i.a8(vt||(vt=new i.a9({anchor:new i.aa(kt.anchor),position:new i.ab(kt.position),color:new i.aa(kt.color),intensity:new i.aa(kt.intensity)}))),this.setLight(d,m),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,m,w={}){this._validate(ir,d,w)||(this._transitionable.setTransitionOrValue(d),this.id=m)}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,m,w){return(!w||w.validate!==!1)&&Ge(this,d.call(Oa,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const Bt=i.a6.terrain;let Pt=class extends i.E{constructor(b,d,m,w,M){super(),this.scope=m,this._transitionable=new i.a8(new i.a9({source:new i.aa(Bt.source),exaggeration:new i.aa(Bt.exaggeration)}),m,w),this._transitionable.setTransitionOrValue(b,w),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=M}get(){return this._transitionable.serialize()}set(b,d){this._transitionable.setTransitionOrValue(b,d)}updateTransitions(b){this._transitioning=this._transitionable.transitioned(b,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(b){this.properties=this._transitioning.possiblyEvaluate(b)}getExaggeration(b){return this._transitioning.possiblyEvaluate(new i.ac(b,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const b=this._transitionable._values.exaggeration;if(!b)return null;const d=b.value.expression;if(!d)return null;let m=-1,w=-1,M=1;for(const O of d.zoomStops)M=d.evaluate(new i.ac(O,{worldview:this.worldview})),M>.01?(m=O,w=-1):w=O;return M<.01&&m>0&&w>m?[m,w]:null}isZoomDependent(){const b=this._transitionable._values.exaggeration;return b!=null&&b.value!=null&&b.value.expression!=null&&b.value.expression instanceof i.ad}};const Ut=45,fr=65,ar=.05;function Wr(b,d,m,w){const M=i.ah(Ut,fr,m),[O,D]=wn(b,w);let B=1-Math.min(1,Math.exp((d-O)/(D-O)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*M*b.alpha}function wn(b,d){const m=.5/Math.tan(.5*d);return[b.range[0]+m,b.range[1]+m]}function Ur(b,d,m,w,M){const O=i.af([],[d,m,w],M.mercatorFogMatrix);return Wr(b,i.ag(O),M.pitch,M._fov)}function es(b,d,m,w,M,O,D){const B=[[m,w,0],[M,w,0],[M,O,0],[m,O,0]];let H=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const Q of B){const ce=i.af([],Q,d),le=i.ag(ce);H=Math.min(H,le),Y=Math.max(Y,le)}return[Wr(b,H,D.pitch,D._fov),Wr(b,Y,D.pitch,D._fov)]}const ts=i.a6.fog;class Yn extends i.E{constructor(d,m,w,M){super();const O=new i.a9({range:new i.aa(ts.range),color:new i.aa(ts.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(ts["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(ts["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(ts["horizon-blend"]),"star-intensity":new i.aa(ts["star-intensity"]),"vertical-range":new i.aa(ts["vertical-range"])});this._transitionable=new i.a8(O,w,new Map(M)),this.set(d,M),this._transitioning=this._transitionable.untransitioned(),this._transform=m,this.properties=new i.ai(O),this.scope=w}get state(){const d=this._transform,m=d.projection.name==="globe",w=i.aj(d.zoom),M=this.properties.get("range"),O=[.5,3];return{range:m?[i.ak(O[0],M[0],w),i.ak(O[1],M[1],w)]:M,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,m,w={}){if(this._validate(Ao,d,w))return;const M=Object.assign({},d);for(const O of Object.keys(ts))M[O]===void 0&&(M[O]=ts[O].default);this._options=M,this._transitionable.setTransitionOrValue(this._options,m)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const m=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.ah(Ut,fr,d))*m.a}getOpacityAtLatLng(d,m){return this._transform.projection.supportsFog?function(w,M,O){const D=i.ae.fromLngLat(M),B=O.elevation?O.elevation.getAtPointOrZero(D):0;return Ur(w,D.x,D.y,B,O)}(this.state,d,m):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const m=this._transform.calculateFogTileMatrix(d.toUnwrapped());return es(this.state,m,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,m,w,M,O){return this._transform.projection.supportsFog?es(this.state,d,m,w,M,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?wn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const m=[4,5,6,7];for(const w of m){const M=d.points[w];let O;if(M[2]>=0)O=M;else{const D=d.points[w-4];O=i.am(D,M,D[2]/(D[2]-M[2]))}if(Ur(this.state,O[0],O[1],0,this._transform)>=ar)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,m,w){return(!w||w.validate!==!1)&&Ge(this,d.call(Oa,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let Ds,Li,po,ha,vo=class extends i.E{constructor(b,d,m,w){super();const M=Ds||(Ds=new i.a9({density:new i.aa(i.a6.snow.density),intensity:new i.aa(i.a6.snow.intensity),color:new i.aa(i.a6.snow.color),opacity:new i.aa(i.a6.snow.opacity),vignette:new i.aa(i.a6.snow.vignette),"vignette-color":new i.aa(i.a6.snow["vignette-color"]),"center-thinning":new i.aa(i.a6.snow["center-thinning"]),direction:new i.aa(i.a6.snow.direction),"flake-size":new i.aa(i.a6.snow["flake-size"])}));this._transitionable=new i.a8(M,m,new Map(w)),this.set(b,w),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(M),this.scope=m}get state(){const b=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),w=i.an(m[0]),M=-Math.max(i.an(m[1]),.01),O=[Math.cos(w)*Math.cos(M),Math.sin(w)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=D,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*b),direction:O,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:B}}get(){return this._transitionable.serialize()}set(b,d,m={}){if(this._validate(ss,b,m))return;const w=Object.assign({},b),M=i.a6.snow;for(const O of Object.keys(M))w[O]===void 0&&(w[O]=M[O].default);this._options=w,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(b){this._transitionable.setTransitionOrValue(this._options,new Map(b))}updateTransitions(b){this._transitioning=this._transitionable.transitioned(b,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(b){this.properties=this._transitioning.possiblyEvaluate(b)}_validate(b,d,m){return(!m||m.validate!==!1)&&Ge(this,b.call(Oa,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},ji=class extends i.E{constructor(b,d,m,w){super();const M=Li||(Li=new i.a9({density:new i.aa(i.a6.rain.density),intensity:new i.aa(i.a6.rain.intensity),color:new i.aa(i.a6.rain.color),opacity:new i.aa(i.a6.rain.opacity),vignette:new i.aa(i.a6.rain.vignette),"vignette-color":new i.aa(i.a6.rain["vignette-color"]),"center-thinning":new i.aa(i.a6.rain["center-thinning"]),direction:new i.aa(i.a6.rain.direction),"droplet-size":new i.aa(i.a6.rain["droplet-size"]),"distortion-strength":new i.aa(i.a6.rain["distortion-strength"])}));this._transitionable=new i.a8(M,m,new Map(w)),this.set(b,w),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(M),this.scope=m}get state(){const b=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),w=i.an(m[0]),M=-Math.max(i.an(m[1]),.01),O=[Math.cos(w)*Math.cos(M),Math.sin(w)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette-color");return D.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*b),direction:O,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:D}}get(){return this._transitionable.serialize()}set(b,d,m={}){if(this._validate(yo,b,m))return;const w=Object.assign({},b),M=i.a6.rain;for(const O of Object.keys(M))w[O]===void 0&&(w[O]=M[O].default);this._options=w,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(b){this._transitionable.setTransitionOrValue(this._options,new Map(b))}updateTransitions(b){this._transitioning=this._transitionable.transitioned(b,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(b){this.properties=this._transitioning.possiblyEvaluate(b)}_validate(b,d,m){return(!m||m.validate!==!1)&&Ge(this,b.call(Oa,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class Ws extends i.E{constructor(d,m,w,M){super(),this.scope=w,this._options=d,this.properties=new i.ai(m),this._transitionable=new i.a8(m,w,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,m){this._options=d,this._transitionable.setTransitionOrValue(d.properties,m)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ki{constructor(d,m,w){this.screenBounds=d,this.cameraPoint=w.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=m,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,w)}static createFromScreenPoints(d,m){let w,M;if(d instanceof i.P||typeof d[0]=="number"){const O=i.P.convert(d);w=[O],M=m.isPointAboveHorizon(O)}else{const O=i.P.convert(d[0]),D=i.P.convert(d[1]),B=O.add(D)._div(2);w=[O,D],M=i.aq(O,D).every(H=>m.isPointAboveHorizon(H))&&m.isPointAboveHorizon(B)}return new ki(w,M,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return i.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const m=this.screenBounds[0],w=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],M=i.aq(m,w,0,!1);return this.cameraPoint.y>w.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x=w.x?M[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(M[3]=this.cameraPoint)),i.ar(M,d)}bufferedCameraGeometryGlobe(d){const m=this.screenBounds[0],w=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],M=i.aq(m,w,d),O=this.cameraPoint.clone();switch(3*((O.y>m.y)+(O.y>w.y))+((O.x>m.x)+(O.x>w.x))){case 0:M[0]=O,M[4]=O.clone();break;case 1:M.splice(1,0,O);break;case 2:M[1]=O;break;case 3:M.splice(4,0,O);break;case 5:M.splice(2,0,O);break;case 6:M[3]=O;break;case 7:M.splice(3,0,O);break;case 8:M[2]=O}return M}containsTile(d,m,w,M=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/m._pixelsPerMercatorPixel+1,D=w?this._bufferedCameraMercator(O,m):this._bufferedScreenMercator(O,m);let B=d.tileID.wrap+(D.unwrapped?M:0);const H=D.polygon.map(De=>i.as(d.tileTransform,De,B));if(!i.at(H,0,0,i.al,i.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?M:0);const Y=this.screenGeometryMercator.polygon.map(De=>i.au(d.tileTransform,De,B)),Q=Y.map(De=>new i.P(De[0],De[1])),ce=m.getFreeCameraOptions().position||new i.ae(0,0,0),le=i.au(d.tileTransform,ce,B),de=Y.map(De=>{const Pe=i.av(De,De,le);return i.aw(Pe,Pe),new i.ax(le,Pe)}),we=i.ay(d,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:Q,tilespaceRays:de,bufferedTilespaceGeometry:H,bufferedTilespaceBounds:(ve=i.az(H),ve.min.x=i.aA(ve.min.x,0,i.al),ve.min.y=i.aA(ve.min.y,0,i.al),ve.max.x=i.aA(ve.max.x,0,i.al),ve.max.y=i.aA(ve.max.y,0,i.al),ve),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:we};var ve}_bufferedScreenMercator(d,m){const w=Ni(d);if(this._screenRaycastCache[w])return this._screenRaycastCache[w];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),m):{polygon:this.bufferedScreenGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[w]=M,M}}_bufferedCameraMercator(d,m){const w=Ni(d);if(this._cameraRaycastCache[w])return this._cameraRaycastCache[w];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),m):{polygon:this.bufferedCameraGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[w]=M,M}}_projectAndResample(d,m){const w=function(O,D){const B=i.aB([],D.pixelMatrix,D.globeMatrix),H=[0,-i.aD,0,1],Y=[0,i.aD,0,1],Q=[0,0,0,1];i.aC(H,H,B),i.aC(Y,Y,B),i.aC(Q,Q,B);const ce=new i.P(H[0]/H[3],H[1]/H[3]),le=new i.P(Y[0]/Y[3],Y[1]/Y[3]),de=i.aE(O,ce)&&H[3]1?za(O.slice(0,De),D):[],Xe=Denew i.P(Ss(xt.x),xt.y)),Xe=Xe.map(xt=>new i.P(Ss(xt.x),xt.y));const We=[...Ve];We.length===0&&We.push(Xe[Xe.length-1]);const bt=i.ak(We[We.length-1].y,(Xe.length===0?Ve[0]:Xe[0]).y,Pe);let ut;return ut=de?[new i.P(0,bt),new i.P(0,0),new i.P(1,0),new i.P(1,bt)]:[new i.P(1,bt),new i.P(1,1),new i.P(0,1),new i.P(0,bt)],We.push(...ut),Xe.length===0?We.push(Ve[0]):We.push(...Xe),{polygon:We.map(xt=>new i.ae(xt.x,xt.y)),unwrapped:!1}}(d,m);if(w)return w;const M=function(O,D){let B=!1,H=-1/0,Y=0;for(let ce=0;ceH&&(H=O[ce].x,Y=ce);for(let ce=0;ce.5&&(de.x{ce.x-=1}),{polygon:O,unwrapped:B}}(za(d,m).map(O=>new i.P(Ss(O.x),O.y)),m);return{polygon:M.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:M.unwrapped}}}function za(b,d){return i.aG(b,m=>{const w=d.pointCoordinate3D(m);m.x=w.x,m.y=w.y},1/256)}function Ss(b){return b<0?1+b%1:b%1}function Ni(b){return 100*b|0}function gl(b,d,m,w,M){const O=function(B,H){if(B)return M(B);if(H){if(b.url&&H.tiles&&b.tiles&&delete b.tiles,H.variants){if(!Array.isArray(H.variants))return M(new Error("variants must be an array"));for(const Q of H.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"){H=Object.assign(H,Q);break}}}const Y=i.aH(Object.assign({},H,b),["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,b.url),M(null,Y)}},D=function(B,H,Y){if(!B)return null;if(!H&&!Y)return B;Y=Y||B.worldview_default;const Q=Object.values(B.language||{});if(Q.length===0)return null;const ce=Object.values(B.worldview||{});if(ce.length===0)return null;const le=Q.every(we=>we===H),de=ce.every(we=>we===Y);return le&&de?B:H in(B.language_options||{})||Y in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(b.data,m,w);return D?i.o.frame(()=>O(null,D)):b.url?i.m(d.transformRequest(d.normalizeSourceURL(b.url,null,m,w),i.R.Source),O):i.o.frame(()=>{const{data:B,...H}=b;O(null,H)})}function Cl(b,d){const m=Math.pow(2,d.z),w=Math.floor(i.aF(b.getWest())*m),M=Math.floor(i.aJ(b.getNorth())*m),O=Math.ceil(i.aF(b.getEast())*m),D=Math.ceil(i.aJ(b.getSouth())*m);return d.x>=w&&d.x=M&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,M)m&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${m}`),w&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${w}`),this.fire(new i.y(M));else if(O){if(Object.assign(this,O),this.hasWorldviews=!!O.worldview_options,O.worldview_default&&(this.worldviewDefault=O.worldview_default),O.vector_layers){this.vectorLayers=O.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const D of O.vector_layers)this.vectorLayerIds.push(D.id),O.worldview&&O.worldview[D.source]&&this.localizableLayerIds.add(D.id)}this.tileBounds=Oc.fromTileJSON(O),ge(O.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.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=i.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,m){const w=d.tileID.canonical.url(this.tiles,this.scheme),M=this.map._requestManager.normalizeTileURL(w),O=this.map._requestManager.transformRequest(M,i.R.Tile),D=this.map.style?this.map.style.getLut(this.scope):null,B=D?{image:D.image.clone()}:null,H={request:O,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:B,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:i.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&&i.h(w)&&(H.localizableLayerIds=this.localizableLayerIds),H.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=m:d.request=d.actor.send("reloadTile",H,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",H,Y.bind(this),void 0,!0);else{const Q=i.aL.call({deduped:this._deduped},H,(ce,le)=>{if(ce||!le)Y.call(this,ce);else{const de=i.aM(le.responseHeaders);H.data={rawData:le.rawData.slice(0),expires:de.expires,cacheControl:de.cacheControl},d.actor&&d.actor.send("loadTile",H,Y.bind(this),void 0,!0)}},!0);d.request={cancel:Q}}function Y(Q,ce){return delete d.request,d.aborted?m(null):Q&&Q instanceof i.aN&&Q.status!==404?m(Q):(ce&&ce.resourceTiming&&(d.resourceTiming=ce.resourceTiming),this.map._refreshExpiredTiles&&ce&&d.setExpiryData(ce),d.loadVectorData(ce,this.map.painter),i.aO(this.dispatcher),m(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,m){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 $o extends i.E{constructor(d,m,w,M){super(),this.id=d,this.dispatcher=w,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"},m),Object.assign(this,i.aH(m,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const m=this.map.getWorldview();this._tileJSONRequest=gl(this._options,this.map._requestManager,null,m,(w,M)=>{this._tileJSONRequest=null,this._loaded=!0,w?this.fire(new i.y(w)):M&&(Object.assign(this,M),M.raster_layers&&(this.rasterLayers=M.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=Oc.fromTileJSON(M),ge(M.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(w)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=i.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,m){const w=i.o.devicePixelRatio>=2,M=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),w,this.tileSize);d.request=i.n(this.map._requestManager.transformRequest(M,i.R.Tile),(O,D,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(O)return d.state="errored",m(O);if(!D)return m(null);const H=i.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(H),d.setTexture(D,this.map.painter),d.state="loaded",i.aO(this.dispatcher),m(null)})}abortTile(d,m){d.request&&(d.request.cancel(),delete d.request),m&&m()}unloadTile(d,m){d.texture&&d.texture instanceof i.T?(d.destroy(!1),d.texture&&d.texture instanceof i.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),m&&m()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function wd([b,d],m,w,{scaled:M=!0}={}){const{tileSize:O,buffer:D}=w,{x:B,y:H,z:Y}=m;if(!isFinite(B)||!isFinite(H)||!isFinite(Y))throw new Error("Invalid MRT header");const Q=2**Y,ce=Q*i.aF(b),le=Q*i.aJ(d);return function([de,we],ve,{scaled:De=!0}={}){if(!ve)throw new Error("bandView is undefined");const{data:Pe,tileSize:Ve,buffer:Xe,offset:We,scale:bt,dimension:ut}=ve;if(de<-Xe||de>Ve+Xe||we<-Xe||we>Ve+Xe)throw new Error(`Point (${de}, ${we}) out of bounds for tileSize=${Ve}, buffer=${Xe}`);const xt=(we+Xe)*(Ve+2*Xe)+(de+Xe);if(new Uint32Array(Pe.buffer)[xt]===4294967295)return null;let ct=[];ct=De?[]:new ve.data.constructor(ut);for(let it=0;it{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",m(B));if(this.map._refreshExpiredTiles&&H){const Q=i.aM(Y);d.setExpiryData(Q)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!H)return m(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=H}m(null)};d.request=this.partial?d.fetchHeader(void 0,D.bind(this)):d.actor.send("loadTile",O,D.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,m){const w=d.texturePerLayer;if(d.flushAllQueues(),w.size){d.destroy(!1);for(const M of w.values())this.map.painter.saveTileTexture(M)}else d.destroy()}prepareTile(d,m,w,M){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(m,w,M,(O,D)=>{if(O)return d.state="errored",this.fire(new i.y(O)),void this.triggerRepaint(d);D&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(w,D,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const m=this.rasterLayers.find(({id:O})=>O===d),w=m&&m.fields,M=w&&w.bands&&w.bands;return M?M[0]:0}getTextureDescriptor(d,m,w){if(!d)return;const M=m.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!M)return;let O=null;m instanceof i.aR?O=m.paint.get("raster-array-band"):m instanceof i.aS&&(O=m.paint.get("raster-particle-array-band"));const D=O||this.getInitialBand(M);if(D==null)return;if(!d.textureDescriptorPerLayer.get(m.id))return void this.prepareTile(d,M,m.id,D);if(d.updateNeeded(m.id,D)&&!w)return;const B=d.textureDescriptorPerLayer.get(m.id);return Object.assign({},B,{texture:d.texturePerLayer.get(m.id)})}getImages(d,m){const w=new Map;for(const M of d)for(const O of m){const[D,B]=O.split("/"),H=M.getLayer(D);if(!H||!H.hasBand(B)||!H.hasDataForBand(B))continue;const{bytes:Y,tileSize:Q,buffer:ce}=H.getBandView(B),le=Q+2*ce,de={data:new i.q({width:le,height:le},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};w.set(O,de)}return w}queryRasterArrayValueByBandId(d,m,w){const M=m._mrt;return new Promise(O=>{const D={},B=new Set;for(const[H,Y]of Object.entries(M.layers)){if(w.layerName&&H!==w.layerName)continue;const Q={};D[H]=Q;for(const{bands:ce}of Y.dataIndex)for(const le of ce)w.bands&&!w.bands.includes(le)||(B.add(i.B(H,le)),m.fetchBand(H,null,le,de=>{i.o.frame(()=>{Q[le]=de?null:wd([d.lng,d.lat],M,Y.getBandView(le)),B.delete(i.B(H,le)),B.size===0&&O(D)})},!1))}B.size===0&&O(D)})}_loadTileForQuery(d,m){if(this._loadTileLoaded[d.uid])return void m(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(m);this._loadTilePending[d.uid]=[m];const w=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),M=this.map._requestManager.transformRequest(w,i.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},(O,D,B)=>{if(O)return this._loadTilePending[d.uid].forEach(H=>H(O,null)),void delete this._loadTilePending[d.uid];if(!D)return this._loadTilePending[d.uid].forEach(H=>H(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&D){const H=i.aM(B);d.setExpiryData(H)}d._mrt=D,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(H=>H(null,D)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,m,w){return new Promise((M,O)=>{this._loadTileForQuery(m,(D,B)=>{D?O(D):M(B?this.queryRasterArrayValueByBandId(d,m,w):null)})})}queryRasterArrayValue(d,m){const w=i.aT.convert(d),M=this.findLoadedParent(w);return M&&M._mrt?m.bands||!this.partial?this.queryRasterArrayValueByBandId(w,M,m):this.queryRasterArrayValueByAllBands(w,M,m):Promise.resolve(null)}findLoadedParent(d){const m=i.ae.fromLngLat(d,this.map.transform.tileSize),w=this.maxzoom+1,M=1<0&&(B[new i.aQ(b.overscaledZ,M,d.z,w,d.y-1).key]={backfilled:!1},B[new i.aQ(b.overscaledZ,b.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},B[new i.aQ(b.overscaledZ,D,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,w)this.fire(new i.y(w));else{const O={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&M&&M.resourceTiming&&M.resourceTiming[this.id]&&(O.resourceTiming=M.resourceTiming[this.id]),b&&(this._partialReload=!0),this.fire(new i.z("data",O)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(b),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const b=i.B(this.id,this.scope);this.map.style.clearSource(b),this._updateWorkerData()}loadTile(b,d){const m=b.actor?"reloadTile":"loadTile";b.actor=this.actor;const w=this.map.style?this.map.style.getLut(this.scope):null,M=w?{image:w.image.clone()}:null,O=this._partialReload,D={type:this.type,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:M,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:b.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:O,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};b.request=this.actor.send(m,D,(B,H)=>O&&!H?(b.state="loaded",d(null)):(delete b.request,b.destroy(!1),b.aborted?d(null):B?d(B):(b.loadVectorData(H,this.map.painter,m==="reloadTile"),d(null))),void 0,m==="loadTile")}abortTile(b){b.request&&(b.request.cancel(),delete b.request),b.aborted=!0}unloadTile(b,d){this.actor.send("removeTile",{uid:b.uid,type:this.type,source:this.id,scope:this.scope}),b.destroy()}onRemove(b){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends i.aU{constructor(b,d,m,w){super(b,d,m,w),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const b=this.options;this.urls=[];for(const d of b.urls)this.urls.push(this.map._requestManager.transformRequest(d,i.R.Source).url);i.aV(this.urls,(d,m)=>{this._loaded=!0,d?this.fire(new i.y(d)):m&&(this.video=m,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(b){if(this.video){const d=this.video.seekable;bd.end(0)?this.fire(new i.y(new i.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=b}}getVideo(){return this.video}onAdd(b){this.map||(this.map=b,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 b=this.map.painter.context,d=b.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 i.T(b,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(b)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:i.aU,model:i.aX,"batched-model":class extends i.E{constructor(b,d,m,w){super(),this.type="batched-model",this.id=b,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=m,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(w)}onAdd(b){this.map=b,this.load()}reload(){this.cancelTileJSONRequest();const b=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(b))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(b){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const d=Array.isArray(this.map._language)?this.map._language.join():this.map._language,m=this.map.getWorldview();this._tileJSONRequest=gl(this._options,this.map._requestManager,d,m,(w,M)=>{this._tileJSONRequest=null,this._loaded=!0,w?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new i.y(w))):M&&(Object.assign(this,M),M.bounds&&(this.tileBounds=new Oc(M.bounds,this.minzoom,this.maxzoom)),ge(M.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),b&&b(w)})}hasTransition(){return!1}hasTile(b){return!this.tileBounds||this.tileBounds.contains(b.canonical)}loaded(){return this._loaded}loadTile(b,d){const m=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme)),w={request:this.map._requestManager.transformRequest(m,i.R.Tile),data:void 0,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,tileSize:this.tileSize*b.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:b.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.o.devicePixelRatio,promoteId:this.promoteId};if(b.actor&&b.state!=="expired")if(b.state==="loading")b.reloadCallback=d;else{if(b.buckets){const O=Object.values(b.buckets);for(const D of O)D.dirty=!0;return void(b.state="loaded")}b.request=b.actor.send("reloadTile",w,M.bind(this))}else b.actor=this.dispatcher.getActor(),b.request=b.actor.send("loadTile",w,M.bind(this),void 0,!0);function M(O,D){return b.aborted?d(null):O&&O.status!==404?d(O):(this.map._refreshExpiredTiles&&D&&b.setExpiryData(D),b.loadModelData(D,this.map.painter),b.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aU{constructor(b,d,m,w){super(b,d,m,w),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(O=>typeof O!="number"))||this.fire(new i.y(new i.V(`sources.${b}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.y(new i.V(`sources.${b}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new i.y(new i.V(`sources.${b}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new i.y(new i.V(`sources.${b}`,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 i.y(new i.V(`sources.${b}`,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 i.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(b){this.map=b,this.load(),this.canvas&&this.animate&&this.play()}onRemove(b){this.pause()}prepare(){let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!b&&!this._playing||this.texture instanceof i.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.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 b of[this.canvas.width,this.canvas.height])if(isNaN(b)||b<=0)return!0;return!1}},custom:class extends i.E{constructor(b,d,m,w){super(),this.id=b,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=d,this.setEventedParent(w),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Oc(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,i.aH(d,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(b){this.map=b,this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(b),this.load()}onRemove(b){this._implementation.onRemove&&this._implementation.onRemove(b)}hasTile(b){if(this._implementation.hasTile){const{x:d,y:m,z:w}=b.canonical;return this._implementation.hasTile({x:d,y:m,z:w})}return!this.tileBounds||this.tileBounds.contains(b.canonical)}loadTile(b,d){const{x:m,y:w,z:M}=b.tileID.canonical,O=new AbortController;b.request=Promise.resolve(this._implementation.loadTile({x:m,y:w,z:M},{signal:O.signal})).then((function(D){return delete b.request,b.aborted?(b.state="unloaded",d(null)):D===void 0?(b.state="errored",d(null)):D===null?(this.loadTileData(b,{width:this.tileSize,height:this.tileSize,data:null}),b.state="loaded",d(null)):function(B){return B instanceof ImageData||B instanceof HTMLCanvasElement||B instanceof ImageBitmap||B instanceof HTMLImageElement}(D)?(this.loadTileData(b,D),b.state="loaded",void d(null)):(b.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(D=>{D.name!=="AbortError"&&(b.state="errored",d(D))}),b.request.cancel=()=>O.abort()}loadTileData(b,d){b.setTexture(d,this.map.painter)}unloadTile(b,d){if(b.texture&&b.texture instanceof i.T?(b.destroy(!1),b.texture&&b.texture instanceof i.T&&this.map.painter.saveTileTexture(b.texture)):b.destroy(),this._implementation.unloadTile){const{x:m,y:w,z:M}=b.tileID.canonical;this._implementation.unloadTile({x:m,y:w,z:M})}d&&d()}abortTile(b,d){b.request&&b.request.cancel&&(b.request.cancel(),delete b.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(b=>({x:b.canonical.x,y:b.canonical.y,z:b.canonical.z}))}_clearTiles(){const b=i.B(this.id,this.scope);this.map.style.clearSource(b)}_update(){this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}}},Uo=function(b,d,m,w){const M=new Zu[d.type](b,d,m,w);if(M.id!==b)throw new Error(`Expected Source id to be ${b} instead of ${M.id}`);return i.aY(["load","abort","unload","serialize","prepare"],M),M};function fp(b,d,m=""){return`${m}:${d.id||""}:${d.layer.id}:${function(w){if("layerId"in w)return`layer:${w.layerId}`;{const{featuresetId:M,importId:O}=w;return`featureset:${M}${O?`:import:${O}`:""}`}}(b.target)}`}function Em(b,d,m,w=""){if(b.uniqueFeatureID){const M=fp(b,d,w);if(m.has(M))return!0;m.add(M)}return!1}function jy(b,d,m,w,M=!1){const O=d.sourceCache.transform,D=d.sourceCache.tilesIn(b,d.has3DLayers,M);D.sort(Ch);const B=[];for(const H of D){const Y=H.tile.queryRenderedFeatures(d,H,m,w,O,M);Object.keys(Y).length&&B.push({wrappedTileID:H.tile.tileID.wrapped().key,queryResults:Y})}for(const H in d.layers){const Y=d.layers[H];if(Y.styleLayer){const Q=Y.styleLayer.queryRenderedFeatures(b,d.sourceCache,w);Object.keys(Q).length&&B.push({wrappedTileID:0,queryResults:Q})}}return B.length===0?{}:function(H){const Y={},Q={};for(const ce of H){const le=ce.queryResults,de=ce.wrappedTileID,we=Q[de]=Q[de]||{};for(const ve in le){const De=le[ve],Pe=we[ve]=we[ve]||{},Ve=Y[ve]=Y[ve]||[];for(const Xe of De)Pe[Xe.featureIndex]||(Pe[Xe.featureIndex]=!0,Ve.push(Xe))}}return Y}(B)}function ky(b,d,m,w,M,O){const D={},B=w.queryRenderedSymbols(b),H=[];for(const Y of Object.keys(B).map(Number))H.push(M[Y]);H.sort(Ch);for(const Y of H){const Q=Y.featureIndex.lookupSymbolFeatures(B[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,m,O);for(const ce in Q){const le=D[ce]=D[ce]||[],de=Q[ce];de.sort((we,ve)=>{const De=Y.featureSortOrder;if(De){const Pe=De.indexOf(we.featureIndex);return De.indexOf(ve.featureIndex)-Pe}return ve.featureIndex-we.featureIndex});for(const we of de)le.push(we)}}return D}function Ny(b,d){const m=b.getRenderableIds().map(O=>b.getTileByID(O)),w=[],M={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(M.length!==0){w.layers=M,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(O=>M.filter(D=>D.id===O)[0]));for(const O of M)m[O.fqid]=w}}return m}const Dc=32,Hd=33,Rc=new Uint16Array(8184);for(let b=0;b<2046;b++){let d=b+2,m=0,w=0,M=0,O=0,D=0,B=0;for(1&d?M=O=D=Dc:m=w=B=Dc;(d>>=1)>1;){const Y=m+M>>1,Q=w+O>>1;1&d?(M=m,O=w,m=D,w=B):(m=M,w=O,M=D,O=B),D=Y,B=Q}const H=4*b;Rc[H+0]=m,Rc[H+1]=w,Rc[H+2]=M,Rc[H+3]=O}const _o=new Uint16Array(2178),jd=new Uint8Array(1089),Yu=new Uint16Array(1089);function yc(b){return b===0?-.03125:b===32?.03125:0}const Sy={type:2,extent:i.al,loadGeometry:()=>[[new i.P(0,0),new i.P(i.al+1,0),new i.P(i.al+1,i.al+1),new i.P(0,i.al+1),new i.P(0,0)]]};class pp{constructor(d,m,w,M,O,D){this.tileID=d,this.uid=i.b2(),this.uses=0,this.tileSize=m,this.tileZoom=w,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,M&&M.style&&(this._lastUpdatedBrightness=M.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",M&&M.transform&&(this.projection=M.transform.projection),this.worldview=D,this._hasAppearances=null}registerFadeDuration(d){const m=d+this.timeAdded;mw)M=!1;else if(m)if(this.expirationTimew.appearances&&w.appearances.length>0))return!0;return!1}updateBuckets(d,m){if(!this.latestFeatureIndex||!d.style)return;const w=d.style.listImages(),M=d.style.getBrightness();for(const O in this.buckets){if(!d.style.hasLayer(O))continue;const D=this.buckets[O],B=D.layers[0],H=B.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(B);let Q={};Y&&(Q=Y._state.getState(H,void 0));const ce=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},le=Object.keys(Q).length>0&&!m;D.hasAppearances=D.layers.some(ve=>ve.appearances&&ve.appearances.length>0);const de=le?D.stateDependentLayers:D.layers;if(le&&D.stateDependentLayers.length!==0||m){const ve=this.latestFeatureIndex.loadVTLayers();D.update(Q,ve[H],w,ce,de,m,M)}if(le&&D.stateDependentLayers.length!==0||m||D.hasAppearances){const ve={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};D.updateAppearances(this.tileID.canonical,Q,w,ve)}(D instanceof i.ba||D instanceof i.bb)&&d._terrain&&d._terrain.enabled&&Y&&D.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const we=d&&d.style&&d.style.getOwnLayer(O);we&&(this.queryPadding=Math.max(this.queryPadding,we.queryRadius(D)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;De--){const Pe=4*De,Ve=Rc[Pe+0],Xe=Rc[Pe+1],We=Rc[Pe+2],bt=Rc[Pe+3],ut=Ve+We>>1,xt=Xe+bt>>1,ct=ut+xt-Xe,it=xt+Ve-ut,St=Xe*Hd+Ve,Dt=bt*Hd+We,Lt=xt*Hd+ut,Ht=Math.hypot((_o[2*St+0]+_o[2*Dt+0])/2-_o[2*Lt+0],(_o[2*St+1]+_o[2*Dt+1])/2-_o[2*Lt+1])>=16;jd[Lt]=jd[Lt]||(Ht?1:0),De<1022&&(jd[Lt]=jd[Lt]||jd[(Xe+it>>1)*Hd+(Ve+ct>>1)]||jd[(bt+it>>1)*Hd+(We+ct>>1)])}const ce=new i.b1,le=new i.b0;let de=0;function we(De,Pe){const Ve=Pe*Hd+De;return Yu[Ve]===0&&(ce.emplaceBack(_o[2*Ve+0],_o[2*Ve+1],De*i.al/Dc,Pe*i.al/Dc),Yu[Ve]=++de),Yu[Ve]-1}function ve(De,Pe,Ve,Xe,We,bt){const ut=De+Ve>>1,xt=Pe+Xe>>1;if(Math.abs(De-We)+Math.abs(Pe-bt)>1&&jd[xt*Hd+ut])ve(We,bt,De,Pe,ut,xt),ve(Ve,Xe,We,bt,ut,xt);else{const ct=we(De,Pe),it=we(Ve,Xe),St=we(We,bt);le.emplaceBack(ct,it,St)}}return ve(0,0,Dc,Dc,Dc,0),ve(Dc,Dc,0,0,0,Dc),{vertices:ce,indices:le}}(this.tileID.canonical,m);M=D.vertices,O=D.indices}else{M=new i.b1,O=new i.b0;for(const{x:B,y:H}of w)M.emplaceBack(B,H,0,0);const D=i.bh(M.int16.subarray(0,4*M.length),void 0,4);for(let B=0;B0&&(H=i.bl(new Float64Array(16),m.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,M,m,D,H,B),this._makeGlobeTileDebugTextBuffer(d,M,m,D,H,B)}_globePoint(d,m,w,M,O,D,B){let H=i.bm(d,m,w);if(D){const Y=1<.5?de=-1:le<-.5&&(de=1);let we=(d/i.al+w.x)/Y+de,ve=(m/i.al+w.y)/Y;we=(we-Q)*M._pixelsPerMercatorPixel+Q,ve=(ve-ce)*M._pixelsPerMercatorPixel+ce;const De=[we*M.worldSize,ve*M.worldSize,0];i.af(De,De,D),H=i.bn(H,De,B)}return i.af(H,H,O)}_makeGlobeTileDebugBorderBuffer(d,m,w,M,O,D){const B=new i.bd,H=new i.be,Y=new i.bo,Q=(le,de,we,ve,De)=>{const Pe=(we-le)/(De-1),Ve=(ve-de)/(De-1),Xe=B.length;for(let We=0;Wece*de+we;for(let de=0;de{if(O)m(O);else try{const H=w.getHeaderLength(D);if(H>d)return void(this.request=this.fetchHeader(H,m));w.parseHeader(D),this._isHeaderLoaded=!0;let Y=0;for(const Q of Object.values(w.layers))Y=Math.max(Y,Q.dataIndex[Q.dataIndex.length-1].lastByte);D.byteLength>=Y&&(this.entireBuffer=D),m(null,this.entireBuffer||D,B)}catch(H){m(H)}}),this.request}fetchBandForRender(d,m,w,M){this.fetchBand(d,m,w,O=>{if(O)return void M(O);this.updateTextureDescriptor(d,m,w);const D=this.textureDescriptorPerLayer.get(m);M(null,D?D.img:null)})}fetchBand(d,m,w,M,O=!0){const D=this._mrt;if(!this._isHeaderLoaded||!D)return void M(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void M(new Error("Can't fetch tile band without an actor"));let H;const Y=i.B(String(w),i.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=(ve,De)=>{H.complete(ve,De),ve?M(ve):(Q.forEach(Pe=>Pe(null,De)),this._taskQueue.delete(Y))},le=(ve,De)=>{if(ve)return M(ve);const Pe=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:De,task:H},ce,void 0,!0);if(m!==null){const Ve=this._workQueuePerLayer.get(m)||[];Ve.push(()=>{Pe&&Pe.cancel(),H.cancel()}),this._workQueuePerLayer.has(m)||this._workQueuePerLayer.set(m,Ve)}};let de;try{de=D.getLayer(d)}catch(ve){if(this.state==="reloading")return;throw ve}if(!de)return void M(new Error(`Unknown sourceLayer "${d}"`));if(de.hasDataForBand(w))return Q.forEach(ve=>ve(null,null)),void this._taskQueue.delete(Y);const we=de.getDataRange([w]);if(H=D.createDecodingTask(we),!H||H.tasks.length)if(m!==null&&this.flushQueues(m),this.entireBuffer)le(null,this.entireBuffer.slice(we.firstByte,we.lastByte+1));else{const ve=Object.assign({},this.requestParams,{headers:{Range:`bytes=${we.firstByte}-${we.lastByte}`}}),De=i.bu(ve,le);if(m!==null){const Pe=this._fetchQueuePerLayer.get(m)||[];Pe.push(()=>{De.cancel(),H.cancel()}),this._fetchQueuePerLayer.has(m)||this._fetchQueuePerLayer.set(m,Pe)}}}updateNeeded(d,m){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==m||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,m,w){if(!this._mrt)return;const M=this._mrt.getLayer(d);if(!M||!M.hasBand(w)||!M.hasDataForBand(w))return;const{bytes:O,tileSize:D,buffer:B,offset:H,scale:Y}=M.getBandView(w),Q=D+2*B,ce=new i.q({width:Q,height:Q},O),le=this.texturePerLayer.get(m);le&&le instanceof i.T&&le.update(ce,{premultiply:!1}),this.textureDescriptorPerLayer.set(m,{layer:d,band:w,img:ce,buffer:B,offset:H,tileSize:D,format:M.pixelFormat,mix:[Y,256*Y,65536*Y,16777216*Y]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const m of this.texturePerLayer.values())m&&m instanceof i.T&&m.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 Cy{constructor(d,m){this.max=d,this.onRemove=m,this.reset()}reset(){for(const d in this.data)for(const m of this.data[d])m.timeout&&clearTimeout(m.timeout),this.onRemove(m.value);return this.data={},this.order=[],this}add(d,m,w){const M=d.wrapped().key;this.data[M]===void 0&&(this.data[M]=[]);const O={value:m,timeout:void 0};if(w!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},w)),this.data[M].push(O),this.order.push(M),this.order.length>this.max){const D=this._getAndRemoveByKey(this.order[0]);D&&this.onRemove(D)}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 m=this.data[d].shift();return m.timeout&&clearTimeout(m.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),m.value}getByKey(d){const m=this.data[d];return m?m[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,m){if(!this.has(d))return this;const w=d.wrapped().key,M=m===void 0?0:this.data[w].indexOf(m),O=this.data[w][M];return this.data[w].splice(M,1),O.timeout&&clearTimeout(O.timeout),this.data[w].length===0&&delete this.data[w],this.onRemove(O.value),this.order.splice(this.order.indexOf(w),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}filter(d){const m=[];for(const w in this.data)for(const M of this.data[w])d(M.value)||m.push(M);for(const w of m)this.remove(w.value.tileID,w)}}class Hg{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,m,w){const M=String(m);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][M]=this.stateChanges[d][M]||{},Object.assign(this.stateChanges[d][M],w),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==M&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][M]===null){this.deletedStates[d][M]={};for(const O in this.state[d][M])w[O]||(this.deletedStates[d][M][O]=null)}else for(const O in w)this.deletedStates[d]&&this.deletedStates[d][M]&&this.deletedStates[d][M][O]===null&&delete this.deletedStates[d][M][O]}removeFeatureState(d,m,w){if(this.deletedStates[d]===null)return;const M=String(m);if(this.deletedStates[d]=this.deletedStates[d]||{},w&&m!==void 0)this.deletedStates[d][M]!==null&&(this.deletedStates[d][M]=this.deletedStates[d][M]||{},this.deletedStates[d][M][w]=null);else if(m!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][M])for(w in this.deletedStates[d][M]={},this.stateChanges[d][M])this.deletedStates[d][M][w]=null;else this.deletedStates[d][M]=null;else this.deletedStates[d]=null}getState(d,m){const w=this.state[d]||{},M=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(m!==void 0){const B=String(m),H=Object.assign({},w[B],M[B]);if(O){const Y=O[m];if(Y===null)return{};for(const Q in Y)delete H[Q]}return H}const D=Object.assign({},w,M);if(O)for(const B in O)delete D[B];return D}initializeTileState(d,m){d.refreshFeatureState(m)}coalesceChanges(d,m){const w={};for(const M in this.stateChanges){this.state[M]=this.state[M]||{};const O={};for(const D in this.stateChanges[M])this.state[M][D]||(this.state[M][D]={}),Object.assign(this.state[M][D],this.stateChanges[M][D]),O[D]=this.state[M][D];w[M]=O}for(const M in this.deletedStates){this.state[M]=this.state[M]||{};const O={};if(this.deletedStates[M]===null)for(const D in this.state[M])O[D]={},this.state[M][D]={};else for(const D in this.deletedStates[M]){if(this.deletedStates[M][D]===null)this.state[M][D]={};else if(this.state[M][D])for(const B of Object.keys(this.deletedStates[M][D]))delete this.state[M][D][B];O[D]=this.state[M][D]}w[M]=w[M]||{},Object.assign(w[M],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(w).length!==0)for(const M in d)d[M].refreshFeatureState(m)}}class Qc extends i.E{constructor(d,m,w){super(),this.id=d,this._onlySymbols=w,m.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))}),m.on("error",()=>{this._sourceErrored=!0}),this._source=m,this._tiles={},this._cache=new Cy(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=m.minTileCacheSize,this._maxTileCacheSize=m.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Hg,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,m){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,m)}_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 m in this._tiles){const w=this._tiles[m];w.upload(d,this.map?this.map.painter:void 0),w.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(Wg).map(d=>d.key)}getRenderableIds(d,m){const w=[];for(const M in this._tiles)this._isIdRenderable(+M,d,m)&&w.push(this._tiles[M]);return d?w.sort((M,O)=>{const D=M.tileID,B=O.tileID,H=new i.P(D.canonical.x,D.canonical.y)._rotate(this.transform.angle),Y=new i.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return D.overscaledZ-B.overscaledZ||Y.y-H.y||Y.x-H.x}).map(M=>M.tileID.key):w.map(M=>M.tileID).sort(Wg).map(M=>M.key)}hasRenderableParent(d){const m=this.findLoadedParent(d,0);return!!m&&this._isIdRenderable(m.tileID.key)}_isIdRenderable(d,m,w){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(m||!this._tiles[d].holdingForFade())&&(w||!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,m){const w=this._tiles[d];w&&(w.state!=="loading"&&(w.state=m),this._loadTile(w,this._tileLoaded.bind(this,w,d,m)))}_tileLoaded(d,m,w,M,O){if(M){if(d.state="errored",M.status!==404)this._source.fire(new i.y(M,{tile:d}));else{if(this._source.fire(new i.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 B=this.map.painter.terrain;this.update(this.transform,B.getScaledDemTileSize(),!0),B.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=i.o.now(),w==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(m,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let D=new Map;O&&O.responseHeaders&&(D=O.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:D}))}_backfillDEM(d){const m=this.getRenderableIds();for(let M=0;M1||(Math.abs(D)>1&&(Math.abs(D+H)===1?D+=H:Math.abs(D-H)===1&&(D-=H)),O.dem&&M.dem&&(M.dem.backfillBorder(O.dem,D,B),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,m,w,M){for(const O in this._tiles){let D=this._tiles[O];if(M[O]||!D.hasData()||D.tileID.overscaledZ<=m||D.tileID.overscaledZ>w)continue;let B=D.tileID;for(;D&&D.tileID.overscaledZ>m+1;){const Y=D.tileID.scaledTo(D.tileID.overscaledZ-1);D=this._tiles[Y.key],D&&D.hasData()&&(B=Y)}let H=B;for(;H.overscaledZ>m;)if(H=H.scaledTo(H.overscaledZ-1),d[H.key]){M[B.key]=B;break}}}findLoadedParent(d,m){if(d.key in this._loadedParentTiles){const w=this._loadedParentTiles[d.key];return w&&w.tileID.overscaledZ>=m?w:null}for(let w=d.overscaledZ-1;w>=m;w--){const M=d.scaledTo(w),O=this._getLoadedTile(M);if(O)return O}}_getLoadedTile(d){const m=this._tiles[d.key];return m&&m.hasData()?m:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,m){m=m||this._source.tileSize;const w=Math.ceil(d.width/m)+1,M=Math.ceil(d.height/m)+1,O=Math.floor(w*M*5),D=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,O):O,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,D):D;this._cache.setMaxSize(B)}handleWrapJump(d){const m=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,m){const w={};for(const M in this._tiles){const O=this._tiles[M];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+m),w[O.tileID.key]=O}this._tiles=w;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,m,w,M,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!w)return;this.updateCacheSize(d,m),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const D=this._source.type==="batched-model";let B,H=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());H>de&&(H=de)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(le=>new i.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,B=le.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!w,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.minzoom<=1&&d.projection.name==="globe"&&(B.push(new i.aQ(1,0,1,0,0)),B.push(new i.aQ(1,0,1,1,0)),B.push(new i.aQ(1,0,1,0,1)),B.push(new i.aQ(1,0,1,1,1)))}else if(B=d.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!w,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.hasTile){const le=this._source.hasTile.bind(this._source);B=B.filter(de=>le(de))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Mh(this._source.type)){const le=d.coveringZoomLevel({tileSize:m||this._source.tileSize,roundZoom:this._source.roundZoom&&!w}),de=Math.min(le,this._source.maxzoom);if(D){const we=d.extendTileCover(B,de);for(const ve of we)B.push(ve)}else if(O){const we=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(de),de);for(const ve of we)B.push(ve)}else if(this.castsShadows&&M){const we=d.extendTileCover(B,de,M,16);for(const ve of we)this._shadowCasterTiles[ve.key]=!0,B.push(ve)}}const Q=this._updateRetainedTiles(B);if(Mh(this._source.type)&&B.length!==0){const le={},de={},we=Object.keys(Q);for(const De of we){const Pe=Q[De],Ve=this._tiles[De];if(!Ve||Ve.fadeEndTime&&Ve.fadeEndTime<=i.o.now())continue;const Xe=this.findLoadedParent(Pe,Math.max(Pe.overscaledZ-Qc.maxOverzooming,this._source.minzoom));Xe&&(this._addTile(Xe.tileID),le[Xe.tileID.key]=Xe.tileID),de[De]=Pe}const ve=B[B.length-1].overscaledZ;for(const De in this._tiles){const Pe=this._tiles[De];if(Q[De]||!Pe.hasData())continue;let Ve=Pe.tileID;for(;Ve.overscaledZ>ve;){Ve=Ve.scaledTo(Ve.overscaledZ-1);const Xe=this._tiles[Ve.key];if(Xe&&Xe.hasData()&&de[Ve.key]){Q[De]=Pe.tileID;break}}}for(const De in le)Q[De]||(this._coveredTiles[De]=!0,Q[De]=le[De])}for(const le in Q)this._tiles[le].clearFadeHold();const ce=i.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 m={};if(d.length===0)return m;const w={},M=d.reduce((Y,Q)=>Math.min(Y,Q.overscaledZ),1/0),O=d[0].overscaledZ,D=Math.max(O-Qc.maxOverzooming,this._source.minzoom),B=Math.max(O+Qc.maxUnderzooming,this._source.minzoom),H={};for(const Y of d){const Q=this._addTile(Y);m[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()){m[le.key]=le;continue}}else{const le=Y.children(this._source.maxzoom);if(m[le[0].key]&&m[le[1].key]&&m[le[2].key]&&m[le[3].key])continue}let ce=Q.wasRequested();for(let le=Y.overscaledZ-1;le>=D;--le){const de=Y.scaledTo(le);if(w[de.key]||(w[de.key]=!0,Q=this.getTile(de),!Q&&ce&&(Q=this._addTile(de)),Q&&(m[de.key]=de,ce=Q.wasRequested(),Q.hasData())))break}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const m=[];let w,M=this._tiles[d].tileID;for(;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){w=this._loadedParentTiles[M.key];break}m.push(M.key);const O=M.scaledTo(M.overscaledZ-1);if(w=this._getLoadedTile(O),w)break;M=O}for(const O of m)this._loadedParentTiles[O]=w}}_addTile(d){let m=this._tiles[d.key];if(m)return m.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),m;m=this._cache.getAndRemove(d),m&&(this._setTileReloadTimer(d.key,m),m.tileID=d,this._state.initializeTileState(m,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,m)));const w=!!m;if(!w){const M=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();m=this._source.type==="raster-array"?new mp(d,O,this.transform.tileZoom,M,this._isRaster):new pp(d,O,this.transform.tileZoom,M,this._isRaster,this._source.worldview),this._loadTile(m,this._tileLoaded.bind(this,m,d.key,m.state))}return m.uses++,this._tiles[d.key]=m,w||this._source.fire(new i.z("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m}_setTileReloadTimer(d,m){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const w=m.getExpiryTimeout();w&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},w))}_removeTile(d){const m=this._tiles[d];m&&(m.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),m.uses>0||(m.hasData()&&m.state!=="reloading"||m.state==="empty"?this._cache.add(m.tileID,m,m.getExpiryTimeout()):(m.aborted=!0,this._abortTile(m),this._unloadTile(m))))}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,m,w){const M=[],O=this.transform;if(!O)return M;const D=O.projection.name==="globe",B=i.aF(O.center.lng);for(const H in this._tiles){const Y=this._tiles[H];if(w&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let Q;if(D){const ce=Y.tileID.canonical;if(ce.z===0){const le=[Math.abs(i.aA(B,...Th(ce,-1))-B),Math.abs(i.aA(B,...Th(ce,1))-B)];Q=[0,2*le.indexOf(Math.min(...le))-1]}else{const le=[Math.abs(i.aA(B,...Th(ce,-1))-B),Math.abs(i.aA(B,...Th(ce,0))-B),Math.abs(i.aA(B,...Th(ce,1))-B)];Q=[le.indexOf(Math.min(...le))-1]}}else Q=[0];for(const ce of Q){const le=d.containsTile(Y,O,m,ce);le&&M.push(le)}}return M}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,m){const w=this.getRenderableIds(d,m).map(O=>this._tiles[O].tileID),M=this.transform.projection.name==="globe";for(const O of w)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=M?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return w}sortCoordinatesByDistance(d){const m=d.slice(),w=this.transform._camera.position,M=this.transform._camera.forward(),O={};for(const D of m){const B=1/(1<O[D.key]-O[B.key]),m}hasTransition(){if(this._source.hasTransition())return!0;if(Mh(this._source.type))for(const d in this._tiles){const m=this._tiles[d];if(m.fadeEndTime!==void 0&&m.fadeEndTime>=i.o.now())return!0}return!1}setFeatureState(d,m,w){this._state.updateState(d=d||"_geojsonTileLayer",m,w)}removeFeatureState(d,m,w){this._state.removeFeatureState(d=d||"_geojsonTileLayer",m,w)}getFeatureState(d,m){return this._state.getState(d=d||"_geojsonTileLayer",m)}setDependencies(d,m,w){const M=this._tiles[d];M&&M.setDependencies(m,w)}reloadTilesForDependencies(d,m){for(const w in this._tiles)this._tiles[w].hasDependency(d,m)&&this._reloadTile(+w,"reloading");this._cache.filter(w=>!w.hasDependency(d,m))}_preloadTiles(d,m){if(!this._sourceLoaded){const H=()=>{this._sourceLoaded&&(this._source.off("data",H),this._preloadTiles(d,m))};return void this._source.on("data",H)}const w=new Map,M=Array.isArray(d)?d:[d],O=this.map.painter.terrain,D=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const H of M){const Y=H.coveringTiles({tileSize:D,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)w.set(Q.key,Q);this.usedForTerrain&&H.updateElevation(!1)}const B=Array.from(w.values());i.bw(B,(H,Y)=>{const Q=new pp(H,this._source.tileSize*H.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)})},m)}}function Wg(b,d){const m=Math.abs(2*b.wrap)-+(b.wrap<0),w=Math.abs(2*d.wrap)-+(d.wrap<0);return b.overscaledZ-d.overscaledZ||w-m||d.canonical.y-b.canonical.y||d.canonical.x-b.canonical.x}function Mh(b){return b==="raster"||b==="image"||b==="video"||b==="custom"}function Th(b,d){const m=1<0:w.type==="building"?M=!w.isHidden(d)&&w.paint.get("building-opacity")>0:w.type==="model"&&(M=!w.isHidden(d)&&w.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!M&&m.visible,m.visible=M}}updateZOffset(d,m){this.currentBuildingBuckets=[];for(const M of this.layers){const O=M.layer,D=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=M.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=M.visible?O.paint.get("building-vertical-scale"):0);let H=D?D.getTile(m):null;if(!H&&D)for(const Y in D._tiles){const Q=D._tiles[Y];if(m.canonical.isChildOf(Q.tileID.canonical)){H=Q;break}}this.currentBuildingBuckets.push({bucket:H?H.getBucket(O):null,tileID:H?H.tileID:m,verticalScale:B})}d.hasAnyZOffset=!1;let w=!1;for(let M=0;M{w in d&&(m[w]=d[w])}),m}function xf(b){b=b.slice();const d=Object.create(null);for(let m=0;m0?(M-D)/B:0;return this.points[O].mult(1-H).add(this.points[m].mult(H))}}class Na{constructor(d,m,w){const M=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/w),this.yCellCount=Math.ceil(m/w);for(let D=0;Dthis.width||M<0||m>this.height)return!O&&[];const B=[];if(d<=0&&m<=0&&this.width<=w&&this.height<=M){if(O)return!0;for(let H=0;H0:B}_queryCircle(d,m,w,M,O){const D=d-w,B=d+w,H=m-w,Y=m+w;if(B<0||D>this.width||Y<0||H>this.height)return!M&&[];const Q=[];return this._forEachCell(D,H,B,Y,this._queryCellCircle,Q,{hitTest:M,circle:{x:d,y:m,radius:w},seenUids:{box:{},circle:{}}},O),M?Q.length>0:Q}query(d,m,w,M,O){return this._query(d,m,w,M,!1,O)}hitTest(d,m,w,M,O){return this._query(d,m,w,M,!0,O)}hitTestCircle(d,m,w,M){return this._queryCircle(d,m,w,!0,M)}_queryCell(d,m,w,M,O,D,B,H){const Y=B.seenUids,Q=this.boxCells[O];if(Q!==null){const le=this.bboxes;for(const de of Q)if(!Y.box[de]){Y.box[de]=!0;const we=4*de;if(d<=le[we+2]&&m<=le[we+3]&&w>=le[we+0]&&M>=le[we+1]&&(!H||H(this.boxKeys[de]))){if(B.hitTest)return D.push(!0),!0;D.push({key:this.boxKeys[de],x1:le[we],y1:le[we+1],x2:le[we+2],y2:le[we+3]})}}}const ce=this.circleCells[O];if(ce!==null){const le=this.circles;for(const de of ce)if(!Y.circle[de]){Y.circle[de]=!0;const we=3*de;if(this._circleAndRectCollide(le[we],le[we+1],le[we+2],d,m,w,M)&&(!H||H(this.circleKeys[de]))){if(B.hitTest)return D.push(!0),!0;{const ve=le[we],De=le[we+1],Pe=le[we+2];D.push({key:this.circleKeys[de],x1:ve-Pe,y1:De-Pe,x2:ve+Pe,y2:De+Pe})}}}}}_queryCellCircle(d,m,w,M,O,D,B,H){const Y=B.circle,Q=B.seenUids,ce=this.boxCells[O];if(ce!==null){const de=this.bboxes;for(const we of ce)if(!Q.box[we]){Q.box[we]=!0;const ve=4*we;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,de[ve+0],de[ve+1],de[ve+2],de[ve+3])&&(!H||H(this.boxKeys[we])))return D.push(!0),!0}}const le=this.circleCells[O];if(le!==null){const de=this.circles;for(const we of le)if(!Q.circle[we]){Q.circle[we]=!0;const ve=3*we;if(this._circlesCollide(de[ve],de[ve+1],de[ve+2],Y.x,Y.y,Y.radius)&&(!H||H(this.circleKeys[we])))return D.push(!0),!0}}}_forEachCell(d,m,w,M,O,D,B,H){const Y=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(m),ce=this._convertToXCellCoord(w),le=this._convertToYCellCoord(M);for(let de=Y;de<=ce;de++)for(let we=Q;we<=le;we++)if(O.call(this,d,m,w,M,this.xCellCount*we+de,D,B,H))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,m,w,M,O,D){const B=M-d,H=O-m,Y=w+D;return Y*Y>B*B+H*H}_circleAndRectCollide(d,m,w,M,O,D,B){const H=(D-M)/2,Y=Math.abs(d-(M+H));if(Y>H+w)return!1;const Q=(B-O)/2,ce=Math.abs(m-(O+Q));if(ce>Q+w)return!1;if(Y<=H||ce<=Q)return!0;const le=Y-H,de=ce-Q;return le*le+de*de<=w*w}}const ra={unknown:0,flipRequired:1,flipNotRequired:2},mi=Math.tan(85*Math.PI/180);function xl(b,d,m,w,M,O,D){const B=i.bC();if(m)if(O.name==="globe"){const H=i.bD(M,d);i.aB(B,B,H)}else{const H=i.bE([],D);B[0]=H[0],B[1]=H[1],B[4]=H[2],B[5]=H[3],w||i.bB(B,B,M.angle)}else i.aB(B,M.labelPlaneMatrix,b);return B}function gp(b,d,m,w,M,O,D){const B=xl(b,d,m,w,M,O,D);return O.name==="globe"&&m||(B[2]=B[6]=B[10]=B[14]=0),B}function xp(b,d,m,w,M,O,D){if(m){if(O.name==="globe"){const B=xl(b,d,m,w,M,O,D);return i.bl(B,B),i.aB(B,b,B),B}{const B=i.bz(b),H=i.bA([]);return H[0]=D[0],H[1]=D[1],H[4]=D[2],H[5]=D[3],i.aB(B,B,H),w||i.bB(B,B,-M.angle),B}}return M.glCoordMatrix}function Wd(b,d,m,w){const M=[b,d,m,1];m?i.aC(M,M,w):mn(M,M,w);const O=M[3];return M[0]/=O,M[1]/=O,M[2]/=O,M}function Sa(b,d){return Math.min(.5+b/d*.5,1.5)}function WI(b,d){const m=b[0]/b[3],w=b[1]/b[3];return m>=-d[0]&&m<=d[0]&&w>=-d[1]&&w<=d[1]}function GI(b,d,m,w,M,O,D,B,H,Y,Q=1){const ce=m.transform,le=w?b.textSizeData:b.iconSizeData,de=i.bK(le,m.transform.zoom,Q),we=ce.projection.name==="globe",ve=[256/m.width*2+1,256/m.height*2+1],De=w?b.text.dynamicLayoutVertexArray:b.icon.dynamicLayoutVertexArray;De.clear();let Pe=null;we&&(Pe=w?b.text.globeExtVertexArray:b.icon.globeExtVertexArray);const Ve=b.lineVertexArray,Xe=w?b.text.placedSymbolArray:b.icon.placedSymbolArray,We=m.transform.width/m.transform.height;let bt,ut=!1;for(let xt=0;xtMath.abs(m)?{useVertical:!0}:b===i.bL.vertical?w>0?{needsFlipping:!0}:null:d!==ra.unknown&&function(M,O){return M===0||Math.abs(O/M)>mi}(m,w)?d===ra.flipRequired?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function A3(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe,Ve,Xe){const We=d/24,bt=b.lineOffsetX*We,ut=b.lineOffsetY*We,{lineStartIndex:xt,glyphStartIndex:ct,numGlyphs:it,segment:St,writingMode:Dt,flipState:Lt}=b,Ht=xt+b.lineLength,Wt=sr=>{if(Q){const[Jt,Vt,dr]=sr.up,Tr=Y.length;i.bN(Q,Tr+0,Jt,Vt,dr),i.bN(Q,Tr+1,Jt,Vt,dr),i.bN(Q,Tr+2,Jt,Vt,dr),i.bN(Q,Tr+3,Jt,Vt,dr)}const[_r,$t,Tt]=sr.point;i.bO(Y,_r,$t,Tt,sr.angle)};if(it>1){const sr=KI(We,B,bt,ut,m,ce,le,b,H,O,de,ve,!1,De,Pe,Ve,Xe);if(!sr)return{notEnoughRoom:!0};if(w&&!m){let[_r,$t,Tt]=sr.first.point,[Jt,Vt,dr]=sr.last.point;[_r,$t]=Wd(_r,$t,Tt,D),[Jt,Vt]=Wd(Jt,Vt,dr,D);const Tr=Fn(Dt,Lt,(Jt-_r)*we,Vt-$t);if(b.flipState=Tr&&Tr.needsFlipping?ra.flipRequired:ra.flipNotRequired,Tr)return Tr}Wt(sr.first);for(let _r=ct+1;_r0?Jt:Xu(le,Tt,_r,1,M,void 0,De,Pe.canonical),dr=Fn(Dt,Lt,(Vt[0]-_r[0])*we,Vt[1]-_r[1]);if(b.flipState=dr&&dr.needsFlipping?ra.flipRequired:ra.flipNotRequired,dr)return dr}const sr=Ty(We*B.getoffsetX(ct),bt,ut,m,ce,le,St,xt,Ht,H,O,de,ve,!1,!1,De,Pe,Ve,Xe);if(!sr)return{notEnoughRoom:!0};Wt(sr)}return{}}function yv(b,d,m,w,M){const{x:O,y:D,z:B}=w.projectTilePoint(b.x,b.y,d);if(!M)return Wd(O,D,B,m);const[H,Y,Q]=M.getElevation(b,M.elevation,M.elevationFeature);return Wd(O+H,D+Y,B+Q,m)}function Xu(b,d,m,w,M,O,D,B){const H=yv(b.sub(d)._unit()._add(b),B,M,D,O);return i.av(H,m,H),i.aw(H,H),i.bH(H,m,H,w)}function Ty(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe,Ve){const Xe=w?b-d:b+d;let We=Xe>0?1:-1,bt=0;w&&(We*=-1,bt=Math.PI),We<0&&(bt+=Math.PI);let ut=B+D+(We>0?0:1)|0,xt=M,ct=M,it=0,St=0;const Dt=Math.abs(Xe),Lt=[],Ht=[];let Wt=O,sr=Wt,_r=i.bF([]);const $t=()=>Xu(sr,Wt,ct,Dt-it+1,Q,le,ve,De.canonical);for(;it+St<=Dt;){if(ut+=We,ut=H)return null;if(ct=xt,sr=Wt,Lt.push(ct),de&&Ht.push(sr),Wt=new i.P(Y.getx(ut),Y.gety(ut)),xt=ce[ut],!xt){const Jr=yv(Wt,De.canonical,Q,ve,le);xt=Jr[3]>0?ce[ut]=Jr:$t()}it+=St;const br=i.av([],xt,ct),sn=i.bG(ct,xt);if(m&&sn>0&&St>0&&i.bJ(_r,br)/(St*sn)0,Xe),xt=Y*ut.perspectiveRatio,ct=(w.x1*m+B.x-w.padding)*xt+ut.point.x,it=(w.y1*m+B.y-w.padding)*xt+ut.point.y,St=(w.x2*m+B.x+w.padding)*xt+ut.point.x,Dt=(w.y2*m+B.y+w.padding)*xt+ut.point.y,Lt=ut.perspectiveRatio<=.55||ut.occluded;return!this.isInsideGrid(ct,it,St,Dt)||!H&&this.grid.hitTest(ct,it,St,Dt,ce)||Lt?{box:[],offscreen:!1,occluded:ut.occluded}:{box:[ct,it,St,Dt],offscreen:this.isOffscreen(ct,it,St,Dt),occluded:!1}}placeCollisionCircles(d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De){const Pe=[],Ve=this.transform.elevation,Xe=d.getProjection(),We=d.elevationType==="road",bt=!!Ve||We,ut=i.bV.getAtTileOffsetFunc(De,this.transform.center.lat,this.transform.worldSize,Xe),xt=new i.P(w.tileAnchorX,w.tileAnchorY),ct=new i.P(w.tileAnchorX,w.tileAnchorY);let{x:it,y:St,z:Dt}=Xe.projectTilePoint(ct.x,ct.y,De.canonical),Lt=null;if(bt){const sn=We?d.getElevationFeatureForText(M):null;Lt={getElevation:ut,elevation:Ve,elevationFeature:sn};const[Jr,zr,Gr]=ut(xt,Ve,sn);it+=Jr,St+=zr,Dt+=Gr}const Ht=Xe.name==="globe",Wt=this.projectAndGetPerspectiveRatio(H,it,St,Dt,De,Ht||!!Ve||this.transform.pitch>0,Xe),{perspectiveRatio:sr}=Wt,_r=(le?B/sr:B*sr)/i.bY,$t=Wd(it,St,Dt,Y),Tt=w.lineOffsetX*_r,Jt=w.lineOffsetY*_r,Vt=i.an(d.layers[0].layout.get("text-max-angle")),dr=Math.cos(Vt),Tr=Wt.signedDistanceFromCamera>0?KI(_r,D,Tt,Jt,We&&w.flipState===1,$t,ct,w,O,Y,{},bt&&!le?Lt:null,le&&bt,Xe,De,le,dr):null;let Hr=!1,Nr=!1,br=!0;if(Tr&&!Wt.occluded){const sn=.5*we*sr+ve,Jr=new i.P(-100,-100),zr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Gr=new rs,{first:kn,last:Xn}=Tr,Rs=kn.path.length;let fa=[];for(let Wn=Rs-1;Wn>=1;Wn--)fa.push(kn.path[Wn]);for(let Wn=1;Wn(bt&&!Ht&&(Ra=ut(CaWn[3]<=0)&&(fa=[]));let ia=[];if(fa.length>0){let Wn=1/0,ya=-1/0,Ra=1/0,Ca=-1/0;for(const sa of fa)Wn=Math.min(Wn,sa[0]),Ra=Math.min(Ra,sa[1]),ya=Math.max(ya,sa[0]),Ca=Math.max(Ca,sa[1]);ya>=Jr.x&&Wn<=zr.x&&Ca>=Jr.y&&Ra<=zr.y&&(ia=[fa.map(sa=>new i.P(sa[0],sa[1]))],(Wnzr.x||Razr.y)&&(ia=i.bW(ia,Jr.x,Jr.y,zr.x,zr.y)))}for(const Wn of ia){Gr.reset(Wn,.25*sn);let ya=0;ya=Gr.length<=.5*sn?1:Math.ceil(Gr.paddedLength/ln)+1;for(let Ra=0;Ra0?(i.aC(H,H,d),this.fogState&&O&&B.name!=="globe"&&(Y=function(le,de,we,ve,De,Pe){const Ve=Pe.calculateFogTileMatrix(De),Xe=[de,we,ve];return i.af(Xe,Xe,Ve),Wr(le,i.ag(Xe),Pe.pitch,Pe._fov)}(this.fogState,m,w,M,O.toUnwrapped(),this.transform)>.9)):mn(H,H,d);const Q=H[3];return{point:new i.P((H[0]/Q+1)/2*this.transform.width+Gs,(-H[1]/Q+1)/2*this.transform.height+Gs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/Q*.5,1.5),signedDistanceFromCamera:Q,occluded:D&&H[2]>Q||Y}}isOffscreen(d,m,w,M){return w=this.screenRightBoundary||Mthis.screenBottomBoundary}isInsideGrid(d,m,w,M){return w>=0&&d=0&&mw.collisionGroupID===m}}return this.collisionGroups[d]}}function vc(b,d,m,w,M){const{horizontalAlign:O,verticalAlign:D}=i.c1(b),B=-(O-.5)*d,H=-(D-.5)*m,Y=i.c2(b,w);return new i.P(B+Y[0]*M,H+Y[1]*M)}function Eo(b,d,m,w,M){const O=new i.P(b,d);return m&&O._rotate(w?M:-M),O}class $ae{constructor(d,m,w,M,O,D){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Da(this.transform,O),this.buildingIndex=D,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new _v(w),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,m,w,M,O=1){const D=w.getBucket(m),B=w.latestFeatureIndex;if(!D||!B||m.fqid!==D.layerIds[0])return;const H=D.layers[0].layout,Y=D.layers[0].paint,Q=w.collisionBoxArray,ce=Math.pow(2,this.transform.zoom-w.tileID.overscaledZ),le=w.tileSize/i.al,de=w.tileID.toUnwrapped();this.transform.setProjection(D.projection);const we=(ve=w.tileID,De=D.getProjection(),Pe=this.transform,De.name===this.projection?Pe.calculateProjMatrix(ve.toUnwrapped()):gr(Pe,De,ve));var ve,De,Pe;const Ve=H.get("text-pitch-alignment")==="map",Xe=H.get("text-rotation-alignment")==="map";m.compileFilter(m.options);const We=m.dynamicFilter(),bt=m.dynamicFilterNeedsFeature(),ut=this.transform.calculatePixelsToTileUnitsMatrix(w),xt=gp(we,w.tileID.canonical,Ve,Xe,this.transform,D.getProjection(),ut);let ct=null;const it=D.getProjection().createInversionMatrix(this.transform,w.tileID.canonical);if(Ve){const Tt=xp(we,w.tileID.canonical,Ve,Xe,this.transform,D.getProjection(),ut);ct=i.aB([],this.transform.labelPlaneMatrix,Tt)}let St=null;We&&w.latestFeatureIndex&&(St={unwrappedTileID:de,dynamicFilter:We,dynamicFilterNeedsFeature:bt}),this.retainedQueryData[D.bucketInstanceId]=new vv(D.bucketInstanceId,B,D.sourceLayerIndex,D.index,w.tileID);const[Dt,Lt]=D.layers[0].layout.get("text-size-scale-range"),Ht=i.aA(O,Dt,Lt),[Wt,sr]=H.get("icon-size-scale-range"),_r=i.aA(O,Wt,sr),$t={bucket:D,layout:H,paint:Y,posMatrix:we,invMatrix:it,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:xt,labelToScreenMatrix:ct,clippingData:St,scale:ce,textPixelRatio:le,holdingForFade:w.holdingForFade(),collisionBoxArray:Q,partiallyEvaluatedTextSize:i.bK(D.textSizeData,this.transform.zoom,Ht),partiallyEvaluatedIconSize:i.bK(D.iconSizeData,this.transform.zoom,_r),collisionGroup:this.collisionGroups.get(D.sourceID),latestFeatureIndex:w.latestFeatureIndex};if(M)for(const Tt of D.sortKeyRanges){const{sortKey:Jt,symbolInstanceStart:Vt,symbolInstanceEnd:dr}=Tt;d.push({sortKey:Jt,symbolInstanceStart:Vt,symbolInstanceEnd:dr,parameters:$t})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:D.symbolInstances.length,parameters:$t})}attemptAnchorPlacement(d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe,Ve,Xe,We,bt){const{textOffset0:ut,textOffset1:xt,crossTileID:ct}=ve,it=[ut,xt],St=vc(d,D,B,it,H),Dt=this.collisionIndex.placeCollisionBox(Pe,H,m,w,M,O,Eo(St.x,St.y,Y,Q,this.transform.angle),we,ce,le,de.predicate);if(Xe){const Lt=Pe.getSymbolInstanceIconSize(bt,this.transform.zoom,ve.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Pe,Lt,Xe,w,M,O,Eo(St.x,St.y,Y,Q,this.transform.angle),we,ce,le,de.predicate).box.length===0)return}if(Dt.box.length>0){let Lt;return this.prevPlacement&&this.prevPlacement.variableOffsets[ct]&&this.prevPlacement.placements[ct]&&this.prevPlacement.placements[ct].text&&(Lt=this.prevPlacement.variableOffsets[ct].anchor),this.variableOffsets[ct]={textOffset:it,width:D,height:B,anchor:d,textScale:H,prevAnchor:Lt},this.markUsedJustification(Pe,d,ve,Ve),Pe.allowVerticalPlacement&&(this.markUsedOrientation(Pe,Ve,ve),this.placedOrientations[ct]=Ve),{shift:St,placedGlyphBoxes:Dt}}}placeLayerBucketPart(d,m,w,M,O=1){const{bucket:D,layout:B,paint:H,posMatrix:Y,textLabelPlaneMatrix:Q,labelToScreenMatrix:ce,clippingData:le,textPixelRatio:de,mercatorCenter:we,invMatrix:ve,holdingForFade:De,collisionBoxArray:Pe,partiallyEvaluatedTextSize:Ve,partiallyEvaluatedIconSize:Xe,collisionGroup:We,latestFeatureIndex:bt}=d.parameters,ut=B.get("text-optional"),xt=B.get("icon-optional"),ct=B.get("text-allow-overlap"),it=B.get("icon-allow-overlap"),St=B.get("text-rotation-alignment")==="map",Dt=B.get("icon-rotation-alignment")==="map",Lt=B.get("text-pitch-alignment")==="map",Ht=H.get("symbol-z-offset"),Wt=B.get("symbol-elevation-reference")==="sea",sr=B.get("symbol-placement"),[_r,$t]=B.get("text-size-scale-range"),[Tt,Jt]=B.get("icon-size-scale-range"),Vt=i.aA(O,_r,$t),dr=i.aA(O,Tt,Jt),Tr=B.get("text-variable-anchor"),Hr=St&&sr!=="point",Nr=Dt&&sr!=="point",br=Tr&&D.hasTextData(),sn=D.hasIconTextFit()&&br&&D.hasIconData();this.transform.setProjection(D.projection);const Jr=br||Hr,zr=Nr||sn;let Gr=ct&&(it||!D.hasIconData()||xt),kn=it&&(ct||!D.hasTextData()||ut);const Xn=!Ht.isConstant();!D.collisionArrays&&Pe&&D.deserializeCollisionBoxes(Pe),w&&M&&D.updateCollisionDebugBuffers(this.transform.zoom,Pe,Vt,dr);const Rs=(ln,ia,Wn)=>{const{crossTileID:ya,numVerticalGlyphVertices:Ra}=ln;let Ca=null;if(le&&le.dynamicFilterNeedsFeature||Xn){const Gi=this.retainedQueryData[D.bucketInstanceId];Ca=bt.loadFeature({featureIndex:ln.featureIndex,bucketIndex:Gi.bucketIndex,sourceLayerIndex:Gi.sourceLayerIndex,layoutVertexArrayOffset:0});const io=Ca.properties?Ca.properties.worldview:null;if(D.localizable&&D.worldview&&typeof io=="string")if(io==="all")Ca.properties.$localized=!0;else{if(!io.split(",").includes(D.worldview))return;Ca.properties.$localized=!0,Ca.properties.worldview=D.worldview}}if(le&&!(0,le.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:D.worldview},Ca,this.retainedQueryData[D.bucketInstanceId].tileID.canonical,new i.P(ln.tileAnchorX,ln.tileAnchorY),this.transform.calculateDistanceTileData(le.unwrappedTileID)))return this.placements[ya]=new ja(!1,!1,!1,!0),void m.add(ya);const sa=Ht.evaluate(Ca,{});if(m.has(ya))return;if(De)return void(this.placements[ya]=new ja(!1,!1,!1));let is=!1,ga=!1,$i=!0,xi=!1,va=!1,Qs=null,ls={box:null,offscreen:null,occluded:null},ii={box:null},eo=null,Di=null,Ha=null,sd=0,sc=0,Ho=0;Wn.textFeatureIndex?sd=Wn.textFeatureIndex:ln.useRuntimeCollisionCircles&&(sd=ln.featureIndex),Wn.verticalTextFeatureIndex&&(sc=Wn.verticalTextFeatureIndex);const bc=D.elevationFeatures?D.elevationFeatures[ln.elevationFeatureIndex]:void 0,wc=Gi=>{Gi.tileID=this.retainedQueryData[D.bucketInstanceId].tileID;const io=this.transform.elevation;Gi.elevation=Wt?sa:sa+i.bV.getAtTileOffset(Gi.tileID,new i.P(Gi.tileAnchorX,Gi.tileAnchorY),io,bc),Gi.elevation+=ln.zOffset},Ul=Wn.textBox;if(Ul){wc(Ul);const Gi=Wa=>{let bo=i.bL.horizontal;if(D.allowVerticalPlacement&&!Wa&&this.prevPlacement){const Ui=this.prevPlacement.placedOrientations[ya];Ui&&(this.placedOrientations[ya]=Ui,bo=Ui,this.markUsedOrientation(D,bo,ln))}return bo},io=(Wa,bo)=>{if(D.allowVerticalPlacement&&Ra>0&&Wn.verticalTextBox){for(const Ui of D.writingModes)if(Ui===i.bL.vertical?(ls=bo(),ii=ls):ls=Wa(),ls&&ls.box&&ls.box.length)break}else ls=Wa()};if(Tr){let Wa=Tr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ya]){const Ri=this.prevPlacement.variableOffsets[ya];Wa.indexOf(Ri.anchor)>0&&(Wa=Wa.filter(ah=>ah!==Ri.anchor),Wa.unshift(Ri.anchor))}const bo=(Ri,ah,Kv)=>{const Rh=D.getSymbolInstanceTextSize(Ve,ln,this.transform.zoom,ia),Zv=(Ri.x2-Ri.x1)*Rh+2*Ri.padding,Jy=(Ri.y2-Ri.y1)*Rh+2*Ri.padding,Cf=ln.hasIconTextFit&&!it?ah:null;Cf&&wc(Cf);let Ep={box:[],offscreen:!1,occluded:!1};const e0=ct?2*Wa.length:Wa.length;for(let Gm=0;Gm=Wa.length,ln,ia,D,Kv,Cf,Ve,Xe);if(Ip&&(Ep=Ip.placedGlyphBoxes,Ep&&Ep.box&&Ep.box.length)){is=!0,Qs=Ip.shift;break}}return Ep};io(()=>bo(Ul,Wn.iconBox,i.bL.horizontal),()=>{const Ri=Wn.verticalTextBox;return Ri&&wc(Ri),D.allowVerticalPlacement&&!(ls&&ls.box&&ls.box.length)&&Ra>0&&Ri?bo(Ri,Wn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),ls&&(is=ls.box,$i=ls.offscreen,xi=ls.occluded);const Ui=Gi(!(!ls||!ls.box));if(!is&&this.prevPlacement){const Ri=this.prevPlacement.variableOffsets[ya];Ri&&(this.variableOffsets[ya]=Ri,this.markUsedJustification(D,Ri.anchor,ln,Ui))}}else{const Wa=(bo,Ui)=>{const Ri=D.getSymbolInstanceTextSize(Ve,ln,this.transform.zoom,ia),ah=this.collisionIndex.placeCollisionBox(D,Ri,bo,we,ve,Jr,new i.P(0,0),ct,de,Y,We.predicate);return ah&&ah.box&&ah.box.length&&(this.markUsedOrientation(D,Ui,ln),this.placedOrientations[ya]=Ui),ah};io(()=>Wa(Ul,i.bL.horizontal),()=>{const bo=Wn.verticalTextBox;return D.allowVerticalPlacement&&Ra>0&&bo?(wc(bo),Wa(bo,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Gi(!!(ls&&ls.box&&ls.box.length))}}if(eo=ls,is=eo&&eo.box&&eo.box.length>0,$i=eo&&eo.offscreen,xi=eo&&eo.occluded,ln.useRuntimeCollisionCircles){const Gi=ln.centerJustifiedTextSymbolIndex>=0?ln.centerJustifiedTextSymbolIndex:ln.verticalPlacedTextSymbolIndex,io=D.text.placedSymbolArray.get(Gi),Wa=i.bM(D.textSizeData,Ve,io),bo=B.get("text-padding");Di=this.collisionIndex.placeCollisionCircles(D,ct,io,Gi,D.lineVertexArray,D.glyphOffsetArray,Wa,Y,Q,ce,w,Lt,We.predicate,ln.collisionCircleDiameter*Wa/i.bY,bo,this.retainedQueryData[D.bucketInstanceId].tileID),is=ct||Di.circles.length>0&&!Di.collisionDetected,$i=$i&&Di.offscreen,xi=Di.occluded}if(Wn.iconFeatureIndex&&(Ho=Wn.iconFeatureIndex),Wn.iconBox){const Gi=io=>{wc(io);const Wa=ln.hasIconTextFit&&Qs?Eo(Qs.x,Qs.y,St,Lt,this.transform.angle):new i.P(0,0),bo=D.getSymbolInstanceIconSize(Xe,this.transform.zoom,ln.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(D,bo,io,we,ve,zr,Wa,it,de,Y,We.predicate)};ii&&ii.box&&ii.box.length&&Wn.verticalIconBox?(Ha=Gi(Wn.verticalIconBox),ga=Ha.box.length>0):(Ha=Gi(Wn.iconBox),ga=Ha.box.length>0),$i=$i&&Ha.offscreen,va=Ha.occluded}const ku=ut||ln.numHorizontalGlyphVertices===0&&Ra===0,sh=xt||ln.numIconVertices===0;if(ku||sh?sh?ku||(ga=ga&&is):is=ga&&is:ga=is=ga&&is,is&&eo&&eo.box&&this.collisionIndex.insertCollisionBox(eo.box,B.get("text-ignore-placement"),D.bucketInstanceId,ii&&ii.box&&sc?sc:sd,We.ID),ga&&Ha&&this.collisionIndex.insertCollisionBox(Ha.box,B.get("icon-ignore-placement"),D.bucketInstanceId,Ho,We.ID),Di&&(is&&this.collisionIndex.insertCollisionCircles(Di.circles,B.get("text-ignore-placement"),D.bucketInstanceId,sd,We.ID),w)){const Gi=D.bucketInstanceId;let io=this.collisionCircleArrays[Gi];io===void 0&&(io=this.collisionCircleArrays[Gi]=new vk);for(let Wa=0;Wa=0;--ia){const Wn=ln[ia];Rs(D.symbolInstances.get(Wn),Wn,D.collisionArrays[Wn])}D.hasAnyZOffset&&i.w(`${D.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(D.hasAnyZOffset){const ln=D.getSortedIndexesByZOffset();for(let ia=0;ia=0&&(d.text.placedSymbolArray.get(O).crossTileID=ce>=0&&O!==ce?0:Y),D>=0&&(d.text.placedSymbolArray.get(D).crossTileID=ce>=0&&D!==ce?0:Y),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=ce>=0&&B!==ce?0:Y),H>=0&&(d.text.placedSymbolArray.get(H).crossTileID=ce>=0&&H!==ce?0:Y)}markUsedOrientation(d,m,w){const M=m===i.bL.horizontal||m===i.bL.horizontalOnly?m:0,O=m===i.bL.vertical?m:0,{leftJustifiedTextSymbolIndex:D,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:H,verticalPlacedTextSymbolIndex:Y}=w,Q=d.text.placedSymbolArray;D>=0&&(Q.get(D).placedOrientation=M),B>=0&&(Q.get(B).placedOrientation=M),H>=0&&(Q.get(H).placedOrientation=M),Y>=0&&(Q.get(Y).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let w=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const M=m?m.symbolFadeChange(d):1,O=m?m.opacities:{},D=m?m.variableOffsets:{},B=m?m.placedOrientations:{};for(const H in this.placements){const Y=this.placements[H],Q=O[H];Q?(this.opacities[H]=new yf(Q,M,Y.text,Y.icon,null,Y.clipped),w=w||Y.text!==Q.text.placed||Y.icon!==Q.icon.placed):(this.opacities[H]=new yf(null,M,Y.text,Y.icon,Y.skipFade,Y.clipped),w=w||Y.text||Y.icon)}for(const H in O){const Y=O[H];if(!this.opacities[H]){const Q=new yf(Y,M,!1,!1);Q.isHidden()||(this.opacities[H]=Q,w=w||Y.text.placed||Y.icon.placed)}}for(const H in D)this.variableOffsets[H]||!this.opacities[H]||this.opacities[H].isHidden()||(this.variableOffsets[H]=D[H]);for(const H in B)this.placedOrientations[H]||!this.opacities[H]||this.opacities[H].isHidden()||(this.placedOrientations[H]=B[H]);w?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:d)}updateLayerOpacities(d,m,w,M){M&&(this.lastReplacementSourceUpdateTime=M.updateTime);const O=new Set;for(const D of m){const B=D.getBucket(d);B&&D.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,O,D,D.collisionBoxArray,w,M,D.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,D.tileID),B.elevationType==="road"&&B.updateRoadElevation(D.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,m,w,M,O,D,B,H){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 yf(null,0,!1,!1,!0),de=Y.get("text-allow-overlap"),we=Y.get("icon-allow-overlap"),ve=Y.get("text-variable-anchor"),De=Y.get("text-rotation-alignment")==="map",Pe=Y.get("text-pitch-alignment")==="map",Ve=Q.get("symbol-z-offset"),Xe=Y.get("symbol-elevation-reference")==="sea",We=!Ve.isConstant(),bt=new yf(null,0,de&&(we||!d.hasIconData()||Y.get("icon-optional")),we&&(de||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&M&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(M);const ut=(ct,it,St)=>{for(let Dt=0;Dt0||Dt>0,Tr=Ht>0,Hr=this.placedOrientations[Lt],Nr=Hr===i.bL.vertical,br=Hr===i.bL.horizontal||Hr===i.bL.horizontalOnly;!dr&&!Tr||Vt.isHidden()||xt++;let sn=!1;if((dr||Tr)&&D)for(const Jr of d.activeReplacements){if(i.bZ(Jr,O,i.b_.Symbol,H)||Jr.min.x>Wt||Wt>Jr.max.x||Jr.min.y>sr||sr>Jr.max.y)continue;const zr=i.b$(Wt,sr,B.canonical,Jr.footprintTileId.canonical);if(sn=i.c0(zr,Jr.footprint),sn)break}if(dr){const Jr=sn?Kg:ed(Vt.text);ut(d.text,St,Nr?Kg:Jr),ut(d.text,Dt,br?Kg:Jr);const zr=Vt.text.isHidden(),{leftJustifiedTextSymbolIndex:Gr,centerJustifiedTextSymbolIndex:kn,rightJustifiedTextSymbolIndex:Xn,verticalPlacedTextSymbolIndex:Rs}=it,fa=d.text.placedSymbolArray,ln=zr||Nr?1:0;Gr>=0&&(fa.get(Gr).hidden=ln),kn>=0&&(fa.get(kn).hidden=ln),Xn>=0&&(fa.get(Xn).hidden=ln),Rs>=0&&(fa.get(Rs).hidden=zr||br?1:0);const ia=this.variableOffsets[Lt];ia&&this.markUsedJustification(d,ia.anchor,it,Hr);const Wn=this.placedOrientations[Lt];Wn&&(this.markUsedJustification(d,"left",it,Wn),this.markUsedOrientation(d,Wn,it))}if(Tr){const Jr=sn?Kg:ed(Vt.icon),{placedIconSymbolIndex:zr,verticalPlacedIconSymbolIndex:Gr}=it,kn=d.icon.placedSymbolArray,Xn=Vt.icon.isHidden()?1:0;zr>=0&&(ut(d.icon,Ht,Nr?Kg:Jr),kn.get(zr).hidden=Xn),Gr>=0&&(ut(d.icon,it.numVerticalIconVertices,br?Kg:Jr),kn.get(Gr).hidden=Xn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const Jr=d.collisionArrays[ct];if(Jr){let zr=new i.P(0,0),Gr=!0;if(Jr.textBox||Jr.verticalTextBox){if(ve){const Xn=this.variableOffsets[Lt];Xn?(zr=vc(Xn.anchor,Xn.width,Xn.height,Xn.textOffset,Xn.textScale),De&&zr._rotate(Pe?this.transform.angle:-this.transform.angle)):Gr=!1}ce&&(Gr=!Vt.clipped),Jr.textBox&&Im(d.textCollisionBox.collisionVertexArray,Vt.text.placed,!Gr||Nr,Tt,Xe,zr.x,zr.y),Jr.verticalTextBox&&Im(d.textCollisionBox.collisionVertexArray,Vt.text.placed,!Gr||br,Tt,Xe,zr.x,zr.y)}const kn=Gr&&!!(!br&&Jr.verticalIconBox);Jr.iconBox&&Im(d.iconCollisionBox.collisionVertexArray,Vt.icon.placed,kn,Tt,Xe,it.hasIconTextFit?zr.x:0,it.hasIconTextFit?zr.y:0),Jr.verticalIconBox&&Im(d.iconCollisionBox.collisionVertexArray,Vt.icon.placed,!kn,Tt,Xe,it.hasIconTextFit?zr.x:0,it.hasIconTextFit?zr.y:0)}}}if(d.fullyClipped=xt===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 ct=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ct.invProjMatrix,d.placementViewportMatrix=ct.viewportMatrix,d.collisionCircleArray=ct.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 Im(b,d,m,w,M,O,D){b.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),b.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),b.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),b.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0)}const E3=Math.pow(2,25),bv=Math.pow(2,24),_k=Math.pow(2,17),I3=Math.pow(2,16),bk=Math.pow(2,9),Jc=Math.pow(2,8),yp=Math.pow(2,1);function ed(b){if(b.opacity===0&&!b.placed)return 0;if(b.opacity===1&&b.placed)return 4294967295;const d=b.placed?1:0,m=Math.floor(127*b.opacity);return m*E3+d*bv+m*_k+d*I3+m*bk+d*Jc+m*yp+d}const Kg=0;class Ay{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,m,w,M,O,D){const B=this._bucketParts;for(;this._currentTileIndexH.sortKey-Y.sortKey));this._currentPartIndex{const H=i.o.now()-D;return!this._forceFullPlacement&&H>2};for(;this._currentPlacementIndex>=0;){const H=m[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(H.type==="symbol"&&H.visibility!=="none"&&(!H.minzoom||H.minzoom<=Y)&&(!H.maxzoom||H.maxzoom>Y)){const Q=H,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"),we=de==="viewport-y"||de==="auto"&&!(de!=="viewport-y"&&le),ve=Q.layout.get("text-allow-overlap")||Q.layout.get("icon-allow-overlap")||Q.layout.get("text-ignore-placement")||Q.layout.get("icon-ignore-placement"),De=we&&ve,Pe=this._inProgressLayer=this._inProgressLayer||new Ay(Q),Ve=i.B(H.source,H.scope);if(Pe.continuePlacement(ce||De?M[Ve]:w[Ve],this.placement,this._showCollisionBoxes,H,B,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const Qu=512/i.al/2;class vp{constructor(d,m,w){this.tileID=d,this.bucketInstanceId=w,this.index=new i.c4(m.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const M=d.canonical.x*i.al,O=d.canonical.y*i.al;for(let D=0;DDe-Pe);for(const De of ve){const Pe=this.crossTileIDs[De];if(this.keys[De]===Q&&!w.has(Pe)){w.add(Pe),Y.crossTileID=Pe;break}}}}}class sl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class P3{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const m=Math.round((d-this.lng)/360);if(m!==0)for(const w in this.indexes){const M=this.indexes[w],O={};for(const D in M){const B=M[D];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+m),O[B.tileID.key]=B}this.indexes[w]=O}this.lng=d}addBucket(d,m,w){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let O=0;Od.overscaledZ)for(const B in D){const H=D[B];H.tileID.isChildOf(d)&&H.findMatches(m.symbolInstances,d,M)}else{const B=D[d.scaledTo(Number(O)).key];B&&B.findMatches(m.symbolInstances,d,M)}}for(let O=0;O{m[w]=!0});for(const w in this.layerIndexes)m[w]||delete this.layerIndexes[w]}}const vf=771;class as{constructor(d,m,w,M){this.blendFunction=d,this.blendColor=m.toNonPremultipliedRenderColor(null),this.mask=w,this.blendEquation=M}}as.Replace=[1,0,1,0],as.disabled=new as(as.Replace,i.ao.transparent,[!1,!1,!1,!1]),as.unblended=new as(as.Replace,i.ao.transparent,[!0,!0,!0,!0]),as.alphaBlended=new as([1,vf,1,vf],i.ao.transparent,[!0,!0,!0,!0]),as.alphaBlendedNonPremultiplied=new as([770,vf,770,vf],i.ao.transparent,[!0,!0,!0,!0]),as.multiply=new as([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),as.additive=new as([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class dn{constructor(d,m,w){this.func=d,this.mask=m,this.range=w}}dn.ReadOnly=!1,dn.ReadWrite=!0,dn.disabled=new dn(519,dn.ReadOnly,[0,1]);const wk=7680;class $n{constructor(d,m,w,M,O,D){this.test=d,this.ref=m,this.mask=w,this.fail=M,this.depthFail=O,this.pass=D}}$n.disabled=new $n({func:519,mask:0},0,0,wk,wk,wk);const Ey=1029,jk=2305;class zn{constructor(d,m,w){this.enable=d,this.mode=m,this.frontFace=w}}function _f(b,d){const m=i.ca(b,3);i.cc(b,d),i.cg(b,3,m)}function L3(b,d){const m=i.c7([]);return i.c8(m,m,-d),i.c9(m,m,-b),m}function kk(b,d){const m=[b[0],b[1],0],w=[d[0],d[1],0];if(i.ag(m)>=1e-15){const D=i.aw([],m);i.c5(w,D,i.bJ(w,D)),d[0]=w[0],d[1]=w[1]}const M=i.bI([],d,b);if(i.c6(M)<1e-15)return null;const O=Math.atan2(-M[1],M[0]);return L3(Math.atan2(Math.sqrt(b[0]*b[0]+b[1]*b[1]),-b[2]),O)}zn.disabled=new zn(!1,Ey,jk),zn.backCCW=new zn(!0,Ey,jk),zn.backCW=new zn(!0,Ey,2304),zn.frontCW=new zn(!0,1028,2304),zn.frontCCW=new zn(!0,1028,jk);class td{constructor(d,m){this.position=d,this.orientation=m}get position(){return this._position}set position(d){if(d){const m=d instanceof i.ae?d:new i.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(m.x=i.bT(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(d,m,w){if(this.orientation=null,!this.position)return;const M=this.position,O=w||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(d)):0),D=i.ae.fromLngLat(d,O),B=[D.x-M.x,D.y-M.y,D.z-M.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=kk(B,m)}setPitchBearing(d,m){this.orientation=L3(i.an(d),i.an(-m))}}class Nk{constructor(d,m){this._transform=i.bA([]),this.orientation=m,this.position=d}get mercatorPosition(){const d=this.position;return new i.ae(d[0],d[1],d[2])}get position(){const d=i.ca(this._transform,3);return[d[0],d[1],d[2]]}set position(d){var m;d&&i.cg(this._transform,3,[(m=d)[0],m[1],m[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||i.c7([]),d&&_f(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),m=this.right();return{bearing:Math.atan2(-m[1],m[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,m){this._orientation=L3(d,m),_f(this._transform,this._orientation)}forward(){const d=i.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=i.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=i.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,m){const w=new Float64Array(16);return i.bl(w,this.getWorldToCamera(d,m)),w}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,m,w){const M=this.position;i.c5(M,M,-d);const O=new Float64Array(16);return i.bq(O,[w,w,w]),i.br(O,O,M),O[10]*=m,O}getWorldToCamera(d,m){const w=new Float64Array(16),M=new Float64Array(4),O=this.position;return i.cb(M,this._orientation),i.c5(O,O,-d),i.cc(w,M),i.br(w,w,O),w[1]*=-1,w[5]*=-1,w[9]*=-1,w[13]*=-1,w[8]*=m,w[9]*=m,w[10]*=m,w[11]*=m,w}getCameraToClipPerspective(d,m,w,M){const O=new Float64Array(16);return i.cd(O,d,m,w,M),O}getCameraToClipOrthographic(d,m,w,M,O,D){const B=new Float64Array(16);return i.ce(B,d,m,w,M,O,D),B}getDistanceToElevation(d,m=!1){const w=d===0?0:i.cf(d,m?i.a$(this.position[1]):this.position[1]),M=this.forward();return(w-this.position[2])/M[2]}clone(){return new Nk([...this.position],[...this.orientation])}}const Ml={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Sk{constructor(d=0,m=0,w=0,M=0){if(isNaN(d)||d<0||isNaN(m)||m<0||isNaN(w)||w<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=m,this.left=w,this.right=M}interpolate(d,m,w){return m.top!=null&&d.top!=null&&(this.top=i.ak(d.top,m.top,w)),m.bottom!=null&&d.bottom!=null&&(this.bottom=i.ak(d.bottom,m.bottom,w)),m.left!=null&&d.left!=null&&(this.left=i.ak(d.left,m.left,w)),m.right!=null&&d.right!=null&&(this.right=i.ak(d.right,m.right,w)),this}getCenter(d,m){const w=i.aA((this.left+d-this.right)/2,0,d),M=i.aA((this.top+m-this.bottom)/2,0,m);return new i.P(w,M)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new Sk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Ph=15;class O3{constructor(d,m,w,M,O,D,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=m||22,this._minPitch=w??0,this._maxPitch=M??60,this.setProjection(D),this.setMaxBounds(B),this.width=0,this.height=0,this._center=new i.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 Sk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Nk,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 O3(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.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!m||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const w=this._elevation;m||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&w.exaggeration()&&this._centerAltitudeValidForExaggeration!==w.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*w.exaggeration(),this._centerAltitudeValidForExaggeration=w.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=w.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,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],w=this.horizonLineFromTop();let M=0,O=0;for(let D=0;D{const De=i.cY(le,ce,de,we,ve);H.has(De)||(O.push(new i.aQ(ce,le,de,we,ve)),H.add(De))};for(let ce=0;cele.canonical.z)continue;const de=le.canonical,we=le.overscaledZ,ve=le.wrap,De=1<0,Xe=de.y+10,bt=le.wrap-(Ve?0:1),ut=le.wrap+(Pe?0:1),xt=Ve?de.x-1:De-1,ct=Pe?de.x+1:0;if(D)w[0]<0?(Y(we,ut,de.z,ct,de.y),w[1]<0&&Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,ut,de.z,ct,de.y+1)),w[1]>0&&We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,ut,de.z,ct,de.y-1))):w[0]>0?(Y(we,bt,de.z,xt,de.y),w[1]<0&&Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,bt,de.z,xt,de.y+1)),w[1]>0&&We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,bt,de.z,xt,de.y-1))):w[1]<0&&Xe?Y(we,ve,de.z,de.x,de.y+1):We&&Y(we,ve,de.z,de.x,de.y-1);else{const it=le.visibleQuadrants;1&it&&(Y(we,bt,de.z,xt,de.y),We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,bt,de.z,xt,de.y-1))),2&it&&(Y(we,ut,de.z,ct,de.y),We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,ut,de.z,ct,de.y-1))),4&it&&(Y(we,bt,de.z,xt,de.y),Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,bt,de.z,xt,de.y+1))),8&it&&(Y(we,ut,de.z,ct,de.y),Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,ut,de.z,ct,de.y+1)))}}const Q=[];for(const ce of O)O.some(le=>ce.isChildOf(le))||Q.push(ce);if(O=Q.filter(ce=>!d.some(le=>!!(ce.overscaledZ{const Pe=De.canonical.x+.5-de[0],Ve=De.canonical.y+.5-de[1];return Pe*Pe+Ve*Ve{const xt=i.cY(Xe,Ve,We,bt,ut);O.has(xt)||(M.push(new i.aQ(Ve,Xe,We,bt,ut)),O.add(xt))},B=d.reduce((Ve,Xe)=>Math.max(Ve,Xe.overscaledZ),w),H=1<{const We=Math.floor(Ve[0]),bt=Math.floor(Ve[1]),ut=(Ve[0]-We)*i.al,xt=(Ve[1]-bt)*i.al,ct=Math.floor(Xe[0]),it=Math.floor(Xe[1]),St=(Xe[0]-ct)*i.al,Dt=(Xe[1]-it)*i.al;for(let Lt=-1;Lt<=1;Lt++){const Ht=We+Lt;if(!(Ht<0||Ht>=H)){Q.x=ut-Lt*i.al,ce.x=St-(Ht-ct)*i.al;for(let Wt=-1;Wt<=1;Wt++){const sr=bt+Wt;Q.y=xt-Wt*i.al,ce.y=Dt-(sr-it)*i.al,i.cZ(Q,ce,Y)&&D(B,0,w,Ht,sr)}}}},de=m.points,we=de[i.cv],ve=de[i.cw],De=this._projectToGround(we,de[i.cx]),Pe=this._projectToGround(ve,de[i.cy]);return le(we,De),le(ve,Pe),M}_projectToGround(d,m){return i.cz(i.cA(),d,m,d[2]/(d[2]-m[2]))}coveringTiles(d){let m=this.coveringZoomLevel(d);const w=m,M=this.elevation&&this.elevation.exaggeration(),O=M&&!d.isTerrainDEM,D=this.projection.name==="mercator";if(d.minzoom!==void 0&&md.maxzoom&&(m=d.maxzoom);const B=this.locationCoordinate(this.center),H=this.center.lat,Y=1<{const Vt=new i.ae(Tt.x+25e-6,Tt.y,Tt.z),dr=new i.ae(Tt.x,Tt.y+25e-6,Tt.z),Tr=Tt.toLngLat(),Hr=Vt.toLngLat(),Nr=dr.toLngLat(),br=this.locationCoordinate(Tr),sn=this.locationCoordinate(Hr),Jr=this.locationCoordinate(Nr),zr=Math.hypot(sn.x-br.x,sn.y-br.y),Gr=Math.hypot(Jr.x-br.x,Jr.y-br.y);return Math.sqrt(zr*Gr)*xt/25e-6},it=Tt=>{const Jt=bt,Vt=ut;return{aabb:i.cF(this,Y,0,0,0,Tt,Vt,Jt,this.projection),zoom:0,x:0,y:0,minZ:Vt,maxZ:Jt,wrap:Tt,fullyVisible:!1}},St=[];let Dt=[];const Lt=m,Ht=d.reparseOverscaled?w:m,Wt=(De-this._centerAltitude)*ve,sr=Tt=>{if(!this._elevation||!Tt.tileID||!D)return;const Jt=this._elevation.getMinMaxForTile(Tt.tileID),Vt=Tt.aabb;Jt?(Vt.min[2]=Jt.min,Vt.max[2]=Jt.max,Vt.center[2]=(Vt.min[2]+Vt.max[2])/2):(Tt.shouldSplit=$t(Tt),Tt.shouldSplit||(Vt.min[2]=Vt.max[2]=Vt.center[2]=this._centerAltitude))},_r=(Tt,Jt)=>{if(.707*Jt{if(Tt.zoom=.9)return!0}else if(O&&(dr=Tt.aabb.distanceZ(Pe)*ve),this.projection.isReprojectedInTileSpace&&w<=5){const Gr=Math.pow(2,Tt.zoom),kn=ct(new i.ae((Tt.x+.5)/Gr,(Tt.y+.5)/Gr));Tr=kn>.85?1:kn}if(!D&&!ce){const Gr=Math.sqrt(Jt*Jt+Vt*Vt+dr*dr);let kn=(1<0;){const Tt=St.pop(),Jt=Tt.x,Vt=Tt.y;let dr=Tt.fullyVisible;const Tr=()=>this.projection.name==="globe"&&(Tt.y===0||Tt.y===(1<>1),sn={aabb:D?Tt.aabb.quadrant(Hr):i.cF(this,Y,Tt.zoom+1,Nr,br,Tt.wrap,Tt.minZ,Tt.maxZ,this.projection),zoom:Tt.zoom+1,x:Nr,y:br,wrap:Tt.wrap,fullyVisible:dr,tileID:void 0,shouldSplit:void 0,minZ:Tt.minZ,maxZ:Tt.maxZ};O&&!ce&&(sn.tileID=new i.aQ(Tt.zoom+1===Lt?Ht:Tt.zoom+1,Tt.wrap,Tt.zoom+1,Nr,br),sr(sn)),St.push(sn)}else{const Hr=Tt.zoom===Lt?Ht:Tt.zoom;if(d.minzoom&&d.minzoom>Hr)continue;let Nr=0;if(!dr){let zr=Ve?Tt.aabb.intersectsPrecise(de):Tt.aabb.intersectsPreciseFlat(de);if(zr===0&&Tr()){const Gr=new i.cD(Tt.zoom,Jt,Vt);zr=i.cE(this,Y,Gr,!0).intersectsPrecise(de)}if(zr===0)continue;if(d.calculateQuadrantVisibility)if(de.containsPoint(Tt.aabb.center))Nr=15;else for(let Gr=0;Gr<4;Gr++)Tt.aabb.quadrant(Gr).intersects(de)!==0&&(Nr|=1<{const dr=[0,0,0,1],Tr=[i.al,i.al,0,1],Hr=this.calculateFogTileMatrix(Vt.tileID.toUnwrapped());i.aC(dr,dr,Hr),i.aC(Tr,Tr,Hr);const Nr=i.cG([],dr,Tr),br=i.cH([],dr,Tr),sn=i.c$(Nr,br);if(sn===0)return!0;let Jr=!1;const zr=this._elevation;if(zr&&sn>Tt&&Jt!==0){const Gr=this.calculateProjMatrix(Vt.tileID.toUnwrapped());let kn;d.isTerrainDEM||(kn=zr.getMinMaxForTile(Vt.tileID)),kn||(kn={min:ut,max:bt});const Xn=i.cI(this.rotation),Rs=[Xn[0]*i.al,Xn[1]*i.al,kn.max];i.af(Rs,Rs,Gr),Jr=(1-Rs[1])*this.height*.5Tt.distanceSq-Jt.distanceSq).map(Tt=>Tt.tileID)}resize(d,m){this.width=d,this.height=m,this.pixelsToGLUnits=[2/d,-2/m],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 m=i.aA(d.lat,-i.cJ,i.cJ),w=this.projection.project(d.lng,m);return new i.P(w.x*this.worldSize,w.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/i.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,m){let w,M;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;w=(m.x-O.x)/B,M=(m.y-O.y)/B}else{const B=this.pointCoordinate(m),H=this.pointCoordinate(O);w=B.x-H.x,M=B.y-H.y}const D=this.locationCoordinate(d);this.setLocation(new i.ae(D.x-w,D.y-M))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,m){return this.projection.locationPoint(this,d,m)}locationPoint3D(d,m){return this.projection.locationPoint(this,d,m,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,m){return this.coordinateLocation(this.pointCoordinate3D(d,m))}locationCoordinate(d,m){const w=m?i.cf(m,d.lat):void 0,M=this.projection.project(d.lng,d.lat);return new i.ae(M.x,M.y,w)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,m){const w=m??this._centerAltitude,M=[d.x,d.y,0,1],O=[d.x,d.y,1,1];i.aC(M,M,this.pixelMatrixInverse),i.aC(O,O,this.pixelMatrixInverse);const D=O[3];i.cK(M,M,1/M[3]),i.cK(O,O,1/D);const B=M[2],H=O[2];return{p0:M,p1:O,t:B===H?0:(w-B)/(H-B)}}screenPointToMercatorRay(d){const m=[d.x,d.y,0,1],w=[d.x,d.y,1,1];return i.aC(m,m,this.pixelMatrixInverse),i.aC(w,w,this.pixelMatrixInverse),i.cK(m,m,1/m[3]),i.cK(w,w,1/w[3]),m[2]=i.cf(m[2],this._center.lat)*this.worldSize,w[2]=i.cf(w[2],this._center.lat)*this.worldSize,i.cK(m,m,1/this.worldSize),i.cK(w,w,1/this.worldSize),new i.ax([m[0],m[1],m[2]],i.aw([],i.av([],w,m)))}rayIntersectionCoordinate(d){const{p0:m,p1:w,t:M}=d,O=i.cf(m[2],this._center.lat),D=i.cf(w[2],this._center.lat);return new i.ae(i.ak(m[0],w[0],M)/this.worldSize,i.ak(m[1],w[1],M)/this.worldSize,i.ak(O,D,M))}pointCoordinate(d,m=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,m)}pointCoordinate3D(d,m){if(!this.elevation)return this.pointCoordinate(d,m);let w=this.projection.pointCoordinate3D(this,d.x,d.y);if(w)return new i.ae(w[0],w[1],w[2]);let M=0,O=this.horizonLineFromTop();if(d.y>O)return this.pointCoordinate(d,m);const D=.02*O,B=d.clone();for(let H=0;H<10&&O-M>D;H++){B.y=i.ak(M,O,.66);const Y=this.projection.pointCoordinate3D(this,B.x,B.y);Y?(O=B.y,w=Y):M=B.y}return w?new i.ae(w[0],w[1],w[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>=i.cL)return!this.isPointAboveHorizon(d);const m=this.pointCoordinate(d);return m.y>=0&&m.y<=1}_coordinatePoint(d,m){const w=m&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,M=[d.x*this.worldSize,d.y*this.worldSize,w+d.toAltitude(),1];return i.aC(M,M,this.pixelMatrix),M[3]>0?new i.P(M[0]/M[3],M[1]/M[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:m}=this._edgeInsets,w=this.height-this._edgeInsets.bottom,M=this.width-this._edgeInsets.right,O=this.pointLocation3D(new i.P(m,d)),D=this.pointLocation3D(new i.P(M,d)),B=this.pointLocation3D(new i.P(M,w)),H=this.pointLocation3D(new i.P(m,w));let Y=Math.min(O.lng,D.lng,B.lng,H.lng),Q=Math.max(O.lng,D.lng,B.lng,H.lng),ce=Math.min(O.lat,D.lat,B.lat,H.lat),le=Math.max(O.lat,D.lat,B.lat,H.lat);const de=Math.pow(2,-this.zoom)/16*270,we=this.projection.name==="globe"?1:4,ve=(De,Pe,Ve,Xe,We)=>{const bt=(De+Ve)/2,ut=(Pe+Xe)/2,xt=new i.P(bt,ut),{lng:ct,lat:it}=this.pointLocation3D(xt),St=Math.max(0,Y-ct,ce-it,ct-Q,it-le);Y=Math.min(Y,ct),Q=Math.max(Q,ct),ce=Math.min(ce,it),le=Math.max(le,it),(Wede)&&(ve(De,Pe,bt,ut,We+1),ve(bt,ut,Ve,Xe,We+1))};if(ve(m,d,M,d,1),ve(M,d,M,w,1),ve(M,w,m,w,1),ve(m,w,m,d,1),this.projection.name==="globe"){const[De,Pe]=i.cM(this);De?(le=90,Q=180,Y=-180):Pe&&(ce=-90,Q=180,Y=-180)}return new i.aI(new i.aT(Y,ce),new i.aT(Q,le))}_getBoundsRectangular(d,m){const{top:w,left:M}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,D=this.width-this._edgeInsets.right,B=new i.P(M,w),H=new i.P(D,w),Y=new i.P(D,O),Q=new i.P(M,O);let ce=this.pointCoordinate(B,d),le=this.pointCoordinate(H,d);const de=this.pointCoordinate(Y,m),we=this.pointCoordinate(Q,m),ve=(De,Pe)=>(Pe.y-De.y)/(Pe.x-De.x);return ce.y>1&&le.y>=0?ce=new i.ae((1-we.y)/ve(we,ce)+we.x,1):ce.y<0&&le.y<=1&&(ce=new i.ae(-we.y/ve(we,ce)+we.x,0)),le.y>1&&ce.y>=0?le=new i.ae((1-de.y)/ve(de,le)+de.x,1):le.y<0&&ce.y<=1&&(le=new i.ae(-de.y/ve(de,le)+de.x,0)),new i.aI().extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(le)).extend(this.coordinateLocation(we)).extend(this.coordinateLocation(de))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const m=d.visibleDemTiles.reduce((w,M)=>{if(M.dem){const O=M.dem.tree;w.min=Math.min(w.min,O.minimums[0]),w.max=Math.max(w.max,O.maximums[0])}return w},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(m.min*d.exaggeration(),m.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 m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,w=this.height/2-m*(1-this._horizonShift);return d?Math.max(0,w):w}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-i.cJ,this.maxLat=i.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&&(B=ce-Y),ce-Qde&&(D=de-H),de-le{for(let $t=0;$t<16;$t++)Ht[$t]=i.ak(Wt[$t],sr[$t],_r)})(B,B,H,i.d0(this.pitch>=Ph?1:this.pitch/Ph))}else B=H;const Y=i.cP([],H,D);let Q=i.cP([],B,D);if(this.projection.isReprojectedInTileSpace){const it=this.locationCoordinate(this.center),St=i.bA([]);i.br(St,St,[it.x*this.worldSize,it.y*this.worldSize,0]),i.aB(St,St,i.cQ(this)),i.br(St,St,[-it.x*this.worldSize,-it.y*this.worldSize,0]),i.aB(Q,Q,St),i.aB(Y,Y,St),this.inverseAdjustmentMatrix=i.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cS([],Q,[this.worldSize,this.worldSize,this.worldSize/O,1]),this.projMatrix=Q,this.invProjMatrix=i.bl(new Float64Array(16),this.projMatrix),m){const it=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);it[8]=2*-d.x/this.width,it[9]=2*d.y/this.height,this.expandedFarZProjMatrix=i.cP([],it,D)}else this.expandedFarZProjMatrix=this.projMatrix;const ce=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(ce,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!m);const le=new Float32Array(16);i.bA(le),i.cS(le,le,[1,-1,1]),i.cU(le,le,this._pitch),i.bB(le,le,this.angle);const de=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(de);const we=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;de[8]=2*-d.x/this.width,de[9]=2*(d.y+we)/this.height,this.skyboxMatrix=i.aB(le,de,le);const ve=this.point,De=ve.x,Pe=ve.y,Ve=this.width%2/2,Xe=this.height%2/2,We=Math.cos(this.angle),bt=Math.sin(this.angle),ut=De-Math.round(De)+We*Ve+bt*Xe,xt=Pe-Math.round(Pe)+We*Xe+bt*Ve,ct=new Float64Array(Q);if(i.br(ct,ct,[ut>.5?ut-1:ut,xt>.5?xt-1:xt,0]),this.alignedProjMatrix=ct,Q=i.bC(),i.cS(Q,Q,[this.width/2,-this.height/2,1]),i.br(Q,Q,[1,-1,0]),this.labelPlaneMatrix=Q,Q=i.bC(),i.cS(Q,Q,[1,-1,1]),i.br(Q,Q,[-1,-1,0]),i.cS(Q,Q,[2/this.width,2/this.height,1]),this.glCoordMatrix=Q,this.pixelMatrix=i.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},Q=i.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=i.cV(this);const it=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.af(it,it,D),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,m=this.cameraPixelsPerMeter,w=this._camera.position,M=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,m];i.c5(O,O,M),i.c5(w,w,-1),i.cW(w,w,O);const D=i.bC();i.br(D,D,w),i.cS(D,D,O),this.mercatorFogMatrix=D,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,m,M)}_computeCameraPosition(d){const m=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,w=this._camera.forward(),M=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-d/this.worldSize*this._centerAltitude;return[M.x/this.worldSize-w[0]*O,M.y/this.worldSize-w[1]*O,d/this.worldSize*this._centerAltitude-w[2]*O]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),w=this._camera.position[2],M=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),M>0&&(O=Math.min((m-w)/M,1)),this._camera.position=i.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,m=this._camera.forward(),{pitch:w,bearing:M}=this._camera.getPitchBearing(),O=i.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,D=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.an(this._maxPitch)),B=Math.max((d[2]-O)/Math.cos(w),D),H=this._zoomFromMercatorZ(B);i.bH(d,d,m,B),this._pitch=i.aA(w,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(M,-Math.PI,Math.PI),this._setZoom(i.aA(H,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.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 m=0,w=i.cL,M=0,O=1/0;for(;w-m>1e-6&&w>m;){const D=m+.5*(w-m),B=this.tileSize*Math.pow(2,D),H=this.getCameraToCenterDistance(this.projection,D,B),Y=this.scaleZoom(H/(Math.max(0,d)*this.tileSize)),Q=Math.abs(D-Y);QY||le.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.P(0,0),new i.P(this.width,this.height))}zoomDeltaToMovement(d,m){const w=i.ag(i.av([],this._camera.position,d)),M=this._zoomFromMercatorZ(w)+m;return w-this._mercatorZfromZoom(M)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([m,w,M],O){const D=[m,w,M,1];i.aC(D,D,O);const B=D[3]=Math.max(D[3],1e-6);return D[0]/=B,D[1]/=B,D[2]/=B,D}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,d))}}getCameraToCenterDistance(d,m=this.zoom,w=this.worldSize){const M=i.cO(d,m,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,w,M);let D=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(D=i.ak(1,D,i.d0(this.pitch>=Ph?1:this.pitch/Ph))),D}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&i.aB(d,d,this.globeMatrix),d}getFrustum(d){return i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const Pm=(b,d)=>{if(d>0&&b.terrain&&i.w("Cutoff is currently disabled on terrain"),d<=0||b.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=b.transform,w=Math.max(Math.abs(m._zoom-(b.minCutoffZoom-1)),1),M=m.isLODDisabled(!1)?i.ah(60,45,m.pitch):i.ah(30,15,m.pitch),O=m._farZ-m._nearZ,D=d*m.height,B=((1-(H=M))*m.cameraToCenterDistance+H*(m._farZ+D))*w;var H;return{shouldRenderCutoff:M<1,uniformValues:{u_cutoff_params:[m._nearZ,m._farZ,(B-m._nearZ)/O,(B-D-m._nearZ)/O]}}},Ju=2048;class wv{constructor(d,m){this.aabb=d,this.lastCascade=m}}class Uae{add(d,m){const w=this.receivers[d.key];w!==void 0?(w.aabb.min[0]=Math.min(w.aabb.min[0],m.min[0]),w.aabb.min[1]=Math.min(w.aabb.min[1],m.min[1]),w.aabb.min[2]=Math.min(w.aabb.min[2],m.min[2]),w.aabb.max[0]=Math.max(w.aabb.max[0],m.max[0]),w.aabb.max[1]=Math.max(w.aabb.max[1],m.max[1]),w.aabb.max[2]=Math.max(w.aabb.max[2],m.max[2])):this.receivers[d.key]=new wv(m,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,m,w){const M=i.d9.fromPoints(d.points);let O=0;for(const D in this.receivers){const B=this.receivers[D];if(!B||!M.intersectsAabb(B.aabb))continue;B.aabb.min=M.closestPoint(B.aabb.min),B.aabb.max=M.closestPoint(B.aabb.max);const H=B.aabb.getCorners();for(let Y=0;Y1||le[1]<-1||le[1]>1){Q=!1;break}}if(B.lastCascade=Y,O=Math.max(O,Y),Q)break}}return O+1}}class Iy{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Uae,this._depthMode=new dn(d.context.gl.LEQUAL,dn.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,m){const w=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!m||!m.properties)return;const M=m.properties.get("shadow-intensity");if(!m.shadowsEnabled()||M<=0||(this._shadowLayerCount=w.style.order.reduce((we,ve)=>{const De=w.style._mergedLayers[ve];return we+(De.hasShadowPass()&&!De.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=w.context,D=Ju,B=Ju;if(this._cascades.length===0||Ju!==this._cascades[0].texture.size[0]){this._cascades=[];for(let we=0;we<2;++we){const ve=w._shadowMapDebug,De=O.gl,Pe=O.createFramebuffer(D,B,ve?1:0,"texture"),Ve=new i.T(O,{width:D,height:B,data:null},De.DEPTH_COMPONENT16);if(Pe.depthAttachment.set(Ve.texture),ve){const Xe=new i.T(O,{width:D,height:B,data:null},De.RGBA8);Pe.colorAttachment0.set(Xe.texture)}this._cascades.push({framebuffer:Pe,texture:Ve,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=kv(m);let H=0;if(d.elevation){const we=d.elevation,ve=[1e4,-1e4];we.visibleDemTiles.filter(De=>De.dem).forEach(De=>{const Pe=De.dem.tree;ve[0]=Math.min(ve[0],Pe.minimums[0]),ve[1]=Math.max(ve[1],Pe.maximums[0])}),ve[0]!==1e4&&(H=(ve[1]-ve[0])*we.exaggeration())}const Y=1.5*d.cameraToCenterDistance,Q=3*Y,ce=new Float64Array(16);for(let we=0;we=0)return{};const O=function(H,Y,Q){const ce=Q/(1<0&&(i.d8(O[1],O[1],[M[0]*D,0,0]),i.d8(O[2],O[2],[M[0]*D,0,0])),M[1]<0?(i.d8(O[0],O[0],[0,M[1]*D,0]),i.d8(O[1],O[1],[0,M[1]*D,0])):M[1]>0&&(i.d8(O[2],O[2],[0,M[1]*D,0]),i.d8(O[3],O[3],[0,M[1]*D,0]));const B={};return B.vertices=O,B.planes=[jv(O[1],O[0],O[4]),jv(O[2],O[1],O[5]),jv(O[3],O[2],O[6]),jv(O[0],O[3],O[7])],B}addShadowReceiver(d,m,w){this._receivers.add(d,i.d9.fromTileIdAndHeight(d,m,w))}getMaxCascadeForTile(d){const m=this._receivers.get(d);return m&&m.lastCascade?m.lastCascade:0}}function jv(b,d,m){const w=i.av([],m,d),M=i.av([],b,d),O=i.bI([],w,M),D=i.ag(O);return D===0?[0,0,1,0]:(i.c5(O,O,1/D),[O[0],O[1],O[2],-i.bJ(O,d)])}function kv(b){const d=b.properties.get("direction"),m=i.d4(d.x,d.y,d.z);m[2]=i.aA(m[2],0,75);const w=i.d6([m[0],m[1],m[2]]);return i.d5(w.x,w.y,w.z)}function _p(b,d,m){const w=d.properties.get("color-use-theme")==="none",M=d.properties.get("color"),O=d.properties.get("intensity"),D=d.properties.get("direction"),B=[D.x,D.y,D.z],H=m.properties.get("color-use-theme")==="none",Y=m.properties.get("color"),Q=m.properties.get("intensity"),ce=Math.max(i.bJ([0,0,1],B),0),le=[0,0,0];i.c5(le,Y.toPremultipliedRenderColor(H?null:b.getLut(d.scope)).toArray01Linear().slice(0,3),Q);const de=[0,0,0];return i.c5(de,M.toPremultipliedRenderColor(w?null:b.getLut(m.scope)).toArray01Linear().slice(0,3),ce*O),i.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 Lm(b,d,m,w,M,O){const D=b.zoom,B=b.scale,H=b.worldSize,Y=1/H,Q=b.aspect,ce=Math.sqrt(1+Q*Q)*Math.tan(.5*b.fovX),le=ce*ce,de=w-m,we=w+m;let ve,De;le>de/we?(ve=w,De=w*ce):(ve=.5*we*(1+le),De=.5*Math.sqrt(de*de+2*(w*w+m*m)*le+we*we*le*le));const Pe=b.projection.pixelsPerMeter(b.center.lat,H),Ve=b._camera.getCameraToWorldMercator(),Xe=[0,0,-ve*Y];i.af(Xe,Xe,Ve);let We=De*Y;const bt=b._edgeInsets;if(!(bt.left===0&&bt.top===0&&bt.right===0&&bt.bottom===0||bt.left===bt.right&&bt.top===bt.bottom)){const dr=b._camera.getWorldToCamera(b.worldSize,b.projection.zAxisUnit==="meters"?Pe:1),Tr=b._camera.getCameraToClipPerspective(b._fov,b.width/b.height,m,w);Tr[8]=2*-b.centerOffset.x/b.width,Tr[9]=2*b.centerOffset.y/b.height;const Hr=new Float64Array(16);i.cP(Hr,Tr,dr);const Nr=new Float64Array(16);i.bl(Nr,Hr);const br=i.cB.fromInvProjectionMatrix(Nr,H,D,!0);for(const sn of br.points){const Jr=((ut=sn)[0]/=B,ut[1]/=B,ut[2]=i.cf(ut[2],b._center.lat),ut);We=Math.max(We,i.c6(i.da([],Xe,Jr)))}}var ut;We*=M/(M-1);const xt=Math.acos(d[2]),ct=Math.atan2(-d[0],-d[1]),it=new Nk;it.position=Xe,it.setPitchBearing(xt,ct);const St=it.getWorldToCamera(H,Pe),Dt=We*H,Lt=Math.min(b._mercatorZfromZoom(17)*H*-2,-2*Dt),Ht=it.getCameraToClipOrthographic(-Dt,Dt,-Dt,Dt,Lt,(Dt+O*Pe)/d[2]),Wt=new Float64Array(16);i.aB(Wt,Ht,St);const sr=i.d5(Math.floor(1e6*Xe[0])/1e6*H,Math.floor(1e6*Xe[1])/1e6*H,0),_r=.5*M,$t=[0,0,0];i.af($t,sr,Wt),i.c5($t,$t,_r);const Tt=[Math.floor($t[0]),Math.floor($t[1]),Math.floor($t[2])],Jt=[0,0,0];i.av(Jt,$t,Tt),i.c5(Jt,Jt,-1/_r);const Vt=new Float64Array(16);return i.bA(Vt),i.br(Vt,Vt,Jt),i.aB(Wt,Vt,Wt),[Wt,Dt]}class qae extends i.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,m){return i.dc(this.requestManager.transformRequest(m,i.R.Model).url).then(w=>{if(!w)return;const M=i.dd(w),O=new i.de(d,m,void 0,void 0,M);return O.computeBoundsAndApplyParent(),O}).catch(w=>{if(w&&w.status===404)return null;this.fire(new i.y(new Error(`Could not load model ${d} from ${m}: ${w.message}`)))})}load(d,m,w={forceReload:!1}){this.models[m]||(this.models[m]={});const M=Object.keys(d),O=[],D=[];for(const B of M){const H=d[B];this.hasURLBeenRequested(H)&&!w.forceReload||(this.modelByURL[H]={modelId:B,scope:m},O.push(this.loadModel(B,H)),D.push(B)),this.models[m][B]||(this.models[m][B]={model:null,numReferences:1})}this.numModelsLoading[m]=(this.numModelsLoading[m]||0)+D.length,Promise.allSettled(O).then(B=>{for(let H=0;H{this.fire(new i.y(new Error(`Could not load models: ${B.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,m,w={exactIdMatch:!1}){return!!(w.exactIdMatch?this.getModel(d,m):this.getModelByURL(this.modelUris[m][d]))}getModel(d,m){return this.models[m]||(this.models[m]={}),this.models[m][d]?this.models[m][d].model:void 0}getModelByURL(d){if(!d)return null;const m=this.modelByURL[d];return m?this.models[m.scope][m.modelId].model:null}hasModelBeenAdded(d,m){return this.models[m]&&this.models[m][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,m,w){this.models[w]||(this.models[w]={}),this.modelUris[w]||(this.modelUris[w]={});const M=this.requestManager.normalizeModelURL(m);if((this.hasModel(d,w,{exactIdMatch:!0})||this.hasModelBeenAdded(d,w))&&this.modelUris[w][d]===M)this.models[w][d].numReferences++;else if(this.hasURLBeenRequested(M)){const{scope:O,modelId:D}=this.modelByURL[M];this.models[O][D].numReferences++}else this.modelUris[w][d]=M,this.load({[d]:this.modelUris[w][d]},w)}addModelURLs(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const w=this.modelUris[m];for(const M in d)w[M]=this.requestManager.normalizeModelURL(d[M])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const w={};for(const M of d)this.hasModel(M,m,{exactIdMatch:!0})||this.hasURLBeenRequested(M)?this.models[m][M].numReferences++:this.modelUris[m][M]&&!this.hasURLBeenRequested(M)?w[M]=this.modelUris[m][M]:!this.hasURLBeenRequested(M)&&i.df(M,!1)&&(this.modelUris[m][M]=this.requestManager.normalizeModelURL(M),w[M]=this.modelUris[m][M]);this.load(w,m)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,m,w=!1,M=!1){if(this.models[m]&&this.models[m][d]&&(this.models[m][d].numReferences--,this.models[m][d].numReferences===0||M)){const O=this.modelUris[m][d];w||delete this.modelUris[m][d],delete this.modelByURL[O];const D=this.models[m][d].model;if(!D)return;delete this.models[m][d],D.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const m of Object.keys(this.models[d])){const w=this.models[d][m].model;delete this.models[d][m],w&&w.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,m){this.models[m]||(this.models[m]={});for(const w in this.models[m])this.models[m][w].model&&this.models[m][w].model.upload(d.context)}}const D3=i.a6.colorTheme,Vae=new i.a9({data:new i.aa(D3.data)});function ZI(b){if(!b.metadata||!b.metadata.content_area)return;const d=i.o.devicePixelRatio,{left:m,top:w,width:M,height:O}=b.metadata.content_area,D=m*d,B=w*d;return[D,B,D+M*d,B+O*d]}function YI(b){if(b)return b.map(([d,m])=>[d*i.o.devicePixelRatio,m*i.o.devicePixelRatio])}class R3{constructor(d,m,w){this.id=d,this.scope=m,this.sourceCache=w,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 m=this.sourceCache.getVisibleCoordinates();if(m.length===0)return d;const w=this.sourceCache.getSource();if(!(w instanceof nc))return d;const M=m.map(D=>this.sourceCache.getTile(D)),O=w.getImages(M,Array.from(this.pendingRequests));for(const[D,B]of O)d.set(i.I.from({name:D,iconsetId:this.id}),B),this.pendingRequests.delete(D);for(const D of this.pendingRequests)this.missingRequests.add(D);return this.pendingRequests.clear(),d}}const Om=(b,d)=>Ge(b,d&&d.filter(m=>m.identifier!=="source.canvas")),XI=i.aH(Ys,["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"]),QI=i.aH(Ys,["setCenter","setZoom","setBearing","setPitch"]),Ck=new Set(["background","sky","slot","custom"]),Dm={version:8,layers:[],sources:{}},Nv={duration:300,delay:0};class eh extends i.E{constructor(d,m={}){super(),this.map=d,this.scope=m.scope||"",this.globalId=null,this.fragments=[],this.importDepth=m.importDepth||0,this.importsCache=m.importsCache||new Map,this.resolvedImports=m.resolvedImports||new Set,this.transition=Object.assign({},Nv),this._buildingIndex=new T3(this),this.crossTileSymbolIndex=new Ih,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=m.styleChanges||new Me,this._hasDataDrivenEmissive=!1,this.dispatcher=m.dispatcher?m.dispatcher:new i.D(i.dh(),this),m.imageManager?this.imageManager=m.imageManager:(this.imageManager=new qe(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=m.glyphManager?m.glyphManager:new i.di(d._requestManager,m.localFontFamily?i.dj.all:m.localIdeographFontFamily?i.dj.ideographs:i.dj.none,m.localFontFamily||m.localIdeographFontFamily),m.modelManager?this.modelManager=m.modelManager:(this.modelManager=new qae(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=m.configOptions?m.configOptions:new Map,this._configDependentLayers=m.configDependentLayers?m.configDependentLayers:new Set,this._indoorDependentLayers=m.indoorDependentLayers?m.indoorDependentLayers:new Set,this._config=m.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:m.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=m.initialConfig,this.dispatcher.broadcast("setReferrer",i.dk());const w=this;this._rtlTextPluginCallback=eh.registerForPluginStateChange(M=>{w.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:M.pluginStatus,pluginURL:M.pluginURL},(O,D)=>{if(i.dl(O),D&&D.every(B=>B))for(const B in w._sourceCaches){const H=w._sourceCaches[B],Y=H.getSource().type;Y!=="vector"&&Y!=="geojson"||H.reload()}})}),this.on("data",M=>{if(M.dataType!=="source"||M.sourceDataType!=="metadata")return;const O=this.getOwnSource(M.sourceId);if(O&&O.vectorLayerIds)for(const D in this._layers){const B=this._layers[D];B.source===O.id&&this._validateLayer(B)}})}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(i.h(d))return d;const m=i.dm(d);if(!m.startsWith("http"))try{return new URL(m,location.href).toString()}catch{return m}return m}return`json://${i.dn(JSON.stringify(d))}`}_diffStyle(d,m,w){this.globalId=this._getGlobalId(d);const M=(O,D)=>{try{D(null,this.setState(O,w))}catch(B){D(B,!1)}};if(typeof d=="string"){const O=this.map._requestManager.normalizeStyleURL(d),D=this.map._requestManager.transformRequest(O,i.R.Style);i.m(D,(B,H)=>{B?this.fire(new i.y(B)):H&&M(H,m)})}else typeof d=="object"&&M(d,m)}loadURL(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"}));const w=typeof m.validate=="boolean"?m.validate:!i.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,m.accessToken),this.resolvedImports.add(d);const M=this.importsCache.get(d);if(M)return this._load(M,w);const O=this.map._requestManager.transformRequest(d,i.R.Style);this._request=i.m(O,(D,B)=>{if(this._request=null,D)this.fire(new i.y(D));else if(B)return this.importsCache.set(d,B),this._load(B,w)})}loadJSON(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=i.o.frame(()=>{this._request=null,this._load(d,m.validate!==!1)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(Dm,!1)}_loadImports(d,m,w){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const M=[];for(const O of d){const D=this._createFragmentStyle(O),B=new Promise(Q=>{D.once("style.import.load",Q),D.once("error",Q)}).then(()=>this.mergeAll());if(M.push(B),this.resolvedImports.has(O.url)){D.loadEmpty();continue}const H=O.data||this.importsCache.get(O.url);H?(D.loadJSON(H,{validate:m}),this._isInternalStyle(H)&&(D.globalId=null)):O.url?D.loadURL(O.url,{validate:m}):D.loadEmpty();const Y={style:D,id:O.id,config:O.config};if(w){const Q=this.fragments.findIndex(({id:ce})=>ce===w);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,m=new Set){for(const w of d.fragments)w.style.globalId&&m.add(w.style.globalId),this.getImportGlobalIds(w.style,m);return[...m.values()]}_createFragmentStyle(d){const m=this.scope?i.B(d.id,this.scope):d.id;let w;const M=this._initialConfig&&this._initialConfig[m];(d.config||M)&&(w=Object.assign({},d.config,M));const O=new eh(this.map,{scope:m,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:w,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return O.setEventedParent(this.map,{style:O}),O}_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,m){if(this._isInternalStyle(d)){const O=Object.assign({},Dm,{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(O,m)}if(this.updateConfig(this._config,d.schema),m&&Om(this,Oa(d)))return;this._loaded=!0,this.stylesheet=i.dp(d);const w=()=>{for(const H in d.sources)this.addSource(H,d.sources[H],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const H in d.iconsets)this.addIconset(H,d.iconsets[H]);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 O=xf(this.stylesheet.layers);if(this._order=O.map(H=>H.id),this.stylesheet.light&&i.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 H=this.stylesheet.lights[0];this.light=new At(H.properties,H.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new At(this.stylesheet.light)),this._layers={};for(const H of O){const Y=i.du(H,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 D=this.stylesheet.terrain;D&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(D,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 i.z("data",{dataType:"style"}));const B=this.isRootStyle();d.imports?this._loadImports(d.imports,m).then(()=>{this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load"))}).catch(H=>{this.fire(new i.y(new Error("Failed to load imports",H))),this.fire(new i.z(B?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new i.z(B?"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 O=this._evaluateColorThemeData(M);this._loadColorTheme(O).then(()=>{w()}).catch(D=>{i.w(`Couldn't load color theme from the stylesheet: ${D}`),w()})}else this._styleColorTheme.lut=null,w()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,m,w,M,O,D,B,H,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&&(m=le.ambientLight),de.type==="directional"&&le.directionalLight!=null&&(w=le.directionalLight);M=this._prioritizeTerrain(M,le.terrain,le.stylesheet.terrain),le.stylesheet.fog&&le.fog!=null&&(O=le.fog),le.stylesheet.snow&&le.snow!=null&&(D=le.snow),le.stylesheet.rain&&le.rain!=null&&(B=le.rain),le.stylesheet.camera!=null&&(Q=le.stylesheet.camera),le.stylesheet.projection!=null&&(H=le.stylesheet.projection),le.stylesheet.transition!=null&&(Y=le.stylesheet.transition),ce[le.scope]=le._styleColorTheme}}),this.light=d,this.ambientLight=m,this.directionalLight=w,this.fog=O,this.snow=D,this.rain=B,this._styleColorThemeForScope=ce,M===null?delete this.terrain:this.terrain=M,this.camera=Q||{"camera-projection":"perspective"},this.projection=H||{name:"mercator"},this.transition=Object.assign({},Nv,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const m=w=>{for(const M of w.fragments)m(M.style);d(w)};m(this)}_prioritizeTerrain(d,m,w){const M=d&&d.drapeRenderMode===0;return w===null?m&&m.drapeRenderMode===0?m:M?d:null:m!=null&&(!d||M||m&&m.drapeRenderMode===1)?m:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(m=>{d=this._prioritizeTerrain(d,m.terrain,m.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(m=>{m.stylesheet.projection!=null&&(d=m.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},m={},w={};this.forEachFragmentStyle(M=>{for(const O in M._sourceCaches){const D=i.B(O,M.scope);d[D]=M._sourceCaches[O]}for(const O in M._otherSourceCaches){const D=i.B(O,M.scope);m[D]=M._otherSourceCaches[O]}for(const O in M._symbolSourceCaches){const D=i.B(O,M.scope);w[D]=M._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=m,this._mergedSymbolSourceCaches=w}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const m of Object.values(d.stylesheet.indoor)){const w=m,M=i.B(w.sourceId,d.scope);this._mergedIndoor[M]=new Set(w.sourceLayers||[])}})}mergeLayers(){const d={},m=[],w={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(D=>{for(const B of D._order){const H=D._layers[B];if(H.type==="slot"){const Y=i.dq(B);if(d[Y])continue;d[Y]=[]}H.slot&&d[H.slot]?d[H.slot].push(H):m.push(H)}}),this._mergedOrder=[];let M=-1;const O=(D=[])=>{for(const B of D)if(B.type==="slot"){const H=i.dq(B.id);d[H]&&O(d[H]),this._mergedSlots.push(H)}else{const H=i.B(B.id,B.scope);this._mergedOrder.push(H),w[H]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,M=this._mergedOrder.length-1),B.type==="circle"&&(this._hasCircleLayers=!0),B.type==="symbol"&&(this._hasSymbolLayers=!0),B.type==="clip"&&(this._clipLayerPresent=!0)}};if(O(m),this._has3DLayers){const D={};for(let B=0;BD[B]-D[H])}this._mergedLayers=w,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(m,w,M,O){const D=Object.assign({},w);for(const H of Object.keys(D3))D[H]===void 0&&(D[H]=D3[H].default);const B=new i.a8(Vae,m,new Map(M));return B.setTransitionOrValue(D,M),B.untransitioned().possiblyEvaluate(new i.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const m=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((w,M)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void w();let D=d;D.startsWith(O)||(D=O+D);const B=i.I.from("mapbox-reserved-lut"),H=new Image;H.src=D,H.onerror=()=>{this._styleColorTheme.lutLoading=!1,M(new Error("Failed to load image data"))},H.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==m)return void w();this._styleColorTheme.lutLoading=!1;const{width:Y,height:Q,data:ce}=i.o.getImageData(H);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(B)&&this.removeImage(B),this.addImage(B,{data:new i.q({width:Y,height:Q},ce),pixelRatio:1,sdf:!1,usvg:!1,version:0});const le=this.imageManager.getImage(B,this.scope);le?(this._styleColorTheme.lut={image:le.data,data:d},w()):M(new Error("Missing LUT image."))}})}getLut(d){const m=this._styleColorThemeForScope[d];return m?m.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(m,w,M){let O,D,B;const H=i.o.devicePixelRatio>1?"@2x":"";let Y=i.m(w.transformRequest(w.normalizeSpriteURL(m,H,".json"),i.R.SpriteJSON),(le,de)=>{Y=null,B||(B=le,O=de,ce())}),Q=i.n(w.transformRequest(w.normalizeSpriteURL(m,H,".png"),i.R.SpriteImage),(le,de)=>{Q=null,B||(B=le,D=de,ce())});function ce(){if(B)M(B);else if(O&&D){const le=i.o.getImageData(D),de={};for(const we in O){const{width:ve,height:De,x:Pe,y:Ve,sdf:Xe,pixelRatio:We,stretchX:bt,stretchY:ut,content:xt}=O[we],ct=new i.q({width:ve,height:De});i.q.copy(le,ct,{x:Pe,y:Ve},{x:0,y:0},{width:ve,height:De},null),de[we]={data:ct,pixelRatio:We!==void 0?We:1,sdf:Xe!==void 0&&Xe,stretchX:bt,stretchY:ut,content:xt,usvg:!1,version:0}}M(null,de)}}return{cancel(){Y&&(Y.cancel(),Y=null),Q&&(Q.cancel(),Q=null)}}}(d,this.map._requestManager,(m,w)=>{if(this._spriteRequest=null,m)this.fire(new i.y(m));else if(w){const M=new Map;for(const O in w)M.set(i.I.from(O),w[O]);this.addImages(M)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))})}addIconset(d,m){if(m.type==="sprite")return void this._loadSprite(m.url);const w=this.getOwnSourceCache(m.source);if(!w)return void this.fire(new i.y(new Error(`Source "${m.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const M=w.getSource();if(M.type!=="raster-array")return void this.fire(new i.y(new Error(`Source "${m.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));M.partial=!1;const O=new R3(d,this.scope,w);this.imageManager.addImageProvider(O,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!i.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const m=this.map._spriteFormat==="auto";var w,M;this._spriteRequest=(M=(O,D)=>{if(this._spriteRequest=null,O)m?this._loadSprite(d):this.fire(new i.y(O));else if(D){const B=new Map;for(const H in D)B.set(i.I.from(H),D[H]);this.addImages(B)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))},i.bu((w=this.map._requestManager).transformRequest(w.normalizeIconsetURL(d),i.R.Iconset),(O,D)=>{if(O)return void M(O);const B={},H=i.dg(new i.bt(D));for(const Y of H.icons){const Q={version:1,pixelRatio:i.o.devicePixelRatio,content:ZI(Y),stretchX:Y.metadata?YI(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?YI(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};B[Y.name]=Q}M(null,B)}))}_validateLayer(d){const m=this.getOwnSource(d.source);if(!m)return;const w=d.sourceLayer;w&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(w)===-1)&&this.fire(new i.y(new Error(`Source layer "${w}" does not exist on source "${m.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,m)=>{const w=this.fragments[m];return w&&w.style&&(d.data=w.style.serialize()),d})}_serializeSources(){const d={};for(const m in this._sourceCaches){const w=this._sourceCaches[m].getSource();d[w.id]||(d[w.id]=w.serialize())}return d}_serializeLayers(d){const m=[];for(const w of d){const M=this._layers[w];M&&M.type!=="custom"&&m.push(M.serialize())}return m}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 m=this._mergedLayers[d];if(m._transitionablePaint&&m._transitionablePaint._values){const w=m._transitionablePaint._values["line-emissive-strength"];if(w&&w.value&&w.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 m=this.getOwnLayer(d);if(m)return m;this.fire(new i.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const m=this.getOwnSource(d);if(m)return m;this.fire(new i.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,m){const w=this.map.painter;if(w)for(let M=d.minzoom||0;M<(d.maxzoom||25.5);M++){const O=d.getProgramIds();if(O)for(const D of O){const B=d.getDefaultProgramParams(D,m.zoom,this._styleColorTheme.lut);B&&(w.style=this,this.fog&&(w._fogVisible=!0,B.overrideFog=!0,w.getOrCreateProgram(D,B)),w._fogVisible=!1,B.overrideFog=!1,w.getOrCreateProgram(D,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,w.getOrCreateProgram(D,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const m=this.calculateLightsBrightness();d.brightness=m||0,m!==this._brightness&&(this._brightness=m,this.dispatcher.broadcast("setBrightness",m)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const w=this._changes.isDirty();let M=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const H in B){const{updatedIds:Y,removedIds:Q}=B[H];(Y||Q)&&(this._updateWorkerLayers(H,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 O={};for(const B in this._mergedSourceCaches){const H=this._mergedSourceCaches[B];O[B]=H.used,H.used=!1,H.tileCoverLift=0}for(const B of this._mergedOrder){const H=this._mergedLayers[B];if(H.visibility!=="none"&&H.recalculate(d,this._availableImages),!H.isHidden(d.zoom)){const Y=this.getLayerSourceCache(H);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,H.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(H,d)}):this.precompilePrograms(H,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&M&&this.mergeLayers();const D=this.imageManager.getPendingImageProviders();for(const B of D)B.sourceCache.used=!0;for(const B in O){const H=this._mergedSourceCaches[B];O[B]!==H.used&&H.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:H.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),w&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const m of d){const w=m.resolvePendingRequests(),M=this.getFragmentStyle(m.scope);M&&M.addImages(w)}}_updateTilesForChangedImages(){const d={};for(const m in this._mergedSourceCaches){const w=this._mergedSourceCaches[m].getSource().scope;d[w]=d[w]||this._changes.getUpdatedImages(w),d[w].length!==0&&this._mergedSourceCaches[m].reloadTilesForDependencies(["icons","patterns"],d[w])}for(const m in d)this._changes.resetUpdatedImages(m)}_updateWorkerLayers(d,m,w){const M=this.getFragmentStyle(d);M&&this.dispatcher.broadcast("updateLayers",{layers:m?M._serializeLayers(m):[],scope:d,removedIds:w||[],options:M.options})}setState(d,m){if(this._checkLoaded(),Om(this,Oa(d)))return!1;(d=i.dp(d)).layers=xf(d.layers);const w=function(D,B){if(!D)return[{command:Ys.setStyle,args:[B]}];let H=[];try{if(!i.by(D.version,B.version))return[{command:Ys.setStyle,args:[B]}];if(i.by(D.center,B.center)||H.push({command:Ys.setCenter,args:[B.center]}),i.by(D.zoom,B.zoom)||H.push({command:Ys.setZoom,args:[B.zoom]}),i.by(D.bearing,B.bearing)||H.push({command:Ys.setBearing,args:[B.bearing]}),i.by(D.pitch,B.pitch)||H.push({command:Ys.setPitch,args:[B.pitch]}),i.by(D.sprite,B.sprite)||H.push({command:Ys.setSprite,args:[B.sprite]}),i.by(D.glyphs,B.glyphs)||H.push({command:Ys.setGlyphs,args:[B.glyphs]}),i.by(D.imports,B.imports)||function(de=[],we=[],ve){we=we||[];const De=(de=de||[]).map(Gg),Pe=we.map(Gg),Ve=de.reduce(jt,{}),Xe=we.reduce(jt,{}),We=De.slice();let bt,ut,xt,ct;for(bt=0,ut=0;bt{de.source&&Y[de.source]?H.push({command:Ys.removeLayer,args:[de.id]}):ce.push(de)});let le=D.terrain;le&&Y[le.source]&&(H.push({command:Ys.setTerrain,args:[void 0]}),le=void 0),H=H.concat(Q),i.by(le,B.terrain)||H.push({command:Ys.setTerrain,args:[B.terrain]}),function(de,we,ve){we=we||[];const De=(de=de||[]).map(Gg),Pe=we.map(Gg),Ve=de.reduce(jt,{}),Xe=we.reduce(jt,{}),We=De.slice(),bt=Object.create(null);let ut,xt,ct,it,St,Dt,Lt;for(ut=0,xt=0;ut!(D.command in QI));if(w.length===0)return!1;const M=w.filter(D=>!(D.command in XI));if(M.length>0)throw new Error(`Unimplemented: ${M.map(D=>D.command).join(", ")}.`);const O=[];return w.forEach(D=>{O.push(this[D.command](...D.args))}),m&&Promise.all(O).then(m).catch(m),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[m,w]of d.entries()){if(this.getImage(m))return this.fire(new i.y(new Error(`An image with the name "${m.name}" already exists.`)));this.imageManager.addImage(m,this.scope,w),this._changes.updateImage(m,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(d,m){return this.getImage(d)?this.fire(new i.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,m),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(d,m,w=!1){this.imageManager.updateImage(d,this.scope,m),w&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.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 i.z("data",{dataType:"style"})),this):this.fire(new i.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 i.z("data",{dataType:"style"})),this}addModel(d,m,w={}){return this._checkLoaded(),this._validate(xe,`models.${d}`,m,null,w)||(this.modelManager.addModel(d,m,this.getActualScope()),this.fire(new i.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 i.z("data",{dataType:"style"})),this):this.fire(new i.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,m,w={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(Ro,`sources.${d}`,m,null,w))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const M=Uo(d,m,this.dispatcher,this);M.scope=this.scope,M.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(M.id),source:M.serialize(),sourceId:M.id}));const O=D=>{const B=(D?"symbol:":"other:")+M.id,H=i.B(B,this.scope),Y=this._sourceCaches[B]=new Qc(H,M,D);(D?this._symbolSourceCaches:this._otherSourceCaches)[M.id]=Y,Y.onAdd(this.map)};O(!1),m.type!=="vector"&&m.type!=="geojson"||O(!0),M.onAdd&&M.onAdd(this.map),w.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const m=this.getOwnSource(d);if(!m)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 i.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 i.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(([O,D])=>D.type==="source"&&D.source===d);if(M)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while iconset "${M[0]}" is using it.`)))}const w=this.getOwnSourceCaches(d);for(const M of w){const O=i.dq(M.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(M.id),M.fire(new i.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(),m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,m){this._checkLoaded(),this.getOwnSource(d).setData(m),this._changes.setDirty()}getOwnSource(d){const m=this.getOwnSourceCache(d);return m&&m.getSource()}getOwnSources(){const d=[];for(const m in this._otherSourceCaches){const w=this.getOwnSourceCache(m);w&&d.push(w.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const m in d){const w=d[m]._tiles;for(const M in w){const O=w[M];if(O.state!=="loaded"&&O.state!=="errored")return!1}}return!0}setLights(d){if(this._checkLoaded(),!d)return delete this.ambientLight,void delete this.directionalLight;const m=this._getTransitionParameters();for(const O of d){if(this._validate(fo,"lights",O))return;switch(O.type){case"ambient":if(this.ambientLight){const D=this.ambientLight;D.set(O),D.updateTransitions(m)}else this.ambientLight=new Ws(O,po||(po=new i.a9({color:new i.aa(i.a6.properties_light_ambient.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const D=this.directionalLight;D.set(O),D.updateTransitions(m)}else this.directionalLight=new Ws(O,ha||(ha=new i.a9({direction:new i.ap(i.a6.properties_light_directional.direction),color:new i.aa(i.a6.properties_light_directional.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_directional.intensity),"cast-shadows":new i.aa(i.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new i.aa(i.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.aa(i.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const w=Object.assign(m,{worldview:this.map.getWorldview()}),M=new i.ac(this.z||0,w);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,m=this.ambientLight;if(!d||!m)return;const w=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(),O=d.properties.get("intensity"),D=d.properties.get("direction"),B=1-i.d4(D.x,D.y,D.z)[2]/90,H=w(M)*O*B,Y=m.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),Q=m.properties.get("intensity"),ce=w(Y)*Q;return Number(((H+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(i.dr(d)){const m=i.ds(d),w=this.fragments.find(({id:O})=>O===m);if(!w)return;const M=i.dq(d);return w.style.getFragmentStyle(M)}{const m=this.fragments.find(({id:w})=>w===d);return m?m.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const m={},w=(M,O="")=>`${M}::${O}`;this._featuresetSelectors={};for(const M in d){const O=this._featuresetSelectors[M]=[];for(const D of d[M].selectors){if(D.featureNamespace){const H=this.getOwnLayer(D.layer);if(!H){i.w(`Layer is undefined for selector: ${D.layer}`);continue}const Y=w(H.source,H.sourceLayer);if(Y in m&&m[Y]!==D.featureNamespace){i.w(`"featureNamespace ${D.featureNamespace} of featureset ${M}'s selector is not associated to the same source, skip this selector`);continue}m[Y]=D.featureNamespace}let B;if(D.properties)for(const H in D.properties){const Y=i.U(D.properties[H]);Y.result==="success"&&(B=B||{},B[H]=Y.value)}O.push({layerId:D.layer,namespace:D.featureNamespace,properties:B,uniqueFeatureID:D._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const m=this.getFragmentStyle(d);if(!m||!m.stylesheet.featuresets)return[];const w=[];for(const M in m.stylesheet.featuresets)w.push({featuresetId:M,importId:m.scope?m.scope:void 0});return w}getFeaturesetLayers(d,m){const w=this.getFragmentStyle(m),M=w.stylesheet.featuresets;if(!M||!M[d])return this.fire(new i.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const O=[];for(const D of M[d].selectors){const B=w.getOwnLayer(D.layer);B&&O.push(B)}return O}getConfigProperty(d,m){const w=this.getFragmentStyle(d);if(!w)return null;const M=i.B(m,w.scope),O=w.options.get(M),D=O?O.value||O.default:null;return D?D.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,m){const w=i.B(d,m);return this._mergedIndoor[w]}setIndoorData(d,m){this.map.indoor.setIndoorData(m)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,m,w){const M=this.getFragmentStyle(d);if(!M)return;const O=M.stylesheet.schema;if(!O||!O[m])return;const D=i.U(w);if(D.result!=="success")return void Om(this,D.value);const B=D.value.expression,H=i.B(m,M.scope),Y=M.options.get(H);if(!Y)return;let Q;const{minValue:ce,maxValue:le,stepValue:de,type:we,values:ve}=O[m],De=i.U(O[m].default);De.result==="success"&&(Q=De.value.expression),Q?(this.options.set(H,Object.assign({},Y,{value:B,default:Q,minValue:ce,maxValue:le,stepValue:de,type:we,values:ve})),this.updateConfigDependencies(m)):this.fire(new i.y(new Error(`No schema defined for the config option "${m}" in the "${d}" fragment.`)))}getConfig(d){const m=this.getFragmentStyle(d);if(!m)return null;const w=m.stylesheet.schema;if(!w)return null;const M={};for(const O in w){const D=i.B(O,m.scope),B=m.options.get(D),H=B?B.value||B.default:null;M[O]=H?H.serialize():null}return M}setConfig(d,m){const w=this.getFragmentStyle(d);w&&(w.updateConfig(m,w.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const m=this.getFragmentStyle(d);return m?m.stylesheet.schema:null}setSchema(d,m){const w=this.getFragmentStyle(d);w&&(w.stylesheet.schema=m,w.updateConfig(w._config,m),this.updateConfigDependencies())}updateConfig(d,m){if(this._config=d,d||m)if(m)for(const w in m){let M,O;const D=i.U(m[w].default);if(D.result==="success"&&(M=D.value.expression),d&&d[w]!==void 0){const le=i.U(d[w]);le.result==="success"&&(O=le.value.expression)}const{minValue:B,maxValue:H,stepValue:Y,type:Q,values:ce}=m[w];if(M){const le=i.B(w,this.scope);this.options.set(le,{default:M,value:O,minValue:B,maxValue:H,stepValue:Y,type:Q,values:ce})}else this.fire(new i.y(new Error(`No schema defined for config option "${w}".`)))}else this.fire(new i.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,m=()=>!0){for(const w of d){const M=this.getLayer(w);M&&m(M)&&(M.possiblyEvaluateVisibility(),this._updateLayer(M),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,m=>!d||m.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(m=>{const w=m._styleColorTheme.colorThemeOverride?m._styleColorTheme.colorThemeOverride:m._styleColorTheme.colorTheme;if(w){const M=m._evaluateColorThemeData(w);(!m._styleColorTheme.lut&&M!==""||m._styleColorTheme.lut&&M!==m._styleColorTheme.lut.data)&&m.setColorTheme(w)}}),this._changes.setDirty()}addLayer(d,m,w={}){this._checkLoaded();const M=d.id;if(this._layers[M])return void this.fire(new i.y(new Error(`Layer with id "${M}" already exists on this map`)));let O;if(d.type==="custom"){if(Om(this,i.dt(d)))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(M,d.source),d=i.dp(d),d=Object.assign(d,{source:M})),this._validate(xu,`layers.${M}`,d,{arrayIndex:-1},w))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:M}})}const D=i.B(O.source,O.scope);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D);let B=this._order.length;if(m){const ce=this._order.indexOf(m);if(ce===-1)return void this.fire(new i.y(new Error(`Layer with id "${m}" does not exist on this map.`)));O.slot===this._layers[m].slot?B=ce:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,M),this._layerOrderChanged=!0,this._layers[M]=O;const H=this.getOwnLayerSourceCache(O),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();H&&O.canCastShadows()&&Y&&(H.castsShadows=!0);const Q=this._changes.getRemovedLayer(O);if(Q&&O.source&&H&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const ce=i.B(O.source,O.scope);Q.type!==O.type?this._changes.updateSourceCache(ce,"clear"):(this._changes.updateSourceCache(ce,"reload"),H.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,m){this._checkLoaded();const w=this._checkLayer(d);if(!w||d===m)return;const M=this._order.indexOf(d);this._order.splice(M,1);let O=this._order.length;if(m){const D=this._order.indexOf(m);if(D===-1)return void this.fire(new i.y(new Error(`Layer with id "${m}" does not exist on this map.`)));w.slot===this._layers[m].slot?O=D:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(O,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const m=this._checkLayer(d);if(!m)return;m.setEventedParent(null);const w=this._order.indexOf(d);this._order.splice(w,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(m.fqid),this._indoorDependentLayers.delete(m.fqid),this._changes.removeLayer(m);const M=this.getOwnLayerSourceCache(m);if(M&&M.castsShadows){let O=!1;for(const D in this._layers)if(this._layers[D].source===m.source&&this._layers[D].canCastShadows()){O=!0;break}M.castsShadows=O}m.onRemove&&m.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const m in this._layers)if(this._layers[m].type===d)return!0;return!1}setLayerZoomRange(d,m,w){this._checkLoaded();const M=this._checkLayer(d);M&&(M.minzoom===m&&M.maxzoom===w||(m!=null&&(M.minzoom=m),w!=null&&(M.maxzoom=w),this._updateLayer(M)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,m){this._checkLoaded();const w=this._checkLayer(d);w&&w.slot!==m&&(w.slot=m,this._updateLayer(w))}setFilter(d,m,w={}){this._checkLoaded();const M=this._checkLayer(d);if(M&&!i.by(M.filter,m))return m==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate($l,`layers.${M.id}.filter`,m,{layerType:M.type},w)||(M.filter=i.dp(m),this._updateLayer(M)))}getFilter(d){const m=this._checkLayer(d);if(m)return i.dp(m.filter)}setLayoutProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!i.by(O.getLayoutProperty(m),w)){if(w!=null&&(!M||M.validate!==!1)&&Om(O,et.call(Oa,{key:`layers.${d}.layout.${m}`,layerType:O.type,objectKey:m,value:w,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(m,w),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);O&&(m==="appearances"?(O.setAppearances(w),this._changes.setDirty()):O.isPaintProperty(m)?this.setPaintProperty(d,m,w,M):this.setLayoutProperty(d,m,w,M))}getLayoutProperty(d,m){const w=this._checkLayer(d);if(w)return w.getLayoutProperty(m)}setPaintProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||i.by(O.getPaintProperty(m),w)||w!=null&&(!M||M.validate!==!1)&&Om(O,yu.call(Oa,{key:`layers.${d}.paint.${m}`,layerType:O.type,objectKey:m,value:w,styleSpec:i.a6})))return;const D=O.setPaintProperty(m,w);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),D&&this._updateLayer(O),this._changes.updatePaintProperties(O)}getPaintProperty(d,m){const w=this._checkLayer(d);if(w)return w.getPaintProperty(m)}setFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(H);for(const{source:le,sourceLayer:de}of ce)Q.setFeatureState({id:d.id,source:le,sourceLayer:de},m)}else if("layerId"in d.target){const{layerId:H}=d.target,Y=this.getLayer(H);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const w=d.source,M=d.sourceLayer,O=this._checkSource(w);if(!O)return;const D=O.type;if(D==="geojson"&&M)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(D==="vector"&&!M)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided.")));const B=this.getOwnSourceCaches(w);for(const H of B)H.setFeatureState(M,d.id,m)}removeFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(H);for(const{source:le,sourceLayer:de}of ce)Q.removeFeatureState({id:d.id,source:le,sourceLayer:de},m)}else if("layerId"in d.target){const{layerId:H}=d.target,Y=this.getLayer(H);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const w=d.source,M=this._checkSource(w);if(!M)return;const O=M.type,D=O==="vector"?d.sourceLayer:void 0;if(O==="vector"&&!D)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new i.y(new Error("A feature id is required to remove its specific state property.")));const B=this.getOwnSourceCaches(w);for(const H of B)H.removeFeatureState(D,d.id,m)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let O;if("featuresetId"in d.target){const{featuresetId:D,importId:B}=d.target,H=this.getFragmentStyle(B),Y=H.getFeaturesetLayers(D);for(const{source:Q,sourceLayer:ce}of Y){const le=H.getFeatureState({id:d.id,source:Q,sourceLayer:ce});if(le&&!O)O=le;else if(!i.by(O,le))return void this.fire(new i.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:D}=d.target,B=this.getLayer(D);O=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return O}const m=d.source,w=d.sourceLayer,M=this._checkSource(m);if(M){if(M.type!=="vector"||w)return d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(m)[0].getFeatureState(w,d.id);this.fire(new i.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(),m=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return i.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:m,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)},w=>w!==void 0)}_updateFilteredLayers(d){for(const m of Object.values(this._mergedLayers))d(m)&&this._updateLayer(m)}_updateLayer(d){this._changes.updateLayer(d);const m=this.getLayerSourceCache(d),w=i.B(d.source,d.scope),M=this._changes.getUpdatedSourceCaches();d.source&&!M[w]&&m&&m.getSource().type!=="raster"&&(this._changes.updateSourceCache(w,"reload"),m.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const m=B=>this._mergedLayers[B].is3D(!!this.terrain),w=this.order,M={},O=[];for(let B=w.length-1;B>=0;B--){const H=w[B];if(m(H)){M[H]=B;for(const Y of d){const Q=Y[H];if(Q)for(const ce of Q)O.push(ce)}}}O.sort((B,H)=>H.intersectionZ-B.intersectionZ);const D=[];for(let B=w.length-1;B>=0;B--){const H=w[B];if(m(H))for(let Y=O.length-1;Y>=0;Y--){const Q=O[Y].feature;if(Q.layer&&M[Q.layer.id]{if(Ck.has(Q.type))return;const ce=this.getOwnLayerSourceCache(Q),le=O[ce.id]=O[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(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new i.y(new Error("parameters.layers must be an Array."))),[];for(const Q of m.layers){const ce=this._layers[Q];if(!ce)return this.fire(new i.y(new Error(`The layer '${Q}' does not exist in the map's style and cannot be queried for features.`))),[];D(ce)}}else for(const Q in this._layers)D(this._layers[Q]);const B=this._queryRenderedFeatures(d,O,w),H=this._flattenAndSortRenderedFeatures(B),Y=[];for(const Q of H)i.dw(Q.layer.id)===this.scope&&Y.push(Q);return Y}queryRenderedFeatureset(d,m,w){let M;m&&!Array.isArray(m)&&m.filter&&(this._validate($l,"queryRenderedFeatures.filter",m.filter,null,m),M=i.b6(m.filter));const O="mock",D=[];if(m&&m.target)D.push(Object.assign({},m,{targetId:O,filter:M}));else{const Q=this.getFeaturesetDescriptors();for(const ce of Q)D.push({targetId:O,filter:M,target:ce});for(const{style:ce}of this.fragments){const le=ce.getFeaturesetDescriptors();for(const de of le)D.push({targetId:O,filter:M,target:de})}}const B=this.queryRenderedTargets(d,D,w),H=[],Y=new Set;for(const Q of B)for(const ce of Q.variants[O])Em(ce,Q,Y)||H.push(new i.dx(Q,ce));return H}queryRenderedTargets(d,m,w){const M={},O=(B,H,Y,Q)=>{const ce=M[H.id]=M[H.id]||{sourceCache:H,layers:{},has3DLayers:!1};if(ce.layers[B.fqid]=ce.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(ce.has3DLayers=!0),!Q)return Y.uniqueFeatureID=!1,void ce.layers[B.fqid].targets.push(Y);ce.layers[B.fqid].targets.push(Object.assign({},Y,{namespace:Q.namespace,properties:Q.properties,uniqueFeatureID:Q.uniqueFeatureID}))};for(const B of m)if("featuresetId"in B.target){const{featuresetId:H,importId:Y}=B.target,Q=this.getFragmentStyle(Y);if(!Q||!Q._featuresetSelectors)continue;const ce=Q._featuresetSelectors[H];if(!ce){this.fire(new i.y(new Error(`The featureset '${H}' 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&&!Ck.has(de.type)&&O(de,Q.getOwnLayerSourceCache(de),B,le)}}else if("layerId"in B.target){const{layerId:H}=B.target,Y=this.getLayer(H);if(!Y||Ck.has(Y.type))continue;O(Y,this.getLayerSourceCache(Y),B)}const D=this._queryRenderedFeatures(d,M,w);return this._flattenAndSortRenderedFeatures(D)}_queryRenderedFeatures(d,m,w){const M=[],O=!!this.map._showQueryGeometry,D=ki.createFromScreenPoints(d,w);for(const B in m){const H=jy(D,m[B],this._availableImages,w,O);Object.keys(H).length&&M.push(H)}if(this.placement)for(const B in m){if(!m[B].sourceCache._onlySymbols)continue;const H=ky(D.screenGeometry,m[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(H).length&&M.push(H)}return M}querySourceFeatures(d,m){const w=m&&m.filter;w&&this._validate($l,"querySourceFeatures.filter",w,null,m);let M=[];const O=this.getOwnSourceCaches(d);for(const D of O)M=M.concat(Ny(D,m));return M}addSourceType(d,m,w){return eh.getSourceType(d)?w(new Error(`A source type called "${d}" already exists.`)):(eh.setSourceType(d,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:m.workerSourceURL},w):w(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,m,w={}){this._checkLoaded();const M=this.light.getLight();let O=!1;for(const B in d)if(!i.by(d[B],M[B])){O=!0;break}if(!O)return;const D=this._getTransitionParameters();this.light.setLight(d,m,w),this.light.updateTransitions(D)}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=i.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,m=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),m===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let w=d;const M=!("source"in d)||d.source==null;if(m===1){if(this.disableElevatedTerrain)return;if("source"in w&&typeof w.source=="object"){const B="terrain-dem-src";this.addSource(B,w.source),w=i.dp(w),w=Object.assign(w,{source:B})}const O=Object.assign({},w),D={};if(this.terrain&&M){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(D.style=B.serialize())}if(this._validate(ml,"terrain",O,D))return}if(!this.terrain||this.terrain.scope!==this.scope&&!M||this.terrain&&m!==this.terrain.drapeRenderMode){if(!w)return;this._createTerrain(w,m),this.fire(new i.z("data",{dataType:"style"}))}else{const O=this.terrain,D=O.get();for(const B of Object.keys(i.a6.terrain))!w.hasOwnProperty(B)&&i.a6.terrain[B].default&&(w[B]=i.a6.terrain[B].default);for(const B in d)if(!i.by(d[B],D[B])){O.set(d,this.options),this.stylesheet.terrain=d;const H=this._getTransitionParameters({duration:0});O.updateTransitions(H),this.fire(new i.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const m=this.fog=new Yn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_createSnow(d){const m=this.snow=new vo(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_createRain(d){const m=this.rain=new ji(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_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 m=this.fog;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.fog=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}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 m=this.snow;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.snow=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}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 m=this.rain;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.rain=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}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()},m=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!m)return this._styleColorTheme.lut=null,void d();const w=this._evaluateColorThemeData(m);this._loadColorTheme(w).then(()=>{this.fire(new i.z("colorthemeset")),d()}).catch(M=>{i.w(`Couldn't set color theme: ${M}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.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,m){const w=this.getFragmentStyle(d);w&&(w._styleColorTheme.colorThemeOverride=m,w._reloadColorTheme())}_getTransitionParameters(d){return{now:i.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],m=[];for(const w of this._mergedOrder)this.isLayerDraped(this._mergedLayers[w])?d.push(w):m.push(w);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...m)}_createTerrain(d,m){const w=this.terrain=new Pt(d,m,this.scope,this.options,this.map.getWorldview());m===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const M=this._getTransitionParameters({duration:0});w.updateTransitions(M)}_force3DLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="symbol"&&this._updateLayer(m)}}_validate(d,m,w,M,O={}){if(O&&O.validate===!1)return!1;const D=Object.assign({},this.serialize());return Om(this,d.call(Oa,Object.assign({key:m,style:D,value:w,styleSpec:i.a6},M)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.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 m=this.getSourceCaches(d);for(const w of m)w.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];m._clear&&m._clear()}}reloadSource(d){const m=this.getSourceCaches(d);for(const w of m)w.resume(),w.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 m;this.directionalLight&&(m=kv(this.directionalLight));const w=new Set,M=new Set;for(const O in this._mergedLayers){const D=this._mergedLayers[O];D.type==="building"&&w.add(D.source),D.hasElevation()&&!M.has(D.source)&&M.add(D.source)}for(const O in this._mergedSourceCaches){const D=this._mergedSourceCaches[O],B=M.has(D._source.id);w.has(D._source.id)&&(D._source.reparseOverscaled=!1),D.update(d,void 0,void 0,m,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const m=this._sourceCaches[d];m.resume(),m.reload()}}_updatePlacement(d,m,w,M,O,D,B=!1){let H=!1,Y=!1;const Q={},ce={};for(const ve of this._mergedOrder){const De=this._mergedLayers[ve];if(De.type!=="symbol")continue;const Pe=i.B(De.source,De.scope);let Ve=Q[Pe];if(!Ve){const We=this.getLayerSourceCache(De);if(!We)continue;const bt=We.getRenderableIds(!0).map(ut=>We.getTileByID(ut));ce[Pe]=bt.slice(),Ve=Q[Pe]=bt.sort((ut,xt)=>xt.tileID.overscaledZ-ut.tileID.overscaledZ||(ut.tileID.isLessThan(xt.tileID)?-1:1))}const Xe=this.crossTileSymbolIndex.addLayer(De,Ve,m.center.lng,m.projection);H=H||Xe}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const le=!!(this.placement&&!m.equals(this.placement.transform)),de=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!D||this.placement.lastReplacementSourceUpdateTime!==D.updateTime)),we=(le||de||H||this.placement&&this.placement.isStale())&&M===0;if((B||!this.pauseablePlacement||we||M!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),m.zoom))&&(this.pauseablePlacement=new yl(m,this._mergedOrder,B||M===0,w,M,O,this.placement,this.fog&&m.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(i.o.now()),Y=!0),H&&this.pauseablePlacement.placement.setStale()),Y||H){this._buildingIndex.onNewFrame(m.zoom);for(let ve=0;veO===d.id)!==-1)return void this.fire(new i.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!m)return w.push(d),this._loadImports([d],!0);const M=w.findIndex(({id:O})=>O===m);return M===-1&&this.fire(new i.y(new Error(`Import with id "${m}" does not exist on this map.`))),this.stylesheet.imports=w.slice(0,M).concat(d).concat(w.slice(M)),this._loadImports([d],!0,m)}updateImport(d,m){this._checkLoaded();const w=this.stylesheet.imports||[],M=this.getImportIndex(d);return M===-1?this:typeof m=="string"?(this.setImportUrl(d,m),this):(m.url&&m.url!==w[M].url&&this.setImportUrl(d,m.url),i.by(m.config,w[M].config)||this.setImportConfig(d,m.config,m.data.schema),i.by(m.data,w[M].data)||this.setImportData(d,m.data),this)}moveImport(d,m){this._checkLoaded();let w=this.stylesheet.imports||[];const M=this.getImportIndex(d);if(M===-1)return this;const O=this.getImportIndex(m);if(O===-1)return this;const D=w[M],B=this.fragments[M];return w=w.filter(({id:H})=>H!==d),this.fragments=this.fragments.filter(({id:H})=>H!==d),this.stylesheet.imports=w.slice(0,O).concat(D).concat(w.slice(O)),this.fragments=this.fragments.slice(0,O).concat(B).concat(this.fragments.slice(O)),this.mergeLayers(),this}setImportUrl(d,m){this._checkLoaded();const w=this.stylesheet.imports||[],M=this.getImportIndex(d);if(M===-1)return this;w[M].url=m;const O=this.fragments[M];return O.style=this._createFragmentStyle(w[M]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(m),this}setImportData(d,m){this._checkLoaded();const w=this.getImportIndex(d),M=this.stylesheet.imports||[];return w===-1?this:m?(this.fragments[w].style.setState(m),this._reloadImports(),this):(delete M[w].data,this.setImportUrl(d,M[w].url))}setImportConfig(d,m,w){this._checkLoaded();const M=this.getImportIndex(d),O=this.stylesheet.imports||[];if(M===-1)return this;m?O[M].config=m:delete O[M].config;const D=this.fragments[M];w&&D.style.stylesheet&&(D.style.stylesheet.schema=w);const B=D.style.stylesheet&&D.style.stylesheet.schema;return D.config=m,D.style.updateConfig(m,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const m=this.stylesheet.imports||[],w=this.getImportIndex(d);w!==-1&&(m.splice(w,1),this.fragments[w].style._remove(),this.fragments.splice(w,1),this._reloadImports())}getImportIndex(d){const m=(this.stylesheet.imports||[]).findIndex(w=>w.id===d);return m===-1&&this.fire(new i.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),m}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const m in this._mergedOtherSourceCaches){const w=this._mergedOtherSourceCaches[m];w&&d.push(w.getSource())}return d}getSource(d,m){const w=this.getSourceCache(d,m);return w&&w.getSource()}getLayerSource(d){const m=this.getLayerSourceCache(d);return m&&m.getSource()}getSourceCache(d,m){const w=i.B(d,m);return this._mergedOtherSourceCaches[w]}getLayerSourceCache(d){const m=i.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[m]:this._mergedOtherSourceCaches[m]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const m=[];return this._mergedOtherSourceCaches[d]&&m.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&m.push(this._mergedSymbolSourceCaches[d]),m}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const m in d){const w=d[m];w==="reload"?this.reloadSource(m):w==="clear"&&this.clearSource(m)}}updateLayers(d){const m=this._changes.getUpdatedPaintProperties();for(const w of m){const M=this.getLayer(w);M&&M.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,m,w){this.imageManager.getImages(m.images,m.scope,w),this._updateTilesForChangedImages();const M=D=>{if(D){const B=m.images.map(H=>i.I.toString(H));D.setDependencies(m.tileID.key,m.type,B)}},O=i.B(m.source,m.scope);M(this._mergedOtherSourceCaches[O]),M(this._mergedSymbolSourceCaches[O]),m.images.some(D=>D.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(d,m,w){this.imageManager.rasterizeImages(m,w)}getGlyphs(d,m,w){this.glyphManager.getGlyphs(m.stacks,w)}getResource(d,m,w){return i.dz(m,w)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const m=[];return this._otherSourceCaches[d]&&m.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&m.push(this._symbolSourceCaches[d]),m}_isSourceCacheLoaded(d){const m=this.getOwnSourceCaches(d);return m.length===0?(this.fire(new i.y(new Error(`There is no source with ID '${d}'`))),!1):m.every(w=>w.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,m){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const w=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),M=d.type==="building";if(d.is3D(!!this.terrain)){if(w||M||m&&m.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)}}eh.getSourceType=function(b){return Zu[b]},eh.setSourceType=function(b,d){Zu[b]=d},eh.registerForPluginStateChange=i.dA;class JI extends i.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},i.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[m,w]of Object.entries(d.buildings))if(this._buildings[m])for(const M of w.floorIds)this._buildings[m].floors[M]||(this._buildings[m].floors[M]=w.floors[M]);else this._buildings[m]=w;for(const m of d.activeFloors)this._activeFloors.add(m);this._updateIndoorSelector()}getIndoorTileOptions(d,m){const w=this._style.getIndoorSourceLayers(d,m);return w&&this._indoorState?{sourceLayers:w,indoorState:this._indoorState}:null}_updateUI(d,m,w){const M=function(O,D,B,H){let Y=null,Q=Number.MAX_SAFE_INTEGER;if(H<16)return null;for(const[ce,le]of Object.entries(O)){const de=le.center;if(de){const we=D.distanceTo(i.aT.convert(de));we({id:D,name:w.floors[D].name,zIndex:w.floors[D].zIndex})).sort((D,B)=>B.zIndex-D.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:M,activeFloorsVisible:this._activeFloorsVisible,floors:O}))}_updateActiveFloors(){const d=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:d,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var Py=` #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`,Ly=` #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;}`,F3=` #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`,Mk="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;}",_u=` #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`,Tk=`#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`,Sr=`#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`,z3=`#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;}`,Ek=`#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`,B3=`#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 Sv=/#include\s+"([^"]+)"/g,bf=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,$3=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Zg=new Set(["ifdef","ifndef","elif","if","defined"]),Yg=new Set;Fm(Py,Yg),Fm(F3,Yg),Fm(Ly,Yg);const Rm={"_prelude_fog.vertex.glsl":Tk,"_prelude_terrain.vertex.glsl":_u,"_prelude_shadow.vertex.glsl":Ek,"_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":Sr,"_prelude_shadow.fragment.glsl":B3,"_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":z3,"_prelude_raster_particle.glsl":Ak},Ik={};Xs("",_u),Xs(Sr,Tk),Xs(B3,Ek),Xs(z3,""),Xs(Ak,"");const eP=Xs(Ly,F3),Pk=Py,Hae=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",Pk,eP.fragmentSource].join(` `),tP=["precision highp float;",Pk,eP.vertexSource].join(` `);var U3={background:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`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:Xs(`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:Xs(`#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:Xs("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:Xs(`#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:Xs(`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:Xs("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:Xs("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:Xs("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:Xs(`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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`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:Xs(`#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:Xs(`#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:Xs(`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:Xs(`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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`#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:Xs("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:Xs("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:Xs(`#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:Xs(`#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:Xs(`#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:Xs("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:Xs(`#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 }`,Mk),skyboxGradient:Xs(`#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 }`,Mk),skyboxCapture:Xs(` 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:Xs(`#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:Xs(`#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:Xs(`#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:Xs(`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:Xs(`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:Xs("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:Xs("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:Xs("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:Xs("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 Fm(b,d){const m=b.split(` `);for(let w of m){if(w=w.trimStart(),w[0]!=="#"||!w.includes("if")||w.startsWith("#endif"))continue;const M=w.match($3);if(M)for(const O of M)Zg.has(O)||d.add(O)}}function Xs(b,d){const m=new Set,w=[],M=[];b=b.replace(Sv,(D,B)=>(M.push(B),"")),d=d.replace(Sv,(D,B)=>(w.push(B),""));let O=new Set(Yg);Fm(b,O),Fm(d,O);for(const D of[...w,...M])Ik[D]||(Ik[D]=new Set,Fm(Rm[D],Ik[D])),O=new Set([...O,...Ik[D]]);return{fragmentSource:b=b.replace(bf,(D,B,H,Y,Q)=>(m.add(Q),B==="define"?` #ifndef HAS_UNIFORM_u_${Q} in ${H} ${Y} ${Q}; #else uniform ${H} ${Y} u_${Q}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${Q} ${H} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${H} ${Y} ${Q}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(bf,(D,B,H,Y,Q)=>{const ce=`MATERIAL_ATTRIBUTE_OFFSET_${Q}`,le=Y==="float"?"vec2":Y,de=`GET_ATTRIBUTE_${le}(a_${Q}, materialInfo, ${ce})`,we=Q.match(/color/)?"color":le;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${H} ${Y} a_${Q}; #endif `:m.has(Q)?B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${H} ${le} a_${Q}; #endif out ${H} ${Y} ${Q}; #else uniform ${H} ${Y} u_${Q}; #endif `:B==="initialize"?we==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} ${Q} = a_${Q}; #else ${H} ${Y} ${Q} = u_${Q}; #endif `:` #if !defined(HAS_UNIFORM_u_${Q}) #ifdef ${ce} ${Q} = unpack_mix_${we}(${de}, u_${Q}_t); #else ${Q} = unpack_mix_${we}(a_${Q}, u_${Q}_t); #endif #else ${H} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${H} ${Y} a_${Q}; out ${H} ${Y} ${Q}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${Q} = a_${Q}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${H} ${le} a_${Q}; #endif #else uniform ${H} ${Y} u_${Q}; #endif `:B==="define-instanced"?we==="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 ${H} ${Y} u_${Q}; #endif `:` #ifdef INSTANCED_ARRAYS in ${H} ${le} a_${Q}; #else uniform ${H} ${Y} u_${Q}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${H} ${Y} ${Q} = a_${Q}; #endif `:we==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${H} ${Y} ${Q} = ${de}; #else ${H} ${Y} ${Q} = a_${Q}; #endif #else ${H} ${Y} ${Q} = u_${Q}; #endif `:` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${H} ${Y} ${Q} = unpack_mix_${we}(${de}, u_${Q}_t); #else ${H} ${Y} ${Q} = unpack_mix_${we}(a_${Q}, u_${Q}_t); #endif #else ${H} ${Y} ${Q} = u_${Q}; #endif `}),usedDefines:O,vertexIncludes:w,fragmentIncludes:M}}class Wae{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,m,w,M,O,D,B,H){this.context=d;let Y=this.boundPaintVertexBuffers.length!==M.length;for(let ce=0;!Y&&ce{const bt=Xe.paint.get("hillshade-shadow-color"),ut=Xe.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",xt=Xe.paint.get("hillshade-highlight-color"),ct=Xe.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",it=Xe.paint.get("hillshade-accent-color"),St=Xe.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Dt=Xe.paint.get("hillshade-emissive-strength");let Lt=i.an(Xe.paint.get("hillshade-illumination-direction"));if(Xe.paint.get("hillshade-illumination-anchor")==="viewport")Lt-=Pe.transform.angle;else if(Pe.style&&Pe.style.enable3dLights()&&Pe.style.directionalLight){const Wt=Pe.style.directionalLight.properties.get("direction"),sr=i.d4(Wt.x,Wt.y,Wt.z);Lt=i.an(sr[1])}const Ht=!Pe.options.moving;return{u_matrix:We||Pe.transform.calculateProjMatrix(Ve.tileID.toUnwrapped(),Ht),u_image:0,u_latrange:Gae(0,Ve.tileID),u_light:[Xe.paint.get("hillshade-exaggeration"),Lt],u_shadow:bt.toPremultipliedRenderColor(ut?null:Xe.lut),u_highlight:xt.toPremultipliedRenderColor(ct?null:Xe.lut),u_emissive_strength:Dt,u_accent:it.toPremultipliedRenderColor(St?null:Xe.lut)}})(b,m,w,b.terrain?d.projMatrix:null);b.uploadCommonUniforms(B,le,d.toUnwrapped());const{tileBoundsBuffer:we,tileBoundsIndexBuffer:ve,tileBoundsSegments:De}=b.getTileBoundsBuffers(m);le.draw(b,H.TRIANGLES,M,O,D,zn.disabled,de,w.id,we,ve,De)}function q3(b,d,m){if(!d.needsDEMTextureUpload)return;const w=b.context,M=w.gl;w.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||b.getTileTexture(m.stride);const O=m.getPixels();d.demTexture?d.demTexture.update(O,{premultiply:!1}):d.demTexture=new i.T(w,O,M.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Zae(b,d,m){const w=b.context,M=w.gl;if(!d.dem)return;const O=d.dem;if(w.activeTexture.set(M.TEXTURE1),q3(b,d,O),!d.demTexture)return;d.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);const D=O.dim;w.activeTexture.set(M.TEXTURE0);let B=d.hillshadeFBO;if(!B){const le=new i.T(w,{width:D,height:D,data:null},M.RGBA8);le.bind(M.LINEAR,M.CLAMP_TO_EDGE),B=d.hillshadeFBO=w.createFramebuffer(D,D,1,"renderbuffer"),B.colorAttachment0.set(le.texture)}w.bindFramebuffer.set(B.framebuffer),w.viewport.set([0,0,D,D]);const{tileBoundsBuffer:H,tileBoundsIndexBuffer:Y,tileBoundsSegments:Q}=b.getMercatorTileBoundsBuffers(),ce=[];b.linearFloatFilteringSupported()&&ce.push("TERRAIN_DEM_FLOAT_FORMAT"),b.terrain&&b.terrain.renderingToTexture&&b.emissiveMode==="mrt-fallback"&&ce.push("USE_MRT1"),b.getOrCreateProgram("hillshadePrepare",{defines:ce}).draw(b,M.TRIANGLES,dn.disabled,$n.disabled,as.unblended,zn.disabled,((le,de)=>{const we=de.stride,ve=i.bC();return i.ce(ve,0,i.al,-i.al,0,0,1),i.br(ve,ve,[0,-i.al,0]),{u_matrix:ve,u_image:1,u_dimension:[we,we],u_zoom:le.overscaledZ}})(d.tileID,O),m.id,H,Y,Q),d.needsHillshadePrepare=!1}class Si{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 Yae extends Si{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class rP extends Si{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class V3 extends Si{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class Lk extends Si{getDefault(){return[!0,!0,!0,!0]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class H3 extends Si{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class Xg extends Si{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Oy extends Si{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const m=this.current;(d.func!==m.func||d.ref!==m.ref||d.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class Cv extends Si{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class Dy extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=d,this.dirty=!1}}class nP extends Si{getDefault(){return[0,1]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class W3 extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=d,this.dirty=!1}}class sP extends Si{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Ry extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.BLEND):m.disable(m.BLEND),this.current=d,this.dirty=!1}}class Ok extends Si{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Dk extends Si{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class G3 extends Si{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 Rk extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=d,this.dirty=!1}}class Mv extends Si{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class aP extends Si{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let iP=class extends Si{getDefault(){return null}set(b){(b!==this.current||this.dirty)&&(this.gl.useProgram(b),this.current=b,this.dirty=!1)}};class oP extends Si{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class Fy extends Si{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class lP extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class Xae extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Qae extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindTexture(m.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Jae extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class K3 extends Si{getDefault(){return null}set(d){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Z3 extends Si{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class Y3 extends Si{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class X3 extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class cP extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Fk extends Si{constructor(d,m){super(d),this.context=d,this.parent=m}getDefault(){return null}}class zk extends Fk{constructor(d,m,w=0){super(d,m),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+w}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachmentPoint,m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class zy extends Fk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferRenderbuffer(m.FRAMEBUFFER,this.attachment(),m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Tv extends Fk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachment(),m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class dP extends zy{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const bu=(b,d,m,w)=>({u_matrix:b,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:m,u_emissive_texture_available:w}),Bk=(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De)=>({u_proj_matrix:Float32Array.from(b),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(w),u_merc_matrix:m,u_zoom_transition:M,u_merc_center:O,u_image0:0,u_image1:1,u_frustum_tl:D,u_frustum_tr:B,u_frustum_br:H,u_frustum_bl:Y,u_globe_pos:Q,u_globe_radius:ce,u_viewport:le,u_grid_matrix:De?Float32Array.from(De):new Float32Array(9),u_skirt_height:de,u_far_z_cutoff:we,u_emissive_texture_available:ve});function Av(b,d){return b!=null&&d!=null&&!(!b.hasData()||!d.hasData())&&b.demTexture!=null&&d.demTexture!=null&&b.tileID.key!==d.tileID.key}const bp=new class{constructor(){this.operations={}}newMorphing(b,d,m,w,M){if(b in this.operations){const O=this.operations[b];O.to.tileID.key!==m.tileID.key&&(O.queued=m)}else this.operations[b]={startTime:w,phase:0,duration:M,from:d,to:m,queued:null}}getMorphValuesForProxy(b){if(!(b in this.operations))return null;const d=this.operations[b];return{from:d.from,to:d.to,phase:d.phase}}update(b){for(const d in this.operations){const m=this.operations[d];for(m.phase=(b-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,b)){delete this.operations[d];break}}}_nextOp(b,d){return!!b.queued&&(b.from=b.to,b.to=b.queued,b.queued=null,b.phase=0,b.startTime=d,!0)}_validOp(b){return b.from.hasData()&&b.to.hasData()}},$k={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Uk(b,d,m){if(d===0)return 0;const w=d<1&&m===514?.25/d:1;return 6*Math.pow(1.5,22-b)*Math.max(d,1)*w}function Q3(b,d){const m=1<({u_matrix:b});function Iv(b,d,m,w,M){if(M>0){const O=i.o.now(),D=(O-b.timeAdded)/M,B=d?(O-d.timeAdded)/M:-1,H=m.getSource(),Y=w.coveringZoomLevel({tileSize:H.tileSize,roundZoom:H.roundZoom}),Q=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(b.tileID.overscaledZ-Y),ce=Q&&b.refreshedUponExpiration?1:i.aA(Q?D:1-B,0,1);return d?{opacity:1,mix:1-ce,isFading:D<1}:{opacity:ce,mix:0,isFading:D<1}}return{opacity:1,mix:0,isFading:!1}}class qk extends Qc{constructor(d){const m=Uo("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",m,!1),m.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,m){d.state="loaded",m(null)}}class J3 extends Qc{constructor(d){const m=Uo("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,m,w){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((O,D)=>{if(O[D.key]="",!this._tiles[D.key]){const B=new pp(D,this._source.tileSize*D.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[D.key]=B}return O},{});for(const O in this._tiles)O in M||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const m=this.proxyCachedFBO[d];if(m!==void 0){const w=Object.values(m);this.renderCachePool.push(...w),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class e5 extends i.aQ{constructor(d,m,w){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=m,this.projMatrix=w}}class t5 extends i.bV{constructor(d,m){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[w,M,O]=function(H){const Y=new i.bd,Q=new i.b0,ce=131;Y.reserve(17161),Q.reserve(33800);const le=i.al/128,de=i.al+le/2,we=de+le;for(let De=-le;Dede||De<0||De>de?24575:0,Xe=i.aA(Math.round(Pe),0,i.al),We=i.aA(Math.round(De),0,i.al);Y.emplaceBack(Xe+Ve,We)}const ve=(De,Pe)=>{const Ve=Pe*ce+De;Q.emplaceBack(Ve+1,Ve,Ve+ce),Q.emplaceBack(Ve+ce,Ve+ce+1,Ve+1)};for(let De=1;De<129;De++)for(let Pe=1;Pe<129;Pe++)ve(Pe,De);return[0,129].forEach(De=>{for(let Pe=0;Pe<130;Pe++)ve(Pe,De),ve(De,Pe)}),[Y,Q,32768]}(),D=d.context;this.gridBuffer=D.createVertexBuffer(w,i.bf.members),this.gridIndexBuffer=D.createIndexBuffer(M),this.gridSegments=i.bg.simpleSegment(0,0,w.length,M.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,w.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new J3(m.map),this.orthoMatrix=i.bC(),i.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,i.al,0,i.al,0,1);const B=D.gl;this._overlapStencilMode=new $n({func:B.GEQUAL,mask:255},0,255,B.KEEP,B.KEEP,B.REPLACE),this._previousZoom=d.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=m,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new qk(m.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,m,w){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const M=d.terrain.properties,O=d.terrain.drapeRenderMode===0,D=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();const B=d.terrain&&d.terrain.scope,H=M.get("source"),Y=O?this._mockSourceCache:d.getSourceCache(H,B);if(!Y)return void i.w(`Couldn't find terrain source "${H}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=D?this.calculateExaggeration(m):M.get("exaggeration"),!m.projection.requiresDraping&&D&&this._exaggeration===0)return void this._disable();this.enabled=!0;const Q=()=>{this.sourceCache.used&&i.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(m,ce,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,Q(),this._initializing=!0),Q(),m.updateElevation(!0,w),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0,this._previousZoom=m.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const m=this._previousCameraAltitude,w=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=w;const M=m!=null?w-m:Number.MAX_VALUE;if(Math.abs(M)<2)return this._exaggeration;const O=d.zoom,D=this._style.terrain;if(!this._previousUpdateTimestamp)return D.getExaggeration(O);let B=O-this._previousZoom;const H=this._previousUpdateTimestamp;let Y=O;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(O-Y)>.5&&(B=.5*(O-Y+B)),B*M<0&&(Y+=B)),this._evaluationZoom=Y;const Q=D.getExaggeration(Y),ce=Q===D.getExaggeration(Math.max(0,Y-.1));if(ce&&Math.abs(Q-this._exaggeration)<.01)return Q;let le=Math.min(.1,.00375*(this._updateTimestamp-H));return(ce||Q<.1||Math.abs(B)<1e-4)&&(le=Math.min(.2,4*le)),i.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 m=this.proxySourceCache,w=this.painter.transform;this._initializing&&(this._initializing=w._centerAltitude===0&&this.getAtPointOrZero(i.ae.fromLngLat(w.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const M=this.proxyCoords=m.getIds().map(H=>{const Y=m.getTileByID(H).tileID;return Y.projMatrix=w.calculateProjMatrix(Y.toUnwrapped()),Y});(function(H,Y){const Q=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),ce=new i.P(Q.x,Q.y);H.sort((le,de)=>{if(de.overscaledZ-le.overscaledZ)return de.overscaledZ-le.overscaledZ;const we=new i.P(le.canonical.x+(1<{this.proxyToSource[H.key]={}}),this.terrainTileForTile={};const D=this._style._mergedSourceCaches;for(const H in D){const Y=D[H];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[H],O),Y.usedForTerrain))continue;const Q=d[H];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(Q)}this.proxiedCoords[m.id]=M.map(H=>new e5(H,H.key,this.orthoMatrix)),this._assignTerrainTiles(M),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(O),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const H of this.proxyCoords){const Y=this.terrainTileForTile[H.key];if(!Y)continue;const Q=Y.tileID.key;Q in B||(this._visibleDemTiles.push(Y),B[Q]=Q)}}_assignTerrainTiles(d){this._initializing||d.forEach(m=>{if(this.terrainTileForTile[m.key])return;const w=this._findTileCoveringTileID(m,this.sourceCache);w&&(this.terrainTileForTile[m.key]=w)})}_prepareDEMTextures(){const d=this.painter.context,m=d.gl;for(const w in this.terrainTileForTile){const M=this.terrainTileForTile[w],O=M.dem;!O||M.demTexture&&!M.needsDEMTextureUpload||(d.activeTexture.set(m.TEXTURE1),q3(this.painter,M,O))}}_prepareDemTileUniforms(d,m,w,M){if(!m||m.demTexture==null)return!1;const O=d.tileID.canonical,D=Math.pow(2,m.tileID.canonical.z-O.z),B=M||"";return w[`u_dem_tl${B}`]=[O.x*D%1,O.y*D%1],w[`u_dem_scale${B}`]=D,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const m=this._visibleDemTiles.reduce((w,M)=>{if(!M.dem)return w;const O=M.dem.tree.minimums[0];return O>0&&d++,w+O},0);return d?m/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,m=d.gl;d.activeTexture.set(m.TEXTURE2);const w=this._getLoadedAreaMinimum(),M=new i.dL({width:1,height:1},new Float32Array([w]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(M,{premultiply:!1}):O=this._emptyDEMTexture=new i.T(d,M,m.R32F,{premultiply:!1}),O}setupElevationDraw(d,m,w){const M=this.painter.context,O=M.gl,D={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};D.u_exaggeration=this.exaggeration();let B=null,H=null,Y=1;if(w&&w.morphing&&this._useVertexMorphing){const de=w.morphing.srcDemTile,we=w.morphing.dstDemTile;Y=w.morphing.phase,de&&we&&(this._prepareDemTileUniforms(d,de,D,"_prev")&&(H=de),this._prepareDemTileUniforms(d,we,D)&&(B=we))}const Q=de=>de&&de.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let ce=null;var le;if(this.enabled?H&&B?(ce=B.demTexture,M.activeTexture.set(O.TEXTURE4),H.demTexture.bind(Q(H),O.CLAMP_TO_EDGE),D.u_dem_lerp=Y):(B=this.terrainTileForTile[d.tileID.key],ce=this._prepareDemTileUniforms(d,B,D)?B.demTexture:this.emptyDEMTexture):ce=this.emptyDEMTexture,M.activeTexture.set(O.TEXTURE2),ce&&(D.u_dem_size=(le=ce).size[0]===1?1:le.size[0]-2,ce.bind(Q(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(w&&w.useDepthForOcclusion,m,D),w&&w.useMeterToDem&&B){const de=(1<{if(Pe===Wt)return;const sr=[$k[Wt],"PROJECTION_GLOBE_VIEW"];Xe&&sr.push("CUSTOM_ANTIALIASING");const _r=Y.isTileAffectedByFog(Ht);De=Y.getOrCreateProgram("globeRaster",{defines:sr,overrideFog:_r}),Pe=Wt},bt=Y.colorModeForRenderPass(),ut=new dn(ve.LEQUAL,dn.ReadWrite,Y.depthRangeFor3D);bp.update(de);const xt=i.dF(Ve),ct=[i.aF(Ve.center.lng),i.aJ(Ve.center.lat)],it=Y.globeSharedBuffers,St=[Ve.width*i.o.devicePixelRatio,Ve.height*i.o.devicePixelRatio],Dt=Float32Array.from(Ve.globeMatrix),Lt={useDenormalizedUpVectorScale:!0};{const Ht=Y.transform,Wt=Uk(Ht.zoom,Q.exaggeration(),Q.sourceCache._source.tileSize);Pe=-1;const sr=ve.TRIANGLES;for(const _r of le){const $t=ce.getTile(_r),Tt=$n.disabled,Jt=Q.prevTerrainTileForTile[_r.key],Vt=Q.terrainTileForTile[_r.key];Av(Jt,Vt)&&bp.newMorphing(_r.key,Jt,Vt,de,250),By(Y,$t.emissiveTexture),we.activeTexture.set(ve.TEXTURE0),$t.texture&&$t.texture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const dr=bp.getMorphValuesForProxy(_r.key),Tr=dr?1:0;dr&&Object.assign(Lt,{morphing:{srcDemTile:dr.from,dstDemTile:dr.to,phase:i.dD(dr.phase)}});const Hr=i.dG(_r.canonical),Nr=i.dH(Hr.getCenter().lat),br=i.dI(_r.canonical,Hr,Nr,Ht.worldSize/Ht._pixelsPerMercatorPixel),sn=i.bk(i.dJ(_r.canonical)),Jr=Y.emissiveMode==="mrt-fallback"?1:0,zr=Bk(Ht.expandedFarZProjMatrix,Dt,xt,sn,i.aj(Ht.zoom),ct,Ht.frustumCorners.TL,Ht.frustumCorners.TR,Ht.frustumCorners.BR,Ht.frustumCorners.BL,Ht.globeCenterInViewSpace,Ht.globeRadius,St,Wt,Ht._farZ,Jr,br);if(We(_r,Tr),De&&(Q.setupElevationDraw($t,De,Lt),Y.uploadCommonUniforms(we,De,_r.toUnwrapped()),it)){const[Gr,kn,Xn]=it.getGridBuffers(Nr,Wt!==0);De.draw(Y,sr,ut,Tt,bt,zn.backCCW,zr,"globe_raster",Gr,kn,Xn)}}}if(it&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Ht=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Xe&&Ht.push("CUSTOM_ANTIALIASING"),De=Y.getOrCreateProgram("globeRaster",{defines:Ht});for(const Wt of le){const{x:sr,y:_r,z:$t}=Wt.canonical,Tt=_r===0,Jt=_r===(1<<$t)-1,[Vt,dr,Tr,Hr]=it.getPoleBuffers($t,!1);if(Hr&&(Tt||Jt)){const Nr=ce.getTile(Wt);By(Y,Nr.emissiveTexture),we.activeTexture.set(ve.TEXTURE0),Nr.texture&&Nr.texture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);let br=i.dK($t,sr,Ve);const sn=i.bk(i.dJ(Wt.canonical)),Jr=Y.emissiveMode==="mrt-fallback"?1:0,zr=(Gr,kn)=>Gr.draw(Y,ve.TRIANGLES,ut,$n.disabled,bt,zn.disabled,Bk(Ve.expandedFarZProjMatrix,br,br,sn,0,ct,Ve.frustumCorners.TL,Ve.frustumCorners.TR,Ve.frustumCorners.BR,Ve.frustumCorners.BL,Ve.globeCenterInViewSpace,Ve.globeRadius,St,0,Ve._farZ,Jr),"globe_pole_raster",kn,Tr,Hr);Q.setupElevationDraw(Nr,De,Lt),Y.uploadCommonUniforms(we,De,Wt.toUnwrapped()),Tt&&Y.renderDefaultNorthPole&&zr(De,Vt),Jt&&Y.renderDefaultSouthPole&&(br=i.cS(i.bC(),br,[1,-1,1]),zr(De,dr))}}}})(M,O,D,B,H);else{const Y=M.context,Q=Y.gl;let ce,le;const de=M.shadowRenderer,we=Pm(M,M.longestCutoffRange),ve=bt=>{if(le===bt)return;const ut=[];ut.push($k[bt]),we.shouldRenderCutoff&&ut.push("RENDER_CUTOFF"),de&&(ut.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&ut.push("NORMAL_OFFSET")),ce=M.getOrCreateProgram("terrainRaster",{defines:ut}),le=bt},De=M.colorModeForRenderPass(),Pe=new dn(Q.LEQUAL,dn.ReadWrite,M.depthRangeFor3D);bp.update(H);const Ve=M.transform,Xe=Uk(Ve.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let We=[0,0,0];if(de){const bt=M.style.directionalLight,ut=M.style.ambientLight;bt&&ut&&(We=_p(M.style,bt,ut))}{le=-1;const bt=Q.TRIANGLES,[ut,xt]=[O.gridIndexBuffer,O.gridSegments];for(const ct of B){const it=D.getTile(ct),St=$n.disabled,Dt=O.prevTerrainTileForTile[ct.key],Lt=O.terrainTileForTile[ct.key];Av(Dt,Lt)&&bp.newMorphing(ct.key,Dt,Lt,H,250),By(M,it.emissiveTexture),Y.activeTexture.set(Q.TEXTURE0),it.texture&&it.texture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const Ht=bp.getMorphValuesForProxy(ct.key),Wt=Ht?1:0;let sr;Ht&&(sr={morphing:{srcDemTile:Ht.from,dstDemTile:Ht.to,phase:i.dD(Ht.phase)}});const _r=M.emissiveMode==="mrt-fallback"?1:0,$t=bu(ct.projMatrix,Q3(ct.canonical,Ve.renderWorldCopies)?Xe/10:Xe,We,_r);if(ve(Wt),!ce)continue;O.setupElevationDraw(it,ce,sr);const Tt=ct.toUnwrapped();de&&de.setupShadows(Tt,ce),M.uploadCommonUniforms(Y,ce,Tt,null,we),ce.draw(M,bt,Pe,St,De,zn.backCCW,$t,"terrain_raster",O.gridBuffer,ut,xt)}}}}(m,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const m=this.painter,w=this.painter.context,M=this.proxySourceCache,O=this.proxiedCoords[M.id],D=this._drapedRenderBatches.shift(),B=m.style.order,H=[];this._updateFBOs(m.emissiveMode==="mrt-fallback");let Y=0;for(const Q of O){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++],we=le!==void 0;if(ce.texture=de.tex,ce.emissiveTexture=de.emissiveTex,we&&!de.dirty){H.push(ce.tileID);continue}w.bindFramebuffer.set(de.fb.framebuffer);const ve=w.gl;let De;ve.drawBuffers(m.emissiveMode==="mrt-fallback"?[ve.COLOR_ATTACHMENT0,ve.COLOR_ATTACHMENT1]:[ve.COLOR_ATTACHMENT0]),this.renderedToTile=!1,de.dirty&&(w.clear({color:i.ao.transparent,stencil:0}),de.dirty=!1);for(let Pe=D.start;Pe<=D.end;++Pe){const Ve=m.style._mergedLayers[B[Pe]];if(Ve.isHidden(m.transform.zoom))continue;const Xe=m.style.getLayerSourceCache(Ve),We=Xe?this.proxyToSource[Q.key][Xe.id]:[Q];if(!We)continue;const bt=We;w.viewport.set([0,0,de.fb.width,de.fb.height]),De!==(Xe?Xe.id:null)&&(this._setupStencil(de,We,Ve,Xe),De=Xe?Xe.id:null),m.renderLayer(m,Xe,Ve,bt)}if(ve.drawBuffers([ve.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Pe of this._pendingGroundEffectLayers){const Ve=m.style._mergedLayers[B[Pe]];if(Ve.isHidden(m.transform.zoom))continue;const Xe=m.style.getLayerSourceCache(Ve),We=Xe?this.proxyToSource[Q.key][Xe.id]:[Q];if(!We)continue;const bt=We;w.viewport.set([0,0,de.fb.width,de.fb.height]),De!==(Xe?Xe.id:null)&&(this._setupStencil(de,We,Ve,Xe),De=Xe?Xe.id:null),m.renderLayer(m,Xe,Ve,bt)}this.renderedToTile?(de.dirty=!0,H.push(ce.tileID)):we||--Y,Y===5&&(Y=0,this.renderToBackBuffer(H))}return this.renderToBackBuffer(H),this.renderingToTexture=!1,w.bindFramebuffer.set(null),w.viewport.set([0,0,m.width,m.height]),D.end+1}postRender(){}isLayerOrderingCorrect(d){const m=d.order.length;let w=-1,M=m;for(let O=0;Ow}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{d=Math.min(d,m.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,m,w){if(!this._visibleDemTiles)return null;const M=this._visibleDemTiles.filter(O=>O.dem).map(O=>{const D=O.tileID,B=1<(O.t!==null?O.t:Number.MAX_VALUE)-(D.t!==null?D.t:Number.MAX_VALUE));for(const O of M){if(O.t==null)return null;const D=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,m,w);if(D!=null)return D}return null}_createFBO(){const d=this.painter.context,m=d.gl,w=this.drapeBufferSize;d.activeTexture.set(m.TEXTURE0);const M=new i.T(d,{width:w[0],height:w[1],data:null},m.RGBA8);M.bind(m.LINEAR,m.CLAMP_TO_EDGE);const O=d.createFramebuffer(w[0],w[1],1,null);let D;return O.colorAttachment0.set(M.texture),this._emissiveTexture&&(D=new i.T(d,{width:w[0],height:w[1],data:null},m.R8),D.bind(m.LINEAR,m.CLAMP_TO_EDGE),O.createColorAttachment(d,1),O.colorAttachment1.set(D.texture)),O.depthAttachment=new dP(d,O.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,w[0],w[1]),this._stencilRef=0,O.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):O.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&m.texParameterf(m.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:O,tex:M,emissiveTex:D,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const m of this.pool)this._updateFBO(m,d);for(const m of this.proxySourceCache.renderCache)this._updateFBO(m,d);this._emissiveTexture=d}}_updateFBO(d,m){const w=d.fb,M=this.painter.context,O=M.gl,D=this.drapeBufferSize;if(m){const B=new i.T(M,{width:D[0],height:D[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,w.createColorAttachment(M,1),w.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,w.removeColorAttachment(M,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const m=this._style._mergedLayers[d],w=m.isHidden(this.painter.transform.zoom);return m.type==="hillshade"||m.type==="custom"?!w&&m.shouldRedrape():!w&&m.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const w of this._style.getSources())if(w instanceof gf){d=!0;break}if(!d)return;const m={};for(let w=0;wH>B.end)||i.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=w}_setupRenderCache(d){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const D=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let B=0;B=0;D--){const B=w[D];if(m.getTileByID(B.key),m.proxyCachedFBO[B.key]!==void 0){const H=d[B.key],Y=this.proxyToSource[B.key];let Q=0;for(const ce in Y){const le=Y[ce],de=H[ce];if(!de||de.length!==le.length||le.some((we,ve)=>we!==de[ve]||M[ce]&&M[ce].hasOwnProperty(we.key))){Q=-1;break}++Q}for(const ce in m.proxyCachedFBO[B.key])m.renderCache[m.proxyCachedFBO[B.key][ce]].dirty=Q<0||Q!==Object.values(H).length}}const O=[...this._drapedRenderBatches];O.sort((D,B)=>B.end-B.start-(D.end-D.start));for(const D of O)for(const B of w){if(m.proxyCachedFBO[B.key])continue;let H=m.renderCachePool.pop();H===void 0&&m.renderCache.length<50&&(H=m.renderCache.length,m.renderCache.push(this._createFBO())),H!==void 0&&(m.proxyCachedFBO[B.key]={},m.proxyCachedFBO[B.key][D.start]=H,m.renderCache[H].dirty=!0)}this._tilesDirty={}}_setupStencil(d,m,w,M){if(!M||!this._sourceTilesOverlap[M.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const O=this.painter.context,D=O.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let B;if(w.isTileClipped())B=m.length,this._overlapStencilMode.test={func:D.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(m[0].overscaledZ>m[m.length-1].overscaledZ))return void(this._overlapStencilType=!1);B=1,this._overlapStencilMode.test={func:D.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+B>255&&(O.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=B,this._overlapStencilMode.ref=this._stencilRef,w.isTileClipped()&&this._renderTileClippingMasks(m,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):$n.disabled}_renderTileClippingMasks(d,m){const w=this.painter,M=this.painter.context,O=M.gl;w._tileClippingMaskIDs={},M.setColorMode(as.disabled),M.setDepthMode(dn.disabled);const D=w.getOrCreateProgram("clippingMask");for(const B of d){const H=w._tileClippingMaskIDs[B.key]=--m;D.draw(w,O.TRIANGLES,dn.disabled,new $n({func:O.ALWAYS,mask:0},H,255,O.KEEP,O.KEEP,O.REPLACE),as.disabled,zn.disabled,Ev(B.projMatrix),"$clipping",w.tileExtentBuffer,w.quadTriangleIndexBuffer,w.tileExtentSegments)}}pointCoordinate(d){const m=this.painter.transform;if(d.x<0||d.x>m.width||d.y<0||d.y>m.height)return null;const w=[d.x,d.y,1,1];i.aC(w,w,m.pixelMatrixInverse),i.cK(w,w,1/w[3]),w[0]/=m.worldSize,w[1]/=m.worldSize;const M=m._camera.position,O=i.cf(1,m.center.lat),D=[M[0],M[1],M[2]/O,0],B=i.da([],w.slice(0,3),D);i.aw(B,B);const H=this.raycast(D,B,this._exaggeration);return H!==null&&H?(i.bH(D,D,B,H),D[3]=D[2],D[2]*=O,D):null}_setupProxiedCoordsForOrtho(d,m,w){if(d.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(d,m,w);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const M=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let H=0;HQ.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,m,w){if(!d.getSource().loaded())return;const M=this.proxiedCoords[d.id]=[],O=this.proxyCoords,D=d.getSource(),B=D.tileID;if(!B)return;const H=new i.P(B.x,B.y)._div(1<(ce.min.x=Math.min(ce.min.x,le.x-H.x),ce.min.y=Math.min(ce.min.y,le.y-H.y),ce.max.x=Math.max(ce.max.x,le.x-H.x),ce.max.y=Math.max(ce.max.y,le.y-H.y),ce),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),Q=(ce,le)=>{const de=ce.wrap+ce.canonical.x/(1<De+Y.max.x||we+vePe+Y.max.y};for(let ce=0;ceD.key===m.tileID.key);if(O)return O}if(m.tileID.key!==d.key){const O=d.canonical.z-m.tileID.canonical.z;let D,B,H;M=i.bC();const Y=m.tileID.wrap-d.wrap<0?(D=i.al>>O,B=D*((m.tileID.canonical.x<=ce){const le=d.canonical.z-ce;m.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,m.transform.tileZoom),D=new i.aQ(B,d.wrap,ce,d.canonical.x>>le,d.canonical.y>>le)):le!==0&&(B=ce,D=new i.aQ(B,d.wrap,ce,d.canonical.x>>le,d.canonical.y>>le))}D.key!==d.key&&(Y.push(D.key),w=m.getTile(D))}const Q=ce=>{Y.forEach(le=>{M[le]=ce}),Y.length=0};for(B-=1;B>=H&&(!w||!w.hasData());B--){w&&Q(w.tileID.key);const ce=D.calculateScaledKey(B);if(w=m.getTileByID(ce),w&&w.hasData())break;const le=M[ce];if(le===null)break;le===void 0?Y.push(ce):w=m.getTileByID(le)}return Q(w?w.tileID.key:null),w&&w.hasData()?w:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,m){let w=this._tilesDirty[d];w||(w=this._tilesDirty[d]={}),w[m.key]=!0}}function $y(b,d,m){const w=function(B,H,Y){const Q=i.bJ(H,B),ce=i.bJ(Y,[.2126,.7152,.0722]),le=(we,ve,De)=>(1-De)*we+De*ve,de=le(1-.3*Math.min(ce,1),1,Math.min(Q+1,1));return le(.92,1,Math.asin(i.aA(H[2],-1,1))/Math.PI+.5)*de}(b,[0,0,1],d),M=[0,0,0];i.c5(M,m.slice(0,3),w);const O=[0,0,0];i.c5(O,d.slice(0,3),b[2]);const D=[0,0,0];return i.d8(D,M,O),i.db(D)}const eie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],tie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class uP{static cacheKey(d,m,w,M){const O=[m];M&&O.push(M.cacheKey);for(const D of w)d.usedDefines.has(D)&&O.push(D);return O.join("/")}constructor(d,m,w,M,O,D){const B=d.gl;this.program=B.createProgram(),this.configuration=M,this.name=m,this.fixedDefines=[...D];const H=`#version 300 es ${(M?M.defines():[]).concat(D.map(ve=>`#define ${ve}`)).join(` `)}`,Y=[H,Hae];for(const ve of w.fragmentIncludes)Y.push(Rm[ve]);Y.push(w.fragmentSource);const Q=Y.join(` `),ce=[H,tP];for(const ve of w.vertexIncludes)ce.push(Rm[ve]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&w.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&ce.push("uniform int u_instanceID;"),ce.push(w.vertexSource);let le=ce.join(` `);this.forceManualRenderingForInstanceIDShaders&&(le=le.replaceAll("gl_InstanceID","u_instanceID"));const de=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(de,Q),B.compileShader(de),B.attachShader(this.program,de);const we=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(we,le),B.compileShader(we),B.attachShader(this.program,we),this.attributes={},B.linkProgram(this.program),B.deleteShader(we),B.deleteShader(de),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=M?M.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(ve=>({u_instanceID:new i.ch(ve)}))(d)),(D.includes("TERRAIN")||m.includes("symbol")||m.includes("circle"))&&(this.terrainUniforms=(ve=>({u_dem:new i.ch(ve),u_dem_prev:new i.ch(ve),u_dem_tl:new i.ck(ve),u_dem_scale:new i.cj(ve),u_dem_tl_prev:new i.ck(ve),u_dem_scale_prev:new i.cj(ve),u_dem_size:new i.cj(ve),u_dem_lerp:new i.cj(ve),u_exaggeration:new i.cj(ve),u_depth:new i.ch(ve),u_depth_size_inv:new i.ck(ve),u_depth_range_unpack:new i.ck(ve),u_occluder_half_size:new i.cj(ve),u_occlusion_depth_offset:new i.cj(ve),u_meter_to_dem:new i.cj(ve),u_label_plane_matrix_inv:new i.cl(ve)}))(d)),D.includes("GLOBE")&&(this.globeUniforms=(ve=>({u_tile_tl_up:new i.ci(ve),u_tile_tr_up:new i.ci(ve),u_tile_br_up:new i.ci(ve),u_tile_bl_up:new i.ci(ve),u_tile_up_scale:new i.cj(ve)}))(d)),D.includes("FOG")&&(this.fogUniforms=(ve=>({u_fog_matrix:new i.cl(ve),u_fog_range:new i.ck(ve),u_fog_color:new i.d3(ve),u_fog_horizon_blend:new i.cj(ve),u_fog_vertical_limit:new i.ck(ve),u_fog_temporal_offset:new i.cj(ve),u_frustum_tl:new i.ci(ve),u_frustum_tr:new i.ci(ve),u_frustum_br:new i.ci(ve),u_frustum_bl:new i.ci(ve),u_globe_pos:new i.ci(ve),u_globe_radius:new i.cj(ve),u_globe_transition:new i.cj(ve),u_is_globe:new i.ch(ve),u_viewport:new i.ck(ve)}))(d)),D.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(ve=>({u_cutoff_params:new i.d3(ve)}))(d)),D.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(ve=>({u_lighting_ambient_color:new i.ci(ve),u_lighting_directional_dir:new i.ci(ve),u_lighting_directional_color:new i.ci(ve),u_ground_radiance:new i.ci(ve)}))(d)),D.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(ve=>({u_light_matrix_0:new i.cl(ve),u_light_matrix_1:new i.cl(ve),u_fade_range:new i.ck(ve),u_shadow_normal_offset:new i.ci(ve),u_shadow_intensity:new i.cj(ve),u_shadow_texel_size:new i.cj(ve),u_shadow_map_resolution:new i.cj(ve),u_shadow_direction:new i.ci(ve),u_shadow_bias:new i.ci(ve),u_shadowmap_0:new i.ch(ve),u_shadowmap_1:new i.ch(ve)}))(d)))}getAttributeLocation(d,m){let w=this.attributes[m];return w===void 0&&(w=this.attributes[m]=d.getAttribLocation(this.program,m)),w}setTerrainUniformValues(d,m){if(!this.terrainUniforms)return;const w=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M]&&w[M].set(this.program,M,m[M])}}setGlobeUniformValues(d,m){if(!this.globeUniforms)return;const w=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M]&&w[M].set(this.program,M,m[M])}}setFogUniformValues(d,m){if(!this.fogUniforms)return;const w=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setCutoffUniformValues(d,m){if(!this.cutoffUniforms)return;const w=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setLightsUniformValues(d,m){if(!this.lightsUniforms)return;const w=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setShadowUniformValues(d,m){if(this.failedToCreate||!this.shadowUniforms)return;const w=this.shadowUniforms;d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}_drawDebugWireframe(d,m,w,M,O,D,B,H,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||!eie.includes(this.name))||!(!ce.layers3D||!tie.includes(this.name))))return;const de=le.gl,we=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,le);if(!we)return;const ve=[...this.fixedDefines,"DEBUG_WIREFRAME"],De=d.getOrCreateProgram(this.name,{config:this.configuration,defines:ve});le.program.set(De.program);const Pe=(We,bt,ut)=>{if(bt[We]&&ut[We])for(const xt in bt[We])ut[We][xt]&&ut[We][xt].set(ut.program,xt,bt[We][xt].current)};Y&&Y.setUniforms(De.program,le,De.binderUniforms,B,{zoom:H}),Pe("fixedUniforms",this,De),Pe("terrainUniforms",this,De),Pe("globeUniforms",this,De),Pe("fogUniforms",this,De),Pe("lightsUniforms",this,De),Pe("shadowUniforms",this,De),we.bind(),le.setColorMode(new as([de.ONE,de.ONE_MINUS_SRC_ALPHA,de.ZERO,de.ONE],i.ao.transparent,[!0,!0,!0,!1])),le.setDepthMode(new dn(m.func===de.LESS?de.LEQUAL:m.func,dn.ReadOnly,m.range)),le.setStencilMode($n.disabled);const Ve=3*D.primitiveLength*2,Xe=3*D.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const We=Q||1;for(let bt=0;bt1?de.drawElementsInstanced(de.LINES,Ve,de.UNSIGNED_SHORT,Xe,Q):de.drawElements(de.LINES,Ve,de.UNSIGNED_SHORT,Xe);O.bind(),le.program.set(this.program),le.setDepthMode(m),le.setStencilMode(w),le.setColorMode(M)}checkUniforms(d,m,w){if(this.fixedDefines.includes(m)){for(const M of Object.keys(w))if(!w[M].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${M} not set but required by ${m} being defined`)}}draw(d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De){const Pe=d.context,Ve=Pe.gl;if(this.failedToCreate)return;Pe.program.set(this.program),Pe.setDepthMode(w),Pe.setStencilMode(M),Pe.setColorMode(O),Pe.setCullFace(D);for(const[ct,it]of this.fixedUniformsEntries)it.set(this.program,ct,B[ct]);we&&we.setUniforms(this.program,Pe,this.binderUniforms,le,{zoom:de});const Xe={[Ve.POINTS]:1,[Ve.LINES]:2,[Ve.TRIANGLES]:3,[Ve.LINE_STRIP]:1}[m];this.checkUniforms(H,"RENDER_SHADOWS",this.shadowUniforms);const We=ve||[],bt=we?we.getPaintVertexBuffers():[],ut=m===Ve.TRIANGLES&&Q,xt=De&&De>0?1:void 0;for(const ct of ce.get()){const it=ct.vaos||(ct.vaos={});if((it[H]||(it[H]=new Wae)).bind(Pe,this,Y,bt,Q,ct.vertexOffset,We,xt),this.forceManualRenderingForInstanceIDShaders){const St=De||1;for(let Dt=0;Dt1?Ve.drawElementsInstanced(m,ct.primitiveLength*Xe,Ve.UNSIGNED_SHORT,ct.primitiveOffset*Xe*2,De):Q?Ve.drawElements(m,ct.primitiveLength*Xe,Ve.UNSIGNED_SHORT,ct.primitiveOffset*Xe*2):Ve.drawArrays(m,ct.vertexOffset,ct.vertexLength);ut&&this._drawDebugWireframe(d,w,M,O,Q,ct,le,de,we,De)}}}function hP(b,d,m=0){const w=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,b.transform.tileZoom)/w,O=M*(d.tileID.canonical.x+d.tileID.wrap*w),D=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.ay(d,1,b.transform.tileZoom),u_pixel_coord_upper:[O>>16,D>>16],u_pixel_coord_lower:[65535&O,65535&D],u_pattern_transition:m}}const Vk={terrain:0,flat:1},rie=i.bC(),Hk=(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe)=>{const Ve=d.style.light,Xe=Ve.properties.get("position"),We=[Xe.x,Xe.y,Xe.z],bt=i.dO();Ve.properties.get("anchor")==="viewport"&&(i.dP(bt,-d.transform.angle),i.dQ(We,We,bt));const ut=Ve.properties.get("color").toPremultipliedRenderColor(null),xt=d.transform,ct={u_matrix:b,u_lightpos:We,u_lightintensity:Ve.properties.get("intensity"),u_lightcolor:[ut.r,ut.g,ut.b],u_vertical_gradient:+m,u_opacity:w,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rie,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Vk[Y],u_base_type:Vk[Q],u_ao:M,u_edge_radius:O,u_width_scale:D,u_flood_light_color:we,u_vertical_scale:ve,u_flood_light_intensity:De,u_ground_shadow_factor:Pe};return xt.projection.name==="globe"&&(ct.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:b,u_edge_radius:d,u_width_scale:m,u_vertical_scale:w,u_height_type:Vk[M],u_base_type:Vk[O]}),fP=(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe)=>{const Ve=Hk(b,d,m,w,M,O,D,B,Y,Q,ce,le,de,we,ve,De,1,[0,0,0]),Xe={u_height_factor:-Math.pow(2,B.overscaledZ)/H.tileSize/8};return Object.assign(Ve,hP(d,H,Pe),Xe)},Uy=(b,d,m,w,M,O,D,B,H,Y,Q)=>({u_matrix:d,u_opacity:m,u_ao_pass:w?1:0,u_meter_to_tile:M,u_ao:O,u_flood_light_intensity:D,u_flood_light_color:B,u_attenuation:H,u_edge_radius:Y,u_fb:0,u_fb_size:Q,u_dynamic_offset:1}),n5=(b,d,m)=>({u_matrix:b,u_emissive_strength:d,u_ground_shadow_factor:m}),s5=(b,d,m,w,M,O=0)=>Object.assign(n5(b,d,M),hP(m,w,O)),pP=(b,d,m,w)=>({u_matrix:b,u_world:m,u_emissive_strength:d,u_ground_shadow_factor:w}),a5=(b,d,m,w,M,O,D=0)=>Object.assign(s5(b,d,m,w,O,D),{u_world:M}),zm=(b,d)=>({u_matrix:b,u_ground_shadow_factor:d}),Qg=(b,d,m,w,M)=>({u_matrix:b,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:m,u_height_scale:w,u_reset_depth:M}),Wk=(b,d,m,w,M,O,D,B,H)=>({u_matrix:b,u_normal_matrix:d,u_opacity:m,u_faux_facade_ao_intensity:w,u_camera_pos:M,u_tile_to_meter:O,u_facade_emissive_chance:D,u_flood_light_color:B,u_flood_light_intensity:H}),mP=b=>({u_matrix:b}),Bm=b=>({u_matrix:b}),i5=(b,d,m,w,M,O,D,B)=>{const H=i.al/O.tileSize;return{u_matrix:b,u_inv_rot_matrix:d,u_camera_to_center_distance:m.getCameraToCenterDistance(B),u_extrude_scale:[m.pixelsToGLUnits[0]/H,m.pixelsToGLUnits[1]/H],u_zoom_transition:w,u_tile_id:D,u_merc_center:M}},Pv=(b,d,m=1)=>({u_matrix:b,u_color:d,u_overlay:0,u_overlay_scale:m}),gP=i.bC(),xP=(b,d,m,w,M,O,D)=>{const B=b.transform,H=B.projection.name==="globe",Y=H?i.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:i.ay(m,1,O),Q={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:D,u_inv_rot_matrix:gP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(H){Q.u_inv_rot_matrix=w,Q.u_merc_center=M,Q.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:b,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:w,u_grid_matrix:M,u_tl_parent:O,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:i.dT(ce.paint.get("raster-saturation")),u_contrast_factor:i.dS(ce.paint.get("raster-contrast")),u_spin_weights:vP(ce.paint.get("raster-hue-rotate")),u_perspective_transform:le,u_raster_elevation:de,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:H,u_colorization_mix:Gk(i.dU,ve,Pe),u_colorization_offset:Kk(i.dU,De,Pe),u_color_ramp:we,u_texture_offset:[Xe/(Ve+2*Xe),Ve/(Ve+2*Xe)],u_texture_res:[Ve+2*Xe,Ve+2*Xe],u_emissive_strength:We});function vP(b){b*=Math.PI/180;const d=Math.sin(b),m=Math.cos(b);return[(2*m+1)/3,(-Math.sqrt(3)*d-m+1)/3,(Math.sqrt(3)*d-m+1)/3]}const wf=.05,nie=(b,d,m,w,M,O,D,B,H,Y,Q,ce)=>({u_matrix:b,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:w,u_grid_matrix:M,u_tl_parent:O,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:D,u_merc_center:B,u_cutoff_params:H}),sie=(b,d,m,w,M,O,D,B,H,Y)=>({u_particle_texture:b,u_particle_texture_side_len:d,u_tile_offset:m,u_velocity:w,u_color_ramp:O,u_velocity_res:M,u_max_speed:D,u_uv_offset:B,u_data_scale:[255*H[0],255*H[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[wf,wf]}),_P=(b,d,m,w,M,O,D,B,H,Y)=>({u_particle_texture:b,u_particle_texture_side_len:d,u_velocity:m,u_velocity_res:w,u_max_speed:M,u_speed_factor:O,u_reset_rate:D,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*H[0],255*H[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[wf,wf]}),bP=i.bC(),Zk=(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe,Ve,Xe,We,bt,ut,xt)=>{const ct=M.transform,it={u_is_size_zoom_constant:+(b==="constant"||b==="source"),u_is_size_feature_constant:+(b==="constant"||b==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ct.getCameraToCenterDistance(Ve),u_rotate_symbol:+m,u_aspect_ratio:ct.width/ct.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:D,u_coord_matrix:B,u_is_text:+Y,u_elevation_from_sea:H?1:0,u_pitch_with_map:+w,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:bP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:bP,u_up_vector:[0,-1,0],u_color_adj_mat:bt,u_icon_transition:ut||0,u_gamma_scale:w?M.transform.getCameraToCenterDistance(Ve)*Math.cos(M.terrain?0:M.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:xt||1,u_ground_shadow_factor:Xe,u_inv_matrix:i.bl(i.bC(),D),u_normal_scale:We,u_lutTexture:Ml.LUT};return Ve.name==="globe"&&(it.u_tile_id=[de.canonical.x,de.canonical.y,1<({u_matrix:b,u_emissive_strength:d,u_opacity:m,u_color:w}),$m=(b,d,m,w,M,O,D,B,H)=>Object.assign(function(Y,Q,ce,le,de,we){const{width:ve,height:De}=le.imageManager.getPixelSize(Q),Pe=Math.pow(2,we.tileID.overscaledZ),Ve=we.tileSize*Math.pow(2,le.transform.tileZoom)/Pe,Xe=Ve*(we.tileID.canonical.x+we.tileID.wrap*Pe),We=Ve*we.tileID.canonical.y;return{u_image:0,u_pattern_tl:ce.tl,u_pattern_br:ce.br,u_texsize:[ve,De],u_pattern_size:ce.displaySize,u_pattern_units_to_pixels:de?[le.transform.width,-1*le.transform.height]:[1/i.ay(we,1,le.transform.tileZoom),1/i.ay(we,1,le.transform.tileZoom)],u_pixel_coord_upper:[Xe>>16,We>>16],u_pixel_coord_lower:[65535&Xe,65535&We]}}(0,O,D,w,B,H),{u_matrix:b,u_emissive_strength:d,u_opacity:m}),qy=new Float32Array(i.bA([])),Jg=(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de=[0,0,0],we,ve,De)=>{const Pe=M.style.light,Ve=Pe.properties.get("position"),Xe=[-Ve.x,-Ve.y,Ve.z],We=i.dO();Pe.properties.get("anchor")==="viewport"&&(i.dP(We,-M.transform.angle),i.dQ(Xe,Xe,We));const bt=Q.alphaMode==="MASK",ut=Pe.properties.get("color").toNonPremultipliedRenderColor(null),xt=le.paint.get("model-ambient-occlusion-intensity"),ct=le.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return ct.a=le.paint.get("model-color-mix-intensity").constantOr(0),De&&(ct.r=De[0],ct.g=De[1],ct.b=De[2],ct.a=De[3]),ve&&(ct.r=ve.color.r,ct.g=ve.color.g,ct.b=ve.color.b,ct.a=ve.colorMix,ce=ve.emissionStrength,O*=ve.opacity),{u_matrix:b,u_lighting_matrix:d,u_normal_matrix:m,u_node_matrix:w||qy,u_lightpos:Xe,u_lightintensity:Pe.properties.get("intensity"),u_lightcolor:[ut.r,ut.g,ut.b],u_camera_pos:de,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+bt,u_alphaCutoff:Q.alphaCutoff,u_baseColorFactor:D.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:H,u_roughnessFactor:Y,u_baseColorTexture:Ml.BaseColor,u_metallicRoughnessTexture:Ml.MetallicRoughness,u_normalTexture:Ml.Normal,u_occlusionTexture:Ml.Occlusion,u_emissionTexture:Ml.Emission,u_lutTexture:Ml.LUT,u_color_mix:ct.toArray01(),u_aoIntensity:xt,u_emissive_strength:ce,u_occlusionTextureTransform:we||[0,0,0,0]}},o5=(b,d=qy,m=qy)=>({u_matrix:b,u_instance:d,u_node_matrix:m}),Yk={fillExtrusion:b=>({u_matrix:new i.cl(b),u_lightpos:new i.ci(b),u_lightintensity:new i.cj(b),u_lightcolor:new i.ci(b),u_vertical_gradient:new i.cj(b),u_opacity:new i.cj(b),u_edge_radius:new i.cj(b),u_width_scale:new i.cj(b),u_ao:new i.ck(b),u_height_type:new i.ch(b),u_base_type:new i.ch(b),u_tile_id:new i.ci(b),u_zoom_transition:new i.cj(b),u_inv_rot_matrix:new i.cl(b),u_merc_center:new i.ck(b),u_up_dir:new i.ci(b),u_height_lift:new i.cj(b),u_flood_light_color:new i.ci(b),u_vertical_scale:new i.cj(b),u_flood_light_intensity:new i.cj(b),u_ground_shadow_factor:new i.ci(b)}),fillExtrusionDepth:b=>({u_matrix:new i.cl(b),u_edge_radius:new i.cj(b),u_width_scale:new i.cj(b),u_vertical_scale:new i.cj(b),u_height_type:new i.ch(b),u_base_type:new i.ch(b)}),fillExtrusionPattern:b=>({u_matrix:new i.cl(b),u_lightpos:new i.ci(b),u_lightintensity:new i.cj(b),u_lightcolor:new i.ci(b),u_vertical_gradient:new i.cj(b),u_height_factor:new i.cj(b),u_edge_radius:new i.cj(b),u_width_scale:new i.cj(b),u_ao:new i.ck(b),u_height_type:new i.ch(b),u_base_type:new i.ch(b),u_tile_id:new i.ci(b),u_zoom_transition:new i.cj(b),u_inv_rot_matrix:new i.cl(b),u_merc_center:new i.ck(b),u_up_dir:new i.ci(b),u_height_lift:new i.cj(b),u_image:new i.ch(b),u_texsize:new i.ck(b),u_pixel_coord_upper:new i.ck(b),u_pixel_coord_lower:new i.ck(b),u_tile_units_to_pixels:new i.cj(b),u_opacity:new i.cj(b),u_pattern_transition:new i.cj(b)}),fillExtrusionGroundEffect:b=>({u_matrix:new i.cl(b),u_opacity:new i.cj(b),u_ao_pass:new i.cj(b),u_meter_to_tile:new i.cj(b),u_ao:new i.ck(b),u_flood_light_intensity:new i.cj(b),u_flood_light_color:new i.ci(b),u_attenuation:new i.cj(b),u_edge_radius:new i.cj(b),u_fb:new i.ch(b),u_fb_size:new i.cj(b),u_dynamic_offset:new i.cj(b)}),fill:b=>({u_matrix:new i.cl(b),u_emissive_strength:new i.cj(b),u_ground_shadow_factor:new i.ci(b)}),fillPattern:b=>({u_matrix:new i.cl(b),u_emissive_strength:new i.cj(b),u_image:new i.ch(b),u_texsize:new i.ck(b),u_pixel_coord_upper:new i.ck(b),u_pixel_coord_lower:new i.ck(b),u_tile_units_to_pixels:new i.cj(b),u_ground_shadow_factor:new i.ci(b),u_pattern_transition:new i.cj(b)}),fillOutline:b=>({u_matrix:new i.cl(b),u_emissive_strength:new i.cj(b),u_world:new i.ck(b),u_ground_shadow_factor:new i.ci(b)}),fillOutlinePattern:b=>({u_matrix:new i.cl(b),u_emissive_strength:new i.cj(b),u_world:new i.ck(b),u_image:new i.ch(b),u_texsize:new i.ck(b),u_pixel_coord_upper:new i.ck(b),u_pixel_coord_lower:new i.ck(b),u_tile_units_to_pixels:new i.cj(b),u_ground_shadow_factor:new i.ci(b),u_pattern_transition:new i.cj(b)}),building:b=>({u_matrix:new i.cl(b),u_normal_matrix:new i.cl(b),u_opacity:new i.cj(b),u_faux_facade_ao_intensity:new i.cj(b),u_camera_pos:new i.ci(b),u_tile_to_meter:new i.cj(b),u_facade_emissive_chance:new i.cj(b),u_flood_light_color:new i.ci(b),u_flood_light_intensity:new i.cj(b)}),buildingBloom:b=>({u_matrix:new i.cl(b)}),buildingDepth:b=>({u_matrix:new i.cl(b)}),elevatedStructuresDepth:b=>({u_matrix:new i.cl(b),u_depth_bias:new i.cj(b)}),elevatedStructures:b=>({u_matrix:new i.cl(b),u_ground_shadow_factor:new i.ci(b)}),elevatedStructuresDepthReconstruct:b=>({u_matrix:new i.cl(b),u_camera_pos:new i.ci(b),u_depth_bias:new i.cj(b),u_height_scale:new i.cj(b),u_reset_depth:new i.cj(b)}),circle:i.dY,collisionBox:b=>({u_matrix:new i.cl(b),u_inv_rot_matrix:new i.cl(b),u_camera_to_center_distance:new i.cj(b),u_extrude_scale:new i.ck(b),u_zoom_transition:new i.cj(b),u_merc_center:new i.ck(b),u_tile_id:new i.ci(b)}),collisionCircle:b=>({u_matrix:new i.cl(b),u_inv_matrix:new i.cl(b),u_camera_to_center_distance:new i.cj(b),u_viewport_size:new i.ck(b)}),debug:b=>({u_color:new i.dB(b),u_matrix:new i.cl(b),u_overlay:new i.ch(b),u_overlay_scale:new i.cj(b)}),clippingMask:b=>({u_matrix:new i.cl(b)}),heatmap:b=>({u_extrude_scale:new i.cj(b),u_intensity:new i.cj(b),u_matrix:new i.cl(b),u_inv_rot_matrix:new i.cl(b),u_merc_center:new i.ck(b),u_tile_id:new i.ci(b),u_zoom_transition:new i.cj(b),u_up_dir:new i.ci(b)}),heatmapTexture:b=>({u_image:new i.ch(b),u_color_ramp:new i.ch(b),u_opacity:new i.cj(b)}),hillshade:b=>({u_matrix:new i.cl(b),u_image:new i.ch(b),u_latrange:new i.ck(b),u_light:new i.ck(b),u_shadow:new i.dB(b),u_highlight:new i.dB(b),u_emissive_strength:new i.cj(b),u_accent:new i.dB(b)}),hillshadePrepare:b=>({u_matrix:new i.cl(b),u_image:new i.ch(b),u_dimension:new i.ck(b),u_zoom:new i.cj(b)}),line:i.dX,linePattern:i.dW,raster:b=>({u_matrix:new i.cl(b),u_normalize_matrix:new i.cl(b),u_globe_matrix:new i.cl(b),u_merc_matrix:new i.cl(b),u_grid_matrix:new i.dC(b),u_tl_parent:new i.ck(b),u_scale_parent:new i.cj(b),u_fade_t:new i.cj(b),u_opacity:new i.cj(b),u_image0:new i.ch(b),u_image1:new i.ch(b),u_brightness_low:new i.cj(b),u_brightness_high:new i.cj(b),u_saturation_factor:new i.cj(b),u_contrast_factor:new i.cj(b),u_spin_weights:new i.ci(b),u_perspective_transform:new i.ck(b),u_raster_elevation:new i.cj(b),u_zoom_transition:new i.cj(b),u_merc_center:new i.ck(b),u_cutoff_params:new i.d3(b),u_colorization_mix:new i.d3(b),u_colorization_offset:new i.cj(b),u_color_ramp:new i.ch(b),u_texture_offset:new i.ck(b),u_texture_res:new i.ck(b),u_emissive_strength:new i.cj(b)}),rasterParticle:b=>({u_matrix:new i.cl(b),u_normalize_matrix:new i.cl(b),u_globe_matrix:new i.cl(b),u_merc_matrix:new i.cl(b),u_grid_matrix:new i.dC(b),u_tl_parent:new i.ck(b),u_scale_parent:new i.cj(b),u_fade_t:new i.cj(b),u_opacity:new i.cj(b),u_image0:new i.ch(b),u_image1:new i.ch(b),u_raster_elevation:new i.cj(b),u_zoom_transition:new i.cj(b),u_merc_center:new i.ck(b),u_cutoff_params:new i.d3(b)}),rasterParticleTexture:b=>({u_texture:new i.ch(b),u_opacity:new i.cj(b)}),rasterParticleDraw:b=>({u_particle_texture:new i.ch(b),u_particle_texture_side_len:new i.cj(b),u_tile_offset:new i.ck(b),u_velocity:new i.ch(b),u_color_ramp:new i.ch(b),u_velocity_res:new i.ck(b),u_max_speed:new i.cj(b),u_uv_offset:new i.ck(b),u_data_scale:new i.ck(b),u_data_offset:new i.cj(b),u_particle_pos_scale:new i.cj(b),u_particle_pos_offset:new i.ck(b)}),rasterParticleUpdate:b=>({u_particle_texture:new i.ch(b),u_particle_texture_side_len:new i.cj(b),u_velocity:new i.ch(b),u_velocity_res:new i.ck(b),u_max_speed:new i.cj(b),u_speed_factor:new i.cj(b),u_reset_rate:new i.cj(b),u_rand_seed:new i.cj(b),u_uv_offset:new i.ck(b),u_data_scale:new i.ck(b),u_data_offset:new i.cj(b),u_particle_pos_scale:new i.cj(b),u_particle_pos_offset:new i.ck(b)}),symbol:b=>({u_is_size_zoom_constant:new i.ch(b),u_is_size_feature_constant:new i.ch(b),u_size_t:new i.cj(b),u_size:new i.cj(b),u_camera_to_center_distance:new i.cj(b),u_rotate_symbol:new i.ch(b),u_aspect_ratio:new i.cj(b),u_fade_change:new i.cj(b),u_matrix:new i.cl(b),u_label_plane_matrix:new i.cl(b),u_coord_matrix:new i.cl(b),u_is_text:new i.ch(b),u_elevation_from_sea:new i.ch(b),u_pitch_with_map:new i.ch(b),u_texsize:new i.ck(b),u_texsize_icon:new i.ck(b),u_texture:new i.ch(b),u_texture_icon:new i.ch(b),u_gamma_scale:new i.cj(b),u_device_pixel_ratio:new i.cj(b),u_tile_id:new i.ci(b),u_zoom_transition:new i.cj(b),u_inv_rot_matrix:new i.cl(b),u_merc_center:new i.ck(b),u_camera_forward:new i.ci(b),u_tile_matrix:new i.cl(b),u_up_vector:new i.ci(b),u_ecef_origin:new i.ci(b),u_is_halo:new i.ch(b),u_icon_transition:new i.cj(b),u_color_adj_mat:new i.cl(b),u_scale_factor:new i.cj(b),u_ground_shadow_factor:new i.ci(b),u_inv_matrix:new i.cl(b),u_normal_scale:new i.cj(b),u_lutTexture:new i.ch(b)}),background:b=>({u_matrix:new i.cl(b),u_emissive_strength:new i.cj(b),u_opacity:new i.cj(b),u_color:new i.dB(b)}),backgroundPattern:b=>({u_matrix:new i.cl(b),u_emissive_strength:new i.cj(b),u_opacity:new i.cj(b),u_image:new i.ch(b),u_pattern_tl:new i.ck(b),u_pattern_br:new i.ck(b),u_texsize:new i.ck(b),u_pattern_size:new i.ck(b),u_pixel_coord_upper:new i.ck(b),u_pixel_coord_lower:new i.ck(b),u_pattern_units_to_pixels:new i.ck(b)}),terrainRaster:b=>({u_matrix:new i.cl(b),u_image0:new i.ch(b),u_image1:new i.ch(b),u_skirt_height:new i.cj(b),u_ground_shadow_factor:new i.ci(b),u_emissive_texture_available:new i.cj(b)}),skybox:b=>({u_matrix:new i.cl(b),u_sun_direction:new i.ci(b),u_cubemap:new i.ch(b),u_opacity:new i.cj(b),u_temporal_offset:new i.cj(b)}),skyboxGradient:b=>({u_matrix:new i.cl(b),u_color_ramp:new i.ch(b),u_center_direction:new i.ci(b),u_radius:new i.cj(b),u_opacity:new i.cj(b),u_temporal_offset:new i.cj(b)}),skyboxCapture:b=>({u_matrix_3f:new i.dC(b),u_sun_direction:new i.ci(b),u_sun_intensity:new i.cj(b),u_color_tint_r:new i.d3(b),u_color_tint_m:new i.d3(b),u_luminance:new i.cj(b)}),globeRaster:b=>({u_proj_matrix:new i.cl(b),u_globe_matrix:new i.cl(b),u_normalize_matrix:new i.cl(b),u_merc_matrix:new i.cl(b),u_zoom_transition:new i.cj(b),u_merc_center:new i.ck(b),u_image0:new i.ch(b),u_image1:new i.ch(b),u_grid_matrix:new i.dC(b),u_skirt_height:new i.cj(b),u_far_z_cutoff:new i.cj(b),u_frustum_tl:new i.ci(b),u_frustum_tr:new i.ci(b),u_frustum_br:new i.ci(b),u_frustum_bl:new i.ci(b),u_globe_pos:new i.ci(b),u_globe_radius:new i.cj(b),u_viewport:new i.ck(b),u_emissive_texture_available:new i.cj(b)}),globeAtmosphere:b=>({u_frustum_tl:new i.ci(b),u_frustum_tr:new i.ci(b),u_frustum_br:new i.ci(b),u_frustum_bl:new i.ci(b),u_horizon:new i.cj(b),u_transition:new i.cj(b),u_fadeout_range:new i.cj(b),u_atmosphere_fog_color:new i.d3(b),u_high_color:new i.d3(b),u_space_color:new i.d3(b),u_temporal_offset:new i.cj(b),u_horizon_angle:new i.cj(b)}),model:b=>({u_matrix:new i.cl(b),u_lighting_matrix:new i.cl(b),u_normal_matrix:new i.cl(b),u_node_matrix:new i.cl(b),u_lightpos:new i.ci(b),u_lightintensity:new i.cj(b),u_lightcolor:new i.ci(b),u_camera_pos:new i.ci(b),u_opacity:new i.cj(b),u_baseColorFactor:new i.d3(b),u_emissiveFactor:new i.d3(b),u_metallicFactor:new i.cj(b),u_roughnessFactor:new i.cj(b),u_baseTextureIsAlpha:new i.ch(b),u_alphaMask:new i.ch(b),u_alphaCutoff:new i.cj(b),u_baseColorTexture:new i.ch(b),u_metallicRoughnessTexture:new i.ch(b),u_normalTexture:new i.ch(b),u_occlusionTexture:new i.ch(b),u_emissionTexture:new i.ch(b),u_lutTexture:new i.ch(b),u_color_mix:new i.d3(b),u_aoIntensity:new i.cj(b),u_emissive_strength:new i.cj(b),u_occlusionTextureTransform:new i.d3(b)}),modelDepth:b=>({u_matrix:new i.cl(b),u_instance:new i.cl(b),u_node_matrix:new i.cl(b)}),groundShadow:b=>({u_matrix:new i.cl(b),u_ground_shadow_factor:new i.ci(b)}),stars:b=>({u_matrix:new i.cl(b),u_up:new i.ci(b),u_right:new i.ci(b),u_intensity_multiplier:new i.cj(b)}),snowParticle:b=>({u_modelview:new i.cl(b),u_projection:new i.cl(b),u_time:new i.cj(b),u_cam_pos:new i.ci(b),u_velocityConeAperture:new i.cj(b),u_velocity:new i.cj(b),u_horizontalOscillationRadius:new i.cj(b),u_horizontalOscillationRate:new i.cj(b),u_boxSize:new i.cj(b),u_billboardSize:new i.cj(b),u_simpleShapeParameters:new i.ck(b),u_screenSize:new i.ck(b),u_thinningCenterPos:new i.ck(b),u_thinningShape:new i.ci(b),u_thinningAffectedRatio:new i.cj(b),u_thinningParticleOffset:new i.cj(b),u_particleColor:new i.d3(b),u_direction:new i.ci(b)}),rainParticle:b=>({u_modelview:new i.cl(b),u_projection:new i.cl(b),u_time:new i.cj(b),u_cam_pos:new i.ci(b),u_texScreen:new i.ch(b),u_velocityConeAperture:new i.cj(b),u_velocity:new i.cj(b),u_boxSize:new i.cj(b),u_rainDropletSize:new i.ck(b),u_distortionStrength:new i.cj(b),u_rainDirection:new i.ci(b),u_color:new i.d3(b),u_screenSize:new i.ck(b),u_thinningCenterPos:new i.ck(b),u_thinningShape:new i.ci(b),u_thinningAffectedRatio:new i.cj(b),u_thinningParticleOffset:new i.cj(b),u_shapeDirectionalPower:new i.cj(b),u_shapeNormalPower:new i.cj(b),u_mode:new i.cj(b)}),vignette:b=>({u_vignetteShape:new i.ci(b),u_vignetteColor:new i.d3(b)}),occlusion:b=>({u_matrix:new i.cl(b),u_anchorPos:new i.ci(b),u_screenSizePx:new i.ck(b),u_occluderSizePx:new i.ck(b),u_color:new i.d3(b)})};class Lh{constructor(d,m,w,M){this.id=Lh.uniqueIdxCounter,Lh.uniqueIdxCounter++,this.context=d;const O=d.gl;this.buffer=O.createBuffer(),this.dynamicDraw=!!w,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),O.bufferData(O.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||M||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Lh.uniqueIdxCounter,Lh.uniqueIdxCounter++;const m=this.context.gl;this.context.unbindVAO(),this.bind(),m.bufferSubData(m.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Lh.uniqueIdxCounter=0;const l5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class wP{constructor(d,m,w,M,O,D){this.length=m.length,this.attributes=w,this.itemSize=m.bytesPerElement,this.dynamicDraw=M,this.instanceCount=D,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||O||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,m){for(let w=0;w0&&d.vertexAttribDivisor(O,w)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class jP{constructor(d,m,w,M,O){this.context=d,this.width=m,this.height=w;const D=this.framebuffer=d.gl.createFramebuffer();M>0&&(this.colorAttachment0=new zk(d,D,0)),M>1&&(this.colorAttachment1=new zk(d,D,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new zy(d,D):new Tv(d,D))}createColorAttachment(d,m){m===0?this.colorAttachment0=new zk(d,this.framebuffer,0):m===1&&(this.colorAttachment1=new zk(d,this.framebuffer,1))}removeColorAttachment(d,m){const w=this.context.gl;let M;m===0?(M=this.colorAttachment0.get(),this.colorAttachment0=void 0):m===1&&(M=this.colorAttachment1.get(),this.colorAttachment1=void 0),M&&w.deleteTexture(M)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const m=this.colorAttachment0.get();m&&d.deleteTexture(m)}if(this.colorAttachment1){const m=this.colorAttachment1.get();m&&d.deleteTexture(m)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const m=this.depthAttachment.get();m&&d.deleteRenderbuffer(m)}else{const m=this.depthAttachment.get();m&&d.deleteTexture(m)}d.deleteFramebuffer(this.framebuffer)}}class Vy{constructor(d,m){this.gl=d,this.clearColor=new Yae(this),this.clearDepth=new rP(this),this.clearStencil=new V3(this),this.colorMask=new Lk(this),this.depthMask=new H3(this),this.stencilMask=new Xg(this),this.stencilFunc=new Oy(this),this.stencilOp=new Cv(this),this.stencilTest=new Dy(this),this.depthRange=new nP(this),this.depthTest=new W3(this),this.depthFunc=new sP(this),this.blend=new Ry(this),this.blendFunc=new Ok(this),this.blendColor=new Dk(this),this.blendEquation=new G3(this),this.cullFace=new Rk(this),this.cullFaceSide=new Mv(this),this.frontFace=new aP(this),this.program=new iP(this),this.activeTexture=new oP(this),this.viewport=new Fy(this),this.bindFramebuffer=new lP(this),this.bindRenderbuffer=new Xae(this),this.bindTexture=new Qae(this),this.bindVertexBuffer=new Jae(this),this.bindElementBuffer=new K3(this),this.bindVertexArrayOES=new Z3(this),this.pixelStoreUnpack=new Y3(this),this.pixelStoreUnpackPremultiplyAlpha=new X3(this),this.pixelStoreUnpackFlipY=new cP(this),this.options=m?Object.assign({},m):{},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=m&&!!m.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,m,w){return new Lh(this,d,m,w)}createVertexBuffer(d,m,w,M,O){return new wP(this,d,m,w,M,O)}createRenderbuffer(d,m,w){const M=this.gl,O=M.createRenderbuffer();return this.bindRenderbuffer.set(O),M.renderbufferStorage(M.RENDERBUFFER,d,m,w),this.bindRenderbuffer.set(null),O}createFramebuffer(d,m,w,M){return new jP(this,d,m,w,M)}clear({color:d,depth:m,stencil:w,colorMask:M}){const O=this.gl;let D=0;d&&(D|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(M||[!0,!0,!0,!0])),m!==void 0&&(D|=O.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),w!==void 0&&(D|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(w),this.stencilMask.set(255)),O.clear(D)}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){i.by(d.blendFunction,as.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 ex;function Yr(b,d,m,w,M,O,D){const B=b.context,H=B.gl,Y=b.transform,Q=[i.aF(Y.center.lng),i.aJ(Y.center.lat)],ce=m.layout.get("symbol-placement"),le=m.layout.get("text-variable-anchor"),de=m.layout.get("icon-rotation-alignment")==="map",we=m.layout.get("text-rotation-alignment")==="map",ve=ce!=="point",De=[];let Pe=0,Ve=0;for(let it=0;it0){const zr=i.bC(),Gr=Nr;i.cP(zr,Lt.placementInvProjMatrix,Y.glCoordMatrix),i.cP(zr,zr,Lt.placementViewportMatrix),De.push({circleArray:sn,circleOffset:Ve,transform:Gr,invTransform:zr,projection:Lt.getProjection()}),Pe+=sn.length/4,Ve=Pe}if(!br)continue;b.terrain&&b.terrain.setupElevationDraw(Dt,Hr);const Jr=dr?[St.canonical.x,St.canonical.y,1<=0&&(de[Xe.associatedIconIndex]={x:Lt,y:Ht,z:Wt,angle:Jt})}else Eh(ut,ce)}if(Y){le.clear();const Ve=b.icon.placedSymbolArray;for(let Xe=0;Xe{let Qs=[0,0,0];if(va){const ls=b.style.directionalLight,ii=b.style.ambientLight;ls&&ii&&(Qs=_p(b.style,ls,ii))}return Qs},ia=va=>{it.depthOcclusionForSymbolsAndCircles&&(m.hasOcclusionOpacityProperties||b.terrain)&&(va.push("DEPTH_D24"),va.push("DEPTH_OCCLUSION"))},Wn=va=>{m.lut&&!ut&&(m.lut.texture||(m.lut.texture=new i.d$(b.context,m.lut.image,[m.lut.image.height,m.lut.image.height,m.lut.image.height],xt.gl.RGBA8)),xt.activeTexture.set(xt.gl.TEXTURE0+Ml.LUT),m.lut.texture&&m.lut.texture.bind(xt.gl.LINEAR,xt.gl.CLAMP_TO_EDGE),va.push("APPLY_LUT_ON_GPU"))},ya=()=>{const va=St&&m.layout.get("symbol-placement")!=="point",Qs=[];ia(Qs),Wn(Qs);const ls=va||Xn,ii=br.elevationType==="road",eo=b.shadowRenderer,Di=ii&&Lt&&!!eo&&eo.enabled,Ha=ln(Di),sd=ii&&Lt&&!b.terrain?$t:_r,sc=m.paint.get("icon-image-cross-fade");b.terrainRenderModeElevated()&&Lt&&Qs.push("PITCH_WITH_MAP_TERRAIN"),sn&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),sc>0&&br.hasAnySecondaryIcon&&Qs.push("ICON_TRANSITION"),!br.icon.zOffsetVertexBuffer||ii&&b.terrain||Qs.push("Z_OFFSET"),Pe===0&&Ve===0&&Xe===0&&We===1||Qs.push("COLOR_ADJUSTMENT"),br.sdfIcons&&Qs.push("RENDER_SDF"),Di&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ii&&Lt&&!b.terrain&&br.icon.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS");const Ho=br.icon.programConfigurations.get(m.id),bc=b.getOrCreateProgram("symbol",{config:Ho,defines:Qs}),wc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Ul=br.iconSizeData,ku=i.bK(Ul,it.zoom),sh=Lt||!it.isOrthographic,Cd=xl(zr,Nr.tileID.canonical,Lt,St,it,br.getProjection(),Gr),Gi=xp(zr,Nr.tileID.canonical,Lt,St,it,br.getProjection(),Gr),io=b.translatePosMatrix(Gi,Nr,B,Y,!0),Wa=b.translatePosMatrix(zr,Nr,B,Y),bo=ls?Ov:Cd,Ui=St&&!Lt&&!va;let Ri=Tr;!Vt&&!it.mercatorFromTransition||St||(Ri=wp(it));const ah=sn?Ri:Tr,Kv=m.getColorAdjustmentMatrix(Pe,Ve,Xe,We),Rh=Zk(Ul.kind,ku,Ui,Lt,b,Wa,bo,io,bt,!1,wc,[0,0],0,Hr,Jr,Tt,Rs,ah,br.getProjection(),Ha,fa,Kv,sc,null),Zv=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,Jy=m.layout.get("icon-size").constantOr(0)!==1||br.iconsNeedLinear,Cf=br.sdfIcons||b.options.rotating||b.options.zooming||Jy||sh?ct.LINEAR:ct.NEAREST,Ep=br.sdfIcons&&m.paint.get("icon-halo-width").constantOr(1)!==0,e0=b.terrain&&Lt&&va?i.bl(i.bC(),Cd):Ov;if(va&&br.icon){const Gm=i.bV.getAtTileOffsetFunc(Hr,it.center.lat,it.worldSize,br.getProjection()),Ip=gp(zr,Nr.tileID.canonical,Lt,St,it,br.getProjection(),Gr),Fh=m.layout.get("icon-size-scale-range"),Pp=i.aA(b.scaleFactor,Fh[0],Fh[1]);GI(br,zr,b,!1,Ip,Gi,Lt,ve,Gm,Hr,Pp)}return{program:bc,buffers:br.icon,uniformValues:Rh,atlasTexture:Zv,atlasTextureIcon:null,atlasInterpolation:Cf,atlasInterpolationIcon:null,isSDF:br.sdfIcons,hasHalo:Ep,depthMode:sd,tile:Nr,renderWithShadows:Di,labelPlaneMatrixInv:e0}},Ra=()=>{const va=Dt&&m.layout.get("symbol-placement")!=="point",Qs=[],ls=va||Jt||Xn,ii=br.elevationType==="road",eo=b.shadowRenderer,Di=ii&&Ht&&!!eo&&eo.enabled,Ha=ln(Di),sd=ii&&Ht&&!b.terrain?$t:_r;b.terrainRenderModeElevated()&&Ht&&Qs.push("PITCH_WITH_MAP_TERRAIN"),sn&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),!br.text.zOffsetVertexBuffer||ii&&b.terrain||Qs.push("Z_OFFSET"),br.iconsInText&&Qs.push("RENDER_TEXT_AND_SYMBOL"),Qs.push("RENDER_SDF"),Di&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ii&&Ht&&!b.terrain&&br.text.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS"),ia(Qs);const sc=br.text.programConfigurations.get(m.id),Ho=b.getOrCreateProgram("symbol",{config:sc,defines:Qs});let bc,wc=[0,0],Ul=null;const ku=br.textSizeData;br.iconsInText&&(wc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Ul=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,bc=Ht||!it.isOrthographic||b.options.rotating||b.options.zooming||ku.kind==="composite"||ku.kind==="camera"?ct.LINEAR:ct.NEAREST);const sh=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture.size:[0,0],Cd=m.layout.get("text-size-scale-range"),Gi=i.aA(b.scaleFactor,Cd[0],Cd[1]),io=i.bK(ku,it.zoom,Gi),Wa=xl(zr,Nr.tileID.canonical,Ht,Dt,it,br.getProjection(),Gr),bo=xp(zr,Nr.tileID.canonical,Ht,Dt,it,br.getProjection(),Gr),Ui=b.translatePosMatrix(bo,Nr,H,Q,!0),Ri=b.translatePosMatrix(zr,Nr,H,Q),ah=ls?Ov:Wa,Kv=Dt&&!Ht&&!va;let Rh=Tr;!Vt&&!it.mercatorFromTransition||Dt||(Rh=wp(it));const Zv=Zk(ku.kind,io,Kv,Ht,b,Ri,ah,Ui,bt,!0,sh,wc,0,Hr,Jr,Tt,Rs,sn?Rh:Tr,br.getProjection(),Ha,fa,null,null,Gi),Jy=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture:null,Cf=ct.LINEAR,Ep=m.paint.get("text-halo-width").constantOr(1)!==0,e0=b.terrain&&Ht&&va?i.bl(i.bC(),Wa):Ov;if(va&&br.text){const Gm=i.bV.getAtTileOffsetFunc(Hr,it.center.lat,it.worldSize,br.getProjection()),Ip=gp(zr,Nr.tileID.canonical,Ht,Dt,it,br.getProjection(),Gr);GI(br,zr,b,!0,Ip,bo,Ht,De,Gm,Hr,Gi)}return{program:Ho,buffers:br.text,uniformValues:Zv,atlasTexture:Jy,atlasTextureIcon:Ul,atlasInterpolation:Cf,atlasInterpolationIcon:bc,isSDF:!0,hasHalo:Ep,depthMode:sd,tile:Nr,renderWithShadows:Di,labelPlaneMatrixInv:e0}},Ca=br.icon.segments.get().length,sa=br.text.segments.get().length,is=Ca&&!D.onlyText?ya():null,ga=sa&&!D.onlyIcons?Ra():null,$i=m.paint.get("icon-opacity").constantOr(1),xi=m.paint.get("text-opacity").constantOr(1);if(Wt&&br.canOverlap){sr=!0;const va=$i&&!D.onlyText?br.icon.segments.get():[],Qs=xi&&!D.onlyIcons?br.text.segments.get():[];for(const ls of va)dr.push({segments:new i.bg([ls]),sortKey:ls.sortKey,state:is});for(const ls of Qs)dr.push({segments:new i.bg([ls]),sortKey:ls.sortKey,state:ga})}else D.onlyText||dr.push({segments:$i?br.icon.segments:new i.bg([]),sortKey:0,state:is}),D.onlyIcons||dr.push({segments:xi?br.text.segments:new i.bg([]),sortKey:0,state:ga})}sr&&dr.sort((Hr,Nr)=>Hr.sortKey-Nr.sortKey);for(const Hr of dr){const Nr=Hr.state;if(Nr)if(b.terrain?b.terrain.setupElevationDraw(Nr.tile,Nr.program,{useDepthForOcclusion:it.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Nr.labelPlaneMatrixInv}):b.setupDepthForOcclusion(it.depthOcclusionForSymbolsAndCircles,Nr.program),xt.activeTexture.set(ct.TEXTURE0),Nr.atlasTexture&&Nr.atlasTexture.bind(Nr.atlasInterpolation,ct.CLAMP_TO_EDGE,!0),Nr.atlasTextureIcon&&(xt.activeTexture.set(ct.TEXTURE1),Nr.atlasTextureIcon&&Nr.atlasTextureIcon.bind(Nr.atlasInterpolationIcon,ct.CLAMP_TO_EDGE,!0)),Nr.renderWithShadows&&b.shadowRenderer.setupShadows(Nr.tile.tileID.toUnwrapped(),Nr.program,"vector-tile"),b.uploadCommonLightUniforms(b.context,Nr.program),Nr.hasHalo){const br=Nr.uniformValues;br.u_is_halo=1,c5(Nr.buffers,Hr.segments,m,b,Nr.program,Nr.depthMode,M,O,br,2),br.u_is_halo=0}else{if(Nr.isSDF){const br=Nr.uniformValues;Nr.hasHalo&&(br.u_is_halo=1,c5(Nr.buffers,Hr.segments,m,b,Nr.program,Nr.depthMode,M,O,br,1)),br.u_is_halo=0}c5(Nr.buffers,Hr.segments,m,b,Nr.program,Nr.depthMode,M,O,Nr.uniformValues,1)}}}function c5(b,d,m,w,M,O,D,B,H,Y){const Q=[b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer,b.iconTransitioningVertexBuffer,b.globeExtVertexBuffer,b.zOffsetVertexBuffer,b.orientationVertexBuffer];M.draw(w,w.context.gl.TRIANGLES,O,D,B,zn.disabled,H,m.id,b.layoutVertexBuffer,b.indexBuffer,d,m.paint,w.transform.zoom,b.programConfigurations.get(m.id),Q,Y)}function kP(b,d){const m=1<=Ph?1:de.pitch/Ph))),2*we}(b.transform),Y=b.transform.getFreeCameraOptions().position,Q="elevatedStructuresDepthReconstruct",ce=b.getOrCreateProgram(Q,{defines:["DEPTH_RECONSTRUCTION"]}),le=b.getOrCreateProgram(Q);for(const de of w){const we=d.getTile(de),ve=we.getBucket(m);if(!ve)continue;const De=ve.elevatedStructures;if(!De)continue;const Pe=ve.elevationBufferData.heightRange,Ve=kP(de.toUnwrapped(),Y),Xe=b.translatePosMatrix(de.projMatrix,we,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));let We,bt,ut,xt;if(M==="initialize"){if(!Pe||Pe.min>=1||De.depthSegments.segments[0].primitiveLength===0)continue;We=Qg(Xe,Ve,H,1,0),bt=D,ut=De.depthSegments,xt=ce}else if(M==="reset"){if(!Pe||Pe.min>=0||De.maskSegments.segments[0].primitiveLength===0)continue;We=Qg(Xe,Ve,0,0,1),bt=B,ut=De.maskSegments,xt=ce}else if(M==="geometry"){if(De.depthSegments.segments[0].primitiveLength===0)continue;We=Qg(Xe,Ve,H,1,0),bt=D,ut=De.depthSegments,xt=le}xt.draw(b,O.TRIANGLES,bt,$n.disabled,as.disabled,zn.disabled,We,m.id,De.vertexBuffer,De.indexBuffer,ut,m.paint,b.transform.zoom)}}function Qk(b,d,m,w){const{painter:M,sourceCache:O,layer:D,coords:B,colorMode:H,elevationType:Y,terrainEnabled:Q,pass:ce}=b,le=M.context.gl,de=D.paint.get("fill-pattern"),we=D.paint.get("fill-pattern-cross-fade"),ve=de.constantOr(null);let De=Y;Y!=="road"||d&&!Q||(De="none");const Pe=De==="road",Ve=b.painter.shadowRenderer,Xe=Pe&&!!Ve&&Ve.enabled,We=new dn(M.context.gl.LEQUAL,dn.ReadOnly,M.depthRangeFor3D);let bt=[0,0,0];if(Xe){const it=M.style.directionalLight,St=M.style.ambientLight;it&&St&&(bt=_p(M.style,it,St))}const ut=de&&de.constantOr(1),xt=M.terrain&&M.terrain.renderingToTexture,ct=(it,St)=>{let Dt,Lt,Ht,Wt,sr;St?(Dt=ut&&!D.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ht=le.LINES):(Dt=ut?"fillPattern":"fill",Ht=le.TRIANGLES);for(const _r of B){const $t=O.getTile(_r);if(ut&&!$t.patternsLoaded())continue;const Tt=$t.getBucket(D);if(!Tt)continue;const Jt=d?Tt.elevationBufferData:Tt.bufferData;if(Jt.isEmpty())continue;M.prepareDrawTile();const Vt=Jt.programConfigurations.get(D.id),dr=M.isTileAffectedByFog(_r),Tr=[],Hr=[];Pe&&(Tr.push("ELEVATED_ROADS"),Hr.push(Jt.elevatedLayoutVertexBuffer)),Xe&&Tr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),xt&&m&&Tr.push("USE_MRT1"),ut&&(M.context.activeTexture.set(le.TEXTURE0),$t.imageAtlasTexture&&$t.imageAtlasTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE),Vt.updatePaintBuffers());let Nr=!1;if(ve&&$t.imageAtlas){const Gr=$t.imageAtlas,kn=i.e3.from(ve),Xn=kn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Rs=kn.getSecondary(),fa=Gr.patternPositions.get(Xn),ln=Rs?Gr.patternPositions.get(Rs.scaleSelf(i.o.devicePixelRatio).toString()):null;Nr=!!fa&&!!ln,fa&&Vt.setConstantPatternPositions(fa,ln)}we>0&&(Nr||Vt.getPatternTransitionVertexBuffer("fill-pattern"))&&Tr.push("FILL_PATTERN_TRANSITION");const br=M.getOrCreateProgram(Dt,{config:Vt,overrideFog:dr,defines:Tr}),sn=M.translatePosMatrix(_r.projMatrix,$t,D.paint.get("fill-translate"),D.paint.get("fill-translate-anchor"));Xe&&Ve.setupShadows($t.tileID.toUnwrapped(),br,"vector-tile");const Jr=D.paint.get("fill-emissive-strength");if(St){Wt=Jt.lineIndexBuffer,sr=Jt.lineSegments;const Gr=M.terrain&&M.terrain.renderingToTexture?M.terrain.drapeBufferSize:[le.drawingBufferWidth,le.drawingBufferHeight];Lt=Dt==="fillOutlinePattern"&&ut?a5(sn,Jr,M,$t,Gr,bt,we):pP(sn,Jr,Gr,bt)}else Wt=Jt.indexBuffer,sr=Jt.triangleSegments,Lt=ut?s5(sn,Jr,M,$t,bt,we):n5(sn,Jr,bt);M.uploadCommonUniforms(M.context,br,_r.toUnwrapped());let zr=it;(Y==="road"&&!Q||Y==="offset")&&(zr=We),br.draw(M,Ht,zr,w||M.stencilModeForClipping(_r),H,zn.disabled,Lt,D.id,Jt.layoutVertexBuffer,Wt,sr,D.paint,M.transform.zoom,Vt,Hr)}};M.renderPass===ce&&ct(M.depthModeForSublayer(1,M.renderPass==="opaque"?dn.ReadWrite:dn.ReadOnly),!1),De==="none"&&M.renderPass==="translucent"&&D.paint.get("fill-antialias")&&ct(M.depthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,dn.ReadOnly),!0)}function Jk(b,d,m,w,M,O,D,B){m.resetLayerRenderingStats(b);const H=b.context,Y=H.gl,Q=b.transform,ce=m.paint.get("fill-extrusion-pattern"),le=m.paint.get("fill-extrusion-pattern-cross-fade"),de=ce.constantOr(null),we=ce.constantOr(1),ve=m.paint.get("fill-extrusion-opacity"),De=b.style.enable3dLights(),Pe=m.paint.get(De&&!we?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),Ve=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Pe],Xe=m.layout.get("fill-extrusion-edge-radius"),We=Xe>0&&!m.paint.get("fill-extrusion-rounded-roof"),bt=We?0:Xe,ut=Q.projection.name==="globe"?i.eb():0,xt=Q.projection.name==="globe",ct=xt?i.aj(Q.zoom):0,it=[i.aF(Q.center.lng),i.aJ(Q.center.lat)],St=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Dt=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(St?null:m.lut).toArray01().slice(0,3),Lt=m.paint.get("fill-extrusion-flood-light-intensity"),Ht=m.paint.get("fill-extrusion-vertical-scale"),Wt=m.paint.get("fill-extrusion-line-width").constantOr(1)!==0,sr=m.paint.get("fill-extrusion-height-alignment"),_r=m.paint.get("fill-extrusion-base-alignment"),$t=Pm(b,m.paint.get("fill-extrusion-cutoff-fade-range")),Tt=[];let Jt;xt&&Tt.push("PROJECTION_GLOBE_VIEW"),Ve[0]>0&&Tt.push("FAUX_AO"),We&&Tt.push("ZERO_ROOF_RADIUS"),B&&Tt.push("HAS_CENTROID"),Lt>0&&Tt.push("FLOOD_LIGHT"),$t.shouldRenderCutoff&&Tt.push("RENDER_CUTOFF"),Wt&&Tt.push("RENDER_WALL_MODE");const Vt=b.renderPass==="shadow",dr=b.shadowRenderer,Tr=Vt&&!!dr,Hr=Vt?zn.disabled:zn.backCCW;b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!0);let Nr=[0,0,0];if(dr){const Jr=b.style.directionalLight,zr=b.style.ambientLight;Jr&&zr&&(Nr=_p(b.style,Jr,zr)),Vt||(Tt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),dr.useNormalOffset&&Tt.push("NORMAL_OFFSET")),Jt=Tt.concat(["SHADOWS_SINGLE_CASCADE"])}const br=Tr?"fillExtrusionDepth":we?"fillExtrusionPattern":"fillExtrusion",sn=m.getLayerRenderingStats();for(const Jr of w){const zr=d.getTile(Jr),Gr=zr.getBucket(m);if(!Gr||Gr.projection.name!==Q.projection.name)continue;let kn=!1;dr&&(kn=dr.getMaxCascadeForTile(Jr.toUnwrapped())===0);const Xn=b.isTileAffectedByFog(Jr),Rs=Gr.programConfigurations.get(m.id);let fa=!1;if(de&&zr.imageAtlas){const sa=zr.imageAtlas,is=i.e3.from(de),ga=is.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),$i=is.getSecondary(),xi=sa.patternPositions.get(ga),va=$i?sa.patternPositions.get($i.scaleSelf(i.o.devicePixelRatio).toString()):null;fa=!!xi&&!!va,xi&&Rs.setConstantPatternPositions(xi,va)}le>0&&(fa||Rs.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Tt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const ln=b.getOrCreateProgram(br,{config:Rs,defines:kn?Jt:Tt,overrideFog:Xn});if(b.terrain&&b.terrain.setupElevationDraw(zr,ln,{useMeterToDem:!0}),!Gr.centroidVertexBuffer){const sa=ln.getAttributeLocation(Y,"a_centroid_pos");sa!==-1&&Y.vertexAttrib2f(sa,0,0)}!Vt&&dr&&dr.setupShadows(zr.tileID.toUnwrapped(),ln,"vector-tile"),we&&(b.context.activeTexture.set(Y.TEXTURE0),zr.imageAtlasTexture&&zr.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Rs.updatePaintBuffers());const ia=m.paint.get("fill-extrusion-vertical-gradient"),Wn=1/Gr.tileToMeter;let ya;if(Vt&&dr){if(kp(zr.tileID,Gr.maxHeight,b))continue;const sa=dr.calculateShadowPassMatrixFromTile(zr.tileID.toUnwrapped());ya=r5(sa,bt,Wn,Ht,sr,_r)}else{const sa=b.translatePosMatrix(Jr.expandedProjMatrix,zr,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),is=Q.projection.createInversionMatrix(Q,Jr.canonical);ya=we?fP(sa,b,ia,ve,Ve,bt,Wn,Jr,zr,ut,sr,_r,ct,it,is,Dt,Ht,le):Hk(sa,b,ia,ve,Ve,bt,Wn,Jr,ut,sr,_r,ct,it,is,Dt,Ht,Lt,Nr)}b.uploadCommonUniforms(H,ln,Jr.toUnwrapped(),null,$t);let Ra=Gr.segments;if(Q.projection.name==="mercator"&&!Vt&&(Ra=Gr.getVisibleSegments(zr.tileID,b.terrain,b.transform.getFrustum(0)),!Ra.get().length))continue;if(sn)if(Vt)for(const sa of Ra.get())sn.numRenderedVerticesInShadowPass+=sa.primitiveLength;else for(const sa of Ra.get())sn.numRenderedVerticesInTransparentPass+=sa.primitiveLength;const Ca=[];(b.terrain||B)&&Ca.push(Gr.centroidVertexBuffer),xt&&Ca.push(Gr.layoutVertexExtBuffer),Wt&&Ca.push(Gr.wallVertexBuffer),ln.draw(b,H.gl.TRIANGLES,M,O,D,Hr,ya,m.id,Gr.layoutVertexBuffer,Gr.indexBuffer,Ra,m.paint,b.transform.zoom,Rs,Ca)}b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!1)}class d5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function jp(b,d,m,w,M,O,D,B,H,Y,Q,ce,le,de,we,ve,De,Pe,Ve,Xe){const We=d.context,bt=We.gl,ut=d.transform,xt=d.transform.zoom,ct=[],it=b.translate,St=b.translateAnchor,Dt=b.edgeRadius,Lt=Pm(d,b.cutoffFadeRange);Q==="clear"?(ct.push("CLEAR_SUBPASS"),Xe&&(ct.push("CLEAR_FROM_TEXTURE"),We.activeTexture.set(bt.TEXTURE0),Xe.bind(bt.LINEAR,bt.CLAMP_TO_EDGE))):Q==="sdf"?ct.push("SDF_SUBPASS"):Q==="emissive"&&(ct.push("USE_MRT1"),We.activeTexture.set(bt.TEXTURE0),Xe.bind(bt.LINEAR,bt.CLAMP_TO_EDGE)),Pe&&ct.push("HAS_CENTROID"),Lt.shouldRenderCutoff&&ct.push("RENDER_CUTOFF");const Ht=(Wt,sr,_r,$t,Tt)=>{let Jt=ct;sr.groundRadiusBuffer!=null&&(Jt=ct.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Vt=sr.programConfigurations.get(w.id),dr=d.isTileAffectedByFog(Wt),Tr=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Vt,defines:Jt,overrideFog:dr}),Hr=Uy(d,$t,ce,Y,Tt,[le,de*Tt],we,ve,De,xt>=17?0:Dt*Tt,Xe?Xe.size[0]:0),Nr=[];Pe&&Nr.push(sr.hiddenByLandmarkVertexBuffer),sr.groundRadiusBuffer!=null&&Nr.push(sr.groundRadiusBuffer),d.uploadCommonUniforms(We,Tr,Wt.toUnwrapped(),null,Lt),Tr.draw(d,We.gl.TRIANGLES,O,D,B,H,Hr,w.id,sr.vertexBuffer,sr.indexBuffer,_r,w.paint,xt,Vt,Nr)};for(const Wt of M){const sr=m.getTile(Wt),_r=sr.getBucket(w);if(!_r||_r.projection.name!==ut.projection.name||!_r.groundEffect||_r.groundEffect&&!_r.groundEffect.hasData())continue;const $t=_r.groundEffect,Tt=1/_r.tileToMeter;{const Jt=d.translatePosMatrix(Wt.projMatrix,sr,it,St),Vt=$t.getDefaultSegment();Ht(Wt,$t,Vt,Jt,Tt)}if(Ve)for(let Jt=0;Jt<4;Jt++){const Vt=i.e9[Jt](Wt),dr=m.getTile(Vt);if(!dr)continue;const Tr=dr.getBucket(w);if(!Tr||Tr.projection.name!==ut.projection.name||!Tr.groundEffect||Tr.groundEffect&&!Tr.groundEffect.hasData())continue;const Hr=Tr.groundEffect;let Nr,br;Jt===0?(Nr=[-i.al,0,0],br=1):Jt===1?(Nr=[i.al,0,0],br=0):Jt===2?(Nr=[0,-i.al,0],br=3):(Nr=[0,i.al,0],br=2);const sn=Hr.regionSegments[br];if(!sn)continue;const Jr=new Float32Array(16);i.br(Jr,Wt.projMatrix,Nr),Ht(Wt,Hr,sn,d.translatePosMatrix(Jr,sr,it,St),Tt)}}}function aie(b,d,m,w,M,O,D){w.centroidVertexArray.length===0&&w.createCentroidsBuffer();const B=O?O.findDEMTileFor(m):null;if(!(B&&B.dem||D))return;O&&B&&B.dem&&w.selfDEMTileTimestamp!==B.dem._timestamp&&(w.borderDoneWithNeighborZ=[-1,-1,-1,-1],w.selfDEMTileTimestamp=B.dem._timestamp);const H=Pe=>new i.P(Math.ceil((Pe+i.ed)*i.ee),0),Y=Pe=>{const Ve=d.getSource().minzoom,Xe=bt=>{const ut=d.getTileByID(bt);if(ut&&ut.hasData())return ut.getBucket(M)},We=[0,-1,1];for(const bt of We){if(Pe.overscaledZ+bt(Q[0]=Math.min(Pe.min.y,Ve.min.y),Q[1]=Math.max(Pe.max.y,Ve.max.y),Q[2]=i.al-Ve.min.x>Pe.max.x?Ve.min.x-i.al:Pe.max.x,Q),le=(Pe,Ve)=>(Q[0]=Math.min(Pe.min.x,Ve.min.x),Q[1]=Math.max(Pe.max.x,Ve.max.x),Q[2]=i.al-Ve.min.y>Pe.max.y?Ve.min.y-i.al:Pe.max.y,Q),de=[(Pe,Ve)=>ce(Pe,Ve),(Pe,Ve)=>ce(Ve,Pe),(Pe,Ve)=>le(Pe,Ve),(Pe,Ve)=>le(Ve,Pe)],we=(Pe,Ve,Xe,We,bt,ut,xt)=>{if(!O)return 0;const ct=[[ut?Xe:Pe,ut?Pe:Xe,0],[ut?Xe:Ve,ut?Ve:Xe,0]],it=xt<0?i.al+xt:xt,St=[ut?it:(Pe+Ve)/2,ut?(Pe+Ve)/2:it,0];return Xe===0&&xt<0||Xe!==0&&xt>0?O.getForTilePoints(bt,[St],!0,We):ct.push(St),O.getForTilePoints(m,ct,!0,B),Math.max(ct[0][2],ct[1][2],St[2])/O.exaggeration()};for(let Pe=0;Pe<4;Pe++){const Ve=w.borderFeatureIndices[Pe];if(Ve.length===0)continue;const Xe=i.e9[Pe](m),We=Y(Xe);if(!(We&&We instanceof i.ea))continue;const bt=O?O.findDEMTileFor(Xe):null;if(!(bt&&bt.dem||D)||(O&&bt&&bt.dem&&w.borderDEMTileTimestamp[Pe]!==bt.dem._timestamp&&(w.borderDoneWithNeighborZ[Pe]=-1,w.borderDEMTileTimestamp[Pe]=bt.dem._timestamp),w.borderDoneWithNeighborZ[Pe]===We.canonical.z))continue;We.centroidVertexArray.length===0&&We.createCentroidsBuffer();const ut=(Pe<2?1:5)-Pe,xt=We.borderDoneWithNeighborZ[ut]!==w.canonical.z,ct=We.borderFeatureIndices[ut];let it=0;if(w.canonical.z!==We.canonical.z){for(const St of Ve)w.showCentroid(w.featuresOnBorder[St]);if(xt)for(const St of ct)We.showCentroid(We.featuresOnBorder[St]);w.borderDoneWithNeighborZ[Pe]=We.canonical.z,We.borderDoneWithNeighborZ[ut]=w.canonical.z}for(const St of Ve){const Dt=w.featuresOnBorder[St],Lt=w.centroidData[Dt.centroidDataIndex],Ht=Dt.borders[Pe];let Wt;for(;itHt[0]+3||sr[0]>Ht[0]-3)break;We.showCentroid(Wt),it++}if(Wt&&itHt[1]-3)&&(_r++,++it!==ct.length);)Wt=We.featuresOnBorder[ct[it]];Wt=We.featuresOnBorder[ct[sr]];let $t=!1;if(_r>=1){const Vt=Wt.borders[ut];Math.abs(Ht[0]-Vt[0])<3&&Math.abs(Ht[1]-Vt[1])<3&&(_r=1,$t=!0,it=sr+1)}else if(_r===0){w.showCentroid(Dt);continue}const Tt=We.centroidData[Wt.centroidDataIndex];D&&$t&&(((ve=Lt).flags|(De=Tt).flags)&i.ec?(ve.flags|=i.ec,De.flags|=i.ec):(ve.flags&=~i.ec,De.flags&=~i.ec));const Jt=Dt.intersectsCount()>1||Wt.intersectsCount()>1;if(_r>1)it=sr,Lt.centroidXY=Tt.centroidXY=new i.P(0,0);else if(bt&&bt.dem&&!Jt){const Vt=de[Pe](Lt,Tt),dr=Pe%2?i.al-1:0,Tr=we(Vt[0],Math.min(i.al-1,Vt[1]),dr,bt,Xe,Pe<2,Vt[2]);Lt.centroidXY=Tt.centroidXY=H(Tr)}else Jt?Lt.centroidXY=Tt.centroidXY=new i.P(0,0):(Lt.centroidXY=w.encodeBorderCentroid(Dt),Tt.centroidXY=We.encodeBorderCentroid(Wt));w.writeCentroidToBuffer(Lt),We.writeCentroidToBuffer(Tt)}else w.showCentroid(Dt)}w.borderDoneWithNeighborZ[Pe]=We.canonical.z,We.borderDoneWithNeighborZ[ut]=w.canonical.z}var ve,De;(w.needsCentroidUpdate||!w.centroidVertexBuffer&&w.centroidVertexArray.length!==0)&&w.uploadCentroid(b)}const Gd=[1,0,0],u5=[0,1,0],rd=[0,0,1];function kp(b,d,m){const w=m.transform,M=m.shadowRenderer;if(!M)return!0;const O=b.toUnwrapped(),D=w.tileSize*M._cascades[m.currentShadowCascade].scale;let B=d;if(w.elevation){const ve=w.elevation.getMinMaxForTile(b);ve&&(B+=ve.max)}const H=[...M.shadowDirection];H[2]=-H[2];const Y=M.computeSimplifiedTileShadowVolume(O,B,D,H);if(!Y)return!1;const Q=[Gd,u5,rd,H,[H[0],0,H[2]],[0,H[1],H[2]]],ce=w.projection.name==="globe",le=w.scaleZoom(D),de=i.cB.fromInvProjectionMatrix(w.invProjMatrix,w.worldSize,le,!ce),we=M.getCurrentCascadeFrustum();return de.intersectsPrecise(Y.vertices,Y.planes,Q)===0||we.intersectsPrecise(Y.vertices,Y.planes,Q)===0}function Rv(b){const{painter:d,source:m,layer:w,coords:M}=b;let O=b.defines;const D=d.context,B=d.renderPass==="shadow",H=d.renderPass==="light-beam",Y=d.shadowRenderer,Q=i.ef(d.transform.center.lat,d.transform.zoom),ce=Pm(d,w.paint.get("building-cutoff-fade-range"));ce.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),b.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const le of M){const de=m.getTile(le),we=de.getBucket(w);if(!we)continue;Y&&Y.getMaxCascadeForTile(le.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const ve=we.programConfigurations.get(w.id);let De,Pe,Ve,Xe=d.translatePosMatrix(le.expandedProjMatrix,de,[0,0],"map");if(Xe=i.cS(i.bC(),Xe,[1,1,b.verticalScale]),B&&Y){if(kp(de.tileID,we.maxHeight*Q,d))continue;let bt=Y.calculateShadowPassMatrixFromTile(de.tileID.toUnwrapped());bt=i.cS(i.bC(),bt,[1,1,b.verticalScale]),Ve=Bm(bt),De=Pe=d.getOrCreateProgram("buildingDepth",{config:ve,defines:O,overrideFog:!1})}else if(H)De=Pe=d.getOrCreateProgram("buildingBloom",{config:ve,defines:O,overrideFog:!1}),Ve=mP(Xe);else{const bt=d.transform.calculatePosMatrix(le.toUnwrapped(),d.transform.worldSize);i.cS(bt,bt,[1,1,b.verticalScale]);const ut=i.bC();i.cS(ut,bt,[1,-1,1/Q]),i.bl(ut,ut),i.eg(ut,ut);const xt=d.transform.getFreeCameraOptions().position,ct=1<{if(H){const xt=bt.entranceBloom;ut.draw(d,D.gl.TRIANGLES,b.depthMode,$n.disabled,b.blendMode,zn.disabled,Ve,w.id,xt.layoutVertexBuffer,xt.indexBuffer,xt.segmentsBucket,w.paint,d.transform.zoom,ve,[xt.layoutAttenuationBuffer,xt.layoutColorBuffer])}else{const xt=bt.segmentsBucket;let ct=[bt.layoutNormalBuffer,bt.layoutCentroidBuffer,bt.layoutColorBuffer,bt.layoutFloodLightDataBuffer];bt.layoutFacadePaintBuffer&&(ct=ct.concat([bt.layoutFacadeDataBuffer,bt.layoutFacadeVerticalRangeBuffer,bt.layoutFacadePaintBuffer])),ut.draw(d,D.gl.TRIANGLES,b.depthMode,$n.disabled,b.blendMode,B?zn.disabled:zn.backCW,Ve,w.id,bt.layoutVertexBuffer,bt.indexBuffer,xt,w.paint,d.transform.zoom,ve,ct)}};d.uploadCommonUniforms(D,Pe,le.toUnwrapped(),null,ce),we.buildingWithoutFacade&&We(we.buildingWithoutFacade,Pe),we.buildingWithFacade&&(De!==Pe&&d.uploadCommonUniforms(D,De,le.toUnwrapped(),null,ce),We(we.buildingWithFacade,De))}}function eN(b,d,m,w,M,O,D,B,H,Y,Q,ce,le){const de=b.context.gl,we=b.depthModeForSublayer(1,dn.ReadOnly,de.LEQUAL,!0),ve=.1*(1-(De=Q))+3*De;var De;const Pe=b._showOverdrawInspector,Ve=ce,Xe=new d5;Pe||jp(Xe,b,d,m,w,we,new $n({func:de.ALWAYS,mask:255},255,255,de.KEEP,de.KEEP,de.REPLACE),new as([de.ONE,de.ONE,de.ONE,de.ONE],i.ao.transparent,[!1,!1,!1,!0],de.MIN),zn.disabled,M,"sdf",O,D,B,H,Y,ve,Ve,!1);{const We=Pe?$n.disabled:new $n({func:de.EQUAL,mask:255},255,255,de.KEEP,de.DECR,de.DECR),bt=Pe?b.colorModeForRenderPass():new as([de.ONE_MINUS_DST_ALPHA,de.DST_ALPHA,de.ONE,de.ONE],i.ao.transparent,[!0,!0,!0,!0]);jp(Xe,b,d,m,w,we,We,bt,zn.disabled,M,"color",O,D,B,H,Y,ve,Ve,!1)}}function tN(b){return[b[0]*i.eh,b[1]*i.eh,b[2]*i.eh,0]}function Fv(b,d,m,w,M,O,D,B,H){const Y=w.getSource(),Q=m.globeSharedBuffers;if(!Q)return;let ce,le,de;if(d&&(ce=w.getTile(d)),Y instanceof i.aU?(le=Y.texture,de=i.dK(0,0,m.transform)):ce&&d&&(le=ce.texture,de=i.dK(d.canonical.z,d.canonical.x,m.transform)),!le||!de)return;b||(de=i.cS(i.bC(),de,[1,-1,1]));const we=m.context,ve=we.gl,De=M.paint.get("raster-resampling")==="nearest"?ve.NEAREST:ve.LINEAR,Pe=m.colorModeForDrapableLayerRenderPass(O),Ve=D.defines;Ve.push("GLOBE_POLES");const Xe=new dn(ve.LEQUAL,dn.ReadWrite,m.depthRangeFor3D),We=Float32Array.from(m.transform.expandedFarZProjMatrix),bt=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0))));m.terrain&&m.terrain.prepareDrawTile(),we.activeTexture.set(ve.TEXTURE0),le.bind(De,ve.CLAMP_TO_EDGE),we.activeTexture.set(ve.TEXTURE1),le.bind(De,ve.CLAMP_TO_EDGE),"useMipmap"in le&&we.extTextureFilterAnisotropic&&m.transform.pitch>20&&ve.texParameterf(ve.TEXTURE_2D,we.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,we.extTextureFilterAnisotropicMax);const[ut,xt,ct,it]=d?Q.getPoleBuffers(d.canonical.z,!1):Q.getPoleBuffers(0,!0),St=M.paint.get("raster-elevation");let Dt;b?(Dt=ut,m.renderDefaultNorthPole=St!==0):(Dt=xt,m.renderDefaultSouthPole=St!==0);const Lt=tN(D.mix),Ht=((sr,_r,$t,Tt,Jt,Vt,dr,Tr,Hr,Nr,br,sn,Jr)=>yP(sr,_r,$t,new Float32Array(16),new Float32Array(9),[0,0],Tt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Vt,[0,0],Tr,2,Nr,br,sn,1,0,Jr))(We,bt,de,i.aj(m.transform.zoom),0,M,0,St,0,Lt,D.offset,D.range,O),Wt=m.getOrCreateProgram("raster",{defines:Ve});m.uploadCommonUniforms(we,Wt,null),Wt.draw(m,ve.TRIANGLES,Xe,H,Pe,B,Ht,M.id,Dt,ct,it)}function NP(b){const d=b._nearZ,m=b.projection.farthestPixelDistance(b),w=m-d,M=.2*b.height,O=d+M;return[d,m,(O-M-d)/w,(O-d)/w]}function Np(b,d,m,w){if(b)return d instanceof nc&&b instanceof mp?d.getTextureDescriptor(b,m,!0):{texture:b.texture,mix:tN(w.mix),offset:w.offset,buffer:0,tileSize:1}}var ti=i.ei([{name:"a_index",type:"Int16",components:1}]);class rN{constructor(d,m,w,M){const O={width:w[0],height:w[1],data:null},D=d.gl;this.targetColorTexture=new i.T(d,O,D.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(d,O,D.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(m,M),this.lastInvalidatedAt=0}updateParticleTexture(d,m){if(this.particleTextureDimension===m.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const w=this.context.gl,M=m.width*m.height;this.particleTexture0=new i.T(this.context,m,w.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,m,w.RGBA8,{premultiply:!1,useMipmap:!1});const O=new i.ej;O.reserve(M);for(let D=0;D0){const Lt=i.bj(m.canonical,H),Ht=i.el(Lt);le=i.aB(new Float32Array(16),H.globeMatrix,Ht),i.aB(le,H.projMatrix,le)}const de=i.bC();de[12]+=2*M/(i.o.devicePixelRatio*H.width),de[13]+=2*O/(i.o.devicePixelRatio*H.height),i.aB(le,de,le);const we=b.getOrCreateProgram("debug",{defines:ce}),ve=d.getTileByID(m.key);b.terrain&&b.terrain.setupElevationDraw(ve,we);const De=dn.disabled,Pe=$n.disabled,Ve=b.colorModeForRenderPass(),Xe="$debug";B.activeTexture.set(Y.TEXTURE0),b.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Q?ve._makeGlobeTileDebugBuffers(b.context,H):ve._makeDebugTileBoundsBuffers(b.context,H.projection);const We=ve._tileDebugBuffer||b.debugBuffer,bt=ve._tileDebugIndexBuffer||b.debugIndexBuffer,ut=ve._tileDebugSegments||b.debugSegments;if(we.draw(b,Y.LINE_STRIP,De,Pe,Ve,zn.disabled,Pv(le,w.toPremultipliedRenderColor(null)),Xe,We,bt,ut,null,null,null,[ve._globeTileDebugBorderBuffer]),D){const Lt=ve.latestRawTileData,Ht=Math.floor((Lt&&Lt.byteLength||0)/1024);let Wt=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(Wt+=` => ${m.overscaledZ}`),Wt+=` ${ve.state}`,Wt+=` ${Ht}kb`,function(sr,_r){sr.initDebugOverlayCanvas();const $t=sr.debugOverlayCanvas,Tt=sr.context.gl,Jt=sr.debugOverlayCanvas.getContext("2d");Jt.clearRect(0,0,$t.width,$t.height),Jt.shadowColor="white",Jt.shadowBlur=2,Jt.lineWidth=1.5,Jt.strokeStyle="white",Jt.textBaseline="top",Jt.font="bold 36px Open Sans, sans-serif",Jt.fillText(_r,5,5),Jt.strokeText(_r,5,5),sr.debugOverlayTexture.update($t),sr.debugOverlayTexture.bind(Tt.LINEAR,Tt.CLAMP_TO_EDGE)}(b,Wt)}const xt=d.getTile(m).tileSize,ct=512/Math.min(xt,512)*(m.overscaledZ/H.zoom)*.5,it=ve._tileDebugTextBuffer||b.debugBuffer,St=ve._tileDebugTextIndexBuffer||b.quadTriangleIndexBuffer,Dt=ve._tileDebugTextSegments||b.debugSegments;we.draw(b,Y.TRIANGLES,De,Pe,as.alphaBlended,zn.disabled,Pv(le,i.ao.transparent.toPremultipliedRenderColor(null),ct),Xe,it,St,Dt,null,null,null,[ve._globeTileDebugTextBuffer])}function nx(b,d,m,w){Ft(b,0,d+m/2,b.transform.width,m,w)}function Wi(b,d,m,w){Ft(b,d-m/2,0,m,b.transform.height,w)}function Ft(b,d,m,w,M,O){const D=b.context,B=D.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*i.o.devicePixelRatio,m*i.o.devicePixelRatio,w*i.o.devicePixelRatio,M*i.o.devicePixelRatio),D.clear({color:O}),B.disable(B.SCISSOR_TEST)}const AP=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:nN}=AP;function jf(b,d,m,w){b.emplaceBack(d,m,w)}class sN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,jf(this.vertexArray,-1,-1,1),jf(this.vertexArray,1,-1,1),jf(this.vertexArray,-1,1,1),jf(this.vertexArray,1,1,1),jf(this.vertexArray,-1,-1,-1),jf(this.vertexArray,1,-1,-1),jf(this.vertexArray,-1,1,-1),jf(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,nN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function sx(b,d,m,w,M,O){const D=b.context.gl,B=d.paint.get("sky-atmosphere-color"),H=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),Q=((ce,le,de,we,ve)=>({u_matrix_3f:ce,u_sun_direction:le,u_sun_intensity:de,u_color_tint_r:[we.r,we.g,we.b,we.a],u_color_tint_m:[ve.r,ve.g,ve.b,ve.a],u_luminance:5e-5}))(i.eo(i.dO(),w),M,Y,B.toPremultipliedRenderColor(null),H.toPremultipliedRenderColor(null));D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+O,d.skyboxTexture,0),m.draw(b,D.TRIANGLES,dn.disabled,$n.disabled,as.unblended,zn.frontCW,Q,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const EP=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Hy{constructor(d){const m=new i.ep;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const w=new i.b0;w.emplaceBack(0,1,2),w.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(m,EP.members),this.indexBuffer=d.createIndexBuffer(w),this.segments=i.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const iie=i.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 oie{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class IP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new as([1,vf,1,vf],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new as([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new oie,this.updateNeeded=!0}update(d){const m=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Hy(m);const w=this.params.sizeRange,M=this.params.intensityRange,O=function(Q){const ce=i.eq(30),le=[];for(let de=0;de{const ct=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];xt&&ct.push("ALPHA_PASS");const it=d.getOrCreateProgram("globeAtmosphere",{defines:ct}),St=((Lt,Ht,Wt,sr,_r,$t,Tt,Jt,Vt,dr,Tr,Hr)=>({u_frustum_tl:Lt,u_frustum_tr:Ht,u_frustum_br:Wt,u_frustum_bl:sr,u_horizon:_r,u_transition:$t,u_fadeout_range:Tt,u_atmosphere_fog_color:Jt.toArray01(),u_high_color:Vt.toArray01(),u_space_color:dr.toArray01(),u_temporal_offset:Tr,u_horizon_angle:Hr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,De,Q,le,we,Ve,bt);d.uploadCommonUniforms(w,it);const Dt=this.atmosphereBuffer;Dt&&it.draw(d,M.TRIANGLES,D,$n.disabled,xt?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,zn.backCW,St,xt?"atmosphere_glow_alpha":"atmosphere_glow",Dt.vertexBuffer,Dt.indexBuffer,Dt.segments)};ut(!1),ut(!0)}drawStars(d,m){const w=i.aA(m.properties.get("star-intensity"),0,1);if(w===0)return;const M=d.context,O=M.gl,D=d.transform,B=d.getOrCreateProgram("stars"),H=i.c7([]);i.c9(H,H,-D._pitch),i.c8(H,H,-D.angle),i.c9(H,H,i.an(D._center.lat)),i.et(H,H,-i.an(D._center.lng));const Y=i.cc(new Float32Array(16),H),Q=i.aB([],D.starsProjMatrix,Y),ce=i.eo([],Y),le=i.eu([],ce),de=[0,1,0];i.dQ(de,de,le),i.c5(de,de,this.params.sizeMultiplier);const we=[1,0,0];i.dQ(we,we,le),i.c5(we,we,this.params.sizeMultiplier);const ve=(De=de,Pe=we,Ve=w,{u_matrix:Float32Array.from(Q),u_up:De,u_right:Pe,u_intensity_multiplier:Ve});var De,Pe,Ve;d.uploadCommonUniforms(M,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,dn.disabled,$n.disabled,this.colorModeAlphaBlendedWriteRGB,zn.disabled,ve,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class aN{constructor(){this.visibleTiles=[]}updateBorders(d,m){const w=[],M=[],O=d._getRenderableCoordinates(!1,!0);for(const H of O){const Y=d.getTile(H);if(!Y.hasData())continue;const Q=Y.getBucket(m);Q&&(Q.isEmpty()||(w.push(H.key),M.push({bucket:Q,tileID:H.canonical})))}let D=w.length!==this.visibleTiles.length;if(!D){w.sort();for(let H=0;HH.tileID.z-Y.tileID.z||H.tileID.x-Y.tileID.x||H.tileID.y-Y.tileID.y);for(const H of M){const Y=new Array,Q=new Array,ce=H.bucket;for(const le of ce.featuresOnBorder)B.has(le.featureId)?Q.push(le.footprintIndex):(B.add(le.featureId),Y.push(le.footprintIndex));ce.updateFootprintHiddenFlags(Y,i.ev,!1),ce.updateFootprintHiddenFlags(Q,i.ev,!0)}}}function iN(b,d){const m=[...b],w=d.cameraWorldSizeForFog/d.worldSize,M=i.bA([]);return i.cS(M,M,[w,w,1]),i.aB(m,M,m),i.aB(m,d.worldToFogMatrix,m),m}function oN(b,d,m,w,M){const O=m.material,D=w.context,{baseColorTexture:B,metallicRoughnessTexture:H}=O.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:Q,emissionTexture:ce}=O;function le(we,ve,De){if(we&&(b.push(ve),D.activeTexture.set(D.gl.TEXTURE0+De),we.gfxTexture)){const{minFilter:Pe,magFilter:Ve,wrapS:Xe,wrapT:We}=we.sampler;we.gfxTexture.bindExtraParam(Pe,Ve,Xe,We)}}le(B,"HAS_TEXTURE_u_baseColorTexture",Ml.BaseColor),le(H,"HAS_TEXTURE_u_metallicRoughnessTexture",Ml.MetallicRoughness),le(Y,"HAS_TEXTURE_u_normalTexture",Ml.Normal),le(Q,"HAS_TEXTURE_u_occlusionTexture",Ml.Occlusion),le(ce,"HAS_TEXTURE_u_emissionTexture",Ml.Emission),M&&(M.texture||(M.texture=new i.d$(w.context,M.image,[M.image.height,M.image.height,M.image.height],D.gl.RGBA8)),D.activeTexture.set(D.gl.TEXTURE0+Ml.LUT),M.texture&&M.texture.bind(D.gl.LINEAR,D.gl.CLAMP_TO_EDGE),b.push("APPLY_LUT_ON_GPU")),m.texcoordBuffer&&(b.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(m.texcoordBuffer)),m.colorBuffer&&(b.push(m.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(m.colorBuffer)),m.normalBuffer&&(b.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(m.normalBuffer)),m.pbrBuffer&&(b.push("HAS_ATTRIBUTE_a_pbr"),b.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(m.pbrBuffer)),O.alphaMode!=="OPAQUE"&&O.alphaMode!=="MASK"||b.push("UNPREMULT_TEXTURE_IN_SHADER"),O.defined||b.push("DIFFUSE_SHADED");const de=w.shadowRenderer;de&&(b.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&b.push("NORMAL_OFFSET"))}function lN(b,d,m,w,M,O){const D=b.modelOpacity,B=d.context,H=new dn(d.context.gl.LEQUAL,b.isLightMesh?dn.ReadOnly:dn.ReadWrite,d.depthRangeFor3D),Y=d.transform,Q=b.mesh,ce=Q.material,le=ce.pbrMetallicRoughness,de=d.style.fog;let we;we=d.transform.projection.zAxisUnit==="pixels"?[...b.nodeModelMatrix]:i.aB([],w.zScaleMatrix,b.nodeModelMatrix),i.aB(we,w.negCameraPosMatrix,we);const ve=i.bl([],we);i.eg(ve,ve);const De=m.paint.get("model-color-use-theme").constantOr("default")==="none",Pe=m.paint.get("model-emissive-strength").constantOr(0),Ve=Jg(new Float32Array(b.worldViewProjection),new Float32Array(we),new Float32Array(ve),null,d,D,le.baseColorFactor,ce.emissiveFactor,le.metallicFactor,le.roughnessFactor,ce,Pe,m,void 0,void 0,b.materialOverride,b.modelColor),Xe={defines:[]},We=[],bt=d.shadowRenderer;bt&&(bt.useNormalOffset=!1),oN(Xe.defines,We,Q,d,De?null:m.lut);let ut=null;if(de){const it=iN(b.nodeModelMatrix,d.transform);if(ut=new Float32Array(it),Y.projection.name!=="globe"){const St=Q.aabb.min,Dt=Q.aabb.max,[Lt,Ht]=de.getOpacityForBounds(it,St[0],St[1],Dt[0],Dt[1]);Xe.overrideFog=Lt>=ar||Ht>=ar}}const xt=Pm(d,m.paint.get("model-cutoff-fade-range"));xt.shouldRenderCutoff&&Xe.defines.push("RENDER_CUTOFF");const ct=d.getOrCreateProgram("model",Xe);d.uploadCommonUniforms(B,ct,null,ut,xt),d.renderPass!=="shadow"&&bt&&bt.setupShadowsFromMatrix(b.nodeModelMatrix,ct),ct.draw(d,B.gl.TRIANGLES,H,M,O,Q.material.doubleSided?zn.disabled:zn.backCCW,Ve,m.id,Q.vertexBuffer,Q.indexBuffer,Q.segments,m.paint,d.transform.zoom,void 0,We)}function zv(b,d){return b.style._importedAsBasemap?"basemap":d.scope}function ax(b,d,m,w,M,O,D,B,H,Y){const Q=b.transform,ce=!!d.isGeometryBloom&&d.isGeometryBloom;if(ce&&b.renderPass==="shadow")return;const le=Q.projection.name==="globe"?i.eD(m,Q):[...m];i.aB(le,le,d.globalMatrix);const de=i.aB([],w,le);if(d.meshes)for(const we of d.meshes){const ve=B.get(we.material.name);if(ve&&ve.opacity<=0)continue;if(we.material.alphaMode!=="BLEND"){D.push({mesh:we,depth:0,modelIndex:M,worldViewProjection:de,nodeModelMatrix:le,isLightMesh:ce,materialOverride:ve,modelOpacity:H,modelColor:Y});continue}const De=i.af([],we.centroid,de);!Q.isOrthographic&&De[2]<=0||O.push({mesh:we,depth:De[2],modelIndex:M,worldViewProjection:de,nodeModelMatrix:le,isLightMesh:ce,materialOverride:ve,modelOpacity:H,modelColor:Y})}if(d.children)for(const we of d.children)ax(b,we,m,w,M,O,D,B,H,Y)}function Oh(b,d,m,w){const M=m.shadowRenderer;if(!M)return;const O=M.getShadowPassDepthMode(),D=M.getShadowPassColorMode(),B=M.calculateShadowPassMatrixFromMatrix(d),H=o5(B);m.getOrCreateProgram("modelDepth",{defines:m._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(m,m.context.gl.TRIANGLES,O,$n.disabled,D,zn.disabled,H,w.id,b.vertexBuffer,b.indexBuffer,b.segments,w.paint,m.transform.zoom,void 0,void 0)}function PP(b,d,m,w,M,O){for(const D of M){const B=Object.assign({},w);B.part=D;const H={type:"Unknown",id:d,properties:B},Y={orientation:b.paint.get("model-rotation").evaluate(H,m)};O.set(D,Y)}}function LP(b,d,m,w,M,O){for(const D of M){const B=Object.assign({},w);B.part=D;const H={type:"Unknown",id:d,properties:B},Y={color:b.paint.get("model-color").evaluate(H,m),colorMix:b.paint.get("model-color-mix-intensity").evaluate(H,m),opacity:b.paint.get("model-opacity").evaluate(H,m),emissionStrength:b.paint.get("model-emissive-strength").evaluate(H,m)};O.set(D,Y)}}function OP(b,d,m,w,M){let O=!1;for(const B of w)B.modelOpacity!==1&&(lN(B,b,d,M[B.modelIndex],$n.disabled,as.disabled),O=!0);for(const B of w)lN(B,b,d,M[B.modelIndex],B.modelOpacity!==1?b.stencilModeFor3D():$n.disabled,b.colorModeForRenderPass());O&&b.resetStencilClippingMasks();const D=as.additive;for(const B of m)lN(B,b,d,M[B.modelIndex],$n.disabled,B.isLightMesh?D:b.colorModeForRenderPass())}function DP(b,d,m){const w=d.updateZoomBasedPaintProperties(),M=function(O,D,B){let H,Y,Q,ce=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&ce>0){const le=O.terrain,de=le.findDEMTileFor(B);de&&de.dem?H=i.eF.create(le,B,de):ce=0}if(ce===0&&(D.terrainElevationMin=0,D.terrainElevationMax=0),ce===D.validForExaggeration&&(ce===0||H&&H._demTile&&H._demTile.tileID===D.validForDEMTile.id&&H._dem._timestamp===D.validForDEMTile.timestamp))return!1;for(const le in D.instancesPerModel){const de=D.instancesPerModel[le];for(let we=0;weY&&(Y=de.max)}const Q=i.aA(w.x,O,D)-w.x,ce=i.aA(w.y,B,H)-w.y,le=i.cf(Y,d.center.lat)-w.z;return d._zoomFromMercatorZ(Math.sqrt(Q*Q+ce*ce+le*le))}function RP(b,d,m,w,M,O,D){const B=b.context,H=b.renderPass==="shadow",Y=b.shadowRenderer,Q=H&&Y?Y.getShadowPassDepthMode():new dn(B.gl.LEQUAL,dn.ReadWrite,b.depthRangeFor3D),ce=b.isTileAffectedByFog(O),le=b.transform.projection.name==="globe";if(m.meshes)for(const de of m.meshes){const we=le?[]:["MODEL_POSITION_ON_GPU"],ve=[];let De,Pe,Ve;const Xe=!le&&w.instancedDataArray.length>20;Xe&&we.push("INSTANCED_ARRAYS");const We=Pm(b,d.paint.get("model-cutoff-fade-range"));if(We.shouldRenderCutoff&&we.push("RENDER_CUTOFF"),H&&Y)De=b.getOrCreateProgram("modelDepth",{defines:we}),Pe=o5(D.shadowTileMatrix,D.shadowTileMatrix,Float32Array.from(m.globalMatrix)),Ve=Y.getShadowPassColorMode();else{oN(we,ve,de,b,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),De=b.getOrCreateProgram("model",{defines:we,overrideFog:ce});const ut=de.material,xt=ut.pbrMetallicRoughness,ct=d.paint.get("model-opacity").constantOr(1),it=d.paint.get("model-emissive-strength").constantOr(0);Pe=Jg(O.expandedProjMatrix,Float32Array.from(m.globalMatrix),new Float32Array(16),null,b,ct,xt.baseColorFactor,ut.emissiveFactor,xt.metallicFactor,xt.roughnessFactor,ut,it,d,M),Y&&(D.shadowUniformsInitialized?De.setShadowUniformValues(B,Y.getShadowUniformValues()):(Y.setupShadows(O.toUnwrapped(),De,"model-tile"),D.shadowUniformsInitialized=!0)),Ve=We.shouldRenderCutoff||ct<1||ut.alphaMode!=="OPAQUE"?as.alphaBlended:as.unblended}b.uploadCommonUniforms(B,De,O.toUnwrapped(),null,We);const bt=de.material.doubleSided?zn.disabled:zn.backCCW;if(Xe)ve.push(w.instancedDataBuffer),De.draw(b,B.gl.TRIANGLES,Q,$n.disabled,Ve,bt,Pe,d.id,de.vertexBuffer,de.indexBuffer,de.segments,d.paint,b.transform.zoom,void 0,ve,w.instancedDataArray.length);else{const ut=H?"u_instance":"u_normal_matrix";for(let xt=0;xtH[1]?D:H,O[0]=m.max[0],D=i.aC(i.eG(),O,M),B=D[1]H[1]?D:H,O[1]=m.min[1],D=i.aC(i.eG(),O,M),B=D[1]H[1]?D:H;const Y=i.aA(w[0],0,1),Q=100*d.pixelsPerMeter*i.aA(w[1],0,1),ce=i.aA(w[2],0,1),le=i.eH(i.eG(),B,H,Y),de=Math.tan(.5*d.fovX),we=-le[2]*de;if(Q===0)return le[1]<-Math.abs(we)?ce:1;const ve=(-Math.abs(we)-le[1])/Q,De=(Ve,Xe,We)=>(1-We)*Ve+We*Xe,Pe=i.aA(De(1,ce,ve),ce,1);return De(1,Pe,i.aA((d.pitch-20)/20,0,1))}class FP{}class qm{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,m,w){{const ce=this._storage.get(m.id);if(ce)return ce.lastUsedFrameIdx=d,ce.buf}const M=w.gl,O=M.getBufferParameter(M.ELEMENT_ARRAY_BUFFER,M.BUFFER_SIZE),D=new ArrayBuffer(O),B=new Int16Array(D);M.getBufferSubData(M.ELEMENT_ARRAY_BUFFER,0,new Int16Array(D));const H=new i.eJ;for(let ce=0;ce30&&(w.buf.destroy(),this._storage.delete(m))}destroy(){for(const[d,m]of this._storage)m.buf.destroy(),this._storage.delete(d)}}class Wy{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Gy=i.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Sp{constructor(d){this.revealStart=11,this.revealRange=2}}const f5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class p5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,m){const w=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const D=new i.eK,B=new i.b0;D.emplaceBack(-1,-1),D.emplaceBack(1,-1),D.emplaceBack(1,1),D.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(D,f5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const M=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,w);const D={u_vignetteShape:(O={vignetteShape:[m.start,m.range,Math.pow(10,m.fadePower)],vignetteColor:[m.color.r,m.color.g,m.color.b,m.color.a*m.strength]}).vignetteShape,u_vignetteColor:O.vignetteColor};w.draw(d,d.context.gl.TRIANGLES,dn.disabled,$n.disabled,as.alphaBlended,zn.disabled,D,"vignette",this.vignetteVx,this.vignetteIdx,M)}var O}}class m5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,m){const w=d.getFreeCameraOptions().position,M=w.toAltitude(),O=w.toLngLat(),D=i.an(O.lng),B=i.an(O.lat),H=d.pixelsPerMeter/m,Y=D*i.eM,Q=i.eM*Math.log(Math.tan(Math.PI/4+B/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)*H,this._accumulatedOffsetY+=ce*H,this._accumulatedElevation+=le*H,this._offsetXPrev=Y,this._offsetYPrev=Q,this._elevationPrev=M}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function cN(b,d){return[-(b[0]-Math.floor(b[0]/d)*d),-(b[1]-Math.floor(b[1]/d)*d),-(b[2]-Math.floor(b[2]/d)*d)]}function wu(b){const d=i.eq(1323123451230),m=[];for(let w=0;w 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 m=d.context;if(!this.particlesVx){const w=wu(this.particlesCount),M=new i.eN,O=new i.b0;let D=0;const B=i.eq(1323123451230);for(let H=0;Hw)return;const M=Nd(0,1,m.revealStart,m.revealStart+m.revealRange,w);if(!this.particlesVx||!this.particlesIdx)return;const O=structuredClone(this._params);let D=[-O.direction.x,O.direction.y,-100];i.aw(D,D);const B=structuredClone(this._vignetteParams);B.strength*=M,O.overrideStyleParameters||(O.intensity=d.style.rain.state.density,O.timeFactor=d.style.rain.state.intensity,O.color=structuredClone(d.style.rain.state.color),D=structuredClone(d.style.rain.state.direction),O.screenThinning.intensity=d.style.rain.state.centerThinning,O.dropletSizeX=d.style.rain.state.dropletSize[0],O.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],O.distortionStrength=100*d.style.rain.state.distortionStrength,B.strength=1,B.color=structuredClone(d.style.rain.state.vignetteColor));const H=this.updateOnRender(d,O.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 i.T(Y,{width:d.width,height:d.height,data:null},Q.RGBA8)),O.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=[O.color.r,O.color.g,O.color.b,O.color.a],we=(ve,De)=>{const Pe=cN(this._movement.getPosition(),ve),Ve=O.dropletSizeX,Xe=O.dropletSizeX*O.dropletSizeYScale,We=d.width/2,bt=d.height/2,ut=Nd(0,O.screenThinning.start,0,1,O.screenThinning.intensity),xt=Nd(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),ct=Nd(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),it=(St={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Pe,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:ve,rainDropletSize:[Ve,Xe],distortionStrength:O.distortionStrength,rainDirection:D,color:de,screenSize:[ce.width,ce.height],thinningCenterPos:[We,bt],thinningShape:[ut,xt,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:ct,shapeDirectionalPower:O.shapeDirPower,shapeNormalPower:O.shapeNormalPower,mode:De?0:1},{u_modelview:Float32Array.from(St.modelview),u_projection:Float32Array.from(St.projection),u_time:St.time,u_cam_pos:St.camPos,u_texScreen:0,u_velocityConeAperture:St.velocityConeAperture,u_velocity:St.velocity,u_boxSize:St.boxSize,u_rainDropletSize:St.rainDropletSize,u_distortionStrength:St.distortionStrength,u_rainDirection:St.rainDirection,u_color:St.color,u_screenSize:St.screenSize,u_thinningCenterPos:St.thinningCenterPos,u_thinningShape:St.thinningShape,u_thinningAffectedRatio:St.thinningAffectedRatio,u_thinningParticleOffset:St.thinningParticleOffset,u_shapeDirectionalPower:St.shapeDirectionalPower,u_shapeNormalPower:St.shapeNormalPower,u_mode:St.mode});var St;const Dt=Math.round(O.intensity*this.particlesCount),Lt=i.bg.simpleSegment(0,0,4*Dt,2*Dt);le.draw(d,Q.TRIANGLES,dn.disabled,$n.disabled,as.alphaBlended,zn.disabled,it,"rain_particles",this.particlesVx,this.particlesIdx,Lt)};O.distortionStrength>0&&we(O.boxSize,!0),we(O.boxSize,!1),this._vignette.draw(d,B)}}const g5=i.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 x5 extends ix{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 Sp("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 m=d.context;if(!this.particlesVx){const w=wu(this.particlesCount),M=new i.eO,O=new i.b0;let D=0;const B=i.eq(1323123451230);for(let H=0;HD)return;const B=Nd(0,1,O.revealStart,O.revealStart+O.revealRange,D);M.strength*=B,m.overrideStyleParameters||(m.intensity=d.style.snow.state.density,m.timeFactor=d.style.snow.state.intensity,m.color=structuredClone(d.style.snow.state.color),w=structuredClone(d.style.snow.state.direction),m.screenThinning.intensity=d.style.snow.state.centerThinning,m.billboardSize=2.79*d.style.snow.state.flakeSize,M.strength=1,M.color=structuredClone(d.style.snow.state.vignetteColor));const H=this.updateOnRender(d,m.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,we,ve)=>{const De=cN(this._movement.getPosition(),de),Pe=ce.width/2,Ve=ce.height/2,Xe=Nd(0,ve.screenThinning.start,0,1,ve.screenThinning.intensity),We=Nd(.001,ve.screenThinning.range,0,1,ve.screenThinning.intensity),bt=Nd(0,ve.screenThinning.particleOffset,0,1,ve.screenThinning.intensity),ut=(xt={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:De,velocityConeAperture:ve.velocityConeAperture,velocity:ve.velocity,horizontalOscillationRadius:ve.horizontalOscillationRadius,horizontalOscillationRate:ve.horizontalOscillationRate,boxSize:de,billboardSize:1*ve.billboardSize,simpleShapeParameters:[ve.shapeFadeStart,ve.shapeFadePower],screenSize:[ce.width,ce.height],thinningCenterPos:[Pe,Ve],thinningShape:[Xe,We,Math.pow(10,ve.screenThinning.fadePower)],thinningAffectedRatio:ve.screenThinning.affectedRatio,thinningParticleOffset:bt,color:[ve.color.r,ve.color.g,ve.color.b,ve.color.a],direction:w},{u_modelview:Float32Array.from(xt.modelview),u_projection:Float32Array.from(xt.projection),u_time:xt.time,u_cam_pos:xt.camPos,u_velocityConeAperture:xt.velocityConeAperture,u_velocity:xt.velocity,u_horizontalOscillationRadius:xt.horizontalOscillationRadius,u_horizontalOscillationRate:xt.horizontalOscillationRate,u_boxSize:xt.boxSize,u_billboardSize:xt.billboardSize,u_simpleShapeParameters:xt.simpleShapeParameters,u_screenSize:xt.screenSize,u_thinningCenterPos:xt.thinningCenterPos,u_thinningShape:xt.thinningShape,u_thinningAffectedRatio:xt.thinningAffectedRatio,u_thinningParticleOffset:xt.thinningParticleOffset,u_particleColor:xt.color,u_direction:xt.direction});var xt;const ct=Math.round(ve.intensity*this.particlesCount),it=i.bg.simpleSegment(0,0,4*ct,2*ct);this.particlesVx&&this.particlesIdx&&le.draw(d,Q.TRIANGLES,dn.disabled,$n.disabled,as.alphaBlended,zn.disabled,ut,"snow_particles",this.particlesVx,this.particlesIdx,it)})(m.boxSize,0,m),this._vignette.draw(d,M)}}const Vm={symbol:function(b,d,m,w,M){if(b.renderPass!=="translucent")return;const O=$n.disabled,D=b.colorModeForRenderPass(),B=m.layout.get("text-variable-anchor"),H=m.layout.get("text-size-scale-range"),Y=i.aA(b.scaleFactor,H[0],H[1]);B&&function(le,de,we,ve,De,Pe,Ve,Xe){const We=de.transform,bt=De==="map",ut=Pe==="map";for(const xt of le){const ct=ve.getTile(xt),it=ct.getBucket(we);if(!it||!it.text||!it.text.segments.get().length)continue;const St=i.bK(it.textSizeData,We.zoom,Xe),Dt=Hn(xt,it.getProjection(),We),Lt=We.calculatePixelsToTileUnitsMatrix(ct),Ht=xl(Dt,ct.tileID.canonical,ut,bt,We,it.getProjection(),Lt),Wt=it.hasIconTextFit()&&it.hasIconData();St&&An(it,bt,ut,Ve,We,Ht,xt,Math.pow(2,We.zoom-ct.tileID.overscaledZ),St,Wt)}}(w,b,m,d,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),M,Y);const Q=m.paint.get("icon-opacity").constantOr(1)!==0,ce=m.paint.get("text-opacity").constantOr(1)!==0;m.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(Q||ce)?Dv(b,d,m,w,O,D):(Q&&Dv(b,d,m,w,O,D,{onlyIcons:!0}),ce&&Dv(b,d,m,w,O,D,{onlyText:!0})),d.map.showCollisionBoxes&&(Yr(b,d,m,w,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),Yr(b,d,m,w,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(b,d,m,w){if(b.renderPass!=="translucent")return;const M=m.paint.get("circle-opacity"),O=m.paint.get("circle-stroke-width"),D=m.paint.get("circle-stroke-opacity"),B=m.layout.get("circle-sort-key").constantOr(1)!==void 0,H=m.paint.get("circle-emissive-strength");if(M.constantOr(1)===0&&(O.constantOr(1)===0||D.constantOr(1)===0))return;const Y=b.context,Q=Y.gl,ce=b.transform,le=!(!b.terrain||!b.terrain.enabled),de=m.layout.get("circle-elevation-reference"),we=b.depthModeForSublayer(0,dn.ReadOnly),ve=new dn(b.context.gl.LEQUAL,dn.ReadOnly,b.depthRangeFor3D),De=de==="none"||le?we:ve,Pe=$n.disabled,Ve=b.colorModeForDrapableLayerRenderPass(H),Xe=ce.projection.name==="globe",We=[i.aF(ce.center.lng),i.aJ(ce.center.lat)],bt=[];for(let xt=0;xtxt.sortKey-ct.sortKey);const ut={useDepthForOcclusion:ce.depthOcclusionForSymbolsAndCircles};for(const xt of bt){const{programConfiguration:ct,program:it,layoutVertexBuffer:St,dynamicBuffers:Dt,indexBuffer:Lt,uniformValues:Ht,tile:Wt}=xt.state,sr=xt.segments;b.terrain&&b.terrain.setupElevationDraw(Wt,it,ut),b.uploadCommonUniforms(Y,it,Wt.tileID.toUnwrapped()),it.draw(b,Q.TRIANGLES,De,Pe,Ve,zn.disabled,Ht,m.id,St,Lt,sr,m.paint,ce.zoom,ct,Dt)}},heatmap:function(b,d,m,w){if(m.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const M=b.context,O=M.gl,D=$n.disabled,B=new as([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(de,we,ve,De){const Pe=de.gl,Ve=we.width*De,Xe=we.height*De;de.activeTexture.set(Pe.TEXTURE1),de.viewport.set([0,0,Ve,Xe]);let We=ve.heatmapFbo;if(!We||We&&(We.width!==Ve||We.height!==Xe)){We&&We.destroy();const bt=Pe.createTexture();Pe.bindTexture(Pe.TEXTURE_2D,bt),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_S,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_T,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MIN_FILTER,Pe.LINEAR),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MAG_FILTER,Pe.LINEAR),We=ve.heatmapFbo=de.createFramebuffer(Ve,Xe,1,null),function(ut,xt,ct,it,St,Dt){const Lt=ut.gl;Lt.texImage2D(Lt.TEXTURE_2D,0,ut.extRenderToTextureHalfFloat?Lt.RGBA16F:Lt.RGBA,St,Dt,0,Lt.RGBA,ut.extRenderToTextureHalfFloat?Lt.HALF_FLOAT:Lt.UNSIGNED_BYTE,null),it.colorAttachment0.set(ct)}(de,0,bt,We,Ve,Xe)}else Pe.bindTexture(Pe.TEXTURE_2D,We.colorAttachment0.get()),de.bindFramebuffer.set(We.framebuffer)})(M,b,m,b.transform.projection.name==="globe"?.5:.25),M.clear({color:i.ao.transparent});const H=b.transform,Y=H.projection.name==="globe",Q=Y?["PROJECTION_GLOBE_VIEW"]:[],ce=Y?zn.frontCCW:zn.disabled,le=[i.aF(H.center.lng),i.aJ(H.center.lat)];for(let de=0;de({u_image:0,u_color_ramp:1,u_opacity:ce.paint.get("heatmap-opacity")}))(0,O),O.id,M.viewportBuffer,M.quadTriangleIndexBuffer,M.viewportSegments,O.paint,M.transform.zoom)}(b,m))},line:function(b,d,m,w){if(b.renderPass!=="translucent")return;const M=m.paint.get("line-opacity"),O=m.paint.get("line-width");if(M.constantOr(1)===0||O.constantOr(1)===0)return;const D=m.paint.get("line-emissive-strength").isConstant(),B=m.paint.get("line-emissive-strength").constantOr(0),H=m.paint.get("line-occlusion-opacity"),Y=m.layout.get("line-elevation-reference"),Q=m.layout.get("line-width-unit")==="meters",ce=Y==="sea",le=!(!b.terrain||!b.terrain.enabled),de=b.context,we=de.gl;if(m.hasElevatedBuckets&&b.transform.projection.name==="globe")return;const ve=m.layout.get("line-cross-slope"),De=ve!==void 0,Pe=ve<1,Ve=b.colorModeForDrapableLayerRenderPass(D?B:null),Xe=b.terrain&&b.terrain.renderingToTexture,We=Xe?1:i.o.devicePixelRatio,bt=m.paint.get("line-dasharray"),ut=bt.constantOr(1),xt=m.layout.get("line-cap"),ct=bt.constantOr(null),it=xt.constantOr(null),St=m.paint.get("line-pattern"),Dt=St.constantOr(1),Lt=m.paint.get("line-pattern-cross-fade"),Ht=St.constantOr(null),Wt=m.paint.get("line-opacity").constantOr(1);let sr=!Dt&&Wt!==1||b.depthOcclusion&&H>0&&H<1;const _r=m.paint.get("line-gradient"),$t=Dt?"linePattern":"line",Tt=i.e2(m);let Jt;if(Xe&&b.terrain&&b.terrain.clipOrMaskOverlapStencilType()&&(sr=!1),H!==0&&b.depthOcclusion){const Hr=m.paint._values["line-opacity"];Hr&&Hr.value&&Hr.value.kind==="constant"?Jt=Hr.value:i.w(`Occlusion opacity for layer ${m.id} is supported only when line-opacity isn't data-driven.`)}O.value.kind!=="constant"&&O.value.isLineProgressConstant===!1&&Tt.push("VARIABLE_LINE_WIDTH"),Xe&&(b.emissiveMode!=="dual-source-blending"||D?b.emissiveMode==="mrt-fallback"&&Tt.push("USE_MRT1"):Tt.push("DUAL_SOURCE_BLENDING"));const Vt=(Hr,Nr,br,sn,Jr,zr)=>{for(const Gr of Hr){const kn=d.getTile(Gr);if(Dt&&!kn.patternsLoaded())continue;const Xn=kn.getBucket(m);if(!Xn||Xn.elevationType!=="none"&&!Jr||Xn.elevationType==="none"&&Jr)continue;b.prepareDrawTile();const Rs=[...Nr],fa=b.shadowRenderer,ln=Xn.elevationType==="road"&&!!fa&&fa.enabled;let ia=[0,0,0];if(ln){const ls=b.style.directionalLight,ii=b.style.ambientLight;ls&&ii&&(ia=_p(b.style,ls,ii)),Rs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Wn=Xn.programConfigurations.get(m.id);let ya=!1;if(Ht&&kn.imageAtlas){const ls=i.e3.from(Ht),ii=ls.getPrimary().scaleSelf(We).toString(),eo=kn.imageAtlas.patternPositions.get(ii),Di=ls.getSecondary(),Ha=Di?kn.imageAtlas.patternPositions.get(Di.scaleSelf(We).toString()):null;ya=!!eo&&!!Ha,eo&&Wn.setConstantPatternPositions(eo,Ha)}Lt>0&&(ya||Wn.getPatternTransitionVertexBuffer("line-pattern"))&&Rs.push("LINE_PATTERN_TRANSITION");const Ra=b.isTileAffectedByFog(Gr),Ca=b.getOrCreateProgram($t,{config:Wn,defines:Rs,overrideFog:Ra});if(!Dt&&ct&&it&&kn.lineAtlas){const ls=kn.lineAtlas.getDash(ct,it);ls&&Wn.setConstantPatternPositions(ls)}ln&&fa.setupShadows(kn.tileID.toUnwrapped(),Ca,"vector-tile");let[sa,is]=m.paint.get("line-trim-offset");(it==="round"||it==="square")&&sa!==is&&(sa===0&&(sa-=1),is===1&&(is+=1));const ga=Xe?Gr.projMatrix:null,$i=Q?1/Xn.tileToMeter/i.ay(kn,1,b.transform.zoom):1,xi=Q?1/Xn.tileToMeter/i.ay(kn,1,Math.floor(b.transform.zoom)):1,va=Dt?i.e4(b,kn,m,ga,We,$i,xi,[sa,is],ia,Lt):i.e5(b,kn,m,ga,Xn.lineClipsArray.length,We,$i,xi,[sa,is],ia);if(_r){const ls=Xn.gradients[m.id];let ii=ls.texture;if(m.gradientVersion!==ls.version){let eo=256;if(m.stepInterpolant){const Di=d.getSource().maxzoom,Ha=Gr.canonical.z===Di?Math.ceil(1<{Jt!=null&&(Jt.value=Wt*H),Ca.draw(b,we.TRIANGLES,br,ls,Ve,zn.disabled,va,m.id,Xn.layoutVertexBuffer,Xn.indexBuffer,Xn.segments,m.paint,b.transform.zoom,Wn,[Xn.layoutVertexBuffer2,Xn.patternVertexBuffer,Xn.zOffsetVertexBuffer]),Jt!=null&&(Jt.value=Wt)};if(sr&&!Jr){const ls=b.stencilModeForClipping(Gr).ref;ls===0&&Xe&&de.clear({stencil:0});const ii={func:we.EQUAL,mask:255};va.u_alpha_discard_threshold=.8,Qs(new $n(ii,ls,255,we.KEEP,we.KEEP,we.INVERT)),va.u_alpha_discard_threshold=0,Qs(new $n(ii,ls,255,we.KEEP,we.KEEP,we.KEEP))}else va.u_alpha_discard_threshold=sr&&Jr&&zr?.8:0,Qs(Jr?sn:b.stencilModeForClipping(Gr))}};let dr=b.depthModeForSublayer(0,dn.ReadOnly);const Tr=new dn(b.depthOcclusion?we.GREATER:we.LEQUAL,dn.ReadOnly,b.depthRangeFor3D);if(m.hasNonElevatedBuckets){const Hr=!Xe&&b.terrain;H!==0&&Hr?i.w(`Occlusion opacity for layer ${m.id} is supported on terrain only if the layer has line-z-offset enabled.`):Hr?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${m.id}.`):Vt(w,Tt,dr,$n.disabled,!1,!0)}if(m.hasElevatedBuckets){Y==="hd-road-markup"?le||(dr=Tr,Tt.push("ELEVATED_ROADS")):(Tt.push("ELEVATED"),dr=Tr,De&&Tt.push(Pe?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),ce&&Tt.push("ELEVATION_REFERENCE_SEA"));const Hr=sr?b.stencilModeFor3D():$n.disabled;b.forceTerrainMode=!0,Vt(w,Tt,dr,Hr,!0,!0),sr&&Vt(w,Tt,dr,Hr,!0,!1),b.forceTerrainMode=!1}sr&&(b.resetStencilClippingMasks(),Xe&&de.clear({stencil:0})),H===0||b.depthOcclusion||Xe||b.layersWithOcclusionOpacity.push(b.currentLayer)},fill:function(b,d,m,w){const M=m.paint.get("fill-color"),O=m.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const D=m.paint.get("fill-emissive-strength"),B=b.colorModeForDrapableLayerRenderPass(D),H=m.paint.get("fill-pattern"),Y=b.opaquePassEnabledForLayer()&&!H.constantOr(1)&&M.constantOr(i.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let Q="none";m.layout.get("fill-elevation-reference")!=="none"?Q="road":m.paint.get("fill-z-offset").constantOr(1)!==0&&(Q="offset");const ce=!(!b.terrain||!b.terrain.enabled),le={painter:b,sourceCache:d,layer:m,coords:w,colorMode:B,elevationType:Q,terrainEnabled:ce,pass:Y};if(b.renderPass==="shadow")return void(b.shadowRenderer&&Q==="road"&&!ce&&function(we){const{painter:ve,sourceCache:De,layer:Pe,coords:Ve}=we,Xe=ve.context.gl,We=we.painter.shadowRenderer;for(const bt of Ve){const ut=De.getTile(bt),xt=ut.getBucket(Pe);if(!xt)continue;const ct=xt.elevatedStructures;if(!ct||!ct.shadowCasterSegments||ct.shadowCasterSegments.segments[0].primitiveLength===0)continue;ve.prepareDrawTile();const it=xt.bufferData.programConfigurations.get(Pe.id),St=ve.isTileAffectedByFog(bt),Dt=ve.getOrCreateProgram("elevatedStructuresDepth",{config:it,overrideFog:St}),Lt=We.calculateShadowPassMatrixFromTile(ut.tileID.toUnwrapped());ve.uploadCommonUniforms(ve.context,Dt,bt.toUnwrapped());const Ht={u_matrix:Lt,u_depth_bias:0};Dt.draw(ve,Xe.TRIANGLES,We.getShadowPassDepthMode(),$n.disabled,We.getShadowPassColorMode(),zn.disabled,Ht,Pe.id,ct.vertexBuffer,ct.indexBuffer,ct.shadowCasterSegments,Pe.paint,ve.transform.zoom,it)}}(le));const de=b.emissiveMode==="mrt-fallback";if(Q!=="offset"){if(Qk(le,!1,de),Q==="road"){const we=!ce&&b.renderPass==="translucent";we&&Xk(b,d,m,w,"geometry"),Qk(le,!0,de,$n.disabled),we&&function(ve){const{painter:De,sourceCache:Pe,layer:Ve,coords:Xe,colorMode:We}=ve,bt=De.context.gl,ut=ve.painter.shadowRenderer,xt=!!ut&&ut.enabled,ct=new dn(De.context.gl.LEQUAL,dn.ReadOnly,De.depthRangeFor3D);let it=[0,0,0];if(xt){const Dt=De.style.directionalLight,Lt=De.style.ambientLight;Dt&&Lt&&(it=_p(De.style,Dt,Lt))}const St=Dt=>{for(const Lt of Xe){const Ht=Pe.getTile(Lt),Wt=Ht.getBucket(Ve);if(!Wt)continue;const sr=Wt.elevatedStructures;if(!sr)continue;let _r,$t;if(Dt?(_r=sr.renderableBridgeSegments,$t=sr.bridgeProgramConfigurations.get(Ve.id)):(_r=sr.renderableTunnelSegments,$t=sr.tunnelProgramConfigurations.get(Ve.id)),!_r||_r.segments[0].primitiveLength===0)continue;$t.updatePaintBuffers(),De.prepareDrawTile();const Tt=De.isTileAffectedByFog(Lt),Jt=[];xt&&Jt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Vt=De.getOrCreateProgram("elevatedStructures",{config:$t,overrideFog:Tt,defines:Jt}),dr=De.translatePosMatrix(Lt.projMatrix,Ht,Ve.paint.get("fill-translate"),Ve.paint.get("fill-translate-anchor"));xt&&ut.setupShadows(Ht.tileID.toUnwrapped(),Vt,"vector-tile");const Tr=zm(dr,it);De.uploadCommonUniforms(De.context,Vt,Lt.toUnwrapped()),Vt.draw(De,bt.TRIANGLES,ct,$n.disabled,We,zn.backCCW,Tr,Ve.id,sr.vertexBuffer,sr.indexBuffer,_r,Ve.paint,De.transform.zoom,$t,[sr.vertexBufferNormal])}};St(!0),St(!1)}(le)}}else Qk(le,!1,de,b.stencilModeFor3D())},"fill-extrusion":function(b,d,m,w){const M=m.paint.get("fill-extrusion-opacity"),O=b.context,D=O.gl,B=b.terrain,H=B&&B.renderingToTexture;if(M===0)return;const Y=b.emissiveMode==="mrt-fallback",Q=b.conflationActive&&b.style.isLayerClipped(m,d.getSource()),ce=b.style.order.indexOf(m.fqid);if(Q&&function(le,de,we,ve,De){for(const Pe of ve){const Ve=de.getTile(Pe).getBucket(we);Ve&&(Ve.updateReplacement(Pe,le.replacementSource,De),Ve.uploadCentroid(le.context))}}(b,d,m,w,ce),B||Q)for(const le of w){const de=d.getTile(le).getBucket(m);de&&aie(b.context,d,le,de,m,B,Q)}if(b.renderPass==="shadow"&&b.shadowRenderer){const le=b.shadowRenderer;if(B&&M<.65&&m._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const de=le.getShadowPassDepthMode(),we=le.getShadowPassColorMode();Jk(b,d,m,w,de,$n.disabled,we,Q)}else if(b.renderPass==="translucent"){const le=!m.paint.get("fill-extrusion-pattern").constantOr(1),de=m.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!H&&de.a!==0){const we=new dn(b.context.gl.LEQUAL,dn.ReadWrite,b.depthRangeFor3D);M===1&&le?Jk(b,d,m,w,we,$n.disabled,as.unblended,Q):(Jk(b,d,m,w,we,$n.disabled,as.disabled,Q),Jk(b,d,m,w,we,b.stencilModeFor3D(),b.colorModeForRenderPass(),Q),b.resetStencilClippingMasks())}if(b.style.enable3dLights()&&le&&(!B&&b.transform.projection.name!=="globe"||H)){const we=m.paint.get("fill-extrusion-opacity"),ve=m.paint.get("fill-extrusion-ambient-occlusion-intensity"),De=m.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Pe=m.paint.get("fill-extrusion-flood-light-intensity"),Ve=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Xe=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Ve?null:m.lut).toArray01().slice(0,3),We=ve>0&&De>0,bt=Pe>0,ut=(it,St,Dt)=>(1-Dt)*it+Dt*St,xt=new d5;xt.translate=m.paint.get("fill-extrusion-translate"),xt.translateAnchor=m.paint.get("fill-extrusion-translate-anchor"),xt.edgeRadius=m.layout.get("fill-extrusion-edge-radius"),xt.cutoffFadeRange=m.paint.get("fill-extrusion-cutoff-fade-range");const ct=it=>{const St=b.depthModeForSublayer(1,dn.ReadOnly,D.LEQUAL,!0),Dt=m.paint.get(it?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Lt=ut(.1,3,Dt),Ht=b._showOverdrawInspector;if(!Ht){const Wt=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),sr=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0],D.MIN);jp(xt,b,d,m,w,St,Wt,sr,zn.disabled,it,"sdf",we,ve,De,Pe,Xe,Lt,Q,!1)}{const Wt=Ht?$n.disabled:new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),sr=Ht?b.colorModeForRenderPass():new as([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],i.ao.transparent,[!0,!0,!0,!0]);jp(xt,b,d,m,w,St,Wt,sr,zn.disabled,it,"color",we,ve,De,Pe,Xe,Lt,Q,!1)}};if(H){const it=()=>{const Dt=B.drapeBufferSize[0],Lt=B.drapeBufferSize[1];let Ht=B.framebufferCopyTexture;return Ht&&(!Ht||Ht.size[0]===Dt&&Ht.size[1]===Lt)||(Ht&&Ht.destroy(),Ht=B.framebufferCopyTexture=new i.T(O,new i.q({width:Dt,height:Lt}),D.RGBA8)),Ht.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,Dt,Lt),Ht},St=(Dt,Lt,Ht)=>{const Wt=b.depthModeForSublayer(1,dn.ReadOnly,D.LEQUAL,!1),sr=m.paint.get(Dt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),_r=ut(.1,3,sr);{const $t=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0]);jp(xt,b,d,m,w,Wt,$n.disabled,$t,zn.disabled,Dt,"clear",we,ve,De,Pe,Xe,_r,Q,Lt)}{const $t=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),Tt=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0],D.MIN);jp(xt,b,d,m,w,Wt,$t,Tt,zn.disabled,Dt,"sdf",we,ve,De,Pe,Xe,_r,Q,Lt)}Y&&!Dt&&(Ht=it());{const $t=Dt?D.ZERO:D.ONE_MINUS_DST_ALPHA,Tt=new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),Jt=new as([$t,D.DST_ALPHA,D.ONE_MINUS_DST_ALPHA,D.ZERO],i.ao.transparent,[!0,!0,!0,!0]);jp(xt,b,d,m,w,Wt,Tt,Jt,zn.disabled,Dt,"color",we,ve,De,Pe,Xe,_r,Q,Lt)}if(!Y||Dt){const $t=new as([D.ONE,D.ONE,D.ONE,Dt?D.ZERO:D.ONE],i.ao.transparent,[!1,!1,!1,!0],Dt?D.FUNC_ADD:D.MAX);jp(xt,b,d,m,w,Wt,$n.disabled,$t,zn.disabled,Dt,"clear",we,ve,De,Pe,Xe,_r,Q,Lt,Ht)}else{D.drawBuffers([D.NONE,D.COLOR_ATTACHMENT1]);const $t=new $n({func:D.EQUAL,mask:255},254,255,D.KEEP,D.DECR,D.DECR),Tt=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!0,!1,!1,!1],D.MAX);jp(xt,b,d,m,w,Wt,$t,Tt,zn.disabled,Dt,"emissive",we,ve,De,Pe,Xe,_r,Q,Lt,Ht),D.drawBuffers([D.COLOR_ATTACHMENT0])}};if(We||bt){let Dt;b.prepareDrawTile(),Y&&!We||(Dt=it()),We&&St(!0,!1,Dt),bt&&St(!1,!0,Dt)}}else We&&ct(!0),bt&&ct(!1),(We||bt)&&b.resetStencilClippingMasks()}}},building:function(b,d,m,w){b.currentLayer0&&O>0,Y=!0;const Q=m.paint.get("building-vertical-scale");if(Q<=0)return;b.shadowRenderer||(Y=!1);const ce=b.conflationActive&&b.style.isLayerClipped(m,d.getSource()),le=b.style.order.indexOf(m.fqid);if(function(de,we,ve,De,Pe,Ve){for(const Xe of Ve){const We=we.getTile(Xe).getBucket(ve);We&&(Pe&&We.updateReplacement(Xe,de.replacementSource,De),We.uploadUpdatedIndexBuffer(de.context))}}(b,d,m,le,ce,w),function(de,we,ve,De){for(const Pe of De){const Ve=we.getTile(Pe).getBucket(ve);Ve&&Ve.needsEvaluation()&&Ve.uploadUpdatedColorBuffer(de.context)}}(b,d,m,w),m.resetLayerRenderingStats(b),b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!0),b.renderPass==="shadow"&&b.shadowRenderer){const de=b.shadowRenderer,we=[],ve=de.getShadowPassDepthMode();Rv({painter:b,source:d,layer:m,coords:w,defines:we,blendMode:de.getShadowPassColorMode(),depthMode:ve,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(b.renderPass==="translucent"){let de=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(de=de.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),b.shadowRenderer&&b.shadowRenderer.useNormalOffset&&(de=de.concat("NORMAL_OFFSET"));const we=m.paint.get("building-facade-emissive-chance"),ve=m.paint.get("building-ambient-occlusion-intensity"),De=m.paint.get("building-flood-light-intensity"),Pe=m.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",Ve=m.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Pe?null:m.lut).toArray01().slice(0,3),Xe=m.paint.get("building-flood-light-ground-attenuation"),We=De>0,bt=new dn(b.context.gl.LEQUAL,dn.ReadWrite,b.depthRangeFor3D);B<1&&Rv({painter:b,source:d,layer:m,coords:w,defines:de,blendMode:as.disabled,depthMode:bt,opacity:B,verticalScale:Q,facadeEmissiveChance:we,facadeAOIntensity:ve,floodLightIntensity:De,floodLightColor:Ve,depthOnly:!0});const ut=b.colorModeForRenderPass();Rv({painter:b,source:d,layer:m,coords:w,defines:de,blendMode:ut,depthMode:bt,opacity:B,verticalScale:Q,facadeEmissiveChance:we,facadeAOIntensity:ve,floodLightIntensity:De,floodLightColor:Ve}),H&&eN(b,d,m,w,!0,B,M,O,De,Ve,D,ce),We&&eN(b,d,m,w,!1,B,M,O,De,Ve,Xe,ce)}else if(b.renderPass==="light-beam"){const de=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],we=new dn(b.context.gl.LEQUAL,dn.ReadOnly,b.depthRangeFor3D);Rv({painter:b,source:d,layer:m,coords:w,defines:de,blendMode:as.alphaBlended,depthMode:we,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!1),b.resetStencilClippingMasks()},hillshade:function(b,d,m,w){if(b.renderPass!=="offscreen"&&b.renderPass!=="translucent"||b.style.disableElevatedTerrain)return;const M=b.context,O=b.terrain&&b.terrain.renderingToTexture,[D,B]=b.renderPass!=="translucent"||O?[{},w]:b.stencilConfigForOverlap(w);for(const H of B){const Y=d.getTile(H);if(Y.needsHillshadePrepare&&b.renderPass==="offscreen")Zae(b,Y,m);else if(b.renderPass==="translucent"){const Q=b.depthModeForSublayer(0,dn.ReadOnly),ce=m.paint.get("hillshade-emissive-strength"),le=b.colorModeForDrapableLayerRenderPass(ce),de=O&&b.terrain?b.terrain.stencilModeForRTTOverlap(H):D[H.overscaledZ];Kae(b,H,Y,m,Q,de,le)}}M.viewport.set([0,0,b.width,b.height]),b.resetStencilClippingMasks()},raster:function(b,d,m,w,M,O){if(b.renderPass!=="translucent"||m.paint.get("raster-opacity")===0)return;const D=b.transform.projection.name==="globe",B=m.paint.get("raster-elevation")!==0,H=B&&D;if(b.renderElevatedRasterBackface&&!H)return;const Y=b.context,Q=Y.gl,ce=d.getSource(),le=function(ut,xt,ct,it,St){const Dt=xt.paint.get("raster-color"),Lt=ut.type==="raster-array",Ht=[],Wt=xt.paint.get("raster-resampling"),sr=xt.paint.get("raster-color-mix");let _r=xt.paint.get("raster-color-range");const $t=[sr[0],sr[1],sr[2],0],Tt=sr[3];let Jt=Wt==="nearest"?it.NEAREST:it.LINEAR;if(Lt&&(Ht.push("RASTER_ARRAY"),Dt||Ht.push("RASTER_COLOR"),Wt==="linear"&&Ht.push("RASTER_ARRAY_LINEAR"),Jt=it.NEAREST,!_r&&ut.rasterLayers)){const Vt=ut.rasterLayers.find(({id:dr})=>dr===xt.sourceLayer);Vt&&Vt.fields&&Vt.fields.range&&(_r=Vt.fields.range)}if(_r=_r||[0,1],Dt){Ht.push("RASTER_COLOR"),ct.activeTexture.set(it.TEXTURE2),xt.updateColorRamp(_r);let Vt=xt.colorRampTexture;Vt||(Vt=xt.colorRampTexture=new i.T(ct,xt.colorRamp,it.RGBA8)),Vt.bind(it.LINEAR,it.CLAMP_TO_EDGE)}return St&&Ht.push("USE_MRT1"),{mix:$t,range:_r,offset:Tt,defines:Ht,resampling:Jt}}(ce,m,Y,Q,b.terrain&&b.terrain.renderingToTexture&&b.emissiveMode==="mrt-fallback");if(ce instanceof i.aU&&!w.length&&!D)return;const de=m.paint.get("raster-emissive-strength"),we=b.colorModeForDrapableLayerRenderPass(de),ve=b.terrain&&b.terrain.renderingToTexture,De=!b.options.moving,Pe=m.paint.get("raster-resampling")==="nearest"?Q.NEAREST:Q.LINEAR;if(ce instanceof i.aU&&!w.length&&(ce.onNorthPole||ce.onSouthPole)){const ut=B?b.stencilModeFor3D():$n.disabled;return void Fv(!!ce.onNorthPole,null,b,d,m,de,le,zn.disabled,ut)}if(!w.length)return;const[Ve,Xe]=ce instanceof i.aU||ve?[{},w]:b.stencilConfigForOverlap(w),We=Xe[Xe.length-1].overscaledZ;H&&le.defines.push("PROJECTION_GLOBE_VIEW"),B&&le.defines.push("RENDER_CUTOFF");const bt=(ut,xt,ct)=>{for(const it of ut){const St=it.toUnwrapped(),Dt=d.getTile(it);if(ve&&(!Dt||!Dt.hasData()))continue;Y.activeTexture.set(Q.TEXTURE0);const Lt=Np(Dt,ce,m,le);if(!Lt||!Lt.texture)continue;const{texture:Ht,mix:Wt,offset:sr,tileSize:_r,buffer:$t}=Lt;let Tt,Jt;ve?(Tt=dn.disabled,Jt=it.projMatrix):B?(Tt=new dn(Q.LEQUAL,dn.ReadWrite,b.depthRangeFor3D),Jt=D?Float32Array.from(b.transform.expandedFarZProjMatrix):b.transform.calculateProjMatrix(St,De)):(Tt=b.depthModeForSublayer(it.overscaledZ-We,m.paint.get("raster-opacity")===1?dn.ReadWrite:dn.ReadOnly,Q.LESS),Jt=b.transform.calculateProjMatrix(St,De));const Vt=b.terrain&&ve?b.terrain.stencilModeForRTTOverlap(it):Ve[it.overscaledZ],dr=O?0:m.paint.get("raster-fade-duration");Dt.registerFadeDuration(dr);const Tr=d.findLoadedParent(it,0),Hr=Iv(Dt,Tr,d,b.transform,dr);let Nr,br;!Hr.isFading&&Dt.refreshedUponExpiration&&(Dt.refreshedUponExpiration=!1),b.terrain&&b.terrain.prepareDrawTile(),Y.activeTexture.set(Q.TEXTURE0),Ht.bind(Pe,Q.CLAMP_TO_EDGE),Y.activeTexture.set(Q.TEXTURE1),Tr?(Tr.texture&&Tr.texture.bind(Pe,Q.CLAMP_TO_EDGE),Nr=Math.pow(2,Tr.tileID.overscaledZ-Dt.tileID.overscaledZ),br=[Dt.tileID.canonical.x*Nr%1,Dt.tileID.canonical.y*Nr%1]):Ht.bind(Pe,Q.CLAMP_TO_EDGE),"useMipmap"in Ht&&Y.extTextureFilterAnisotropic&&b.transform.pitch>20&&Q.texParameterf(Q.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const sn=b.transform;let Jr;const zr=B?NP(sn):[0,0,0,0];let Gr,kn,Xn,Rs,fa,ln=0;if(H&&ce instanceof i.aU&&ce.coordinates.length>3)Gr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),kn=Float32Array.from(sn.globeMatrix),Xn=Float32Array.from(i.dF(sn)),Rs=[i.aF(sn.center.lng),i.aJ(sn.center.lat)],Jr=ce.elevatedGlobePerspectiveTransform,fa=ce.elevatedGlobeGridMatrix||new Float32Array(9);else if(H){const Ra=i.dG(it.canonical);ln=i.dH(Ra.getCenter().lat),Gr=Float32Array.from(i.bk(i.dJ(it.canonical))),kn=Float32Array.from(sn.globeMatrix),Xn=Float32Array.from(i.dF(sn)),Rs=[i.aF(sn.center.lng),i.aJ(sn.center.lat)],Jr=[0,0],fa=Float32Array.from(i.dI(it.canonical,Ra,ln,sn.worldSize/sn._pixelsPerMercatorPixel))}else Jr=ce instanceof i.aU?ce.perspectiveTransform:[0,0],Gr=new Float32Array(16),kn=new Float32Array(9),Xn=new Float32Array(16),Rs=[0,0],fa=new Float32Array(9);const ia=yP(Jt,Gr,kn,Xn,fa,br||[0,0],i.aj(b.transform.zoom),Rs,zr,Nr||1,Hr,m,Jr,B?m.paint.get("raster-elevation"):0,2,Wt,sr,le.range,_r,$t,de),Wn=b.isTileAffectedByFog(it),ya=b.getOrCreateProgram("raster",{defines:le.defines,overrideFog:Wn});if(b.uploadCommonUniforms(Y,ya,St),ce instanceof i.aU){const Ra=ce.elevatedGlobeVertexBuffer,Ca=ce.elevatedGlobeIndexBuffer;if(ve||!D)ce.boundsBuffer&&ce.boundsSegments&&ya.draw(b,Q.TRIANGLES,Tt,$n.disabled,we,zn.disabled,ia,m.id,ce.boundsBuffer,b.quadTriangleIndexBuffer,ce.boundsSegments);else if(Ra&&Ca){const sa=sn.zoom<=i.c_?ce.elevatedGlobeSegments:ce.getSegmentsForLongitude(sn.center.lng);sa&&ya.draw(b,Q.TRIANGLES,Tt,$n.disabled,we,xt,ia,m.id,Ra,Ca,sa)}}else if(H){Tt=new dn(Q.LEQUAL,dn.ReadOnly,b.depthRangeFor3D);const Ra=b.globeSharedBuffers;if(Ra){const[Ca,sa,is]=Ra.getGridBuffers(ln,!1);ya.draw(b,Q.TRIANGLES,Tt,ct||Vt,b.colorModeForRenderPass(),xt,ia,m.id,Ca,sa,is)}}else{const{tileBoundsBuffer:Ra,tileBoundsIndexBuffer:Ca,tileBoundsSegments:sa}=b.getTileBoundsBuffers(Dt);ya.draw(b,Q.TRIANGLES,Tt,Vt,we,zn.disabled,ia,m.id,Ra,Ca,sa)}}if(!(ce instanceof i.aU)&&H)for(const it of ut){const St=it.canonical.y===(1<>>16,2654435769),((it=Math.imul(it^it>>>16,2654435769))>>>0)/4294967296},ct=1/1.1;for(let it=0;iti.e9[Vt](Ht));$t.push(Ht);const Tt=Ht.canonical.x,Jt=Ht.canonical.y;for(const Vt of $t){const dr=We.getTile(St?Vt.wrapped():Vt);if(!dr)continue;const Tr=dr.rasterParticleState;if(!Tr)continue;const Hr=Vt.canonical.x+(1<xt.tileID)),de&&(Y.activeTexture.set(Q.TEXTURE0),b.imageManager.bind(b.context,m.scope));const ut=[];if(b.terrain&&b.terrain.renderingToTexture&&b.emissiveMode==="mrt-fallback"&&ut.push("USE_MRT1"),H){const xt=b.getOrCreateProgram(Xe,{overrideFog:!1,overrideRtt:!0,defines:ut}),ct=new Float32Array(i.bA([])),it=new i.aQ(0,0,0,0,0),St=de?$m(ct,B,D,b,0,m.scope,we,H,{tileID:it,tileSize:le}):Lv(ct,B,D,M.toPremultipliedRenderColor(O?null:m.lut));xt.draw(b,Q.TRIANGLES,Pe,De,Ve,zn.disabled,St,m.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments)}else for(const xt of bt){const ct=b.isTileAffectedByFog(xt),it=b.getOrCreateProgram(Xe,{overrideFog:ct,defines:ut}),St=xt.toUnwrapped(),Dt=w?xt.projMatrix:b.transform.calculateProjMatrix(St);b.prepareDrawTile();const Lt=d?d.getTile(xt):We?We[xt.key]:new pp(xt,le,ce.zoom,b),Ht=de?$m(Dt,B,D,b,0,m.scope,we,H,{tileID:xt,tileSize:le}):Lv(Dt,B,D,M.toPremultipliedRenderColor(O?null:m.lut));b.uploadCommonUniforms(Y,it,St);const{tileBoundsBuffer:Wt,tileBoundsIndexBuffer:sr,tileBoundsSegments:_r}=b.getTileBoundsBuffers(Lt);it.draw(b,Q.TRIANGLES,Pe,De,Ve,zn.disabled,Ht,m.id,Wt,sr,_r)}},sky:function(b,d,m){const w=b._atmosphere?i.aj(b.transform.zoom):1,M=m.paint.get("sky-opacity")*w;if(M===0)return;const O=b.context,D=m.paint.get("sky-type"),B=new dn(O.gl.LEQUAL,dn.ReadOnly,[0,1]),H=b.frameCounter/1e3%1;D==="atmosphere"?b.renderPass==="offscreen"?m.needsSkyboxCapture(b)&&(function(Y,Q,ce,le){const de=Y.context,we=de.gl;let ve=Q.skyboxFbo;if(!ve){ve=Q.skyboxFbo=de.createFramebuffer(32,32,1,null),Q.skyboxGeometry=new sN(de),Q.skyboxTexture=de.gl.createTexture(),we.bindTexture(we.TEXTURE_CUBE_MAP,Q.skyboxTexture),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_WRAP_S,we.CLAMP_TO_EDGE),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_WRAP_T,we.CLAMP_TO_EDGE),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_MIN_FILTER,we.LINEAR),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_MAG_FILTER,we.LINEAR);for(let Xe=0;Xe<6;++Xe)we.texImage2D(we.TEXTURE_CUBE_MAP_POSITIVE_X+Xe,0,we.RGBA,32,32,0,we.RGBA,we.UNSIGNED_BYTE,null)}de.bindFramebuffer.set(ve.framebuffer),de.viewport.set([0,0,32,32]);const De=Q.getCenter(Y,!0),Pe=Y.getOrCreateProgram("skyboxCapture"),Ve=new Float64Array(16);i.bA(Ve),i.en(Ve,Ve,.5*-Math.PI),sx(Y,Q,Pe,Ve,De,0),i.bA(Ve),i.en(Ve,Ve,.5*Math.PI),sx(Y,Q,Pe,Ve,De,1),i.bA(Ve),i.cU(Ve,Ve,.5*-Math.PI),sx(Y,Q,Pe,Ve,De,2),i.bA(Ve),i.cU(Ve,Ve,.5*Math.PI),sx(Y,Q,Pe,Ve,De,3),i.bA(Ve),sx(Y,Q,Pe,Ve,De,4),i.bA(Ve),i.en(Ve,Ve,Math.PI),sx(Y,Q,Pe,Ve,De,5),de.viewport.set([0,0,Y.width,Y.height])}(b,m),m.markSkyboxValid(b)):b.renderPass==="sky"&&function(Y,Q,ce,le,de){const we=Y.context,ve=we.gl,De=Y.transform,Pe=Y.getOrCreateProgram("skybox");we.activeTexture.set(ve.TEXTURE0),ve.bindTexture(ve.TEXTURE_CUBE_MAP,Q.skyboxTexture);const Ve=((Xe,We,bt,ut,xt)=>({u_matrix:Xe,u_sun_direction:We,u_cubemap:0,u_opacity:ut,u_temporal_offset:xt}))(De.skyboxMatrix,Q.getCenter(Y,!1),0,le,de);Y.uploadCommonUniforms(we,Pe),Pe.draw(Y,ve.TRIANGLES,ce,$n.disabled,Y.colorModeForRenderPass(),zn.backCW,Ve,"skybox",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(b,m,B,M,H):D==="gradient"&&b.renderPass==="sky"&&function(Y,Q,ce,le,de){const we=Y.context,ve=we.gl,De=Y.transform,Pe=Y.getOrCreateProgram("skyboxGradient");Q.skyboxGeometry||(Q.skyboxGeometry=new sN(we)),we.activeTexture.set(ve.TEXTURE0);let Ve=Q.colorRampTexture;Ve||(Ve=Q.colorRampTexture=new i.T(we,Q.colorRamp,ve.RGBA8)),Ve.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const Xe=((We,bt,ut,xt,ct)=>({u_matrix:We,u_color_ramp:0,u_center_direction:bt,u_radius:i.an(ut),u_opacity:xt,u_temporal_offset:ct}))(De.skyboxMatrix,Q.getCenter(Y,!1),Q.paint.get("sky-gradient-radius"),le,de);Y.uploadCommonUniforms(we,Pe),Pe.draw(Y,ve.TRIANGLES,ce,$n.disabled,Y.colorModeForRenderPass(),zn.backCW,Xe,"skyboxGradient",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(b,m,B,M,H)},custom:function(b,d,m,w){const M=b.context,O=m.implementation;if(!b.transform.projection.unsupportedLayers||!b.transform.projection.unsupportedLayers.includes("custom")||b.terrain&&(b.terrain.renderingToTexture||b.renderPass==="offscreen")&&m.isDraped(d)){if(b.renderPass==="offscreen"){const D=O.prerender;if(D){if(b.setCustomLayerDefaults(),M.setColorMode(b.colorModeForRenderPass()),b.transform.projection.name==="globe"){const B=b.transform.pointMerc;D.call(O,M.gl,b.transform.customLayerMatrix(),b.transform.getProjection(),b.transform.globeToMercatorMatrix(),i.aj(b.transform.zoom),[B.x,B.y],b.transform.pixelsPerMeterRatio)}else D.call(O,M.gl,b.transform.customLayerMatrix());M.setDirty(),b.setBaseState()}}else if(b.renderPass==="translucent"){if(b.terrain&&b.terrain.renderingToTexture){const B=O.renderToTile;if(B){const H=w[0].canonical,Y={x:H.x+w[0].wrap*(O.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,Q||(Y.enabled=!0))},le=d.getSource();if(b.renderPass==="light-beam"&&le.type!=="batched-model")return;if(le.type==="vector"||le.type==="geojson")return function(We,bt,ut,xt,ct){const it=We.transform,St=it.projection.name==="globe",Dt=it.getFreeCameraOptions().position;if(!We.modelManager)return;const Lt=We.modelManager;ut.modelManager=Lt;const Ht=We.shadowRenderer;if(!ut._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Wt=ut._unevaluatedLayout._values["model-id"],sr=Object.assign({},ut.layout.get("model-id").parameters),_r=We.style.order.indexOf(ut.fqid),$t=ut.paint.get("model-opacity").constantOr(1);for(const Tt of xt){const Jt=bt.getTile(Tt).getBucket(ut);if(!Jt||Jt.projection.name!==it.projection.name)continue;const Vt=Jt.getModelUris();if(Vt&&!Jt.modelsRequested&&(Lt.addModelsFromBucket(Vt,ct),Jt.modelsRequested=!0),St)sr.zoom=Tt.overscaledZ;else{const zr=nd(Tt,it);sr.zoom=zr}const dr=Wt.possiblyEvaluate(sr);if(DP(We,Jt,Tt),kf.shadowUniformsInitialized=!1,kf.useSingleShadowCascade=!!Ht&&Ht.getMaxCascadeForTile(Tt.toUnwrapped())===0,We.renderPass==="shadow"&&Ht){if(We.currentShadowCascade===1&&Jt.isInsideFirstShadowMapFrustum)continue;const zr=it.calculatePosMatrix(Tt.toUnwrapped(),it.worldSize);if(kf.tileMatrix.set(zr),kf.shadowTileMatrix=Float32Array.from(Ht.calculateShadowPassMatrixFromMatrix(zr)),kf.aabb.min=[0,0,0],kf.aabb.max[0]=kf.aabb.max[1]=i.al,kf.aabb.max[2]=0,lie(Jt,kf,We,ut.scope))continue}const Tr=1<0&&We.style.isLayerClipped(ut,bt.getSource())&&Jt.updateReplacement(Tt,We.replacementSource,_r,ut.scope)&&(Jt.uploaded=!1,Jt.upload(We.context));let Nr=0;const br=new Array,sn=new Array,Jr=new Array;for(let zr in Jt.instancesPerModel){const Gr=Jt.instancesPerModel[zr];Gr.features.length>0&&!St&&(zr=dr.evaluate(Gr.features[0].feature,{}));const kn=Lt.getModel(zr,ct);if(kn||Lt.hasURLBeenRequested(zr)||Jt.modelUris.includes(zr)||(Jt.modelUris.push(zr),Jt.modelsRequested=!1),kn&&kn.uploaded)if(St){const Xn=i.c5([],[Dt.x,Dt.y,Dt.z],We.transform.worldSize);i.ew(Xn,Xn);for(let Rs=0;Rs0&&ia.elevationUpdate(zr.terrain,Rs,ln,kn.source),ia.needsReEvaluation(zr,fa,kn)&&ia.evaluate(kn))}})(We,bt,ut,xt),function(){let zr,Gr,kn;br?(zr=xt.length-1,Gr=-1,kn=-1):(zr=0,Gr=xt.length,kn=1);const Xn=new Float64Array(16),Rs=i.cA(),fa=new i.P(0,0);for(let ln=zr;ln!==Gr;ln+=kn){const ia=xt[ln],Wn=bt.getTile(ia).getBucket(ut);if(!Wn||!Wn.uploaded)continue;let ya=!1;Dt&&(ya=Dt.getMaxCascadeForTile(ia.toUnwrapped())===0);const Ra=it.calculatePosMatrix(ia.toUnwrapped(),it.worldSize),Ca=Wn.modelTraits;!Tr&&br&&(i.bl(Xn,Ra),i.af(Rs,Ht,Xn),fa.x=Rs[0],fa.y=Rs[1]);const sa=[];Wn.setFilter(ut.filter);for(const is of Wn.getNodesInfo()){if(is.hiddenByReplacement||!is.node.meshes)continue;const ga=is.node;let $i=0;We.terrain&&ga.elevation&&($i=ga.elevation*We.terrain.exaggeration());const xi=(()=>{const bc=is.aabb;return dr.min=[...bc.min],dr.max=[...bc.max],dr.min[2]+=$i,dr.max[2]+=$i,i.af(dr.min,dr.min,Ra),i.af(dr.max,dr.max,Ra),dr})(),va=is.evaluatedScale;if(va[0]<=1&&va[1]<=1&&va[2]<=1&&xi.intersects(Hr)===0)continue;if(!Tr&&br){const bc=.16666666666666666;is.cameraCollisionOpacity=Ht[0]>xi.min[0]&&Ht[0]xi.min[1]&&Ht[1]!br||is.opacity===1&&ga.opacity===1?is.depthga.depth?-1:1);for(const is of sa){const ga=is.nodeInfo,$i=ga.node;let xi=i.aB([],$t,is.tileModelMatrix);i.aB(xi,sr,xi);const va=i.bl([],xi);i.eg(va,va),i.cS(va,va,Bv),xi=i.aB(xi,xi,$i.globalMatrix);const Qs=We.renderPass==="light-beam",ls=ut.paint.get("model-color-use-theme").constantOr("default")==="none",ii=Ca&i.eI.HasMapboxMeshFeatures,eo=ii?0:ga.evaluatedRMEA[0][2];for(let Di=0;Di<$i.meshes.length;++Di){const Ha=$i.meshes[Di],sd=Di===$i.lightMeshIndex;let sc=is.wvpForNode;if(sd){if(!Qs&&!We.terrain&&We.shadowRenderer){We.currentLayer=ar||Ri>=ar}}const Ul=Ha.material;let ku;Ul.occlusionTexture&&Ul.occlusionTexture.offsetScale&&(ku=Ul.occlusionTexture.offsetScale,Ho.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const sh=We.getOrCreateProgram("model",Ho);!Tr&&Dt&&Dt.setupShadowsFromMatrix(is.tileModelMatrix,sh,Dt.useNormalOffset),We.uploadCommonUniforms(ct,sh,null,wc);const Cd=Ul.pbrMetallicRoughness;Cd.metallicFactor=.9,Cd.roughnessFactor=.5;const Gi=Jg(new Float32Array(sc),new Float32Array(xi),new Float32Array(va),new Float32Array($i.globalMatrix),We,is.opacity,Cd.baseColorFactor,Ul.emissiveFactor,Cd.metallicFactor,Cd.roughnessFactor,Ul,eo,ut,[0,0,0],ku);!sd&&(ga.hasTranslucentParts||is.opacity<1)&&sh.draw(We,ct.gl.TRIANGLES,Jt,$n.disabled,as.disabled,zn.backCCW,Gi,ut.id,Ha.vertexBuffer,Ha.indexBuffer,Ha.segments,ut.paint,We.transform.zoom,void 0,bc),sh.draw(We,ct.gl.TRIANGLES,sd?Vt:Jt,$n.disabled,sd||is.opacity<1||ga.hasTranslucentParts?as.alphaBlended:as.unblended,zn.backCCW,Gi,ut.id,Ha.vertexBuffer,Ha.indexBuffer,Ha.segments,ut.paint,We.transform.zoom,void 0,bc)}}}}()}(b,d,m,w),void ce();if(le.type!=="model")return;const de=le.getModels(),we=[],ve=b.transform.getFreeCameraOptions().position,De=i.c5([],[ve.x,ve.y,ve.z],b.transform.worldSize);i.ew(De,De);const Pe=[],Ve=[];let Xe=0;for(const We of de){const bt=d.getFeatureState("",We.id),ut={type:"Unknown",id:We.id,properties:We.featureProperties},xt=m.paint.get("model-rotation").evaluate(ut,bt),ct=m.paint.get("model-scale").evaluate(ut,bt),it=m.paint.get("model-translation").evaluate(ut,bt),St=m.paint.get("model-opacity").evaluate(ut,bt);PP(m,We.id,bt,We.featureProperties,We.nodeOverrideNames,We.nodeOverrides),LP(m,We.id,bt,We.featureProperties,We.materialOverrideNames,We.materialOverrides),We.nodeOverrides.size>0&&We.computeBoundsAndApplyParent(),We.computeModelMatrix(b,xt,ct,it,B,D,!1);const Dt=i.bA([]),Lt=i.ef(We.position.lat,b.transform.zoom),Ht=i.bq([],[1,1,1/Lt]);i.br(Dt,Dt,De),we.push({zScaleMatrix:Ht,negCameraPosMatrix:Dt});for(const Wt of We.nodes)ax(b,Wt,We.matrix,b.transform.expandedFarZProjMatrix,Xe,Pe,Ve,We.materialOverrides,St);Xe++}if(Pe.sort((We,bt)=>bt.depth-We.depth),b.renderPass!=="shadow")OP(b,m,Pe,Ve,we),ce();else{for(const We of Ve)Oh(We.mesh,We.nodeModelMatrix,b,m);for(const We of Pe)Oh(We.mesh,We.nodeModelMatrix,b,m);ce()}}},uN={line:function(b,d,m){if(b.hasElevatedBuckets=!1,b.hasNonElevatedBuckets=!1,b._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||b._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const w=d.getVisibleCoordinates();for(const M of w){const O=d.getTile(M).getBucket(b);if(O&&(O.elevationType!=="none"?b.hasElevatedBuckets=!0:b.hasNonElevatedBuckets=!0,b.hasElevatedBuckets&&b.hasNonElevatedBuckets))break}}}else b.hasNonElevatedBuckets=!0},model:function(b,d,m){const w=d.getSource();if(!w.loaded())return;if(w.type==="vector"||w.type==="geojson")return void(m.modelManager&&m.modelManager.upload(m,zv(m,b)));if(w.type==="batched-model"||w.type!=="model")return;const M=w.getModels();for(const O of M)O.upload(m.context)},raster:function(b,d,m){const w=d.getSource();if(!(w instanceof nc&&w.loaded()))return;const M=b.sourceLayer||w.rasterLayerIds&&w.rasterLayerIds[0];if(!M)return;const O=b.paint.get("raster-array-band")||w.getInitialBand(M);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(b.id,O)&&w.prepareTile(B,M,b.id,O)},"raster-particle":function(b,d,m){const w=d.getSource();if(!(w instanceof nc&&w.loaded()))return;const M=b.sourceLayer||w.rasterLayerIds&&w.rasterLayerIds[0];if(!M)return;const O=b.paint.get("raster-particle-array-band")||w.getInitialBand(M);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(b.id,O)&&w.prepareTile(B,M,b.id,O)}},ju={fill:Xk},hN={fill:function(b,d,m,w){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const M=b.context.gl,O=new dn(M.LEQUAL,dn.ReadOnly,b.depthRangeFor3D),D=new $n({func:M.ALWAYS,mask:255},255,255,M.KEEP,M.KEEP,M.REPLACE),B=b.transform.getFreeCameraOptions().position,H=b.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of w){const Q=d.getTile(Y),ce=Q.getBucket(m);if(!ce)continue;const le=ce.elevatedStructures;if(!le||le.depthSegments.segments[0].primitiveLength===0)continue;const de=kP(Y.toUnwrapped(),B),we=b.translatePosMatrix(Y.projMatrix,Q,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor")),ve=Qg(we,de,0,1,0);H.draw(b,M.TRIANGLES,O,D,as.disabled,zn.disabled,ve,m.id,le.vertexBuffer,le.indexBuffer,le.depthSegments,m.paint,b.transform.zoom)}}};class fN{constructor(d,m,w,M,O){this.context=new Vy(d,m),this.transform=w,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=i.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const D=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const H of D)this._debugParams.enabledLayers[H]=!0;for(const H of D);this.occlusionParams=new Wy,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 i.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Iy(this),this._wireframeDebugCache=new qm,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const B=new i.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,B,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=M,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,m){const w=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(w||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new t5(this,d));const M=this._terrain;this.transform.elevation=w?M:null,M.update(d,this.transform,m),this.transform.elevation&&!M.enabled&&(this.transform.elevation=null)}_updateFog(d){const m=d.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[w,M]=m.getFovAdjustedRange(this.transform._fov);if(w>M)return void(this.transform.fogCullDistSq=null);const O=w+.78*(M-w);this.transform.fogCullDistSq=O*O}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 t5(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,m){if(this.width=d*i.o.devicePixelRatio,this.height=m*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const w of this.style.order)this.style._mergedLayers[w].resize()}setup(){const d=this.context,m=new i.bd;m.emplaceBack(0,0),m.emplaceBack(i.al,0),m.emplaceBack(0,i.al),m.emplaceBack(i.al,i.al),this.tileExtentBuffer=d.createVertexBuffer(m,i.bf.members),this.tileExtentSegments=i.bg.simpleSegment(0,0,4,2);const w=new i.bd;w.emplaceBack(0,0),w.emplaceBack(i.al,0),w.emplaceBack(0,i.al),w.emplaceBack(i.al,i.al),this.debugBuffer=d.createVertexBuffer(w,i.bf.members),this.debugSegments=i.bg.simpleSegment(0,0,4,5);const M=new i.bd;M.emplaceBack(-1,-1),M.emplaceBack(1,-1),M.emplaceBack(-1,1),M.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(M,i.bf.members),this.viewportSegments=i.bg.simpleSegment(0,0,4,2);const O=new i.b1;O.emplaceBack(0,0,0,0),O.emplaceBack(i.al,0,i.al,0),O.emplaceBack(0,i.al,0,i.al),O.emplaceBack(i.al,i.al,i.al,i.al),this.mercatorBoundsBuffer=d.createVertexBuffer(O,i.bi.members),this.mercatorBoundsSegments=i.bg.simpleSegment(0,0,4,2);const D=new i.b0;D.emplaceBack(0,1,2),D.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(D);const B=new i.be;for(const Y of[0,1,3,2,0])B.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(B),this.emptyTexture=new i.T(d,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=i.bC();const H=this.context.gl;this.stencilClearMode=new $n({func:H.ALWAYS,mask:0},0,255,H.ZERO,H.ZERO,H.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,dn.disabled,this.stencilClearMode,as.disabled,zn.disabled,Ev(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,m,w){if(!m||this.currentStencilSource===m.id||!d.isTileClipped()||!w||w.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const H of w)if(this._tileClippingMaskIDs[H.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=m.id;const M=this.context,O=M.gl;this.nextStencilID+w.length>256&&this.clearStencil(),M.setColorMode(as.disabled),M.setDepthMode(dn.disabled);const D=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of w){const H=m.getTile(B),Y=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:Q,tileBoundsIndexBuffer:ce,tileBoundsSegments:le}=this.getTileBoundsBuffers(H);D.draw(this,O.TRIANGLES,dn.disabled,new $n({func:O.ALWAYS,mask:0},Y,255,O.KEEP,O.KEEP,O.REPLACE),as.disabled,zn.disabled,Ev(B.projMatrix),"$clipping",Q,ce,le)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,m=this.context.gl;return new $n({func:m.NOTEQUAL,mask:255},d,255,m.KEEP,m.KEEP,m.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const m=this.context.gl;return new $n({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(d){const m=this.context.gl,w=d.sort((D,B)=>B.overscaledZ-D.overscaledZ),M=w[w.length-1].overscaledZ,O=w[0].overscaledZ-M+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const D={};for(let B=0;Bthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,m)=>d+m/this._fpsHistory.length,0))}render(d,m){const w=i.o.now();this._dt=w-this._timeStamp,this._timeStamp=w,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=m;const M=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),D=()=>this.style._getOrder(O).filter($t=>{const Tt=M[$t];return!(Tt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Tt.type]});let B=D(),H=!1,Y=!1,Q=null,ce=0,le=!1;for(const $t of B){const Tt=M[$t];Tt.visibility!=="none"&&(Tt.type==="circle"?H=!0:Tt.type==="building"?(Q=Tt,++ce):Tt.type==="symbol"&&(Tt.hasOcclusionOpacityProperties?Y=!0:H=!0))}this.updateEmissiveMode();let de=B.map($t=>M[$t]);const we=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(i.o.now()),this.imageManager.beginFrame();for(const $t in we){const Tt=we[$t];Tt.used&&(Tt.prepare(this.context),Tt.getSource().usedInConflation&&++ce)}let ve=!1;for(const $t of de)$t.isHidden(this.transform.zoom)||($t.type==="clip"&&(ve=!0),this.prepareLayer($t));const De={},Pe={},Ve={},Xe={},We={};for(const $t in we){const Tt=we[$t];De[$t]=Tt.getVisibleCoordinates(),Pe[$t]=De[$t].slice().reverse(),Ve[$t]=Tt.getVisibleCoordinates(!0).reverse(),Xe[$t]=Tt.getShadowCasterCoordinates(),We[$t]=Tt.sortCoordinatesByDistance(De[$t])}const bt=$t=>{const Tt=this.style.getLayerSourceCache($t);return Tt&&Tt.used?Tt.getSource():null};if(ce||ve||this._clippingActiveLastFrame){const $t=[],Tt=[];let Jt=0;for(const Vt of de)this.isSourceForClippingOrConflation(Vt,bt(Vt))&&($t.push(Vt),Tt.push(Jt)),Jt++;if($t&&(ve||$t.length>1)||this._clippingActiveLastFrame){ve=!1;const Vt=[];for(let dr=0;dr<$t.length;dr++){const Tr=$t[dr],Hr=Tt[dr],Nr=this.style.getLayerSourceCache(Tr);if(!Nr||!Nr.used||!Nr.getSource().usedInConflation&&Tr.type!=="clip"&&Tr.type!=="building")continue;let br=i.eQ,sn=i.b_.None;const Jr=[];let zr=!0;if(Tr.type==="building")br=i.eS;else if(Tr.type==="clip"){br=Hr;for(const Gr of Tr.layout.get("clip-layer-types"))sn|=Gr==="model"?i.b_.Model:Gr==="symbol"?i.b_.Symbol:i.b_.FillExtrusion;for(const Gr of Tr.layout.get("clip-layer-scope"))Jr.push(Gr);Tr.isHidden(this.transform.zoom)?zr=!1:ve=!0}zr&&Vt.push({layer:Tr.fqid,cache:Nr,order:br,clipMask:sn,clipScope:Jr})}this.replacementSource.setSources(Vt),le=!0}}this._clippingActiveLastFrame=ve,le||this.replacementSource.clear(),this.conflationActive=le,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let $t=0;$t0){const Vt=bt(Tt);Vt&&(this.minCutoffZoom=Math.max(Vt.minzoom,this.minCutoffZoom)),Tt.minzoom&&(this.minCutoffZoom=Math.max(Tt.minzoom,this.minCutoffZoom))}Tt.is3D(O)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=$t),this._lastOcclusionLayer=$t)}const ut=this.style&&this.style.fog;ut?(this._fogVisible=ut.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ut.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(Ve),this.opaquePassCutoff=0,B=D(),de=B.map($t=>M[$t]));const xt=this._shadowRenderer;if(xt){xt.updateShadowParameters(this.transform,this.style.directionalLight);for(const $t in we)for(const Tt of De[$t]){let Jt={min:0,max:0};this.terrain&&(Jt=this.terrain.getMinMaxForTile(Tt)||Jt),xt.addShadowReceiver(Tt.toUnwrapped(),Jt.min,Jt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new i.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new IP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ct=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),it=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ct&&!this._snow&&(this._snow=new x5(this)),!ct&&this._snow&&(this._snow.destroy(),delete this._snow),it&&!this._rain&&(this._rain=new dN(this)),!it&&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 aN);const $t=this.style.getLayerSourceCache(Q);this.buildingTileBorderManager.updateBorders($t,Q)}if(!rt.has(this.context.gl))return;this.renderPass="offscreen";for(const $t of de){const Tt=d.getLayerSourceCache($t);if(!$t.hasOffscreenPass()||$t.isHidden(this.transform.zoom))continue;const Jt=Tt?Pe[Tt.id]:void 0;($t.type==="custom"||$t.type==="raster"||$t.type==="raster-particle"||$t.isSky()||Jt&&Jt.length)&&this.renderLayer(this,Tt,$t,Jt)}this.depthRangeFor3D=[0,1-(de.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Xe)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const St=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Dt=(()=>{if(m.showOverdrawInspector)return i.ao.black;const $t=this.style.fog;if($t&&this.transform.projection.supportsFog){const Tt=this.style.getLut($t.scope);if(!St){const Jt=$t.properties.get("color-use-theme")==="none",Vt=$t.properties.get("color").toNonPremultipliedRenderColor(Jt?null:Tt).toArray01();return new i.ao(...Vt)}if(St){const Jt=$t.properties.get("space-color-use-theme")==="none",Vt=$t.properties.get("space-color").toNonPremultipliedRenderColor(Jt?null:Tt).toArray01();return new i.ao(...Vt)}}return i.ao.transparent})();if(this.context.clear({color:Dt,depth:1}),this.clearStencil(),this._showOverdrawInspector=m.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&St&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=B.length-1;this.currentLayer>=0;this.currentLayer--){const $t=de[this.currentLayer],Tt=d.getLayerSourceCache($t);if($t.isSky())continue;const Jt=Tt?($t.is3D(O)?We:Pe)[Tt.id]:void 0;this._renderTileClippingMasks($t,Tt,Jt),this.renderLayer(this,Tt,$t,Jt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&St&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||i.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&&$t.hasShadowPass()&&--Ht==0){{this.clearStencil(),this.resetStencilClippingMasks();const Jt=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Jt=this.currentLayer;this.depthOcclusion=!0;for(const Vt of this.layersWithOcclusionOpacity){this.currentLayer=Vt;const dr=de[this.currentLayer],Tr=d.getLayerSourceCache(dr),Hr=Tr?Pe[Tr.id]:void 0;this.terrain||this._renderTileClippingMasks(dr,Tr,Tr?De[Tr.id]:void 0),this.renderLayer(this,Tr,dr,Hr)}this.depthOcclusion=!1,this.currentLayer=Jt,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 $t=null;de.forEach(Tt=>{const Jt=d.getLayerSourceCache(Tt);Jt&&!Tt.isHidden(this.transform.zoom)&&Jt.getVisibleCoordinates().length&&(!$t||$t.getSource().maxzoom0?m.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,m,w){const M=w===void 0?this.terrain&&this.terrain.renderingToTexture:w,O=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(O.push("LIGHTING_3D_MODE"),O.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):M||O.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||O.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(O.push("TERRAIN"),this.linearFloatFilteringSupported()&&O.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&O.push("GLOBE"),!this._fogVisible||M||m!==void 0&&!m||O.push("FOG","FOG_DITHERING"),M&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,m){this.cache=this.cache||{};const w=m&&m.defines||[],M=m&&m.config,O=this.currentGlobalDefines(d,m&&m.overrideFog,m&&m.overrideRtt).concat(w),D=uP.cacheKey(U3[d],d,O,M);return this.cache[D]||(this.cache[D]=new uP(this.context,d,U3[d],M,Yk[d],O)),this.cache[D]}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 i.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,m){if(this.style.enable3dLights()){const w=this.style.directionalLight,M=this.style.ambientLight;if(w&&M){const O=((D,B,H)=>{const Y=D.properties.get("direction"),Q=D.properties.get("color-use-theme")==="none",ce=D.properties.get("color").toNonPremultipliedRenderColor(Q?null:H.getLut(D.scope)).toArray01(),le=D.properties.get("intensity"),de=B.properties.get("color-use-theme")==="none",we=B.properties.get("color").toNonPremultipliedRenderColor(de?null:H.getLut(B.scope)).toArray01(),ve=B.properties.get("intensity"),De=[Y.x,Y.y,Y.z],Pe=i.dN(we,ve),Ve=i.dN(ce,le);return{u_lighting_ambient_color:Pe,u_lighting_directional_dir:De,u_lighting_directional_color:Ve,u_ground_radiance:$y(De,Ve,Pe)}})(w,M,this.style);m.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,m,w,M,O){if(this.uploadCommonLightUniforms(d,m),this.terrain&&this.terrain.renderingToTexture)return;const D=this.style.fog;if(D){const B=D.getOpacity(this.transform.pitch),H=((Y,Q,ce,le,de,we,ve,De,Pe,Ve,Xe,We)=>{const bt=Y.transform,ut=Q.properties.get("color-use-theme")==="none",xt=Q.properties.get("color").toNonPremultipliedRenderColor(ut?null:Y.style.getLut(Q.scope)).toArray01();xt[3]=le;const ct=Y.frameCounter/1e3%1,[it,St]=Q.properties.get("vertical-range");return{u_fog_matrix:ce?bt.calculateFogTileMatrix(ce):We||Y.identityMat,u_fog_range:Q.getFovAdjustedRange(bt._fov),u_fog_color:xt,u_fog_horizon_blend:Q.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(it,St),St],u_fog_temporal_offset:ct,u_frustum_tl:de,u_frustum_tr:we,u_frustum_br:ve,u_frustum_bl:De,u_globe_pos:Pe,u_globe_radius:Ve,u_viewport:Xe,u_globe_transition:i.aj(bt.zoom),u_is_globe:+(bt.projection.name==="globe")}})(this,D,w,B,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*i.o.devicePixelRatio,this.transform.height*i.o.devicePixelRatio],M);m.setFogUniformValues(d,H)}O&&m.setCutoffUniformValues(d,O.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,m=d.createTexture();return d.bindTexture(d.TEXTURE_2D,m),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),m}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,m=this._backgroundTiles={},w=this.transform.coveringTiles({tileSize:512});for(const M of w)m[M.key]=d[M.key]||new pp(M,512,this.transform.tileZoom,this,void 0,this.worldview);return m}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,m){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")&&(!m||m.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let m=this._cachedTileFogOpacities[d.key];return m||(this._cachedTileFogOpacities[d.key]=m=this.style.fog.getOpacityForTile(d)),m[0]>=ar||m[1]>=ar}setupDepthForOcclusion(d,m,w){const M=this.context,O=M.gl,D=!!w;var B;w||(w={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(O.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),w.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],w.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],w.u_occluder_half_size=.5*this.occlusionParams.occluderSize,w.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),M.activeTexture.set(O.TEXTURE0),D||m.setTerrainUniformValues(M,w)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function pN(b,d){let m=!1,w=null;const M=()=>{w=null,m&&(b(),w=setTimeout(M,d),m=!1)};return()=>(m=!0,w||M(),w)}class y5{constructor(d){this._hashName=d&&encodeURIComponent(d),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=pN(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 m=qo(d);if(this._hashName){const w=this._hashName;let M=!1;const O=location.hash.slice(1).split("&").map(D=>{const B=D.split("=")[0];return B===w?(M=!0,`${B}=${m}`):D}).filter(D=>D);return M||O.push(`${w}=${m}`),`#${O.join("&")}`}return`#${m}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(w=>w.split("=")).forEach(w=>{w[0]===this._hashName&&(m=w)}),(m&&m[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(w=>isNaN(Number(w)))){const w=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(m[3]||0):d.getBearing();return d.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:w,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function qo(b,d){const m=b.getCenter(),w=Math.round(100*b.getZoom())/100,M=Math.ceil((w*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,M),D=Math.round(m.lng*O)/O,B=Math.round(m.lat*O)/O,H=b.getBearing(),Y=b.getPitch();let Q=d?`/${D}/${B}/${w}`:`${w}/${B}/${D}`;return(H||Y)&&(Q+="/"+Math.round(10*H)/10),Y&&(Q+=`/${Math.round(Y)}`),Q}const Ky={linearity:.3,easing:i.eT(0,0,.3,1)},v5=Object.assign({deceleration:2500,maxSpeed:1400},Ky),_5=Object.assign({deceleration:20,maxSpeed:1400},Ky),ox=Object.assign({deceleration:1e3,maxSpeed:360},Ky),b5=Object.assign({deceleration:1e3,maxSpeed:90},Ky);class w5{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,m=i.o.now();for(;d.length>0&&m-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const m={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)m.zoom+=O.zoomDelta||0,m.bearing+=O.bearingDelta||0,m.pitch+=O.pitchDelta||0,O.panDelta&&m.pan._add(O.panDelta),O.around&&(m.around=O.around),O.pinchAround&&(m.pinchAround=O.pinchAround);const w=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,M={};if(m.pan.mag()){const O=Nf(m.pan.mag(),w,Object.assign({},v5,d||{}));M.offset=m.pan.mult(O.amount/m.pan.mag()),M.center=this._map.transform.center,Zy(M,O)}if(m.zoom){const O=Nf(m.zoom,w,_5);M.zoom=this._map.transform.zoom+O.amount,Zy(M,O)}if(m.bearing){const O=Nf(m.bearing,w,ox);M.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),Zy(M,O)}if(m.pitch){const O=Nf(m.pitch,w,b5);M.pitch=this._map.transform.pitch+O.amount,Zy(M,O)}if(M.zoom||M.bearing){const O=m.pinchAround===void 0?m.around:m.pinchAround;M.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),M.noMoveStart=!0,M}}function Zy(b,d){(!b.duration||b.durationm.unproject(H)),B=O.reduce((H,Y,Q,ce)=>H.add(Y.div(ce.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:D,lngLat:m.unproject(B),originalEvent:w}),this._defaultPrevented=!1}}class j5 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,m){super("wheel",{originalEvent:m}),this._defaultPrevented=!1}}class mN{constructor(d,m){this._map=d,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new j5(this._map,d))}mousedown(d,m){return this._mousedownPos=m,this._firePreventable(new Sd(d.type,this._map,d))}mouseup(d){this._map.fire(new Sd(d.type,this._map,d))}preclick(d){const m=new MouseEvent("preclick",d);this._map.fire(new Sd(m.type,this._map,m))}click(d,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(d),this._map.fire(new Sd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new Sd(d.type,this._map,d))}mouseover(d){this._map.fire(new Sd(d.type,this._map,d))}mouseout(d){this._map.fire(new Sd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new Hm(d.type,this._map,d))}touchmove(d){this._map.fire(new Hm(d.type,this._map,d))}touchend(d){this._map.fire(new Hm(d.type,this._map,d))}touchcancel(d){this._map.fire(new Hm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class k5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new Sd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Sd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new Sd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,m){this.isEnabled()&&d.shiftKey&&d.button===0&&(z(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(d,m){if(!this._active)return;const w=m,M=this._startPos,O=this._lastPos;if(!M||!O||O.equals(w)||!this._box&&w.dist(M){this._box&&(this._box.style.transform=`translate(${D}px,${H}px)`,this._box.style.width=B-D+"px",this._box.style.height=Y-H+"px")})}mouseupWindow(d,m){if(!this._active)return;const w=this._startPos,M=m;if(w&&d.button===0){if(this.reset(),V(),w.x!==M.x||w.y!==M.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(w,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,m){return this._map.fire(new i.z(d,{originalEvent:m}))}}function xN(b,d){const m={};for(let w=0;wthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),w.length===this.numTouches&&(this.centroid=function(M){const O=new i.P(0,0);for(const D of M)O._add(D);return O.div(M.length)}(m),this.touches=xN(w,m)))}touchmove(d,m,w){if(this.aborted||!this.centroid)return;const M=xN(w,m);for(const O in this.touches){const D=M[O];(!D||D.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,m,w){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),w.length===0){const M=!this.aborted&&this.centroid;if(this.reset(),M)return M}}}class yN{constructor(d){this.singleTap=new zP(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,m,w){this.singleTap.touchstart(d,m,w)}touchmove(d,m,w){this.singleTap.touchmove(d,m,w)}touchend(d,m,w){const M=this.singleTap.touchend(d,m,w);if(M){const O=d.timeStamp-this.lastTime<500,D=!this.lastTap||this.lastTap.dist(M)<30;if(O&&D||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=M,this.count===this.numTaps)return this.reset(),M}}}class BP{constructor(){this._zoomIn=new yN({numTouches:1,numTaps:2}),this._zoomOut=new yN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,m,w){this._zoomIn.touchstart(d,m,w),this._zoomOut.touchstart(d,m,w)}touchmove(d,m,w){this._zoomIn.touchmove(d,m,w),this._zoomOut.touchmove(d,m,w)}touchend(d,m,w){const M=this._zoomIn.touchend(d,m,w),O=this._zoomOut.touchend(d,m,w);return M?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()+1,around:D.unproject(M)},{originalEvent:d})}):O?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()-1,around:D.unproject(O)},{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 $P={0:1,2:2},N5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class vN{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,m){return!1}_move(d,m){return{}}mousedown(d,m){if(this._lastPoint)return;const w=te(d);this._correctButton(d,w)&&(this._lastPoint=m,this._eventButton=w)}mousemoveWindow(d,m){const w=this._lastPoint;if(w){if(d.preventDefault(),this._eventButton!=null&&function(M,O){const D=$P[O];return M.buttons===void 0||(M.buttons&D)!==D}(d,this._eventButton))this.reset();else if(this._moved||!(m.dist(w)0&&(this._active=!0);const M=xN(w,m),O=new i.P(0,0),D=new i.P(0,0);let B=0;for(const Y in M){const Q=M[Y],ce=this._touches[Y];ce&&(O._add(Q),D._add(Q.sub(ce)),B++,M[Y]=Q)}if(this._touches=M,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class _N{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,m,w){return{}}touchstart(d,m,w){this._firstTwoTouches||w.length<2||(this._firstTwoTouches=[w[0].identifier,w[1].identifier],this._start([m[0],m[1]]))}touchmove(d,m,w){const M=this._firstTwoTouches;if(!M)return;d.preventDefault();const[O,D]=M,B=$v(w,m,O),H=$v(w,m,D);if(!B||!H)return;const Y=this._aroundCenter?null:B.add(H).div(2);return this._move([B,H],Y,d)}touchend(d,m,w){if(!this._firstTwoTouches)return;const[M,O]=this._firstTwoTouches,D=$v(w,m,M),B=$v(w,m,O);D&&B||(this._active&&V(),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 $v(b,d,m){for(let w=0;wMath.abs(b.x)}class die extends _N{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,bN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,m,w){const M=this._lastPoints;if(!M)return;const O=d[0].sub(M[0]),D=d[1].sub(M[1]);return this._map._cooperativeGestures&&!i.eU()&&w.touches.length<3||(this._valid=this.gestureBeginsVertically(O,D,w.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+D.y)/2*-.5})}gestureBeginsVertically(d,m,w){if(this._valid!==void 0)return this._valid;const M=d.mag()>=2,O=m.mag()>=2;if(!M&&!O)return;if(!M||!O)return this._firstMove==null&&(this._firstMove=w),w-this._firstMove<100&&void 0;const D=d.y>0==m.y>0;return bN(d)&&bN(m)&&D}}const uie={panStep:100,bearingStep:15,pitchStep:10};class hie{constructor(){const d=uie;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 m=0,w=0,M=0,O=0,D=0;switch(d.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:d.shiftKey?w=-1:(d.preventDefault(),O=-1);break;case 39:d.shiftKey?w=1:(d.preventDefault(),O=1);break;case 38:d.shiftKey?M=1:(d.preventDefault(),D=-1);break;case 40:d.shiftKey?M=-1:(d.preventDefault(),D=1);break;default:return}return this._rotationDisabled&&(w=0,M=0),{cameraAnimation:B=>{const H=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:Uv,zoom:m?Math.round(H)+m*(d.shiftKey?2:1):H,bearing:B.getBearing()+w*this._bearingStep,pitch:B.getPitch()+M*this._pitchStep,offset:[-O*this._panStep,-D*this._panStep],center:B.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 Uv(b){return b*(2-b)}const M5=4.000244140625,T5=1/450;class wN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._handler=m,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=T5,i.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()||i.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const w=i.o.now(),M=w-(this._lastWheelEventTime||0);this._lastWheelEventTime=w,m!==0&&m%M5==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":M>400?(this._type=null,this._lastValue=m,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(M*m)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,m+=this._lastValue)),d.shiftKey&&m&&(m/=4),this._type&&(this._lastWheelEvent=d,this._delta-=m,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 m=K(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:m,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 m=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const Y=this._type==="wheel"&&Math.abs(this._delta)>M5?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=m(),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 w=typeof this._targetZoom=="number"?this._targetZoom:m(),M=this._startZoom,O=this._easing;let D,B=!1;if(this._type==="wheel"&&M&&O){const Y=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),Q=O(Y);D=i.ak(M,w,Q),Y<1?this._frameId||(this._frameId=!0):B=!0}else D=w,B=!0;this._active=!0,B&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let H=D-m();return H*this._lastDelta<0&&(H=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:H,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let m=i.eV;if(this._prevEase){const w=this._prevEase,M=(i.o.now()-w.start)/w.duration,O=w.easing(M+.01)-w.easing(M),D=.27/Math.sqrt(O*O+1e-4)*.01,B=Math.sqrt(.0729-D*D);m=i.eT(D,B,.25,1)}return this._prevEase={start:i.o.now(),duration:d,easing:m},m}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=N("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 Cp{constructor(d,m){this._clickZoom=d,this._tapZoom=m}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 jN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,m){return d.preventDefault(),{cameraAnimation:w=>{w.easeTo({duration:300,zoom:w.getZoom()+(d.shiftKey?-1:1),around:w.unproject(m)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vo{constructor(){this._tap=new yN({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,m,w){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?w.length>0&&(this._swipePoint=m[0],this._swipeTouch=w[0].identifier):this._tap.touchstart(d,m,w))}touchmove(d,m,w){if(this._tapTime){if(this._swipePoint){if(w[0].identifier!==this._swipeTouch)return;const M=m[0],O=M.y-this._swipePoint.y;return this._swipePoint=M,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,m,w)}touchend(d,m,w){this._tapTime?this._swipePoint&&w.length===0&&this.reset():this._tap.touchend(d,m,w)&&(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 Sf{constructor(d,m,w){this._el=d,this._mousePan=m,this._touchPan=w}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 qv{constructor(d,m,w){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=m,this._mousePitch=w}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 kN{constructor(d,m,w,M){this._el=d,this._touchZoom=m,this._touchRotate=w,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 Vv=b=>b.zoom||b.drag||b.pitch||b.rotate;class fie extends i.z{}class Hv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,m){const w=i.av([],m,d);this.radius=i.ag(w[2]<0?i.eX([],w,this.constants):[w[0],w[1],0])}projectRay(d){i.eX(d,d,this.constants),i.aw(d,d),i.eY(d,d,this.constants);const m=i.c5([],d,this.radius);if(m[2]>0){const w=i.c5([],[0,0,1],i.bJ(m,[0,0,1])),M=i.c5([],i.aw([],[m[0],m[1],0]),this.radius),O=i.d8([],m,i.c5([],i.av([],i.d8([],M,w),m),2));m[0]=O[0],m[1]=O[1]}return m}}function NN(b){return b.panDelta&&b.panDelta.mag()||b.zoomDelta||b.bearingDelta||b.pitchDelta}class pie{constructor(d,m){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new w5(d),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Hv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),i.aY(["handleEvent","handleWindowEvent"],this);const w=this._el;this._listeners=[[w,"touchstart",{passive:!0}],[w,"touchmove",{passive:!1}],[w,"touchend",void 0],[w,"touchcancel",void 0],[w,"mousedown",void 0],[w,"mousemove",void 0],[w,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[w,"mouseover",void 0],[w,"mouseout",void 0],[w,"dblclick",void 0],[w,"click",void 0],[w,"keydown",{capture:!1}],[w,"keyup",void 0],[w,"wheel",{passive:!1}],[w,"contextmenu",void 0],[window,"blur",void 0]];for(const[M,O,D]of this._listeners){const B=M===document?this.handleWindowEvent:this.handleEvent;M.addEventListener(O,B,D)}}destroy(){for(const[d,m,w]of this._listeners){const M=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(m,M,w)}}_addDefaultHandlers(d){const m=this._map,w=m.getCanvasContainer();this._add("mapEvent",new mN(m,d));const M=m.boxZoom=new gN(m,d);this._add("boxZoom",M);const O=new BP,D=new jN;m.doubleClickZoom=new Cp(D,O),this._add("tapZoom",O),this._add("clickZoom",D);const B=new Vo;this._add("tapDragZoom",B);const H=m.touchPitch=new die(m);this._add("touchPitch",H);const Y=new S5(d),Q=new C5(d);m.dragRotate=new qv(d,Y,Q),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",Q,["mouseRotate"]);const ce=new UP(d),le=new qP(m,d);m.dragPan=new Sf(w,ce,le),this._add("mousePan",ce),this._add("touchPan",le,["touchZoom","touchRotate"]);const de=new Oi,we=new cie;m.touchZoomRotate=new kN(w,we,de,B),this._add("touchRotate",de,["touchPan","touchZoom"]),this._add("touchZoom",we,["touchPan","touchRotate"]),this._add("blockableMapEvent",new k5(m));const ve=m.scrollZoom=new wN(m,this);this._add("scrollZoom",ve,["mousePan"]);const De=m.keyboard=new hie;this._add("keyboard",De);for(const Pe of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Pe]&&m[Pe].enable(d[Pe])}_add(d,m,w){this._handlers.push({handlerName:d,handler:m,allowed:w}),this._handlersById[d]=m}stop(d){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.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!!Vv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,m,w){for(const M in d)if(M!==w&&(!m||m.indexOf(M)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const m=[];for(const w of d)this._el.contains(w.target)&&m.push(w);return m}handleEvent(d,m){this._updatingCamera=!0;const w=d.type==="renderFrame",M=w?void 0:d,O={needsRenderFrame:!1},D={},B={},H=d.touches?this._getMapTouches(d.touches):void 0,Y=H?G(this._el,H):w?void 0:K(this._el,d);for(const{handlerName:le,handler:de,allowed:we}of this._handlers){if(!de.isEnabled())continue;let ve;this._blockedByActive(B,we,le)?de.reset():de[m||d.type]&&(ve=de[m||d.type](d,Y,H),this.mergeHandlerResult(O,D,ve,le,M),ve&&ve.needsRenderFrame&&this._triggerRenderFrame()),(ve||de.isActive())&&(B[le]=de)}const Q={};for(const le in this._previousActiveHandlers)B[le]||(Q[le]=M);this._previousActiveHandlers=B,(Object.keys(Q).length||NN(O))&&(this._changes.push([O,D,Q]),this._triggerRenderFrame()),(Object.keys(B).length||NN(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=O;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))}mergeHandlerResult(d,m,w,M,O){if(!w)return;Object.assign(d,w);const D={handlerName:M,originalEvent:w.originalEvent||O};w.zoomDelta!==void 0&&(m.zoom=D),w.panDelta!==void 0&&(m.drag=D),w.pitchDelta!==void 0&&(m.pitch=D),w.bearingDelta!==void 0&&(m.rotate=D)}_applyChanges(){const d={},m={},w={};for(const[M,O,D]of this._changes)M.panDelta&&(d.panDelta=(d.panDelta||new i.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(m,O),Object.assign(w,D);this._updateMapTransform(d,m,w),this._changes=[]}_updateMapTransform(d,m,w){const M=this._map,O=M.transform,D=Ve=>[Ve.x,Ve.y,Ve.z];if((Ve=>{const Xe=this._eventsInProgress.drag;return Xe&&!this._handlersById[Xe.handlerName].isActive()})()&&!NN(d)){const Ve=O.zoom;O.cameraElevationReference="sea",this._originalZoom!=null&&O._orthographicProjectionAtLowPitch&&O.projection.name!=="globe"&&O.pitch===0?(O.cameraElevationReference="ground",O.zoom=this._originalZoom):(O.recenterOnTerrain(),O.cameraElevationReference="ground"),Ve!==O.zoom&&this._map._update(!0)}if(O._isCameraConstrained&&M._stop(!0),!NN(d))return void this._fireEvents(m,w,!0);let{panDelta:B,zoomDelta:H,bearingDelta:Y,pitchDelta:Q,around:ce,aroundCoord:le,pinchAround:de}=d;O._isCameraConstrained&&(H>0&&(H=0),O._isCameraConstrained=!1),de!==void 0&&(ce=de),(H||(Ve=>m[Ve]&&!this._eventsInProgress[Ve])("drag"))&&ce&&(this._dragOrigin=D(O.pointCoordinate3D(ce)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",M._stop(!0),ce=ce||M.transform.centerPoint,Y&&(O.bearing+=Y),Q&&(O.pitch+=Q),O._updateCameraState();const we=[0,0,0];if(B)if(O.projection.name==="mercator"){const Ve=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ce).dir),Xe=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ce.sub(B)).dir);we[0]=Xe[0]-Ve[0],we[1]=Xe[1]-Ve[1]}else{const Ve=O.pointCoordinate(ce);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const Xe=O._pixelsPerMercatorPixel/O.worldSize;we[0]=-B.x*i.eW(i.a$(Ve.y))*Xe,we[1]=-B.y*i.eW(O.center.lat)*Xe}else{const Xe=O.pointCoordinate(ce.sub(B));Ve&&Xe&&(we[0]=Xe.x-Ve.x,we[1]=Xe.y-Ve.y)}}const ve=O.zoom,De=[0,0,0];if(H){const Ve=D(le||O.pointCoordinate3D(ce)),Xe={dir:i.aw([],i.av([],Ve,O._camera.position))};if(Xe.dir[2]<0){const We=O.zoomDeltaToMovement(Ve,H);i.c5(De,Xe.dir,We)}}const Pe=i.d8(we,we,De);O._translateCameraConstrained(Pe),H&&Math.abs(O.zoom-ve)>1e-4&&O.recenterOnTerrain(),O.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(m,w,!0)}_fireEvents(d,m,w){const M=Vv(this._eventsInProgress),O=Vv(d),D={};for(const Q in d){const{originalEvent:ce}=d[Q];this._eventsInProgress[Q]||(D[`${Q}start`]=ce),this._eventsInProgress[Q]=d[Q]}!M&&O&&this._fireEvent("movestart",O.originalEvent);for(const Q in D)this._fireEvent(Q,D[Q]);O&&this._fireEvent("move",O.originalEvent);for(const Q in d){const{originalEvent:ce}=d[Q];this._fireEvent(Q,ce)}const B={};let H;for(const Q in this._eventsInProgress){const{handlerName:ce,originalEvent:le}=this._eventsInProgress[Q];this._handlersById[ce].isActive()||(delete this._eventsInProgress[Q],H=m[ce]||le,B[`${Q}end`]=H)}for(const Q in B)this._fireEvent(Q,B[Q]);const Y=Vv(this._eventsInProgress);if(w&&(M||O)&&!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 fie("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const SN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class A5 extends i.E{constructor(d,m){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=m.bearingSnap,this._respectPrefersReducedMotion=m.respectPrefersReducedMotion!==!1,i.aY(["_renderFrameCallback"],this)}getCenter(){return new i.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,m){return this.jumpTo({center:d},m)}panBy(d,m,w){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},m),w)}panTo(d,m,w){return this.easeTo(Object.assign({center:d},m),w)}getZoom(){return this.transform.zoom}setZoom(d,m){return this.jumpTo({zoom:d},m),this}zoomTo(d,m,w){return this.easeTo(Object.assign({zoom:d},m),w)}zoomIn(d,m){return this.zoomTo(this.getZoom()+1,d,m),this}zoomOut(d,m){return this.zoomTo(this.getZoom()-1,d,m),this}getBearing(){return this.transform.bearing}setBearing(d,m){return this.jumpTo({bearing:d},m),this}getPadding(){return this.transform.padding}setPadding(d,m){return this.jumpTo({padding:d},m),this}rotateTo(d,m,w){return this.easeTo(Object.assign({bearing:d},m),w)}resetNorth(d,m){return this.rotateTo(0,Object.assign({duration:1e3},d),m),this}resetNorthPitch(d,m){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),m),this}snapToNorth(d,m){return Math.abs(this.getBearing())d.aspect?w/(2*Math.tan(.5*d.fovX)*d.aspect):M/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,m,w,M,O,D){const B=d.clone(),H=this._extendCameraOptions(D);B.bearing=M,B.pitch=O;const Y=i.aT.convert(m),Q=i.aT.convert(w),ce=.5*(Y.lat+Q.lat),le=.5*(Y.lng+Q.lng),de=i.eZ(ce,le),we=i.aw([],de),ve=i.aw([],i.bI([],we,[0,1,0])),De=i.bI([],ve,we),Pe=[ve[0],ve[1],ve[2],0,De[0],De[1],De[2],0,we[0],we[1],we[2],0,0,0,0,1],Ve=[de,i.eZ(Y.lat,Y.lng),i.eZ(Q.lat,Y.lng),i.eZ(Q.lat,Q.lng),i.eZ(Y.lat,Q.lng),i.eZ(ce,Y.lng),i.eZ(ce,Q.lng),i.eZ(Y.lat,le),i.eZ(Q.lat,le)];let Xe=i.d9.fromPoints(Ve.map(Vt=>[i.bJ(ve,Vt),i.bJ(De,Vt),i.bJ(we,Vt)]));const We=i.af([],Xe.center,Pe);i.e_(We)===0&&i.e$(We,0,0,1),i.aw(We,We),i.c5(We,We,i.aD),B.center=i.f0(We);const bt=B.getWorldToCameraMatrix(),ut=i.bl(new Float64Array(16),bt);Xe=i.d9.applyTransform(Xe,i.aB([],bt,Pe));const xt=this._extendAABB(Xe,B,H,M);if(!xt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Xe=xt,i.af(We,We,bt);const ct=.5*(Xe.max[2]-Xe.min[2]),it=this._minimumAABBFrustumDistance(B,Xe),St=i.c5([],[0,0,1],ct),Dt=i.d8(St,We,St),Lt=it+(B.pitch===0?0:i.bG(We,Dt)),Ht=B.globeCenterInViewSpace,Wt=i.av([],We,[Ht[0],Ht[1],Ht[2]]);i.aw(Wt,Wt),i.c5(Wt,Wt,Lt);const sr=i.d8([],We,Wt);i.af(sr,sr,ut);const _r=i.eM/i.aD,$t=i.ag(sr),Tt=i.cf(Math.max($t*_r-i.eM,Number.EPSILON),0),Jt=Math.min(B.zoomFromMercatorZAdjusted(Tt),H.maxZoom);return Jt>.5*(i.c_+i.cL)?(B.setProjection({name:"mercator"}),B.zoom=Jt,this._cameraForBounds(B,m,w,M,O,D)):{center:B.center,zoom:Jt,bearing:M,pitch:O}}_extendAABB(d,m,w,M){const O=.5*((w.padding.left||0)+(w.padding.right||0)),D=.5*((w.padding.top||0)+(w.padding.bottom||0)),B=D,H=O,Y=O,Q=D,ce=m.width-(H+Y),le=m.height-(B+Q),de=i.av([],d.max,d.min),we=Math.min(ce/de[0],le/de[1]),ve=Math.min(m.scaleZoom(m.scale*we),w.maxZoom);if(isNaN(ve))return null;const De=m.scale/m.zoomScale(ve),Pe=new i.d9([d.min[0]-H*De,d.min[1]-Q*De,d.min[2]],[d.max[0]+Y*De,d.max[1]+B*De,d.max[2]]),Ve=(typeof w.offset.x=="number"&&typeof w.offset.y=="number"?new i.P(w.offset.x,w.offset.y):i.P.convert(w.offset)).rotate(-i.an(M));return Pe.center[0]-=Ve.x*De,Pe.center[1]+=Ve.y*De,Pe}queryTerrainElevation(d,m){const w=this.transform.elevation;return w?(m=Object.assign({},{exaggerated:!0},m),w.getAtPoint(i.ae.fromLngLat(d),null,m.exaggerated)):null}_cameraForBounds(d,m,w,M,O,D){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,m,w,M,O,D);const B=d.clone(),H=this._extendCameraOptions(D);B.bearing=M,B.pitch=O;const Y=i.aT.convert(m),Q=i.aT.convert(w),ce=new i.aT(Y.lng,Q.lat),le=new i.aT(Q.lng,Y.lat),de=B.project(Y),we=B.project(Q),ve=this.queryTerrainElevation(Y),De=this.queryTerrainElevation(Q),Pe=this.queryTerrainElevation(ce),Ve=this.queryTerrainElevation(le),Xe=[[de.x,de.y,Math.min(ve||0,De||0,Pe||0,Ve||0)],[we.x,we.y,Math.max(ve||0,De||0,Pe||0,Ve||0)]];let We=i.d9.fromPoints(Xe);const bt=B.getWorldToCameraMatrix(),ut=i.bl(new Float64Array(16),bt);We=i.d9.applyTransform(We,bt);const xt=this._extendAABB(We,B,H,M);if(!xt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");We=xt;const ct=.5*i.av([],We.max,We.min)[2],it=this._minimumAABBFrustumDistance(B,We),St=[0,0,1,0];i.aC(St,St,bt),i.f1(St,St);const Dt=i.c5([],St,it+ct),Lt=i.d8([],We.center,Dt);i.af(We.center,We.center,ut),i.af(Lt,Lt,ut);const Ht=B.unproject(new i.P(We.center[0],We.center[1])),Wt=i.f2(B.projection,Ht),sr=Math.pow(2,Wt),_r=Math.min(B._zoomFromMercatorZ(Lt[2]*B.pixelsPerMeter*sr/B.worldSize),H.maxZoom);return B.mercatorFromTransition&&_r<.5*(i.c_+i.cL)?(B.setProjection({name:"globe"}),B.zoom=_r,this._cameraForBounds(B,m,w,M,O,D)):{center:Ht,zoom:_r,bearing:M,pitch:O}}fitBounds(d,m,w){const M=this.cameraForBounds(d,m);return this._fitInternal(M,m,w)}fitScreenCoordinates(d,m,w,M,O){const D=i.P.convert(d),B=i.P.convert(m),H=new i.P(Math.min(D.x,B.x),Math.min(D.y,B.y)),Y=new i.P(Math.max(D.x,B.x),Math.max(D.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(D,B))return this;const Q=this.transform.pointLocation3D(H),ce=this.transform.pointLocation3D(Y),le=this.transform.pointLocation3D(new i.P(H.x,Y.y)),de=this.transform.pointLocation3D(new i.P(Y.x,H.y)),we=[Math.min(Q.lng,ce.lng,le.lng,de.lng),Math.min(Q.lat,ce.lat,le.lat,de.lat)],ve=[Math.max(Q.lng,ce.lng,le.lng,de.lng),Math.max(Q.lat,ce.lat,le.lat,de.lat)],De=M&&M.pitch?M.pitch:this.getPitch(),Pe=this._cameraForBounds(this.transform,we,ve,w,De,M);return this._fitInternal(Pe,M,O)}_fitInternal(d,m,w){return d?(m=Object.assign(d,m)).linear?this.easeTo(m,w):this.flyTo(m,w):this}jumpTo(d,m){this.stop();const w=d.preloadOnly?this.transform.clone():this.transform;let M=!1,O=!1,D=!1;"zoom"in d&&w.zoom!==+d.zoom&&(M=!0,w.zoom=+d.zoom),d.center!==void 0&&(w.center=i.aT.convert(d.center)),"bearing"in d&&w.bearing!==+d.bearing&&(O=!0,w.bearing=+d.bearing),"pitch"in d&&w.pitch!==+d.pitch&&(D=!0,w.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!w.isPaddingEqual(B))if(d.retainPadding===!1){const H=w.clone();H.padding=B,w.setLocationAtPoint(w.center,H.centerPoint)}else w.padding=B;return d.preloadOnly?(this._preloadTiles(w),this):(this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),M&&this.fire(new i.z("zoomstart",m)).fire(new i.z("zoom",m)).fire(new i.z("zoomend",m)),O&&this.fire(new i.z("rotatestart",m)).fire(new i.z("rotate",m)).fire(new i.z("rotateend",m)),D&&this.fire(new i.z("pitchstart",m)).fire(new i.z("pitch",m)).fire(new i.z("pitchend",m)),this.fire(new i.z("moveend",m)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(SN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,m){const w=this.transform;if(!w.projection.supportsFreeCamera)return i.w(SN),this;this.stop();const M=w.zoom,O=w.pitch,D=w.bearing;w.setFreeCameraOptions(d);const B=M!==w.zoom,H=O!==w.pitch,Y=D!==w.bearing;return this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),B&&this.fire(new i.z("zoomstart",m)).fire(new i.z("zoom",m)).fire(new i.z("zoomend",m)),Y&&this.fire(new i.z("rotatestart",m)).fire(new i.z("rotate",m)).fire(new i.z("rotateend",m)),H&&this.fire(new i.z("pitchstart",m)).fire(new i.z("pitch",m)).fire(new i.z("pitchend",m)),this.fire(new i.z("moveend",m)),this}easeTo(d,m){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:i.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const w=this.transform,M=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),H="zoom"in d?+d.zoom:M,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,Q="pitch"in d?+d.pitch:D,ce=this._extendPadding(d.padding),le=i.P.convert(d.offset);let de,we,ve;if(w.projection.name==="globe"){const St=i.ae.fromLngLat(w.center),Dt=le.rotate(-w.angle);St.x+=Dt.x/w.worldSize,St.y+=Dt.y/w.worldSize;const Lt=St.toLngLat(),Ht=i.aT.convert(d.center||Lt);this._normalizeCenter(Ht),de=w.centerPoint.add(Dt),we=new i.P(St.x,St.y).mult(w.worldSize),ve=new i.P(i.aF(Ht.lng),i.aJ(Ht.lat)).mult(w.worldSize).sub(we)}else{de=w.centerPoint.add(le);const St=w.pointLocation(de),Dt=i.aT.convert(d.center||St);this._normalizeCenter(Dt),we=w.project(St),ve=w.project(Dt).sub(we)}const De=w.zoomScale(H-M);let Pe,Ve;d.around&&(Pe=i.aT.convert(d.around),Ve=w.locationPoint(Pe));const Xe=this._zooming||H!==M,We=this._rotating||O!==Y,bt=this._pitching||Q!==D,ut=!w.isPaddingEqual(ce),xt=d.retainPadding===!1?w.clone():w,ct=St=>Dt=>{if(Xe&&(St.zoom=i.ak(M,H,Dt)),We&&(St.bearing=i.ak(O,Y,Dt)),bt&&(St.pitch=i.ak(D,Q,Dt)),ut&&(xt.interpolatePadding(B,ce,Dt),de=xt.centerPoint.add(le)),Pe)St.setLocationAtPoint(Pe,Ve);else{const Lt=St.zoomScale(St.zoom-M),Ht=H>M?Math.min(2,De):Math.max(.5,De),Wt=Math.pow(Ht,1-Dt),sr=St.unproject(we.add(ve.mult(Dt*Wt)).mult(Lt));St.setLocationAtPoint(St.renderWorldCopies?sr.wrap():sr,de)}return d.preloadOnly||this._fireMoveEvents(m),St};if(d.preloadOnly){const St=this._emulate(ct,d.duration,w);return this._preloadTiles(St),this}const it={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Xe,this._rotating=We,this._pitching=bt,this._padding=ut,this._easeId=d.easeId,this._prepareEase(m,d.noMoveStart,it),this._ease(ct(w),St=>{w.cameraElevationReference==="sea"&&w.recenterOnTerrain(),this._afterEase(m,St)},d),this}_prepareEase(d,m,w={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),m||w.moving||this.fire(new i.z("movestart",d)),this._zooming&&!w.zooming&&this.fire(new i.z("zoomstart",d)),this._rotating&&!w.rotating&&this.fire(new i.z("rotatestart",d)),this._pitching&&!w.pitching&&this.fire(new i.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new i.z("move",d)),this._zooming&&this.fire(new i.z("zoom",d)),this._rotating&&this.fire(new i.z("rotate",d)),this._pitching&&this.fire(new i.z("pitch",d))}_afterEase(d,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const w=this._zooming,M=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,w&&this.fire(new i.z("zoomend",d)),M&&this.fire(new i.z("rotateend",d)),O&&this.fire(new i.z("pitchend",d)),this.fire(new i.z("moveend",d))}flyTo(d,m){if(this._prefersReducedMotion(d)){const Vt=i.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Vt,m)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eV},d);const w=this.transform,M=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),H="zoom"in d?i.aA(+d.zoom,w.minZoom,w.maxZoom):M,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,Q="pitch"in d?+d.pitch:D,ce=this._extendPadding(d.padding),le=w.zoomScale(H-M),de=i.P.convert(d.offset);let we=w.centerPoint.add(de);const ve=w.pointLocation(we),De=i.aT.convert(d.center||ve);this._normalizeCenter(De);const Pe=w.project(ve),Ve=w.project(De).sub(Pe);let Xe=d.curve;const We=Math.max(w.width,w.height),bt=We/le,ut=Ve.mag();if("minZoom"in d){const Vt=i.aA(Math.min(d.minZoom,M,H),w.minZoom,w.maxZoom),dr=We/w.zoomScale(Vt-M);Xe=Math.sqrt(dr/ut*2)}const xt=Xe*Xe;function ct(Vt){const dr=(bt*bt-We*We+(Vt?-1:1)*xt*xt*ut*ut)/(2*(Vt?bt:We)*xt*ut);return Math.log(Math.sqrt(dr*dr+1)-dr)}function it(Vt){return(Math.exp(Vt)-Math.exp(-Vt))/2}function St(Vt){return(Math.exp(Vt)+Math.exp(-Vt))/2}const Dt=ct(0);let Lt=function(Vt){return St(Dt)/St(Dt+Xe*Vt)},Ht=function(Vt){return We*((St(Dt)*(it(dr=Dt+Xe*Vt)/St(dr))-it(Dt))/xt)/ut;var dr},Wt=(ct(1)-Dt)/Xe;if(Math.abs(ut)<1e-6||!isFinite(Wt)){if(Math.abs(We-bt)<1e-6)return this.easeTo(d,m);const Vt=btd.maxDuration&&(d.duration=0);const sr=O!==Y,_r=Q!==D,$t=!w.isPaddingEqual(ce),Tt=d.retainPadding===!1?w.clone():w,Jt=Vt=>dr=>{const Tr=dr*Wt,Hr=1/Lt(Tr);Vt.zoom=dr===1?H:M+Vt.scaleZoom(Hr),sr&&(Vt.bearing=i.ak(O,Y,dr)),_r&&(Vt.pitch=i.ak(D,Q,dr)),$t&&(Tt.interpolatePadding(B,ce,dr),we=Tt.centerPoint.add(de));const Nr=dr===1?De:Vt.unproject(Pe.add(Ve.mult(Ht(Tr))).mult(Hr));return Vt.setLocationAtPoint(Vt.renderWorldCopies?Nr.wrap():Nr,we),Vt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(m),Vt};if(d.preloadOnly){const Vt=this._emulate(Jt,d.duration,w);return this._preloadTiles(Vt),this}return this._zooming=!0,this._rotating=sr,this._pitching=_r,this._padding=$t,this._prepareEase(m,!1),this._ease(Jt(w),()=>this._afterEase(m),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const w=this._onEaseEnd;this._onEaseEnd=void 0,w.call(this,m)}if(!d){const w=this.handlers;w&&w.stop(!1)}return this}_ease(d,m,w){w.animate===!1||w.duration===0?(d(1),m()):(this._easeStart=i.o.now(),this._easeOptions=w,this._onEaseFrame=d,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,m){d=i.bT(d,-180,180);const w=Math.abs(d-m);return Math.abs(d-360-m)180?-360:w<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,m,w){const M=Math.ceil(15*m/1e3),O=[],D=d(w.clone());for(let B=0;B<=M;B++){const H=D(B/M);O.push(H.clone())}return O}_preloadTiles(d,m){}}class Wv{constructor(d={}){this.options=d,i.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const m=this.options&&this.options.compact,w=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=N("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",w);const M=N("span","mapboxgl-ctrl-icon",this._compactButton);return M.setAttribute("aria-hidden","true"),M.setAttribute("title",w),this._innerContainer=N("div","mapboxgl-ctrl-attrib-inner",this._container),m&&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),m===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 m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.e.ACCESS_TOKEN}];if(d){const w=m.reduce((M,O,D)=>(O.value&&(M+=`${O.key}=${O.value}${DM.length-O.length),d=d.filter((M,O)=>{for(let D=O+1;D=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const w=d.map(M=>function(O){const D=new DOMParser().parseFromString(O,"text/html");return Array.from(D.body.querySelectorAll("*")).forEach(B=>{const H=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(D.createTextNode(H));const Y=B.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void B.replaceWith(D.createTextNode(H));const Q=D.createElement("a");Q.href=Y,Q.textContent=H,Q.rel="noopener nofollow";const ce=B.getAttribute("class");ce&&(Q.className=ce),B.replaceWith(Q)}),D.body.innerHTML}(M)).join(" | ");w!==this._attribHTML&&(this._attribHTML=w,d.length?(this._innerContainer.innerHTML=w,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 Gv{constructor(){i.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=N("div","mapboxgl-ctrl");const m=N("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),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 m in d){const w=d[m].getSource();if(w.hasOwnProperty("mapbox_logo")&&!w.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class Yy{constructor(){i.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",m=>this._onIndoorUpdate(m)),this._container}_createButton(d,m){const w=N("button",d,this._container);return w.type="button",w.addEventListener("click",m),w}_createSeparator(){return N("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,m){this._map&&(d.setAttribute("aria-label",m),d.textContent=m)}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 m=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",m&&Array.from(this._container.children).forEach(w=>w.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 m=this._map;this._model&&m&&m._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});N("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,m){for(let w=0;w{this._map._selectIndoorFloor(M.id)});this._setButtonTitle(O,M.zIndex.toString()),this._model&&M.id===this._model.selectedFloorId&&m&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),w=this._endTime)return this._end;const m=i.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}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,m,w){this._start=this.getValue(m),this._end=d,this._startTime=m,this._endTime=m+w}}const Ap={"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 Wm extends i.z{constructor(d,m,w,M){const{point:O,lngLat:D,originalEvent:B,target:H}=d;super(d.type,{point:O,lngLat:D,originalEvent:B,target:H}),this.preventDefault=()=>{d.preventDefault()},this.id=m,this.interaction=w,this.feature=M}}class Dh{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,m){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const w=m.filter;let M=m.type;w&&this.filters.set(d,i.b6(w)),M==="mouseover"&&(M="mouseenter"),M==="mouseout"&&(M="mouseleave");const O=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,m)):O.size===0&&this.map.on(M,this.handleType),O.size===0&&this.interactionsByType.set(M,O),O.set(d,m),this.typeById.set(d,M)}get(d){const m=this.typeById.get(d);if(!m)return;const w=this.interactionsByType.get(m);return w?w.get(d):void 0}remove(d){const m=this.typeById.get(d);if(!m)return;this.typeById.delete(d),this.filters.delete(d);const w=this.interactionsByType.get(m);w&&(w.delete(d),m==="mouseenter"||m==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):w.size===0&&this.map.off(m,this.handleType))}queryTargets(d,m){const w=[];for(const[M,O]of m)O.target&&w.push({targetId:M,target:O.target,filter:this.filters.get(M)});return this.map.style.queryRenderedTargets(d,w,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const m=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());m.length&&(d.type="mouseenter",this.handleType(d,m));const w=new Map;for(const[M,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(M)||w.set(O.id,O);w.size&&(d.type="mouseleave",this.handleType(d,Array.from(w.values())))}handleOut(d){const m=Array.from(this.hoveredFeatures.values()).map(({feature:w})=>w);m.length&&(d.type="mouseleave",this.handleType(d,m)),this.hoveredFeatures.clear()}handleType(d,m){const w=d.type==="mouseenter";if(w&&!this.interactionsByType.has(d.type))return void i.w("mouseenter interaction required for mouseleave to work.");const M=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!m;m=m||this.queryTargets(d.point,M);let D=!1;const B=new Set;for(const H of m){for(const[Y,Q]of M){if(!Q.target)continue;const ce=H.variants?H.variants[Y]:null;if(ce){for(const le of ce){if(Em(le,H,B,Y))continue;const de=new i.dx(H,le),we=fp(le,H,Y);O&&de.id!==void 0&&(de.state=this.map.getFeatureState(de));const ve=w?this.prevHoveredFeatures.get(we):null,De=new Wm(d,Y,Q,de),Pe=ve?ve.stop:Q.handler(De);if(w&&this.hoveredFeatures.set(we,{feature:H,stop:Pe}),Pe!==!1){D=!0;break}}if(D)break}}if(D)break}if(!D)for(const[H,Y]of M){const{handler:Q,target:ce}=Y;if(!ce&&Q(new Wm(d,H,Y,null))!==!1)break}}}function mie(b,d){if(Array.isArray(b)&&Array.isArray(d)){const m=new Set(b),w=new Set(d);return m.size===w.size&&b.every(M=>w.has(M))}return i.by(b,d)}const gie={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"},xie={showCompass:!0,showZoom:!0,visualizePitch:!1};class yie{constructor(d,m,w=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new S5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,w&&(this.mousePitch=new C5({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),i.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(d,m){this.mouseRotate.mousedown(d,m),this.mousePitch&&this.mousePitch.mousedown(d,m),z()}move(d,m){const w=this.map,M=this.mouseRotate.mousemoveWindow(d,m),O=M&&M.bearingDelta;if(O&&w.setBearing(w.getBearing()+O),this.mousePitch){const D=this.mousePitch.mousemoveWindow(d,m),B=D&&D.pitchDelta;B&&w.setPitch(w.getPitch()+B)}}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=G(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=G(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)m.width||d.y>m.height;m.locationPoint3D(w).distSqr(d)180;){const w=m.locationPoint3D(b);if(w.x>=0&&w.y>=0&&w.x<=m.width&&w.y<=m.height)break;b.lng>m.center.lng?b.lng-=360:b.lng+=360}return b}const _c={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%)"},th={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class CN extends i.E{constructor(d,m){super(),(d instanceof HTMLElement||m)&&(d=Object.assign({element:d},m)),i.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:w="center",color:M="#3FB1CE",scale:O=1,draggable:D=!1,clickTolerance:B=0,rotation:H=th.rotation,rotationAlignment:Y=th.rotationAlignment,pitchAlignment:Q=th.pitchAlignment,occludedOpacity:ce=th.occludedOpacity,altitude:le=th.altitude}=d||{};this._anchor=w,this._color=M,this._scale=O,this._draggable=D,this._clickTolerance=B,this._rotation=H,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=i.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.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",ve=>{ve.preventDefault()}),this._element.addEventListener("mousedown",ve=>{ve.preventDefault()});const de=this._element.classList;for(const ve in _c)de.remove(`mapboxgl-marker-anchor-${ve}`);de.add(`mapboxgl-marker-anchor-${this._anchor}`);const we=d&&d.className?d.className.trim().split(/\s+/):[];de.add(...we),this._popup=null}_createDefaultMarker(){const d=N("div"),m=A("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const w=A("radialGradient",{id:"shadowGradient"},A("defs",{},m));A("stop",{offset:"10%","stop-opacity":.4},w),A("stop",{offset:"100%","stop-opacity":.05},w),A("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},m)}return A("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"},m),A("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"},m),A("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},m),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=i.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||th.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 m=d.code,w=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&w!==32&&w!==13||this.togglePopup()}_onMapClick(d){const m=d.originalEvent.target,w=this._element;this._popup&&(m===w||w.contains(m))&&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,m=this._pos;if(!d||!m)return!1;const w=d.unproject(m,this._altitude),M=d.getFreeCameraOptions();if(!M.position)return!1;const O=M.position.toLngLat();return O.distanceTo(w)<.9*O.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const m=this._pos;if(!m||m.x<0||m.x>d.transform.width||m.y<0||m.y>d.transform.height)return void this._clearFadeTimer();const w=d.unproject(m,this._altitude);let M;d._showingGlobe()&&i.f5(d.transform,this._lngLat)?M=0:(M=1-d._queryFogOpacity(w),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 m=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${_c[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${m.x}px,${m.y}px) `}_calculateXYTransform(){const d=this._pos,m=this._map,w=this.getPitchAlignment();if(!m||!d||w!=="map")return"";if(!m._showingGlobe()){const H=m.getPitch();return H?`rotateX(${H}deg)`:""}const M=i.cX(i.f6(m.transform,this._lngLat)),O=d.sub(i.f7(m.transform)),D=Math.abs(O.x)+Math.abs(O.y);if(D===0)return"";const B=M/D;return`rotateX(${-O.y*B}deg) rotateY(${O.x*B}deg)`}_calculateZTransform(){const d=this._pos,m=this._map;if(!m||!d)return"";let w=0;const M=this.getRotationAlignment();if(M==="map")if(m._showingGlobe()){const O=m.project(new i.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),D=m.project(new i.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(O);w=i.cX(Math.atan2(D.y,D.x))-90}else w=-m.getBearing();else if(M==="horizon"){const O=i.ah(4,6,m.getZoom()),D=i.f7(m.transform);D.y+=O*m.transform.height;const B=d.sub(D),H=i.cX(Math.atan2(B.y,B.x));w=(H>90?H-270:H+90)*(1-O)}return w+=this._rotation,w?`rotateZ(${w}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=E5(this._lngLat,this._pos,m.transform)),this._pos=m.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(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=i.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 m=this._map;if(!m)return;const w=this._pointerdownPos,M=this._positionDelta;if(w&&M){if(!this._isDragging){const O=this._clickTolerance||m._clickTolerance;if(d.point.dist(w)b.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(b.minPitch!=null&&b.maxPitch!=null&&b.minPitch>b.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(b.minPitch!=null&&b.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(b.maxPitch!=null&&b.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(b.antialias&&i.f3(window)&&(b.antialias=!1,i.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new O3(b.minZoom,b.maxZoom,b.minPitch,b.maxPitch,b.renderWorldCopies,null,null),b),this._repaint=!!b.repaint,this._interactive=b.interactive,this._minTileCacheSize=b.minTileCacheSize,this._maxTileCacheSize=b.maxTileCacheSize,this._failIfMajorPerformanceCaveat=b.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=b.preserveDrawingBuffer,this._antialias=b.antialias,this._trackResize=b.trackResize,this._bearingSnap=b.bearingSnap,this._refreshExpiredTiles=b.refreshExpiredTiles,this._fadeDuration=b.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=b.crossSourceCollisions,this._collectResourceTiming=b.collectResourceTiming,this._language=this._parseLanguage(b.language),this._worldview=b.worldview,this._renderTaskQueue=new Mp,this._domRenderTaskQueue=new Mp,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},Ap,b.locale),this._clickTolerance=b.clickTolerance,this._cooperativeGestures=b.cooperativeGestures,this._performanceMetricsCollection=b.performanceMetricsCollection,this._tessellationStep=b.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=b.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Tp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=b.scaleFactor,this._requestManager=new ae(b.transformRequest,b.accessToken,b.testMode),this._silenceAuthErrors=!!b.testMode,this._contextCreateOptions=b.contextCreateOptions?Object.assign({},b.contextCreateOptions):{},typeof b.container=="string"){const m=document.getElementById(b.container);if(!m)throw new Error(`Container '${b.container.toString()}' not found.`);this._container=m}else{if(!(b.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=b.container}if(this._container.childNodes.length>0&&i.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."),b.maxBounds&&this.setMaxBounds(b.maxBounds),this._spriteFormat=b.spriteFormat,i.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 pie(this,b),this._localFontFamily=b.localFontFamily,this._localIdeographFontFamily=b.localIdeographFontFamily,(b.style||!b.testMode)&&this.setStyle(b.style||i.e.DEFAULT_STYLE,{config:b.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),b.projection&&this.setProjection(b.projection),b.hash&&(this._hash=new y5(typeof b.hash=="string"&&b.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch});const m=b.bounds;m&&(this.resize(),this.fitBounds(m,Object.assign({},b.fitBoundsOptions,{duration:0})))}this.resize(),b.attributionControl&&this.addControl(new Wv({customAttribution:b.customAttribution})),this._logoControl=new Gv,this.addControl(this._logoControl,b.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",m=>{this._update(m.dataType==="style"),this.fire(new i.z(`${m.dataType}data`,m))}),this.on("dataloading",m=>{this.fire(new i.z(`${m.dataType}dataloading`,m))}),this._interactions=new Dh(this)}_getMapId(){return this._mapId}addControl(b,d){if(d===void 0&&(d=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.onAdd)return this.fire(new i.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const m=b.onAdd(this);this._controls.push(b);const w=this._controlPositions[d];return d.indexOf("bottom")!==-1?w.insertBefore(m,w.firstChild):w.appendChild(m),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new i.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(b);return d>-1&&this._controls.splice(d,1),b.onRemove(this),this}hasControl(b){return this._controls.indexOf(b)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(b){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 i.z("movestart",b)).fire(new i.z("move",b)),this.fire(new i.z("resize",b)),d&&this.fire(new i.z("moveend",b)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(b){return this.transform.setMaxBounds(i.aI.convert(b)),this._update()}setMinZoom(b){if((b=b??-2)>=-2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b?this.setZoom(b):this.fire(new i.z("zoomstart")).fire(new i.z("zoom")).fire(new i.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=b??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b?this.setPitch(b):this.fire(new i.z("pitchstart")).fire(new i.z("pitch")).fire(new i.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(b){return this._scaleFactor=b,this.painter.scaleFactor=b,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(b){return this.transform.renderWorldCopies=b,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(b){return b==="auto"?navigator.language:Array.isArray(b)?b.length===0?void 0:b.map(d=>d==="auto"?navigator.language:d):b}setLanguage(b){const d=this._parseLanguage(b);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const m of this._controls)m._setLanguage&&m._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(b){return this.style&&b!==this._worldview?(this._worldview=b,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(b){return this._lazyInitEmptyStyle(),b?typeof b=="string"&&(b={name:b}):b=null,this._useExplicitProjection=!!b,this._prioritizeAndUpdateProjection(b,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const b=this.transform,d=b.projection.name;let m;d==="globe"&&b.zoom>=i.cL?(b.setMercatorFromTransition(),m=!0):d==="mercator"&&b.zoom=i.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(b),this.style.applyProjectionUpdate();const w=this.transform.getProjection().name==="mercator"&&m!==this.transform.mercatorFromTransition;return(d||w)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(b,d){return this.transform.locationPoint3D(i.aT.convert(b),d)}unproject(b,d){return this.transform.pointLocation3D(i.P.convert(b),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(b,d,m){const w=M=>{let O=[];if(Array.isArray(d)){const D=d.filter(B=>this.getLayer(B));O=D.length?this.queryRenderedFeatures(M,{layers:D}):[]}else O=this.queryRenderedFeatures(M,{target:d});return O};if(b==="mouseenter"||b==="mouseover"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:D=>{const B=w(D.point);B.length?M||(M=!0,m.call(this,new Sd(b,this,D.originalEvent,{features:B}))):M=!1},mouseout:()=>{M=!1}}}}if(b==="mouseleave"||b==="mouseout"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:B=>{w(B.point).length?M=!0:M&&(M=!1,m.call(this,new Sd(b,this,B.originalEvent)))},mouseout:B=>{M&&(M=!1,m.call(this,new Sd(b,this,B.originalEvent)))}}}}{const M=O=>{const D=w(O.point);D.length&&(O.features=D,m.call(this,O),delete O.features)};return{listener:m,targets:d,delegates:{[b]:M}}}}on(b,d,m){if(typeof d=="function"||m===void 0)return super.on(b,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._createDelegatedListener(b,d,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[b]=this._delegatedListeners[b]||[],this._delegatedListeners[b].push(w);for(const M in w.delegates)this.on(M,w.delegates[M]);return this}once(b,d,m){if(typeof d=="function"||m===void 0)return super.once(b,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._createDelegatedListener(b,d,m);for(const M in w.delegates)this.once(M,w.delegates[M]);return this}off(b,d,m){if(typeof d=="function"||m===void 0)return super.off(b,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._delegatedListeners?this._delegatedListeners[b]:void 0;return w&&(M=>{for(let O=0;O{if(m){const M=typeof m=="string"?m:m instanceof Error?m.message:m.error;i.w(`Unable to perform style diff: ${M}. Rebuilding the style from scratch.`),this._updateStyle(b,d)}else w&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(b,d))}_getUIString(b){const d=this._locale[b];if(d==null)throw new Error(`Missing UI string '${b}'`);return d}_updateStyle(b,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),b){const m=Object.assign({},d);d&&d.config&&(m.initialConfig=d.config,delete m.config),this.style=new eh(this,m).load(b),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new eh(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():(i.w("There is no style added to the map."),!1)}_isValidId(b){return b==null?(this.fire(new i.y(new Error("IDs can't be empty."))),!1):!i.dr(b)||(this.fire(new i.y(new Error(`IDs can't contain special symbols: "${b}".`))),!1)}_isTargetValid(b){return"featuresetId"in b?this._isValidId("importId"in b?b.importId:b.featuresetId):"layerId"in b&&this._isValidId(b.layerId)}_areTargetsValid(b){if(Array.isArray(b)){for(const d of b)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(b)}addSource(b,d){return this._isValidId(b)?(this._lazyInitEmptyStyle(),this.style.addSource(b,d),this._update(!0)):this}isSourceLoaded(b){return!!this._isValidId(b)&&!!this.style&&this.style._isSourceCacheLoaded(b)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(b,d,m){this._lazyInitEmptyStyle(),this.style.addSourceType(b,d,m)}removeSource(b){return this._isValidId(b)?(this.style.removeSource(b),this._updateTerrain(),this._update(!0)):this}getSource(b){return this._isValidId(b)?this.style.getOwnSource(b):null}addImage(b,d,{pixelRatio:m=1,sdf:w=!1,stretchX:M,stretchY:O,content:D}={}){this._lazyInitEmptyStyle();const B=i.I.from(b);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:H,height:Y,data:Q}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:H,height:Y},Q),pixelRatio:m,stretchX:M,stretchY:O,content:D,sdf:w,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new i.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:H,height:Y}=d,Q=d;this.style.addImage(B,{data:new i.q({width:H,height:Y},new Uint8Array(Q.data)),pixelRatio:m,stretchX:M,stretchY:O,content:D,sdf:w,usvg:!1,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,b)}}updateImage(b,d){this._lazyInitEmptyStyle();const m=i.I.from(b),w=this.style.getImage(m);if(!w)return void this.fire(new i.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?i.o.getImageData(d):d,{width:O,height:D,data:B}=M;if(O===void 0||D===void 0)return void this.fire(new i.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(O!==(w.usvg?w.icon.usvg_tree.width:w.data.width)||D!==(w.usvg?w.icon.usvg_tree.height:w.data.height))return void this.fire(new i.y(new Error(`The width and height of the updated image (${O}, ${D}) must be that same as the previous version of the image (${w.data.width}, ${w.data.height})`)));const H=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;w.usvg?(w.data=new i.q({width:O,height:D},new Uint8Array(B)),w.usvg=!1,w.icon=void 0,Y=!0):w.data.replace(B,H),this.style.updateImage(m,w,Y)}hasImage(b){return b?!!this.style&&!!this.style.getImage(i.I.from(b)):(this.fire(new i.y(new Error("Missing required image id"))),!1)}removeImage(b){this.style.removeImage(i.I.from(b))}loadImage(b,d){i.n(this._requestManager.transformRequest(b,i.R.Image),(m,w)=>{d(m,w instanceof HTMLImageElement?i.o.getImageData(w):w)})}listImages(){return this.style.listImages().map(b=>b.name)}addModel(b,d){this._lazyInitEmptyStyle(),this.style.addModel(b,d)}hasModel(b){return b?this.style.hasModel(b):(this.fire(new i.y(new Error("Missing required model id"))),!1)}removeModel(b){this.style.removeModel(b)}listModels(){return this.style.listModels()}addLayer(b,d){return this._isValidId(b.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(b,d),this._update(!0)):this}getSlot(b){const d=this.getLayer(b);return d&&d.slot||null}setSlot(b,d){return this.style.setSlot(b,d),this.style.mergeLayers(),this._update(!0)}addImport(b,d){return this.style.addImport(b,d).catch(m=>this.fire(new i.y(new Error("Failed to add import",m)))),this}updateImport(b,d){return typeof d!="string"&&d.id!==b?(this.removeImport(b),this.addImport(d)):(this.style.updateImport(b,d),this._update(!0))}removeImport(b){return this.style.removeImport(b),this}moveImport(b,d){return this.style.moveImport(b,d),this._update(!0)}moveLayer(b,d){return this._isValidId(b)?(this.style.moveLayer(b,d),this._update(!0)):this}removeLayer(b){return this._isValidId(b)?(this.style.removeLayer(b),this._update(!0)):this}getLayer(b){if(!this._isValidId(b))return null;const d=this.style.getOwnLayer(b);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(b,d,m){return this._isValidId(b)?(this.style.setLayerZoomRange(b,d,m),this._update(!0)):this}setFilter(b,d,m={}){return this._isValidId(b)?(this.style.setFilter(b,d,m),this._update(!0)):this}getFilter(b){return this._isValidId(b)?this.style.getFilter(b):null}setPaintProperty(b,d,m,w={}){return this._isValidId(b)?(this.style.setPaintProperty(b,d,m,w),this._update(!0)):this}getPaintProperty(b,d){return this._isValidId(b)?this.style.getPaintProperty(b,d):null}setLayoutProperty(b,d,m,w={}){return this._isValidId(b)?(this.style.setLayoutProperty(b,d,m,w),this._update(!0)):this}getLayoutProperty(b,d){return this._isValidId(b)?this.style.getLayoutProperty(b,d):null}setLayerProperty(b,d,m,w={}){return this._isValidId(b)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(b,d,m,w),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(b){return this.style.setGlyphsUrl(b),this._update(!0)}getSchema(b){return this.style.getSchema(b)}setSchema(b,d){return this.style.setSchema(b,d),this._update(!0)}getConfig(b){return this.style.getConfig(b)}setConfig(b,d){return this.style.setConfig(b,d),this._update(!0)}getConfigProperty(b,d){return this.style.getConfigProperty(b,d)}setConfigProperty(b,d,m){return this.style.setConfigProperty(b,d,m),this._update(!0)}getFeaturesetDescriptors(b){return this.style.getFeaturesetDescriptors(b)}setLights(b){if(this._lazyInitEmptyStyle(),b&&b.length===1&&b[0].type==="flat"){const d=b[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(b),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const b=this.style.getLights()||[];return b.length===0&&b.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),b}setLight(b,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:b}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(b){return this._lazyInitEmptyStyle(),!b&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(b),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(b){return this._lazyInitEmptyStyle(),this.style.setFog(b),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(b){return this._lazyInitEmptyStyle(),this.style.setSnow(b),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(b){return this._lazyInitEmptyStyle(),this.style.setRain(b),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(b){return this._lazyInitEmptyStyle(),this.style.setColorTheme(b),this._update(!0)}setImportColorTheme(b,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(b,d),this._update(!0)}setCamera(b){return this.style.setCamera(b),this._triggerCameraUpdate(b)}_triggerCameraUpdate(b){return this._update(this.transform.setOrthographicProjectionAtLowPitch(b["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(b){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.aT.convert(b),this.transform):0}setFeatureState(b,d){return b.source&&!this._isValidId(b.source)?this:(this.style.setFeatureState(b,d),this._update())}removeFeatureState(b,d){return b.source&&!this._isValidId(b.source)?this:(this.style.removeFeatureState(b,d),this._update())}getFeatureState(b){return b.source&&!this._isValidId(b.source)?null:this.style.getFeatureState(b)}_selectIndoorFloor(b){this.indoor.selectFloor(b)}_setIndoorActiveFloorsVisibility(b){this.indoor.setActiveFloorsVisibility(b)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Yy),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const b=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let m,w,M,O=this._container;for(;O&&(!w||!M);){const D=window.getComputedStyle(O).transform;D&&D!=="none"&&(m=D.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(w=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(M=m[3])),O=O.parentElement}this._containerWidth=w?Math.abs(b/w):b,this._containerHeight=M?Math.abs(d/M):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&i.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 JI(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 b=this._container;b.classList.add("mapboxgl-map"),(this._missingCSSCanary=N("div","mapboxgl-canary",b)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=N("div","mapboxgl-canvas-container",b);this._canvas=N("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 m=this._controlContainer=N("div","mapboxgl-control-container",b),w=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(M=>{w[M]=N("div",`mapboxgl-ctrl-${M}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,d){const m=i.o.devicePixelRatio||1;this._canvas.width=m*Math.ceil(b),this._canvas.height=m*Math.ceil(d),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${d}px`}_addMarker(b){this._markers.push(b)}_removeMarker(b){const d=this._markers.indexOf(b);d!==-1&&this._markers.splice(d,1)}_addPopup(b){this._popups.push(b)}_removePopup(b){const d=this._popups.indexOf(b);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const b=Object.assign({},C.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",b);d?(at(d,!0),this.painter=new fN(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",m=>{m.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),i.k.testSupport(d)):this.fire(new i.y(new Error("Failed to initialize WebGL")))}_contextLost(b){b.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.z("webglcontextlost",{originalEvent:b}))}_contextRestored(b){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 i.z("webglcontextrestored",{originalEvent:b}))}_onMapScroll(b){if(b.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(b){return this.style?(this._styleDirty=this._styleDirty||b,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(b){return this._update(),this._renderTaskQueue.add(b)}_cancelRenderFrame(b){this._renderTaskQueue.remove(b)}_requestDomTask(b){!this.loaded()||this.loaded()&&!this.isMoving()?b():this._domRenderTaskQueue.add(b)}_render(b){let d;this.fire(new i.z("renderstart")),++this._frameId;const m=this.painter.context.extTimerQuery,w=i.o.now(),M=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=M.createQuery(),M.beginQuery(m.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(b),this._domRenderTaskQueue.run(b),this._removed)return;this._updateProjectionTransition();const O=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Y=this.transform.zoom,Q=this.transform.pitch,ce=i.o.now(),le=new i.ac(Y,{now:ce,fadeDuration:O,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 D=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),D=this._updateAverageElevation(w),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):D=this._updateAverageElevation(w);const B=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,O,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),B&&(this._placementDirty=B.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:O,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 i.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(p.load),this.fire(new i.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=i.o.now()-w;M.endQuery(m.TIME_ELAPSED_EXT),setTimeout(()=>{const Q=M.getQueryParameter(d,M.QUERY_RESULT)/1e6;M.deleteQuery(d),this.fire(new i.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 i.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 i.z("gpu-timing-deferred-render",{gpuTime:Q}))},50)}const H=this._sourcesDirty||this._styleDirty||this._placementDirty||D;if(H||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(D=this._updateAverageElevation(w,!0)),D)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new i.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Q=this._calculateSpeedIndex();this.fire(new i.z("speedindexcompleted",{speedIndex:Q})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||H||(this._fullyLoaded=!0,x.mark(p.fullLoad),this._performanceMetricsCollection&&Ke(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(b){for(const d of this._markers)b&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!b||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(b,d=!1){const m=M=>(this.transform.averageElevation=M,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);const w=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(w||(d||b-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(b)){const M=this.transform.averageElevation;let O=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(O)?O=0:this._averageElevationLastSampledAt=b;const D=Math.abs(M-O);if(D>1){if(this._isInitialLoad||w)return this._averageElevation.jumpTo(O),m(O);this._averageElevation.easeTo(O,b,300)}else if(D>1e-4)return this._averageElevation.jumpTo(O),m(O)}return!!this._averageElevation.isEasing(b)&&m(this._averageElevation.getValue(b))}_authenticate(){yt(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,b=>{if(b&&(b.message===ye||b.status===401)){const d=this.painter.context.gl;at(d,!1),this._logoControl instanceof Gv&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.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/")))}}),ke(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ee(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Fe(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){tt(this._requestManager._customAccessToken)}_updateTerrain(){const b=this._isDragging();this.painter.updateTerrain(this.style,b)}_calculateSpeedIndex(){const b=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const m=this.painter.context.gl,w=m.createFramebuffer();function M(O){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,O,0);const D=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,D),D}return m.bindFramebuffer(m.FRAMEBUFFER,w),this._canvasPixelComparison(M(b),d.canvasCopies.map(M),d.timeStamps)}_canvasPixelComparison(b,d,m){let w=m[1]-m[0];const M=b.length/4;for(let O=0;O{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(d)}))}_preloadTiles(b){const d=this.style?this.style.getSourceCaches():[];return i.bw(d,(m,w)=>m._preloadTiles(b,w),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(b){this._trackResize&&this.resize({originalEvent:b})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(b){this._showTileBoundaries!==b&&(this._showTileBoundaries=b,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(b){this._showParseStatus!==b&&(this._showParseStatus=b,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(b){this._showTerrainWireframe!==b&&(this._showTerrainWireframe=b,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(b){this._showLayers2DWireframe!==b&&(this._showLayers2DWireframe=b,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(b){this._showLayers3DWireframe!==b&&(this._showLayers3DWireframe=b,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(b){this._speedIndexTiming!==b&&(this._speedIndexTiming=b,this._update())}get showPadding(){return!!this._showPadding}set showPadding(b){this._showPadding!==b&&(this._showPadding=b,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(b){this._showCollisionBoxes!==b&&(this._showCollisionBoxes=b,this.style&&b?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(b){this._showOverdrawInspector!==b&&(this._showOverdrawInspector=b,this._update())}get repaint(){return!!this._repaint}set repaint(b){this._repaint!==b&&(this._repaint=b,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(b){this._vertices=b,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(b){this._showTileAABBs!==b&&(this._showTileAABBs=b,b&&this._update())}_setCacheLimits(b,d){i.f4(b,d)}get version(){return h}},NavigationControl:class{constructor(b={}){this.options=Object.assign({},xie,b),this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(i.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",d=>{this._map&&this._map.zoomIn({},{originalEvent:d})}),N("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})}),N("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",d=>{const m=this._map;m&&(this.options.visualizePitch?m.resetNorthPitch({},{originalEvent:d}):m.resetNorth({},{originalEvent:d}))}),this._compassIcon=N("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const b=this._map;if(!b)return;const d=b.getZoom(),m=d===b.getMaxZoom(),w=d===b.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=w,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",w.toString())}_rotateCompassArrow(){const b=this._map;if(!b)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(b.transform.pitch*(Math.PI/180)),.5)}) rotateX(${b.transform.pitch}deg) rotateZ(${b.transform.angle*(180/Math.PI)}deg)`:`rotate(${b.transform.angle*(180/Math.PI)}deg)`;b._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(b){return this._map=b,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),b.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&b.on("pitch",this._rotateCompassArrow),b.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new yie(b,this._compass,this.options.visualizePitch)),this._container}onRemove(){const b=this._map;b&&(this._container.remove(),this.options.showZoom&&b.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&b.off("pitch",this._rotateCompassArrow),b.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(b,d){const m=N("button",b,this._container);return m.type="button",m.addEventListener("click",d),m}_setButtonTitle(b,d){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${d}`);b.setAttribute("aria-label",m),b.firstElementChild&&b.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends i.E{constructor(b={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},vie,b),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=pN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(b){return this._map=b,this._container=N("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(b){const d=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,b(m)};this._supportsGeolocation!==void 0?b(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(m=>d(m.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(b){const d=this._map.getMaxBounds(),m=b.coords;return!!d&&(m.longituded.getEast()||m.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(b){if(this._map){if(this._isOutOfMapMaxBounds(b))return this._setErrorState(),this.fire(new i.z("outofmaxbounds",b)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=b,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(b),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(b),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("geolocate",Object.assign({coords:b.coords,timestamp:b.timestamp},b.toJSON?{toJSON:b.toJSON.bind(b)}:{}))),this._finish()}}_updateCamera(b){const d=new i.aT(b.coords.longitude,b.coords.latitude),m=b.coords.accuracy,w=this._map.getBearing(),M=Object.assign({bearing:w},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(m),M,{geolocateSource:!0})}_updateMarker(b){if(b){const d=new i.aT(b.coords.longitude,b.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=b.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const b=this._map.transform,d=i.cf(1,b._center.lat)*b.worldSize,m=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}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(b){if(this._map){if(this.options.trackUserLocation)if(b.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(b.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("error",b)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(b){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=N("button","mapboxgl-ctrl-geolocate",this._container),N("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",b===!1){i.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=N("div","mapboxgl-user-location"),this._dotElement.appendChild(N("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(N("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new CN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=N("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new CN({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 i.z("trackuserlocationend")))})}}_onDeviceOrientation(b){this._userLocationDotMarker&&(b.webkitCompassHeading?this._heading=b.webkitCompassHeading:b.absolute===!0&&(this._heading=-1*b.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.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 i.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 i.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 b;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(b={maximumAge:6e5,timeout:0},this._noTimeout=!0):(b=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,b),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 b=()=>{"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"&&b()}).catch(console.error):b()}_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:Wv,ScaleControl:class{constructor(b={}){this.options=Object.assign({},Xy,b),i.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const b=this.options.maxWidth||100,d=this._map,m=d._containerHeight/2,w=d._containerWidth/2-b/2,M=d.unproject([w,m]),O=d.unproject([w+b,m]),D=M.distanceTo(O);if(this.options.unit==="imperial"){const B=3.2808*D;B>5280?this._setScale(b,B/5280,"mile"):this._setScale(b,B,"foot")}else this.options.unit==="nautical"?this._setScale(b,D/1852,"nautical-mile"):D>=1e3?this._setScale(b,D/1e3,"kilometer"):this._setScale(b,D,"meter")}_setScale(b,d,m){this._map._requestDomTask(()=>{const w=function(O){const D=Math.pow(10,`${Math.floor(O)}`.length-1);let B=O/D;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(H){const Y=Math.pow(10,Math.ceil(-Math.log(H)/Math.LN10));return Math.round(H*Y)/Y}(B),D*B}(d),M=w/d;this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:m}).format(w):`${w} ${I5[m]}`,this._container.style.width=b*M+"px"})}onAdd(b){return this._map=b,this._language=b.getLanguage(),this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-scale",b.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(b){this._language=b,this._update()}setUnit(b){this.options.unit=b,this._update()}},FullscreenControl:class{constructor(b={}){this._fullscreen=!1,b&&b.container&&(b.container instanceof HTMLElement?this._container=b.container:i.w("Full screen control 'container' must be a DOM element.")),i.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(b){return this._map=b,this._container||(this._container=this._map.getContainer()),this._controlContainer=N("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.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 b=this._fullscreenButton=N("button","mapboxgl-ctrl-fullscreen",this._controlContainer);N("span","mapboxgl-ctrl-icon",b).setAttribute("aria-hidden","true"),b.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const b=this._getTitle();this._fullscreenButton.setAttribute("aria-label",b),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",b)}_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:Yy,Popup:class extends i.E{constructor(b){super(),this.options=Object.assign(Object.create(rh),b),this._altitude=this.options.altitude,i.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(b&&b.className?b.className.trim().split(/\s+/):[])}addTo(b){return this._map&&this.remove(),this._map=b,this.options.closeOnClick&&b.on("preclick",this._onClose),this.options.closeOnMove&&b.on("move",this._onClose),b.on("remove",this.remove),this._update(),b._addPopup(this),this._focusFirstElement(),this._trackPointer?(b.on("mousemove",this._onMouseEvent),b.on("mouseup",this._onMouseEvent),b._canvasContainer.classList.add("mapboxgl-track-pointer")):b.on("move",this._update),this.fire(new i.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const b=this._map;return b&&(b.off("move",this._update),b.off("move",this._onClose),b.off("preclick",this._onClose),b.off("click",this._onClose),b.off("remove",this.remove),b.off("mousemove",this._onMouseEvent),b.off("mouseup",this._onMouseEvent),b.off("drag",this._onMouseEvent),b._canvasContainer&&b._canvasContainer.classList.remove("mapboxgl-track-pointer"),b._removePopup(this),this._map=void 0),this.fire(new i.z("close")),this}getLngLat(){return this._lngLat}setLngLat(b){this._lngLat=i.aT.convert(b),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(b){return this._altitude=b,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const b=this._map;return b&&(b.off("move",this._update),b.on("mousemove",this._onMouseEvent),b.on("drag",this._onMouseEvent),b._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(b){return this.setDOMContent(document.createTextNode(b))}setHTML(b){const d=document.createDocumentFragment(),m=document.createElement("body");let w;for(m.innerHTML=b;w=m.firstChild,w;)d.appendChild(w);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(b){return this.options.maxWidth=b,this._update(),this}setDOMContent(b){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=N("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(b),this.options.closeButton){const m=this._closeButton=N("button","mapboxgl-popup-close-button",d);m.type="button",m.setAttribute("aria-label","Close popup"),m.innerHTML='',m.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(b){return this._classList.add(b),this._updateClassList(),this}removeClassName(b){return this._classList.delete(b),this._updateClassList(),this}setOffset(b){return this.options.offset=b,this._update(),this}toggleClassName(b){let d;return this._classList.delete(b)?d=!1:(this._classList.add(b),d=!0),this._updateClassList(),d}_onMouseEvent(b){this._update(b.point)}_getAnchor(b){if(this.options.anchor)return this.options.anchor;const d=this._map,m=this._container,w=this._pos;if(!d||!m||!w)return"bottom";const M=m.offsetWidth,O=m.offsetHeight,D=w.xd.transform.width-M/2;if(w.y+bd.transform.height-O){if(D)return"bottom-left";if(B)return"bottom-right"}return D?"left":B?"right":"bottom"}_updateClassList(){const b=this._container;if(!b)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"),b.className=d.join(" ")}_update(b){const d=this._map,m=this._content;if(!d||!this._lngLat&&!this._trackPointer||!m)return;let w=this._container;if(w||(w=this._container=N("div","mapboxgl-popup",d.getContainer()),this._tip=N("div","mapboxgl-popup-tip",w),w.appendChild(m)),this.options.maxWidth&&w.style.maxWidth!==this.options.maxWidth&&(w.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=E5(this._lngLat,this._pos,d.transform)),!this._trackPointer||b){const M=this._pos=this._trackPointer&&b instanceof i.P?b:d.project(this._lngLat,this._altitude),O=lx(this.options.offset),D=this._anchor=this._getAnchor(O.y),B=lx(this.options.offset,D),H=M.add(B).round();d._requestDomTask(()=>{this._container&&D&&(this._container.style.transform=`${_c[D]} translate(${H.x}px,${H.y}px)`)})}if(!this._marker&&d._showingGlobe()){const M=i.f5(d.transform,this._lngLat)?0:1;this._setOpacity(M)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const b=this._container.querySelector(nh);b&&b.focus()}_onClose(){this.remove()}_setOpacity(b){this._container&&(this._container.style.opacity=`${b}`),this._content&&(this._content.style.pointerEvents=b?"auto":"none")}},Marker:CN,Style:eh,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:td,Evented:i.E,config:i.e,prewarm:i.f9,clearPrewarmedResources:i.f8,get accessToken(){return i.e.ACCESS_TOKEN},set accessToken(b){i.e.ACCESS_TOKEN=b},get baseApiUrl(){return i.e.API_URL},set baseApiUrl(b){i.e.API_URL=b},get workerCount(){return i.fi.workerCount},set workerCount(b){i.fi.workerCount=b},get maxParallelImageRequests(){return i.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(b){i.e.MAX_PARALLEL_IMAGE_REQUESTS=b},clearStorage(b){i.fh(b)},get workerUrl(){return i.fg.workerUrl},set workerUrl(b){i.fg.workerUrl=b},get workerClass(){return i.fg.workerClass},set workerClass(b){i.fg.workerClass=b},get workerParams(){return i.fg.workerParams},set workerParams(b){i.fg.workerParams=b},get dracoUrl(){return i.ff()},set dracoUrl(b){i.fe(b)},get meshoptUrl(){return i.fd()},set meshoptUrl(b){i.fc(b)},setNow:i.o.setNow,restoreNow:i.o.restoreNow}});var l=a;return l})})(M6e);var Kat=M6e.exports;const Xl=Hi(Kat);function Ir({className:t,...e}){return r.jsx("div",{className:zt("animate-pulse rounded-md bg-muted",t),...e})}const mje={coming_soon:"#3B82F6",active:"#10B981",price_improvement:"#F97316",under_contract:"#8B5CF6",sold:"#6B7280"},gje={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function Zat(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function Yat({listings:t,isLoading:e}){const n=Zn(),s=I.useRef(null),a=I.useRef(null),o=I.useRef([]),[l,i]=I.useState(""),[h,p]=I.useState(!0);return I.useEffect(()=>{(async()=>{p(!0);try{const{data:_}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();_!=null&&_.value&&i(_.value)}catch(_){console.error("Error fetching mapbox token:",_)}p(!1)})()},[]),I.useEffect(()=>{if(!s.current||!l||a.current)return;Xl.accessToken=l;const y=t.filter(C=>C.latitude!=null&&C.longitude!=null);let _=[-98.5795,39.8283],j=4;if(y.length>0){const C=y.reduce((A,E)=>A+E.longitude,0)/y.length,N=y.reduce((A,E)=>A+E.latitude,0)/y.length;_=[C,N],j=y.length===1?12:10}return a.current=new Xl.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:j,center:_}),a.current.addControl(new Xl.NavigationControl,"top-right"),()=>{var C;(C=a.current)==null||C.remove(),a.current=null}},[l]),I.useEffect(()=>{if(!a.current||!l)return;o.current.forEach(_=>_.remove()),o.current=[];const y=t.filter(_=>_.latitude!=null&&_.longitude!=null);if(y.forEach(_=>{var z,F,q;const j=mje[_.status]||"#10B981",C=((z=_.photos)==null?void 0:z.find(V=>V.is_primary))||((F=_.photos)==null?void 0:F[0]),A=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${_.slug||_.id}`:`/public/listing/${_.slug||_.id}`,E=document.createElement("div");E.className="cursor-pointer",E.innerHTML=`
`;const T=new Xl.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${C!=null&&C.photo_url?``:""}
${Zat(_.price)}
${_.property_address||""}
${_.city}, ${_.state}
${gje[_.status]||_.status} ${_.bedrooms?`${_.bedrooms} bed`:""} ${_.bathrooms?`${_.bathrooms} bath`:""}
${(q=_.agent)!=null&&q.name?`
Listed by ${_.agent.name}
`:""}
Click to view details →
`),P=new Xl.Marker(E).setLngLat([_.longitude,_.latitude]).setPopup(T).addTo(a.current);o.current.push(P)}),y.length>1){const _=new Xl.LngLatBounds;y.forEach(j=>_.extend([j.longitude,j.latitude])),a.current.fitBounds(_,{padding:60,maxZoom:13})}else y.length===1&&a.current.flyTo({center:[y[0].longitude,y[0].latitude],zoom:12})},[t,l]),I.useEffect(()=>(window.__navigateToPublicListing__=y=>{n(y)},()=>{delete window.__navigateToPublicListing__}),[n]),h||e?r.jsx(Ir,{className:"w-full h-[500px] rounded-lg"}):!l||t.filter(y=>y.latitude!=null&&y.longitude!=null).length===0?null:r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:Object.entries(mje).map(([y,_])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:_}}),r.jsx("span",{className:"text-xs text-gray-600",children:gje[y]})]},y))}),r.jsx("div",{ref:s,className:"w-full h-[500px] rounded-lg shadow-lg border border-gray-200"})]})}function nE(t,[e,n]){return Math.min(n,Math.max(e,t))}function NI(t){const e=I.useRef({value:t,previous:t});return I.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Xat=[" ","Enter","ArrowUp","ArrowDown"],Qat=[" ","Enter"],Uj="Select",[Wne,Gne,Jat]=cI(Uj),[d3]=rc(Uj,[Jat,Bg]),Kne=Bg(),[eit,iv]=d3(Uj),[tit,rit]=d3(Uj),A6e=t=>{const{__scopeSelect:e,children:n,open:s,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:h,dir:p,name:x,autoComplete:y,disabled:_,required:j,form:C}=t,N=Kne(e),[A,E]=I.useState(null),[T,P]=I.useState(null),[z,F]=I.useState(!1),q=ok(p),[V,K]=$u({prop:s,defaultProp:a??!1,onChange:o,caller:Uj}),[G,te]=$u({prop:l,defaultProp:i,onChange:h,caller:Uj}),ie=I.useRef(null),oe=A?C||!!A.closest("form"):!0,[ye,ae]=I.useState(new Set),pe=Array.from(ye).map(se=>se.props.value).join(";");return r.jsx(fI,{...N,children:r.jsxs(eit,{required:j,scope:e,trigger:A,onTriggerChange:E,valueNode:T,onValueNodeChange:P,valueNodeHasChildren:z,onValueNodeHasChildrenChange:F,contentId:Kc(),value:G,onValueChange:te,open:V,onOpenChange:K,dir:q,triggerPointerDownPosRef:ie,disabled:_,children:[r.jsx(Wne.Provider,{scope:e,children:r.jsx(tit,{scope:t.__scopeSelect,onNativeOptionAdd:I.useCallback(se=>{ae(he=>new Set(he).add(se))},[]),onNativeOptionRemove:I.useCallback(se=>{ae(he=>{const ue=new Set(he);return ue.delete(se),ue})},[]),children:n})}),oe?r.jsxs(eLe,{"aria-hidden":!0,required:j,tabIndex:-1,name:x,autoComplete:y,value:G,onChange:se=>te(se.target.value),disabled:_,form:C,children:[G===void 0?r.jsx("option",{value:""}):null,Array.from(ye)]},pe):null]})})};A6e.displayName=Uj;var E6e="SelectTrigger",I6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:s=!1,...a}=t,o=Kne(n),l=iv(E6e,n),i=l.disabled||s,h=ta(e,l.onTriggerChange),p=Gne(n),x=I.useRef("touch"),[y,_,j]=rLe(N=>{const A=p().filter(P=>!P.disabled),E=A.find(P=>P.value===l.value),T=nLe(A,N,E);T!==void 0&&l.onValueChange(T.value)}),C=N=>{i||(l.onOpenChange(!0),j()),N&&(l.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return r.jsx(e3,{asChild:!0,...o,children:r.jsx(Rn.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":tLe(l.value)?"":void 0,...a,ref:h,onClick:on(a.onClick,N=>{N.currentTarget.focus(),x.current!=="mouse"&&C(N)}),onPointerDown:on(a.onPointerDown,N=>{x.current=N.pointerType;const A=N.target;A.hasPointerCapture(N.pointerId)&&A.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:on(a.onKeyDown,N=>{const A=y.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&_(N.key),!(A&&N.key===" ")&&Xat.includes(N.key)&&(C(),N.preventDefault())})})})});I6e.displayName=E6e;var P6e="SelectValue",L6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:a,children:o,placeholder:l="",...i}=t,h=iv(P6e,n),{onValueNodeHasChildrenChange:p}=h,x=o!==void 0,y=ta(e,h.onValueNodeChange);return ec(()=>{p(x)},[p,x]),r.jsx(Rn.span,{...i,ref:y,style:{pointerEvents:"none"},children:tLe(h.value)?r.jsx(r.Fragment,{children:l}):o})});L6e.displayName=P6e;var nit="SelectIcon",O6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,children:s,...a}=t;return r.jsx(Rn.span,{"aria-hidden":!0,...a,ref:e,children:s||"▼"})});O6e.displayName=nit;var sit="SelectPortal",D6e=t=>r.jsx(ZC,{asChild:!0,...t});D6e.displayName=sit;var qj="SelectContent",R6e=I.forwardRef((t,e)=>{const n=iv(qj,t.__scopeSelect),[s,a]=I.useState();if(ec(()=>{a(new DocumentFragment)},[]),!n.open){const o=s;return o?gy.createPortal(r.jsx(F6e,{scope:t.__scopeSelect,children:r.jsx(Wne.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),o):null}return r.jsx(z6e,{...t,ref:e})});R6e.displayName=qj;var Gp=10,[F6e,ov]=d3(qj),ait="SelectContentImpl",iit=z1("SelectContent.RemoveScroll"),z6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:_,collisionPadding:j,sticky:C,hideWhenDetached:N,avoidCollisions:A,...E}=t,T=iv(qj,n),[P,z]=I.useState(null),[F,q]=I.useState(null),V=ta(e,Ee=>z(Ee)),[K,G]=I.useState(null),[te,ie]=I.useState(null),oe=Gne(n),[ye,ae]=I.useState(!1),pe=I.useRef(!1);I.useEffect(()=>{if(P)return Rne(P)},[P]),Dne();const se=I.useCallback(Ee=>{const[Ue,...Fe]=oe().map(Te=>Te.ref.current),[be]=Fe.slice(-1),tt=document.activeElement;for(const Te of Ee)if(Te===tt||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===Ue&&F&&(F.scrollTop=0),Te===be&&F&&(F.scrollTop=F.scrollHeight),Te==null||Te.focus(),document.activeElement!==tt))return},[oe,F]),he=I.useCallback(()=>se([K,P]),[se,K,P]);I.useEffect(()=>{ye&&he()},[ye,he]);const{onOpenChange:ue,triggerPointerDownPosRef:_e}=T;I.useEffect(()=>{if(P){let Ee={x:0,y:0};const Ue=be=>{var tt,Te;Ee={x:Math.abs(Math.round(be.pageX)-(((tt=_e.current)==null?void 0:tt.x)??0)),y:Math.abs(Math.round(be.pageY)-(((Te=_e.current)==null?void 0:Te.y)??0))}},Fe=be=>{Ee.x<=10&&Ee.y<=10?be.preventDefault():P.contains(be.target)||ue(!1),document.removeEventListener("pointermove",Ue),_e.current=null};return _e.current!==null&&(document.addEventListener("pointermove",Ue),document.addEventListener("pointerup",Fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ue),document.removeEventListener("pointerup",Fe,{capture:!0})}}},[P,ue,_e]),I.useEffect(()=>{const Ee=()=>ue(!1);return window.addEventListener("blur",Ee),window.addEventListener("resize",Ee),()=>{window.removeEventListener("blur",Ee),window.removeEventListener("resize",Ee)}},[ue]);const[Ae,Ce]=rLe(Ee=>{const Ue=oe().filter(tt=>!tt.disabled),Fe=Ue.find(tt=>tt.ref.current===document.activeElement),be=nLe(Ue,Ee,Fe);be&&setTimeout(()=>be.ref.current.focus())}),Se=I.useCallback((Ee,Ue,Fe)=>{const be=!pe.current&&!Fe;(T.value!==void 0&&T.value===Ue||be)&&(G(Ee),be&&(pe.current=!0))},[T.value]),ge=I.useCallback(()=>P==null?void 0:P.focus(),[P]),Le=I.useCallback((Ee,Ue,Fe)=>{const be=!pe.current&&!Fe;(T.value!==void 0&&T.value===Ue||be)&&ie(Ee)},[T.value]),ke=s==="popper"?the:B6e,Be=ke===the?{side:i,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:_,collisionPadding:j,sticky:C,hideWhenDetached:N,avoidCollisions:A}:{};return r.jsx(F6e,{scope:n,content:P,viewport:F,onViewportChange:q,itemRefCallback:Se,selectedItem:K,onItemLeave:ge,itemTextRefCallback:Le,focusSelectedItem:he,selectedItemText:te,position:s,isPositioned:ye,searchRef:Ae,children:r.jsx(_I,{as:iit,allowPinchZoom:!0,children:r.jsx(yI,{asChild:!0,trapped:T.open,onMountAutoFocus:Ee=>{Ee.preventDefault()},onUnmountAutoFocus:on(a,Ee=>{var Ue;(Ue=T.trigger)==null||Ue.focus({preventScroll:!0}),Ee.preventDefault()}),children:r.jsx(rv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ee=>Ee.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(ke,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:Ee=>Ee.preventDefault(),...E,...Be,onPlaced:()=>ae(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:on(E.onKeyDown,Ee=>{const Ue=Ee.ctrlKey||Ee.altKey||Ee.metaKey;if(Ee.key==="Tab"&&Ee.preventDefault(),!Ue&&Ee.key.length===1&&Ce(Ee.key),["ArrowUp","ArrowDown","Home","End"].includes(Ee.key)){let be=oe().filter(tt=>!tt.disabled).map(tt=>tt.ref.current);if(["ArrowUp","End"].includes(Ee.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ee.key)){const tt=Ee.target,Te=be.indexOf(tt);be=be.slice(Te+1)}setTimeout(()=>se(be)),Ee.preventDefault()}})})})})})})});z6e.displayName=ait;var oit="SelectItemAlignedPosition",B6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:s,...a}=t,o=iv(qj,n),l=ov(qj,n),[i,h]=I.useState(null),[p,x]=I.useState(null),y=ta(e,V=>x(V)),_=Gne(n),j=I.useRef(!1),C=I.useRef(!0),{viewport:N,selectedItem:A,selectedItemText:E,focusSelectedItem:T}=l,P=I.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&p&&N&&A&&E){const V=o.trigger.getBoundingClientRect(),K=p.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),te=E.getBoundingClientRect();if(o.dir!=="rtl"){const tt=te.left-K.left,Te=G.left-tt,Ke=V.left-Te,me=V.width+Ke,yt=Math.max(me,K.width),rt=window.innerWidth-Gp,at=nE(Te,[Gp,Math.max(Gp,rt-yt)]);i.style.minWidth=me+"px",i.style.left=at+"px"}else{const tt=K.right-te.right,Te=window.innerWidth-G.right-tt,Ke=window.innerWidth-V.right-Te,me=V.width+Ke,yt=Math.max(me,K.width),rt=window.innerWidth-Gp,at=nE(Te,[Gp,Math.max(Gp,rt-yt)]);i.style.minWidth=me+"px",i.style.right=at+"px"}const ie=_(),oe=window.innerHeight-Gp*2,ye=N.scrollHeight,ae=window.getComputedStyle(p),pe=parseInt(ae.borderTopWidth,10),se=parseInt(ae.paddingTop,10),he=parseInt(ae.borderBottomWidth,10),ue=parseInt(ae.paddingBottom,10),_e=pe+se+ye+ue+he,Ae=Math.min(A.offsetHeight*5,_e),Ce=window.getComputedStyle(N),Se=parseInt(Ce.paddingTop,10),ge=parseInt(Ce.paddingBottom,10),Le=V.top+V.height/2-Gp,ke=oe-Le,Be=A.offsetHeight/2,Ee=A.offsetTop+Be,Ue=pe+se+Ee,Fe=_e-Ue;if(Ue<=Le){const tt=ie.length>0&&A===ie[ie.length-1].ref.current;i.style.bottom="0px";const Te=p.clientHeight-N.offsetTop-N.offsetHeight,Ke=Math.max(ke,Be+(tt?ge:0)+Te+he),me=Ue+Ke;i.style.height=me+"px"}else{const tt=ie.length>0&&A===ie[0].ref.current;i.style.top="0px";const Ke=Math.max(Le,pe+N.offsetTop+(tt?Se:0)+Be)+Fe;i.style.height=Ke+"px",N.scrollTop=Ue-Le+N.offsetTop}i.style.margin=`${Gp}px 0`,i.style.minHeight=Ae+"px",i.style.maxHeight=oe+"px",s==null||s(),requestAnimationFrame(()=>j.current=!0)}},[_,o.trigger,o.valueNode,i,p,N,A,E,o.dir,s]);ec(()=>P(),[P]);const[z,F]=I.useState();ec(()=>{p&&F(window.getComputedStyle(p).zIndex)},[p]);const q=I.useCallback(V=>{V&&C.current===!0&&(P(),T==null||T(),C.current=!1)},[P,T]);return r.jsx(cit,{scope:n,contentWrapper:i,shouldExpandOnScrollRef:j,onScrollButtonChange:q,children:r.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:r.jsx(Rn.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});B6e.displayName=oit;var lit="SelectPopperPosition",the=I.forwardRef((t,e)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=Gp,...o}=t,l=Kne(n);return r.jsx(pI,{...l,...o,ref:e,align:s,collisionPadding:a,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)"}})});the.displayName=lit;var[cit,Lge]=d3(qj,{}),rhe="SelectViewport",$6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:s,...a}=t,o=ov(rhe,n),l=Lge(rhe,n),i=ta(e,o.onViewportChange),h=I.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(Wne.Slot,{scope:n,children:r.jsx(Rn.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:on(a.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:_}=l;if(_!=null&&_.current&&y){const j=Math.abs(h.current-x.scrollTop);if(j>0){const C=window.innerHeight-Gp*2,N=parseFloat(y.style.minHeight),A=parseFloat(y.style.height),E=Math.max(N,A);if(E0?z:0,y.style.justifyContent="flex-end")}}}h.current=x.scrollTop})})})]})});$6e.displayName=rhe;var U6e="SelectGroup",[dit,uit]=d3(U6e),hit=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=Kc();return r.jsx(dit,{scope:n,id:a,children:r.jsx(Rn.div,{role:"group","aria-labelledby":a,...s,ref:e})})});hit.displayName=U6e;var q6e="SelectLabel",V6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=uit(q6e,n);return r.jsx(Rn.div,{id:a.id,...s,ref:e})});V6e.displayName=q6e;var Jee="SelectItem",[fit,H6e]=d3(Jee),W6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:o,...l}=t,i=iv(Jee,n),h=ov(Jee,n),p=i.value===s,[x,y]=I.useState(o??""),[_,j]=I.useState(!1),C=ta(e,T=>{var P;return(P=h.itemRefCallback)==null?void 0:P.call(h,T,s,a)}),N=Kc(),A=I.useRef("touch"),E=()=>{a||(i.onValueChange(s),i.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(fit,{scope:n,value:s,disabled:a,textId:N,isSelected:p,onItemTextChange:I.useCallback(T=>{y(P=>P||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(Wne.ItemSlot,{scope:n,value:s,disabled:a,textValue:x,children:r.jsx(Rn.div,{role:"option","aria-labelledby":N,"data-highlighted":_?"":void 0,"aria-selected":p&&_,"data-state":p?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:C,onFocus:on(l.onFocus,()=>j(!0)),onBlur:on(l.onBlur,()=>j(!1)),onClick:on(l.onClick,()=>{A.current!=="mouse"&&E()}),onPointerUp:on(l.onPointerUp,()=>{A.current==="mouse"&&E()}),onPointerDown:on(l.onPointerDown,T=>{A.current=T.pointerType}),onPointerMove:on(l.onPointerMove,T=>{var P;A.current=T.pointerType,a?(P=h.onItemLeave)==null||P.call(h):A.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:on(l.onPointerLeave,T=>{var P;T.currentTarget===document.activeElement&&((P=h.onItemLeave)==null||P.call(h))}),onKeyDown:on(l.onKeyDown,T=>{var z;((z=h.searchRef)==null?void 0:z.current)!==""&&T.key===" "||(Qat.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});W6e.displayName=Jee;var lT="SelectItemText",G6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:a,...o}=t,l=iv(lT,n),i=ov(lT,n),h=H6e(lT,n),p=rit(lT,n),[x,y]=I.useState(null),_=ta(e,E=>y(E),h.onItemTextChange,E=>{var T;return(T=i.itemTextRefCallback)==null?void 0:T.call(i,E,h.value,h.disabled)}),j=x==null?void 0:x.textContent,C=I.useMemo(()=>r.jsx("option",{value:h.value,disabled:h.disabled,children:j},h.value),[h.disabled,h.value,j]),{onNativeOptionAdd:N,onNativeOptionRemove:A}=p;return ec(()=>(N(C),()=>A(C)),[N,A,C]),r.jsxs(r.Fragment,{children:[r.jsx(Rn.span,{id:h.textId,...o,ref:_}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?gy.createPortal(o.children,l.valueNode):null]})});G6e.displayName=lT;var K6e="SelectItemIndicator",Z6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return H6e(K6e,n).isSelected?r.jsx(Rn.span,{"aria-hidden":!0,...s,ref:e}):null});Z6e.displayName=K6e;var nhe="SelectScrollUpButton",Y6e=I.forwardRef((t,e)=>{const n=ov(nhe,t.__scopeSelect),s=Lge(nhe,t.__scopeSelect),[a,o]=I.useState(!1),l=ta(e,s.onScrollButtonChange);return ec(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=h.scrollTop>0;o(p)};const h=n.viewport;return i(),h.addEventListener("scroll",i),()=>h.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(Q6e,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:h}=n;i&&h&&(i.scrollTop=i.scrollTop-h.offsetHeight)}}):null});Y6e.displayName=nhe;var she="SelectScrollDownButton",X6e=I.forwardRef((t,e)=>{const n=ov(she,t.__scopeSelect),s=Lge(she,t.__scopeSelect),[a,o]=I.useState(!1),l=ta(e,s.onScrollButtonChange);return ec(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=h.scrollHeight-h.clientHeight,x=Math.ceil(h.scrollTop)h.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(Q6e,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:h}=n;i&&h&&(i.scrollTop=i.scrollTop+h.offsetHeight)}}):null});X6e.displayName=she;var Q6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=t,o=ov("SelectScrollButton",n),l=I.useRef(null),i=Gne(n),h=I.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return I.useEffect(()=>()=>h(),[h]),ec(()=>{var x;const p=i().find(y=>y.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[i]),r.jsx(Rn.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:on(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:on(a.onPointerMove,()=>{var p;(p=o.onItemLeave)==null||p.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:on(a.onPointerLeave,()=>{h()})})}),pit="SelectSeparator",J6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return r.jsx(Rn.div,{"aria-hidden":!0,...s,ref:e})});J6e.displayName=pit;var ahe="SelectArrow",mit=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=Kne(n),o=iv(ahe,n),l=ov(ahe,n);return o.open&&l.position==="popper"?r.jsx(mI,{...a,...s,ref:e}):null});mit.displayName=ahe;var git="SelectBubbleInput",eLe=I.forwardRef(({__scopeSelect:t,value:e,...n},s)=>{const a=I.useRef(null),o=ta(s,a),l=NI(e);return I.useEffect(()=>{const i=a.current;if(!i)return;const h=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==e&&x){const y=new Event("change",{bubbles:!0});x.call(i,e),i.dispatchEvent(y)}},[l,e]),r.jsx(Rn.select,{...n,style:{...YTe,...n.style},ref:o,defaultValue:e})});eLe.displayName=git;function tLe(t){return t===""||t===void 0}function rLe(t){const e=Ql(t),n=I.useRef(""),s=I.useRef(0),a=I.useCallback(l=>{const i=n.current+l;e(i),function h(p){n.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>h(""),1e3))}(i)},[e]),o=I.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,o]}function nLe(t,e,n){const a=e.length>1&&Array.from(e).every(p=>p===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let l=xit(t,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.textValue.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function xit(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var yit=A6e,sLe=I6e,vit=L6e,_it=O6e,bit=D6e,aLe=R6e,wit=$6e,iLe=V6e,oLe=W6e,jit=G6e,kit=Z6e,lLe=Y6e,cLe=X6e,dLe=J6e;const gn=yit,yn=vit,fn=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(sLe,{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(_it,{asChild:!0,children:r.jsx(Fd,{className:"h-4 w-4 opacity-50"})})]}));fn.displayName=sLe.displayName;const uLe=I.forwardRef(({className:t,...e},n)=>r.jsx(lLe,{ref:n,className:zt("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(f1,{className:"h-4 w-4"})}));uLe.displayName=lLe.displayName;const hLe=I.forwardRef(({className:t,...e},n)=>r.jsx(cLe,{ref:n,className:zt("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(Fd,{className:"h-4 w-4"})}));hLe.displayName=cLe.displayName;const pn=I.forwardRef(({className:t,children:e,position:n="popper",...s},a)=>r.jsx(bit,{children:r.jsxs(aLe,{ref:a,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(uLe,{}),r.jsx(wit,{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(hLe,{})]})}));pn.displayName=aLe.displayName;const Nit=I.forwardRef(({className:t,...e},n)=>r.jsx(iLe,{ref:n,className:zt("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Nit.displayName=iLe.displayName;const qt=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(oLe,{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(kit,{children:r.jsx(Ai,{className:"h-4 w-4"})})}),r.jsx(jit,{children:e})]}));qt.displayName=oLe.displayName;const Sit=I.forwardRef(({className:t,...e},n)=>r.jsx(dLe,{ref:n,className:zt("-mx-1 my-1 h-px bg-muted",t),...e}));Sit.displayName=dLe.displayName;const Cit=t=>Yt({queryKey:["public-listings",t],queryFn:async()=>{let e=J.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, latitude, longitude, 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}}),fLe=t=>Yt({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=J.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, latitude, longitude, 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:a}=await n.single();if(a)throw a;return s},enabled:!!t}),pLe=()=>cr({mutationFn:async({listingId:t,agentId:e,firstName:n,lastName:s,email:a,phone:o,shareToken:l})=>{let i=null,h=null;if(l){const{data:_}=await J.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",t).maybeSingle();_&&(i=_.id,h=_.sharing_agent_id)}const{data:p,error:x}=await J.from("listing_leads").insert({listing_id:t,agent_id:h||e,first_name:n,last_name:s,email:a,phone:o,share_id:i,referred_by_agent_id:h}).select().single();if(x)throw x;const{error:y}=await J.functions.invoke("process-listing-lead",{body:{leadId:p.id}});return y&&console.error("Error processing lead:",y),p}}),Mit=()=>cr({mutationFn:async t=>{const{error:e}=await J.rpc("increment_listing_share_click",{p_share_token:t});if(e)throw e}}),Tit={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},xje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Ait={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function mLe(){const[t,e]=I.useState(""),[n,s]=I.useState(!1),[a,o]=I.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=Cit({city:t||void 0,status:a.status||void 0,propertyType:a.propertyType||void 0,minPrice:a.minPrice?Number(a.minPrice):void 0,maxPrice:a.maxPrice?Number(a.maxPrice):void 0}),h=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),p=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),e("")},x=t||a.status||a.propertyType||a.minPrice||a.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{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(co,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:C6e,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(${Gat})`},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(wa,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(dt,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:t,onChange:y=>e(y.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(ee,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(wa,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(ee,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(XT,{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(gn,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(yn,{placeholder:"Any status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"Any status"}),Object.entries(xje).map(([y,_])=>r.jsx(qt,{value:y,children:_},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(gn,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(yn,{placeholder:"Any type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"Any type"}),Object.entries(Ait).map(([y,_])=>r.jsx(qt,{value:y,children:_},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(dt,{type:"number",placeholder:"No min",value:a.minPrice,onChange:y=>o({...a,minPrice:y.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(dt,{type:"number",placeholder:"No max",value:a.maxPrice,onChange:y=>o({...a,maxPrice:y.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:p,className:"gap-1 text-gray-500",children:[r.jsx(_s,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),l&&l.length>0&&r.jsx("section",{className:"py-8 bg-white border-b border-gray-200",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"Explore on Map"}),r.jsx(Yat,{listings:l,isLoading:i})]})}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:i?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((y,_)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Ir,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Ir,{className:"h-7 w-28"}),r.jsx(Ir,{className:"h-4 w-full"}),r.jsx(Ir,{className:"h-4 w-3/4"})]})]},_))}):l&&l.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:[l.length," ",l.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:l.map(y=>{var N,A,E;const _=((N=y.photos)==null?void 0:N.find(T=>T.is_primary))||((A=y.photos)==null?void 0:A[0]),C=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return r.jsx(co,{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:[_?r.jsx("img",{src:_.photo_url,alt:y.property_address||y.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(da,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Ot,{className:`absolute top-2 left-2 ${Tit[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:xje[y.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:T=>T.preventDefault(),children:r.jsx(ci,{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:h(y.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[y.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),y.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:y.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[y.city,", ",y.state]}),y.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:y.agent.name}),((E=y.agent.brokerage)==null?void 0:E.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:y.agent.brokerage.name})]})]})]})},y.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(da,{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:x?"Try adjusting your search or filters":"Check back soon for new listings"}),x&&r.jsx(ee,{variant:"outline",onClick:p,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:Pge,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=I.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 Gt=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("flex flex-col space-y-1.5 p-6",t),...e}));Gt.displayName="CardHeader";const Zt=I.forwardRef(({className:t,...e},n)=>r.jsx("h3",{ref:n,className:zt("text-2xl font-semibold leading-none tracking-tight",t),...e}));Zt.displayName="CardTitle";const Tn=I.forwardRef(({className:t,...e},n)=>r.jsx("p",{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Tn.displayName="CardDescription";const Je=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("p-6 pt-0",t),...e}));Je.displayName="CardContent";const oA=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("flex items-center p-6 pt-0",t),...e}));oA.displayName="CardFooter";var Eit="Label",gLe=I.forwardRef((t,e)=>r.jsx(Rn.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));gLe.displayName=Eit;var xLe=gLe;const Iit=YC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),He=I.forwardRef(({className:t,...e},n)=>r.jsx(xLe,{ref:n,className:zt(Iit(),t),...e}));He.displayName=xLe.displayName;const ete="/assets/levelup-logo-color-D3mY9gCJ.png";function Pit(){const t=Nm(),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(mLe,{}):s.startsWith("public/")?null:r.jsx(Lit,{slug:s})}function Lit({slug:t}){return r.jsx(Rit,{slug:t})}const Oit={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Dit={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},yje={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Rit({slug:t}){var G,te;const{data:e,isLoading:n}=fLe(t),s=pLe(),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(""),[_,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(null),T=ie=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ie),P=async ie=>{if(ie.preventDefault(),!(!a.trim()||!h.trim()||!e)){j(!0);try{await s.mutateAsync({listingId:e.id,agentId:e.agent_id,firstName:a.trim(),lastName:l.trim(),email:h.trim(),phone:x.trim()}),N(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(oe){console.error("Lead submission error:",oe),ze.error(`Failed to submit: ${oe.message||"Please try again"}`)}finally{j(!1)}}},z=(e==null?void 0:e.photos)||[],F=z.find(ie=>ie.is_primary)||z[0],q=()=>{A!==null&&E(A===0?z.length-1:A-1)},V=()=>{A!==null&&E(A===z.length-1?0:A+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(Ir,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Ir,{className:"h-10 w-48 mb-6"}),r.jsx(Ir,{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(Ir,{className:"h-12 w-48"}),r.jsx(Ir,{className:"h-6 w-full"}),r.jsx(Ir,{className:"h-6 w-3/4"})]}),r.jsx(Ir,{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:ete,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(da,{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(ee,{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(Sm,{children:[r.jsxs("title",{children:[K," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${T(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA ${e.square_footage?e.square_footage.toLocaleString()+" sqft":""} ${yje[e.property_type]} in ${e.city}, ${e.state}. ${((G=e.description)==null?void 0:G.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:K}),r.jsx("meta",{property:"og:description",content:`${T(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:ete,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(so,{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:()=>E(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:z.slice(1,5).map((ie,oe)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>E(oe+1),children:[r.jsx("img",{src:ie.photo_url,alt:`Photo ${oe+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),oe===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"]})]},ie.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(Ot,{className:`${Oit[e.status]} text-white border-0`,children:Dit[e.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:T(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(Mo,{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(h1,{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(u1,{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(kg,{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(Os,{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(Ot,{variant:"secondary",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),yje[e.property_type]]}),e.lot_size&&r.jsxs(Ot,{variant:"secondary",children:["Lot: ",e.lot_size]}),e.has_hoa&&r.jsx(Ot,{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(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:e.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{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(Gt,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Ic,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"font-semibold text-lg",children:e.agent.name}),((te=e.agent.brokerage)==null?void 0:te.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.agent.brokerage.name})]})]}),r.jsxs(Ye,{className:"border-primary",children:[r.jsx(Gt,{children:r.jsx(Zt,{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(ua,{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:P,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"firstName",children:"First Name *"}),r.jsx(dt,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:ie=>o(ie.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lastName",children:"Last Name"}),r.jsx(dt,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ie=>i(ie.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:h,onChange:ie=>p(ie.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ie=>y(ie.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:_,children:_?"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(Fr,{open:A!==null,onOpenChange:()=>E(null),children:r.jsxs(Rr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(qr,{className:"sr-only",children:r.jsx($r,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>E(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(_s,{className:"h-5 w-5"})}),A!==null&&z[A]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:z[A].photo_url,alt:`Photo ${A+1}`,className:"w-full max-h-[80vh] object-contain"}),z.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(Ac,{className:"h-6 w-6"})}),r.jsx("button",{onClick:V,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(Vi,{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:[A+1," / ",z.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"})})]})})]})]})}function Zne({card:t,variant:e}){const n=t.brokerage_display_name||t.brokerage_logo_url,s=t.team_name||t.team_logo_url;if(!n&&!s)return null;const a={standard:{container:"bg-slate-50 border border-slate-100",text:"text-slate-600",subtext:"text-slate-400"},luxury:{container:"bg-[#1e2636] border border-[#c9a84c]/10",text:"text-[#e2e8f0]",subtext:"text-[#4a5568]"},bold:{container:"bg-gray-50 border border-gray-100",text:"text-[#1a1a2e]",subtext:"text-gray-400"},classic:{container:"bg-white border border-[#d4cfc5] shadow-sm",text:"text-[#1b3a4b]",subtext:"text-[#a0aec0]"}}[e];return r.jsx("div",{className:`rounded-2xl p-4 mb-6 ${a.container}`,children:r.jsxs("div",{className:`flex flex-col items-center gap-3 ${n&&s?"divide-y divide-current/10":""}`,children:[n&&r.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-full",children:[t.brokerage_logo_url&&r.jsx("img",{src:t.brokerage_logo_url,alt:t.brokerage_display_name||"Brokerage",style:{height:`${t.brokerage_logo_size||56}px`},className:"max-w-[280px] object-contain"}),t.brokerage_display_name&&!t.brokerage_logo_url&&r.jsx("p",{className:`text-sm font-medium ${a.text}`,children:t.brokerage_display_name})]}),s&&r.jsxs("div",{className:`flex flex-col items-center gap-1.5 w-full ${n?"pt-3":""}`,children:[t.team_logo_url&&r.jsx("img",{src:t.team_logo_url,alt:t.team_name||"Team",style:{height:`${t.team_logo_size||56}px`},className:"max-w-[280px] object-contain"}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:`text-sm font-medium ${a.text}`,children:t.team_name})]})]})})}const yLe=t=>Yt({queryKey:["agent-card-public",t],queryFn:async()=>{if(!t)throw new Error("No slug provided");const{data:e,error:n}=await J.from("agent_cards").select("*").eq("slug",t).eq("is_published",!0).single();if(n)throw n;const{data:s}=await J.from("profiles").select("name, email, phone, brokerage_id").eq("id",e.user_id).single();let a=null;if(s!=null&&s.brokerage_id){const{data:l}=await J.from("brokerages").select("name").eq("id",s.brokerage_id).single();a=(l==null?void 0:l.name)||null}let o=null;try{const{data:l}=await J.from("profiles").select("avatar_url").eq("id",e.user_id).single();if(l!=null&&l.avatar_url)o=l.avatar_url;else{const{data:i}=await J.storage.from("avatars").list(`${e.user_id}`);if(i&&i.length>0){const{data:h}=J.storage.from("avatars").getPublicUrl(`${e.user_id}/${i[0].name}`);o=`${h.publicUrl}?t=${Date.now()}`}}}catch{}return{...e,social_links:e.social_links||[],profile:s||{name:null,email:null,phone:null,brokerage_id:null},brokerage_name:e.brokerage_display_name||a,avatar_url:o}},enabled:!!t}),Fit=()=>Yt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:t,error:e}=await J.from("agent_cards").select("*").order("created_at",{ascending:!1});if(e)throw e;return t}}),zit=t=>Yt({queryKey:["agent-card",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("agent_cards").select("*").eq("user_id",t).maybeSingle();if(n)throw n;return e},enabled:!!t}),vLe=()=>{const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("agent_cards").insert(e).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-cards-admin"]}),t.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card created")},onError:e=>ze.error(e.message)})},_Le=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("agent_cards").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["agent-cards-admin"]}),t.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card updated")},onError:e=>ze.error(e.message)})},Ti=async(t,e,n,s)=>{const a=new URLSearchParams(window.location.search);await J.from("agent_card_interactions").insert({card_id:t,interaction_type:e,interaction_detail:n||null,referrer:document.referrer||null,user_agent:navigator.userAgent||null,utm_source:a.get("utm_source")||null,utm_medium:a.get("utm_medium")||null,utm_campaign:a.get("utm_campaign")||null,metadata:{}})},Bit=async(t,e)=>{const{error:n}=await J.from("agent_card_leads").insert({card_id:t,...e});if(n)throw n},bLe=t=>Yt({queryKey:["agent-card-analytics",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("agent_card_interactions").select("interaction_type, interaction_detail, created_at").eq("card_id",t).order("created_at",{ascending:!1}).limit(500);if(n)throw n;const{data:s,error:a}=await J.from("agent_card_leads").select("*").eq("card_id",t).order("created_at",{ascending:!1});if(a)throw a;const o=(e==null?void 0:e.filter(h=>h.interaction_type==="card_view").length)||0,l=(e==null?void 0:e.filter(h=>h.interaction_type==="button_click").length)||0,i=(e==null?void 0:e.filter(h=>h.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:i,leads:s||[],interactions:e||[]}},enabled:!!t});function Yne({open:t,onOpenChange:e,cardId:n,type:s,agentName:a}){const[o,l]=I.useState(""),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(""),[j,C]=I.useState(""),[N,A]=I.useState(!1),E=async T=>{if(T.preventDefault(),!o.trim()){ze.error("Please enter your name");return}A(!0);try{await Bit(n,{lead_type:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}),Ti(n,"lead_submitted",s),J.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}}).catch(P=>console.error("Card lead notify failed:",P)),ze.success(s==="booking"?"Request sent! They'll be in touch soon.":s==="connect"?"Info shared! They'll be in touch soon.":"Referral submitted! Thank you."),e(!1),l(""),h(""),x(""),_(""),C("")}catch{ze.error("Something went wrong. Please try again.")}finally{A(!1)}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Qn,{children:s==="booking"?`Let ${a} know you'd like to connect.`:s==="connect"?`Share your info and ${a} will reach out.`:`Know someone who could use ${a}'s help?`})]}),r.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-name",children:"Name *"}),r.jsx(dt,{id:"lead-name",value:o,onChange:T=>l(T.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-phone",children:"Phone"}),r.jsx(dt,{id:"lead-phone",type:"tel",value:p,onChange:T=>x(T.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-email",children:"Email"}),r.jsx(dt,{id:"lead-email",type:"email",value:i,onChange:T=>h(T.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(gn,{value:y,onValueChange:_,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select one"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buy",children:"Buy a home"}),r.jsx(qt,{value:"sell",children:"Sell my home"}),r.jsx(qt,{value:"both",children:"Buy & Sell"}),r.jsx(qt,{value:"other",children:"Something else"})]})]})]}),s!=="connect"&&r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(dt,{id:"lead-message",value:j,onChange:T=>C(T.target.value),placeholder:s==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),r.jsx(ee,{type:"submit",className:"w-full rounded-2xl",disabled:N,children:N?"Sending...":"Submit"})]})]})})}const $it=t=>Yt({queryKey:["card-blocks",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("card_blocks").select("*").eq("card_id",t).eq("is_visible",!0).order("sort_order",{ascending:!0});if(n)throw n;return e||[]},enabled:!!t}),Uit=t=>Yt({queryKey:["card-blocks-all",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("card_blocks").select("*").eq("card_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e||[]},enabled:!!t}),qit=()=>{const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("card_blocks").insert(e).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["card-blocks",n.card_id]}),t.invalidateQueries({queryKey:["card-blocks-all",n.card_id]}),ze.success("Block added")},onError:e=>ze.error(e.message)})},Vit=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("card_blocks").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block updated")},onError:e=>ze.error(e.message)})},Hit=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("card_blocks").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block removed")},onError:e=>ze.error(e.message)})};function Wit(t){const e=t.match(/(?:iframe\.mediadelivery\.net\/embed\/|video\.bunnycdn\.com\/play\/)(\d+)\/([a-f0-9-]+)/i);return e?`https://iframe.mediadelivery.net/embed/${e[1]}/${e[2]}?autoplay=false&responsive=true`:(t.includes("iframe.mediadelivery.net"),t)}function Git(t){const e=t.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/);return e?`https://www.youtube.com/embed/${e[1]}`:null}const Kit={standard:"rounded-2xl overflow-hidden mb-6 bg-slate-100",luxury:"rounded-xl overflow-hidden mb-6 bg-[#1e2636] border border-[#c9a84c]/10",bold:"rounded-2xl overflow-hidden mb-6",classic:"rounded-lg overflow-hidden mb-6 border border-[#d4cfc5] shadow-sm"};function Zit({block:t,variant:e}){const n=t.config;if(!n.video_url)return null;const s=n.video_url.includes("mediadelivery.net")||n.video_url.includes("bunnycdn.com"),a=Git(n.video_url),o=s||!!a,l=s?Wit(n.video_url):a||n.video_url;return r.jsx("div",{className:Kit[e],children:o?r.jsx("div",{style:{position:"relative",paddingTop:"56.25%"},children:r.jsx("iframe",{src:l,loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,width:"100%",height:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsx("video",{src:n.video_url,controls:!0,className:"w-full",preload:"metadata"})})}const Yit={standard:{container:"mb-6",card:"bg-slate-50 rounded-2xl p-5 border border-slate-100",quote:"text-sm text-slate-600 italic",name:"text-sm font-semibold text-slate-800",role:"text-xs text-slate-500",dot:"bg-primary",dotInactive:"bg-slate-300",nav:"text-slate-400 hover:text-slate-600"},luxury:{container:"mb-6",card:"bg-[#1e2636] rounded-xl p-5 border border-[#c9a84c]/10",quote:"text-sm text-[#a0aec0] italic font-serif",name:"text-sm font-semibold text-white",role:"text-xs text-[#c9a84c]",dot:"bg-[#c9a84c]",dotInactive:"bg-[#2a3040]",nav:"text-[#4a5568] hover:text-[#c9a84c]"},bold:{container:"mb-6",card:"bg-[#fff3e0] rounded-2xl p-5",quote:"text-sm text-[#1a1a2e] font-medium",name:"text-sm font-black text-[#1a1a2e]",role:"text-xs text-[#ff5722] font-bold",dot:"bg-[#ff5722]",dotInactive:"bg-gray-300",nav:"text-gray-400 hover:text-[#ff5722]"},classic:{container:"mb-6",card:"bg-white rounded-lg p-5 border border-[#d4cfc5] shadow-sm",quote:"text-sm text-[#4a5568] italic font-serif",name:"text-sm font-semibold text-[#1b3a4b]",role:"text-xs text-[#5a7a6f]",dot:"bg-[#1b3a4b]",dotInactive:"bg-[#d4cfc5]",nav:"text-[#a0aec0] hover:text-[#1b3a4b]"}};function Xit({block:t,variant:e}){const s=t.config.testimonials||[],[a,o]=I.useState(0);if(s.length===0)return null;const l=Yit[e],i=s[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(HT,{className:"h-4 w-4 mb-2 opacity-30"}),r.jsxs("p",{className:`${l.quote} mb-3`,children:['"',i.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:l.name,children:i.name}),i.role&&r.jsx("p",{className:l.role,children:i.role})]})]}),s.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(h=>(h-1+s.length)%s.length),className:l.nav,children:r.jsx(Ac,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((h,p)=>r.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${p===a?l.dot:l.dotInactive}`,onClick:()=>o(p)},p))}),r.jsx("button",{onClick:()=>o(h=>(h+1)%s.length),className:l.nav,children:r.jsx(Vi,{className:"h-4 w-4"})})]})]})}const Qit={standard:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-primary/10 text-primary"},luxury:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-[#c9a84c]/10 text-[#e8d48b] border border-[#c9a84c]/20"},bold:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-black rounded-full bg-[#1a1a2e] text-white uppercase tracking-wide"},classic:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-md bg-[#1b3a4b]/10 text-[#1b3a4b] border border-[#d4cfc5]"}};function Jit({block:t,variant:e}){const s=t.config.tags||[];if(s.length===0)return null;const a=Qit[e];return r.jsx("div",{className:a.container,children:s.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const eot={standard:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-2xl bg-slate-50 hover:bg-slate-100 border border-slate-100 transition-colors text-sm font-medium text-slate-700",icon:"text-primary"},luxury:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-xl bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/10 transition-colors text-sm font-medium text-[#e2e8f0]",icon:"text-[#c9a84c]"},bold:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-2xl bg-gray-50 hover:bg-gray-100 transition-colors text-sm font-bold text-[#1a1a2e]",icon:"text-[#ff5722]"},classic:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-lg bg-white hover:bg-[#f5f1eb] border border-[#d4cfc5] shadow-sm transition-colors text-sm font-medium text-[#1b3a4b]",icon:"text-[#5a7a6f]"}};function tot({block:t,cardId:e,variant:n}){const a=t.config.links||[];if(a.length===0)return null;const o=eot[n];return r.jsx("div",{className:o.container,children:a.map((l,i)=>r.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(e,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Ls,{className:`h-4 w-4 ${o.icon}`})]},i))})}const ihe={instagram:{label:"Instagram",icon:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z",color:"#E4405F",hoverBg:"hover:bg-[#E4405F]/10"},facebook:{label:"Facebook",icon:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z",color:"#1877F2",hoverBg:"hover:bg-[#1877F2]/10"},linkedin:{label:"LinkedIn",icon:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",color:"#0A66C2",hoverBg:"hover:bg-[#0A66C2]/10"},twitter:{label:"X",icon:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z",color:"#000000",hoverBg:"hover:bg-black/10"},youtube:{label:"YouTube",icon:"M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814z M9.545 15.568V8.432L15.818 12z",color:"#FF0000",hoverBg:"hover:bg-[#FF0000]/10"},tiktok:{label:"TikTok",icon:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",color:"#000000",hoverBg:"hover:bg-black/10"},zillow:{label:"Zillow",icon:"M12 0L1 6v12l11 6 11-6V6L12 0zm0 2.18L21 7.5v9L12 21.82 3 16.5v-9L12 2.18z",color:"#006AFF",hoverBg:"hover:bg-[#006AFF]/10"},realtor:{label:"Realtor",icon:"M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l8 4v8l-8 4-8-4v-8l8-4z",color:"#D92228",hoverBg:"hover:bg-[#D92228]/10"}};function rot({path:t,color:e,size:n=20}){return r.jsx("svg",{viewBox:"0 0 24 24",width:n,height:n,fill:e,children:r.jsx("path",{d:t})})}const not={standard:{container:"bg-white rounded-2xl border border-slate-100 p-5 mb-6 shadow-sm",title:"text-sm font-semibold text-slate-800 mb-3",linkClass:"h-11 w-11 rounded-xl bg-slate-50 border border-slate-100 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:shadow-md"},luxury:{container:"bg-zinc-900/50 backdrop-blur rounded-2xl border border-amber-900/20 p-5 mb-6",title:"text-sm font-semibold text-amber-200/80 mb-3",linkClass:"h-11 w-11 rounded-xl bg-zinc-800/80 border border-amber-900/20 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:border-amber-500/40 hover:shadow-md hover:shadow-amber-500/10"},bold:{container:"bg-white/10 backdrop-blur rounded-2xl border border-white/20 p-5 mb-6",title:"text-sm font-semibold text-white/90 mb-3",linkClass:"h-11 w-11 rounded-xl bg-white/10 border border-white/20 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:bg-white/20 hover:shadow-md"},classic:{container:"bg-stone-50 rounded-2xl border border-stone-200 p-5 mb-6",title:"text-sm font-semibold text-stone-800 mb-3",linkClass:"h-11 w-11 rounded-xl bg-white border border-stone-200 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:shadow-md"}};function sot({block:t,cardId:e,variant:n}){const a=t.config.platforms||[],o=not[n];return a.length===0?null:r.jsxs("div",{className:o.container,children:[r.jsx("h3",{className:o.title,children:"Follow Me"}),r.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:a.map((l,i)=>{const h=ihe[l.platform.toLowerCase()];return!h||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(e,"button_click",`social_${l.platform}`),className:o.linkClass,title:h.label,children:r.jsx(rot,{path:h.icon,color:h.color})},i)})})]})}function Xne({cardId:t,variant:e}){const{data:n}=$it(t);if(!n||n.length===0)return null;const s=n.filter(l=>l.block_type==="social_media"&&l.is_visible),a=n.filter(l=>l.block_type!=="social_media"),o=s.length>0?{...s[0],config:{platforms:s.flatMap(l=>l.config.platforms||[])}}:null;return n.findIndex(l=>l.block_type==="social_media"),r.jsxs(r.Fragment,{children:[a.map(l=>{switch(l.block_type){case"video_intro":return r.jsx(Zit,{block:l,variant:e},l.id);case"testimonials":return r.jsx(Xit,{block:l,variant:e},l.id);case"specialties":return r.jsx(Jit,{block:l,variant:e},l.id);case"custom_links":return r.jsx(tot,{block:l,cardId:t,variant:e},l.id);default:return null}}),o&&r.jsx(sot,{block:o,cardId:t,variant:e})]})}async function aot(t){try{const e=await fetch(t);if(!e.ok)return null;const n=await e.blob(),s=n.type||"image/jpeg";return new Promise(a=>{const o=new FileReader;o.onloadend=()=>{const i=o.result.split(",")[1];a({base64:i,mimeType:s})},o.onerror=()=>a(null),o.readAsDataURL(n)})}catch{return null}}function iot(t){const e=t.trim().split(/\s+/);if(e.length<=1)return{first:e[0]||"",last:""};const n=e.pop();return{first:e.join(" "),last:n}}async function Qne(t){const{first:e,last:n}=iot(t.name),s=["BEGIN:VCARD","VERSION:3.0",`FN:${t.name}`,`N:${n};${e};;;`];if(t.phone&&s.push(`TEL;TYPE=CELL:${t.phone}`),t.email&&s.push(`EMAIL;TYPE=INTERNET:${t.email}`),t.brokerage&&s.push(`ORG:${t.brokerage}`),s.push(`URL:${t.cardUrl}`),t.avatarUrl){const i=await aot(t.avatarUrl);if(i){const p={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[i.mimeType]||"JPEG";s.push(`PHOTO;ENCODING=b;TYPE=${p}:${i.base64}`)}}s.push("END:VCARD");const a=new Blob([s.join(`\r `)],{type:"text/vcard"}),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=`${t.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),ze.success("Contact saved!")}function oot({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{Ti(t.id,"button_click",T),P()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},_=()=>{var T,P;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(P=t.profile)==null?void 0:P.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:t.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 via-white to-slate-50",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&r.jsxs(Ks,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-semibold bg-primary text-primary-foreground",children:l})]}),r.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-slate-500 mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-slate-400 mb-3",children:t.team_name}),t.positioning_statement&&r.jsxs("p",{className:"text-base text-slate-600 italic leading-relaxed max-w-xs mx-auto",children:['"',t.positioning_statement,'"']})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[r.jsxs(ee,{onClick:h,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(bi,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(ee,{onClick:p,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Oo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(ee,{onClick:x,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(ua,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(ee,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(Os,{className:"h-5 w-5 mr-2"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm text-slate-600",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-amber-500 fill-amber-500"}),r.jsx("span",{className:"font-bold text-slate-900",children:"5.0"})]})}),t.review_snippet&&r.jsx("div",{className:"bg-slate-50 rounded-2xl p-4 mb-6 border border-slate-100",children:r.jsxs("p",{className:"text-sm text-slate-600 italic text-center",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-2",children:"About Me"}),r.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"standard"}),r.jsx(Xne,{cardId:t.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[t.show_save_contact&&r.jsxs(ee,{variant:"ghost",onClick:_,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(no,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs(ee,{variant:"ghost",onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(vs,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),t.show_refer_friend&&r.jsxs(ee,{variant:"ghost",onClick:C,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Bn,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(ee,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(sf,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(ee,{variant:"ghost",onClick:j,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(pc,{className:"h-4 w-4 mr-3 text-primary"}),"Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((T,P)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-slate-100 hover:bg-slate-200 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function lot({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{Ti(t.id,"button_click",T),P()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},_=()=>{var T,P;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(P=t.profile)==null?void 0:P.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:t.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#0f1419] via-[#1a1f2e] to-[#0f1419]",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsx("div",{className:"w-16 h-0.5 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] mx-auto mb-8"}),r.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&r.jsxs(Ks,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-serif bg-[#c9a84c]/20 text-[#e8d48b]",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-white tracking-wide mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-medium text-[#e8d48b] mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#c9a84c] tracking-widest uppercase mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:t.team_name}),t.positioning_statement&&r.jsxs("p",{className:"text-base text-[#a0aec0] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',t.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:bi,label:"Call",handler:h},{icon:Oo,label:"Text",handler:p},{icon:ua,label:"Email",handler:x}].map(({icon:T,label:P,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/20 rounded-xl transition-colors",children:[r.jsx(T,{className:"h-5 w-5 text-[#c9a84c]"}),r.jsx("span",{className:"text-xs font-medium text-[#e2e8f0]",children:P})]},P))}),r.jsxs("button",{onClick:y,className:"w-full h-12 text-base font-semibold rounded-xl mb-6 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] text-[#0f1419] hover:opacity-90 transition-opacity flex items-center justify-center gap-2",children:[r.jsx(Os,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c] fill-[#c9a84c]"}),r.jsx("span",{className:"font-bold text-white",children:"5.0"})]})}),t.review_snippet&&r.jsx("div",{className:"bg-[#1e2636] rounded-xl p-4 mb-6 border border-[#c9a84c]/10",children:r.jsxs("p",{className:"text-sm text-[#a0aec0] italic text-center font-serif",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#c9a84c] mb-2 tracking-wide uppercase",children:"About"}),r.jsx("p",{className:"text-sm text-[#a0aec0] leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"luxury"}),r.jsx(Xne,{cardId:t.id,variant:"luxury"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:_,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(no,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Bn,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(sf,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(pc,{className:"h-4 w-4 text-[#c9a84c]"})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((T,P)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1e2636] border border-[#c9a84c]/20 hover:border-[#c9a84c]/50 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function cot({card:t}){var P,z,F,q;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((P=t.profile)==null?void 0:P.name)||"Agent",l=o.split(" ").map(V=>V[0]).join("").toUpperCase().slice(0,2),i={accent:((z=t.bold_theme_colors)==null?void 0:z.accent)||"#ff5722",dark:((F=t.bold_theme_colors)==null?void 0:F.dark)||"#1a1a2e",button:((q=t.bold_theme_colors)==null?void 0:q.button)||"#ff5722"},h=(V,K)=>{const G=parseInt(V.replace("#",""),16),te=Math.max(0,(G>>16)-K),ie=Math.max(0,(G>>8&255)-K),oe=Math.max(0,(G&255)-K);return`#${(te<<16|ie<<8|oe).toString(16).padStart(6,"0")}`};h(i.accent,25),h(i.dark,-20),h(i.button,25);const p=(V,K)=>{Ti(t.id,"button_click",V),K()},x=()=>p("call",()=>{var V;(V=t.profile)!=null&&V.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),y=()=>p("text",()=>{var V;(V=t.profile)!=null&&V.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),_=()=>p("email",()=>{var V;(V=t.profile)!=null&&V.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),j=()=>{t.booking_url?p("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},C=()=>{var V,K;Ti(t.id,"contact_saved"),Qne({name:o,phone:(V=t.profile)==null?void 0:V.phone,email:(K=t.profile)==null?void 0:K.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},N=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},A=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},E=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},T={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen",style:{backgroundColor:i.accent},children:[r.jsxs("div",{className:"px-5 pt-10 pb-14 text-center relative",style:{backgroundColor:i.dark},children:[t.show_photo&&r.jsxs(Ks,{className:"h-28 w-28 mx-auto mb-4 shadow-2xl",style:{boxShadow:`0 0 0 4px ${i.accent}`},children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-black text-white",style:{backgroundColor:i.accent},children:l})]}),r.jsx("h1",{className:"text-3xl font-black text-white tracking-tight mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-bold mb-1",style:{color:`${i.accent}cc`},children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-bold uppercase tracking-wider mb-1",style:{color:i.accent},children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-bold text-white/60 uppercase tracking-wider",children:t.team_name})]}),r.jsxs("div",{className:"max-w-md mx-auto px-5 -mt-6",children:[r.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl px-5 py-8",children:[t.positioning_statement&&r.jsx("p",{className:"text-center font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",style:{color:i.dark},children:t.positioning_statement}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:bi,label:"Call",handler:x},{icon:Oo,label:"Text",handler:y},{icon:ua,label:"Email",handler:_}].map(({icon:V,label:K,handler:G})=>r.jsxs("button",{onClick:G,className:"flex flex-col items-center gap-1.5 py-4 text-white rounded-2xl transition-opacity font-bold hover:opacity-85",style:{backgroundColor:i.dark},children:[r.jsx(V,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:K})]},K))}),r.jsxs("button",{onClick:j,className:"w-full h-14 text-base font-black rounded-2xl mb-6 text-white transition-opacity hover:opacity-90 flex items-center justify-center gap-2 uppercase tracking-wide",style:{backgroundColor:i.button},children:[r.jsx(Os,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-5 mb-6",children:t.review_snippet&&r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-5 w-5",style:{color:i.accent,fill:i.accent}}),r.jsx("span",{className:"font-black text-2xl",style:{color:i.dark},children:"5.0"})]})}),t.review_snippet&&r.jsx("div",{className:"rounded-2xl p-4 mb-6",style:{backgroundColor:`${i.accent}15`},children:r.jsxs("p",{className:"text-sm font-medium text-center",style:{color:i.dark},children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xs font-black mb-2 uppercase tracking-wider",style:{color:i.accent},children:"About Me"}),r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"bold"}),r.jsx(Xne,{cardId:t.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(no,{className:"h-4 w-4",style:{color:i.accent}})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(vs,{className:"h-4 w-4",style:{color:i.accent}})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:A,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(Bn,{className:"h-4 w-4",style:{color:i.accent}})," Refer a Friend"]}),r.jsxs("button",{onClick:E,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(sf,{className:"h-4 w-4",style:{color:i.accent}})," Connect with Me"]}),r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(pc,{className:"h-4 w-4",style:{color:i.accent}})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-6",children:t.social_links.slice(0,3).map((V,K)=>r.jsx("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${V.platform}`),className:"h-10 w-10 rounded-full flex items-center justify-center text-lg transition-opacity hover:opacity-85",style:{backgroundColor:i.dark},children:T[V.platform.toLowerCase()]||"🔗"},K))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function dot({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{Ti(t.id,"button_click",T),P()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},_=()=>{var T,P;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(P=t.profile)==null?void 0:P.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#f5f1eb]",children:[r.jsx("div",{className:"bg-[#1b3a4b] h-2"}),r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&r.jsxs(Ks,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-serif bg-[#1b3a4b] text-white",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-[#1b3a4b] mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:t.team_name}),t.positioning_statement&&r.jsxs("p",{className:"text-base text-[#4a5568] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',t.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:bi,label:"Call",handler:h},{icon:Oo,label:"Text",handler:p},{icon:ua,label:"Email",handler:x}].map(({icon:T,label:P,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-white hover:bg-[#e8e3db] border border-[#d4cfc5] rounded-lg transition-colors shadow-sm",children:[r.jsx(T,{className:"h-5 w-5 text-[#1b3a4b]"}),r.jsx("span",{className:"text-xs font-semibold text-[#1b3a4b]",children:P})]},P))}),r.jsxs("button",{onClick:y,className:"w-full h-12 text-base font-semibold rounded-lg mb-6 bg-[#1b3a4b] hover:bg-[#264d61] text-white transition-colors flex items-center justify-center gap-2 shadow-sm",children:[r.jsx(Os,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsx("div",{className:"flex items-center justify-center gap-6",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843] fill-[#d4a843]"}),r.jsx("span",{className:"font-bold text-[#1b3a4b] font-serif",children:"5.0"})]})})}),t.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsxs("p",{className:"text-sm text-[#4a5568] italic text-center font-serif",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#1b3a4b] mb-2 font-serif",children:"About"}),r.jsx("p",{className:"text-sm text-[#4a5568] leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"classic"}),r.jsx(Xne,{cardId:t.id,variant:"classic"}),r.jsxs("div",{className:"bg-white rounded-lg border border-[#d4cfc5] shadow-sm divide-y divide-[#e8e3db] mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:_,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(no,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Bn,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(sf,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(pc,{className:"h-4 w-4 text-[#5a7a6f]"})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((T,P)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-white border border-[#d4cfc5] hover:bg-[#e8e3db] flex items-center justify-center text-lg transition-colors shadow-sm",children:A[T.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function Oge({card:t}){switch(t.theme){case"luxury":return r.jsx(lot,{card:t});case"bold":return r.jsx(cot,{card:t});case"classic":return r.jsx(dot,{card:t});case"standard":default:return r.jsx(oot,{card:t})}}function uot(){const t=Nm();I.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]);const e=t.pathname.slice(1);return!e||e===""?r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Agent Cards"}),r.jsx("p",{className:"text-slate-500",children:"Visit a specific agent's card URL to view their digital business card."})]})}):r.jsx(hot,{slug:e})}function hot({slug:t}){return r.jsx(fot,{slug:t})}function fot({slug:t}){var o;const{data:e,isLoading:n,error:s}=yLe(t);if(I.useEffect(()=>{e!=null&&e.id&&Ti(e.id,"card_view")},[e==null?void 0:e.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Ir,{className:"h-28 w-28 rounded-full"}),r.jsx(Ir,{className:"h-6 w-48"}),r.jsx(Ir,{className:"h-4 w-36"})]}),r.jsx(Ir,{className:"h-12 w-full"}),r.jsx(Ir,{className:"h-12 w-full"})]})});if(s||!e)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const a=((o=e.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:e.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:e.positioning_statement||`Connect with ${a}`}),e.avatar_url&&r.jsx("meta",{property:"og:image",content:e.avatar_url})]}),r.jsx(Oge,{card:e})]})}const ohe="levelup_affiliate_ref",pot=30,mot=()=>{const[t]=qd();I.useEffect(()=>{const e=t.get("ref");if(e){const n={code:e.toUpperCase(),timestamp:Date.now()};localStorage.setItem(ohe,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",e)}},[t])},got=()=>{try{const t=localStorage.getItem(ohe);if(!t)return null;const e=JSON.parse(t),n=pot*24*60*60*1e3;return Date.now()-e.timestamp>n?(localStorage.removeItem(ohe),console.log("[Affiliate] Referral code expired"),null):e.code}catch{return null}},tte="/assets/levelup-logo-header-_ZX7DvlA.png",xot="/assets/scale-your-team-ku4MPatU.png";function yot({open:t,onOpenChange:e}){return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(qr,{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(ai,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Qn,{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 id={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"]}},vot=[{icon:$f,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:pd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Os,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Fl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:La,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ki,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],_ot=[{icon:Bn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ms,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:bi,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Jh,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Mo,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:dc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:ci,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Sg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],bot=[{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."}],wot=()=>{const{user:t,loading:e}=Xr(),n=Zn(),[s]=qd();I.useEffect(()=>{const V=window.location.host==="listings.relevelup.com",K=window.location.pathname==="/";if(V&&K){n("/public/listings",{replace:!0});return}},[n]);const[a,o]=I.useState(null),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(""),[_,j]=I.useState(""),[C,N]=I.useState(""),[A,E]=I.useState(!1),[T,P]=I.useState(!1),z=(V,K=!1)=>{i({tier:V,skipTrial:K}),p(!0)};mot(),I.useEffect(()=>{const V=window.location.host==="listings.relevelup.com",K=location.pathname.startsWith("/public/");!e&&t&&!V&&!K&&n("/dashboard")},[t,e,n,location.pathname]),I.useEffect(()=>{s.get("canceled")==="true"&&ze.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const F=async(V,K=!1)=>{if(!x){ze.error("Please enter your email address");return}if(!_.trim()){ze.error("Please enter your full name");return}E(!0),o(V+(K?"_direct":""));const G=got();try{const{data:te,error:ie}=await J.functions.invoke("create-checkout",{body:{tier:V,email:x,name:_.trim(),couponCode:C.trim()||void 0,skipTrial:K,referralCode:G}});if(ie)throw ie;if(te!=null&&te.url)window.open(te.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(te){console.error("Checkout error:",te),ze.error(te.message||"Failed to start checkout. Please try again.")}finally{E(!1),o(null),p(!1),i(null)}},q=()=>{l&&F(l.tier,l.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:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(ee,{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(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("free-trial"))==null?void 0:V.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(hl,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(ee,{size:"lg",variant:"outline",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.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(ee,{size:"lg",variant:"outline",onClick:()=>{var V;return(V=document.getElementById("brokerage"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(ai,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(Ic,{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:vot.map((V,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(Gt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(V.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:V.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:V.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(Ms,{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:_ot.map((V,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(Gt,{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(V.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Zt,{className:"text-lg font-semibold text-white",children:V.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:V.description})})]},K))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.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(hl,{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(ai,{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((V,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(Ai,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:V})]},K))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Vi,{className:"ml-2 w-5 h-5"})]}),r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>P(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(Os,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:xot,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:bot.map((V,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(G=>r.jsx(vs,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},G))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',V.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:V.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:V.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(ee,{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:()=>z("individual_agent"),children:["Start Free Trial",r.jsx(hl,{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(Gt,{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(Ic,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:id.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:id.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:id.individual_agent.period})]}),r.jsx(Tn,{className:"text-base mt-2",children:id.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(Ya,{className:"w-4 h-4"}),id.individual_agent.trial]})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:id.individual_agent.features.map((V,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ai,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},K))})}),r.jsxs(oA,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("individual_agent"),children:"Start Free Trial"}),r.jsx(ee,{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:()=>z("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(Gt,{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(ai,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-xl font-sans",children:id.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:id.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:id.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:id.brokerage_under_25.period})]}),r.jsx(Tn,{className:"text-base mt-2",children:id.brokerage_under_25.description})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:id.brokerage_under_25.features.map((V,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ai,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},K))})}),r.jsx(oA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("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(Gt,{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(ai,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-xl font-sans",children:id.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:id.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:id.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:id.brokerage_over_25.period})]}),r.jsx(Tn,{className:"text-base mt-2",children:id.brokerage_over_25.description})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:id.brokerage_over_25.features.map((V,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ai,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},K))})}),r.jsx(oA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("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(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.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(hl,{className:"ml-2 w-5 h-5"})]}),r.jsx(ee,{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:tte,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(yot,{open:T,onOpenChange:P}),r.jsx(Fr,{open:h,onOpenChange:p,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Qn,{children:(l==null?void 0:l.tier)==="individual_agent"&&!(l!=null&&l.skipTrial)?"Start your 7-day free trial":(l==null?void 0:l.tier)==="individual_agent"?"Subscribe to Individual Agent":(l==null?void 0:l.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(He,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(dt,{id:"dialog-name",type:"text",placeholder:"John Smith",value:_,onChange:V=>j(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(He,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(dt,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:V=>y(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(He,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(dt,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:C,onChange:V=>N(V.target.value),className:"mt-1"})]})]}),r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:q,disabled:A,children:A?"Loading...":"Continue to Checkout"})]})})]})},jot=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{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"})]})]})]})]})})]}),kot=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{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"})]})]})]})]})})]}),Not=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{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 ro;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{const o={};for(const l of a)o[l]=l;return o},t.getValidEnumValues=a=>{const o=t.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),l={};for(const i of o)l[i]=a[i];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(o){return a[o]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},t.find=(a,o)=>{for(const l of a)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(ro||(ro={}));var vje;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(vje||(vje={}));const Cs=ro.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),j0=t=>{switch(typeof t){case"undefined":return Cs.undefined;case"string":return Cs.string;case"number":return Number.isNaN(t)?Cs.nan:Cs.number;case"boolean":return Cs.boolean;case"function":return Cs.function;case"bigint":return Cs.bigint;case"symbol":return Cs.symbol;case"object":return Array.isArray(t)?Cs.array:t===null?Cs.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Cs.promise:typeof Map<"u"&&t instanceof Map?Cs.map:typeof Set<"u"&&t instanceof Set?Cs.set:typeof Date<"u"&&t instanceof Date?Cs.date:Cs.object;default:return Cs.unknown}},On=ro.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 Lg 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:[]},a=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)s._errors.push(n(l));else{let i=s,h=0;for(;hn.message){const n={},s=[];for(const a of this.issues)if(a.path.length>0){const o=a.path[0];n[o]=n[o]||[],n[o].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Lg.create=t=>new Lg(t);const lhe=(t,e)=>{let n;switch(t.code){case On.invalid_type:t.received===Cs.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case On.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ro.jsonStringifyReplacer)}`;break;case On.unrecognized_keys:n=`Unrecognized key(s) in object: ${ro.joinValues(t.keys,", ")}`;break;case On.invalid_union:n="Invalid input";break;case On.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ro.joinValues(t.options)}`;break;case On.invalid_enum_value:n=`Invalid enum value. Expected ${ro.joinValues(t.options)}, received '${t.received}'`;break;case On.invalid_arguments:n="Invalid function arguments";break;case On.invalid_return_type:n="Invalid function return type";break;case On.invalid_date:n="Invalid date";break;case On.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}"`:ro.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case On.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 On.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 On.custom:n="Invalid input";break;case On.invalid_intersection_types:n="Intersection results could not be merged";break;case On.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case On.not_finite:n="Number must be finite";break;default:n=e.defaultError,ro.assertNever(t)}return{message:n}};let Sot=lhe;function Cot(){return Sot}const Mot=t=>{const{data:e,path:n,errorMaps:s,issueData:a}=t,o=[...n,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const h=s.filter(p=>!!p).slice().reverse();for(const p of h)i=p(l,{data:e,defaultError:i}).message;return{...a,path:o,message:i}};function hs(t,e){const n=Cot(),s=Mot({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===lhe?void 0:lhe].filter(a=>!!a)});t.common.issues.push(s)}class df{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 a of n){if(a.status==="aborted")return Ka;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,n){const s=[];for(const a of n){const o=await a.key,l=await a.value;s.push({key:o,value:l})}return df.mergeObjectSync(e,s)}static mergeObjectSync(e,n){const s={};for(const a of n){const{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return Ka;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(s[o.value]=l.value)}return{status:e.value,value:s}}}const Ka=Object.freeze({status:"aborted"}),cT=t=>({status:"dirty",value:t}),lp=t=>({status:"valid",value:t}),_je=t=>t.status==="aborted",bje=t=>t.status==="dirty",cC=t=>t.status==="valid",rte=t=>typeof Promise<"u"&&t instanceof Promise;var zs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(zs||(zs={}));class U1{constructor(e,n,s,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=a}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 wje=(t,e)=>{if(cC(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 Lg(t.common.issues);return this._error=n,this._error}}};function vi(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:a}=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:a}:{errorMap:(l,i)=>{const{message:h}=t;return l.code==="invalid_enum_value"?{message:h??i.defaultError}:typeof i.data>"u"?{message:h??s??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:h??n??i.defaultError}},description:a}}class Ji{get description(){return this._def.description}_getType(e){return j0(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:j0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new df,ctx:{common:e.parent.common,data:e.data,parsedType:j0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(rte(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:j0(e)},a=this._parseSync({data:e,path:s.path,parent:s});return wje(s,a)}"~validate"(e){var s,a;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j0(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return cC(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(a=(s=o==null?void 0:o.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(o=>cC(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:j0(e)},a=this._parse({data:e,path:s.path,parent:s}),o=await(rte(a)?a:Promise.resolve(a));return wje(s,o)}refine(e,n){const s=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{const l=e(a),i=()=>o.addIssue({code:On.custom,...s(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(i(),!1)):l?!0:(i(),!1)})}refinement(e,n){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(e){return new hC({schema:this,typeName:Za.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 T1.create(this,this._def)}nullable(){return fC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ag.create(this)}promise(){return ite.create(this,this._def)}or(e){return ste.create([this,e],this._def)}and(e){return ate.create(this,e,this._def)}transform(e){return new hC({...vi(this._def),schema:this,typeName:Za.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new hhe({...vi(this._def),innerType:this,defaultValue:n,typeName:Za.ZodDefault})}brand(){return new Xot({typeName:Za.ZodBranded,type:this,...vi(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new fhe({...vi(this._def),innerType:this,catchValue:n,typeName:Za.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Dge.create(this,e)}readonly(){return phe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tot=/^c[^\s-]{8,}$/i,Aot=/^[0-9a-z]+$/,Eot=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Iot=/^[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,Pot=/^[a-z0-9_-]{21}$/i,Lot=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Oot=/^[-+]?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)?)??$/,Dot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rot="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ule;const Fot=/^(?:(?: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])$/,zot=/^(?:(?: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])$/,Bot=/^(([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]))$/,$ot=/^(([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])$/,Uot=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wLe="((\\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])))",Vot=new RegExp(`^${wLe}$`);function jLe(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 Hot(t){return new RegExp(`^${jLe(t)}$`)}function Wot(t){let e=`${wLe}T${jLe(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 Got(t,e){return!!((e==="v4"||!e)&&Fot.test(t)||(e==="v6"||!e)&&Bot.test(t))}function Kot(t,e){if(!Lot.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,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Zot(t,e){return!!((e==="v4"||!e)&&zot.test(t)||(e==="v6"||!e)&&$ot.test(t))}class X0 extends Ji{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Cs.string){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_type,expected:Cs.string,received:o.parsedType}),Ka}const s=new df;let a;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(a=this._getOrReturnCtx(e,a),hs(a,{code:On.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){const l=e.data.length>o.value,i=e.data.lengthe.test(a),{validation:n,code:On.invalid_string,...zs.errToObj(s)})}_addCheck(e){return new X0({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...zs.errToObj(e)})}url(e){return this._addCheck({kind:"url",...zs.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...zs.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...zs.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...zs.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...zs.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...zs.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...zs.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...zs.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...zs.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...zs.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...zs.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...zs.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,...zs.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,...zs.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...zs.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...zs.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...zs.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...zs.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...zs.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...zs.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...zs.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...zs.errToObj(n)})}nonempty(e){return this.min(1,zs.errToObj(e))}trim(){return new X0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new X0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new X0({...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 X0({checks:[],typeName:Za.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...vi(t)});function Yot(t,e){const n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=n>s?n:s,o=Number.parseInt(t.toFixed(a).replace(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}class dC extends Ji{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)!==Cs.number){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_type,expected:Cs.number,received:o.parsedType}),Ka}let s;const a=new df;for(const o of this._def.checks)o.kind==="int"?ro.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),hs(s,{code:On.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Yot(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),hs(s,{code:On.not_finite,message:o.message}),a.dirty()):ro.assertNever(o);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,zs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,zs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,zs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,zs.toString(n))}setLimit(e,n,s,a){return new dC({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:zs.toString(a)}]})}_addCheck(e){return new dC({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:zs.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:zs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:zs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:zs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:zs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:zs.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:zs.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:zs.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:zs.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"&&ro.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 dC({checks:[],typeName:Za.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...vi(t)});class sE extends Ji{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)!==Cs.bigint)return this._getInvalidInput(e);let s;const a=new df;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):ro.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return hs(n,{code:On.invalid_type,expected:Cs.bigint,received:n.parsedType}),Ka}gte(e,n){return this.setLimit("min",e,!0,zs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,zs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,zs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,zs.toString(n))}setLimit(e,n,s,a){return new sE({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:zs.toString(a)}]})}_addCheck(e){return new sE({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:zs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:zs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:zs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:zs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:zs.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 sE({checks:[],typeName:Za.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...vi(t)});class che extends Ji{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Cs.boolean){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.boolean,received:s.parsedType}),Ka}return lp(e.data)}}che.create=t=>new che({typeName:Za.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...vi(t)});class nte extends Ji{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Cs.date){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_type,expected:Cs.date,received:o.parsedType}),Ka}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_date}),Ka}const s=new df;let a;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(a=this._getOrReturnCtx(e,a),hs(a,{code:On.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):ro.assertNever(o);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new nte({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:zs.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:zs.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 nte({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Za.ZodDate,...vi(t)});class jje extends Ji{_parse(e){if(this._getType(e)!==Cs.symbol){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.symbol,received:s.parsedType}),Ka}return lp(e.data)}}jje.create=t=>new jje({typeName:Za.ZodSymbol,...vi(t)});class kje extends Ji{_parse(e){if(this._getType(e)!==Cs.undefined){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.undefined,received:s.parsedType}),Ka}return lp(e.data)}}kje.create=t=>new kje({typeName:Za.ZodUndefined,...vi(t)});class Nje extends Ji{_parse(e){if(this._getType(e)!==Cs.null){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.null,received:s.parsedType}),Ka}return lp(e.data)}}Nje.create=t=>new Nje({typeName:Za.ZodNull,...vi(t)});class Sje extends Ji{constructor(){super(...arguments),this._any=!0}_parse(e){return lp(e.data)}}Sje.create=t=>new Sje({typeName:Za.ZodAny,...vi(t)});class Cje extends Ji{constructor(){super(...arguments),this._unknown=!0}_parse(e){return lp(e.data)}}Cje.create=t=>new Cje({typeName:Za.ZodUnknown,...vi(t)});class q1 extends Ji{_parse(e){const n=this._getOrReturnCtx(e);return hs(n,{code:On.invalid_type,expected:Cs.never,received:n.parsedType}),Ka}}q1.create=t=>new q1({typeName:Za.ZodNever,...vi(t)});class Mje extends Ji{_parse(e){if(this._getType(e)!==Cs.undefined){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.void,received:s.parsedType}),Ka}return lp(e.data)}}Mje.create=t=>new Mje({typeName:Za.ZodVoid,...vi(t)});class Ag extends Ji{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),a=this._def;if(n.parsedType!==Cs.array)return hs(n,{code:On.invalid_type,expected:Cs.array,received:n.parsedType}),Ka;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,i=n.data.lengtha.maxLength.value&&(hs(n,{code:On.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((l,i)=>a.type._parseAsync(new U1(n,l,n.path,i)))).then(l=>df.mergeArray(s,l));const o=[...n.data].map((l,i)=>a.type._parseSync(new U1(n,l,n.path,i)));return df.mergeArray(s,o)}get element(){return this._def.type}min(e,n){return new Ag({...this._def,minLength:{value:e,message:zs.toString(n)}})}max(e,n){return new Ag({...this._def,maxLength:{value:e,message:zs.toString(n)}})}length(e,n){return new Ag({...this._def,exactLength:{value:e,message:zs.toString(n)}})}nonempty(e){return this.min(1,e)}}Ag.create=(t,e)=>new Ag({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Za.ZodArray,...vi(e)});function v4(t){if(t instanceof Cc){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=T1.create(v4(s))}return new Cc({...t._def,shape:()=>e})}else return t instanceof Ag?new Ag({...t._def,type:v4(t.element)}):t instanceof T1?T1.create(v4(t.unwrap())):t instanceof fC?fC.create(v4(t.unwrap())):t instanceof Vj?Vj.create(t.items.map(e=>v4(e))):t}class Cc extends Ji{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=ro.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Cs.object){const p=this._getOrReturnCtx(e);return hs(p,{code:On.invalid_type,expected:Cs.object,received:p.parsedType}),Ka}const{status:s,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof q1&&this._def.unknownKeys==="strip"))for(const p in a.data)l.includes(p)||i.push(p);const h=[];for(const p of l){const x=o[p],y=a.data[p];h.push({key:{status:"valid",value:p},value:x._parse(new U1(a,y,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof q1){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of i)h.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(p==="strict")i.length>0&&(hs(a,{code:On.unrecognized_keys,keys:i}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of i){const y=a.data[x];h.push({key:{status:"valid",value:x},value:p._parse(new U1(a,y,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of h){const y=await x.key,_=await x.value;p.push({key:y,value:_,alwaysSet:x.alwaysSet})}return p}).then(p=>df.mergeObjectSync(s,p)):df.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return zs.errToObj,new Cc({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,s)=>{var o,l;const a=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:zs.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Cc({...this._def,unknownKeys:"strip"})}passthrough(){return new Cc({...this._def,unknownKeys:"passthrough"})}extend(e){return new Cc({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Cc({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Za.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Cc({...this._def,catchall:e})}pick(e){const n={};for(const s of ro.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Cc({...this._def,shape:()=>n})}omit(e){const n={};for(const s of ro.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new Cc({...this._def,shape:()=>n})}deepPartial(){return v4(this)}partial(e){const n={};for(const s of ro.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?n[s]=a:n[s]=a.optional()}return new Cc({...this._def,shape:()=>n})}required(e){const n={};for(const s of ro.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof T1;)o=o._def.innerType;n[s]=o}return new Cc({...this._def,shape:()=>n})}keyof(){return kLe(ro.objectKeys(this.shape))}}Cc.create=(t,e)=>new Cc({shape:()=>t,unknownKeys:"strip",catchall:q1.create(),typeName:Za.ZodObject,...vi(e)});Cc.strictCreate=(t,e)=>new Cc({shape:()=>t,unknownKeys:"strict",catchall:q1.create(),typeName:Za.ZodObject,...vi(e)});Cc.lazycreate=(t,e)=>new Cc({shape:t,unknownKeys:"strip",catchall:q1.create(),typeName:Za.ZodObject,...vi(e)});class ste extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function a(o){for(const i of o)if(i.result.status==="valid")return i.result;for(const i of o)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(i=>new Lg(i.ctx.common.issues));return hs(n,{code:On.invalid_union,unionErrors:l}),Ka}if(n.common.async)return Promise.all(s.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let o;const l=[];for(const h of s){const p={...n,common:{...n.common,issues:[]},parent:null},x=h._parseSync({data:n.data,path:n.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const i=l.map(h=>new Lg(h));return hs(n,{code:On.invalid_union,unionErrors:i}),Ka}}get options(){return this._def.options}}ste.create=(t,e)=>new ste({options:t,typeName:Za.ZodUnion,...vi(e)});function dhe(t,e){const n=j0(t),s=j0(e);if(t===e)return{valid:!0,data:t};if(n===Cs.object&&s===Cs.object){const a=ro.objectKeys(e),o=ro.objectKeys(t).filter(i=>a.indexOf(i)!==-1),l={...t,...e};for(const i of o){const h=dhe(t[i],e[i]);if(!h.valid)return{valid:!1};l[i]=h.data}return{valid:!0,data:l}}else if(n===Cs.array&&s===Cs.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let o=0;o{if(_je(o)||_je(l))return Ka;const i=dhe(o.value,l.value);return i.valid?((bje(o)||bje(l))&&n.dirty(),{status:n.value,value:i.data}):(hs(s,{code:On.invalid_intersection_types}),Ka)};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,l])=>a(o,l)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ate.create=(t,e,n)=>new ate({left:t,right:e,typeName:Za.ZodIntersection,...vi(n)});class Vj extends Ji{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Cs.array)return hs(s,{code:On.invalid_type,expected:Cs.array,received:s.parsedType}),Ka;if(s.data.lengththis._def.items.length&&(hs(s,{code:On.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((l,i)=>{const h=this._def.items[i]||this._def.rest;return h?h._parse(new U1(s,l,s.path,i)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>df.mergeArray(n,l)):df.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Vj({...this._def,rest:e})}}Vj.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vj({items:t,typeName:Za.ZodTuple,rest:null,...vi(e)})};class Tje extends Ji{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!==Cs.map)return hs(s,{code:On.invalid_type,expected:Cs.map,received:s.parsedType}),Ka;const a=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([i,h],p)=>({key:a._parse(new U1(s,i,s.path,[p,"key"])),value:o._parse(new U1(s,h,s.path,[p,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const h of l){const p=await h.key,x=await h.value;if(p.status==="aborted"||x.status==="aborted")return Ka;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}})}else{const i=new Map;for(const h of l){const p=h.key,x=h.value;if(p.status==="aborted"||x.status==="aborted")return Ka;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}}}}Tje.create=(t,e,n)=>new Tje({valueType:e,keyType:t,typeName:Za.ZodMap,...vi(n)});class aE extends Ji{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Cs.set)return hs(s,{code:On.invalid_type,expected:Cs.set,received:s.parsedType}),Ka;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(hs(s,{code:On.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function l(h){const p=new Set;for(const x of h){if(x.status==="aborted")return Ka;x.status==="dirty"&&n.dirty(),p.add(x.value)}return{status:n.value,value:p}}const i=[...s.data.values()].map((h,p)=>o._parse(new U1(s,h,s.path,p)));return s.common.async?Promise.all(i).then(h=>l(h)):l(i)}min(e,n){return new aE({...this._def,minSize:{value:e,message:zs.toString(n)}})}max(e,n){return new aE({...this._def,maxSize:{value:e,message:zs.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}aE.create=(t,e)=>new aE({valueType:t,minSize:null,maxSize:null,typeName:Za.ZodSet,...vi(e)});class Aje extends Ji{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})}}Aje.create=(t,e)=>new Aje({getter:t,typeName:Za.ZodLazy,...vi(e)});class uhe extends Ji{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return hs(n,{received:n.data,code:On.invalid_literal,expected:this._def.value}),Ka}return{status:"valid",value:e.data}}get value(){return this._def.value}}uhe.create=(t,e)=>new uhe({value:t,typeName:Za.ZodLiteral,...vi(e)});function kLe(t,e){return new uC({values:t,typeName:Za.ZodEnum,...vi(e)})}class uC extends Ji{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return hs(n,{expected:ro.joinValues(s),received:n.parsedType,code:On.invalid_type}),Ka}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 hs(n,{received:n.data,code:On.invalid_enum_value,options:s}),Ka}return lp(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 uC.create(e,{...this._def,...n})}exclude(e,n=this._def){return uC.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}}uC.create=kLe;class Eje extends Ji{_parse(e){const n=ro.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Cs.string&&s.parsedType!==Cs.number){const a=ro.objectValues(n);return hs(s,{expected:ro.joinValues(a),received:s.parsedType,code:On.invalid_type}),Ka}if(this._cache||(this._cache=new Set(ro.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=ro.objectValues(n);return hs(s,{received:s.data,code:On.invalid_enum_value,options:a}),Ka}return lp(e.data)}get enum(){return this._def.values}}Eje.create=(t,e)=>new Eje({values:t,typeName:Za.ZodNativeEnum,...vi(e)});class ite extends Ji{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.promise&&n.common.async===!1)return hs(n,{code:On.invalid_type,expected:Cs.promise,received:n.parsedType}),Ka;const s=n.parsedType===Cs.promise?n.data:Promise.resolve(n.data);return lp(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ite.create=(t,e)=>new ite({type:t,typeName:Za.ZodPromise,...vi(e)});class hC extends Ji{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Za.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:l=>{hs(s,l),l.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const l=a.transform(s.data,o);if(s.common.async)return Promise.resolve(l).then(async i=>{if(n.value==="aborted")return Ka;const h=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return h.status==="aborted"?Ka:h.status==="dirty"||n.value==="dirty"?cT(h.value):h});{if(n.value==="aborted")return Ka;const i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?Ka:i.status==="dirty"||n.value==="dirty"?cT(i.value):i}}if(a.type==="refinement"){const l=i=>{const h=a.refinement(i,o);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Ka:(i.status==="dirty"&&n.dirty(),l(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?Ka:(i.status==="dirty"&&n.dirty(),l(i.value).then(()=>({status:n.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!cC(l))return Ka;const i=a.transform(l.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>cC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:n.value,value:i})):Ka);ro.assertNever(a)}}hC.create=(t,e,n)=>new hC({schema:t,typeName:Za.ZodEffects,effect:e,...vi(n)});hC.createWithPreprocess=(t,e,n)=>new hC({schema:e,effect:{type:"preprocess",transform:t},typeName:Za.ZodEffects,...vi(n)});class T1 extends Ji{_parse(e){return this._getType(e)===Cs.undefined?lp(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}T1.create=(t,e)=>new T1({innerType:t,typeName:Za.ZodOptional,...vi(e)});class fC extends Ji{_parse(e){return this._getType(e)===Cs.null?lp(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fC.create=(t,e)=>new fC({innerType:t,typeName:Za.ZodNullable,...vi(e)});class hhe extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===Cs.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}hhe.create=(t,e)=>new hhe({innerType:t,typeName:Za.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...vi(e)});class fhe extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return rte(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Lg(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Lg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}fhe.create=(t,e)=>new fhe({innerType:t,typeName:Za.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...vi(e)});class Ije extends Ji{_parse(e){if(this._getType(e)!==Cs.nan){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.nan,received:s.parsedType}),Ka}return{status:"valid",value:e.data}}}Ije.create=t=>new Ije({typeName:Za.ZodNaN,...vi(t)});class Xot extends Ji{_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 Dge extends Ji{_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"?Ka:o.status==="dirty"?(n.dirty(),cT(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Ka:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,n){return new Dge({in:e,out:n,typeName:Za.ZodPipeline})}}class phe extends Ji{_parse(e){const n=this._def.innerType._parse(e),s=a=>(cC(a)&&(a.value=Object.freeze(a.value)),a);return rte(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}phe.create=(t,e)=>new phe({innerType:t,typeName:Za.ZodReadonly,...vi(e)});var Za;(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"})(Za||(Za={}));const oc=X0.create,lA=dC.create,Qot=che.create;q1.create;Ag.create;const u3=Cc.create;ste.create;ate.create;Vj.create;const Pje=uhe.create,NLe=uC.create;ite.create;T1.create;fC.create;const Jot=u3({email:oc().email("Invalid email address"),password:oc().min(6,"Password must be at least 6 characters")}),elt=()=>{const{signIn:t,user:e}=Xr(),n=Zn(),[s,a]=I.useState(!1),[o,l]=I.useState({}),[i,h]=I.useState(""),[p,x]=I.useState(!1),[y,_]=I.useState(!1);I.useEffect(()=>{e&&n("/dashboard")},[e,n]);const j=async N=>{N.preventDefault(),l({}),a(!0);const A=new FormData(N.currentTarget),E=A.get("email"),T=A.get("password");try{Jot.parse({email:E,password:T}),await t(E,T)}catch(P){if(P instanceof Lg){const z={};P.errors.forEach(F=>{F.path[0]&&(z[F.path[0]]=F.message)}),l(z)}}finally{a(!1)}},C=async()=>{if(!i){ze.error("Please enter your email address");return}x(!0);try{const{error:N}=await J.functions.invoke("send-password-reset",{body:{email:i,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(N)throw N;ze.success("Password reset email sent! Check your inbox."),_(!1),h("")}catch(N){ze.error(N.message||"Failed to send reset email")}finally{x(!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(co,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(so,{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:C6e,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ye,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Gt,{className:"space-y-1 text-center pb-4",children:[r.jsx(Zt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(Tn,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(Je,{children:r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(dt,{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(He,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(dt,{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(ee,{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(Fr,{open:y,onOpenChange:_,children:[r.jsx(Bo,{asChild:!0,children:r.jsx(ee,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Rr,{className:"bg-white",children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Qn,{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(He,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(dt,{id:"reset-email",type:"email",placeholder:"your@email.com",value:i,onChange:N=>h(N.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(ee,{onClick:C,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:p,children:p?"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(co,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},tlt=()=>{const[t]=qd(),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(Gt,{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(Yi,{className:"w-10 h-10 text-green-500"})}),r.jsx(Zt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(Tn,{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(ua,{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."})})]})]})})},SLe=t=>{const[e,n]=I.useState(null),[s,a]=I.useState(!0);return I.useEffect(()=>{if(!t){a(!1);return}(async()=>{try{const{data:i}=await J.storage.from("avatars").list(`${t}`);if(i&&i.length>0){const{data:h}=J.storage.from("avatars").getPublicUrl(`${t}/${i[0].name}`);n(`${h.publicUrl}?t=${Date.now()}`)}else n(null)}catch(i){console.error("Error fetching avatar:",i),n(null)}finally{a(!1)}})()},[t]),{avatarUrl:e,loading:s,refreshAvatar:async()=>{if(t)try{const{data:l}=await J.storage.from("avatars").list(`${t}`);if(l&&l.length>0){const{data:i}=J.storage.from("avatars").getPublicUrl(`${t}/${l[0].name}`);n(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},CLe=async t=>{const e=new Map;return await Promise.all(t.map(async n=>{try{const{data:s}=await J.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:a}=J.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);e.set(n,a.publicUrl)}}catch{}})),e},rlt=t=>{const[e,n]=I.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return I.useEffect(()=>{if(!t){n(a=>({...a,loading:!1}));return}(async()=>{try{const{data:a,error:o}=await J.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(h=>({...h,loading:!1}));return}const l=(a==null?void 0:a.subscription_status)==="trialing"&&(a==null?void 0:a.subscription_end_date),i=(a==null?void 0:a.is_trial)&&(a==null?void 0:a.trial_expires_at);if(l){const h=new Date().getTime(),p=new Date(a.subscription_end_date).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.subscription_end_date,daysLeft:y?0:x,loading:!1})}else if(i){const h=new Date().getTime(),p=new Date(a.trial_expires_at).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.trial_expires_at,daysLeft:y?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(a){console.error("Error in useTrialStatus:",a),n(o=>({...o,loading:!1}))}})()},[t]),e},MLe=()=>{const{data:t,isLoading:e}=Yt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:a}=await J.from("feature_flags").select("*");if(a)throw a;return s}}),n=s=>{if(!t)return!1;const a=t.find(o=>o.key===s);return(a==null?void 0:a.enabled)??!1};return{flags:t,isLoading:e,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},Lje="community_last_seen_post_at";function nlt(){const{user:t}=Xr(),e=Nm(),[n,s]=I.useState(0),[a,o]=I.useState(null);I.useEffect(()=>{if(!t)return;const i=localStorage.getItem(`${Lje}_${t.id}`);o(i)},[t]),I.useEffect(()=>{if(!t)return;(async()=>{let h=J.from("community_posts").select("id",{count:"exact",head:!0});a&&(h=h.gt("created_at",a));const{data:p}=await J.from("profiles").select("brokerage_id").eq("id",t.id).single(),{count:x,error:y}=await h;!y&&x!==null&&s(x)})()},[t,a]),I.useEffect(()=>{if(!t)return;const i=J.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async h=>{const p=h.new;if(p.user_id===t.id)return;const x=e.pathname==="/community";x||s(C=>C+1);const{data:y}=await J.from("profiles").select("name").eq("id",p.user_id).single(),_=(y==null?void 0:y.name)||"Someone",j=p.content.length>50?p.content.substring(0,50)+"...":p.content;x||ze("New Community Post",{description:`${_}: ${j}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{J.removeChannel(i)}},[t,e.pathname]);const l=I.useCallback(()=>{if(!t)return;const i=new Date().toISOString();localStorage.setItem(`${Lje}_${t.id}`,i),o(i),s(0)},[t]);return I.useEffect(()=>{e.pathname==="/community"&&n>0&&l()},[e.pathname,n,l]),{unreadCount:n,markAsRead:l}}function slt(){const{isAdmin:t}=Xr(),{data:e=0}=Yt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await J.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}}const Jne=qne,Rge=Ige,alt=Vne,TLe=I.forwardRef(({className:t,...e},n)=>r.jsx(l3,{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}));TLe.displayName=l3.displayName;const ilt=YC("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"}}),SI=I.forwardRef(({side:t="right",className:e,children:n,...s},a)=>r.jsxs(alt,{children:[r.jsx(TLe,{}),r.jsxs(c3,{ref:a,className:zt(ilt({side:t}),e),...s,children:[n,r.jsxs(Hne,{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(_s,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));SI.displayName=c3.displayName;const ese=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-2 text-center sm:text-left",t),...e});ese.displayName="SheetHeader";const tse=I.forwardRef(({className:t,...e},n)=>r.jsx(jI,{ref:n,className:zt("text-lg font-semibold text-foreground",t),...e}));tse.displayName=jI.displayName;const olt=I.forwardRef(({className:t,...e},n)=>r.jsx(kI,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));olt.displayName=kI.displayName;function llt(t,e){return I.useReducer((n,s)=>e[n][s]??n,t)}var Fge="ScrollArea",[ALe]=rc(Fge),[clt,cp]=ALe(Fge),ELe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:a,scrollHideDelay:o=600,...l}=t,[i,h]=I.useState(null),[p,x]=I.useState(null),[y,_]=I.useState(null),[j,C]=I.useState(null),[N,A]=I.useState(null),[E,T]=I.useState(0),[P,z]=I.useState(0),[F,q]=I.useState(!1),[V,K]=I.useState(!1),G=ta(e,ie=>h(ie)),te=ok(a);return r.jsx(clt,{scope:n,type:s,dir:te,scrollHideDelay:o,scrollArea:i,viewport:p,onViewportChange:x,content:y,onContentChange:_,scrollbarX:j,onScrollbarXChange:C,scrollbarXEnabled:F,onScrollbarXEnabledChange:q,scrollbarY:N,onScrollbarYChange:A,scrollbarYEnabled:V,onScrollbarYEnabledChange:K,onCornerWidthChange:T,onCornerHeightChange:z,children:r.jsx(Rn.div,{dir:te,...l,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":P+"px",...t.style}})})});ELe.displayName=Fge;var ILe="ScrollAreaViewport",PLe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:a,...o}=t,l=cp(ILe,n),i=I.useRef(null),h=ta(e,i,l.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:a}),r.jsx(Rn.div,{"data-radix-scroll-area-viewport":"",...o,ref:h,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:r.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});PLe.displayName=ILe;var Ug="ScrollAreaScrollbar",zge=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=cp(Ug,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=t.orientation==="horizontal";return I.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?r.jsx(dlt,{...s,ref:e,forceMount:n}):a.type==="scroll"?r.jsx(ult,{...s,ref:e,forceMount:n}):a.type==="auto"?r.jsx(LLe,{...s,ref:e,forceMount:n}):a.type==="always"?r.jsx(Bge,{...s,ref:e}):null});zge.displayName=Ug;var dlt=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=cp(Ug,t.__scopeScrollArea),[o,l]=I.useState(!1);return I.useEffect(()=>{const i=a.scrollArea;let h=0;if(i){const p=()=>{window.clearTimeout(h),l(!0)},x=()=>{h=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",p),i.addEventListener("pointerleave",x),()=>{window.clearTimeout(h),i.removeEventListener("pointerenter",p),i.removeEventListener("pointerleave",x)}}},[a.scrollArea,a.scrollHideDelay]),r.jsx(xc,{present:n||o,children:r.jsx(LLe,{"data-state":o?"visible":"hidden",...s,ref:e})})}),ult=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=cp(Ug,t.__scopeScrollArea),o=t.orientation==="horizontal",l=nse(()=>h("SCROLL_END"),100),[i,h]=llt("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 I.useEffect(()=>{if(i==="idle"){const p=window.setTimeout(()=>h("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(p)}},[i,a.scrollHideDelay,h]),I.useEffect(()=>{const p=a.viewport,x=o?"scrollLeft":"scrollTop";if(p){let y=p[x];const _=()=>{const j=p[x];y!==j&&(h("SCROLL"),l()),y=j};return p.addEventListener("scroll",_),()=>p.removeEventListener("scroll",_)}},[a.viewport,o,h,l]),r.jsx(xc,{present:n||i!=="hidden",children:r.jsx(Bge,{"data-state":i==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:on(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:on(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),LLe=I.forwardRef((t,e)=>{const n=cp(Ug,t.__scopeScrollArea),{forceMount:s,...a}=t,[o,l]=I.useState(!1),i=t.orientation==="horizontal",h=nse(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=t,a=cp(Ug,t.__scopeScrollArea),o=I.useRef(null),l=I.useRef(0),[i,h]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=zLe(i.viewport,i.content),x={...s,sizes:i,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:_=>o.current=_,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:_=>l.current=_};function y(_,j){return xlt(_,l.current,i,j)}return n==="horizontal"?r.jsx(hlt,{...x,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const _=a.viewport.scrollLeft,j=Oje(_,i,a.dir);o.current.style.transform=`translate3d(${j}px, 0, 0)`}},onWheelScroll:_=>{a.viewport&&(a.viewport.scrollLeft=_)},onDragScroll:_=>{a.viewport&&(a.viewport.scrollLeft=y(_,a.dir))}}):n==="vertical"?r.jsx(flt,{...x,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const _=a.viewport.scrollTop,j=Oje(_,i);o.current.style.transform=`translate3d(0, ${j}px, 0)`}},onWheelScroll:_=>{a.viewport&&(a.viewport.scrollTop=_)},onDragScroll:_=>{a.viewport&&(a.viewport.scrollTop=y(_))}}):null}),hlt=I.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...a}=t,o=cp(Ug,t.__scopeScrollArea),[l,i]=I.useState(),h=I.useRef(null),p=ta(e,h,o.onScrollbarXChange);return I.useEffect(()=>{h.current&&i(getComputedStyle(h.current))},[h]),r.jsx(DLe,{"data-orientation":"horizontal",...a,ref:p,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":rse(n)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.x),onDragScroll:x=>t.onDragScroll(x.x),onWheelScroll:(x,y)=>{if(o.viewport){const _=o.viewport.scrollLeft+x.deltaX;t.onWheelScroll(_),$Le(_,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:lte(l.paddingLeft),paddingEnd:lte(l.paddingRight)}})}})}),flt=I.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...a}=t,o=cp(Ug,t.__scopeScrollArea),[l,i]=I.useState(),h=I.useRef(null),p=ta(e,h,o.onScrollbarYChange);return I.useEffect(()=>{h.current&&i(getComputedStyle(h.current))},[h]),r.jsx(DLe,{"data-orientation":"vertical",...a,ref:p,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":rse(n)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.y),onDragScroll:x=>t.onDragScroll(x.y),onWheelScroll:(x,y)=>{if(o.viewport){const _=o.viewport.scrollTop+x.deltaY;t.onWheelScroll(_),$Le(_,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:lte(l.paddingTop),paddingEnd:lte(l.paddingBottom)}})}})}),[plt,OLe]=ALe(Ug),DLe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:x,onResize:y,..._}=t,j=cp(Ug,n),[C,N]=I.useState(null),A=ta(e,G=>N(G)),E=I.useRef(null),T=I.useRef(""),P=j.viewport,z=s.content-s.viewport,F=Ql(x),q=Ql(h),V=nse(y,10);function K(G){if(E.current){const te=G.clientX-E.current.left,ie=G.clientY-E.current.top;p({x:te,y:ie})}}return I.useEffect(()=>{const G=te=>{const ie=te.target;(C==null?void 0:C.contains(ie))&&F(te,z)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[P,C,z,F]),I.useEffect(q,[s,q]),pC(C,V),pC(j.content,V),r.jsx(plt,{scope:n,scrollbar:C,hasThumb:a,onThumbChange:Ql(o),onThumbPointerUp:Ql(l),onThumbPositionChange:q,onThumbPointerDown:Ql(i),children:r.jsx(Rn.div,{..._,ref:A,style:{position:"absolute",..._.style},onPointerDown:on(t.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),E.current=C.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",j.viewport&&(j.viewport.style.scrollBehavior="auto"),K(G))}),onPointerMove:on(t.onPointerMove,K),onPointerUp:on(t.onPointerUp,G=>{const te=G.target;te.hasPointerCapture(G.pointerId)&&te.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=T.current,j.viewport&&(j.viewport.style.scrollBehavior=""),E.current=null})})})}),ote="ScrollAreaThumb",RLe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=OLe(ote,t.__scopeScrollArea);return r.jsx(xc,{present:n||a.hasThumb,children:r.jsx(mlt,{ref:e,...s})})}),mlt=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...a}=t,o=cp(ote,n),l=OLe(ote,n),{onThumbPositionChange:i}=l,h=ta(e,y=>l.onThumbChange(y)),p=I.useRef(void 0),x=nse(()=>{p.current&&(p.current(),p.current=void 0)},100);return I.useEffect(()=>{const y=o.viewport;if(y){const _=()=>{if(x(),!p.current){const j=ylt(y,i);p.current=j,i()}};return i(),y.addEventListener("scroll",_),()=>y.removeEventListener("scroll",_)}},[o.viewport,x,i]),r.jsx(Rn.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:on(t.onPointerDownCapture,y=>{const j=y.target.getBoundingClientRect(),C=y.clientX-j.left,N=y.clientY-j.top;l.onThumbPointerDown({x:C,y:N})}),onPointerUp:on(t.onPointerUp,l.onThumbPointerUp)})});RLe.displayName=ote;var $ge="ScrollAreaCorner",FLe=I.forwardRef((t,e)=>{const n=cp($ge,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(glt,{...t,ref:e}):null});FLe.displayName=$ge;var glt=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,a=cp($ge,n),[o,l]=I.useState(0),[i,h]=I.useState(0),p=!!(o&&i);return pC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),h(x)}),pC(a.scrollbarY,()=>{var y;const x=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(x),l(x)}),p?r.jsx(Rn.div,{...s,ref:e,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function lte(t){return t?parseInt(t,10):0}function zLe(t,e){const n=t/e;return isNaN(n)?0:n}function rse(t){const e=zLe(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function xlt(t,e,n,s="ltr"){const a=rse(n),o=a/2,l=e||o,i=a-l,h=n.scrollbar.paddingStart+l,p=n.scrollbar.size-n.scrollbar.paddingEnd-i,x=n.content-n.viewport,y=s==="ltr"?[0,x]:[x*-1,0];return BLe([h,p],y)(t)}function Oje(t,e,n="ltr"){const s=rse(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-a,l=e.content-e.viewport,i=o-s,h=n==="ltr"?[0,l]:[l*-1,0],p=nE(t,h);return BLe([0,l],[0,i])(p)}function BLe(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 $Le(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},s=0;return function a(){const o={left:t.scrollLeft,top:t.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&e(),n=o,s=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(s)};function nse(t,e){const n=Ql(t),s=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(s.current),[]),I.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,e)},[n,e])}function pC(t,e){const n=Ql(e);ec(()=>{let s=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return a.observe(t),()=>{window.cancelAnimationFrame(s),a.unobserve(t)}}},[t,n])}var ULe=ELe,vlt=PLe,_lt=FLe;const tl=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(ULe,{ref:s,className:zt("relative overflow-hidden",t),...n,children:[r.jsx(vlt,{className:"h-full w-full rounded-[inherit]",children:e}),r.jsx(Uge,{}),r.jsx(_lt,{})]}));tl.displayName=ULe.displayName;const Uge=I.forwardRef(({className:t,orientation:e="vertical",...n},s)=>r.jsx(zge,{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(RLe,{className:"relative flex-1 rounded-full bg-border"})}));Uge.displayName=zge.displayName;var sse="Collapsible",[blt]=rc(sse),[wlt,qge]=blt(sse),qLe=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:o,onOpenChange:l,...i}=t,[h,p]=$u({prop:s,defaultProp:a??!1,onChange:l,caller:sse});return r.jsx(wlt,{scope:n,disabled:o,contentId:Kc(),open:h,onOpenToggle:I.useCallback(()=>p(x=>!x),[p]),children:r.jsx(Rn.div,{"data-state":Hge(h),"data-disabled":o?"":void 0,...i,ref:e})})});qLe.displayName=sse;var VLe="CollapsibleTrigger",HLe=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,a=qge(VLe,n);return r.jsx(Rn.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":Hge(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:e,onClick:on(t.onClick,a.onOpenToggle)})});HLe.displayName=VLe;var Vge="CollapsibleContent",WLe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=qge(Vge,t.__scopeCollapsible);return r.jsx(xc,{present:n||a.open,children:({present:o})=>r.jsx(jlt,{...s,ref:e,present:o})})});WLe.displayName=Vge;var jlt=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:a,...o}=t,l=qge(Vge,n),[i,h]=I.useState(s),p=I.useRef(null),x=ta(e,p),y=I.useRef(0),_=y.current,j=I.useRef(0),C=j.current,N=l.open||i,A=I.useRef(N),E=I.useRef(void 0);return I.useEffect(()=>{const T=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(T)},[]),ec(()=>{const T=p.current;if(T){E.current=E.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const P=T.getBoundingClientRect();y.current=P.height,j.current=P.width,A.current||(T.style.transitionDuration=E.current.transitionDuration,T.style.animationName=E.current.animationName),h(s)}},[l.open,s]),r.jsx(Rn.div,{"data-state":Hge(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!N,...o,ref:x,style:{"--radix-collapsible-content-height":_?`${_}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...t.style},children:N&&a})});function Hge(t){return t?"open":"closed"}var klt=qLe;const SS=klt,CS=HLe,MS=WLe,Dje="/assets/levelup-logo-Eif24dqY.png",Nlt="/assets/levelup-logo-icon-C-7iromj.png";var CI=t=>t.type==="checkbox",$w=t=>t instanceof Date,Pu=t=>t==null;const GLe=t=>typeof t=="object";var gc=t=>!Pu(t)&&!Array.isArray(t)&&GLe(t)&&!$w(t),KLe=t=>gc(t)&&t.target?CI(t.target)?t.target.checked:t.target.value:t,Slt=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ZLe=(t,e)=>t.has(Slt(e)),Clt=t=>{const e=t.constructor&&t.constructor.prototype;return gc(e)&&e.hasOwnProperty("isPrototypeOf")},Wge=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function $c(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(!(Wge&&(t instanceof Blob||s))&&(n||gc(t)))if(e=n?[]:{},!n&&!Clt(t))e=t;else for(const a in t)t.hasOwnProperty(a)&&(e[a]=$c(t[a]));else return t;return e}var ase=t=>/^\w*$/.test(t),lc=t=>t===void 0,Gge=t=>Array.isArray(t)?t.filter(Boolean):[],Kge=t=>Gge(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Kn=(t,e,n)=>{if(!e||!gc(t))return n;const s=(ase(e)?[e]:Kge(e)).reduce((a,o)=>Pu(a)?a:a[o],t);return lc(s)||s===t?lc(t[e])?n:t[e]:s},Vh=t=>typeof t=="boolean",wo=(t,e,n)=>{let s=-1;const a=ase(e)?[e]:Kge(e),o=a.length,l=o-1;for(;++sst.useContext(Zge),Mlt=t=>{const{children:e,...n}=t;return st.createElement(Zge.Provider,{value:n},e)};var YLe=(t,e,n,s=!0)=>{const a={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(a,o,{get:()=>{const l=o;return e._proxyFormState[l]!==sm.all&&(e._proxyFormState[l]=!s||sm.all),n&&(n[l]=!0),t[l]}});return a};const Yge=typeof window<"u"?st.useLayoutEffect:st.useEffect;function Tlt(t){const e=ise(),{control:n=e.control,disabled:s,name:a,exact:o}=t||{},[l,i]=st.useState(n._formState),h=st.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Yge(()=>n._subscribe({name:a,formState:h.current,exact:o,callback:p=>{!s&&i({...n._formState,...p})}}),[a,s,o]),st.useEffect(()=>{h.current.isValid&&n._setValid(!0)},[n]),st.useMemo(()=>YLe(l,n,h.current,!1),[l,n])}var ug=t=>typeof t=="string",XLe=(t,e,n,s,a)=>ug(t)?(s&&e.watch.add(t),Kn(n,t,a)):Array.isArray(t)?t.map(o=>(s&&e.watch.add(o),Kn(n,o))):(s&&(e.watchAll=!0),n),mhe=t=>Pu(t)||!GLe(t);function Ex(t,e,n=new WeakSet){if(mhe(t)||mhe(e))return t===e;if($w(t)&&$w(e))return t.getTime()===e.getTime();const s=Object.keys(t),a=Object.keys(e);if(s.length!==a.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const o of s){const l=t[o];if(!a.includes(o))return!1;if(o!=="ref"){const i=e[o];if($w(l)&&$w(i)||gc(l)&&gc(i)||Array.isArray(l)&&Array.isArray(i)?!Ex(l,i,n):l!==i)return!1}}return!0}function Alt(t){const e=ise(),{control:n=e.control,name:s,defaultValue:a,disabled:o,exact:l,compute:i}=t||{},h=st.useRef(a),p=st.useRef(i),x=st.useRef(void 0);p.current=i;const y=st.useMemo(()=>n._getWatch(s,h.current),[n,s]),[_,j]=st.useState(p.current?p.current(y):y);return Yge(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:C=>{if(!o){const N=XLe(s,n._names,C.values||n._formValues,!1,h.current);if(p.current){const A=p.current(N);Ex(A,x.current)||(j(A),x.current=A)}else j(N)}}}),[n,o,s,l]),st.useEffect(()=>n._removeUnmounted()),_}function Elt(t){const e=ise(),{name:n,disabled:s,control:a=e.control,shouldUnregister:o,defaultValue:l}=t,i=ZLe(a._names.array,n),h=st.useMemo(()=>Kn(a._formValues,n,Kn(a._defaultValues,n,l)),[a,n,l]),p=Alt({control:a,name:n,defaultValue:h,exact:!0}),x=Tlt({control:a,name:n,exact:!0}),y=st.useRef(t),_=st.useRef(a.register(n,{...t.rules,value:p,...Vh(t.disabled)?{disabled:t.disabled}:{}}));y.current=t;const j=st.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Kn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Kn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Kn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Kn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Kn(x.errors,n)}}),[x,n]),C=st.useCallback(T=>_.current.onChange({target:{value:KLe(T),name:n},type:cte.CHANGE}),[n]),N=st.useCallback(()=>_.current.onBlur({target:{value:Kn(a._formValues,n),name:n},type:cte.BLUR}),[n,a._formValues]),A=st.useCallback(T=>{const P=Kn(a._fields,n);P&&T&&(P._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:z=>T.setCustomValidity(z),reportValidity:()=>T.reportValidity()})},[a._fields,n]),E=st.useMemo(()=>({name:n,value:p,...Vh(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:C,onBlur:N,ref:A}),[n,s,x.disabled,C,N,A,p]);return st.useEffect(()=>{const T=a._options.shouldUnregister||o;a.register(n,{...y.current.rules,...Vh(y.current.disabled)?{disabled:y.current.disabled}:{}});const P=(z,F)=>{const q=Kn(a._fields,z);q&&q._f&&(q._f.mount=F)};if(P(n,!0),T){const z=$c(Kn(a._options.defaultValues,n));wo(a._defaultValues,n,z),lc(Kn(a._formValues,n))&&wo(a._formValues,n,z)}return!i&&a.register(n),()=>{(i?T&&!a._state.action:T)?a.unregister(n):P(n,!1)}},[n,a,i,o]),st.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),st.useMemo(()=>({field:E,formState:x,fieldState:j}),[E,x,j])}const Ilt=t=>t.render(Elt(t));var QLe=(t,e,n,s,a)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[s]:a||!0}}:{},cA=t=>Array.isArray(t)?t:[t],Rje=()=>{let t=[];return{get observers(){return t},next:a=>{for(const o of t)o.next&&o.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(o=>o!==a)}}),unsubscribe:()=>{t=[]}}},lh=t=>gc(t)&&!Object.keys(t).length,Xge=t=>t.type==="file",am=t=>typeof t=="function",dte=t=>{if(!Wge)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},JLe=t=>t.type==="select-multiple",Qge=t=>t.type==="radio",Plt=t=>Qge(t)||CI(t),qle=t=>dte(t)&&t.isConnected;function Llt(t,e){const n=e.slice(0,-1).length;let s=0;for(;s{for(const e in t)if(am(t[e]))return!0;return!1};function ute(t,e={}){const n=Array.isArray(t);if(gc(t)||n)for(const s in t)Array.isArray(t[s])||gc(t[s])&&!eOe(t[s])?(e[s]=Array.isArray(t[s])?[]:{},ute(t[s],e[s])):Pu(t[s])||(e[s]=!0);return e}function tOe(t,e,n){const s=Array.isArray(t);if(gc(t)||s)for(const a in t)Array.isArray(t[a])||gc(t[a])&&!eOe(t[a])?lc(e)||mhe(n[a])?n[a]=Array.isArray(t[a])?ute(t[a],[]):{...ute(t[a])}:tOe(t[a],Pu(e)?{}:e[a],n[a]):n[a]=!Ex(t[a],e[a]);return n}var LM=(t,e)=>tOe(t,e,ute(e));const Fje={value:!1,isValid:!1},zje={value:!0,isValid:!0};var rOe=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&&!lc(t[0].attributes.value)?lc(t[0].value)||t[0].value===""?zje:{value:t[0].value,isValid:!0}:zje:Fje}return Fje},nOe=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:s})=>lc(t)?t:e?t===""?NaN:t&&+t:n&&ug(t)?new Date(t):s?s(t):t;const Bje={isValid:!1,value:null};var sOe=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,Bje):Bje;function $je(t){const e=t.ref;return Xge(e)?e.files:Qge(e)?sOe(t.refs).value:JLe(e)?[...e.selectedOptions].map(({value:n})=>n):CI(e)?rOe(t.refs).value:nOe(lc(e.value)?t.ref.value:e.value,t)}var Dlt=(t,e,n,s)=>{const a={};for(const o of t){const l=Kn(e,o);l&&wo(a,o,l._f)}return{criteriaMode:n,names:[...t],fields:a,shouldUseNativeValidation:s}},hte=t=>t instanceof RegExp,OM=t=>lc(t)?t:hte(t)?t.source:gc(t)?hte(t.value)?t.value.source:t.value:t,Uje=t=>({isOnSubmit:!t||t===sm.onSubmit,isOnBlur:t===sm.onBlur,isOnChange:t===sm.onChange,isOnAll:t===sm.all,isOnTouch:t===sm.onTouched});const qje="AsyncFunction";var Rlt=t=>!!t&&!!t.validate&&!!(am(t.validate)&&t.validate.constructor.name===qje||gc(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===qje)),Flt=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Vje=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const dA=(t,e,n,s)=>{for(const a of n||Object.keys(t)){const o=Kn(t,a);if(o){const{_f:l,...i}=o;if(l){if(l.refs&&l.refs[0]&&e(l.refs[0],a)&&!s)return!0;if(l.ref&&e(l.ref,l.name)&&!s)return!0;if(dA(i,e))break}else if(gc(i)&&dA(i,e))break}}};function Hje(t,e,n){const s=Kn(t,n);if(s||ase(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),l=Kn(e,o),i=Kn(t,o);if(l&&!Array.isArray(l)&&n!==o)return{name:n};if(i&&i.type)return{name:o,error:i};if(i&&i.root&&i.root.type)return{name:`${o}.root`,error:i.root};a.pop()}return{name:n}}var zlt=(t,e,n,s)=>{n(t);const{name:a,...o}=t;return lh(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(l=>e[l]===(!s||sm.all))},Blt=(t,e,n)=>!t||!e||t===e||cA(t).some(s=>s&&(n?s===e:s.startsWith(e)||e.startsWith(s))),$lt=(t,e,n,s,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(e||t):(n?s.isOnBlur:a.isOnBlur)?!t:(n?s.isOnChange:a.isOnChange)?t:!0,Ult=(t,e)=>!Gge(Kn(t,e)).length&&kc(t,e),qlt=(t,e,n)=>{const s=cA(Kn(t,n));return wo(s,"root",e[n]),wo(t,n,s),t},nee=t=>ug(t);function Wje(t,e,n="validate"){if(nee(t)||Array.isArray(t)&&t.every(nee)||Vh(t)&&!t)return{type:n,message:nee(t)?t:"",ref:e}}var i4=t=>gc(t)&&!hte(t)?t:{value:t,message:""},Gje=async(t,e,n,s,a,o)=>{const{ref:l,refs:i,required:h,maxLength:p,minLength:x,min:y,max:_,pattern:j,validate:C,name:N,valueAsNumber:A,mount:E}=t._f,T=Kn(n,N);if(!E||e.has(N))return{};const P=i?i[0]:l,z=oe=>{a&&P.reportValidity&&(P.setCustomValidity(Vh(oe)?"":oe||""),P.reportValidity())},F={},q=Qge(l),V=CI(l),K=q||V,G=(A||Xge(l))&&lc(l.value)&&lc(T)||dte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,te=QLe.bind(null,N,s,F),ie=(oe,ye,ae,pe=px.maxLength,se=px.minLength)=>{const he=oe?ye:ae;F[N]={type:oe?pe:se,message:he,ref:l,...te(oe?pe:se,he)}};if(o?!Array.isArray(T)||!T.length:h&&(!K&&(G||Pu(T))||Vh(T)&&!T||V&&!rOe(i).isValid||q&&!sOe(i).isValid)){const{value:oe,message:ye}=nee(h)?{value:!!h,message:h}:i4(h);if(oe&&(F[N]={type:px.required,message:ye,ref:P,...te(px.required,ye)},!s))return z(ye),F}if(!G&&(!Pu(y)||!Pu(_))){let oe,ye;const ae=i4(_),pe=i4(y);if(!Pu(T)&&!isNaN(T)){const se=l.valueAsNumber||T&&+T;Pu(ae.value)||(oe=se>ae.value),Pu(pe.value)||(ye=senew Date(new Date().toDateString()+" "+Ae),ue=l.type=="time",_e=l.type=="week";ug(ae.value)&&T&&(oe=ue?he(T)>he(ae.value):_e?T>ae.value:se>new Date(ae.value)),ug(pe.value)&&T&&(ye=ue?he(T)+oe.value,pe=!Pu(ye.value)&&T.length<+ye.value;if((ae||pe)&&(ie(ae,oe.message,ye.message),!s))return z(F[N].message),F}if(j&&!G&&ug(T)){const{value:oe,message:ye}=i4(j);if(hte(oe)&&!T.match(oe)&&(F[N]={type:px.pattern,message:ye,ref:l,...te(px.pattern,ye)},!s))return z(ye),F}if(C){if(am(C)){const oe=await C(T,n),ye=Wje(oe,P);if(ye&&(F[N]={...ye,...te(px.validate,ye.message)},!s))return z(ye.message),F}else if(gc(C)){let oe={};for(const ye in C){if(!lh(oe)&&!s)break;const ae=Wje(await C[ye](T,n),P,ye);ae&&(oe={...ae,...te(ye,ae.message)},z(ae.message),s&&(F[N]=oe))}if(!lh(oe)&&(F[N]={ref:P,...oe},!s))return F}}return z(!0),F};const Vlt={mode:sm.onSubmit,reValidateMode:sm.onChange,shouldFocusError:!0};function Hlt(t={}){let e={...Vlt,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:am(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},a=gc(e.defaultValues)||gc(e.values)?$c(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:$c(a),l={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,p=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const _={array:Rje(),state:Rje()},j=e.criteriaMode===sm.all,C=qe=>Oe=>{clearTimeout(p),p=setTimeout(qe,Oe)},N=async qe=>{if(!e.disabled&&(x.isValid||y.isValid||qe)){const Oe=e.resolver?lh((await V()).errors):await G(s,!0);Oe!==n.isValid&&_.state.next({isValid:Oe})}},A=(qe,Oe)=>{!e.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((qe||Array.from(i.mount)).forEach(Qe=>{Qe&&(Oe?wo(n.validatingFields,Qe,Oe):kc(n.validatingFields,Qe))}),_.state.next({validatingFields:n.validatingFields,isValidating:!lh(n.validatingFields)}))},E=(qe,Oe=[],Qe,nt,gt=!0,mt=!0)=>{if(nt&&Qe&&!e.disabled){if(l.action=!0,mt&&Array.isArray(Kn(s,qe))){const Mt=Qe(Kn(s,qe),nt.argA,nt.argB);gt&&wo(s,qe,Mt)}if(mt&&Array.isArray(Kn(n.errors,qe))){const Mt=Qe(Kn(n.errors,qe),nt.argA,nt.argB);gt&&wo(n.errors,qe,Mt),Ult(n.errors,qe)}if((x.touchedFields||y.touchedFields)&&mt&&Array.isArray(Kn(n.touchedFields,qe))){const Mt=Qe(Kn(n.touchedFields,qe),nt.argA,nt.argB);gt&&wo(n.touchedFields,qe,Mt)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=LM(a,o)),_.state.next({name:qe,isDirty:ie(qe,Oe),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else wo(o,qe,Oe)},T=(qe,Oe)=>{wo(n.errors,qe,Oe),_.state.next({errors:n.errors})},P=qe=>{n.errors=qe,_.state.next({errors:n.errors,isValid:!1})},z=(qe,Oe,Qe,nt)=>{const gt=Kn(s,qe);if(gt){const mt=Kn(o,qe,lc(Qe)?Kn(a,qe):Qe);lc(mt)||nt&&nt.defaultChecked||Oe?wo(o,qe,Oe?mt:$je(gt._f)):ae(qe,mt),l.mount&&N()}},F=(qe,Oe,Qe,nt,gt)=>{let mt=!1,Mt=!1;const wt={name:qe};if(!e.disabled){if(!Qe||nt){(x.isDirty||y.isDirty)&&(Mt=n.isDirty,n.isDirty=wt.isDirty=ie(),mt=Mt!==wt.isDirty);const Qt=Ex(Kn(a,qe),Oe);Mt=!!Kn(n.dirtyFields,qe),Qt?kc(n.dirtyFields,qe):wo(n.dirtyFields,qe,!0),wt.dirtyFields=n.dirtyFields,mt=mt||(x.dirtyFields||y.dirtyFields)&&Mt!==!Qt}if(Qe){const Qt=Kn(n.touchedFields,qe);Qt||(wo(n.touchedFields,qe,Qe),wt.touchedFields=n.touchedFields,mt=mt||(x.touchedFields||y.touchedFields)&&Qt!==Qe)}mt&>&&_.state.next(wt)}return mt?wt:{}},q=(qe,Oe,Qe,nt)=>{const gt=Kn(n.errors,qe),mt=(x.isValid||y.isValid)&&Vh(Oe)&&n.isValid!==Oe;if(e.delayError&&Qe?(h=C(()=>T(qe,Qe)),h(e.delayError)):(clearTimeout(p),h=null,Qe?wo(n.errors,qe,Qe):kc(n.errors,qe)),(Qe?!Ex(gt,Qe):gt)||!lh(nt)||mt){const Mt={...nt,...mt&&Vh(Oe)?{isValid:Oe}:{},errors:n.errors,name:qe};n={...n,...Mt},_.state.next(Mt)}},V=async qe=>{A(qe,!0);const Oe=await e.resolver(o,e.context,Dlt(qe||i.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return A(qe),Oe},K=async qe=>{const{errors:Oe}=await V(qe);if(qe)for(const Qe of qe){const nt=Kn(Oe,Qe);nt?wo(n.errors,Qe,nt):kc(n.errors,Qe)}else n.errors=Oe;return Oe},G=async(qe,Oe,Qe={valid:!0})=>{for(const nt in qe){const gt=qe[nt];if(gt){const{_f:mt,...Mt}=gt;if(mt){const wt=i.array.has(mt.name),Qt=gt._f&&Rlt(gt._f);Qt&&x.validatingFields&&A([nt],!0);const Cr=await Gje(gt,i.disabled,o,j,e.shouldUseNativeValidation&&!Oe,wt);if(Qt&&x.validatingFields&&A([nt]),Cr[mt.name]&&(Qe.valid=!1,Oe))break;!Oe&&(Kn(Cr,mt.name)?wt?qlt(n.errors,Cr,mt.name):wo(n.errors,mt.name,Cr[mt.name]):kc(n.errors,mt.name))}!lh(Mt)&&await G(Mt,Oe,Qe)}}return Qe.valid},te=()=>{for(const qe of i.unMount){const Oe=Kn(s,qe);Oe&&(Oe._f.refs?Oe._f.refs.every(Qe=>!qle(Qe)):!qle(Oe._f.ref))&&Ee(qe)}i.unMount=new Set},ie=(qe,Oe)=>!e.disabled&&(qe&&Oe&&wo(o,qe,Oe),!Ex(Ae(),a)),oe=(qe,Oe,Qe)=>XLe(qe,i,{...l.mount?o:lc(Oe)?a:ug(qe)?{[qe]:Oe}:Oe},Qe,Oe),ye=qe=>Gge(Kn(l.mount?o:a,qe,e.shouldUnregister?Kn(a,qe,[]):[])),ae=(qe,Oe,Qe={})=>{const nt=Kn(s,qe);let gt=Oe;if(nt){const mt=nt._f;mt&&(!mt.disabled&&wo(o,qe,nOe(Oe,mt)),gt=dte(mt.ref)&&Pu(Oe)?"":Oe,JLe(mt.ref)?[...mt.ref.options].forEach(Mt=>Mt.selected=gt.includes(Mt.value)):mt.refs?CI(mt.ref)?mt.refs.forEach(Mt=>{(!Mt.defaultChecked||!Mt.disabled)&&(Array.isArray(gt)?Mt.checked=!!gt.find(wt=>wt===Mt.value):Mt.checked=gt===Mt.value||!!gt)}):mt.refs.forEach(Mt=>Mt.checked=Mt.value===gt):Xge(mt.ref)?mt.ref.value="":(mt.ref.value=gt,mt.ref.type||_.state.next({name:qe,values:$c(o)})))}(Qe.shouldDirty||Qe.shouldTouch)&&F(qe,gt,Qe.shouldTouch,Qe.shouldDirty,!0),Qe.shouldValidate&&_e(qe)},pe=(qe,Oe,Qe)=>{for(const nt in Oe){if(!Oe.hasOwnProperty(nt))return;const gt=Oe[nt],mt=qe+"."+nt,Mt=Kn(s,mt);(i.array.has(qe)||gc(gt)||Mt&&!Mt._f)&&!$w(gt)?pe(mt,gt,Qe):ae(mt,gt,Qe)}},se=(qe,Oe,Qe={})=>{const nt=Kn(s,qe),gt=i.array.has(qe),mt=$c(Oe);wo(o,qe,mt),gt?(_.array.next({name:qe,values:$c(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Qe.shouldDirty&&_.state.next({name:qe,dirtyFields:LM(a,o),isDirty:ie(qe,mt)})):nt&&!nt._f&&!Pu(mt)?pe(qe,mt,Qe):ae(qe,mt,Qe),Vje(qe,i)&&_.state.next({...n,name:qe}),_.state.next({name:l.mount?qe:void 0,values:$c(o)})},he=async qe=>{l.mount=!0;const Oe=qe.target;let Qe=Oe.name,nt=!0;const gt=Kn(s,Qe),mt=Qt=>{nt=Number.isNaN(Qt)||$w(Qt)&&isNaN(Qt.getTime())||Ex(Qt,Kn(o,Qe,Qt))},Mt=Uje(e.mode),wt=Uje(e.reValidateMode);if(gt){let Qt,Cr;const cn=Oe.type?$je(gt._f):KLe(qe),jn=qe.type===cte.BLUR||qe.type===cte.FOCUS_OUT,Qr=!Flt(gt._f)&&!e.resolver&&!Kn(n.errors,Qe)&&!gt._f.deps||$lt(jn,Kn(n.touchedFields,Qe),n.isSubmitted,wt,Mt),Pn=Vje(Qe,i,jn);wo(o,Qe,cn),jn?(gt._f.onBlur&>._f.onBlur(qe),h&&h(0)):gt._f.onChange&>._f.onChange(qe);const js=F(Qe,cn,jn),hr=!lh(js)||Pn;if(!jn&&_.state.next({name:Qe,type:qe.type,values:$c(o)}),Qr)return(x.isValid||y.isValid)&&(e.mode==="onBlur"?jn&&N():jn||N()),hr&&_.state.next({name:Qe,...Pn?{}:js});if(!jn&&Pn&&_.state.next({...n}),e.resolver){const{errors:xs}=await V([Qe]);if(mt(cn),nt){const ka=Hje(n.errors,s,Qe),xa=Hje(xs,s,ka.name||Qe);Qt=xa.error,Qe=xa.name,Cr=lh(xs)}}else A([Qe],!0),Qt=(await Gje(gt,i.disabled,o,j,e.shouldUseNativeValidation))[Qe],A([Qe]),mt(cn),nt&&(Qt?Cr=!1:(x.isValid||y.isValid)&&(Cr=await G(s,!0)));nt&&(gt._f.deps&&_e(gt._f.deps),q(Qe,Cr,Qt,js))}},ue=(qe,Oe)=>{if(Kn(n.errors,Oe)&&qe.focus)return qe.focus(),1},_e=async(qe,Oe={})=>{let Qe,nt;const gt=cA(qe);if(e.resolver){const mt=await K(lc(qe)?qe:gt);Qe=lh(mt),nt=qe?!gt.some(Mt=>Kn(mt,Mt)):Qe}else qe?(nt=(await Promise.all(gt.map(async mt=>{const Mt=Kn(s,mt);return await G(Mt&&Mt._f?{[mt]:Mt}:Mt)}))).every(Boolean),!(!nt&&!n.isValid)&&N()):nt=Qe=await G(s);return _.state.next({...!ug(qe)||(x.isValid||y.isValid)&&Qe!==n.isValid?{}:{name:qe},...e.resolver||!qe?{isValid:Qe}:{},errors:n.errors}),Oe.shouldFocus&&!nt&&dA(s,ue,qe?gt:i.mount),nt},Ae=qe=>{const Oe={...l.mount?o:a};return lc(qe)?Oe:ug(qe)?Kn(Oe,qe):qe.map(Qe=>Kn(Oe,Qe))},Ce=(qe,Oe)=>({invalid:!!Kn((Oe||n).errors,qe),isDirty:!!Kn((Oe||n).dirtyFields,qe),error:Kn((Oe||n).errors,qe),isValidating:!!Kn(n.validatingFields,qe),isTouched:!!Kn((Oe||n).touchedFields,qe)}),Se=qe=>{qe&&cA(qe).forEach(Oe=>kc(n.errors,Oe)),_.state.next({errors:qe?n.errors:{}})},ge=(qe,Oe,Qe)=>{const nt=(Kn(s,qe,{_f:{}})._f||{}).ref,gt=Kn(n.errors,qe)||{},{ref:mt,message:Mt,type:wt,...Qt}=gt;wo(n.errors,qe,{...Qt,...Oe,ref:nt}),_.state.next({name:qe,errors:n.errors,isValid:!1}),Qe&&Qe.shouldFocus&&nt&&nt.focus&&nt.focus()},Le=(qe,Oe)=>am(qe)?_.state.subscribe({next:Qe=>"values"in Qe&&qe(oe(void 0,Oe),Qe)}):oe(qe,Oe,!0),ke=qe=>_.state.subscribe({next:Oe=>{Blt(qe.name,Oe.name,qe.exact)&&zlt(Oe,qe.formState||x,at,qe.reRenderRoot)&&qe.callback({values:{...o},...n,...Oe,defaultValues:a})}}).unsubscribe,Be=qe=>(l.mount=!0,y={...y,...qe.formState},ke({...qe,formState:y})),Ee=(qe,Oe={})=>{for(const Qe of qe?cA(qe):i.mount)i.mount.delete(Qe),i.array.delete(Qe),Oe.keepValue||(kc(s,Qe),kc(o,Qe)),!Oe.keepError&&kc(n.errors,Qe),!Oe.keepDirty&&kc(n.dirtyFields,Qe),!Oe.keepTouched&&kc(n.touchedFields,Qe),!Oe.keepIsValidating&&kc(n.validatingFields,Qe),!e.shouldUnregister&&!Oe.keepDefaultValue&&kc(a,Qe);_.state.next({values:$c(o)}),_.state.next({...n,...Oe.keepDirty?{isDirty:ie()}:{}}),!Oe.keepIsValid&&N()},Ue=({disabled:qe,name:Oe})=>{(Vh(qe)&&l.mount||qe||i.disabled.has(Oe))&&(qe?i.disabled.add(Oe):i.disabled.delete(Oe))},Fe=(qe,Oe={})=>{let Qe=Kn(s,qe);const nt=Vh(Oe.disabled)||Vh(e.disabled);return wo(s,qe,{...Qe||{},_f:{...Qe&&Qe._f?Qe._f:{ref:{name:qe}},name:qe,mount:!0,...Oe}}),i.mount.add(qe),Qe?Ue({disabled:Vh(Oe.disabled)?Oe.disabled:e.disabled,name:qe}):z(qe,!0,Oe.value),{...nt?{disabled:Oe.disabled||e.disabled}:{},...e.progressive?{required:!!Oe.required,min:OM(Oe.min),max:OM(Oe.max),minLength:OM(Oe.minLength),maxLength:OM(Oe.maxLength),pattern:OM(Oe.pattern)}:{},name:qe,onChange:he,onBlur:he,ref:gt=>{if(gt){Fe(qe,Oe),Qe=Kn(s,qe);const mt=lc(gt.value)&>.querySelectorAll&>.querySelectorAll("input,select,textarea")[0]||gt,Mt=Plt(mt),wt=Qe._f.refs||[];if(Mt?wt.find(Qt=>Qt===mt):mt===Qe._f.ref)return;wo(s,qe,{_f:{...Qe._f,...Mt?{refs:[...wt.filter(qle),mt,...Array.isArray(Kn(a,qe))?[{}]:[]],ref:{type:mt.type,name:qe}}:{ref:mt}}}),z(qe,!1,void 0,mt)}else Qe=Kn(s,qe,{}),Qe._f&&(Qe._f.mount=!1),(e.shouldUnregister||Oe.shouldUnregister)&&!(ZLe(i.array,qe)&&l.action)&&i.unMount.add(qe)}}},be=()=>e.shouldFocusError&&dA(s,ue,i.mount),tt=qe=>{Vh(qe)&&(_.state.next({disabled:qe}),dA(s,(Oe,Qe)=>{const nt=Kn(s,Qe);nt&&(Oe.disabled=nt._f.disabled||qe,Array.isArray(nt._f.refs)&&nt._f.refs.forEach(gt=>{gt.disabled=nt._f.disabled||qe}))},0,!1))},Te=(qe,Oe)=>async Qe=>{let nt;Qe&&(Qe.preventDefault&&Qe.preventDefault(),Qe.persist&&Qe.persist());let gt=$c(o);if(_.state.next({isSubmitting:!0}),e.resolver){const{errors:mt,values:Mt}=await V();n.errors=mt,gt=$c(Mt)}else await G(s);if(i.disabled.size)for(const mt of i.disabled)kc(gt,mt);if(kc(n.errors,"root"),lh(n.errors)){_.state.next({errors:{}});try{await qe(gt,Qe)}catch(mt){nt=mt}}else Oe&&await Oe({...n.errors},Qe),be(),setTimeout(be);if(_.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lh(n.errors)&&!nt,submitCount:n.submitCount+1,errors:n.errors}),nt)throw nt},Ke=(qe,Oe={})=>{Kn(s,qe)&&(lc(Oe.defaultValue)?se(qe,$c(Kn(a,qe))):(se(qe,Oe.defaultValue),wo(a,qe,$c(Oe.defaultValue))),Oe.keepTouched||kc(n.touchedFields,qe),Oe.keepDirty||(kc(n.dirtyFields,qe),n.isDirty=Oe.defaultValue?ie(qe,$c(Kn(a,qe))):ie()),Oe.keepError||(kc(n.errors,qe),x.isValid&&N()),_.state.next({...n}))},me=(qe,Oe={})=>{const Qe=qe?$c(qe):a,nt=$c(Qe),gt=lh(qe),mt=gt?a:nt;if(Oe.keepDefaultValues||(a=Qe),!Oe.keepValues){if(Oe.keepDirtyValues){const Mt=new Set([...i.mount,...Object.keys(LM(a,o))]);for(const wt of Array.from(Mt))Kn(n.dirtyFields,wt)?wo(mt,wt,Kn(o,wt)):se(wt,Kn(mt,wt))}else{if(Wge&&lc(qe))for(const Mt of i.mount){const wt=Kn(s,Mt);if(wt&&wt._f){const Qt=Array.isArray(wt._f.refs)?wt._f.refs[0]:wt._f.ref;if(dte(Qt)){const Cr=Qt.closest("form");if(Cr){Cr.reset();break}}}}if(Oe.keepFieldsRef)for(const Mt of i.mount)se(Mt,Kn(mt,Mt));else s={}}o=e.shouldUnregister?Oe.keepDefaultValues?$c(a):{}:$c(mt),_.array.next({values:{...mt}}),_.state.next({values:{...mt}})}i={mount:Oe.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Oe.keepIsValid||!!Oe.keepDirtyValues,l.watch=!!e.shouldUnregister,_.state.next({submitCount:Oe.keepSubmitCount?n.submitCount:0,isDirty:gt?!1:Oe.keepDirty?n.isDirty:!!(Oe.keepDefaultValues&&!Ex(qe,a)),isSubmitted:Oe.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:gt?{}:Oe.keepDirtyValues?Oe.keepDefaultValues&&o?LM(a,o):n.dirtyFields:Oe.keepDefaultValues&&qe?LM(a,qe):Oe.keepDirty?n.dirtyFields:{},touchedFields:Oe.keepTouched?n.touchedFields:{},errors:Oe.keepErrors?n.errors:{},isSubmitSuccessful:Oe.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},yt=(qe,Oe)=>me(am(qe)?qe(o):qe,Oe),rt=(qe,Oe={})=>{const Qe=Kn(s,qe),nt=Qe&&Qe._f;if(nt){const gt=nt.refs?nt.refs[0]:nt.ref;gt.focus&&(gt.focus(),Oe.shouldSelect&&am(gt.select)&>.select())}},at=qe=>{n={...n,...qe}},ft={control:{register:Fe,unregister:Ee,getFieldState:Ce,handleSubmit:Te,setError:ge,_subscribe:ke,_runSchema:V,_focusError:be,_getWatch:oe,_getDirty:ie,_setValid:N,_setFieldArray:E,_setDisabledField:Ue,_setErrors:P,_getFieldArray:ye,_reset:me,_resetDefaultValues:()=>am(e.defaultValues)&&e.defaultValues().then(qe=>{yt(qe,e.resetOptions),_.state.next({isLoading:!1})}),_removeUnmounted:te,_disableForm:tt,_subjects:_,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state(qe){l=qe},get _defaultValues(){return a},get _names(){return i},set _names(qe){i=qe},get _formState(){return n},get _options(){return e},set _options(qe){e={...e,...qe}}},subscribe:Be,trigger:_e,register:Fe,handleSubmit:Te,watch:Le,setValue:se,getValues:Ae,reset:yt,resetField:Ke,clearErrors:Se,unregister:Ee,setError:ge,setFocus:rt,getFieldState:Ce};return{...ft,formControl:ft}}function ose(t={}){const e=st.useRef(void 0),n=st.useRef(void 0),[s,a]=st.useState({isDirty:!1,isValidating:!1,isLoading:am(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:am(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!am(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...i}=Hlt(t);e.current={...i,formState:s}}const o=e.current.control;return o._options=t,Yge(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState}),reRenderRoot:!0});return a(i=>({...i,isReady:!0})),o._formState.isReady=!0,l},[o]),st.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),st.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),st.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),st.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),st.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),st.useEffect(()=>{t.values&&!Ex(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=t.values,a(l=>({...l}))):o._resetDefaultValues()},[o,t.values]),st.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=YLe(s,o),e.current}const Kje=(t,e,n)=>{if(t&&"reportValidity"in t){const s=Kn(n,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},aOe=(t,e)=>{for(const n in e.fields){const s=e.fields[n];s&&s.ref&&"reportValidity"in s.ref?Kje(s.ref,n,t):s.refs&&s.refs.forEach(a=>Kje(a,n,t))}},Wlt=(t,e)=>{e.shouldUseNativeValidation&&aOe(t,e);const n={};for(const s in t){const a=Kn(e.fields,s),o=Object.assign(t[s]||{},{ref:a&&a.ref});if(Glt(e.names||Object.keys(t),s)){const l=Object.assign({},Kn(n,s));wo(l,"root",o),wo(n,s,l)}else wo(n,s,o)}return n},Glt=(t,e)=>t.some(n=>n.startsWith(e+"."));var Klt=function(t,e){for(var n={};t.length;){var s=t[0],a=s.code,o=s.message,l=s.path.join(".");if(!n[l])if("unionErrors"in s){var i=s.unionErrors[0].errors[0];n[l]={message:i.message,type:i.code}}else n[l]={message:o,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(x){return x.errors.forEach(function(y){return t.push(y)})}),e){var h=n[l].types,p=h&&h[s.code];n[l]=QLe(l,e,n,a,p?[].concat(p,s.message):s.message)}t.shift()}return n},lse=function(t,e,n){return n===void 0&&(n={}),function(s,a,o){try{return Promise.resolve(function(l,i){try{var h=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(p){return o.shouldUseNativeValidation&&aOe({},o),{errors:{},values:n.raw?s:p}})}catch(p){return i(p)}return h&&h.then?h.then(void 0,i):h}(0,function(l){if(function(i){return Array.isArray(i==null?void 0:i.errors)}(l))return{values:{},errors:Wlt(Klt(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const cse=Mlt,iOe=I.createContext({}),Al=({...t})=>r.jsx(iOe.Provider,{value:{name:t.name},children:r.jsx(Ilt,{...t})}),dse=()=>{const t=I.useContext(iOe),e=I.useContext(oOe),{getFieldState:n,formState:s}=ise(),a=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`,...a}},oOe=I.createContext({}),wl=I.forwardRef(({className:t,...e},n)=>{const s=I.useId();return r.jsx(oOe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:zt("space-y-2",t),...e})})});wl.displayName="FormItem";const jl=I.forwardRef(({className:t,...e},n)=>{const{error:s,formItemId:a}=dse();return r.jsx(He,{ref:n,className:zt(s&&"text-destructive",t),htmlFor:a,...e})});jl.displayName="FormLabel";const kl=I.forwardRef(({...t},e)=>{const{error:n,formItemId:s,formDescriptionId:a,formMessageId:o}=dse();return r.jsx(Dme,{ref:e,id:s,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...t})});kl.displayName="FormControl";const see=I.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:s}=dse();return r.jsx("p",{ref:n,id:s,className:zt("text-sm text-muted-foreground",t),...e})});see.displayName="FormDescription";const Lu=I.forwardRef(({className:t,children:e,...n},s)=>{const{error:a,formMessageId:o}=dse(),l=a?String(a==null?void 0:a.message):e;return l?r.jsx("p",{ref:s,id:o,className:zt("text-sm font-medium text-destructive",t),...n,children:l}):null});Lu.displayName="FormMessage";const ps=I.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 Zlt=u3({category:NLe(["general","technology","crm","marketing"]),subject:oc().min(5,"Subject must be at least 5 characters").max(200),description:oc().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Ylt={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function ghe({trigger:t}){const[e,n]=I.useState(!1),[s,a]=I.useState(!1),{user:o}=Xr(),l=ose({resolver:lse(Zlt),defaultValues:{category:"general",subject:"",description:""}}),i=async h=>{if(!o){ze.error("You must be logged in to submit a ticket");return}a(!0);try{const{error:p}=await J.from("support_tickets").insert({user_id:o.id,category:h.category,subject:h.subject,description:h.description});if(p)throw p;try{await J.functions.invoke("support-ticket-notify",{body:{category:Ylt[h.category],subject:h.subject}})}catch(x){console.log("Notification send attempted:",x)}ze.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(p){console.error("Error submitting ticket:",p),ze.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return r.jsxs(Fr,{open:e,onOpenChange:n,children:[r.jsx(Bo,{asChild:!0,children:t||r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(zT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Rr,{className:"sm:max-w-[500px]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Need Help?"}),r.jsx(Qn,{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(bi,{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(cse,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[r.jsx(Al,{control:l.control,name:"category",render:({field:h})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Category"}),r.jsxs(gn,{onValueChange:h.onChange,defaultValue:h.value,children:[r.jsx(kl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a category"})})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"general",children:"General Support"}),r.jsx(qt,{value:"technology",children:"Technology Support"}),r.jsx(qt,{value:"crm",children:"CRM Support"}),r.jsx(qt,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(Lu,{})]})}),r.jsx(Al,{control:l.control,name:"subject",render:({field:h})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Subject"}),r.jsx(kl,{children:r.jsx(dt,{placeholder:"Brief description of your issue",...h})}),r.jsx(Lu,{})]})}),r.jsx(Al,{control:l.control,name:"description",render:({field:h})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Description"}),r.jsx(kl,{children:r.jsx(ps,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...h})}),r.jsx(Lu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function ws(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 ko(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function Kl(t,e){const n=ws(t);return isNaN(e)?ko(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function wh(t,e){const n=ws(t);if(isNaN(e))return ko(t,NaN);if(!e)return n;const s=n.getDate(),a=ko(t,n.getTime());a.setMonth(n.getMonth()+e+1,0);const o=a.getDate();return s>=o?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}function lOe(t,e){const n=+ws(t);return ko(t,n+e)}const Jge=6048e5,Xlt=864e5,cOe=6e4,dOe=36e5,Qlt=1e3,wL=43200,Zje=1440;function Yje(t,e){return lOe(t,e*dOe)}let Jlt={};function lv(){return Jlt}function uf(t,e){var i,h,p,x;const n=lv(),s=(e==null?void 0:e.weekStartsOn)??((h=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=ws(t),o=a.getDay(),l=(o=a.getTime()?n+1:e.getTime()>=l.getTime()?n:n-1}function hf(t){const e=ws(t);return e.setHours(0,0,0,0),e}function V1(t){const e=ws(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 dm(t,e){const n=hf(t),s=hf(e),a=+n-V1(n),o=+s-V1(s);return Math.round((a-o)/Xlt)}function ect(t){const e=uOe(t),n=ko(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),cy(n)}function Xje(t,e){return lOe(t,e*cOe)}function Uw(t,e){const n=e*7;return Kl(t,n)}function tct(t,e){return wh(t,e*12)}function rct(t){let e;return t.forEach(function(n){const s=ws(n);(e===void 0||e{const s=ws(n);(!e||e>s||isNaN(+s))&&(e=s)}),e||new Date(NaN)}function aee(t,e){const n=ws(t),s=ws(e),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function sct(t){return ko(t,Date.now())}function Jl(t,e){const n=hf(t),s=hf(e);return+n==+s}function exe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function xhe(t){if(!exe(t)&&typeof t!="number")return!1;const e=ws(t);return!isNaN(Number(e))}function mC(t,e){const n=ws(t),s=ws(e),a=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return a*12+o}function act(t,e,n){const s=uf(t,n),a=uf(e,n),o=+s-V1(s),l=+a-V1(a);return Math.round((o-l)/Jge)}function dy(t,e){const n=ws(t),s=ws(e),a=Qje(n,s),o=Math.abs(dm(n,s));n.setDate(n.getDate()-a*o);const l=+(Qje(n,s)===-a),i=a*(o-l);return i===0?0:i}function Qje(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 ict(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function oct(t,e){return+ws(t)-+ws(e)}function lct(t){const e=ws(t);return e.setHours(23,59,59,999),e}function use(t){const e=ws(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function cct(t){const e=ws(t);return+lct(e)==+use(e)}function dct(t,e){const n=ws(t),s=ws(e),a=aee(n,s),o=Math.abs(mC(n,s));let l;if(o<1)l=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*o);let i=aee(n,s)===-a;cct(ws(t))&&o===1&&aee(t,s)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function uct(t,e,n){const s=oct(t,e)/1e3;return ict(n==null?void 0:n.roundingMethod)(s)}function _h(t){const e=ws(t);return e.setDate(1),e.setHours(0,0,0,0),e}function hOe(t){const e=ws(t),n=ko(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function txe(t,e){var i,h,p,x;const n=lv(),s=(e==null?void 0:e.weekStartsOn)??((h=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=ws(t),o=a.getDay(),l=(o{let s;const a=hct[t];return typeof a=="string"?s=a:e===1?s=a.one:s=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Vle(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const pct={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},mct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gct={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},xct={date:Vle({formats:pct,defaultWidth:"full"}),time:Vle({formats:mct,defaultWidth:"full"}),dateTime:Vle({formats:gct,defaultWidth:"full"})},yct={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},vct=(t,e,n,s)=>yct[t];function DM(t){return(e,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,i=n!=null&&n.width?String(n.width):l;a=t.formattingValues[i]||t.formattingValues[l]}else{const l=t.defaultWidth,i=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[i]||t.values[l]}const o=t.argumentCallback?t.argumentCallback(e):e;return a[o]}}const _ct={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},bct={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wct={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"]},jct={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"]},kct={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"}},Nct={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"}},Sct=(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"},Cct={ordinalNumber:Sct,era:DM({values:_ct,defaultWidth:"wide"}),quarter:DM({values:bct,defaultWidth:"wide",argumentCallback:t=>t-1}),month:DM({values:wct,defaultWidth:"wide"}),day:DM({values:jct,defaultWidth:"wide"}),dayPeriod:DM({values:kct,defaultWidth:"wide",formattingValues:Nct,defaultFormattingWidth:"wide"})};function RM(t){return(e,n={})=>{const s=n.width,a=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],o=e.match(a);if(!o)return null;const l=o[0],i=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(i)?Tct(i,y=>y.test(l)):Mct(i,y=>y.test(l));let p;p=t.valueCallback?t.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const x=e.slice(l.length);return{value:p,rest:x}}}function Mct(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Tct(t,e){for(let n=0;n{const s=e.match(t.matchPattern);if(!s)return null;const a=s[0],o=e.match(t.parsePattern);if(!o)return null;let l=t.valueCallback?t.valueCallback(o[0]):o[0];l=n.valueCallback?n.valueCallback(l):l;const i=e.slice(a.length);return{value:l,rest:i}}}const Ect=/^(\d+)(th|st|nd|rd)?/i,Ict=/\d+/i,Pct={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},Lct={any:[/^b/i,/^(a|c)/i]},Oct={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Dct={any:[/1/i,/2/i,/3/i,/4/i]},Rct={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},Fct={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]},zct={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},Bct={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]},$ct={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},Uct={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}},qct={ordinalNumber:Act({matchPattern:Ect,parsePattern:Ict,valueCallback:t=>parseInt(t,10)}),era:RM({matchPatterns:Pct,defaultMatchWidth:"wide",parsePatterns:Lct,defaultParseWidth:"any"}),quarter:RM({matchPatterns:Oct,defaultMatchWidth:"wide",parsePatterns:Dct,defaultParseWidth:"any",valueCallback:t=>t+1}),month:RM({matchPatterns:Rct,defaultMatchWidth:"wide",parsePatterns:Fct,defaultParseWidth:"any"}),day:RM({matchPatterns:zct,defaultMatchWidth:"wide",parsePatterns:Bct,defaultParseWidth:"any"}),dayPeriod:RM({matchPatterns:$ct,defaultMatchWidth:"any",parsePatterns:Uct,defaultParseWidth:"any"})},hse={code:"en-US",formatDistance:fct,formatLong:xct,formatRelative:vct,localize:Cct,match:qct,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Vct(t){const e=ws(t);return dm(e,hOe(e))+1}function rxe(t){const e=ws(t),n=+cy(e)-+ect(e);return Math.round(n/Jge)+1}function nxe(t,e){var x,y,_,j;const n=ws(t),s=n.getFullYear(),a=lv(),o=(e==null?void 0:e.firstWeekContainsDate)??((y=(x=e==null?void 0:e.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??a.firstWeekContainsDate??((j=(_=a.locale)==null?void 0:_.options)==null?void 0:j.firstWeekContainsDate)??1,l=ko(t,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const i=uf(l,e),h=ko(t,0);h.setFullYear(s,0,o),h.setHours(0,0,0,0);const p=uf(h,e);return n.getTime()>=i.getTime()?s+1:n.getTime()>=p.getTime()?s:s-1}function Hct(t,e){var i,h,p,x;const n=lv(),s=(e==null?void 0:e.firstWeekContainsDate)??((h=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,a=nxe(t,e),o=ko(t,0);return o.setFullYear(a,0,s),o.setHours(0,0,0,0),uf(o,e)}function sxe(t,e){const n=ws(t),s=+uf(n,e)-+Hct(n,e);return Math.round(s/Jge)+1}function jo(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const h0={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return jo(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):jo(n+1,2)},d(t,e){return jo(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 jo(t.getHours()%12||12,e.length)},H(t,e){return jo(t.getHours(),e.length)},m(t,e){return jo(t.getMinutes(),e.length)},s(t,e){return jo(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return jo(a,e.length)}},o4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Jje={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(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return h0.y(t,e)},Y:function(t,e,n,s){const a=nxe(t,s),o=a>0?a:1-a;if(e==="YY"){const l=o%100;return jo(l,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):jo(o,e.length)},R:function(t,e){const n=uOe(t);return jo(n,e.length)},u:function(t,e){const n=t.getFullYear();return jo(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 jo(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 jo(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 h0.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 jo(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 a=sxe(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):jo(a,e.length)},I:function(t,e,n){const s=rxe(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):jo(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):h0.d(t,e)},D:function(t,e,n){const s=Vct(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):jo(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 a=t.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return jo(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const a=t.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return jo(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),a=s===0?7:s;switch(e){case"i":return String(a);case"ii":return jo(a,e.length);case"io":return n.ordinalNumber(a,{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 a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let a;switch(s===12?a=o4.noon:s===0?a=o4.midnight:a=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const s=t.getHours();let a;switch(s>=17?a=o4.evening:s>=12?a=o4.afternoon:s>=4?a=o4.morning:a=o4.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{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 h0.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):h0.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):jo(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):jo(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):h0.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):h0.s(t,e)},S:function(t,e){return h0.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return tke(s);case"XXXX":case"XX":return Mw(s);case"XXXXX":case"XXX":default:return Mw(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return tke(s);case"xxxx":case"xx":return Mw(s);case"xxxxx":case"xxx":default:return Mw(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+eke(s,":");case"OOOO":default:return"GMT"+Mw(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+eke(s,":");case"zzzz":default:return"GMT"+Mw(s,":")}},t:function(t,e,n){const s=Math.trunc(t.getTime()/1e3);return jo(s,e.length)},T:function(t,e,n){const s=t.getTime();return jo(s,e.length)}};function eke(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=Math.trunc(s/60),o=s%60;return o===0?n+String(a):n+String(a)+e+jo(o,2)}function tke(t,e){return t%60===0?(t>0?"-":"+")+jo(Math.abs(t)/60,2):Mw(t,e)}function Mw(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=jo(Math.trunc(s/60),2),o=jo(s%60,2);return n+a+e+o}const rke=(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"})}},pOe=(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"})}},Wct=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return rke(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}}",rke(s,e)).replace("{{time}}",pOe(a,e))},yhe={p:pOe,P:Wct},Gct=/^D+$/,Kct=/^Y+$/,Zct=["D","DD","YY","YYYY"];function mOe(t){return Gct.test(t)}function gOe(t){return Kct.test(t)}function vhe(t,e,n){const s=Yct(t,e,n);if(console.warn(s),Zct.includes(t))throw new RangeError(s)}function Yct(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 Xct=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qct=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Jct=/^'([^]*?)'?$/,edt=/''/g,tdt=/[a-zA-Z]/;function xn(t,e,n){var x,y,_,j,C,N,A,E;const s=lv(),a=(n==null?void 0:n.locale)??s.locale??hse,o=(n==null?void 0:n.firstWeekContainsDate)??((y=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??s.firstWeekContainsDate??((j=(_=s.locale)==null?void 0:_.options)==null?void 0:j.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((N=(C=n==null?void 0:n.locale)==null?void 0:C.options)==null?void 0:N.weekStartsOn)??s.weekStartsOn??((E=(A=s.locale)==null?void 0:A.options)==null?void 0:E.weekStartsOn)??0,i=ws(t);if(!xhe(i))throw new RangeError("Invalid time value");let h=e.match(Qct).map(T=>{const P=T[0];if(P==="p"||P==="P"){const z=yhe[P];return z(T,a.formatLong)}return T}).join("").match(Xct).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const P=T[0];if(P==="'")return{isToken:!1,value:rdt(T)};if(Jje[P])return{isToken:!0,value:T};if(P.match(tdt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+P+"`");return{isToken:!1,value:T}});a.localize.preprocessor&&(h=a.localize.preprocessor(i,h));const p={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return h.map(T=>{if(!T.isToken)return T.value;const P=T.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&gOe(P)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&mOe(P))&&vhe(P,e,String(t));const z=Jje[P[0]];return z(i,P,a.localize,p)}).join("")}function rdt(t){const e=t.match(Jct);return e?e[1].replace(edt,"'"):t}function ndt(t,e,n){const s=lv(),a=(n==null?void 0:n.locale)??s.locale??hse,o=2520,l=aee(t,e);if(isNaN(l))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let h,p;l>0?(h=ws(e),p=ws(t)):(h=ws(t),p=ws(e));const x=uct(p,h),y=(V1(p)-V1(h))/1e3,_=Math.round((x-y)/60);let j;if(_<2)return n!=null&&n.includeSeconds?x<5?a.formatDistance("lessThanXSeconds",5,i):x<10?a.formatDistance("lessThanXSeconds",10,i):x<20?a.formatDistance("lessThanXSeconds",20,i):x<40?a.formatDistance("halfAMinute",0,i):x<60?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",1,i):_===0?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",_,i);if(_<45)return a.formatDistance("xMinutes",_,i);if(_<90)return a.formatDistance("aboutXHours",1,i);if(_s.getTime()}function fse(t,e){const n=ws(t),s=ws(e);return+n<+s}function ddt(t){return+ws(t)>Date.now()}function udt(t,e){const n=e instanceof Date?ko(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 hdt=10;class xOe{constructor(){Gn(this,"subPriority",0)}validate(e,n){return!0}}class fdt extends xOe{constructor(e,n,s,a,o){super(),this.value=e,this.validateValue=n,this.setValue=s,this.priority=a,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 pdt extends xOe{constructor(){super(...arguments);Gn(this,"priority",hdt);Gn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:ko(n,udt(n,Date))}}class ho{run(e,n,s,a){const o=this.parse(e,n,s,a);return o?{setter:new fdt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,n,s){return!0}}class mdt extends ho{constructor(){super(...arguments);Gn(this,"priority",140);Gn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,a){switch(s){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})||a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"})}}set(n,s,a){return s.era=a,n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}const uc={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}/},lg={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 hc(t,e){return t&&{value:e(t.value),rest:t.rest}}function Ll(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function cg(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,a=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,l=n[5]?parseInt(n[5],10):0;return{value:s*(a*dOe+o*cOe+l*Qlt),rest:e.slice(n[0].length)}}function yOe(t){return Ll(uc.anyDigitsSigned,t)}function tc(t,e){switch(t){case 1:return Ll(uc.singleDigit,e);case 2:return Ll(uc.twoDigits,e);case 3:return Ll(uc.threeDigits,e);case 4:return Ll(uc.fourDigits,e);default:return Ll(new RegExp("^\\d{1,"+t+"}"),e)}}function pte(t,e){switch(t){case 1:return Ll(uc.singleDigitSigned,e);case 2:return Ll(uc.twoDigitsSigned,e);case 3:return Ll(uc.threeDigitsSigned,e);case 4:return Ll(uc.fourDigitsSigned,e);default:return Ll(new RegExp("^-?\\d{1,"+t+"}"),e)}}function axe(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 vOe(t,e){const n=e>0,s=n?e:1-e;let a;if(s<=50)a=t||100;else{const o=s+50,l=Math.trunc(o/100)*100,i=t>=o%100;a=t+l-(i?100:0)}return n?a:1-a}function _Oe(t){return t%400===0||t%4===0&&t%100!==0}class gdt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,a){const o=l=>({year:l,isTwoDigitYear:s==="yy"});switch(s){case"y":return hc(tc(4,n),o);case"yo":return hc(a.ordinalNumber(n,{unit:"year"}),o);default:return hc(tc(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a){const o=n.getFullYear();if(a.isTwoDigitYear){const i=vOe(a.year,o);return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}const l=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}}class xdt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,a){const o=l=>({year:l,isTwoDigitYear:s==="YY"});switch(s){case"Y":return hc(tc(4,n),o);case"Yo":return hc(a.ordinalNumber(n,{unit:"year"}),o);default:return hc(tc(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,o){const l=nxe(n,o);if(a.isTwoDigitYear){const h=vOe(a.year,l);return n.setFullYear(h,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),uf(n,o)}const i=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(i,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),uf(n,o)}}class ydt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return pte(s==="R"?4:s.length,n)}set(n,s,a){const o=ko(n,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),cy(o)}}class vdt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return pte(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class _dt extends ho{constructor(){super(...arguments);Gn(this,"priority",120);Gn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"Q":case"QQ":return tc(s.length,n);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})||a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class bdt extends ho{constructor(){super(...arguments);Gn(this,"priority",120);Gn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"q":case"qq":return tc(s.length,n);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})||a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class wdt extends ho{constructor(){super(...arguments);Gn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Gn(this,"priority",110)}parse(n,s,a){const o=l=>l-1;switch(s){case"M":return hc(Ll(uc.month,n),o);case"MM":return hc(tc(2,n),o);case"Mo":return hc(a.ordinalNumber(n,{unit:"month"}),o);case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})||a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}class jdt extends ho{constructor(){super(...arguments);Gn(this,"priority",110);Gn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,a){const o=l=>l-1;switch(s){case"L":return hc(Ll(uc.month,n),o);case"LL":return hc(tc(2,n),o);case"Lo":return hc(a.ordinalNumber(n,{unit:"month"}),o);case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})||a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}function kdt(t,e,n){const s=ws(t),a=sxe(s,n)-e;return s.setDate(s.getDate()-a*7),s}class Ndt extends ho{constructor(){super(...arguments);Gn(this,"priority",100);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return Ll(uc.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return tc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,o){return uf(kdt(n,a,o),o)}}function Sdt(t,e){const n=ws(t),s=rxe(n)-e;return n.setDate(n.getDate()-s*7),n}class Cdt extends ho{constructor(){super(...arguments);Gn(this,"priority",100);Gn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,a){switch(s){case"I":return Ll(uc.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return tc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return cy(Sdt(n,a))}}const Mdt=[31,28,31,30,31,30,31,31,30,31,30,31],Tdt=[31,29,31,30,31,30,31,31,30,31,30,31];class Adt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"subPriority",1);Gn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return Ll(uc.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return tc(s.length,n)}}validate(n,s){const a=n.getFullYear(),o=_Oe(a),l=n.getMonth();return o?s>=1&&s<=Tdt[l]:s>=1&&s<=Mdt[l]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class Edt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"subpriority",1);Gn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,a){switch(s){case"D":case"DD":return Ll(uc.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return tc(s.length,n)}}validate(n,s){const a=n.getFullYear();return _Oe(a)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,a){return n.setMonth(0,a),n.setHours(0,0,0,0),n}}function ixe(t,e,n){var y,_,j,C;const s=lv(),a=(n==null?void 0:n.weekStartsOn)??((_=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:_.weekStartsOn)??s.weekStartsOn??((C=(j=s.locale)==null?void 0:j.options)==null?void 0:C.weekStartsOn)??0,o=ws(t),l=o.getDay(),h=(e%7+7)%7,p=7-a,x=e<0||e>6?e-(l+p)%7:(h+p)%7-(l+p)%7;return Kl(o,x)}class Idt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=ixe(n,a,o),n.setHours(0,0,0,0),n}}class Pdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,a,o){const l=i=>{const h=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+h};switch(s){case"e":case"ee":return hc(tc(s.length,n),l);case"eo":return hc(a.ordinalNumber(n,{unit:"day"}),l);case"eee":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeeee":return a.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=ixe(n,a,o),n.setHours(0,0,0,0),n}}class Ldt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,a,o){const l=i=>{const h=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+h};switch(s){case"c":case"cc":return hc(tc(s.length,n),l);case"co":return hc(a.ordinalNumber(n,{unit:"day"}),l);case"ccc":return a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"ccccc":return a.day(n,{width:"narrow",context:"standalone"});case"cccccc":return a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(n,{width:"wide",context:"standalone"})||a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=ixe(n,a,o),n.setHours(0,0,0,0),n}}function Odt(t,e){const n=ws(t),s=idt(n),a=e-s;return Kl(n,a)}class Ddt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,a){const o=l=>l===0?7:l;switch(s){case"i":case"ii":return tc(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return hc(a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return hc(a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return hc(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return hc(a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,a){return n=Odt(n,a),n.setHours(0,0,0,0),n}}class Rdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,a){switch(s){case"a":case"aa":case"aaa":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(axe(a),0,0,0),n}}class Fdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,a){switch(s){case"b":case"bb":case"bbb":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(axe(a),0,0,0),n}}class zdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,a){switch(s){case"B":case"BB":case"BBB":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(axe(a),0,0,0),n}}class Bdt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return Ll(uc.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return tc(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,a){const o=n.getHours()>=12;return o&&a<12?n.setHours(a+12,0,0,0):!o&&a===12?n.setHours(0,0,0,0):n.setHours(a,0,0,0),n}}class $dt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return Ll(uc.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return tc(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class Udt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return Ll(uc.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return tc(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.getHours()>=12&&a<12?n.setHours(a+12,0,0,0):n.setHours(a,0,0,0),n}}class qdt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return Ll(uc.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return tc(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,a){const o=a<=24?a%24:a;return n.setHours(o,0,0,0),n}}class Vdt extends ho{constructor(){super(...arguments);Gn(this,"priority",60);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return Ll(uc.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return tc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class Hdt extends ho{constructor(){super(...arguments);Gn(this,"priority",50);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return Ll(uc.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return tc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class Wdt extends ho{constructor(){super(...arguments);Gn(this,"priority",30);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=o=>Math.trunc(o*Math.pow(10,-s.length+3));return hc(tc(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class Gdt extends ho{constructor(){super(...arguments);Gn(this,"priority",10);Gn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return cg(lg.basicOptionalMinutes,n);case"XX":return cg(lg.basic,n);case"XXXX":return cg(lg.basicOptionalSeconds,n);case"XXXXX":return cg(lg.extendedOptionalSeconds,n);case"XXX":default:return cg(lg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:ko(n,n.getTime()-V1(n)-a)}}class Kdt extends ho{constructor(){super(...arguments);Gn(this,"priority",10);Gn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return cg(lg.basicOptionalMinutes,n);case"xx":return cg(lg.basic,n);case"xxxx":return cg(lg.basicOptionalSeconds,n);case"xxxxx":return cg(lg.extendedOptionalSeconds,n);case"xxx":default:return cg(lg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:ko(n,n.getTime()-V1(n)-a)}}class Zdt extends ho{constructor(){super(...arguments);Gn(this,"priority",40);Gn(this,"incompatibleTokens","*")}parse(n){return yOe(n)}set(n,s,a){return[ko(n,a*1e3),{timestampIsSet:!0}]}}class Ydt extends ho{constructor(){super(...arguments);Gn(this,"priority",20);Gn(this,"incompatibleTokens","*")}parse(n){return yOe(n)}set(n,s,a){return[ko(n,a),{timestampIsSet:!0}]}}const Xdt={G:new mdt,y:new gdt,Y:new xdt,R:new ydt,u:new vdt,Q:new _dt,q:new bdt,M:new wdt,L:new jdt,w:new Ndt,I:new Cdt,d:new Adt,D:new Edt,E:new Idt,e:new Pdt,c:new Ldt,i:new Ddt,a:new Rdt,b:new Fdt,B:new zdt,h:new Bdt,H:new $dt,K:new Udt,k:new qdt,m:new Vdt,s:new Hdt,S:new Wdt,X:new Gdt,x:new Kdt,t:new Zdt,T:new Ydt},Qdt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Jdt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,eut=/^'([^]*?)'?$/,tut=/''/g,rut=/\S/,nut=/[a-zA-Z]/;function oxe(t,e,n,s){var N,A,E,T;const a=adt(),o=a.locale??hse,l=a.firstWeekContainsDate??((A=(N=a.locale)==null?void 0:N.options)==null?void 0:A.firstWeekContainsDate)??1,i=a.weekStartsOn??((T=(E=a.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(e==="")return t===""?ws(n):ko(n,NaN);const h={firstWeekContainsDate:l,weekStartsOn:i,locale:o},p=[new pdt],x=e.match(Jdt).map(P=>{const z=P[0];if(z in yhe){const F=yhe[z];return F(P,o.formatLong)}return P}).join("").match(Qdt),y=[];for(let P of x){gOe(P)&&vhe(P,e,t),mOe(P)&&vhe(P,e,t);const z=P[0],F=Xdt[z];if(F){const{incompatibleTokens:q}=F;if(Array.isArray(q)){const K=y.find(G=>q.includes(G.token)||G.token===z);if(K)throw new RangeError(`The format string mustn't contain \`${K.fullToken}\` and \`${P}\` at the same time`)}else if(F.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${P}\` and any other token at the same time`);y.push({token:z,fullToken:P});const V=F.run(t,P,o.match,h);if(!V)return ko(n,NaN);p.push(V.setter),t=V.rest}else{if(z.match(nut))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");if(P==="''"?P="'":z==="'"&&(P=sut(P)),t.indexOf(P)===0)t=t.slice(P.length);else return ko(n,NaN)}}if(t.length>0&&rut.test(t))return ko(n,NaN);const _=p.map(P=>P.priority).sort((P,z)=>z-P).filter((P,z,F)=>F.indexOf(P)===z).map(P=>p.filter(z=>z.priority===P).sort((z,F)=>F.subPriority-z.subPriority)).map(P=>P[0]);let j=ws(n);if(isNaN(j.getTime()))return ko(n,NaN);const C={};for(const P of _){if(!P.validate(j,h))return ko(n,NaN);const z=P.set(j,C,h);Array.isArray(z)?(j=z[0],Object.assign(C,z[1])):j=z}return ko(n,j)}function sut(t){return t.match(eut)[1].replace(tut,"'")}function aut(t){return+ws(t)o-l);return n>=s&&n<=a}function Hle(t,e){return Kl(t,-e)}function Wle(t,e){const n=ws(t),s=n.getFullYear(),a=n.getDate(),o=ko(t,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const l=sdt(o);return n.setMonth(e,Math.min(a,l)),n}function bOe(t,e){const n=ws(t);return n.setHours(e),n}function wOe(t,e){const n=ws(t);return n.setMinutes(e),n}function mte(t,e){const n=ws(t);return isNaN(+n)?ko(t,NaN):(n.setFullYear(e),n)}function out(t,e){return wh(t,-12)}const lut=()=>{const{user:t}=Xr(),e=Zn(),[n,s]=I.useState([]),[a,o]=I.useState(0),[l,i]=I.useState(!1),[h,p]=I.useState(null);I.useEffect(()=>{if(!t)return;const C=`notification_last_read_${t.id}`;let N=h;if(!N){const T=localStorage.getItem(C);T&&(N=T,p(T))}(async()=>{const{data:T,error:P}=await J.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!P&&T){s(T);const z=N?new Date(N):null,F=T.filter(q=>z?new Date(q.created_at)>z:!0);o(F.length)}})();const E=J.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const P=T.new;s(F=>[P,...F].slice(0,20));const z=N?new Date(N):null;(!z||new Date(P.created_at)>z)&&o(F=>F+1),Notification.permission==="granted"&&new Notification(P.title,{body:P.body,icon:"/favicon.ico"})}).subscribe();return()=>{J.removeChannel(E)}},[t,h]);const x=C=>{const N=C.toLowerCase();return N.includes("community")||N.includes("post")?Oo:N.includes("academy")||N.includes("video")?Pa:N.includes("template")?pd:N.includes("event")?Os:N.includes("newsletter")?Gx:N.includes("brokerage")?vh:N.includes("swag")||N.includes("social")?Ki:N.includes("toolbox")||N.includes("tool")?Zx:N.includes("brief")?Ms:Oo},y=C=>{i(!1),C.url&&C.url!=="/"&&e(C.url)},_=()=>{if(!t)return;const C=new Date().toISOString(),N=`notification_last_read_${t.id}`;localStorage.setItem(N,C),p(C),o(0)},j=C=>{i(C),C&&a>0&&_()};return r.jsxs(jh,{open:l,onOpenChange:j,children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(yg,{className:"h-5 w-5"}),a>0&&r.jsx(Ot,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:a>9?"9+":a})]})}),r.jsxs(Gu,{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(ee,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:_,children:"Mark all read"})]}),r.jsx(tl,{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 N=x(C.title);return r.jsxs(di,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(C),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(N,{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:uu(new Date(C.created_at),{addSuffix:!0})})]})]},C.id)})})]})]})};var ake=1,cut=.9,dut=.8,uut=.17,Gle=.1,Kle=.999,hut=.9999,fut=.99,put=/[\\\/_+.#"@\[\(\{&]/,mut=/[\\\/_+.#"@\[\(\{&]/g,gut=/[\s-]/,jOe=/[\s-]/g;function _he(t,e,n,s,a,o,l){if(o===e.length)return a===t.length?ake:fut;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var h=s.charAt(o),p=n.indexOf(h,a),x=0,y,_,j,C;p>=0;)y=_he(t,e,n,s,p+1,o+1,l),y>x&&(p===a?y*=ake:put.test(t.charAt(p-1))?(y*=dut,j=t.slice(a,p-1).match(mut),j&&a>0&&(y*=Math.pow(Kle,j.length))):gut.test(t.charAt(p-1))?(y*=cut,C=t.slice(a,p-1).match(jOe),C&&a>0&&(y*=Math.pow(Kle,C.length))):(y*=uut,a>0&&(y*=Math.pow(Kle,p-a))),t.charAt(p)!==e.charAt(o)&&(y*=hut)),(yy&&(y=_*Gle)),y>x&&(x=y),p=n.indexOf(h,p+1);return l[i]=x,x}function ike(t){return t.toLowerCase().replace(jOe," ")}function xut(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,_he(t,e,ike(t),ike(e),0,0,{})}var FM='[cmdk-group=""]',Zle='[cmdk-group-items=""]',yut='[cmdk-group-heading=""]',kOe='[cmdk-item=""]',oke=`${kOe}:not([aria-disabled="true"])`,bhe="cmdk-item-select",_4="data-value",vut=(t,e,n)=>xut(t,e,n),NOe=I.createContext(void 0),MI=()=>I.useContext(NOe),SOe=I.createContext(void 0),cxe=()=>I.useContext(SOe),COe=I.createContext(void 0),MOe=I.forwardRef((t,e)=>{let n=b4(()=>{var Se,ge;return{search:"",value:(ge=(Se=t.value)!=null?Se:t.defaultValue)!=null?ge:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=b4(()=>new Set),a=b4(()=>new Map),o=b4(()=>new Map),l=b4(()=>new Set),i=TOe(t),{label:h,children:p,value:x,onValueChange:y,filter:_,shouldFilter:j,loop:C,disablePointerSelection:N=!1,vimBindings:A=!0,...E}=t,T=Kc(),P=Kc(),z=Kc(),F=I.useRef(null),q=Aut();Hj(()=>{if(x!==void 0){let Se=x.trim();n.current.value=Se,V.emit()}},[x]),Hj(()=>{q(6,ye)},[]);let V=I.useMemo(()=>({subscribe:Se=>(l.current.add(Se),()=>l.current.delete(Se)),snapshot:()=>n.current,setState:(Se,ge,Le)=>{var ke,Be,Ee,Ue;if(!Object.is(n.current[Se],ge)){if(n.current[Se]=ge,Se==="search")oe(),te(),q(1,ie);else if(Se==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Fe=document.getElementById(z);Fe?Fe.focus():(ke=document.getElementById(T))==null||ke.focus()}if(q(7,()=>{var Fe;n.current.selectedItemId=(Fe=ae())==null?void 0:Fe.id,V.emit()}),Le||q(5,ye),((Be=i.current)==null?void 0:Be.value)!==void 0){let Fe=ge??"";(Ue=(Ee=i.current).onValueChange)==null||Ue.call(Ee,Fe);return}}V.emit()}},emit:()=>{l.current.forEach(Se=>Se())}}),[]),K=I.useMemo(()=>({value:(Se,ge,Le)=>{var ke;ge!==((ke=o.current.get(Se))==null?void 0:ke.value)&&(o.current.set(Se,{value:ge,keywords:Le}),n.current.filtered.items.set(Se,G(ge,Le)),q(2,()=>{te(),V.emit()}))},item:(Se,ge)=>(s.current.add(Se),ge&&(a.current.has(ge)?a.current.get(ge).add(Se):a.current.set(ge,new Set([Se]))),q(3,()=>{oe(),te(),n.current.value||ie(),V.emit()}),()=>{o.current.delete(Se),s.current.delete(Se),n.current.filtered.items.delete(Se);let Le=ae();q(4,()=>{oe(),(Le==null?void 0:Le.getAttribute("id"))===Se&&ie(),V.emit()})}),group:Se=>(a.current.has(Se)||a.current.set(Se,new Set),()=>{o.current.delete(Se),a.current.delete(Se)}),filter:()=>i.current.shouldFilter,label:h||t["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:z,labelId:P,listInnerRef:F}),[]);function G(Se,ge){var Le,ke;let Be=(ke=(Le=i.current)==null?void 0:Le.filter)!=null?ke:vut;return Se?Be(Se,n.current.search,ge):0}function te(){if(!n.current.search||i.current.shouldFilter===!1)return;let Se=n.current.filtered.items,ge=[];n.current.filtered.groups.forEach(ke=>{let Be=a.current.get(ke),Ee=0;Be.forEach(Ue=>{let Fe=Se.get(Ue);Ee=Math.max(Fe,Ee)}),ge.push([ke,Ee])});let Le=F.current;pe().sort((ke,Be)=>{var Ee,Ue;let Fe=ke.getAttribute("id"),be=Be.getAttribute("id");return((Ee=Se.get(be))!=null?Ee:0)-((Ue=Se.get(Fe))!=null?Ue:0)}).forEach(ke=>{let Be=ke.closest(Zle);Be?Be.appendChild(ke.parentElement===Be?ke:ke.closest(`${Zle} > *`)):Le.appendChild(ke.parentElement===Le?ke:ke.closest(`${Zle} > *`))}),ge.sort((ke,Be)=>Be[1]-ke[1]).forEach(ke=>{var Be;let Ee=(Be=F.current)==null?void 0:Be.querySelector(`${FM}[${_4}="${encodeURIComponent(ke[0])}"]`);Ee==null||Ee.parentElement.appendChild(Ee)})}function ie(){let Se=pe().find(Le=>Le.getAttribute("aria-disabled")!=="true"),ge=Se==null?void 0:Se.getAttribute(_4);V.setState("value",ge||void 0)}function oe(){var Se,ge,Le,ke;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Be=0;for(let Ee of s.current){let Ue=(ge=(Se=o.current.get(Ee))==null?void 0:Se.value)!=null?ge:"",Fe=(ke=(Le=o.current.get(Ee))==null?void 0:Le.keywords)!=null?ke:[],be=G(Ue,Fe);n.current.filtered.items.set(Ee,be),be>0&&Be++}for(let[Ee,Ue]of a.current)for(let Fe of Ue)if(n.current.filtered.items.get(Fe)>0){n.current.filtered.groups.add(Ee);break}n.current.filtered.count=Be}function ye(){var Se,ge,Le;let ke=ae();ke&&(((Se=ke.parentElement)==null?void 0:Se.firstChild)===ke&&((Le=(ge=ke.closest(FM))==null?void 0:ge.querySelector(yut))==null||Le.scrollIntoView({block:"nearest"})),ke.scrollIntoView({block:"nearest"}))}function ae(){var Se;return(Se=F.current)==null?void 0:Se.querySelector(`${kOe}[aria-selected="true"]`)}function pe(){var Se;return Array.from(((Se=F.current)==null?void 0:Se.querySelectorAll(oke))||[])}function se(Se){let ge=pe()[Se];ge&&V.setState("value",ge.getAttribute(_4))}function he(Se){var ge;let Le=ae(),ke=pe(),Be=ke.findIndex(Ue=>Ue===Le),Ee=ke[Be+Se];(ge=i.current)!=null&&ge.loop&&(Ee=Be+Se<0?ke[ke.length-1]:Be+Se===ke.length?ke[0]:ke[Be+Se]),Ee&&V.setState("value",Ee.getAttribute(_4))}function ue(Se){let ge=ae(),Le=ge==null?void 0:ge.closest(FM),ke;for(;Le&&!ke;)Le=Se>0?Mut(Le,FM):Tut(Le,FM),ke=Le==null?void 0:Le.querySelector(oke);ke?V.setState("value",ke.getAttribute(_4)):he(Se)}let _e=()=>se(pe().length-1),Ae=Se=>{Se.preventDefault(),Se.metaKey?_e():Se.altKey?ue(1):he(1)},Ce=Se=>{Se.preventDefault(),Se.metaKey?se(0):Se.altKey?ue(-1):he(-1)};return I.createElement(Rn.div,{ref:e,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:Se=>{var ge;(ge=E.onKeyDown)==null||ge.call(E,Se);let Le=Se.nativeEvent.isComposing||Se.keyCode===229;if(!(Se.defaultPrevented||Le))switch(Se.key){case"n":case"j":{A&&Se.ctrlKey&&Ae(Se);break}case"ArrowDown":{Ae(Se);break}case"p":case"k":{A&&Se.ctrlKey&&Ce(Se);break}case"ArrowUp":{Ce(Se);break}case"Home":{Se.preventDefault(),se(0);break}case"End":{Se.preventDefault(),_e();break}case"Enter":{Se.preventDefault();let ke=ae();if(ke){let Be=new Event(bhe);ke.dispatchEvent(Be)}}}}},I.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:Iut},h),pse(t,Se=>I.createElement(SOe.Provider,{value:V},I.createElement(NOe.Provider,{value:K},Se))))}),_ut=I.forwardRef((t,e)=>{var n,s;let a=Kc(),o=I.useRef(null),l=I.useContext(COe),i=MI(),h=TOe(t),p=(s=(n=h.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;Hj(()=>{if(!p)return i.item(a,l==null?void 0:l.id)},[p]);let x=AOe(a,o,[t.value,t.children,o],t.keywords),y=cxe(),_=H1(q=>q.value&&q.value===x.current),j=H1(q=>p||i.filter()===!1?!0:q.search?q.filtered.items.get(a)>0:!0);I.useEffect(()=>{let q=o.current;if(!(!q||t.disabled))return q.addEventListener(bhe,C),()=>q.removeEventListener(bhe,C)},[j,t.onSelect,t.disabled]);function C(){var q,V;N(),(V=(q=h.current).onSelect)==null||V.call(q,x.current)}function N(){y.setState("value",x.current,!0)}if(!j)return null;let{disabled:A,value:E,onSelect:T,forceMount:P,keywords:z,...F}=t;return I.createElement(Rn.div,{ref:iy(o,e),...F,id:a,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!_,"data-disabled":!!A,"data-selected":!!_,onPointerMove:A||i.getDisablePointerSelection()?void 0:N,onClick:A?void 0:C},t.children)}),but=I.forwardRef((t,e)=>{let{heading:n,children:s,forceMount:a,...o}=t,l=Kc(),i=I.useRef(null),h=I.useRef(null),p=Kc(),x=MI(),y=H1(j=>a||x.filter()===!1?!0:j.search?j.filtered.groups.has(l):!0);Hj(()=>x.group(l),[]),AOe(l,i,[t.value,t.heading,h]);let _=I.useMemo(()=>({id:l,forceMount:a}),[a]);return I.createElement(Rn.div,{ref:iy(i,e),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&I.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:p},n),pse(t,j=>I.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?p:void 0},I.createElement(COe.Provider,{value:_},j))))}),wut=I.forwardRef((t,e)=>{let{alwaysRender:n,...s}=t,a=I.useRef(null),o=H1(l=>!l.search);return!n&&!o?null:I.createElement(Rn.div,{ref:iy(a,e),...s,"cmdk-separator":"",role:"separator"})}),jut=I.forwardRef((t,e)=>{let{onValueChange:n,...s}=t,a=t.value!=null,o=cxe(),l=H1(p=>p.search),i=H1(p=>p.selectedItemId),h=MI();return I.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),I.createElement(Rn.input,{ref:e,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":i,id:h.inputId,type:"text",value:a?t.value:l,onChange:p=>{a||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),kut=I.forwardRef((t,e)=>{let{children:n,label:s="Suggestions",...a}=t,o=I.useRef(null),l=I.useRef(null),i=H1(p=>p.selectedItemId),h=MI();return I.useEffect(()=>{if(l.current&&o.current){let p=l.current,x=o.current,y,_=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let j=p.offsetHeight;x.style.setProperty("--cmdk-list-height",j.toFixed(1)+"px")})});return _.observe(p),()=>{cancelAnimationFrame(y),_.unobserve(p)}}},[]),I.createElement(Rn.div,{ref:iy(o,e),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:h.listId},pse(t,p=>I.createElement("div",{ref:iy(l,h.listInnerRef),"cmdk-list-sizer":""},p)))}),Nut=I.forwardRef((t,e)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:o,container:l,...i}=t;return I.createElement(qne,{open:n,onOpenChange:s},I.createElement(Vne,{container:l},I.createElement(l3,{"cmdk-overlay":"",className:a}),I.createElement(c3,{"aria-label":t.label,"cmdk-dialog":"",className:o},I.createElement(MOe,{ref:e,...i}))))}),Sut=I.forwardRef((t,e)=>H1(n=>n.filtered.count===0)?I.createElement(Rn.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Cut=I.forwardRef((t,e)=>{let{progress:n,children:s,label:a="Loading...",...o}=t;return I.createElement(Rn.div,{ref:e,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},pse(t,l=>I.createElement("div",{"aria-hidden":!0},l)))}),Nh=Object.assign(MOe,{List:kut,Item:_ut,Input:jut,Group:but,Separator:wut,Dialog:Nut,Empty:Sut,Loading:Cut});function Mut(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Tut(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function TOe(t){let e=I.useRef(t);return Hj(()=>{e.current=t}),e}var Hj=typeof window>"u"?I.useEffect:I.useLayoutEffect;function b4(t){let e=I.useRef();return e.current===void 0&&(e.current=t()),e}function H1(t){let e=cxe(),n=()=>t(e.snapshot());return I.useSyncExternalStore(e.subscribe,n,n)}function AOe(t,e,n,s=[]){let a=I.useRef(),o=MI();return Hj(()=>{var l;let i=(()=>{var p;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(p=x.current.textContent)==null?void 0:p.trim():a.current}})(),h=s.map(p=>p.trim());o.value(t,i,h),(l=e.current)==null||l.setAttribute(_4,i),a.current=i}),a}var Aut=()=>{let[t,e]=I.useState(),n=b4(()=>new Map);return Hj(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,a)=>{n.current.set(s,a),e({})}};function Eut(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function pse({asChild:t,children:e},n){return t&&I.isValidElement(e)?I.cloneElement(Eut(e),{ref:e.ref},n(e.props.children)):n(e)}var Iut={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const W1=I.forwardRef(({className:t,...e},n)=>r.jsx(Nh,{ref:n,className:zt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));W1.displayName=Nh.displayName;const Put=({children:t,...e})=>r.jsx(Fr,{...e,children:r.jsx(Rr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(W1,{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})})}),G1=I.forwardRef(({className:t,...e},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(wa,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Nh.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})]}));G1.displayName=Nh.Input.displayName;const K1=I.forwardRef(({className:t,...e},n)=>r.jsx(Nh.List,{ref:n,className:zt("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));K1.displayName=Nh.List.displayName;const Z1=I.forwardRef((t,e)=>r.jsx(Nh.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Z1.displayName=Nh.Empty.displayName;const Y1=I.forwardRef(({className:t,...e},n)=>r.jsx(Nh.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}));Y1.displayName=Nh.Group.displayName;const Lut=I.forwardRef(({className:t,...e},n)=>r.jsx(Nh.Separator,{ref:n,className:zt("-mx-1 h-px bg-border",t),...e}));Lut.displayName=Nh.Separator.displayName;const X1=I.forwardRef(({className:t,...e},n)=>r.jsx(Nh.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}));X1.displayName=Nh.Item.displayName;const Out={event:{label:"Events",icon:mm,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:pd,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:_1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:Zx,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Ms,color:"bg-fuchsia-500/10 text-fuchsia-600"}},lke=()=>{const[t,e]=I.useState(!1),[n,s]=I.useState(""),[a,o]=I.useState([]),[l,i]=I.useState(!1),h=Zn();I.useEffect(()=>{const _=j=>{j.key==="k"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),e(C=>!C))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[]);const p=I.useCallback(async _=>{if(!_.trim()){o([]);return}i(!0);const j=`%${_}%`;try{const[C,N,A,E,T]=await Promise.all([J.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),J.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${j},description.ilike.${j}`).limit(5),J.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),J.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${j},description.ilike.${j}`).limit(5),J.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5)]),P=[];C.data&&C.data.forEach(z=>{P.push({id:z.id,title:z.title,description:z.description,type:"event",date:z.event_date,path:`/event/${z.id}`})}),N.data&&N.data.forEach(z=>{P.push({id:z.id,title:z.name,description:z.description,type:"template",date:z.publish_date,path:`/templates/${z.id}`})}),A.data&&A.data.forEach(z=>{P.push({id:z.id,title:z.title,description:z.description,type:"academy",date:z.publish_date,path:`/academy/${z.id}`})}),E.data&&E.data.forEach(z=>{P.push({id:z.id,title:z.name,description:z.description,type:"toolbox",date:z.publish_date,path:`/toolbox/${z.id}`})}),T.data&&T.data.forEach(z=>{P.push({id:z.id,title:z.title,description:z.description,type:"social-swag",date:z.publish_date,path:`/social-swag/${z.id}`})}),o(P)}catch(C){console.error("Search error:",C)}finally{i(!1)}},[]);I.useEffect(()=>{const _=setTimeout(()=>{p(n)},300);return()=>clearTimeout(_)},[n,p]);const x=_=>{e(!1),s(""),h(_)},y=a.reduce((_,j)=>(_[j.type]||(_[j.type]=[]),_[j.type].push(j),_),{});return r.jsxs(r.Fragment,{children:[r.jsxs(ee,{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(wa,{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(Put,{open:t,onOpenChange:e,children:[r.jsx(G1,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(K1,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&a.length===0&&r.jsxs(Z1,{children:['No results found for "',n,'"']}),!l&&!n&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search across all content..."}),Object.entries(y).map(([_,j])=>{const C=Out[_],N=C.icon;return r.jsx(Y1,{heading:C.label,children:j.map(A=>r.jsxs(X1,{value:`${A.type}-${A.id}-${A.title}`,onSelect:()=>x(A.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(N,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:A.title}),A.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:A.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Ot,{variant:"secondary",className:"text-xs",children:C.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:uu(new Date(A.date),{addSuffix:!0})})]})]},`${A.type}-${A.id}`))},_)})]})]})]})},Dut=({expiresAt:t,className:e,showUpgradeButton:n=!0})=>{const[s,a]=I.useState(null),o=Zn();if(I.useEffect(()=>{const p=()=>{const y=new Date().getTime(),j=new Date(t).getTime()-y;if(j<=0){a({days:0,hours:0,minutes:0});return}const C=Math.floor(j/(1e3*60*60*24)),N=Math.floor(j%(1e3*60*60*24)/(1e3*60*60)),A=Math.floor(j%(1e3*60*60)/(1e3*60));a({days:C,hours:N,minutes:A})};p();const x=setInterval(p,6e4);return()=>clearInterval(x)},[t]),!s)return null;const l=s.days===0&&s.hours===0&&s.minutes===0,i=s.days<=1,h=s.days<=3&&!i;return l?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(Hh,{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(ee,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Ms,{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",i?"bg-destructive/10 border-destructive/20":h?"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(Ya,{className:zt("h-4 w-4",i?"text-destructive":h?"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",i?"text-destructive":h?"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",i?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:zt("text-sm font-bold",i?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:zt("text-sm font-bold",i?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:zt("text-xs",i?"text-destructive/70":h?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(ee,{size:"sm",onClick:()=>o("/subscription"),variant:i?"destructive":h?"default":"outline",className:zt("text-xs h-7 px-3",h&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Rut=()=>{const t=Zn();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(Gt,{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(Hh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Zt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(Tn,{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(Bn,{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(ee,{className:"w-full",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(Ms,{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(ai,{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(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(ai,{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(bi,{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(ua,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Fut=({hasUnseenBrief:t,onClick:e,className:n})=>r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",onClick:e,className:zt("relative transition-colors",t&&"text-primary hover:text-primary",n),children:[r.jsx(ym,{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(vm,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var mse="Checkbox",[zut]=rc(mse),[But,dxe]=zut(mse);function $ut(t){const{__scopeCheckbox:e,checked:n,children:s,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:h,required:p,value:x="on",internal_do_not_use_render:y}=t,[_,j]=$u({prop:n,defaultProp:a??!1,onChange:h,caller:mse}),[C,N]=I.useState(null),[A,E]=I.useState(null),T=I.useRef(!1),P=C?!!l||!!C.closest("form"):!0,z={checked:_,disabled:o,setChecked:j,control:C,setControl:N,name:i,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:p,defaultChecked:A1(a)?!1:a,isFormControl:P,bubbleInput:A,setBubbleInput:E};return r.jsx(But,{scope:e,...z,children:Uut(y)?y(z):s})}var EOe="CheckboxTrigger",IOe=I.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...s},a)=>{const{control:o,value:l,disabled:i,checked:h,required:p,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:_,isFormControl:j,bubbleInput:C}=dxe(EOe,t),N=ta(a,x),A=I.useRef(h);return I.useEffect(()=>{const E=o==null?void 0:o.form;if(E){const T=()=>y(A.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[o,y]),r.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":A1(h)?"mixed":h,"aria-required":p,"data-state":ROe(h),"data-disabled":i?"":void 0,disabled:i,value:l,...s,ref:N,onKeyDown:on(e,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:on(n,E=>{y(T=>A1(T)?!0:!T),C&&j&&(_.current=E.isPropagationStopped(),_.current||E.stopPropagation())})})});IOe.displayName=EOe;var uxe=I.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:h,onCheckedChange:p,form:x,...y}=t;return r.jsx($ut,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:p,name:s,form:x,value:h,internal_do_not_use_render:({isFormControl:_})=>r.jsxs(r.Fragment,{children:[r.jsx(IOe,{...y,ref:e,__scopeCheckbox:n}),_&&r.jsx(DOe,{__scopeCheckbox:n})]})})});uxe.displayName=mse;var POe="CheckboxIndicator",LOe=I.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:s,...a}=t,o=dxe(POe,n);return r.jsx(xc,{present:s||A1(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{"data-state":ROe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:e,style:{pointerEvents:"none",...t.style}})})});LOe.displayName=POe;var OOe="CheckboxBubbleInput",DOe=I.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:h,name:p,value:x,form:y,bubbleInput:_,setBubbleInput:j}=dxe(OOe,t),C=ta(n,j),N=NI(o),A=hI(s);I.useEffect(()=>{const T=_;if(!T)return;const P=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(P,"checked").set,q=!a.current;if(N!==o&&F){const V=new Event("click",{bubbles:q});T.indeterminate=A1(o),F.call(T,A1(o)?!1:o),T.dispatchEvent(V)}},[_,N,o,a]);const E=I.useRef(A1(o)?!1:o);return r.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??E.current,required:i,disabled:h,name:p,value:x,form:y,...e,tabIndex:-1,ref:C,style:{...e.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});DOe.displayName=OOe;function Uut(t){return typeof t=="function"}function A1(t){return t==="indeterminate"}function ROe(t){return A1(t)?"indeterminate":t?"checked":"unchecked"}const Dl=I.forwardRef(({className:t,...e},n)=>r.jsx(uxe,{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(LOe,{className:zt("flex items-center justify-center text-current"),children:r.jsx(Ai,{className:"h-4 w-4"})})}));Dl.displayName=uxe.displayName;var hxe="Radio",[qut,FOe]=rc(hxe),[Vut,Hut]=qut(hxe),zOe=I.forwardRef((t,e)=>{const{__scopeRadio:n,name:s,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:h,form:p,...x}=t,[y,_]=I.useState(null),j=ta(e,A=>_(A)),C=I.useRef(!1),N=y?p||!!y.closest("form"):!0;return r.jsxs(Vut,{scope:n,checked:a,disabled:l,children:[r.jsx(Rn.button,{type:"button",role:"radio","aria-checked":a,"data-state":qOe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:j,onClick:on(t.onClick,A=>{a||h==null||h(),N&&(C.current=A.isPropagationStopped(),C.current||A.stopPropagation())})}),N&&r.jsx(UOe,{control:y,bubbles:!C.current,name:s,value:i,checked:a,required:o,disabled:l,form:p,style:{transform:"translateX(-100%)"}})]})});zOe.displayName=hxe;var BOe="RadioIndicator",$Oe=I.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:s,...a}=t,o=Hut(BOe,n);return r.jsx(xc,{present:s||o.checked,children:r.jsx(Rn.span,{"data-state":qOe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:e})})});$Oe.displayName=BOe;var Wut="RadioBubbleInput",UOe=I.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:s=!0,...a},o)=>{const l=I.useRef(null),i=ta(l,o),h=NI(n),p=hI(e);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const C=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(C)}},[h,n,s]),r.jsx(Rn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});UOe.displayName=Wut;function qOe(t){return t?"checked":"unchecked"}var Gut=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gse="RadioGroup",[Kut]=rc(gse,[o3,FOe]),VOe=o3(),HOe=FOe(),[Zut,Yut]=Kut(gse),WOe=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:s,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:h,dir:p,loop:x=!0,onValueChange:y,..._}=t,j=VOe(n),C=ok(p),[N,A]=$u({prop:o,defaultProp:a??null,onChange:y,caller:gse});return r.jsx(Zut,{scope:n,name:s,required:l,disabled:i,value:N,onValueChange:A,children:r.jsx(vge,{asChild:!0,...j,orientation:h,dir:C,loop:x,children:r.jsx(Rn.div,{role:"radiogroup","aria-required":l,"aria-orientation":h,"data-disabled":i?"":void 0,dir:C,..._,ref:e})})})});WOe.displayName=gse;var GOe="RadioGroupItem",KOe=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:s,...a}=t,o=Yut(GOe,n),l=o.disabled||s,i=VOe(n),h=HOe(n),p=I.useRef(null),x=ta(e,p),y=o.value===a.value,_=I.useRef(!1);return I.useEffect(()=>{const j=N=>{Gut.includes(N.key)&&(_.current=!0)},C=()=>_.current=!1;return document.addEventListener("keydown",j),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",j),document.removeEventListener("keyup",C)}},[]),r.jsx(_ge,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(zOe,{disabled:l,required:o.required,checked:y,...h,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:on(j=>{j.key==="Enter"&&j.preventDefault()}),onFocus:on(a.onFocus,()=>{var j;_.current&&((j=p.current)==null||j.click())})})})});KOe.displayName=GOe;var Xut="RadioGroupIndicator",ZOe=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...s}=t,a=HOe(n);return r.jsx($Oe,{...a,...s,ref:e})});ZOe.displayName=Xut;var YOe=WOe,XOe=KOe,Qut=ZOe;const QOe=I.forwardRef(({className:t,...e},n)=>r.jsx(YOe,{className:zt("grid gap-2",t),...e,ref:n}));QOe.displayName=YOe.displayName;const JOe=I.forwardRef(({className:t,...e},n)=>r.jsx(XOe,{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(Qut,{className:"flex items-center justify-center",children:r.jsx(Bu,{className:"h-2.5 w-2.5 fill-current text-current"})})}));JOe.displayName=XOe.displayName;const Jut=({brief:t,open:e,onClose:n,onDismiss:s})=>{const{user:a}=Xr(),[o,l]=I.useState({}),[i,h]=I.useState({}),[p,x]=I.useState([]);I.useEffect(()=>{e&&a&&t.polls.length>0&&y()},[e,a,t.polls]);const y=async()=>{if(!a)return;const A=t.polls.map(T=>T.id),{data:E}=await J.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",A);if(E){const T={};E.forEach(P=>{T[P.poll_id]||(T[P.poll_id]=[]),T[P.poll_id].push(P.option_id)}),h(T)}},_=(A,E)=>{l(T=>({...T,[A]:E}))},j=(A,E,T)=>{l(P=>{const z=P[A]||[];return T?{...P,[A]:[...z,E]}:{...P,[A]:z.filter(F=>F!==E)}})},C=async A=>{if(!a)return;const E=o[A];if(!E||Array.isArray(E)&&E.length===0){ze.error("Please select an option");return}x(T=>[...T,A]);try{await J.from("levelup_brief_poll_responses").delete().eq("poll_id",A).eq("user_id",a.id);const T=Array.isArray(E)?E:[E],P=T.map(F=>({poll_id:A,option_id:F,user_id:a.id})),{error:z}=await J.from("levelup_brief_poll_responses").insert(P);if(z)throw z;h(F=>({...F,[A]:T})),ze.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),ze.error("Failed to submit response")}finally{x(T=>T.filter(P=>P!==A))}},N=A=>(A.includes("mediadelivery.net")||A.includes("bunny"),A);return r.jsx(Fr,{open:e,onOpenChange:A=>!A&&n(),children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden [&>button]:hidden",children:[r.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 pr-12 text-primary-foreground relative",children:[r.jsx("button",{onClick:n,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/30 hover:bg-white/50 transition-colors","aria-label":"Close",children:r.jsx(_s,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:r.jsx(ym,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Ot,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx($r,{className:"text-xl font-bold text-white",children:t.brief.title})]})]})]}),r.jsx(tl,{className:"max-h-[calc(90vh-240px)]",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:N(t.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),t.brief.graphic_url&&!t.brief.video_url&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted",children:t.brief.graphic_link_url?r.jsx("a",{href:t.brief.graphic_link_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:r.jsx("img",{src:t.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain cursor-pointer hover:opacity-90 transition-opacity"})}):r.jsx("img",{src:t.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain"})}),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(A=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>window.open(A.url,"_blank"),className:"gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),A.title]},A.id))})]}),t.polls.map(A=>{var P,z;const E=((P=i[A.id])==null?void 0:P.length)>0,T=p.includes(A.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:A.question}),E&&r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),"Responded"]})]}),A.poll_type==="single"?r.jsx(QOe,{value:o[A.id]||((z=i[A.id])==null?void 0:z[0])||"",onValueChange:F=>_(A.id,F),className:"space-y-2",children:A.options.map(F=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(JOe,{value:F.id,id:F.id}),r.jsx(He,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id))}):r.jsx("div",{className:"space-y-2",children:A.options.map(F=>{const V=(o[A.id]||i[A.id]||[]).includes(F.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Dl,{id:F.id,checked:V,onCheckedChange:K=>j(A.id,F.id,K)}),r.jsx(He,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id)})}),r.jsx(ee,{size:"sm",onClick:()=>C(A.id),disabled:T,children:T?"Submitting...":E?"Update Response":"Submit"})]},A.id)})]})}),r.jsxs("div",{className:"p-4 pb-[calc(1rem+env(safe-area-inset-bottom))] border-t bg-muted/30 flex flex-col items-center gap-2 sticky bottom-0 z-10",children:[r.jsx(ee,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},eht=()=>{const{user:t}=Xr(),[e,n]=I.useState(null),[s,a]=I.useState(!1),[o,l]=I.useState(!0),[i,h]=I.useState(!1),p=I.useCallback(async()=>{if(!t){l(!1);return}try{const{data:C,error:N}=await J.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(N||!C){l(!1);return}const{data:A}=await J.from("levelup_brief_views").select("*").eq("brief_id",C.id).eq("user_id",t.id).maybeSingle(),[E,T]=await Promise.all([J.from("levelup_brief_links").select("*").eq("brief_id",C.id).order("sort_order"),J.from("levelup_brief_polls").select("*").eq("brief_id",C.id).order("sort_order")]),P=[];if(T.data)for(const V of T.data){const{data:K}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",V.id).order("sort_order");P.push({...V,options:K||[]})}const z={brief:C,links:E.data||[],polls:P};n(z);const F=!!A,q=(A==null?void 0:A.dismissed_at)!==null;if(!F)a(!0),h(!0);else if(C.show_frequency==="every_login"&&!q)a(!0),h(!0);else if(C.show_frequency==="daily"){const V=new Date(A.viewed_at);(new Date().getTime()-V.getTime())/(1e3*60*60)>=24&&!q&&(a(!0),h(!0))}else h(!q)}catch(C){console.error("Error fetching brief:",C)}finally{l(!1)}},[t]);I.useEffect(()=>{p()},[p]);const x=async()=>{if(!(!t||!e))try{const{data:C}=await J.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await J.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",C.id):await J.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:i,loading:o,openBrief:()=>{a(!0)},closeBrief:()=>{a(!1),x()},dismissBrief:async()=>{if(!(!t||!e))try{const{data:C}=await J.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await J.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",C.id):await J.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id,dismissed_at:new Date().toISOString()}),a(!1),h(!1)}catch(C){console.error("Error dismissing brief:",C)}},refetch:p}};function tht(){const[t,e]=I.useState(!1),[n,s]=I.useState(!1),[a,o]=I.useState(null);I.useEffect(()=>{if(localStorage.getItem("install-banner-dismissed")||window.matchMedia("(display-mode: standalone)").matches||!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent))return;const y=/iPhone|iPad|iPod/i.test(navigator.userAgent);s(y),e(!0);const _=j=>{j.preventDefault(),o(j)};return window.addEventListener("beforeinstallprompt",_),()=>{window.removeEventListener("beforeinstallprompt",_)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),e(!1)},i=async()=>{if(a){await a.prompt();const{outcome:h}=await a.userChoice;h==="accepted"&&l(),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(no,{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(ZT,{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&&a&&r.jsx(ee,{size:"sm",variant:"secondary",onClick:i,className:"text-xs",children:"Install"}),r.jsx("button",{onClick:l,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(_s,{className:"h-4 w-4"})})]})]})}):null}const rht=({children:t,onRefresh:e})=>{const[n,s]=I.useState(!1),[a,o]=I.useState(0),[l,i]=I.useState(!1),h=I.useRef(null),p=I.useRef(0),x=Vr(),y=80,_=120,j=I.useCallback(T=>{const P=h.current;P&&P.scrollTop<=0&&(p.current=T.touches[0].clientY,s(!0))},[]),C=I.useCallback(T=>{if(!n||l)return;const P=h.current;if(!P||P.scrollTop>0){s(!1),o(0);return}const F=T.touches[0].clientY-p.current;if(F>0){const V=Math.min(F*.5,_);o(V),V>10&&T.preventDefault()}},[n,l]),N=I.useCallback(async()=>{if(n)if(s(!1),a>=y&&!l){i(!0),o(y);try{e?await e():await x.invalidateQueries()}catch(T){console.error("Refresh failed:",T)}finally{i(!1),o(0)}}else o(0)},[n,a,l,e,x]),A=Math.min(a/y,1),E=A*180;return r.jsxs("div",{ref:h,className:"h-full overflow-auto",onTouchStart:j,onTouchMove:C,onTouchEnd:N,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:a>0?a:0,opacity:A},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${E}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(Gl,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:a>0?`translateY(${Math.max(0,a-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:t})]})},e8e=()=>{const{user:t}=Xr(),[e,n]=I.useState(!1),[s,a]=I.useState(!1),[o,l]=I.useState(0),[i,h]=I.useState(!0);I.useEffect(()=>{(async()=>{if(!t){h(!1);return}try{const{data:j}=await J.from("membership_reviews").select("id").eq("user_id",t.id).maybeSingle();if(j){a(!0),n(!1),h(!1);return}const{data:C}=await J.from("profiles").select("login_count").eq("id",t.id).single(),N=(C==null?void 0:C.login_count)||0;l(N);const A=sessionStorage.getItem("review-prompt-dismissed");n(N>=4&&!A)}catch(j){console.error("Error checking review eligibility:",j)}finally{h(!1)}})()},[t]);const p=I.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=I.useCallback(async(_,j)=>{if(!t)return{success:!1,error:"Not authenticated"};try{const{error:C}=await J.from("membership_reviews").insert({user_id:t.id,rating:_,review_text:j});if(C)throw C;return a(!0),n(!1),{success:!0,pointsAwarded:25}}catch(C){return console.error("Error submitting review:",C),{success:!1,error:C.message}}},[t]),y=I.useCallback(async()=>{if(t)try{await J.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",t.id)}catch(_){console.error("Error updating Google review status:",_)}},[t]);return{shouldShowPrompt:e,hasSubmittedReview:s,loginCount:o,isLoading:i,dismissPrompt:p,submitReview:x,markPostedToGoogle:y}},nht="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",sht=()=>{const{shouldShowPrompt:t,isLoading:e,dismissPrompt:n,submitReview:s,markPostedToGoogle:a}=e8e(),[o,l]=I.useState(!1),[i,h]=I.useState("review"),[p,x]=I.useState(0),[y,_]=I.useState(0),[j,C]=I.useState(""),[N,A]=I.useState(!1),[E,T]=I.useState(!1);if(e||!t&&!E)return null;const P=async()=>{if(p===0){ma({title:"Please select a rating",variant:"destructive"});return}A(!0);const q=await s(p,j);A(!1),q.success?(T(!0),ma({title:"Thank you for your feedback!",description:"Your review helps us improve."}),h("google")):ma({title:"Error submitting review",description:q.error,variant:"destructive"})},z=async q=>{q&&(await navigator.clipboard.writeText(j||`${p} star rating for LevelUp!`),ma({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(nht,"_blank")),l(!1),n()},F=()=>{l(!1),n()};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>l(!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(vs,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Fr,{open:o,onOpenChange:F,children:r.jsx(Rr,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Qn,{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:()=>x(q),onMouseEnter:()=>_(q),onMouseLeave:()=>_(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(vs,{className:zt("h-8 w-8 transition-colors",(y||p)>=q?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},q))}),r.jsx(ps,{placeholder:"Tell us about your experience (optional)",value:j,onChange:q=>C(q.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",onClick:F,className:"flex-1",children:"Maybe Later"}),r.jsx(ee,{onClick:P,disabled:N||p===0,className:"flex-1",children:N?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Qn,{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(ee,{variant:"outline",onClick:()=>z(!1),className:"flex-1",children:"No Thanks"}),r.jsx(ee,{onClick:()=>z(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function aht(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),a=new Uint8Array(s.length);for(let o=0;o{if(!y){l(!1);return}(async()=>{try{const{data:N,error:A}=await J.functions.invoke("get-vapid-public-key",{body:{}});if(A)throw A;const E=N==null?void 0:N.vapidPublicKey;if(!E)throw new Error("Missing VAPID public key");x(E);const T=await navigator.serviceWorker.register("/push-sw.js");h(T),n(Notification.permission);const P=await T.pushManager.getSubscription();a(!!P)}catch(N){console.error("Error initializing push notifications:",N)}finally{l(!1)}})()},[y]);const _=I.useCallback(async()=>{if(!y||!i||!t)return console.error("Push notifications not supported or user not logged in"),!1;if(!p)return ze.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const C=await i.pushManager.getSubscription();if(C){try{await C.unsubscribe()}catch(z){console.warn("Failed to unsubscribe existing push subscription:",z)}const{error:P}=await J.from("push_subscriptions").delete().eq("user_id",t.id);P&&console.warn("Failed to cleanup push_subscriptions rows:",P)}if(Notification.permission!=="granted"){const P=await Notification.requestPermission();if(n(P),P!=="granted")return P==="denied"?ze.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):ze.error("Notification permission was dismissed. Please try again."),!1}const N=aht(p);let A;try{A=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:N})}catch(P){console.error("PushManager.subscribe() failed:",P);const z=(P==null?void 0:P.message)||String(P);return z.includes("permission")?ze.error("Push permission denied. Check your browser notification settings."):z.includes("key")||z.includes("VAPID")?ze.error("Push configuration error. Please contact support."):z.includes("AbortError")?ze.error("Push subscription was cancelled. Please try again."):ze.error(`Failed to subscribe: ${z}`),!1}const E=A.toJSON(),{error:T}=await J.from("push_subscriptions").upsert({user_id:t.id,endpoint:E.endpoint,p256dh_key:E.keys.p256dh,auth_key:E.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),ze.error("Failed to save notification preferences. Please try again."),T;return a(!0),ze.success("Push notifications enabled!"),!0}catch(C){if(console.error("Error subscribing to push notifications:",C),!(C instanceof Error&&C.message.includes("toast"))){const N=C instanceof Error?C.message:"Unknown error";ze.error("Failed to enable push notifications: "+N)}return!1}finally{l(!1)}},[y,i,t,p]),j=I.useCallback(async()=>{if(!i||!t)return!1;try{l(!0);const C=await i.pushManager.getSubscription();return C&&await C.unsubscribe(),await J.from("push_subscriptions").delete().eq("user_id",t.id),a(!1),ze.success("Push notifications disabled"),!0}catch(C){console.error("Error unsubscribing:",C);const N=C instanceof Error?C.message:"Unknown error";return ze.error("Failed to disable push notifications: "+N),!1}finally{l(!1)}},[i,t]);return{isSupported:y,permission:e,isSubscribed:s,isLoading:o,vapidPublicKey:p,subscribe:_,unsubscribe:j}}const cke="push_notification_prompt_dismissed",iht=()=>{const{user:t}=Xr(),{isSupported:e,isSubscribed:n,isLoading:s,subscribe:a}=t8e(),[o,l]=I.useState(!1),[i,h]=I.useState(!1);I.useEffect(()=>{if(!t||!e||n||s||localStorage.getItem(`${cke}_${t.id}`))return;const _=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(_)},[t,e,n,s]);const p=async()=>{h(!0);const y=await a();h(!1),y&&l(!1)},x=()=>{t&&localStorage.setItem(`${cke}_${t.id}`,"true"),l(!1)};return!e||n?null:r.jsx(Fr,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{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(yg,{className:"h-6 w-6 text-primary"})}),r.jsx($r,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Qn,{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(ee,{onClick:p,disabled:i,className:"w-full",children:i?"Enabling...":"Enable Notifications"}),r.jsx(ee,{variant:"ghost",onClick:x,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."})]})})},dke=t=>{let e;const n=new Set,s=(p,x)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const _=e;e=x??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(j=>j(e,_))}},a=()=>e,i={setState:s,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=e=t(s,a,i);return i},oht=t=>t?dke(t):dke,lht=t=>t;function cht(t,e=lht){const n=st.useSyncExternalStore(t.subscribe,st.useCallback(()=>e(t.getState()),[t,e]),st.useCallback(()=>e(t.getInitialState()),[t,e]));return st.useDebugValue(n),n}const dht=t=>{const e=oht(t),n=s=>cht(e,s);return Object.assign(n,e),n},uht=t=>dht;function hht(t,e){let n;try{n=t()}catch{return}return{getItem:a=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),i=(o=n.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>n.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>n.removeItem(a)}}const whe=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return whe(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return whe(s)(n)}}}},fht=(t,e)=>(n,s,a)=>{let o={storage:hht(()=>localStorage),partialize:N=>N,version:0,merge:(N,A)=>({...A,...N}),...e},l=!1;const i=new Set,h=new Set;let p=o.storage;if(!p)return t((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...N)},s,a);const x=()=>{const N=o.partialize({...s()});return p.setItem(o.name,{state:N,version:o.version})},y=a.setState;a.setState=(N,A)=>(y(N,A),x());const _=t((...N)=>(n(...N),x()),s,a);a.getInitialState=()=>_;let j;const C=()=>{var N,A;if(!p)return;l=!1,i.forEach(T=>{var P;return T((P=s())!=null?P:_)});const E=((A=o.onRehydrateStorage)==null?void 0:A.call(o,(N=s())!=null?N:_))||void 0;return whe(p.getItem.bind(p))(o.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==o.version){if(o.migrate){const P=o.migrate(T.state,T.version);return P instanceof Promise?P.then(z=>[!0,z]):[!0,P]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var P;const[z,F]=T;if(j=o.merge(F,(P=s())!=null?P:_),n(j,!0),z)return x()}).then(()=>{E==null||E(j,void 0),j=s(),l=!0,h.forEach(T=>T(j))}).catch(T=>{E==null||E(void 0,T)})};return a.persist={setOptions:N=>{o={...o,...N},N.storage&&(p=N.storage)},clearStorage:()=>{p==null||p.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>C(),hasHydrated:()=>l,onHydrate:N=>(i.add(N),()=>{i.delete(N)}),onFinishHydration:N=>(h.add(N),()=>{h.delete(N)})},o.skipHydration||C(),j||_},pht=fht,xse=uht()(pht((t,e)=>({cartItems:[],addToCart:(n,s,a=1,o)=>{t(l=>{const i=l.cartItems.findIndex(h=>{var p;return h.product.id===n.id&&((p=h.variant)==null?void 0:p.id)===(s==null?void 0:s.id)});if(i>=0){const h=[...l.cartItems];return h[i].quantity+=a,o&&(h[i].artworkUrl=o),{cartItems:h}}return{cartItems:[...l.cartItems,{product:n,variant:s,quantity:a,artworkUrl:o}]}})},removeFromCart:(n,s)=>{t(a=>({cartItems:a.cartItems.filter(o=>{var l;return!(o.product.id===n&&((l=o.variant)==null?void 0:l.id)===s)})}))},updateQuantity:(n,s,a)=>{t(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===n&&((i=l.variant)==null?void 0:i.id)===s?{...l,quantity:Math.max(1,a)}:l})}))},updateArtwork:(n,s,a)=>{t(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===n&&((i=l.variant)==null?void 0:i.id)===s?{...l,artworkUrl:a}:l})}))},clearCart:()=>t({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),a=n.variant?Number(n.variant.price_adjustment):0;return s+a},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=e();return n.reduce((a,o)=>a+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=e();return n.reduce((s,a)=>s+Number(a.product.shipping_fee)*a.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=e();return n()+s()}}),{name:"marketplace-cart",partialize:t=>({cartItems:t.cartItems})})),r8e=I.createContext({onlineUsers:[],totalOnline:0}),mht=async t=>{try{const{data:e}=await J.storage.from("avatars").list(`${t}`);if(e&&e.length>0){const{data:n}=J.storage.from("avatars").getPublicUrl(`${t}/${e[0].name}`);return n.publicUrl}}catch{}},ght=({children:t})=>{const{user:e,brokerageId:n,isAdmin:s}=Xr(),[a,o]=I.useState([]),[l,i]=I.useState(null);I.useEffect(()=>{if(!e)return;const p=J.channel("app-presence",{config:{presence:{key:e.id}}});return p.on("presence",{event:"sync"},()=>{const x=p.presenceState(),y=[];Object.entries(x).forEach(([_,j])=>{if(j&&j.length>0){const C=j[0];y.push({id:_,name:C.name||"Unknown",avatarUrl:C.avatarUrl,brokerageId:C.brokerageId,onlineSince:C.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var y;if(x==="SUBSCRIBED"){const{data:_}=await J.from("profiles").select("name, brokerage_id").eq("id",e.id).single(),j=await mht(e.id);await p.track({name:(_==null?void 0:_.name)||((y=e.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:j,brokerageId:_==null?void 0:_.brokerage_id,onlineSince:new Date().toISOString()})}}),i(p),()=>{p.unsubscribe()}},[e]);const h=a.filter(p=>p.id===(e==null?void 0:e.id)?!1:!!(s||n&&p.brokerageId===n||!n&&!p.brokerageId));return r.jsx(r8e.Provider,{value:{onlineUsers:h,totalOnline:a.length},children:t})},n8e=()=>I.useContext(r8e),uke="dashboard-sidebar-collapsed",Lr=({children:t,title:e})=>{var ge,Le,ke;const{user:n,signOut:s,isAdmin:a,isBrokerageManager:o,brokerageId:l}=Xr(),{isAssistant:i,actingAsAgent:h}=xge(),x=i&&!!h?40:0,{avatarUrl:y}=SLe(n==null?void 0:n.id),{isTrial:_,isExpired:j,expiresAt:C}=rlt(n==null?void 0:n.id),{isMarketplaceEnabled:N}=MLe(),{currentBrief:A,shouldShowPopup:E,hasUnseenBrief:T,openBrief:P,closeBrief:z,dismissBrief:F}=eht(),{unreadCount:q}=nlt(),{openCount:V}=slt(),G=xse(Be=>Be.cartItems).reduce((Be,Ee)=>Be+Ee.quantity,0),te=Zn(),ie=Nm(),[oe,ye]=I.useState(()=>typeof window<"u"?localStorage.getItem(uke)==="true":!1);I.useEffect(()=>{localStorage.setItem(uke,String(oe))},[oe]);const[ae,pe]=I.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),se=Be=>{pe(Ee=>({...Ee,[Be]:!Ee[Be]}))},he=Be=>Be.split(" ").map(Ee=>Ee[0]).join("").toUpperCase().slice(0,2),ue=Be=>ie.pathname===Be,_e=Be=>Be.some(Ee=>ie.pathname===Ee),Ae=({path:Be,icon:Ee,label:Ue,badgeCount:Fe})=>{const be=r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ue(Be)&&"bg-sidebar-accent text-sidebar-accent-foreground",oe?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>te(Be),children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ee,{className:"h-4 w-4 shrink-0"}),oe&&Fe!=null&&Fe>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!oe&&Ue,!oe&&Fe!=null&&Fe>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:Fe>9?"9+":Fe})]});return oe?r.jsxs(Mg,{delayDuration:0,children:[r.jsx(Tg,{asChild:!0,children:be}),r.jsxs(vm,{side:"right",className:"flex items-center gap-2",children:[Ue,Fe!=null&&Fe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Fe>9?"9+":Fe})]})]}):be},Ce=({id:Be,label:Ee,icon:Ue,children:Fe,activePaths:be,showBetaBadge:tt,defaultPath:Te,badgeCount:Ke})=>{if(oe){const me=Te||be[0];return r.jsxs(Mg,{delayDuration:0,children:[r.jsx(Tg,{asChild:!0,children:r.jsx(ee,{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",_e(be)&&"text-primary"),onClick:()=>te(me),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ue,{className:"h-4 w-4"}),Ke!=null&&Ke>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(vm,{side:"right",className:"flex items-center gap-2",children:[Ee,tt&&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"}),Ke!=null&&Ke>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Ke>9?"9+":Ke})]})]})}return r.jsxs(SS,{open:ae[Be],onOpenChange:()=>se(Be),children:[r.jsx(CS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",_e(be)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(Ue,{className:"h-4 w-4"}),Ee,tt&&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:[Ke!=null&&Ke>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Ke>9?"9+":Ke}),r.jsx(Fd,{className:zt("h-4 w-4 transition-transform duration-200",ae[Be]&&"rotate-180")})]})]})}),r.jsx(MS,{className:"pl-4 space-y-1 mt-1",children:Fe})]})},Se=({isMobile:Be=!1})=>{const Ee=Be?!1:oe;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:zt("p-3 border-b border-sidebar-border",Ee?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[Ee?r.jsx("img",{src:Nlt,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:Dje,alt:"LevelUp",className:"h-8 w-auto"}),!Be&&r.jsxs(Mg,{delayDuration:0,children:[r.jsx(Tg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>ye(!Ee),children:r.jsx(Ac,{className:zt("h-4 w-4 transition-transform duration-300",Ee&&"rotate-180")})})}),r.jsx(vm,{side:"right",children:Ee?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(tl,{className:"flex-1",children:r.jsxs("nav",{className:zt("p-3 space-y-1",Ee&&"flex flex-col items-center"),children:[r.jsx(Ae,{path:"/dashboard",icon:yj,label:"Dashboard"}),r.jsx(Ae,{path:"/events",icon:mm,label:"Events"}),r.jsxs(Ce,{id:"agentos",label:"Agent OS",icon:tS,activePaths:["/mission-control","/mission-control/contacts","/mission-control/plans","/mission-control/popbys","/mission-control/video-library","/mission-control/scorecard","/mission-control/listings","/mission-control/pipeline"],showBetaBadge:!0,defaultPath:"/mission-control",children:[r.jsx(Ae,{path:"/mission-control",icon:ci,label:"Mission Control"}),r.jsx(Ae,{path:"/mission-control/contacts",icon:Bn,label:"Contacts"}),r.jsx(Ae,{path:"/mission-control/plans",icon:mm,label:"TouchPlans"}),r.jsx(Ae,{path:"/mission-control/pipeline",icon:Hx,label:"Deal Pipeline"}),r.jsx(Ae,{path:"/mission-control/popbys",icon:Ki,label:"Popbys"}),r.jsx(Ae,{path:"/mission-control/video-library",icon:Pa,label:"Video Library"}),r.jsx(Ae,{path:"/mission-control/scorecard",icon:dc,label:"Scorecard"}),r.jsx(Ae,{path:"/mission-control/listings",icon:ai,label:"Listing Exchange"})]}),r.jsxs(Ce,{id:"tools",label:"Tools",icon:$h,activePaths:["/apps","/ai-toolkit","/mission-control/my-card"],defaultPath:"/apps",children:[r.jsx(Ae,{path:"/apps",icon:$h,label:"Apps"}),!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/mission-control/my-card"),children:[r.jsx(gm,{className:"h-4 w-4"}),"Digital Card",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"})]}),Ee&&r.jsx(Ae,{path:"/mission-control/my-card",icon:gm,label:"Digital Card"})]}),r.jsxs(Ce,{id:"marketing",label:"Marketing",icon:ym,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(Ae,{path:"/templates",icon:pd,label:"Templates"}),!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/social-swag-2"),children:[r.jsx(jg,{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"})]}),Ee&&r.jsx(Ae,{path:"/social-swag-2",icon:jg,label:"Social Swag"}),r.jsx(Ae,{path:"/newsletters",icon:Gx,label:"Newsletters"})]}),r.jsxs(Ce,{id:"learning",label:"Learning",icon:CT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(Ae,{path:"/academy",icon:_1,label:"Academy"}),r.jsx(Ae,{path:"/toolbox",icon:Zx,label:"Toolbox"})]}),r.jsxs(Ce,{id:"community",label:"Community",icon:Oo,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:q,children:[r.jsx(Ae,{path:"/community",icon:Bn,label:"Community",badgeCount:q}),r.jsx(Ae,{path:"/wishlist",icon:w1,label:"Wishlist",badgeCount:V}),!Ee&&r.jsxs(ee,{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(Ls,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(Ce,{id:"goods",label:"The Goods",icon:ph,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[N&&!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ie.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/marketplace"),children:[r.jsx(ph,{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"})]}),N&&Ee&&r.jsx(Ae,{path:"/marketplace",icon:ph,label:"Marketplace"}),r.jsx(Ae,{path:"/reward-store",icon:Zi,label:"Reward Store"})]}),r.jsxs(Ce,{id:"help",label:"Help & Services",icon:Cx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(Ae,{path:"/support",icon:lS,label:"Support"}),r.jsx(Ae,{path:"/additional-services",icon:Ms,label:"Additional Services"})]}),a&&r.jsxs(r.Fragment,{children:[!Ee&&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"})}),Ee?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(Ae,{path:"/admin",icon:Qf,label:"Admin Dashboard"})}):r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ie.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/admin"),children:[r.jsx(Qf,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&r.jsxs(r.Fragment,{children:[!Ee&&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"})}),Ee?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(Ae,{path:"/my-brokerage",icon:ai,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{path:"/brokerage/dashboard",icon:md,label:"Manage Brokerages"}),r.jsx(Ae,{path:"/brokerage-resources",icon:vh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/my-brokerage"),children:[r.jsx(ai,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/brokerage/dashboard"),children:[r.jsx(md,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/brokerage-resources"),children:[r.jsx(vh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/profile"),children:[r.jsx(Ic,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(ee,{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(uS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(ght,{children:r.jsx(gI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[_&&j&&r.jsx(Rut,{}),typeof document<"u"&&gy.createPortal(r.jsx("aside",{className:zt("hidden md:flex flex-col bg-card border-r border-border fixed left-0 z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",oe?"w-16":"w-52"),style:{top:`${x}px`,height:`calc(100vh - ${x}px)`},children:r.jsx(Se,{})}),document.body),r.jsxs("div",{className:zt("flex-1 flex flex-col overflow-hidden transition-all duration-300",oe?"md:ml-16":"md:ml-52"),style:{height:`calc(100vh - ${x}px)`,marginTop:`${x}px`},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(Jne,{children:[r.jsx(Rge,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(FT,{className:"h-5 w-5"})})}),r.jsx(SI,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(Se,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:Dje,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(lke,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[_&&!j&&C&&r.jsx(Dut,{expiresAt:C,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(lke,{})}),A&&r.jsx(Fut,{hasUnseenBrief:T,onClick:P}),N&&r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",onClick:()=>te("/marketplace/cart"),children:[r.jsx(ph,{className:"h-5 w-5"}),G>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:G>99?"99+":G})]}),r.jsx(lut,{}),r.jsx(ghe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Le=(ge=n==null?void 0:n.user_metadata)==null?void 0:ge.name)==null?void 0:Le.split(" ")[0])||"User","!"]}),r.jsxs(jh,{children:[r.jsx(kh,{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(Ks,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Ei,{src:y||void 0}),r.jsx(Zs,{className:"bg-primary text-primary-foreground font-medium text-sm",children:he(((ke=n==null?void 0:n.user_metadata)==null?void 0:ke.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(Gu,{align:"end",className:"w-48",children:[r.jsxs(di,{onClick:()=>te("/profile"),className:"cursor-pointer",children:[r.jsx(Ic,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsx(Bj,{}),r.jsxs(di,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(uS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(rht,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:t})}),A&&r.jsx(Jut,{brief:A,open:E,onClose:z,onDismiss:F}),r.jsx(tht,{}),r.jsx(sht,{}),r.jsx(iht,{})]})]})})})},xht=()=>{const{user:t}=Xr(),[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState(""),i=async y=>{var _;if(!(t!=null&&t.email)){ze.error("Please sign in to upgrade");return}n(!0),a(y);try{const{data:j,error:C}=await J.functions.invoke("create-checkout",{body:{tier:y,email:t.email,name:((_=t.user_metadata)==null?void 0:_.full_name)||t.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(C)throw C;if(j!=null&&j.url)window.open(j.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(j){console.error("Checkout error:",j),ze.error(j.message||"Failed to start checkout. Please try again.")}finally{n(!1),a(null)}},h=["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"],p=["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"],x=["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(Lr,{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(He,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(dt,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:y=>l(y.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(Gt,{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(Bn,{className:"h-7 w-7 text-primary"})}),r.jsx(Zt,{className:"text-xl",children:"Individual Agent"}),r.jsx(Tn,{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:h.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ai,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(ee,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:e,children:[e&&s==="individual_agent"?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Ms,{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(Gt,{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(ai,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Zt,{className:"text-xl",children:"Brokerage"}),r.jsx(Tn,{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:p.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ai,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>i("brokerage_under_25"),disabled:e,children:[e&&s==="brokerage_under_25"?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ai,{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(Gt,{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(ai,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Zt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(Tn,{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:x.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ai,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(ee,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>i("brokerage_over_25"),disabled:e,children:[e&&s==="brokerage_over_25"?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ai,{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(bi,{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(ua,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},yht=()=>{const{user:t,loading:e,isBrokerageManager:n,brokerageId:s}=Xr(),a=Zn(),[o,l]=I.useState(""),[i,h]=I.useState(!1),[p,x]=I.useState(!1);I.useEffect(()=>{!e&&!t&&a("/auth")},[t,e,a]),I.useEffect(()=>{!e&&t&&s&&a("/profile?setup=true")},[t,e,s,a]);const y=async()=>{if(!o.trim()){ze.error("Please enter a brokerage name");return}const{data:_}=await J.auth.getSession(),j=_.session;if(!t||!j){ze.error("Please sign in again to create your brokerage."),a("/auth");return}h(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!t,hasSession:!!j,userId:t==null?void 0:t.id});const{data:C,error:N}=await J.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:C,error:N}),N)throw N;if(!(C!=null&&C.ok))throw new Error((C==null?void 0:C.error)||"Failed to create brokerage");h(!1),x(!0),ze.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(C){console.error("Error creating brokerage:",C),ze.error(C.message||"Failed to create brokerage"),h(!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"})}):p?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(Gt,{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(en,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Zt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(Tn,{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(Yi,{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(en,{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(Gt,{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(ai,{className:"w-10 h-10 text-primary"})}),r.jsx(Zt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(Tn,{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(He,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:_=>l(_.target.value),onKeyDown:_=>_.key==="Enter"&&y()}),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(Bn,{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(Yi,{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(Yi,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Yi,{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(Yi,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(ee,{onClick:y,className:"w-full",disabled:i||!o.trim(),children:[i?"Creating...":"Create Brokerage",r.jsx(hl,{className:"w-4 h-4 ml-2"})]})]})]})})},hke=()=>{const t=Zn(),[e,n]=I.useState("verifying"),[s,a]=I.useState("");I.useEffect(()=>{(async()=>{try{const{data:{session:i},error:h}=await J.auth.getSession();if(h)throw h;if(i!=null&&i.user){const{data:p}=await J.from("profiles").select("login_count").eq("id",i.user.id).single();if(((p==null?void 0:p.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",i.user.email),n("success");try{await J.functions.invoke("trial-claim-hook",{body:{userId:i.user.id}})}catch(x){console.log("Trial claim hook (non-critical):",x)}setTimeout(()=>{t("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(i){console.error("Claim error:",i),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(Gt,{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(Zt,{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(Tn,{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(ee,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},vht=()=>{const t=Zn(),[e]=qd(),[n,s]=I.useState(e.get("code")||""),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(!1),[_,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,P]=I.useState(null),[z,F]=I.useState(null),[q,V]=I.useState(null),[K,G]=I.useState(null);I.useEffect(()=>{const ye=e.get("code");ye&&(s(ye),te(ye))},[e]);const te=async ye=>{N(!0);const{data:ae,error:pe}=await J.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",ye.toUpperCase().trim()).single();if(pe||!ae){ze.error("Invalid invite code"),N(!1);return}if(!ae.is_active){ze.error("This invite code is no longer active"),N(!1);return}if(ae.max_uses&&ae.uses_count>=ae.max_uses){ze.error("This invite code has reached its maximum uses"),N(!1);return}if(ae.expires_at&&new Date(ae.expires_at){ye.preventDefault(),te(n)},oe=async ye=>{var ae;if(ye.preventDefault(),!h.trim()){ze.error("Please enter your name");return}if(l.length<6){ze.error("Password must be at least 6 characters");return}j(!0);try{const pe=`${window.location.origin}/`,{data:se,error:he}=await J.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:pe,data:{name:h.trim()}}});if(he){he.message.includes("already registered")?ze.error("This email is already registered. Please sign in instead."):ze.error(he.message);return}se.user&&(await J.rpc("add_default_signup_tag",{user_id:se.user.id}),z?await J.functions.invoke("assign-brokerage",{body:{userId:se.user.id,brokerageId:z}}):K?await J.functions.invoke("assign-brokerage",{body:{userId:se.user.id,trialDays:K}}):await J.functions.invoke("assign-brokerage",{body:{userId:se.user.id,grandfathered:!0}}),T&&await J.from("invite_codes").update({uses_count:((ae=(await J.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:ae.uses_count)+1}).eq("id",T),ze.success("Account created! You can now access the dashboard."),t("/dashboard"))}catch(pe){console.error("Signup error:",pe),ze.error("An unexpected error occurred")}finally{j(!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(Gt,{className:"text-center",children:[r.jsx(Zt,{className:"text-2xl font-bold text-primary",children:q?`Join ${q}`:"Join LevelUp"}),r.jsx(Tn,{children:A?q?`Create your account to join ${q}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(Je,{children:A?r.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Full Name"}),r.jsx(dt,{id:"name",type:"text",placeholder:"John Doe",value:h,onChange:ye=>p(ye.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:ye=>o(ye.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:ye=>i(ye.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:()=>y(!x),children:x?r.jsx(g1,{className:"h-4 w-4"}):r.jsx(el,{className:"h-4 w-4"})})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:_,children:_?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(dt,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:ye=>s(ye.target.value),required:!0,autoFocus:!0})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},_ht="/assets/testimonial-avatar-1-BsCQFauB.jpg",bht="/assets/testimonial-avatar-2-B6VPVc2t.jpg",wht="/assets/testimonial-avatar-3-GuEFwYUE.jpg",jht="/assets/testimonial-avatar-4-98iKMtkB.jpg",kht="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Nht=[_ht,bht,wht,jht,kht],Sht=u3({name:oc().trim().min(2,"Name must be at least 2 characters").max(100),email:oc().trim().email("Please enter a valid email address").max(255),phone:oc().trim().min(10,"Please enter a valid phone number").max(20).optional().or(Pje("")),brokerage:oc().trim().max(200).optional().or(Pje(""))}),Cht=[{icon:$f,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:pd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Os,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Fl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:La,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ki,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Mht=[{icon:Bn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ms,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:bi,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Jh,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Mo,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:dc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:ci,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Sg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Tht=[{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."}],Aht=()=>{const t=Zn(),[e,n]=I.useState(!1),[s,a]=I.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=I.useState({}),i=async h=>{var x,y;h.preventDefault(),l({});const p=Sht.safeParse(s);if(!p.success){const _={};p.error.errors.forEach(j=>{j.path[0]&&(_[j.path[0]]=j.message)}),l(_);return}n(!0);try{const{data:_,error:j}=await J.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((x=s.phone)==null?void 0:x.trim())||void 0,brokerage:((y=s.brokerage)==null?void 0:y.trim())||void 0}});if(j){console.error("Trial signup error:",j),ze.error(j.message||"Something went wrong. Please try again.");return}if(_!=null&&_.error){ze.error(_.error);return}ze.success("🎉 Welcome aboard! Check your email to claim your account."),t("/trial/success")}catch(_){console.error("Trial signup error:",_),ze.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{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:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var h;return(h=document.getElementById("features"))==null?void 0:h.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{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(Ms,{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(Xi,{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(Xi,{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:Nht.map((h,p)=>r.jsx("img",{src:h,alt:`Agent ${p+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},p))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(h=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},h))}),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(_g,{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:i,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Full Name *"}),r.jsx(dt,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:h=>a({...s,name:h.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(He,{htmlFor:"email",children:"Email Address *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:h=>a({...s,email:h.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(He,{htmlFor:"phone",children:"Phone Number"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:h=>a({...s,phone:h.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(He,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:h=>a({...s,brokerage:h.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(ee,{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(en,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(hl,{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:Cht.map((h,p)=>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(Gt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(h.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:h.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:h.description})})]},p))})]})}),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(Ms,{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:Mht.map((h,p)=>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(Gt,{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(h.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Zt,{className:"text-lg font-semibold text-white",children:h.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:h.description})})]},p))})]})]}),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:Tht.map((h,p)=>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(x=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',h.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:h.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.role})]})]})},p))})]})}),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(nf,{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(Sg,{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(Bn,{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(ee,{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(hl,{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:Pge,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."})]})})})]})]})},Eht=()=>{const t=Zn();return r.jsxs(r.Fragment,{children:[r.jsx(Sm,{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:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(ee,{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(Xi,{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(Ec,{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(ua,{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(ee,{onClick:()=>t("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(hl,{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:Pge,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Iht=u3({viewerName:oc().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:oc().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:oc().max(20,"Phone must be less than 20 characters").optional(),message:oc().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Pht({shareToken:t,agentName:e,hasContact:n}){const[s,a]=I.useState(!1),[o,l]=I.useState(!1),[i,h]=I.useState(null),p=ose({resolver:lse(Iht),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{a(!0),h(null);try{const{data:_,error:j}=await J.functions.invoke("video-reply-notify",{body:{shareToken:t,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(j)throw new Error(j.message);if(!(_!=null&&_.success))throw new Error((_==null?void 0:_.error)||"Failed to send reply");l(!0)}catch(_){console.error("Failed to submit reply:",_),h(_.message||"Something went wrong. Please try again.")}finally{a(!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(Xi,{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(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Fl,{className:"h-5 w-5 text-primary"}),r.jsx(Zt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(Tn,{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(cse,{...p,children:r.jsxs("form",{onSubmit:p.handleSubmit(x),className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsx(Al,{control:p.control,name:"viewerName",render:({field:y})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Your Name *"}),r.jsx(kl,{children:r.jsx(dt,{placeholder:"John Smith",...y})}),r.jsx(Lu,{})]})}),r.jsx(Al,{control:p.control,name:"viewerEmail",render:({field:y})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Email *"}),r.jsx(kl,{children:r.jsx(dt,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(Lu,{})]})})]}),!n&&r.jsx(Al,{control:p.control,name:"viewerPhone",render:({field:y})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Phone (optional)"}),r.jsx(kl,{children:r.jsx(dt,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(Lu,{})]})}),r.jsx(Al,{control:p.control,name:"message",render:({field:y})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Message *"}),r.jsx(kl,{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",...y})}),r.jsx(Lu,{})]})}),i&&r.jsx("p",{className:"text-sm text-destructive",children:i}),r.jsx(ee,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Do,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Lht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0 opacity-[0.08]",children:[r.jsx("div",{className:"absolute top-0 left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[16%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[32%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[48%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[64%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[80%] left-0 right-0 h-[8%] bg-red-600"})]}),r.jsx("div",{className:"absolute top-0 left-0 w-[35%] h-[45%] bg-blue-900/10 rounded-br-3xl"}),r.jsx(vs,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(vs,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(vs,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(Ux,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Oht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-500/5 via-transparent to-blue-500/5"}),r.jsxs("div",{className:"absolute top-[10%] left-[15%] w-32 h-32",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-red-400/20 animate-ping",style:{animationDuration:"3s"}}),r.jsx(Ms,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 text-red-400/40"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[20%] w-24 h-24",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-blue-400/20 animate-ping",style:{animationDuration:"4s",animationDelay:"1s"}}),r.jsx(vs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 text-blue-400/40 fill-blue-400/20"})]}),r.jsxs("div",{className:"absolute top-[20%] left-[50%] w-20 h-20",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border border-white/10 animate-ping",style:{animationDuration:"3.5s",animationDelay:"0.5s"}}),r.jsx(Ms,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 text-amber-400/40"})]}),r.jsx(vs,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(vs,{className:"absolute bottom-[15%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse",style:{animationDelay:"0.5s"}}),r.jsx(Ux,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Dht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-200/20 via-rose-100/10 to-purple-200/15"}),r.jsx("div",{className:"absolute top-[5%] left-[5%] opacity-20",children:r.jsx(lm,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(lm,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(lm,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(lm,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(ci,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(ci,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-300/40 fill-pink-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(ci,{className:"absolute top-[10%] left-[60%] w-4 h-4 text-rose-400/30 fill-rose-400/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx("div",{className:"absolute top-[8%] left-[45%] w-8 h-8 rounded-full bg-pink-300/10 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[30%] w-6 h-6 rounded-full bg-rose-300/10 blur-sm"})]}),Rht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/5 via-slate-800/3 to-indigo-900/5"}),r.jsx("div",{className:"absolute top-[5%] right-[10%] opacity-15",children:r.jsxs("div",{className:"w-12 h-24 relative",children:[r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-10 h-3 bg-blue-600 rounded-full"}),r.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-[20px] border-r-[20px] border-t-[60px] border-l-transparent border-r-transparent border-t-blue-500"})]})}),r.jsx(Ol,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(vs,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Ol,{className:"absolute bottom-[20%] right-[8%] w-14 h-14 text-indigo-500/12"}),r.jsx("div",{className:"absolute top-[3%] left-[40%] opacity-12",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tr-none rotate-6"}),r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tl-none -rotate-6"})]})}),r.jsx(vs,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(vs,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Fht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-100/20 via-purple-100/15 to-sky-100/20"}),r.jsx("div",{className:"absolute top-[5%] left-[8%] w-12 h-16 rounded-full bg-gradient-to-b from-pink-300/25 to-pink-400/18 rotate-12"}),r.jsx("div",{className:"absolute top-[8%] right-[12%] w-10 h-14 rounded-full bg-gradient-to-b from-purple-300/25 to-purple-400/18 -rotate-6"}),r.jsx("div",{className:"absolute bottom-[18%] left-[15%] w-11 h-15 rounded-full bg-gradient-to-b from-sky-300/20 to-sky-400/12 rotate-6"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-12 h-16 rounded-full bg-gradient-to-b from-yellow-300/20 to-yellow-400/12 -rotate-12"}),r.jsx("div",{className:"absolute top-[10%] left-[10%] w-6 h-1 bg-white/30 rounded-full rotate-12"}),r.jsx("div",{className:"absolute top-[12%] right-[15%] w-5 h-1 bg-white/25 rounded-full -rotate-6"}),r.jsx(lm,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(lm,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(rS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),zht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/12 via-purple-900/8 to-slate-900/12"}),r.jsx(gj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(gj,{className:"absolute top-[10%] right-[12%] w-12 h-12 text-purple-400/20 animate-pulse"}),r.jsxs("div",{className:"absolute bottom-[18%] left-[8%]",children:[r.jsx("div",{className:"w-14 h-12 rounded-full bg-orange-500/20"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-4 bg-green-600/25 rounded-t-full"})]}),r.jsxs("div",{className:"absolute bottom-[22%] right-[12%]",children:[r.jsx("div",{className:"w-12 h-10 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-1.5 h-3 bg-green-600/20 rounded-t-full"})]}),r.jsx("div",{className:"absolute top-[15%] left-[40%] opacity-20",children:r.jsx("svg",{viewBox:"0 0 24 12",className:"w-10 h-5 text-slate-800 fill-current",children:r.jsx("path",{d:"M12 6c-2-4-6-6-12-6 4 2 6 4 6 6s-2 4-6 6c6 0 10-2 12-6zm0 0c2-4 6-6 12-6-4 2-6 4-6 6s2 4 6 6c-6 0-10-2-12-6z"})})}),r.jsx(Ms,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Ms,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Bht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-900/8 via-green-900/5 to-emerald-900/8"}),r.jsx(S1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(S1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(S1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(Z0,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(Z0,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(Z0,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(Z0,{className:"absolute top-[8%] left-[70%] w-8 h-8 text-blue-200/20 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[12%] left-[10%] w-5 h-5 rounded-full bg-red-500/25"}),r.jsx("div",{className:"absolute top-[15%] right-[15%] w-4 h-4 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"absolute top-[20%] left-[55%] w-4 h-4 rounded-full bg-green-500/20"}),r.jsx(vs,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),$ht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/10 via-amber-800/6 to-red-900/10"}),r.jsx("div",{className:"absolute top-[5%] left-[10%] w-10 h-8 rounded-full bg-orange-500/25 rotate-45"}),r.jsx("div",{className:"absolute top-[10%] right-[15%] w-8 h-6 rounded-full bg-red-500/20 -rotate-12"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-7 h-5 rounded-full bg-amber-500/22 rotate-30"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-10 h-7 rounded-full bg-yellow-600/18 -rotate-45"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-9 h-6 rounded-full bg-orange-600/15 rotate-12"}),r.jsxs("div",{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2",children:[r.jsx("div",{className:"w-16 h-14 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-5 bg-green-600/18 rounded-t-full"})]}),r.jsx(ci,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(ci,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Uht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-900/8 via-amber-900/4 to-purple-900/8"}),r.jsx(vs,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(vs,{className:"absolute top-[8%] right-[12%] w-10 h-10 text-amber-400/30 fill-amber-400/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(vs,{className:"absolute top-[15%] left-[40%] w-7 h-7 text-yellow-300/25 fill-yellow-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(vs,{className:"absolute top-[12%] right-[35%] w-8 h-8 text-amber-300/28 fill-amber-300/18 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[20%] left-[25%] w-4 h-4 rounded-full bg-pink-400/30"}),r.jsx("div",{className:"absolute top-[18%] right-[30%] w-3 h-3 rounded-full bg-sky-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[60%] w-2.5 h-2.5 rounded-full bg-emerald-400/30"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-3 h-3 rounded-full bg-purple-400/30"}),r.jsx(Ms,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Ec,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Ec,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),qht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsxs("div",{className:"absolute bottom-[12%] left-1/2 -translate-x-1/2 flex items-end gap-3",children:[r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2.5 h-20 bg-blue-500/22 rounded-full"})," ",r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"})]}),r.jsx("div",{className:"absolute bottom-[38%] left-[calc(50%-42px)] w-3 h-4 bg-yellow-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[35%] left-[calc(50%-28px)] w-2.5 h-3 bg-yellow-300/25 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[40%] left-[calc(50%-14px)] w-3 h-4 bg-amber-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[45%] left-1/2 -translate-x-1/2 w-4 h-5 bg-yellow-400/35 rounded-full blur-sm"}),r.jsx(vs,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Ms,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Ms,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Vht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/12 via-emerald-900/6 to-teal-900/10"}),r.jsx(Ox,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Ox,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Ox,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Ox,{className:"absolute bottom-[22%] right-[10%] w-11 h-11 text-emerald-400/18"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-6 h-6 rounded-full bg-yellow-500/30 border-2 border-yellow-600/25"}),r.jsx("div",{className:"absolute top-[20%] right-[28%] w-5 h-5 rounded-full bg-amber-500/25 border-2 border-amber-600/20"}),r.jsx("div",{className:"absolute bottom-[28%] left-[45%] w-5 h-5 rounded-full bg-yellow-400/25 border-2 border-yellow-500/20"}),r.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 opacity-12 rounded-bl-full overflow-hidden",children:r.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-red-400/60 via-yellow-400/60 to-green-400/60"})}),r.jsxs("div",{className:"absolute bottom-[10%] right-[5%] opacity-15",children:[r.jsx("div",{className:"w-12 h-8 bg-slate-700 rounded-b-full"}),r.jsx("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 w-10 h-3 bg-slate-600 rounded-full"}),r.jsxs("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 flex gap-0.5",children:[r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"})]})]})]}),Hht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsx("div",{className:"absolute top-[8%] left-[12%] w-16 h-16 rounded-full border-4 border-blue-500/18"}),r.jsx("div",{className:"absolute top-[10%] right-[10%] w-14 h-14 rounded-full border-4 border-indigo-500/15"}),r.jsx("div",{className:"absolute bottom-[18%] left-[18%] w-12 h-12 rounded-full border-3 border-sky-500/12"}),r.jsx(vs,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(vs,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Ol,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Ol,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(Ux,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Wht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/6 via-rose-900/6 to-purple-900/6"}),r.jsx(Jh,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-amber-400/18"}),r.jsxs("div",{className:"absolute top-[5%] left-[15%]",children:[r.jsx("div",{className:"w-12 h-14 rounded-full bg-rose-400/25"}),r.jsx("div",{className:"w-0.5 h-10 bg-rose-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[3%] left-[25%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-sky-400/25"}),r.jsx("div",{className:"w-0.5 h-12 bg-sky-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[8%] right-[18%]",children:[r.jsx("div",{className:"w-11 h-13 rounded-full bg-purple-400/25"}),r.jsx("div",{className:"w-0.5 h-9 bg-purple-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[10%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"w-0.5 h-11 bg-amber-400/18 mx-auto"})]}),r.jsx("div",{className:"absolute top-[20%] left-[35%] w-3 h-3 bg-pink-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[18%] right-[40%] w-2.5 h-2.5 bg-emerald-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-2 h-2 bg-amber-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[30%] w-2.5 h-2.5 bg-sky-400/35 rounded-full"}),r.jsx(Ec,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(Ki,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),Ght=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-rose-900/12 via-pink-900/8 to-red-900/12"}),r.jsx(ci,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(ci,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(ci,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(ci,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(ci,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(ci,{className:"absolute top-[20%] right-[35%] w-5 h-5 text-rose-300/35 fill-rose-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(ci,{className:"absolute top-[12%] left-[55%] w-5 h-5 text-red-300/30 fill-red-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(ci,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-400/30 fill-pink-400/15 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[18%] left-[45%] w-8 h-8 rounded-full bg-rose-300/18 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[40%] w-6 h-6 rounded-full bg-pink-300/15 blur-sm"})]}),Kht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsxs("div",{className:"absolute top-[5%] right-[12%]",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-yellow-400/25 blur-sm"}),r.jsx(N1,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-14 h-14 text-amber-400/45"})]}),r.jsx("div",{className:"absolute bottom-[12%] left-[20%] w-20 h-10 bg-slate-800/12 rounded-full blur-md"}),r.jsx(N1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Ms,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(N1,{className:"absolute bottom-[22%] right-[25%] w-8 h-8 text-orange-400/25"}),r.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[15%] bg-gradient-to-t from-amber-900/10 to-transparent"})]}),Zht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-cyan-900/6 to-emerald-900/10"}),r.jsx(da,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(da,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(tf,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(tf,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(ci,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(ci,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Ms,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Ec,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Yht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-900/10 via-teal-900/6 to-cyan-900/10"}),r.jsx(Ec,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Ec,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(tf,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(da,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Ms,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Ms,{className:"absolute top-[20%] right-[32%] w-7 h-7 text-cyan-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-3 h-3 bg-amber-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-2.5 h-2.5 bg-teal-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[28%] left-[35%] w-2 h-2 bg-emerald-400/30 rounded-full"})]}),Xht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsx(tf,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(tf,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(tf,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(da,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Ec,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Ms,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(vs,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),Qht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-emerald-900/6 to-green-900/10"}),r.jsx(da,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-teal-500/22"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-12 h-10 bg-amber-400/18 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[20%] left-[20%] w-10 h-8 bg-orange-400/15 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[16%] right-[15%] w-11 h-9 bg-amber-300/18 rounded-sm"}),r.jsx(tf,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(ci,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Ms,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(pj,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),fke=()=>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"})]}),Jht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(ci,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(ci,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(ci,{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(ci,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),eft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(pj,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Ms,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(da,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),tft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(fj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(hS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(fj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),zM=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ms,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Ec,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Ms,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),pke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(da,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Ms,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(da,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),jhe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Ms,{className:"h-5 w-5"}),category:"general",headerText:()=>"Video Message",subText:"A personal video just for you",gradientClasses:"from-background to-muted/30",accentColor:"primary"},{id:"thank_you",name:"Thank You",description:"Express your gratitude",icon:r.jsx(ci,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You, ${t}!`:"Thank You!",subText:"Your support means the world to me",gradientClasses:"from-rose-50/70 via-pink-50/50 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(Jht,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(TT,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thinking of You, ${t}`:"Thinking of You",subText:"Just wanted to reach out and say hello",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(zM,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(fj,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Hey ${t}!`:"Hey There!",subText:"Just checking in to see how you're doing",gradientClasses:"from-amber-50/70 via-orange-50/50 to-yellow-50/40 dark:from-amber-950/30 dark:via-orange-950/20 dark:to-yellow-950/20",accentColor:"amber",decorativeElement:r.jsx(tft,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(dc,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Market Update for ${t}`:"Market Update",subText:"The latest insights from your local market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue"},{id:"referral_thank_you",name:"Referral Thank You",description:"Thank someone for a referral",icon:r.jsx(Bn,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You for the Referral, ${t}!`:"Thank You for the Referral!",subText:"Your trust in me means everything",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx(zM,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"So proud of your accomplishment",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(fke,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(Mo,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Welcome to the Neighborhood, ${t}!`:"Welcome to the Neighborhood!",subText:"So excited to have you as our new neighbor",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-sky-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-sky-950/20",accentColor:"teal",decorativeElement:r.jsx(pke,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(hS,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Hey ${t}!`:"Hey There!",subText:"No reason needed – just wanted to connect",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(zM,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(Jh,{className:"h-5 w-5"}),category:"holidays",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(Wht,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(ci,{className:"h-5 w-5"}),category:"holidays",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(Ght,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(N1,{className:"h-5 w-5"}),category:"holidays",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(Kht,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(vs,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy New Year, ${t}!`:"Happy New Year!",subText:"Wishing you a year full of success and happiness",gradientClasses:"from-yellow-50/70 via-amber-50/50 to-orange-50/40 dark:from-yellow-950/30 dark:via-amber-950/20 dark:to-orange-950/20",accentColor:"yellow",decorativeElement:r.jsx(Uht,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(rS,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Easter, ${t}!`:"Happy Easter!",subText:"Wishing you a joyful celebration",gradientClasses:"from-pink-50/70 via-purple-50/50 to-sky-50/40 dark:from-pink-950/30 dark:via-purple-950/20 dark:to-sky-950/20",accentColor:"pink",decorativeElement:r.jsx(Fht,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(lm,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Mother's Day, ${t}!`:"Happy Mother's Day!",subText:"Celebrating the wonderful mothers in our lives",gradientClasses:"from-pink-50/70 via-rose-50/50 to-purple-50/40 dark:from-pink-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"pink",decorativeElement:r.jsx(Dht,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Father's Day, ${t}!`:"Happy Father's Day!",subText:"Celebrating the wonderful fathers in our lives",gradientClasses:"from-blue-50/70 via-sky-50/50 to-indigo-50/40 dark:from-blue-950/30 dark:via-sky-950/20 dark:to-indigo-950/20",accentColor:"blue",decorativeElement:r.jsx(Rht,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(Ux,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Memorial Day, ${t}`:"Happy Memorial Day",subText:"Honoring those who served our country",gradientClasses:"from-red-50/60 via-white to-blue-50/60 dark:from-red-950/30 dark:via-slate-950/20 dark:to-blue-950/30",accentColor:"blue",decorativeElement:r.jsx(Lht,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(ef,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy 4th of July, ${t}!`:"Happy 4th of July!",subText:"Celebrating freedom and independence",gradientClasses:"from-red-50/70 via-white to-blue-50/70 dark:from-red-950/30 dark:via-slate-950/10 dark:to-blue-950/30",accentColor:"red",decorativeElement:r.jsx(Oht,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Labor Day, ${t}!`:"Happy Labor Day!",subText:"Celebrating the hard work that builds our communities",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(Hht,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(gj,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Halloween, ${t}!`:"Happy Halloween!",subText:"Have a spooktacular day!",gradientClasses:"from-orange-50/70 via-amber-50/50 to-purple-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-purple-950/30",accentColor:"orange",decorativeElement:r.jsx(zht,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(ci,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Thanksgiving, ${t}!`:"Happy Thanksgiving!",subText:"Grateful for you and your friendship",gradientClasses:"from-orange-50/70 via-amber-50/50 to-red-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-red-950/20",accentColor:"orange",decorativeElement:r.jsx($ht,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(S1,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Merry Christmas, ${t}!`:"Merry Christmas!",subText:"Wishing you joy and peace this holiday season",gradientClasses:"from-red-50/70 via-green-50/40 to-emerald-50/40 dark:from-red-950/30 dark:via-green-950/20 dark:to-emerald-950/20",accentColor:"red",decorativeElement:r.jsx(Bht,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Ms,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Hanukkah, ${t}!`:"Happy Hanukkah!",subText:"Wishing you eight nights of light and joy",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(qht,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Ox,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy St. Patrick's Day, ${t}!`:"Happy St. Patrick's Day!",subText:"Wishing you the luck of the Irish!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(Vht,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(da,{className:"h-5 w-5"}),category:"transactional",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(Zht,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Ec,{className:"h-5 w-5"}),category:"transactional",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(Yht,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(Os,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Exciting News, ${t}!`:"Just Listed!",subText:"A new property is now on the market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-violet-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-violet-950/20",accentColor:"blue",decorativeElement:r.jsx(pke,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(fd,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Just Sold!",subText:"Another successful transaction completed",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx(zM,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(jj,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Great News, ${t}!`:"Price Reduced!",subText:"This property just became more affordable",gradientClasses:"from-orange-50/70 via-amber-50/50 to-yellow-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-yellow-950/20",accentColor:"orange"},{id:"open_house",name:"Open House",description:"Invite to an open house event",icon:r.jsx(pj,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`You're Invited, ${t}!`:"You're Invited!",subText:"Join us for an exclusive open house",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(eft,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(tf,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"It's official – the keys are yours!",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(Xht,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(da,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Welcome Home, ${t}!`:"Welcome Home!",subText:"Wishing you all the best in your new home",gradientClasses:"from-teal-50/70 via-emerald-50/50 to-green-50/40 dark:from-teal-950/30 dark:via-emerald-950/20 dark:to-green-950/20",accentColor:"teal",decorativeElement:r.jsx(Qht,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(gd,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Amazing News, ${t}!`:"Offer Accepted!",subText:"Your offer has been accepted – congratulations!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(zM,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(fke,{})}],rft=[{id:"general",name:"General Touch",description:"Everyday connection templates"},{id:"holidays",name:"Holidays",description:"Seasonal and holiday greetings"},{id:"transactional",name:"Transactional",description:"Real estate milestone templates"}];function nft(t){return jhe.filter(e=>e.category===t)}function TS(t){return jhe.find(e=>e.id===t)||jhe[0]}function sft(){const{shareToken:t}=Yc(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(!0),[p,x]=I.useState(null),[y,_]=I.useState(!0);I.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(te=>{document.querySelectorAll(te).forEach(ie=>{ie.style.display="none"})})};q();const V=[setTimeout(q,500),setTimeout(q,1500),setTimeout(q,3e3)],K=new MutationObserver(q);return K.observe(document.body,{childList:!0,subtree:!0}),()=>{V.forEach(clearTimeout),K.disconnect()}},[]),I.useEffect(()=>{(async()=>{if(!t){x("Invalid share link"),h(!1);return}const{data:V,error:K}=await J.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||!V){x("Video not found or has been removed"),h(!1);return}n(V);try{await J.rpc("log_video_view",{p_video_id:V.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(G){console.warn("Failed to log video view:",G)}if(V.owner_user_id){const{data:G}=await J.from("profiles").select("id, name, email, phone").eq("id",V.owner_user_id).single();if(G){a(G);try{const{data:te}=await J.storage.from("avatars").list(`${V.owner_user_id}`);if(te&&te.length>0){const{data:ie}=J.storage.from("avatars").getPublicUrl(`${V.owner_user_id}/${te[0].name}`);l(ie.publicUrl)}}catch{}}}h(!1)})()},[t]);const j=q=>{if(!q)return"0:00";const V=Math.floor(q/60),K=q%60;return`${V}:${K.toString().padStart(2,"0")}`},C=q=>q.includes("iframe.mediadelivery.net/play/")?q.replace("/play/","/embed/")+"?autoplay=true&responsive=true":q,N=q=>{if(!q)return"?";const V=q.split(" ");return V.length>=2?`${V[0][0]}${V[1][0]}`.toUpperCase():q.substring(0,2).toUpperCase()},A=TS((e==null?void 0:e.page_template)||"default"),E=(e==null?void 0:e.recipient_name)||null,T=A.headerText(E),z=`https://dashboard.relevelup.com/share/video/${t}`;if(i)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-primary"})});if(p||!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(Pa,{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:p||"This video is no longer available."})]})})});const F=A.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{children:[r.jsx("title",{children:T}),r.jsx("meta",{name:"description",content:A.subText}),r.jsx("meta",{property:"og:title",content:T}),r.jsx("meta",{property:"og:description",content:A.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:z}),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:T}),r.jsx("meta",{name:"twitter:description",content:A.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",A.gradientClasses),children:[F&&A.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 shadow-sm",A.accentColor==="primary"&&"bg-primary/10 text-primary",A.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",A.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",A.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",A.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",A.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",A.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",A.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",A.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",A.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",A.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",A.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",A.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:r.jsx("div",{className:"scale-150",children:A.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:T}),r.jsx("p",{className:"text-muted-foreground",children:A.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(Ks,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Ei,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(Zs,{className:"bg-primary/10 text-primary font-semibold",children:N(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(ee,{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(bi,{className:"h-4 w-4"})})}),s.email&&r.jsx(ee,{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(ua,{className:"h-4 w-4"})})})]})]}),r.jsx(Ye,{className:"overflow-hidden shadow-lg",children:y&&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:()=>_(!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 V=(K=q.currentTarget.parentElement)==null?void 0:K.querySelector(".video-fallback");V&&(V.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(Pa,{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(fc,{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:j(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:y?"Enjoy the video!":"Click to play the video"})]}),!y&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(ee,{size:"lg",onClick:()=>_(!0),className:"gap-2",children:[r.jsx(fc,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Pht,{shareToken:t,agentName:(s==null?void 0:s.name)||null,hasContact:!!e.contact_id})]})]})]})}function aft(){return I.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(IJe,{})}function ift(){const{token:t}=Yc();return I.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(en,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const oft={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},lft={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},l4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function cft(){var ae,pe,se,he;const{slugOrId:t}=Yc(),[e]=qd(),{data:n,isLoading:s}=fLe(t||""),a=pLe(),o=Mit(),l=e.get("ref"),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(""),[j,C]=I.useState(""),[N,A]=I.useState(!1),[E,T]=I.useState(!1),[P,z]=I.useState(null),[F,q]=I.useState(!1);I.useEffect(()=>{l&&o.mutate(l)},[l]);const V=ue=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ue),K=async ue=>{if(ue.preventDefault(),!(!i.trim()||!y.trim()||!n)){A(!0);try{await a.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:i.trim(),lastName:p.trim(),email:y.trim(),phone:j.trim(),shareToken:l}),T(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(_e){console.error("Lead submission error:",_e),ze.error(`Failed to submit: ${_e.message||"Please try again"}`)}finally{A(!1)}}},G=(n==null?void 0:n.photos)||[],te=G.find(ue=>ue.is_primary)||G[0],ie=()=>{P!==null&&z(P===0?G.length-1:P-1)},oe=()=>{P!==null&&z(P===G.length-1?0:P+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(Ir,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Ir,{className:"h-10 w-48 mb-6"}),r.jsx(Ir,{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(Ir,{className:"h-12 w-48"}),r.jsx(Ir,{className:"h-6 w-full"}),r.jsx(Ir,{className:"h-6 w-3/4"})]}),r.jsx(Ir,{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(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:ete,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(da,{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(ee,{asChild:!0,children:r.jsx(co,{to:"/public/listings",children:"Browse All Listings"})})]})]});const ye=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(Sm,{children:[r.jsxs("title",{children:[ye," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${l4[n.property_type]} in ${n.city}, ${n.state}. ${((ae=n.description)==null?void 0:ae.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:ye}),r.jsx("meta",{property:"og:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${l4[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}`}),te&&r.jsx("meta",{property:"og:image",content:te.photo_url}),te&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${l4[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:ye}),r.jsx("meta",{name:"twitter:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),te&&r.jsx("meta",{name:"twitter:image",content:te.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||`${l4[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:G.map(ue=>ue.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:(pe=n.agent.brokerage)!=null&&pe.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(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:ete,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(co,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),G.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:()=>z(0),children:r.jsx("img",{src:te==null?void 0:te.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${l4[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:G.slice(1,5).map((ue,_e)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>z(_e+1),children:[r.jsx("img",{src:ue.photo_url,alt:`${n.property_address||n.city} - Photo ${_e+2} of ${G.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),_e===3&&G.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",G.length-5," more"]})]},ue.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(Ot,{className:`${oft[n.status]} text-white border-0`,children:lft[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:V(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(Mo,{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(h1,{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(u1,{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(kg,{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(Os,{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(Ot,{variant:"secondary",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),l4[n.property_type]]}),n.lot_size&&r.jsxs(Ot,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Ot,{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(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{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(Pa,{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(fc,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(ee,{onClick:()=>q(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(fc,{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(Gt,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Ic,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((se=n.agent.brokerage)==null?void 0:se.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(Ye,{className:"border-primary",children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Je,{children:E?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(ua,{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(He,{htmlFor:"firstName",children:"First Name *"}),r.jsx(dt,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:ue=>h(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lastName",children:"Last Name"}),r.jsx(dt,{id:"lastName",type:"text",placeholder:"Doe",value:p,onChange:ue=>x(ue.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:ue=>_(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:j,onChange:ue=>C(ue.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:N,children:N?"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(Fr,{open:P!==null,onOpenChange:()=>z(null),children:r.jsxs(Rr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(qr,{className:"sr-only",children:r.jsx($r,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>z(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(_s,{className:"h-5 w-5"})}),P!==null&&G[P]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:G[P].photo_url,alt:`Photo ${P+1}`,className:"w-full max-h-[80vh] object-contain"}),G.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:ie,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(Ac,{className:"h-6 w-6"})}),r.jsx("button",{onClick:oe,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(Vi,{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:[P+1," / ",G.length]})]})]})]})}),r.jsx(Fr,{open:F,onOpenChange:q,children:r.jsxs(Rr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(qr,{className:"sr-only",children:r.jsx($r,{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(_s,{className:"h-5 w-5"})}),((he=n==null?void 0:n.video)==null?void 0:he.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 dft(){var o;const{slug:t}=Yc(),{data:e,isLoading:n,error:s}=yLe(t);if(I.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),I.useEffect(()=>{e!=null&&e.id&&Ti(e.id,"card_view")},[e==null?void 0:e.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Ir,{className:"h-28 w-28 rounded-full"}),r.jsx(Ir,{className:"h-6 w-48"}),r.jsx(Ir,{className:"h-4 w-36"})]}),r.jsx(Ir,{className:"h-12 w-full"}),r.jsx(Ir,{className:"h-12 w-full"})]})});if(s||!e)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const a=((o=e.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(Sm,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:e.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:e.positioning_statement||`Connect with ${a}`}),e.avatar_url&&r.jsx("meta",{property:"og:image",content:e.avatar_url})]}),r.jsx(Oge,{card:e})]})}function BM({banners:t,autoPlayInterval:e=5e3,className:n}){const[s,a]=I.useState(0),[o,l]=I.useState(!1),i=I.useCallback(()=>{a(y=>(y+1)%t.length)},[t.length]),h=I.useCallback(()=>{a(y=>(y-1+t.length)%t.length)},[t.length]),p=I.useCallback(y=>{a(y)},[]);if(I.useEffect(()=>{if(t.length<=1||o)return;const y=setInterval(i,e);return()=>clearInterval(y)},[t.length,o,e,i]),!t||t.length===0)return null;const x=t[s];return r.jsxs("div",{className:zt("relative w-full overflow-hidden rounded-xl",n),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!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:x.image_url,alt:x.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:x.title}),x.description&&r.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:x.description}),x.link_url&&r.jsx("a",{href:x.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:r.jsx(ee,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:x.link_text||"Learn More"})})]}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{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:h,children:r.jsx(Ac,{className:"h-6 w-6"})}),r.jsx(ee,{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:i,children:r.jsx(Vi,{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((y,_)=>r.jsx("button",{onClick:()=>p(_),className:zt("w-2 h-2 rounded-full transition-all duration-300",_===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${_+1}`},_))})]})}function uft(t){return"EST"}function iE(t){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(t),s=uft();return`${n} ${s}`}function AS(t){const e=new Date,n=new Date(t),s=Xje(n,-15),a=Xje(n,30);return e>a?"ended":ske(e,{start:n,end:a})?"live":ske(e,{start:s,end:n})?"starting_soon":"upcoming"}function fxe(t){const e=AS(t);return e==="starting_soon"||e==="live"}const mke=fxe,hft=({events:t,registrations:e,onNavigateToEvents:n})=>{const[s,a]=I.useState(new Date);I.useEffect(()=>{const j=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(j)},[]);const o=t.filter(j=>fxe(j.event_date));if(o.length===0)return null;const l=o[0],i=AS(l.event_date),h=e.find(j=>j.event_id===l.id),p=(h==null?void 0:h.zoom_join_url)||l.zoom_link,x=!!h,y=i==="live",_=y?{container:"from-red-500/10 via-red-500/5 to-primary/10 border-red-500/30",pulse:"from-red-500/5",indicator:"bg-red-500",text:"text-red-500",button:"bg-red-500 hover:bg-red-600",outlineButton:"border-red-500/50 text-red-500 hover:bg-red-500/10"}:{container:"from-amber-500/10 via-amber-500/5 to-primary/10 border-amber-500/30",pulse:"from-amber-500/5",indicator:"bg-amber-500",text:"text-amber-500",button:"bg-amber-500 hover:bg-amber-600",outlineButton:"border-amber-500/50 text-amber-500 hover:bg-amber-500/10"};return r.jsxs("div",{className:`relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r ${_.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${_.pulse} 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 ${_.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${_.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${_.text} font-bold text-sm uppercase tracking-wider`,children:y?r.jsxs(r.Fragment,{children:[r.jsx(wj,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ya,{className:"h-4 w-4"}),"Starting Soon"]})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:l.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:y?`Started at ${iE(new Date(l.event_date))}`:`Starts at ${iE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(ee,{onClick:()=>window.open(p,"_blank"),className:`${_.button} text-white gap-2`,children:[r.jsx(Ls,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(ee,{variant:"outline",onClick:n,className:`${_.outlineButton} gap-2`,children:[r.jsx(Bn,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var pxe="Progress",mxe=100,[fft]=rc(pxe),[pft,mft]=fft(pxe),s8e=I.forwardRef((t,e)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:o=gft,...l}=t;(a||a===0)&&!gke(a)&&console.error(xft(`${a}`,"Progress"));const i=gke(a)?a:mxe;s!==null&&!xke(s,i)&&console.error(yft(`${s}`,"Progress"));const h=xke(s,i)?s:null,p=gte(h)?o(h,i):void 0;return r.jsx(pft,{scope:n,value:h,max:i,children:r.jsx(Rn.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":gte(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":o8e(h,i),"data-value":h??void 0,"data-max":i,...l,ref:e})})});s8e.displayName=pxe;var a8e="ProgressIndicator",i8e=I.forwardRef((t,e)=>{const{__scopeProgress:n,...s}=t,a=mft(a8e,n);return r.jsx(Rn.div,{"data-state":o8e(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:e})});i8e.displayName=a8e;function gft(t,e){return`${Math.round(t/e*100)}%`}function o8e(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function gte(t){return typeof t=="number"}function gke(t){return gte(t)&&!isNaN(t)&&t>0}function xke(t,e){return gte(t)&&!isNaN(t)&&t<=e&&t>=0}function xft(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${mxe}\`.`}function yft(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 ${mxe} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var l8e=s8e,vft=i8e;const Zc=I.forwardRef(({className:t,value:e,...n},s)=>r.jsx(l8e,{ref:s,className:zt("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:r.jsx(vft,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Zc.displayName=l8e.displayName;function _ft(){const{user:t,isBrokerageManager:e}=Xr(),[n,s]=I.useState([]),[a,o]=I.useState([]),[l,i]=I.useState(!1),[h,p]=I.useState(!0),x=e?"brokerage_manager":"agent";I.useEffect(()=>{if(!(t!=null&&t.id)){p(!1);return}y()},[t==null?void 0:t.id,x]);const y=async()=>{if(t!=null&&t.id)try{const{data:z,error:F}=await J.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(F)throw F;const{data:q,error:V}=await J.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",t.id);if(V)throw V;const{data:K,error:G}=await J.from("onboarding_checklist_dismissed").select("id").eq("user_id",t.id).maybeSingle();if(G)throw G;s(z||[]),o(q||[]),i(!!K),z&&z.length>0&&await _(z,q||[])}catch(z){console.error("Error fetching checklist data:",z)}finally{p(!1)}},_=async(z,F)=>{var Ue,Fe;if(!(t!=null&&t.id))return;const q=F.map(be=>be.item_id),V=z.filter(be=>!q.includes(be.id));if(V.length===0)return;const[K,G,te,ie,oe,ye,ae,pe,se,he,ue,_e,Ae,Ce,Se]=await Promise.all([J.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle(),J.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",t.id),J.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",t.id),J.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",t.id),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","template"),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","academy_video"),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","toolbox"),J.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),J.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",t.id),J.from("innercircle_contacts").select("id").eq("owner_user_id",t.id),J.from("deal_pipeline").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id)]),ge={},Le=(Ue=K.data)==null?void 0:Ue.brokerage_id;ge.share_resource=(G.count||0)>0,ge.post_community=(te.count||0)>0,ge.register_event=(ie.count||0)>0,ge.view_template=(oe.count||0)>0,ge.watch_academy=(ye.count||0)>0,ge.use_toolbox=(ae.count||0)>0,ge.launch_app=(pe.count||0)>0,ge.add_contact=(se.count||0)>0,ge.create_video=(he.count||0)>0,ge.complete_touch=(ue.count||0)>0,ge.add_transaction=(_e.count||0)>0,ge.add_listing=(Ae.count||0)>0,ge.add_deal=(Se.count||0)>0;const ke=((Fe=Ce.data)==null?void 0:Fe.map(be=>be.id))||[],Be=[];Le?Be.push(J.from("profiles").select("id").eq("brokerage_id",Le).neq("id",t.id).then(be=>{var tt;ge.add_agent=(((tt=be.data)==null?void 0:tt.length)||0)>0})):ge.add_agent=!1,ke.length>0?(Be.push(J.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",ke).then(be=>{ge.add_plan=(be.count||0)>0})),Be.push(J.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",ke).then(be=>{ge.schedule_popby=(be.count||0)>0}))):(ge.add_plan=!1,ge.schedule_popby=!1),await Promise.all(Be);const Ee=V.filter(be=>ge[be.action_type]);if(Ee.length>0){const be=Ee.map(Te=>({user_id:t.id,item_id:Te.id})),{error:tt}=await J.from("onboarding_checklist_progress").upsert(be,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!tt){const Te=Ee.map(Ke=>({item_id:Ke.id,completed_at:new Date().toISOString()}));o(Ke=>[...Ke,...Te])}}},j=async z=>{if(t!=null&&t.id)try{const{error:F}=await J.from("onboarding_checklist_progress").insert({user_id:t.id,item_id:z});if(F)throw F;o(q=>[...q,{item_id:z,completed_at:new Date().toISOString()}])}catch(F){console.error("Error marking item complete:",F)}},C=async()=>{if(t!=null&&t.id)try{const{error:z}=await J.from("onboarding_checklist_dismissed").insert({user_id:t.id});if(z)throw z;i(!0)}catch(z){console.error("Error dismissing checklist:",z)}},N=a.length,A=n.length,E=A>0&&N>=A,T=A>0?N/A*100:0;return{items:n,progress:a,isDismissed:l,loading:h,completedCount:N,totalCount:A,isComplete:E,progressPercentage:T,isItemComplete:z=>a.some(F=>F.item_id===z),markComplete:j,dismiss:C,refetch:y}}const bft={add_agent:r.jsx(Bn,{className:"h-4 w-4"}),share_resource:r.jsx(pc,{className:"h-4 w-4"}),post_community:r.jsx(Oo,{className:"h-4 w-4"}),register_event:r.jsx(Os,{className:"h-4 w-4"}),view_template:r.jsx(_0,{className:"h-4 w-4"}),watch_academy:r.jsx(_1,{className:"h-4 w-4"}),use_toolbox:r.jsx(Zx,{className:"h-4 w-4"}),launch_app:r.jsx(ST,{className:"h-4 w-4"}),add_deal:r.jsx(Hx,{className:"h-4 w-4"}),add_listing:r.jsx(da,{className:"h-4 w-4"})},wft={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function jft(){const{items:t,isDismissed:e,loading:n,completedCount:s,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:h,dismiss:p}=_ft(),x=Zn(),[y,_]=I.useState(!0);return n||e||a===0||o?null:r.jsxs(Ye,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Gt,{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(_g,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{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(ee,{variant:"ghost",size:"sm",onClick:()=>_(!y),className:"h-8 w-8 p-0",children:y?r.jsx(f1,{className:"h-4 w-4"}):r.jsx(Fd,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(_s,{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 ",a," complete"]})]}),r.jsx(Zc,{value:l,className:"h-2"})]})]}),y&&r.jsx(Je,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:t.map(j=>{const C=i(j.id);return r.jsxs("div",{className:zt("flex items-start gap-3 p-3 rounded-lg transition-colors",C?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>{if(C)return;const N=wft[j.action_type];N?x(N):h(j.id)},children:[r.jsx("div",{className:"mt-0.5",children:C?r.jsx(Xi,{className:"h-5 w-5 text-primary"}):r.jsx(Bu,{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:bft[j.action_type]||r.jsx(Bu,{className:"h-4 w-4"})}),r.jsx("span",{className:zt("font-medium",C&&"line-through text-muted-foreground"),children:j.title})]}),j.description&&r.jsx("p",{className:zt("text-sm text-muted-foreground mt-1",C&&"line-through"),children:j.description})]})]},j.id)})})})]})}const Mm=()=>Yt({queryKey:["relationship-types"],queryFn:async()=>{const{data:t,error:e}=await J.from("relationship_types").select("*").order("sort_order");if(e)throw e;return t}}),dp=t=>{const e=Lc(),n=1e3,s=async a=>{const o=[];let l=0;for(;;){const{data:i,error:h}=await a.range(l,l+n-1);if(h)throw h;const p=i??[];if(o.push(...p),p.length{let a=J.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(a)},enabled:!!e})},kft=t=>Yt({queryKey:["innercircle-contact",t],queryFn:async()=>{const{data:e,error:n}=await J.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}),c8e=()=>{const t=Lc();return Yt({queryKey:["innercircle-contact-counts",t],queryFn:async()=>{const{data:e,error:n}=await J.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return e==null||e.forEach(a=>{var o;(o=a.tags)==null||o.forEach(l=>{s[l.relationship_type_id]=(s[l.relationship_type_id]||0)+1})}),s},enabled:!!t})},gxe=()=>{const t=Vr(),e=Lc();return cr({mutationFn:async n=>{const{tagIds:s,...a}=n,o={...a,birthday:a.birthday||null,home_anniversary:a.home_anniversary||null,owner_user_id:e},{data:l,error:i}=await J.from("innercircle_contacts").insert(o).select().single();if(i)throw i;if(s&&s.length>0){const{error:h}=await J.from("innercircle_contact_tags").insert(s.map(p=>({contact_id:l.id,relationship_type_id:p})));if(h)throw h}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:"Contact created successfully"})},onError:n=>{ma({title:"Error creating contact",description:n.message,variant:"destructive"})}})},d8e=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{tagIds:s,tags:a,...o}=n,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:i,error:h}=await J.from("innercircle_contacts").update(l).eq("id",e).select().single();if(h)throw h;if(s!==void 0&&(await J.from("innercircle_contact_tags").delete().eq("contact_id",e),s.length>0)){const{error:p}=await J.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:e,relationship_type_id:x})));if(p)throw p}return i},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:"Contact updated successfully"})},onError:e=>{ma({title:"Error updating contact",description:e.message,variant:"destructive"})}})},xxe=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("innercircle_contacts").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:"Contact deleted successfully"})},onError:e=>{ma({title:"Error deleting contact",description:e.message,variant:"destructive"})}})},yxe=()=>Yt({queryKey:["action-types"],queryFn:async()=>{const{data:t,error:e}=await J.from("action_types").select("*").order("sort_order");if(e)throw e;return t}}),Nft=t=>Yt({queryKey:["action-scripts",t],queryFn:async()=>{let e=J.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await e;if(s)throw s;return n}}),Sft=()=>Yt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:t,error:e}=await J.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(e)throw e;return t}}),Cft=()=>{const t=Vr(),e=Lc();return cr({mutationFn:async({name:n,description:s})=>{const{data:a,error:o}=await J.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:e,active:!0,is_template:!1}).select().single();if(o)throw o;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan created successfully"})},onError:n=>{ma({title:"Error creating plan",description:n.message,variant:"destructive"})}})},Mft=()=>{const t=Vr(),e=Lc();return cr({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:a,error:o}=await J.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!a)throw new Error("Source plan not found");const{data:l,error:i}=await J.from("touchpoint_plans").insert({name:s,description:a.description,owner_user_id:e,active:!0,is_template:!1}).select().single();if(i)throw i;if(a.items&&a.items.length>0){const h=a.items.map(x=>({plan_id:l.id,month_number:x.month_number,action_type_id:x.action_type_id,default_script_id:x.default_script_id,notes:x.notes})),{error:p}=await J.from("touchpoint_plan_items").insert(h);if(p)throw p}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{ma({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},Tft=()=>{const t=Vr();return cr({mutationFn:async({id:e,name:n,description:s})=>{const{data:a,error:o}=await J.from("touchpoint_plans").update({name:n,description:s}).eq("id",e).select().single();if(o)throw o;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan updated successfully"})}})},Aft=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("touchpoint_plans").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan deleted successfully"})}})},Eft=()=>{const t=Vr();return cr({mutationFn:async({planId:e,items:n})=>{if(await J.from("touchpoint_plan_items").delete().eq("plan_id",e),n.length>0){const{error:s}=await J.from("touchpoint_plan_items").insert(n.map(a=>({plan_id:e,month_number:a.month_number,action_type_id:a.action_type_id,default_script_id:a.default_script_id||null,notes:a.notes})));if(s)throw s}},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan schedule updated"})}})},Ift=()=>{const t=Vr();return cr({mutationFn:async({actionTypeId:e,title:n,scriptBody:s,emailSubject:a,tone:o})=>{const{data:l,error:i}=await J.from("action_scripts").insert({action_type_id:e,title:n,script_body:s,email_subject:a||null,tone:o||null,active:!0}).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["action-scripts"]}),ma({title:"Script created successfully"})},onError:e=>{ma({title:"Error creating script",description:e.message,variant:"destructive"})}})},Pft=()=>{const t=Lc();return Yt({queryKey:["user-plan-enrollments",t],queryFn:async()=>{const{data:e,error:n}=await J.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return e},enabled:!!t})},Lft=()=>{const t=Vr(),e=Lc();return cr({mutationFn:async({planId:n,relationshipTypeId:s,active:a})=>{const{data:o}=await J.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await J.from("user_plan_enrollments").update({active:a}).eq("id",o.id);if(l)throw l}else if(a){const{error:l}=await J.from("user_plan_enrollments").insert({owner_user_id:e,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{t.invalidateQueries({queryKey:["user-plan-enrollments"]}),ma({title:"Plan enrollment updated"})}})},yse=(t=7)=>{const e=Lc();return Yt({queryKey:["contact-touch-logs",e,t],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-t);const{data:s,error:a}=await J.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(a)throw a;return s},enabled:!!e})},u8e=()=>{const t=Lc();return Yt({queryKey:["contacts-last-touch",t],queryFn:async()=>{const{data:e,error:n}=await J.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(a=>{s[a.contact_id]||(s[a.contact_id]=a.completed_at)}),s},enabled:!!t})},Oft=(t=90)=>{const{data:e}=dp(),{data:n}=u8e();if(!e||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-t);const a=e.filter(o=>{const l=n[o.id];return l?new Date(l){const t=Vr(),e=Lc();return cr({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await J.from("contact_touch_logs").insert({owner_user_id:e,contact_id:n,action_type_id:s,script_used_id:a,notes:o,completed_at:new Date().toISOString()}).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts-last-touch"]}),t.invalidateQueries({queryKey:["today-actions"]}),ma({title:"Action completed!"})}})},f8e="agentos_weekly_touch_goal",yke=20,xte=()=>{if(typeof window>"u")return yke;const t=localStorage.getItem(f8e);if(t){const e=parseInt(t,10);if(!isNaN(e)&&e>0)return e}return yke},p8e=t=>{localStorage.setItem(f8e,t.toString())},m8e=()=>{const{data:t}=yse(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(l=>new Date(l.completed_at)>=n).length)||0;let a=0;if(t&&t.length>0){const l=new Set(t.map(h=>new Date(h.completed_at).toDateString()));let i=new Date(e);for(;l.has(i.toDateString());)a++,i.setDate(i.getDate()-1)}const o=xte();return{actionsThisWeek:s,weeklyGoal:o,streak:a,progress:Math.min(s/o*100,100)}},Dft=()=>{const t=Lc();return Yt({queryKey:["contact-plan-cycles",t],queryFn:async()=>{const{data:e,error:n}=await J.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})},Rft=()=>{const t=Vr();return Lc(),cr({mutationFn:async()=>{const{data:e}=await J.from("user_plan_enrollments").select("*").eq("active",!0);if(!e||e.length===0)return;const{data:n}=await J.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!n)return;const{data:s}=await J.from("contact_plan_cycles").select("contact_id, plan_id"),a=new Set((s==null?void 0:s.map(l=>`${l.contact_id}-${l.plan_id}`))||[]),o=[];for(const l of n)for(const i of l.tags||[]){const h=e.find(p=>p.relationship_type_id===i.relationship_type_id);h&&!a.has(`${l.id}-${h.plan_id}`)&&o.push({contact_id:l.id,plan_id:h.plan_id,relationship_type_id:i.relationship_type_id})}if(o.length>0){const{error:l}=await J.from("contact_plan_cycles").insert(o);if(l)throw l}return o.length},onSuccess:e=>{t.invalidateQueries({queryKey:["contact-plan-cycles"]}),e&&e>0&&ma({title:`${e} contact(s) enrolled in plans`})}})},g8e=()=>{const t=Lc(),{data:e}=Dft(),{data:n}=yse(30);return Yt({queryKey:["today-actions",t,e==null?void 0:e.length,n==null?void 0:n.length],queryFn:async()=>{var _;if(!e||e.length===0)return[];const s=new Date,a=[],o=new Date(s.getFullYear(),s.getMonth(),1),l=new Set((n==null?void 0:n.filter(j=>new Date(j.completed_at)>=o).map(j=>`${j.contact_id}-${j.action_type_id}`))||[]);for(const j of e){if(!((_=j.plan)!=null&&_.items)||j.plan.items.length===0||!j.contact)continue;const C=new Date(j.cycle_start_date),A=Math.floor((s.getTime()-C.getTime())/(30.44*24*60*60*1e3))%12+1,E=j.plan.items.find(T=>T.month_number===A);if(E&&E.action_type){const T=`${j.contact_id}-${E.action_type_id}`;if(!l.has(T)){const{data:P}=await J.from("relationship_types").select("name").eq("id",j.relationship_type_id).single();a.push({contact:j.contact,actionType:E.action_type,script:E.default_script||void 0,planName:j.plan.name,relationshipTypeName:(P==null?void 0:P.name)||"",monthNumber:A})}}}const i=5,h=s.getDate(),p=a.sort((j,C)=>j.contact.first_name.localeCompare(C.contact.first_name)),x=(h-1)%Math.max(1,p.length);return[...p.slice(x),...p.slice(0,x)].slice(0,i)},enabled:!!t&&!!e})};function Fft(){const t=Zn(),{data:e,isLoading:n}=g8e(),{data:s}=dp(),a=m8e(),[o,l]=I.useState(xte()),[i,h]=I.useState(""),[p,x]=I.useState(!1);I.useEffect(()=>{l(xte())},[]);const y=()=>{const q=parseInt(i,10);if(isNaN(q)||q<1){ma({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(q),p8e(q),x(!1),ma({title:"Goal updated",description:`Weekly touch goal set to ${q}`})},_=()=>{h(o.toString()),x(!0)},j=hf(new Date),C=Kl(j,7),N=q=>{if(!q)return null;const V=new Date(q);return new Date(j.getFullYear(),V.getMonth(),V.getDate())},A=(s==null?void 0:s.map(q=>{const V=N(q.birthday),K=N(q.home_anniversary),G=[];return V&&V>=j&&V<=C&&G.push({contact:q,type:"birthday",date:V,isToday:Jl(V,j)}),K&&K>=j&&K<=C&&G.push({contact:q,type:"anniversary",date:K,isToday:Jl(K,j)}),G}).flat().sort((q,V)=>q.date.getTime()-V.date.getTime()).slice(0,3))||[],E=(s==null?void 0:s.filter(q=>{const V=N(q.birthday),K=N(q.home_anniversary);return V&&Jl(V,j)||K&&Jl(K,j)}).length)||0,T=(e==null?void 0:e.length)||0,P=E+T,z=(a==null?void 0:a.actionsThisWeek)||0,F=(a==null?void 0:a.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(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:F>0&&r.jsxs(Ot,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(ef,{className:"h-3 w-3"}),F," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[P>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[P," tasks"]})," for today"]}):"No tasks for today",z>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:z})," touches this week"]})]})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control/contacts?new=true")},children:[r.jsx(sf,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control")},children:[r.jsx(bi,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(ee,{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("/mission-control/video/record")},children:[r.jsx(Pa,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control/popbys")},children:[r.jsx(Mo,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(ee,{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("/mission-control/pipeline")},children:[r.jsx(Hx,{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(Kx,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Fr,{open:p,onOpenChange:x,children:[r.jsx(Bo,{asChild:!0,children:r.jsx("button",{onClick:_,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(md,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Rr,{className:"sm:max-w-[360px]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Set Weekly Goal"}),r.jsx(Qn,{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(He,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(dt,{id:"weekly-goal",type:"number",min:"1",value:i,onChange:q=>h(q.target.value),placeholder:"20",onKeyDown:q=>{q.key==="Enter"&&y()}})]}),r.jsx(ee,{onClick:y,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:z}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(Zc,{value:Math.min(z/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),z>=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."]}),z0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-z," more to hit your weekly goal"]})]}),A.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(Jh,{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:A.map((q,V)=>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(`/mission-control/contacts/${q.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[q.type==="birthday"?r.jsx(Jh,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(da,{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(Ot,{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"?"🎂":"🏠":xn(q.date,"EEE, MMM d")}),r.jsx(Vi,{className:"h-3 w-3"})]})]},`${q.contact.id}-${q.type}-${V}`))})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>t("/mission-control"),children:["Open Agent OS",r.jsx(hl,{className:"h-4 w-4"})]})]})]})}const x8e=()=>Yt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:t,error:e}=await J.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(e)throw e;return(t==null?void 0:t.enabled)??!1}}),y8e=t=>{const{user:e,brokerageId:n}=Xr();return Yt({queryKey:["listings",t,n],queryFn:async()=>{let s=J.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:a,error:o}=await s;if(o)throw o;let l=a||[];if(n){const{data:i}=await J.from("profiles").select("id").eq("brokerage_id",n);if(i&&i.length>0){const h=i.map(y=>y.id);let p=J.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",h);t!=null&&t.status&&(p=p.eq("status",t.status)),t!=null&&t.propertyType&&(p=p.eq("property_type",t.propertyType)),t!=null&&t.city&&(p=p.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(p=p.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(p=p.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(p=p.eq("open_to_referrals",!0));const{data:x}=await p;if(x){const y=new Set(l.map(j=>j.id)),_=x.filter(j=>!y.has(j.id));l=[...l,..._]}}}switch(t==null?void 0:t.sortBy){case"updated":l.sort((i,h)=>new Date(h.updated_at).getTime()-new Date(i.updated_at).getTime());break;case"price_asc":l.sort((i,h)=>i.price-h.price);break;case"price_desc":l.sort((i,h)=>h.price-i.price);break;default:l.sort((i,h)=>new Date(h.created_at).getTime()-new Date(i.created_at).getTime())}return l}})},v8e=()=>{const{user:t}=Xr();return Yt({queryKey:["my-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})},_8e=t=>{const{user:e}=Xr();return Yt({queryKey:["listing",t],queryFn:async()=>{const{data:n,error:s}=await J.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 J.from("listing_views").insert({listing_id:t,viewer_id:e.id}),n},enabled:!!t})},zft=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:a}=await J.from("listings").insert({...n,agent_id:e.id}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Bft=()=>{const t=Vr();return cr({mutationFn:async({agentId:e,...n})=>{const{data:s,error:a}=await J.from("listings").insert({...n,agent_id:e}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["brokerage-listings"]})}})},$ft=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("listings").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:e=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["listing",e.id]})}})},b8e=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("listings").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Uft=()=>{const t=Vr();return cr({mutationFn:async({listingId:e,photoUrl:n,isPrimary:s=!1})=>{const{data:a,error:o}=await J.from("listing_photos").insert({listing_id:e,photo_url:n,is_primary:s}).select().single();if(o)throw o;return a},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e.listing_id]}),t.invalidateQueries({queryKey:["my-listings"]})}})},qft=()=>{const t=Vr();return cr({mutationFn:async({photoId:e,listingId:n})=>{const{error:s}=await J.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"]})}})},Vft=()=>{const{user:t}=Xr();return Yt({queryKey:["saved-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.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})},w8e=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await J.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await J.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await J.from("listing_saves").insert({listing_id:n,agent_id:e.id}),{saved:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["saved-listings"]}),t.invalidateQueries({queryKey:["listings"]})}})},j8e=t=>{const{user:e}=Xr();return Yt({queryKey:["listing-saved",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await J.from("listing_saves").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Hft=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await J.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await J.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await J.from("listing_follows").insert({listing_id:n,agent_id:e.id}),{following:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-following"]})}})},Wft=t=>{const{user:e}=Xr();return Yt({queryKey:["listing-following",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await J.from("listing_follows").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Gft=()=>{const{user:t}=Xr();return cr({mutationFn:async({listingId:e,shareType:n})=>{if(!t)throw new Error("Not authenticated");const{error:s}=await J.from("listing_shares").insert({listing_id:e,sharing_agent_id:t.id,share_type:n});if(s)throw s}})},Kft=()=>{const{user:t}=Xr();return Yt({queryKey:["my-referrals",t==null?void 0:t.id],queryFn:async()=>{if(!t)return{sent:[],received:[]};const[e,n]=await Promise.all([J.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",t.id).order("created_at",{ascending:!1}),J.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})},Zft=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async({listingId:n,listingAgentId:s,buyerName:a,buyerType:o,notes:l})=>{if(!e)throw new Error("Not authenticated");const{data:i,error:h}=await J.from("listing_referrals").insert({listing_id:n,sender_agent_id:e.id,listing_agent_id:s,buyer_name:a,buyer_type:o,notes:l}).select().single();if(h)throw h;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["my-referrals"]})}})},Yft=()=>Yt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:t}=await J.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(l=>{var p;const i=l.sharing_agent_id;if(!i)return;const h=e.get(i);h?h.count++:e.set(i,{name:((p=l.profiles)==null?void 0:p.name)||"Unknown",count:1})});const n=Array.from(e.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10),{data:s}=await J.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),a=new Map;s==null||s.forEach(l=>{var h;const i=a.get(l.agent_id);i?i.count++:a.set(l.agent_id,{name:((h=l.agent)==null?void 0:h.name)||"Unknown",count:1})});const o=Array.from(a.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10);return{topSharers:n,topListers:o}}}),Xft=()=>{const{user:t,brokerageId:e}=Xr();return Yt({queryKey:["brokerage-listings",e],queryFn:async()=>{if(!t||!e)return[];const{data:n}=await J.from("profiles").select("id").eq("brokerage_id",e);if(!n||n.length===0)return[];const s=n.map(l=>l.id),{data:a,error:o}=await J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).in("agent_id",s).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return a},enabled:!!t&&!!e})},Qft=({className:t,variant:e="default"})=>r.jsx(Ot,{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"}),Jft={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"},ept={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function tpt(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function rpt(){const t=Zn(),{data:e,isLoading:n}=x8e(),{data:s,isLoading:a}=y8e({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(x=>x.is_approved&&x.is_public))||[],l=o.filter(x=>x.is_featured),i=o.filter(x=>!x.is_featured),h=[...l,...i].slice(0,6),p=n||a;return!p&&!e?null:p?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(Qft,{})]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{className:"h-4 w-4"})]})]}),h.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(da,{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(ee,{variant:"link",size:"sm",onClick:()=>t("/mission-control/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:h.map(x=>{var _,j;const y=((_=x.photos)==null?void 0:_.find(C=>C.is_primary))||((j=x.photos)==null?void 0:j[0]);return r.jsxs("div",{onClick:()=>t(`/mission-control/listings/${x.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:[y!=null&&y.photo_url?r.jsx("img",{src:y.photo_url,alt:`${x.city}, ${x.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(da,{className:"h-8 w-8 text-muted-foreground/50"})}),x.is_featured&&r.jsx("div",{className:"absolute top-1.5 left-1.5",children:r.jsxs(Ot,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(vs,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Ot,{className:`text-[10px] px-1.5 py-0.5 ${Jft[x.status]}`,children:ept[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:tpt(x.price)}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[x.city,", ",x.state]}),(x.bedrooms||x.bathrooms)&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[x.bedrooms&&`${x.bedrooms} bed`,x.bedrooms&&x.bathrooms&&" · ",x.bathrooms&&`${x.bathrooms} bath`]})]})]},x.id)})})]})}function k8e(t=10,e){return Yt({queryKey:["event-leaderboard",t,e],queryFn:async()=>{const{data:n}=await J.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(_=>_.user_id))||[]);let a=null;if(e){const{data:_}=await J.from("profiles").select("id").eq("brokerage_id",e);a=new Set((_==null?void 0:_.map(j=>j.id))||[])}const{data:o,error:l}=await J.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(l)throw l;if(!o||o.length===0)return[];let i=o.filter(_=>!s.has(_.user_id));a&&(i=i.filter(_=>a.has(_.user_id)));const h=i.slice(0,t),p=h.map(_=>_.user_id),{data:x}=await J.from("profiles").select("id, name").in("id",p),y=new Map((x==null?void 0:x.map(_=>[_.id,{name:_.name}]))||[]);return h.map(_=>({user_id:_.user_id,total_points:_.total_points,total_events_attended:_.total_events_attended,current_streak:_.current_streak,profile:y.get(_.user_id)||null}))}})}function N8e(t){return Yt({queryKey:["user-attendance-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("agent_attendance_stats").select("*").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return e},enabled:!!t})}function S8e(t){return Yt({queryKey:["user-badges",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("agent_badges").select("*").eq("user_id",t).order("earned_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function C8e(t,e){return Yt({queryKey:["user-rank",t,e],queryFn:async()=>{if(!t)return null;const{data:n}=await J.from("agent_attendance_stats").select("total_points").eq("user_id",t).single();if(!n)return null;const{data:s}=await J.from("user_roles").select("user_id").eq("role","admin"),a=new Set((s==null?void 0:s.map(h=>h.user_id))||[]),{data:o,error:l}=await J.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(l)throw l;let i=(o==null?void 0:o.filter(h=>!a.has(h.user_id)))||[];if(e){const{data:h}=await J.from("profiles").select("id").eq("brokerage_id",e),p=new Set((h==null?void 0:h.map(x=>x.id))||[]);i=i.filter(x=>p.has(x.user_id))}return i.length+1},enabled:!!t})}function npt(){const{user:t,brokerageId:e,isAdmin:n}=Xr();Zn();const s=!!e,[a,o]=I.useState("brokerage"),l=()=>{if(n)return null;if(s)return a==="global"?null:e},{data:i,isLoading:h}=k8e(5,l()),{data:p}=N8e(t==null?void 0:t.id),{data:x}=C8e(t==null?void 0:t.id,l()),{data:y}=S8e(t==null?void 0:t.id),_=n||s,j=()=>n?"Agent Leaderboard":s?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(h)return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4 text-yellow-500"}),j()]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-2",children:[...Array(_?5:3)].map((N,A)=>r.jsx(Ir,{className:"h-10 w-full"},A))})})]});const C=N=>N===0?r.jsx(Zi,{className:"h-4 w-4 text-yellow-500 mx-auto"}):N===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):N===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:N+1});if(_){const N=(i==null?void 0:i.slice(0,5))||[];return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4 text-yellow-500"}),j()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(ee,{variant:a==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(ee,{variant:a==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(Je,{children:[!n&&p&&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:["#",x||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:p.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:p.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[N.map((A,E)=>{var T,P,z;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${A.user_id===(t==null?void 0:t.id)?"bg-primary/10 border border-primary/20":E===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:C(E)}),r.jsx(Ks,{className:"h-6 w-6",children:r.jsx(Zs,{className:"text-xs",children:((P=(T=A.profile)==null?void 0:T.name)==null?void 0:P.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((z=A.profile)==null?void 0:z.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:A.total_points})]},A.user_id)}),N.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(co,{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(Ki,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Vi,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(Je,{children:p?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:p.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:p.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(ef,{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:[p.current_streak," 🔥"]})]}),y&&y.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(Ol,{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:[y.slice(0,4).map(N=>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:N.badge_name},N.id)),y.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),r.jsxs(co,{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(Ki,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Vi,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(vs,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(co,{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(Ki,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Vi,{className:"h-4 w-4"})]})]})})]})}const vse=()=>Yt({queryKey:["lead-sources"],queryFn:async()=>{const{data:t,error:e}=await J.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}}),spt=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("lead_sources").insert({name:n,owner_user_id:e==null?void 0:e.id,sort_order:100}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["lead-sources"]}),ze.success("Lead source added")},onError:n=>{ze.error("Failed to add lead source"),console.error(n)}})},vxe=(t,e)=>{const{user:n,isAdmin:s}=Xr(),a=s&&e?e:n==null?void 0:n.id;return Yt({queryKey:["scorecard-transactions",t,a],queryFn:async()=>{let o=J.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",a).order("close_date",{ascending:!1});t&&(o=o.gte("close_date",`${t}-01-01`).lte("close_date",`${t}-12-31`));const{data:l,error:i}=await o;if(i)throw i;return l},enabled:!!a})},M8e=t=>{const{user:e,isAdmin:n}=Xr(),s=n&&t?t:e==null?void 0:e.id;return Yt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:a,error:o}=await J.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 a},enabled:!!s})},_se=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("scorecard_transactions").insert({...n,owner_user_id:e.id}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction added")},onError:n=>{ze.error("Failed to add transaction"),console.error(n)}})},apt=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("scorecard_transactions").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction updated")},onError:e=>{ze.error("Failed to update transaction"),console.error(e)}})},ipt=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("scorecard_transactions").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction deleted")},onError:e=>{ze.error("Failed to delete transaction"),console.error(e)}})},T8e=(t,e)=>{const{user:n,isAdmin:s}=Xr(),a=s&&e?e:n==null?void 0:n.id;return Yt({queryKey:["scorecard-goals",t,a],queryFn:async()=>{const{data:o,error:l}=await J.from("scorecard_goals").select("*").eq("owner_user_id",a).eq("year",t).maybeSingle();if(l)throw l;return o},enabled:!!a})},opt=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("scorecard_goals").upsert({...n,owner_user_id:e.id},{onConflict:"owner_user_id,year"}).select().single();if(a)throw a;return s},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["scorecard-goals",s.year]}),ze.success("Goals saved")},onError:n=>{ze.error("Failed to save goals"),console.error(n)}})},bse=()=>{const{user:t}=Xr();return Yt({queryKey:["scorecard-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("scorecard_settings").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e},enabled:!!(t!=null&&t.id)})},lpt=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("scorecard_settings").upsert({...n,user_id:e.id},{onConflict:"user_id"}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-settings"]}),ze.success("Settings saved")},onError:n=>{ze.error("Failed to save settings"),console.error(n)}})},A8e=(t,e)=>{const{data:n,isLoading:s}=vxe(t,e),{data:a,isLoading:o}=M8e(e),{data:l}=bse(),i=(l==null?void 0:l.show_commission)??!0,h=p=>{if(!p||p.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=p.filter(z=>z.transaction_type==="buyer").length,y=p.filter(z=>z.transaction_type==="seller").length,_=p.reduce((z,F)=>z+Number(F.sale_price),0),j=p.reduce((z,F)=>z+(Number(F.commission_amount)||0),0),C={};p.forEach(z=>{var q;const F=((q=z.lead_source)==null?void 0:q.name)||"Unknown";C[F]=(C[F]||0)+1});const N=Object.entries(C).map(([z,F])=>({name:z,count:F})).sort((z,F)=>F.count-z.count),A=N[0]||null,E={};p.forEach(z=>{const F=new Date(z.close_date).toLocaleString("default",{month:"short"});E[F]=(E[F]||0)+1});const P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(z=>({month:z,count:E[z]||0}));return{totalTransactions:p.length,buyerCount:x,sellerCount:y,totalVolume:_,averagePrice:p.length>0?_/p.length:0,totalCommission:i?j:0,topLeadSource:A,transactionsByMonth:P,leadSourceBreakdown:N}};return{yearStats:h(n),lifetimeStats:h(a),isLoading:s||o,showCommission:i}},cpt=()=>{const{isAdmin:t}=Xr();return Yt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:e,error:n}=await J.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(e.map(l=>l.owner_user_id))],{data:a,error:o}=await J.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return a},enabled:t})},k0={recency:40,touchpoints:30,transactions:20},vke={warm:70,cooling:40};function dpt(t){return t===null?0:t<=14?k0.recency:t<=30?k0.recency*.85:t<=60?k0.recency*.65:t<=90?k0.recency*.4:t<=180?k0.recency*.2:k0.recency*.05}function upt(t){const e=Math.min(t/12,1);return Math.round(k0.touchpoints*e)}function hpt(t){return t?k0.transactions:0}function fpt(){return 0}function ppt(t){return t>=vke.warm?"warm":t>=vke.cooling?"cooling":"at-risk"}function _xe(){const{data:t,isLoading:e}=dp(),{data:n}=u8e(),{data:s}=yse(365),{data:a}=M8e(),o=I.useMemo(()=>{if(!t)return[];const i=new Date,h=out(i),p={};s==null||s.forEach(y=>{new Date(y.completed_at)>=h&&(p[y.contact_id]=(p[y.contact_id]||0)+1)});const x=new Set((a==null?void 0:a.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return t.map(y=>{const _=(n==null?void 0:n[y.id])||null,j=_?dy(i,new Date(_)):null,C=p[y.id]||0,N=x.has(y.id),A=dpt(j),E=upt(C),T=hpt(N),P=fpt(),z=Math.round(A+E+T+P),F={score:z,status:ppt(z),breakdown:{recency:Math.round(A),touchpoints:Math.round(E),transactions:Math.round(T),referrals:Math.round(P)},lastTouchDate:_,daysSinceTouch:j,touchCountLast12Months:C,hasTransaction:N};return{...y,relationshipScore:F}})},[t,n,s,a]),l=I.useMemo(()=>{const i=o.filter(_=>_.relationshipScore.status==="warm").length,h=o.filter(_=>_.relationshipScore.status==="cooling").length,p=o.filter(_=>_.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((_,j)=>_+j.relationshipScore.score,0)/x):0;return{warm:i,cooling:h,atRisk:p,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:e}}function E8e(){const t=Zn(),{stats:e,contactsWithScores:n,isLoading:s}=_xe();if(s)return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Ir,{className:"h-5 w-40"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx(Ir,{className:"h-20 w-full"}),r.jsx(Ir,{className:"h-16 w-full"})]})]});if(e.total===0)return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bn,{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(ee,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>t("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const a=Math.round(e.warm/e.total*100),o=Math.round(e.cooling/e.total*100),l=Math.round(e.atRisk/e.total*100),i=n.filter(h=>h.relationshipScore.status==="at-risk").sort((h,p)=>h.relationshipScore.score-p.relationshipScore.score).slice(0,3);return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ep,{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," (",a,"%)"]})]}),r.jsx(Zc,{value:a,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," (",l,"%)"]})]}),r.jsx(Zc,{value:l,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),i.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(jj,{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:i.map(h=>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(`/mission-control/contacts/${h.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:[h.first_name," ",h.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:h.relationshipScore.daysSinceTouch===null?"Never":`${h.relationshipScore.daysSinceTouch}d`}),r.jsx(Vi,{className:"h-3 w-3"})]})]},h.id))})]}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Vi,{className:"h-4 w-4 ml-1"})]})]})]})}const mpt=()=>{var ae,pe;const{user:t,isAdmin:e}=Xr(),n=Zn(),[s,a]=I.useState([]),[o,l]=I.useState([]),[i,h]=I.useState([]),[p,x]=I.useState([]),[y,_]=I.useState([]),[j,C]=I.useState([]),[N,A]=I.useState(new Set),[E,T]=I.useState([]),[P,z]=I.useState([]),[F,q]=I.useState([]),[V,K]=I.useState(!0);I.useEffect(()=>{G()},[t]);const G=async()=>{var se,he,ue,_e;try{const[Ae,Ce,Se,ge,Le,ke,Be,Ee,Ue,Fe]=await Promise.all([J.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),J.from("app_tiles").select("*").order("name"),J.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),J.from("events").select("*").order("event_date",{ascending:!0}),J.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t==null?void 0:t.id),J.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),J.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.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),J.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),be=((se=Ae.data)==null?void 0:se.map(rt=>rt.tag))||[],tt=new Set(((he=Se.data)==null?void 0:he.map(rt=>rt.app_id))||[]);A(tt);const Ke=(((ue=Ce.data)==null?void 0:ue.filter(rt=>!rt.required_tags||rt.required_tags.length===0?!0:rt.required_tags.some(at=>be.includes(at))))||[]).sort((rt,at)=>rt.name==="LevelUp Members Portal"?-1:at.name==="LevelUp Members Portal"?1:0);a(Ke.slice(0,6));const me=((_e=ge.data)==null?void 0:_e.filter(rt=>AS(rt.event_date)!=="ended"))||[];l(me.slice(0,4)),T(Le.data||[]),h(ke.data||[]),x(Be.data||[]),_(Ee.data||[]),C(Ue.data||[]);const yt=Fe.data||[];z(yt.filter(rt=>rt.placement==="top")),q(yt.filter(rt=>rt.placement==="between"))}catch(Ae){console.error("Error loading dashboard:",Ae),ze.error("Failed to load dashboard data")}finally{K(!1)}},te=async se=>{var ue;const he=window.open("about:blank","_blank");try{await J.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:se.app_id,app_name:se.name,user_agent:navigator.userAgent});const{data:_e,error:Ae}=await J.functions.invoke("sso-launch",{body:{app_id:se.app_id}});if(Ae)throw Ae;_e!=null&&_e.redirect_url?he&&!he.closed?(he.location.href=_e.redirect_url,(ue=he.focus)==null||ue.call(he)):window.location.assign(_e.redirect_url):(he==null||he.close(),ze.error("Launch link unavailable"))}catch(_e){he==null||he.close(),console.error("Error launching app:",_e),ze.error("Failed to launch app")}},ie=se=>E==null?void 0:E.some(he=>he.event_id===se),oe=se=>{const he=E==null?void 0:E.find(ue=>ue.event_id===se);return he==null?void 0:he.zoom_join_url};if(V)return r.jsx(Lr,{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 ye=se=>F.filter(he=>he.section_after===se);return r.jsxs(Lr,{title:"Dashboard",children:[r.jsx(hft,{events:o,registrations:E,onNavigateToEvents:()=>n("/events")}),P.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(BM,{banners:P})}),r.jsx(jft,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((pe=(ae=t==null?void 0:t.user_metadata)==null?void 0:ae.name)==null?void 0:pe.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(Fft,{}),r.jsx(E8e,{}),r.jsx(npt,{})]}),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(ee,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{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(Os,{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(se=>{const he=ie(se.id),ue=oe(se.id)||se.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 ${mke(se.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[mke(se.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(wj,{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:new Intl.DateTimeFormat("en-US",{month:"short",timeZone:"America/New_York"}).format(new Date(se.event_date))}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-primary",children:new Intl.DateTimeFormat("en-US",{day:"numeric",timeZone:"America/New_York"}).format(new Date(se.event_date))})]}),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:se.title}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-0.5",children:[new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:"America/New_York"}).format(new Date(se.event_date))," at ",iE(new Date(se.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:he?r.jsxs(ee,{size:"sm",variant:"default",className:"gap-1",onClick:_e=>{_e.stopPropagation(),window.open(ue,"_blank")},children:[r.jsx(Ls,{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(Vi,{className:"h-4 w-4"})]})})]},se.id)})})]}),ye("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:ye("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(ee,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{className:"h-4 w-4"})]})]}),y.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($f,{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:y.map(se=>r.jsxs("div",{onClick:()=>n(`/academy/${se.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:[se.thumbnail_url?r.jsx("img",{src:se.thumbnail_url,alt:se.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($f,{className:"h-8 w-8 text-muted-foreground/50"})}),se.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:se.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:se.title})})]},se.id))})]}),ye("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:ye("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(ee,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{className:"h-4 w-4"})]})]}),p.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(qx,{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:p.map(se=>r.jsxs("div",{onClick:()=>n(`/toolbox/${se.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:se.featured_image_url?r.jsx("img",{src:se.featured_image_url,alt:se.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(qx,{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:se.name})})]},se.id))})]}),ye("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:ye("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(ee,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{className:"h-4 w-4"})]})]}),i.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(x1,{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:i.map(se=>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:se.preview_image_url?r.jsx("img",{src:se.preview_image_url,alt:se.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(x1,{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:se.name})})]},se.id))})]}),ye("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:ye("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(rpt,{})}),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(ee,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{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(pm,{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(se=>{const he=N.has(se.id);return r.jsxs("div",{onClick:()=>te(se),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:se.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:se.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:se.description})]}),he&&r.jsx(pm,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},se.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(ee,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(hl,{className:"h-4 w-4"})]})]}),j.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(Ms,{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:j.map(se=>r.jsxs("div",{onClick:()=>window.open(se.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:se.preview_image_url?r.jsx("img",{src:se.preview_image_url,alt:se.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(Ms,{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:se.name}),se.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:se.description})]})]},se.id))})]})]})};var wse="Switch",[gpt]=rc(wse),[xpt,ypt]=gpt(wse),I8e=I.forwardRef((t,e)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:h="on",onCheckedChange:p,form:x,...y}=t,[_,j]=I.useState(null),C=ta(e,P=>j(P)),N=I.useRef(!1),A=_?x||!!_.closest("form"):!0,[E,T]=$u({prop:a,defaultProp:o??!1,onChange:p,caller:wse});return r.jsxs(xpt,{scope:n,checked:E,disabled:i,children:[r.jsx(Rn.button,{type:"button",role:"switch","aria-checked":E,"aria-required":l,"data-state":D8e(E),"data-disabled":i?"":void 0,disabled:i,value:h,...y,ref:C,onClick:on(t.onClick,P=>{T(z=>!z),A&&(N.current=P.isPropagationStopped(),N.current||P.stopPropagation())})}),A&&r.jsx(O8e,{control:_,bubbles:!N.current,name:s,value:h,checked:E,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});I8e.displayName=wse;var P8e="SwitchThumb",L8e=I.forwardRef((t,e)=>{const{__scopeSwitch:n,...s}=t,a=ypt(P8e,n);return r.jsx(Rn.span,{"data-state":D8e(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:e})});L8e.displayName=P8e;var vpt="SwitchBubbleInput",O8e=I.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:s=!0,...a},o)=>{const l=I.useRef(null),i=ta(l,o),h=NI(n),p=hI(e);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const C=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(C)}},[h,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});O8e.displayName=vpt;function D8e(t){return t?"checked":"unchecked"}var R8e=I8e,_pt=L8e;const Ps=I.forwardRef(({className:t,...e},n)=>r.jsx(R8e,{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(_pt,{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")})}));Ps.displayName=R8e.displayName;var F8e="AlertDialog",[bpt]=rc(F8e,[d6e]),xy=d6e(),z8e=t=>{const{__scopeAlertDialog:e,...n}=t,s=xy(e);return r.jsx(qne,{...s,...n,modal:!0})};z8e.displayName=F8e;var wpt="AlertDialogTrigger",B8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=xy(n);return r.jsx(Ige,{...a,...s,ref:e})});B8e.displayName=wpt;var jpt="AlertDialogPortal",$8e=t=>{const{__scopeAlertDialog:e,...n}=t,s=xy(e);return r.jsx(Vne,{...s,...n})};$8e.displayName=jpt;var kpt="AlertDialogOverlay",U8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=xy(n);return r.jsx(l3,{...a,...s,ref:e})});U8e.displayName=kpt;var ES="AlertDialogContent",[Npt,Spt]=bpt(ES),Cpt=WTe("AlertDialogContent"),q8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:s,...a}=t,o=xy(n),l=I.useRef(null),i=ta(e,l),h=I.useRef(null);return r.jsx(Bat,{contentName:ES,titleName:V8e,docsSlug:"alert-dialog",children:r.jsx(Npt,{scope:n,cancelRef:h,children:r.jsxs(c3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:on(a.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=h.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[r.jsx(Cpt,{children:s}),r.jsx(Tpt,{contentRef:l})]})})})});q8e.displayName=ES;var V8e="AlertDialogTitle",H8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=xy(n);return r.jsx(jI,{...a,...s,ref:e})});H8e.displayName=V8e;var W8e="AlertDialogDescription",G8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=xy(n);return r.jsx(kI,{...a,...s,ref:e})});G8e.displayName=W8e;var Mpt="AlertDialogAction",K8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=xy(n);return r.jsx(Hne,{...a,...s,ref:e})});K8e.displayName=Mpt;var Z8e="AlertDialogCancel",Y8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,{cancelRef:a}=Spt(Z8e,n),o=xy(n),l=ta(e,a);return r.jsx(Hne,{...o,...s,ref:l})});Y8e.displayName=Z8e;var Tpt=({contentRef:t})=>{const e=`\`${ES}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${ES}\` by passing a \`${W8e}\` 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 \`${ES}\`. 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 I.useEffect(()=>{var s;document.getElementById((s=t.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Apt=z8e,Ept=B8e,Ipt=$8e,X8e=U8e,Q8e=q8e,J8e=K8e,eDe=Y8e,tDe=H8e,rDe=G8e;const Ou=Apt,Q0=Ept,Ppt=Ipt,nDe=I.forwardRef(({className:t,...e},n)=>r.jsx(X8e,{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}));nDe.displayName=X8e.displayName;const nu=I.forwardRef(({className:t,...e},n)=>r.jsxs(Ppt,{children:[r.jsx(nDe,{}),r.jsx(Q8e,{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})]}));nu.displayName=Q8e.displayName;const su=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-2 text-center sm:text-left",t),...e});su.displayName="AlertDialogHeader";const au=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});au.displayName="AlertDialogFooter";const iu=I.forwardRef(({className:t,...e},n)=>r.jsx(tDe,{ref:n,className:zt("text-lg font-semibold",t),...e}));iu.displayName=tDe.displayName;const ou=I.forwardRef(({className:t,...e},n)=>r.jsx(rDe,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));ou.displayName=rDe.displayName;const Dd=I.forwardRef(({className:t,...e},n)=>r.jsx(J8e,{ref:n,className:zt(eE(),t),...e}));Dd.displayName=J8e.displayName;const lu=I.forwardRef(({className:t,...e},n)=>r.jsx(eDe,{ref:n,className:zt(eE({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));lu.displayName=eDe.displayName;const Lpt=[{key:"contacts",label:"Contacts",icon:bi,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:yj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:Pa,description:"View and upload videos"},{key:"listings",label:"Listings",icon:da,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:IT,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:Mo,description:"View and log pop-bys"}];function Opt(){var F;const{user:t}=Xr(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState(null),[y,_]=I.useState({email:"",name:"",password:""}),[j,C]=I.useState(!1),[N,A]=I.useState(null);I.useEffect(()=>{t&&E()},[t]);const E=async()=>{if(t){a(!0);try{const{data:q,error:V}=await J.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",t.id);if(V)throw V;if(q&&q.length>0){const K=q.map(ie=>ie.assistant_id),{data:G}=await J.from("profiles").select("id, name, email").in("id",K),te=q.map(ie=>{const oe=G==null?void 0:G.find(ye=>ye.id===ie.assistant_id);return{...ie,permissions:ie.permissions,assistant_profile:oe?{name:oe.name||"",email:oe.email||""}:void 0}});n(te)}else n([])}catch(q){console.error("Error loading assistants:",q)}finally{a(!1)}}},T=async()=>{if(!t||!y.email.trim()||!y.name.trim()||!y.password.trim()){ze.error("Please fill in all fields");return}if(y.password.length<6){ze.error("Password must be at least 6 characters");return}if(e.length>=1){ze.error("You can only have 1 assistant");return}C(!0);try{const{data:{session:q}}=await J.auth.getSession();if(!q)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q.access_token}`},body:JSON.stringify({email:y.email.trim(),password:y.password,name:y.name.trim(),purpose:"assistant"})}),K=await V.json();if(!V.ok)throw new Error(K.error||"Failed to create assistant account");const G=K.userId||K.id;if(!G)throw new Error("No user ID returned");const te=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q.access_token}`},body:JSON.stringify({userId:G,role:"assistant",action:"add",agentId:t.id})}),ie=await te.json();if(!te.ok)throw new Error(ie.error||"Failed to assign assistant role");const{error:oe}=await J.from("agent_assistant_assignments").insert({agent_id:t.id,assistant_id:G,permissions:{contacts:!0,pipeline:!0,videos:!1,listings:!1,scorecard:!1,popbys:!1}});if(oe)throw oe;ze.success(`Assistant account created for ${y.name.trim()}`),l(!1),_({email:"",name:"",password:""}),E()}catch(q){console.error("Error adding assistant:",q),ze.error(q.message||"Failed to add assistant")}finally{C(!1)}},P=async()=>{if(!(!p||!t))try{const{data:{session:q}}=await J.auth.getSession();if(!q)throw new Error("Not authenticated");const{error:V}=await J.from("agent_assistant_assignments").delete().eq("id",p.id);if(V)throw V;const{data:K}=await J.from("agent_assistant_assignments").select("id").eq("assistant_id",p.assistant_id);(!K||K.length===0)&&await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q.access_token}`},body:JSON.stringify({userId:p.assistant_id,role:"assistant",action:"remove"})}),ze.success("Assistant removed"),h(!1),x(null),E()}catch(q){console.error("Error removing assistant:",q),ze.error(q.message||"Failed to remove assistant")}},z=async(q,V,K)=>{A(q);try{const G=e.find(oe=>oe.id===q);if(!G)return;const te={...G.permissions,[V]:K},{error:ie}=await J.from("agent_assistant_assignments").update({permissions:te}).eq("id",q);if(ie)throw ie;n(oe=>oe.map(ye=>ye.id===q?{...ye,permissions:te}:ye))}catch(G){console.error("Error updating permissions:",G),ze.error("Failed to update permissions")}finally{A(null)}};return s?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"My Assistant"]}),r.jsx(Tn,{children:"Add an assistant to help manage your Agent OS"})]}),e.length===0&&r.jsxs(ee,{size:"sm",onClick:()=>l(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),r.jsx(Je,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No assistant assigned. Add one to help manage your contacts, deals, and more."}):r.jsx("div",{className:"space-y-4",children:e.map(q=>{var V,K,G,te;return r.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ks,{className:"h-10 w-10",children:r.jsx(Zs,{children:((K=(V=q.assistant_profile)==null?void 0:V.name)==null?void 0:K.split(" ").map(ie=>ie[0]).join("").toUpperCase())||"A"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((G=q.assistant_profile)==null?void 0:G.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((te=q.assistant_profile)==null?void 0:te.email)||""})]}),r.jsxs(Ot,{variant:"secondary",className:"ml-2",children:[r.jsx(nf,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{x(q),h(!0)},children:r.jsx(Vn,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Permissions"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Lpt.map(ie=>{const oe=ie.icon;return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md border",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oe,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:ie.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ie.description})]})]}),r.jsx(Ps,{checked:q.permissions[ie.key]||!1,onCheckedChange:ye=>z(q.id,ie.key,ye),disabled:N===q.id})]},ie.key)})})]})]},q.id)})})})]}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add Assistant"}),r.jsx(Qn,{children:"Create an account for your assistant. They'll be able to manage the features you enable below."})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"assistant-name",children:"Name"}),r.jsx(dt,{id:"assistant-name",value:y.name,onChange:q=>_({...y,name:q.target.value}),placeholder:"Assistant's full name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"assistant-email",children:"Email"}),r.jsx(dt,{id:"assistant-email",type:"email",value:y.email,onChange:q=>_({...y,email:q.target.value}),placeholder:"assistant@email.com"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"assistant-password",children:"Temporary Password"}),r.jsx(dt,{id:"assistant-password",type:"password",value:y.password,onChange:q=>_({...y,password:q.target.value}),placeholder:"Min 6 characters"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your assistant can change this after their first login."})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(ee,{onClick:T,disabled:j,children:[j&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(Ou,{open:i,onOpenChange:h,children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Remove Assistant?"}),r.jsxs(ou,{children:["This will remove ",(F=p==null?void 0:p.assistant_profile)==null?void 0:F.name,"'s access to your Agent OS. Their account will remain active but they won't be able to manage your data."]})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}var Dpt=Object.defineProperty,Rpt=(t,e,n)=>e in t?Dpt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bl=(t,e,n)=>Rpt(t,typeof e!="symbol"?e+"":e,n);const yte={x:0,y:0,width:0,height:0,unit:"px"},c4=(t,e,n)=>Math.min(Math.max(t,e),n),Fpt=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),_ke=(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 zpt(t,e,n,s){const a=eg(t,n,s);return t.width&&(a.height=a.width/e),t.height&&(a.width=a.height*e),a.y+a.height>s&&(a.height=s-a.y,a.width=a.height*e),a.x+a.width>n&&(a.width=n-a.x,a.height=a.width/e),t.unit==="%"?N0(a,n,s):a}function Bpt(t,e,n){const s=eg(t,e,n);return s.x=(e-s.width)/2,s.y=(n-s.height)/2,t.unit==="%"?N0(s,e,n):s}function N0(t,e,n){return t.unit==="%"?{...yte,...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 eg(t,e,n){return t.unit?t.unit==="px"?{...yte,...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}:{...yte,...t,unit:"px"}}function bke(t,e,n,s,a,o=0,l=0,i=s,h=a){const p={...t};let x=Math.min(o,s),y=Math.min(l,a),_=Math.min(i,s),j=Math.min(h,a);e&&(e>1?(x=l?l*e:x,y=x/e,_=i*e):(y=o?o/e:y,x=y*e,j=h/e)),p.y<0&&(p.height=Math.max(p.height+p.y,y),p.y=0),p.x<0&&(p.width=Math.max(p.width+p.x,x),p.x=0);const C=s-(p.x+p.width);C<0&&(p.x=Math.min(p.x,s-x),p.width+=C);const N=a-(p.y+p.height);if(N<0&&(p.y=Math.min(p.y,a-y),p.height+=N),p.width_&&((n==="sw"||n=="nw")&&(p.x-=_-p.width),p.width=_),p.height>j&&((n==="nw"||n=="ne")&&(p.y-=j-p.height),p.height=j),e){const A=p.width/p.height;if(Ae){const E=Math.max(p.height*e,x);(n==="sw"||n=="nw")&&(p.x-=E-p.width),p.width=E}}return p}function $pt(t,e,n,s){const a={...t};return e==="ArrowLeft"?s==="nw"?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):s==="w"?(a.x-=n,a.width+=n):s==="sw"?(a.x-=n,a.width+=n,a.height+=n):s==="ne"?(a.y+=n,a.width-=n,a.height-=n):s==="e"?a.width-=n:s==="se"&&(a.width-=n,a.height-=n):e==="ArrowRight"&&(s==="nw"?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):s==="w"?(a.x+=n,a.width-=n):s==="sw"?(a.x+=n,a.width-=n,a.height-=n):s==="ne"?(a.y-=n,a.width+=n,a.height+=n):s==="e"?a.width+=n:s==="se"&&(a.width+=n,a.height+=n)),e==="ArrowUp"?s==="nw"?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):s==="n"?(a.y-=n,a.height+=n):s==="ne"?(a.y-=n,a.width+=n,a.height+=n):s==="sw"?(a.x+=n,a.width-=n,a.height-=n):s==="s"?a.height-=n:s==="se"&&(a.width-=n,a.height-=n):e==="ArrowDown"&&(s==="nw"?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):s==="n"?(a.y+=n,a.height-=n):s==="ne"?(a.y+=n,a.width-=n,a.height-=n):s==="sw"?(a.x-=n,a.width+=n,a.height+=n):s==="s"?a.height+=n:s==="se"&&(a.width+=n,a.height+=n)),a}const d4={capture:!0,passive:!1};let Upt=0;const g0=class Wp extends I.PureComponent{constructor(){super(...arguments),bl(this,"docMoveBound",!1),bl(this,"mouseDownOnCrop",!1),bl(this,"dragStarted",!1),bl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),bl(this,"componentRef",I.createRef()),bl(this,"mediaRef",I.createRef()),bl(this,"resizeObserver"),bl(this,"initChangeCalled",!1),bl(this,"instanceId",`rc-${Upt++}`),bl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),bl(this,"onCropPointerDown",e=>{const{crop:n,disabled:s}=this.props,a=this.getBox();if(!n)return;const o=eg(n,a.width,a.height);if(s)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=e.target.dataset.ord,i=!!l;let h=e.clientX,p=e.clientY,x=o.x,y=o.y;if(l){const _=e.clientX-a.x,j=e.clientY-a.y;let C=0,N=0;l==="ne"||l=="e"?(C=_-(o.x+o.width),N=j-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(C=_-(o.x+o.width),N=j-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(C=_-o.x,N=j-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(C=_-o.x,N=j-o.y,x=o.x+o.width,y=o.y+o.height),h=x+a.x+C,p=y+a.y+N}this.evData={startClientX:h,startClientY:p,startCropX:x,startCropY:y,clientX:e.clientX,clientY:e.clientY,isResize:i,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),bl(this,"onComponentPointerDown",e=>{const{crop:n,disabled:s,locked:a,keepSelection:o,onChange:l}=this.props,i=this.getBox();if(s||a||o&&n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=e.clientX-i.x,p=e.clientY-i.y,x={unit:"px",x:h,y:p,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:p,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(eg(x,i.width,i.height),N0(x,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),bl(this,"onDocPointerMove",e=>{const{crop:n,disabled:s,onChange:a,onDragStart:o}=this.props,l=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(e));const{evData:i}=this;i.clientX=e.clientX,i.clientY=e.clientY;let h;i.isResize?h=this.resizeCrop():h=this.dragCrop(),_ke(n,h)||a(eg(h,l.width,l.height),N0(h,l.width,l.height))}),bl(this,"onComponentKeyDown",e=>{const{crop:n,disabled:s,onChange:a,onComplete:o}=this.props;if(s)return;const l=e.key;let i=!1;if(!n)return;const h=this.getBox(),p=this.makePixelCrop(h),x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Wp.nudgeStepLarge:e.shiftKey?Wp.nudgeStepMedium:Wp.nudgeStep;if(l==="ArrowLeft"?(p.x-=x,i=!0):l==="ArrowRight"?(p.x+=x,i=!0):l==="ArrowUp"?(p.y-=x,i=!0):l==="ArrowDown"&&(p.y+=x,i=!0),i){e.cancelable&&e.preventDefault(),p.x=c4(p.x,0,h.width-p.width),p.y=c4(p.y,0,h.height-p.height);const y=eg(p,h.width,h.height),_=N0(p,h.width,h.height);a(y,_),o&&o(y,_)}}),bl(this,"onHandlerKeyDown",(e,n)=>{const{aspect:s=0,crop:a,disabled:o,minWidth:l=0,minHeight:i=0,maxWidth:h,maxHeight:p,onChange:x,onComplete:y}=this.props,_=this.getBox();if(o||!a)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;const j=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Wp.nudgeStepLarge:e.shiftKey?Wp.nudgeStepMedium:Wp.nudgeStep,C=eg(a,_.width,_.height),N=$pt(C,e.key,j,n),A=bke(N,s,n,_.width,_.height,l,i,h,p);if(!_ke(a,A)){const E=N0(A,_.width,_.height);x(A,E),y&&y(A,E)}}),bl(this,"onDocPointerDone",e=>{const{crop:n,disabled:s,onComplete:a,onDragEnd:o}=this.props,l=this.getBox();this.unbindDocMove(),!(s||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(e),a&&a(eg(n,l.width,l.height),N0(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),bl(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:a,height:o}=e.getBoundingClientRect();return{x:n,y:s,width:a,height:o}}componentDidUpdate(e){const{crop:n,onComplete:s}=this.props;if(s&&!e.crop&&n){const{width:a,height:o}=this.getBox();a&&o&&s(eg(n,a,o),N0(n,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,d4),this.document.addEventListener("pointerup",this.onDocPointerDone,d4),this.document.addEventListener("pointercancel",this.onDocPointerDone,d4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,d4),this.document.removeEventListener("pointerup",this.onDocPointerDone,d4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,d4),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),a=e.clientX-e.startClientX,o=e.clientY-e.startClientY;return s.x=c4(e.startCropX+a,0,n.width-s.width),s.y=c4(e.startCropY+o,0,n.height-s.height),s}getPointRegion(e,n,s,a){const{evData:o}=this,l=o.clientX-e.x,i=o.clientY-e.y;let h;a&&n?h=n==="nw"||n==="n"||n==="ne":h=i1?o?[o,o/n]:[l*n,l]:l?[l*n,l]:[o,o/n]}resizeCrop(){const{evData:e}=this,{aspect:n=0,maxWidth:s,maxHeight:a}=this.props,o=this.getBox(),[l,i]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let h=this.makePixelCrop(o);const p=this.getPointRegion(o,e.ord,l,i),x=e.ord||p;let y=e.clientX-e.startClientX,_=e.clientY-e.startClientY;(l&&x==="nw"||x==="w"||x==="sw")&&(y=Math.min(y,-l)),(i&&x==="nw"||x==="n"||x==="ne")&&(_=Math.min(_,-i));const j={unit:"px",x:0,y:0,width:0,height:0};p==="ne"?(j.x=e.startCropX,j.width=y,n?(j.height=j.width/n,j.y=e.startCropY-j.height):(j.height=Math.abs(_),j.y=e.startCropY-j.height)):p==="se"?(j.x=e.startCropX,j.y=e.startCropY,j.width=y,n?j.height=j.width/n:j.height=_):p==="sw"?(j.x=e.startCropX+y,j.y=e.startCropY,j.width=Math.abs(y),n?j.height=j.width/n:j.height=_):p==="nw"&&(j.x=e.startCropX+y,j.width=Math.abs(y),n?(j.height=j.width/n,j.y=e.startCropY-j.height):(j.height=Math.abs(_),j.y=e.startCropY+_));const C=bke(j,n,p,o.width,o.height,l,i,s,a);return n||Wp.xyOrds.indexOf(x)>-1?h=C:Wp.xOrds.indexOf(x)>-1?(h.x=C.x,h.width=C.width):Wp.yOrds.indexOf(x)>-1&&(h.y=C.y,h.height=C.height),h.x=c4(h.x,0,o.width-h.width),h.y=c4(h.y,0,o.height-h.height),h}renderCropSelection(){const{ariaLabels:e=Wp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return st.createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&&st.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},st.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),st.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),st.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),st.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"nw"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"n"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"ne"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"e"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"se"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"s"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"sw"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"w"),role:"button"})),a&&st.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:h=>h.stopPropagation()},a(this.state)),o&&st.createElement(st.Fragment,null,st.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),st.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){const n={...yte,...this.props.crop||{}};return eg(n,e.width,e.height)}render(){const{aspect:e,children:n,circularCrop:s,className:a,crop:o,disabled:l,locked:i,style:h,ruleOfThirds:p}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,_=o?this.renderCropSelection():null,j=Fpt("ReactCrop",a,x&&"ReactCrop--active",l&&"ReactCrop--disabled",i&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&e&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&p&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return st.createElement("div",{ref:this.componentRef,className:j,style:h},st.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?st.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},st.createElement("defs",null,st.createElement("mask",{id:`hole-${this.instanceId}`},st.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?st.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"}):st.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),st.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,_)}};bl(g0,"xOrds",["e","w"]),bl(g0,"yOrds",["n","s"]),bl(g0,"xyOrds",["nw","ne","se","sw"]),bl(g0,"nudgeStep",1),bl(g0,"nudgeStepMedium",10),bl(g0,"nudgeStepLarge",100),bl(g0,"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 qpt=g0;var sDe=["PageUp","PageDown"],aDe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],iDe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},h3="Slider",[khe,Vpt,Hpt]=cI(h3),[oDe]=rc(h3,[Hpt]),[Wpt,jse]=oDe(h3),lDe=I.forwardRef((t,e)=>{const{name:n,min:s=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:h=0,defaultValue:p=[s],value:x,onValueChange:y=()=>{},onValueCommit:_=()=>{},inverted:j=!1,form:C,...N}=t,A=I.useRef(new Set),E=I.useRef(0),P=l==="horizontal"?Gpt:Kpt,[z=[],F]=$u({prop:x,defaultProp:p,onChange:ie=>{var ye;(ye=[...A.current][E.current])==null||ye.focus(),y(ie)}}),q=I.useRef(z);function V(ie){const oe=Jpt(z,ie);te(ie,oe)}function K(ie){te(ie,E.current)}function G(){const ie=q.current[E.current];z[E.current]!==ie&&_(z)}function te(ie,oe,{commit:ye}={commit:!1}){const ae=nmt(o),pe=smt(Math.round((ie-s)/o)*o+s,ae),se=nE(pe,[s,a]);F((he=[])=>{const ue=Xpt(he,se,oe);if(rmt(ue,h*o)){E.current=ue.indexOf(se);const _e=String(ue)!==String(he);return _e&&ye&&_(ue),_e?ue:he}else return he})}return r.jsx(Wpt,{scope:t.__scopeSlider,name:n,disabled:i,min:s,max:a,valueIndexToChangeRef:E,thumbs:A.current,values:z,orientation:l,form:C,children:r.jsx(khe.Provider,{scope:t.__scopeSlider,children:r.jsx(khe.Slot,{scope:t.__scopeSlider,children:r.jsx(P,{"aria-disabled":i,"data-disabled":i?"":void 0,...N,ref:e,onPointerDown:on(N.onPointerDown,()=>{i||(q.current=z)}),min:s,max:a,inverted:j,onSlideStart:i?void 0:V,onSlideMove:i?void 0:K,onSlideEnd:i?void 0:G,onHomeKeyDown:()=>!i&&te(s,0,{commit:!0}),onEndKeyDown:()=>!i&&te(a,z.length-1,{commit:!0}),onStepKeyDown:({event:ie,direction:oe})=>{if(!i){const pe=sDe.includes(ie.key)||ie.shiftKey&&aDe.includes(ie.key)?10:1,se=E.current,he=z[se],ue=o*pe*oe;te(he+ue,se,{commit:!0})}}})})})})});lDe.displayName=h3;var[cDe,dDe]=oDe(h3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Gpt=I.forwardRef((t,e)=>{const{min:n,max:s,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:h,onStepKeyDown:p,...x}=t,[y,_]=I.useState(null),j=ta(e,P=>_(P)),C=I.useRef(void 0),N=ok(a),A=N==="ltr",E=A&&!o||!A&&o;function T(P){const z=C.current||y.getBoundingClientRect(),F=[0,z.width],V=bxe(F,E?[n,s]:[s,n]);return C.current=z,V(P-z.left)}return r.jsx(cDe,{scope:t.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:r.jsx(uDe,{dir:N,"data-orientation":"horizontal",...x,ref:j,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:P=>{const z=T(P.clientX);l==null||l(z)},onSlideMove:P=>{const z=T(P.clientX);i==null||i(z)},onSlideEnd:()=>{C.current=void 0,h==null||h()},onStepKeyDown:P=>{const F=iDe[E?"from-left":"from-right"].includes(P.key);p==null||p({event:P,direction:F?-1:1})}})})}),Kpt=I.forwardRef((t,e)=>{const{min:n,max:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:h,...p}=t,x=I.useRef(null),y=ta(e,x),_=I.useRef(void 0),j=!a;function C(N){const A=_.current||x.current.getBoundingClientRect(),E=[0,A.height],P=bxe(E,j?[s,n]:[n,s]);return _.current=A,P(N-A.top)}return r.jsx(cDe,{scope:t.__scopeSlider,startEdge:j?"bottom":"top",endEdge:j?"top":"bottom",size:"height",direction:j?1:-1,children:r.jsx(uDe,{"data-orientation":"vertical",...p,ref:y,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const A=C(N.clientY);o==null||o(A)},onSlideMove:N=>{const A=C(N.clientY);l==null||l(A)},onSlideEnd:()=>{_.current=void 0,i==null||i()},onStepKeyDown:N=>{const E=iDe[j?"from-bottom":"from-top"].includes(N.key);h==null||h({event:N,direction:E?-1:1})}})})}),uDe=I.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:h,...p}=t,x=jse(h3,n);return r.jsx(Rn.span,{...p,ref:e,onKeyDown:on(t.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):sDe.concat(aDe).includes(y.key)&&(h(y),y.preventDefault())}),onPointerDown:on(t.onPointerDown,y=>{const _=y.target;_.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(_)?_.focus():s(y)}),onPointerMove:on(t.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:on(t.onPointerUp,y=>{const _=y.target;_.hasPointerCapture(y.pointerId)&&(_.releasePointerCapture(y.pointerId),o(y))})})}),hDe="SliderTrack",fDe=I.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=jse(hDe,n);return r.jsx(Rn.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:e})});fDe.displayName=hDe;var Nhe="SliderRange",pDe=I.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=jse(Nhe,n),o=dDe(Nhe,n),l=I.useRef(null),i=ta(e,l),h=a.values.length,p=a.values.map(_=>xDe(_,a.min,a.max)),x=h>1?Math.min(...p):0,y=100-Math.max(...p);return r.jsx(Rn.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:i,style:{...t.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});pDe.displayName=Nhe;var She="SliderThumb",mDe=I.forwardRef((t,e)=>{const n=Vpt(t.__scopeSlider),[s,a]=I.useState(null),o=ta(e,i=>a(i)),l=I.useMemo(()=>s?n().findIndex(i=>i.ref.current===s):-1,[n,s]);return r.jsx(Zpt,{...t,ref:o,index:l})}),Zpt=I.forwardRef((t,e)=>{const{__scopeSlider:n,index:s,name:a,...o}=t,l=jse(She,n),i=dDe(She,n),[h,p]=I.useState(null),x=ta(e,T=>p(T)),y=h?l.form||!!h.closest("form"):!0,_=hI(h),j=l.values[s],C=j===void 0?0:xDe(j,l.min,l.max),N=Qpt(s,l.values.length),A=_==null?void 0:_[i.size],E=A?emt(A,C,i.direction):0;return I.useEffect(()=>{if(h)return l.thumbs.add(h),()=>{l.thumbs.delete(h)}},[h,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${C}% + ${E}px)`},children:[r.jsx(khe.ItemSlot,{scope:t.__scopeSlider,children:r.jsx(Rn.span,{role:"slider","aria-label":t["aria-label"]||N,"aria-valuemin":l.min,"aria-valuenow":j,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:x,style:j===void 0?{display:"none"}:t.style,onFocus:on(t.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(gDe,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:j},s)]})});mDe.displayName=She;var Ypt="RadioBubbleInput",gDe=I.forwardRef(({__scopeSlider:t,value:e,...n},s)=>{const a=I.useRef(null),o=ta(a,s),l=NI(e);return I.useEffect(()=>{const i=a.current;if(!i)return;const h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==e&&x){const y=new Event("input",{bubbles:!0});x.call(i,e),i.dispatchEvent(y)}},[l,e]),r.jsx(Rn.input,{style:{display:"none"},...n,ref:o,defaultValue:e})});gDe.displayName=Ypt;function Xpt(t=[],e,n){const s=[...t];return s[n]=e,s.sort((a,o)=>a-o)}function xDe(t,e,n){const o=100/(n-e)*(t-e);return nE(o,[0,100])}function Qpt(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Jpt(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),s=Math.min(...n);return n.indexOf(s)}function emt(t,e,n){const s=t/2,o=bxe([0,50],[0,s]);return(s-o(e)*n)*n}function tmt(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function rmt(t,e){if(e>0){const n=tmt(t);return Math.min(...n)>=e}return!0}function bxe(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 nmt(t){return(String(t).split(".")[1]||"").length}function smt(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var yDe=lDe,amt=fDe,imt=pDe,omt=mDe;const um=I.forwardRef(({className:t,...e},n)=>r.jsxs(yDe,{ref:n,className:zt("relative flex w-full touch-none select-none items-center",t),...e,children:[r.jsx(amt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(imt,{className:"absolute h-full bg-primary"})}),r.jsx(omt,{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"})]}));um.displayName=yDe.displayName;function lmt(t,e,n){return Bpt(zpt({unit:"%",width:90},n,t,e),t,e)}const wxe=({open:t,onClose:e,imageSrc:n,onCropComplete:s,aspectRatio:a=1})=>{const o=I.useRef(null),[l,i]=I.useState(),[h,p]=I.useState(),[x,y]=I.useState(1),[_,j]=I.useState(0),C=I.useCallback(E=>{const{width:T,height:P}=E.currentTarget;i(lmt(T,P,a))},[a]),N=I.useCallback(async()=>{const E=o.current;if(!E||!h)return;const T=document.createElement("canvas"),P=T.getContext("2d");if(!P)return;const z=E.naturalWidth/E.width,F=E.naturalHeight/E.height,q=400;T.width=q,T.height=q,P.imageSmoothingQuality="high";const V=h.x*z,K=h.y*F,G=h.width*z,te=h.height*F,ie=_*Math.PI/180,oe=T.width/2,ye=T.height/2;return P.save(),P.translate(oe,ye),P.rotate(ie),P.scale(x,x),P.translate(-oe,-ye),P.drawImage(E,V,K,G,te,0,0,q,q),P.restore(),new Promise((ae,pe)=>{T.toBlob(se=>{se?ae(se):pe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[h,x,_]),A=async()=>{try{const E=await N();E&&(s(E),e())}catch(E){console.error("Error cropping image:",E)}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{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(qpt,{crop:l,onChange:(E,T)=>i(T),onComplete:E=>p(E),aspect:a,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${_}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(vS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(um,{value:[x],min:.5,max:3,step:.1,onValueChange:([E])=>y(E),className:"flex-1"}),r.jsx(yS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(KT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(um,{value:[_],min:-180,max:180,step:1,onValueChange:([E])=>j(E),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[_,"°"]})]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:e,children:"Cancel"}),r.jsx(ee,{onClick:A,children:"Save Photo"})]})]})})},cmt=()=>{const{user:t}=Xr(),{toast:e}=pi(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(null);I.useEffect(()=>{t&&h()},[t]);const h=async()=>{s(!0);try{const{data:y}=await J.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",t==null?void 0:t.id).single();y&&i({status:y.subscription_status||"none",productId:y.subscription_product_id,endDate:y.subscription_end_date,isGrandfathered:y.is_grandfathered||!1})}catch(y){console.error("Error loading subscription:",y)}finally{s(!1)}},p=async()=>{o(!0);try{const{data:{session:y}}=await J.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:_,error:j}=await J.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(j)throw j;_!=null&&_.url&&window.open(_.url,"_blank")}catch(y){console.error("Error opening customer portal:",y),e({title:"Error",description:y.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},x=()=>{if(l!=null&&l.isGrandfathered)return r.jsx(Ot,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Ot,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Ot,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Ot,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Ot,{variant:"secondary",children:"Canceled"});default:return r.jsx(Ot,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(Tn,{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:x()})]}),(l==null?void 0:l.endDate)&&l.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(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.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."}):(l==null?void 0:l.status)==="active"||(l==null?void 0:l.status)==="trialing"?r.jsxs(r.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(l.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(ee,{onClick:p,variant:"outline",disabled:a,children:[a?r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ls,{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."})]})]})},dmt=()=>{const{user:t}=Xr(),e=Zn(),{toast:n}=pi(),[s]=qd(),a=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:h,subscribe:p,unsubscribe:x}=t8e(),[y,_]=I.useState(!1),[j,C]=I.useState(""),[N,A]=I.useState(!1),[E,T]=I.useState(!1),[P,z]=I.useState(""),[F,q]=I.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}),[V,K]=I.useState(!1),[G,te]=I.useState(!1),[ie,oe]=I.useState({newPassword:"",confirmPassword:""});I.useEffect(()=>{t&&ye()},[t]),I.useEffect(()=>{o&&t&&setTimeout(()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,t]);const ye=async()=>{var ue,_e,Ae;if(!(t!=null&&t.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",t.id);const{data:Ce,error:Se}=await J.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(Se)throw console.error("Profile query error:",Se),Se;Ce?(console.log("Profile loaded successfully:",Ce),q({name:Ce.name||"",email:Ce.email||"",title:Ce.title||"",bio:Ce.bio||"",areas_served:Ce.areas_served||"",years_experience:((ue=Ce.years_experience)==null?void 0:ue.toString())||"",instagram_url:Ce.instagram_url||"",facebook_url:Ce.facebook_url||"",linkedin_url:Ce.linkedin_url||""}),K(Ce.digest_opt_out||!1)):(console.warn("No profile found for user"),q({name:((_e=t.user_metadata)==null?void 0:_e.name)||((Ae=t.email)==null?void 0:Ae.split("@")[0])||"",email:t.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}));const{data:ge}=await J.storage.from("avatars").list(`${t.id}`);if(ge&&ge.length>0){const{data:Le}=J.storage.from("avatars").getPublicUrl(`${t.id}/${ge[0].name}`);C(Le.publicUrl)}}catch(Ce){console.error("Error loading profile:",Ce),n({title:"Error",description:Ce.message||"Failed to load profile",variant:"destructive"})}},ae=ue=>{var Ce;const _e=(Ce=ue.target.files)==null?void 0:Ce[0];if(!_e)return;const Ae=new FileReader;Ae.onloadend=()=>{z(Ae.result),T(!0)},Ae.readAsDataURL(_e),ue.target.value=""},pe=async ue=>{if(t){A(!0);try{const{data:_e}=await J.storage.from("avatars").list(`${t.id}`);_e&&_e.length>0&&await J.storage.from("avatars").remove(_e.map(Le=>`${t.id}/${Le.name}`));const Ce=`${t.id}/avatar.jpg`,{error:Se}=await J.storage.from("avatars").upload(Ce,ue,{upsert:!0,contentType:"image/jpeg"});if(Se)throw Se;const{data:ge}=J.storage.from("avatars").getPublicUrl(Ce);C(`${ge.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(_e){console.error("Error uploading avatar:",_e),n({title:"Error",description:_e.message||"Failed to upload photo",variant:"destructive"})}finally{A(!1)}}},se=async()=>{if(!F.name.trim()||!F.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}_(!0);try{const{error:ue}=await J.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(ue)throw ue;n({title:"Success",description:"Profile updated successfully"})}catch(ue){console.error("Error updating profile:",ue),n({title:"Error",description:ue.message||"Failed to update profile",variant:"destructive"})}finally{_(!1)}},he=async()=>{if(!ie.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ie.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ie.newPassword!==ie.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}_(!0);try{const{error:ue}=await J.auth.updateUser({password:ie.newPassword});if(ue)throw ue;n({title:"Success",description:"Password updated successfully"}),oe({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>e("/dashboard"),1e3)}catch(ue){console.error("Error updating password:",ue),n({title:"Error",description:ue.message||"Failed to update password",variant:"destructive"})}finally{_(!1)}};return r.jsx(Lr,{title:a?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:a?"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:[!a&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(ee,{variant:"outline",onClick:()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(xj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Profile Photo"}),r.jsx(Tn,{children:"Upload a professional photo for your profile"})]}),r.jsxs(Je,{className:"flex items-center gap-6",children:[r.jsxs(Ks,{className:"h-24 w-24",children:[r.jsx(Ei,{src:j}),r.jsx(Zs,{className:"text-2xl",children:F.name.split(" ").map(ue=>ue[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ae,disabled:N}),r.jsxs(ee,{variant:"outline",onClick:()=>{var ue;return(ue=document.getElementById("avatar-upload"))==null?void 0:ue.click()},disabled:N,children:[r.jsx(uo,{className:"mr-2 h-4 w-4"}),N?"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(Gt,{children:[r.jsx(Zt,{children:"Personal Information"}),r.jsx(Tn,{children:"Update your profile details"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:F.name,onChange:ue=>q({...F,name:ue.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:F.email,onChange:ue=>q({...F,email:ue.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Job Title"}),r.jsx(dt,{id:"title",value:F.title,onChange:ue=>q({...F,title:ue.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"bio",children:"Bio"}),r.jsx(dt,{id:"bio",value:F.bio,onChange:ue=>q({...F,bio:ue.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(He,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(dt,{id:"areas_served",value:F.areas_served,onChange:ue=>q({...F,areas_served:ue.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(dt,{id:"years_experience",type:"number",min:"0",value:F.years_experience,onChange:ue=>q({...F,years_experience:ue.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(dt,{value:F.linkedin_url,onChange:ue=>q({...F,linkedin_url:ue.target.value}),placeholder:"LinkedIn URL"}),r.jsx(dt,{value:F.instagram_url,onChange:ue=>q({...F,instagram_url:ue.target.value}),placeholder:"Instagram URL"}),r.jsx(dt,{value:F.facebook_url,onChange:ue=>q({...F,facebook_url:ue.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(ee,{onClick:se,disabled:y,children:[r.jsx(bg,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ye,{id:"change-password-section",children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:a?"Set Your Password":"Change Password"}),r.jsx(Tn,{children:a?"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(He,{htmlFor:"newPassword",children:"New Password"}),r.jsx(dt,{id:"newPassword",type:"password",value:ie.newPassword,onChange:ue=>oe({...ie,newPassword:ue.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(dt,{id:"confirmPassword",type:"password",value:ie.confirmPassword,onChange:ue=>oe({...ie,confirmPassword:ue.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(ee,{onClick:he,disabled:y,children:[r.jsx(bg,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&r.jsx(ee,{variant:"outline",onClick:()=>e("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[i?r.jsx(yg,{className:"h-5 w-5"}):r.jsx(cj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(Tn,{children:"Receive browser notifications when new content is added"})]}),r.jsx(Je,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:i?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:i?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(Ps,{checked:i,onCheckedChange:ue=>{ue?p():x()},disabled:h})]}):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(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[V?r.jsx(RT,{className:"h-5 w-5"}):r.jsx(ua,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(Tn,{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:V?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(Ps,{checked:!V,onCheckedChange:async ue=>{te(!0);try{const{error:_e}=await J.from("profiles").update({digest_opt_out:!ue}).eq("id",t==null?void 0:t.id);if(_e)throw _e;K(!ue),n({title:ue?"Subscribed":"Unsubscribed",description:ue?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(_e){n({title:"Error",description:_e.message||"Failed to update preference",variant:"destructive"})}finally{te(!1)}},disabled:G})]})})]}),r.jsx(Opt,{}),r.jsx(cmt,{})]}),r.jsx(wxe,{open:E,onClose:()=>T(!1),imageSrc:P,onCropComplete:pe,aspectRatio:1})]})})};var umt="AspectRatio",vDe=I.forwardRef((t,e)=>{const{ratio:n=1/1,style:s,...a}=t;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(Rn.div,{...a,ref:e,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});vDe.displayName=umt;var hmt=vDe;const fmt=hmt;function pmt(){const{user:t}=Xr(),e=Vr(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),{data:l,isLoading:i}=Yt({queryKey:["calendar-token",t==null?void 0:t.id],queryFn:async()=>{const{data:C,error:N}=await J.from("profiles").select("calendar_token").eq("id",t==null?void 0:t.id).single();if(N)throw N;return C},enabled:!!t&&a}),h=cr({mutationFn:async()=>{const C=new Uint8Array(12);crypto.getRandomValues(C);const N=btoa(String.fromCharCode(...C)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:A}=await J.from("profiles").update({calendar_token:N}).eq("id",t==null?void 0:t.id);if(A)throw A;return N},onSuccess:()=>{e.invalidateQueries({queryKey:["calendar-token",t==null?void 0:t.id]}),ze.success("Calendar subscription URL generated!")},onError:C=>{ze.error("Failed to generate calendar URL: "+C.message)}}),p=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,x=async()=>{p&&(await navigator.clipboard.writeText(p),s(!0),ze.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{p&&(window.location.href=p.replace("https://","webcal://"))},_=()=>{if(p){const C=p.replace("https://","webcal://"),N=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(C)}`;window.open(N,"_blank")}},j=()=>{if(p){const C=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(p)}&name=Level%20Up%20Events`;window.open(C,"_blank")}};return r.jsxs(Fr,{open:a,onOpenChange:o,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Qn,{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:i?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):p?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(dt,{value:p,readOnly:!0,className:"text-xs font-mono"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(Ai,{className:"h-4 w-4 text-green-500"}):r.jsx(Qo,{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(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:y,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(Ls,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:_,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(Ls,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:j,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(Ls,{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(ee,{onClick:()=>h.mutate(),disabled:h.isPending,className:"w-full",children:h.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var kse="Tabs",[mmt]=rc(kse,[o3]),_De=o3(),[gmt,jxe]=mmt(kse),bDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:h="automatic",...p}=t,x=ok(i),[y,_]=$u({prop:s,onChange:a,defaultProp:o??"",caller:kse});return r.jsx(gmt,{scope:n,baseId:Kc(),value:y,onValueChange:_,orientation:l,dir:x,activationMode:h,children:r.jsx(Rn.div,{dir:x,"data-orientation":l,...p,ref:e})})});bDe.displayName=kse;var wDe="TabsList",jDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,loop:s=!0,...a}=t,o=jxe(wDe,n),l=_De(n);return r.jsx(vge,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Rn.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:e})})});jDe.displayName=wDe;var kDe="TabsTrigger",NDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...o}=t,l=jxe(kDe,n),i=_De(n),h=MDe(l.baseId,s),p=TDe(l.baseId,s),x=s===l.value;return r.jsx(_ge,{asChild:!0,...i,focusable:!a,active:x,children:r.jsx(Rn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...o,ref:e,onMouseDown:on(t.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:on(t.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:on(t.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(s)})})})});NDe.displayName=kDe;var SDe="TabsContent",CDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,forceMount:a,children:o,...l}=t,i=jxe(SDe,n),h=MDe(i.baseId,s),p=TDe(i.baseId,s),x=s===i.value,y=I.useRef(x);return I.useEffect(()=>{const _=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(_)},[]),r.jsx(xc,{present:a||x,children:({present:_})=>r.jsx(Rn.div,{"data-state":x?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":h,hidden:!_,id:p,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:y.current?"0s":void 0},children:_&&o})})});CDe.displayName=SDe;function MDe(t,e){return`${t}-trigger-${e}`}function TDe(t,e){return`${t}-content-${e}`}var xmt=bDe,ADe=jDe,EDe=NDe,IDe=CDe;const Ii=xmt,wi=I.forwardRef(({className:t,...e},n)=>r.jsx(ADe,{ref:n,className:zt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));wi.displayName=ADe.displayName;const nn=I.forwardRef(({className:t,...e},n)=>r.jsx(EDe,{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}));nn.displayName=EDe.displayName;const Sn=I.forwardRef(({className:t,...e},n)=>r.jsx(IDe,{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}));Sn.displayName=IDe.displayName;const ymt={first_timer:vs,regular:Wx,dedicated:Ol,veteran:Zi,streak_master:ef,century:Zi},vmt={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 wke(t){return t===1?r.jsx(Zi,{className:"h-5 w-5 text-yellow-500"}):t===2?r.jsx(Wx,{className:"h-5 w-5 text-gray-400"}):t===3?r.jsx(Ol,{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 PDe({showUserStats:t=!0,compact:e=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:a}=Xr(),{data:o,isLoading:l}=k8e(e?5:10,n),{data:i}=N8e(a==null?void 0:a.id),{data:h}=C8e(a==null?void 0:a.id),{data:p}=S8e(a==null?void 0:a.id);return l?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Ir,{className:"h-12 w-full"},y))})})]}):r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(Je,{children:[t&&i&&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"}),h&&r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:["Rank #",h]})]}),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:i.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:i.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(ef,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:i.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),p&&p.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[p.slice(0,4).map(x=>{const y=ymt[x.badge_type]||vs;return r.jsxs(Ot,{variant:"outline",className:`text-xs ${vmt[x.badge_type]||""}`,title:x.badge_description||"",children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),x.badge_name]},x.id)}),p.length>4&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:["+",p.length-4," more"]})]})]}),r.jsxs(Ii,{defaultValue:"points",className:"w-full",children:[r.jsxs(wi,{className:"w-full mb-3",children:[r.jsx(nn,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(nn,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(Sn,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,y)=>{var _,j,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:wke(y+1)}),r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"text-xs",children:((j=(_=x.profile)==null?void 0:_.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=x.profile)==null?void 0:C.name)||"Unknown",x.user_id===(a==null?void 0:a.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:x.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},x.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(Sn,{value:"events",className:"mt-0",children:r.jsx("div",{className:"space-y-2",children:[...o||[]].sort((x,y)=>y.total_events_attended-x.total_events_attended).map((x,y)=>{var _,j,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:wke(y+1)}),r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"text-xs",children:((j=(_=x.profile)==null?void 0:_.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=x.profile)==null?void 0:C.name)||"Unknown",x.user_id===(a==null?void 0:a.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:x.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},x.user_id)})})})]})]})]})}function _mt(){const t=Zn(),{user:e,isAdmin:n}=Xr(),s=Vr(),{data:a,isLoading:o}=Yt({queryKey:["public-events"],queryFn:async()=>{const{data:N,error:A}=await J.from("events").select("*").order("event_date",{ascending:!0});if(A)throw A;return N}}),{data:l}=Yt({queryKey:["my-registrations"],queryFn:async()=>{if(!e)return[];const{data:N,error:A}=await J.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e.id);if(A)throw A;return N},enabled:!!e}),{data:i}=Yt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:N,error:A}=await J.from("event_registrations").select("event_id");if(A)throw A;const E={};return N.forEach(T=>{E[T.event_id]=(E[T.event_id]||0)+1}),E}}),h=cr({mutationFn:async N=>{const{data:A,error:E}=await J.functions.invoke("zoom-register",{body:{event_id:N}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:N=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),N!=null&&N.join_url?ze.success("Successfully registered! You'll receive a Zoom confirmation email."):ze.success("Successfully registered for the event!")},onError:N=>{ze.error("Failed to register: "+N.message)}}),p=cr({mutationFn:async N=>{const{data:A,error:E}=await J.functions.invoke("zoom-unregister",{body:{event_id:N}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),ze.success("Registration cancelled and removed from Zoom")},onError:N=>{ze.error("Failed to cancel: "+N.message)}}),x=N=>l==null?void 0:l.some(A=>A.event_id===N),y=N=>{const A=l==null?void 0:l.find(E=>E.event_id===N);return A==null?void 0:A.zoom_join_url},_=N=>N.capacity?((i==null?void 0:i[N.id])||0)>=N.capacity:!1,j=(a==null?void 0:a.filter(N=>AS(N.event_date)!=="ended"))||[],C=(a==null?void 0:a.filter(N=>AS(N.event_date)==="ended"))||[];return r.jsx(Lr,{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(pmt,{}),n&&r.jsx(ee,{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..."}):j.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:j.map(N=>{const A=AS(N.event_date),E=fxe(N.event_date),T=A==="live",P=A==="starting_soon";return r.jsxs(Ye,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${T?"border-red-500 ring-2 ring-red-500/20":P?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>t(`/events/${N.id}`),children:[E&&r.jsxs("div",{className:`${T?"bg-red-500":"bg-amber-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"})]}),T?r.jsxs(r.Fragment,{children:[r.jsx(wj,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ya,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),N.image_url&&r.jsx(fmt,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:N.image_url,alt:N.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Gt,{children:[r.jsx(Zt,{className:"line-clamp-2",children:N.title}),N.description&&r.jsx(Tn,{className:"line-clamp-2",children:N.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(Os,{className:"h-4 w-4"}),new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(N.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ya,{className:"h-4 w-4"}),iE(new Date(N.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Bn,{className:"h-4 w-4"}),(i==null?void 0:i[N.id])||0," registered",N.capacity&&` / ${N.capacity} spots`]})]}),r.jsx(oA,{className:"flex gap-2",onClick:z=>z.stopPropagation(),children:x(N.id)?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>p.mutate(N.id),disabled:p.isPending,children:[r.jsx(_s,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(ee,{className:"flex-1",onClick:()=>window.open(y(N.id)||N.zoom_link,"_blank"),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(ee,{className:"w-full",onClick:()=>h.mutate(N.id),disabled:h.isPending||_(N),children:_(N)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},N.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(N=>r.jsx(Ye,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t(`/events/${N.id}`),children:r.jsxs(Gt,{children:[r.jsx(Zt,{className:"text-base line-clamp-1",children:N.title}),r.jsx(Tn,{children:new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(N.event_date))})]})},N.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(PDe,{showUserStats:!0})})]})]})})}const Yle=[{value:"all",label:"All Roles",icon:Bn},{value:"brokerage_manager",label:"Brokerage Managers",icon:rA},{value:"admin",label:"Admins",icon:nf}];function bmt({open:t,onOpenChange:e,resourceType:n,resourceId:s,resourceTitle:a}){var be,tt;const{user:o,isAdmin:l,isBrokerageManager:i}=Xr(),[h,p]=I.useState([]),[x,y]=I.useState([]),[_,j]=I.useState([]),[C,N]=I.useState([]),[A,E]=I.useState(""),[T,P]=I.useState(""),[z,F]=I.useState(""),[q,V]=I.useState(!1),[K,G]=I.useState(!1),[te,ie]=I.useState("agents"),[oe,ye]=I.useState("all"),[ae,pe]=I.useState({}),se=l||i;I.useEffect(()=>{t&&o&&(l?he():ue())},[t,o,l]),I.useEffect(()=>{t||(j([]),N([]),E(""),P(""),F(""),ie("agents"),ye("all"))},[t]);const he=async()=>{if(o){V(!0);try{const{data:Te,error:Ke}=await J.from("brokerages").select("id, name").order("name");if(Ke)throw Ke;const me=1e3,yt={};let rt=0,at=!0;for(;at;){const{data:qe,error:Oe}=await J.from("profiles").select("brokerage_id").range(rt*me,(rt+1)*me-1);if(Oe)throw Oe;qe==null||qe.forEach(Qe=>{Qe.brokerage_id&&(yt[Qe.brokerage_id]=(yt[Qe.brokerage_id]||0)+1)}),at=(qe==null?void 0:qe.length)===me,rt++}y((Te==null?void 0:Te.map(qe=>({...qe,agent_count:yt[qe.id]||0})))||[]);const Me=[];for(rt=0,at=!0;at;){const{data:qe,error:Oe}=await J.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(rt*me,(rt+1)*me-1);if(Oe)throw Oe;qe&&Me.push(...qe),at=(qe==null?void 0:qe.length)===me,rt++}const ft={};for(rt=0,at=!0;at;){const{data:qe,error:Oe}=await J.from("user_roles").select("user_id, role").range(rt*me,(rt+1)*me-1);if(Oe)throw Oe;qe==null||qe.forEach(Qe=>{ft[Qe.user_id]||(ft[Qe.user_id]=[]),ft[Qe.user_id].push(Qe.role)}),at=(qe==null?void 0:qe.length)===me,rt++}pe(ft),p(Me.map(qe=>{var Oe;return{id:qe.id,name:qe.name,email:qe.email,brokerage_name:((Oe=qe.brokerages)==null?void 0:Oe.name)||"No Brokerage",roles:ft[qe.id]||[]}}))}catch(Te){console.error("Error loading data:",Te),ze.error("Failed to load agents and brokerages")}finally{V(!1)}}},ue=async()=>{if(o){V(!0);try{const{data:Te}=await J.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Te!=null&&Te.brokerage_id)){ze.error("You must be part of a brokerage to share resources"),e(!1);return}const{data:Ke,error:me}=await J.from("profiles").select("id, name, email").eq("brokerage_id",Te.brokerage_id).neq("id",o.id).order("name");if(me)throw me;p(Ke||[])}catch(Te){console.error("Error loading agents:",Te),ze.error("Failed to load agents")}finally{V(!1)}}},_e=h.filter(Te=>{var me;const Ke=Te.name.toLowerCase().includes(A.toLowerCase())||Te.email.toLowerCase().includes(A.toLowerCase())||((me=Te.brokerage_name)==null?void 0:me.toLowerCase().includes(A.toLowerCase()));if(l&&oe!=="all"){const yt=ae[Te.id]||[];return Ke&&yt.includes(oe)}return Ke}),Ae=x.filter(Te=>Te.name.toLowerCase().includes(T.toLowerCase())),Ce=()=>{_.length===_e.length?j([]):j(_e.map(Te=>Te.id))},Se=()=>{C.length===Ae.length?N([]):N(Ae.map(Te=>Te.id))},ge=Te=>{if(!se){j([Te]);return}j(Ke=>Ke.includes(Te)?Ke.filter(me=>me!==Te):[...Ke,Te])},Le=Te=>{N(Ke=>Ke.includes(Te)?Ke.filter(me=>me!==Te):[...Ke,Te])},ke=async()=>{if(!(_.length>0||C.length>0)){ze.error("Please select at least one agent or brokerage to share with");return}G(!0);try{const{data:Ke,error:me}=await J.functions.invoke("send-share-notification",{body:{recipientIds:_,brokerageIds:C,resourceType:n,resourceId:s,resourceTitle:a,message:z.trim()||void 0}});if(me)throw me;const yt=(Ke==null?void 0:Ke.sharesCreated)||_.length;ze.success(`Shared with ${yt} agent${yt!==1?"s":""}`),e(!1)}catch(Ke){console.error("Error sharing resource:",Ke),ze.error("Failed to share resource")}finally{G(!1)}},Be=Te=>Te.split(" ").map(Ke=>Ke[0]).join("").toUpperCase().slice(0,2),Ee=Te=>{const Ke=ae[Te]||[];return Ke.includes("admin")?r.jsx(Ot,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Ke.includes("brokerage_manager")?r.jsx(Ot,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Ue=_.length+C.length,Fe=oe!=="all"?_e.length:null;return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{className:"flex-shrink-0",children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Qn,{className:"line-clamp-2",children:['Share "',a,'" with ',l?"agents or brokerages":"agents in your brokerage"]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[l?r.jsxs(Ii,{value:te,onValueChange:ie,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(nn,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),_.length>0&&r.jsx(Ot,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:_.length})]}),r.jsxs(nn,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),C.length>0&&r.jsx(Ot,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:C.length})]})]}),r.jsxs(Sn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or brokerage...",value:A,onChange:Te=>E(Te.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:oe,onValueChange:ye,children:[r.jsxs(fn,{className:"w-[180px]",children:[r.jsx(v1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(yn,{placeholder:"Filter by role"})]}),r.jsx(pn,{children:Yle.map(Te=>r.jsx(qt,{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(ee,{variant:"ghost",size:"sm",onClick:Ce,className:"text-xs h-8",disabled:_e.length===0,children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1.5"}),_.length===_e.length&&_e.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Fe!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Fe," ",(be=Yle.find(Te=>Te.value===oe))==null?void 0:be.label]}),r.jsxs("span",{className:"font-medium",children:[_.length," selected"]})]})]}),r.jsx(tl,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):_e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Bn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:oe!=="all"?`No ${(tt=Yle.find(Te=>Te.value===oe))==null?void 0:tt.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:_e.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${_.includes(Te.id)?"bg-accent":""}`,onClick:()=>ge(Te.id),children:[r.jsx(Dl,{checked:_.includes(Te.id),onCheckedChange:()=>ge(Te.id),className:"flex-shrink-0"}),r.jsx(Ks,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Zs,{className:"text-xs bg-primary/10 text-primary",children:Be(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}),Ee(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(Sn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search brokerages...",value:T,onChange:Te=>P(Te.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:Ae.length===0,children:[r.jsx(ai,{className:"h-3.5 w-3.5 mr-1.5"}),C.length===Ae.length&&Ae.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(tl,{className:"h-[250px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ae.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(ai,{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:Ae.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:()=>Le(Te.id),children:[r.jsx(Dl,{checked:C.includes(Te.id),onCheckedChange:()=>Le(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(ai,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:A,onChange:Te=>E(Te.target.value),className:"pl-9"})]}),se&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:Ce,className:"text-xs h-8",disabled:_e.length===0,children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1.5"}),_.length===_e.length&&_e.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[_.length," selected"]})]}),r.jsx(tl,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):_e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Bn,{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:_e.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${_.includes(Te.id)?"bg-accent":""}`,onClick:()=>ge(Te.id),children:[r.jsx(Dl,{checked:_.includes(Te.id),onCheckedChange:()=>ge(Te.id),className:"flex-shrink-0"}),r.jsx(Ks,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Zs,{className:"text-xs bg-primary/10 text-primary",children:Be(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(He,{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:z,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(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{onClick:ke,disabled:Ue===0||K,children:K?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function f3({resourceType:t,resourceId:e,resourceTitle:n,variant:s="outline",size:a="sm",className:o=""}){const[l,i]=I.useState(!1),{user:h}=Xr();return h?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:s,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(pc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(bmt,{open:l,onOpenChange:i,resourceType:t,resourceId:e,resourceTitle:n})]}):null}function wmt(){const{eventId:t}=Yc(),e=Zn(),{user:n}=Xr(),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(0),[p,x]=I.useState(!0),[y,_]=I.useState(!1);I.useEffect(()=>{t&&j()},[t,n]);const j=async()=>{try{const{data:P,error:z}=await J.from("events").select("*").eq("id",t).single();if(z)throw z;a(P);const{count:F}=await J.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",t);if(h(F||0),n){const{data:q}=await J.from("event_registrations").select("id, zoom_join_url").eq("event_id",t).eq("user_id",n.id).maybeSingle();l(q)}}catch(P){console.error("Error loading event:",P),ze.error("Failed to load event"),e("/events")}finally{x(!1)}},C=async()=>{if(!(!n||!s)){_(!0);try{if(o){const{error:P}=await J.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(P)throw P;ze.success("Successfully cancelled registration"),l(null),h(z=>z-1)}else{const{data:P,error:z}=await J.functions.invoke("zoom-register",{body:{event_id:s.id}});if(z)throw z;ze.success("Successfully registered for event!"),l({id:P.registration_id,zoom_join_url:P.zoom_join_url}),h(F=>F+1)}}catch(P){console.error("Registration error:",P),ze.error(o?"Failed to cancel registration":"Failed to register for event")}finally{_(!1)}}},N=P=>{var z,F,q;if(P.includes("iframe.mediadelivery.net")||P.includes("video.bunnycdn.com")){const V=P.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(V)return`https://iframe.mediadelivery.net/embed/${V[1]}/${V[2]}?autoplay=false&preload=true`}if(P.includes("youtube.com")||P.includes("youtu.be")){const V=P.includes("youtu.be")?(z=P.split("youtu.be/")[1])==null?void 0:z.split("?")[0]:(F=P.split("v=")[1])==null?void 0:F.split("&")[0];if(V)return`https://www.youtube.com/embed/${V}`}if(P.includes("vimeo.com")){const V=(q=P.split("vimeo.com/")[1])==null?void 0:q.split("?")[0];if(V)return`https://player.vimeo.com/video/${V}`}return P};if(p)return r.jsx(Lr,{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(Lr,{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(ee,{onClick:()=>e("/events"),className:"mt-4",children:"Back to Events"})]})});const A=aut(new Date(s.event_date)),E=s.capacity&&i>=s.capacity,T=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Lr,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>e("/events"),children:[r.jsx(so,{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"}),A&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ot,{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(f3,{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($f,{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:N(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(Os,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(s.event_date))}),r.jsx("p",{className:"text-sm text-muted-foreground",children:iE(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Bn,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[i," / ",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(Yi,{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:[!A&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(Ls,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:C,disabled:y,children:[y?r.jsx(en,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(ee,{className:"w-full gap-2",onClick:C,disabled:y||(E??!1),children:y?r.jsx(en,{className:"h-4 w-4 animate-spin"}):E?"Event Full":"Register Now"})}),A&&o&&r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const jmt=()=>{const{user:t,isAdmin:e}=Xr(),n=Zn(),[s,a]=I.useState([]),[o,l]=I.useState(!0),[i,h]=I.useState(""),[p,x]=I.useState("all"),[y,_]=I.useState(new Set);I.useEffect(()=>{j()},[t]);const j=async()=>{try{const{data:T}=await J.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),P=(T==null?void 0:T.map(te=>te.tag))||[],{data:z,error:F}=await J.from("app_tiles").select("*").order("name");if(F)throw F;const{data:q}=await J.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),V=new Set((q==null?void 0:q.map(te=>te.app_id))||[]);_(V);const G=((z==null?void 0:z.filter(te=>!te.required_tags||te.required_tags.length===0?!0:te.required_tags.some(ie=>P.includes(ie))))||[]).sort((te,ie)=>te.name==="LevelUp Members Portal"?-1:ie.name==="LevelUp Members Portal"?1:0);a(G)}catch(T){console.error("Error loading apps:",T),ze.error("Failed to load apps")}finally{l(!1)}},C=async T=>{var z;const P=window.open("about:blank","_blank");try{const{data:F,error:q}=await J.auth.getSession();if(q||!F.session){P==null||P.close(),ze.error("Session expired. Please refresh the page and try again.");return}const V=F.session.access_token;await J.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:T.app_id,app_name:T.name,user_agent:navigator.userAgent});const{data:K,error:G}=await J.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${V}`}});if(G)throw G;K!=null&&K.redirect_url?P&&!P.closed?(P.location.href=K.redirect_url,(z=P.focus)==null||z.call(P)):window.location.assign(K.redirect_url):(P==null||P.close(),ze.error("Launch link unavailable"))}catch(F){P==null||P.close(),console.error("Error launching app:",F),ze.error("Failed to launch app. Please try again.")}},N=async(T,P)=>{T.stopPropagation();const z=y.has(P);try{if(z){const{error:F}=await J.from("user_favorites").delete().eq("user_id",t==null?void 0:t.id).eq("app_id",P);if(F)throw F;_(q=>{const V=new Set(q);return V.delete(P),V}),ze.success("Removed from favorites")}else{const{error:F}=await J.from("user_favorites").insert({user_id:t==null?void 0:t.id,app_id:P});if(F)throw F;_(q=>new Set(q).add(P)),ze.success("Added to favorites")}}catch(F){console.error("Error toggling favorite:",F),ze.error("Failed to update favorites")}},A=s.filter(T=>{var z;const P=T.name.toLowerCase().includes(i.toLowerCase())||((z=T.description)==null?void 0:z.toLowerCase().includes(i.toLowerCase()));return p==="favorites"?P&&y.has(T.id):P}),E=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Lr,{title:"Apps",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(Lr,{title:"Apps",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"}),r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:i,onChange:T=>h(T.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:E.map(T=>r.jsxs("button",{onClick:()=>x(T.id),className:zt("pb-3 text-sm font-medium transition-colors relative",p===T.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[T.label,p===T.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},T.id))}),A.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:p==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(pm,{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(Qf,{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(ee,{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:A.map(T=>{const P=y.has(T.id),z=T.name.toLowerCase().includes("agent review")||T.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(T),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:T.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:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:T.description})]}),r.jsx("button",{className:zt("flex-shrink-0 p-1 transition-colors",P?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:F=>N(F,T.id),children:r.jsx(pm,{className:zt("h-5 w-5",P&&"fill-current")})})]}),z&&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 →"})]},T.id)})})]})},kmt=()=>{const t=Zn(),[e,n]=I.useState(""),[s,a]=I.useState("all"),[o,l]=I.useState("all"),[i,h]=I.useState("grid"),{data:p=[]}=Yt({queryKey:["template-categories"],queryFn:async()=>{const{data:E,error:T}=await J.from("template_categories").select("*").order("name");if(T)throw T;return E}}),{data:x=[]}=Yt({queryKey:["template-types"],queryFn:async()=>{const{data:E,error:T}=await J.from("template_types").select("*").order("name");if(T)throw T;return E}}),{data:y=[],isLoading:_}=Yt({queryKey:["canva-templates"],queryFn:async()=>{const{data:E,error:T}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(T)throw T;const{data:P,error:z}=await J.from("template_links").select("*").order("sort_order");if(z)throw z;const{data:F}=await J.from("template_likes").select("template_id"),{data:q}=await J.from("template_comments").select("template_id"),V=new Map;F==null||F.forEach(te=>{V.set(te.template_id,(V.get(te.template_id)||0)+1)});const K=new Map;return q==null||q.forEach(te=>{K.set(te.template_id,(K.get(te.template_id)||0)+1)}),(E||[]).map(te=>({...te,links:(P||[]).filter(ie=>ie.template_id===te.id)||[],likesCount:V.get(te.id)||0,commentsCount:K.get(te.id)||0}))}}),j=y.filter(E=>{var F;const T=E.name.toLowerCase().includes(e.toLowerCase())||((F=E.description)==null?void 0:F.toLowerCase().includes(e.toLowerCase())),P=s==="all"||E.category_id===s,z=o==="all"||E.type_id===o;return T&&P&&z}),C=()=>{n(""),a("all"),l("all")},N=e||s!=="all"||o!=="all",A=E=>{t(`/templates/${E}`)};return r.jsx(Lr,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search templates...",value:e,onChange:E=>n(E.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:s,onValueChange:a,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(yn,{placeholder:"All Categories"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Categories"}),p.map(E=>r.jsx(qt,{value:E.id,children:E.name},E.id))]})]}),r.jsxs(gn,{value:o,onValueChange:l,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(yn,{placeholder:"All Types"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),x.map(E=>r.jsx(qt,{value:E.id,children:E.name},E.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[N&&r.jsx(ee,{variant:"outline",size:"sm",onClick:C,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>h("grid"),className:"rounded-full",children:r.jsx(Yf,{className:"h-4 w-4"})}),r.jsx(ee,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>h("list"),className:"rounded-full",children:r.jsx(Xf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[j.length," template",j.length!==1?"s":""," found"]}),_&&r.jsx("div",{className:i==="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((E,T)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ir,{className:"h-5 w-16"}),r.jsx(Ir,{className:"h-5 w-20"})]})]})},T))}),!_&&j.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:N?"No templates match your filters":"No templates available yet"}),N&&r.jsx(ee,{variant:"outline",onClick:C,children:"Clear Filters"})]}),!_&&j.length>0&&r.jsx("div",{className:i==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:j.map(E=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>A(E.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${i==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[E.preview_image_url?r.jsx("img",{src:E.preview_image_url,alt:E.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"}),E.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(Co,{className:"h-3 w-3"}),E.links.length]})})]}),r.jsxs(Je,{className:`p-4 flex flex-col ${i==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:E.name}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Sne(E.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[E.category&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:E.category.name}),E.type&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:E.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(gd,{className:"h-3.5 w-3.5"}),E.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),E.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),A(E.id)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Template"]})]})]},E.id))})]})})};var Nmt="Separator",jke="horizontal",Smt=["horizontal","vertical"],LDe=I.forwardRef((t,e)=>{const{decorative:n,orientation:s=jke,...a}=t,o=Cmt(s)?s:jke,i=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Rn.div,{"data-orientation":o,...i,...a,ref:e})});LDe.displayName=Nmt;function Cmt(t){return Smt.includes(t)}var ODe=LDe;const cu=I.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...s},a)=>r.jsx(ODe,{ref:a,decorative:n,orientation:e,className:zt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));cu.displayName=ODe.displayName;const TI=()=>({trackEngagement:I.useCallback(async(e,n,s,a="view")=>{try{const{data:{user:o}}=await J.auth.getUser();if(!o)return;await J.from("content_engagement_logs").insert({user_id:o.id,resource_type:e,resource_id:n,resource_title:s,action_type:a})}catch(o){console.error("Error tracking engagement:",o)}},[])}),Mmt=()=>{const{templateId:t}=Yc(),{user:e,isAdmin:n}=Xr(),{toast:s}=pi(),a=Vr(),{trackEngagement:o}=TI(),[l,i]=I.useState(""),{data:h,isLoading:p}=Yt({queryKey:["template-detail",t],queryFn:async()=>{const{data:T,error:P}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",t).single();if(P)throw P;const{data:z}=await J.from("template_links").select("*").eq("template_id",t).order("sort_order"),{data:F}=await J.from("template_guides").select("*").eq("template_id",t).order("sort_order");return{...T,links:z||[],guides:F||[]}},enabled:!!t});I.useEffect(()=>{h&&o("template",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Yt({queryKey:["template-likes",t],queryFn:async()=>{const{data:T,error:P}=await J.from("template_likes").select("*").eq("template_id",t);if(P)throw P;return T},enabled:!!t}),{data:y=[]}=Yt({queryKey:["template-comments",t],queryFn:async()=>{const{data:T,error:P}=await J.from("template_comments").select("*").eq("template_id",t).order("created_at",{ascending:!1});if(P)throw P;const z=[...new Set(T.map(V=>V.user_id))],{data:F}=await J.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(V=>[V.id,V.name]))||[]);return T.map(V=>({...V,user_name:q.get(V.user_id)||"Unknown User"}))},enabled:!!t}),_=cr({mutationFn:async T=>{const{error:P}=await J.from("template_comments").insert({template_id:t,user_id:e.id,content:T});if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),i(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error adding comment",description:T.message,variant:"destructive"})}}),j=cr({mutationFn:async T=>{const{error:P}=await J.from("template_comments").delete().eq("id",T);if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),s({title:"Comment deleted"})}}),C=cr({mutationFn:async()=>{const T=x.find(P=>P.user_id===(e==null?void 0:e.id));if(T){const{error:P}=await J.from("template_likes").delete().eq("id",T.id);if(P)throw P}else{const{error:P}=await J.from("template_likes").insert({template_id:t,user_id:e.id});if(P)throw P}},onSuccess:()=>{a.invalidateQueries({queryKey:["template-likes",t]})}}),N=x.some(T=>T.user_id===(e==null?void 0:e.id)),A=T=>T.split(" ").map(P=>P[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!l.trim()||!e)&&_.mutate(l.trim())};return p?r.jsx(Lr,{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"})})}):h?r.jsx(Lr,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/templates",children:[r.jsx(so,{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:h.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.category&&r.jsx(Ot,{variant:"secondary",children:h.category.name}),h.type&&r.jsx(Ot,{variant:"outline",children:h.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/templates?edit=${h.id}`,children:[r.jsx(fi,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(f3,{resourceType:"template",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:N?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(gd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.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:h.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(Co,{className:"h-4 w-4"}),h.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_canva"),window.open(T.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:T.title}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),h.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:h.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),h.guides&&h.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(La,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:h.guides.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_pdf"),window.open(T.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:T.name}),T.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(T.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(cu,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:l,onChange:T=>i(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(Do,{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(T=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:A(T.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:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:uu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(T.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Lr,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Co,{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(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/templates",children:"Back to Templates"})})]})})},Tmt=()=>{const{user:t}=Xr(),[e,n]=I.useState(""),[s,a]=I.useState("all"),{data:o=[]}=Yt({queryKey:["academy-categories"],queryFn:async()=>{const{data:_,error:j}=await J.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(j)throw j;return _}}),{data:l=[],isLoading:i}=Yt({queryKey:["academy-videos"],queryFn:async()=>{const{data:_,error:j}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(j)throw j;const{data:C,error:N}=await J.from("academy_resources").select("*").order("sort_order");if(N)throw N;return _.map(E=>({...E,resources:(C==null?void 0:C.filter(T=>T.video_id===E.id))||[]}))}}),{data:h=[]}=Yt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:_,error:j}=await J.from("academy_video_likes").select("video_id, user_id");if(j)throw j;return _}}),p=l.filter(_=>{var N;const j=e===""||_.title.toLowerCase().includes(e.toLowerCase())||((N=_.description)==null?void 0:N.toLowerCase().includes(e.toLowerCase())),C=s==="all"||_.category_id===s;return j&&C}),x=_=>h.filter(j=>j.video_id===_).length,y=_=>h.some(j=>j.video_id===_&&j.user_id===(t==null?void 0:t.id));return r.jsx(Lr,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search videos...",value:e,onChange:_=>n(_.target.value),className:"pl-10"})]})}),r.jsx(Ii,{value:s,onValueChange:a,children:r.jsxs(wi,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(nn,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(_=>r.jsx(nn,{value:_.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:_.name},_.id))]})}),i?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"})}):p.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Pa,{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:p.map(_=>r.jsx(co,{to:`/academy/${_.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:[_.thumbnail_url?r.jsx("img",{src:_.thumbnail_url,alt:_.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Pa,{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(fc,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),_.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(Ya,{className:"h-3 w-3"}),_.duration]})]}),r.jsxs(Gt,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Zt,{className:"text-lg line-clamp-2",children:_.title})}),_.category&&r.jsx(Ot,{variant:"secondary",className:"w-fit",children:_.category.name})]}),r.jsxs(Je,{className:"pt-0",children:[_.description&&r.jsx(Tn,{className:"line-clamp-2",children:_.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(gd,{className:`h-4 w-4 ${y(_.id)?"fill-primary text-primary":""}`}),x(_.id)]}),_.resources&&_.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4"}),_.resources.length]})]})]})]})},_.id))})]})})},Amt=(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},Emt=()=>{const{videoId:t}=Yc();Zn();const{user:e}=Xr(),{toast:n}=pi(),s=Vr(),{trackEngagement:a}=TI(),[o,l]=I.useState(""),{data:i,isLoading:h}=Yt({queryKey:["academy-video",t],queryFn:async()=>{const{data:T,error:P}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",t).eq("is_published",!0).single();if(P)throw P;const{data:z}=await J.from("academy_resources").select("*").eq("video_id",t).order("sort_order");return{...T,resources:z||[]}},enabled:!!t});I.useEffect(()=>{i&&a("academy_video",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:p=[]}=Yt({queryKey:["academy-video-likes",t],queryFn:async()=>{const{data:T,error:P}=await J.from("academy_video_likes").select("*").eq("video_id",t);if(P)throw P;return T},enabled:!!t}),{data:x=[]}=Yt({queryKey:["academy-video-comments",t],queryFn:async()=>{const{data:T,error:P}=await J.from("academy_video_comments").select("*").eq("video_id",t).order("created_at",{ascending:!1});if(P)throw P;const z=[...new Set(T.map(V=>V.user_id))],{data:F}=await J.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(V=>[V.id,V.name]))||[]);return T.map(V=>({...V,user_name:q.get(V.user_id)||"Unknown User"}))},enabled:!!t}),y=cr({mutationFn:async T=>{const{error:P}=await J.from("academy_video_comments").insert({video_id:t,user_id:e.id,content:T});if(P)throw P},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),l(""),n({title:"Comment added!"})},onError:T=>{n({title:"Error adding comment",description:T.message,variant:"destructive"})}}),_=cr({mutationFn:async T=>{const{error:P}=await J.from("academy_video_comments").delete().eq("id",T);if(P)throw P},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const T=p.find(P=>P.user_id===(e==null?void 0:e.id));if(T){const{error:P}=await J.from("academy_video_likes").delete().eq("id",T.id);if(P)throw P}else{const{error:P}=await J.from("academy_video_likes").insert({video_id:t,user_id:e.id});if(P)throw P}},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-likes",t]})}}),C=p.some(T=>T.user_id===(e==null?void 0:e.id)),N=T=>{switch(T==null?void 0:T.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},A=T=>T.split(" ").map(P=>P[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!o.trim()||!e)&&y.mutate(o.trim())};return h?r.jsx(Lr,{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"})})}):i?r.jsx(Lr,{title:i.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/academy",children:[r.jsx(so,{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(i.video_type)?r.jsx("iframe",{src:Amt(i.video_url,i.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(Pa,{className:"h-16 w-16 opacity-50"}),r.jsx(ee,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:i.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Ls,{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:i.title}),i.category&&r.jsx(Ot,{variant:"secondary",children:i.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(f3,{resourceType:"academy_video",resourceId:i.id,resourceTitle:i.title}),r.jsxs(ee,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!e||j.isPending,children:[r.jsx(gd,{className:`h-4 w-4 ${C?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),i.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.resources&&i.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(La,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:i.resources.map(T=>r.jsxs("a",{href:T.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:N(T.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:T.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:T.file_type})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(cu,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:T=>l(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Do,{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:x.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!"})})}):x.map(T=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:A(T.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:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:uu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>_.mutate(T.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Lr,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Pa,{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(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/academy",children:"Back to Academy"})})]})})};function Imt(){const t=Zn(),[e,n]=I.useState(""),{data:s,isLoading:a}=Yt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(C)throw C;return j}}),{data:o}=Yt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(C)throw C;return j}}),{data:l}=Yt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kit_likes").select("kit_id");if(C)throw C;return j}}),{data:i}=Yt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kit_comments").select("kit_id");if(C)throw C;return j}}),h=s==null?void 0:s.filter(j=>{var C;return j.name.toLowerCase().includes(e.toLowerCase())||((C=j.description)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))}),p=j=>(o==null?void 0:o.filter(C=>C.kit_id===j))||[],x=j=>(l==null?void 0:l.filter(C=>C.kit_id===j).length)||0,y=j=>(i==null?void 0:i.filter(C=>C.kit_id===j).length)||0,_=j=>{t(`/toolbox/${j}`)};return r.jsx(Lr,{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(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search resource kits...",value:e,onChange:j=>n(j.target.value),className:"pl-10"})]}),!a&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(h==null?void 0:h.length)||0," resource kit",(h==null?void 0:h.length)!==1?"s":""," available"]}),a?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((j,C)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"}),r.jsx(Ir,{className:"h-4 w-2/3"})]})},C))}):(h==null?void 0:h.length)===0?r.jsxs(Ye,{className:"p-12 text-center",children:[r.jsx(zl,{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:h==null?void 0:h.map(j=>{const C=p(j.id).length,N=x(j.id),A=y(j.id);return r.jsxs(Ye,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>_(j.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:j.featured_image_url?r.jsx("img",{src:j.featured_image_url,alt:j.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(zl,{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:j.name}),j.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:Sne(j.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(La,{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(gd,{className:"h-3.5 w-3.5"}),N]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),A]})]})]})]})]},j.id)})})]})})}const Pmt=()=>{const{kitId:t}=Yc(),{user:e,isAdmin:n}=Xr(),{toast:s}=pi(),a=Vr(),{trackEngagement:o}=TI(),[l,i]=I.useState(""),{data:h,isLoading:p}=Yt({queryKey:["resource-kit-detail",t],queryFn:async()=>{const{data:P,error:z}=await J.from("resource_kits").select("*").eq("id",t).eq("is_published",!0).single();if(z)throw z;const{data:F}=await J.from("resource_kit_files").select("*").eq("kit_id",t).order("sort_order"),{data:q}=await J.from("resource_kit_links").select("*").eq("kit_id",t).order("sort_order");return{...P,files:F||[],links:q||[]}},enabled:!!t});I.useEffect(()=>{h&&o("toolbox",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Yt({queryKey:["resource-kit-likes",t],queryFn:async()=>{const{data:P,error:z}=await J.from("resource_kit_likes").select("*").eq("kit_id",t);if(z)throw z;return P},enabled:!!t}),{data:y=[]}=Yt({queryKey:["resource-kit-comments",t],queryFn:async()=>{const{data:P,error:z}=await J.from("resource_kit_comments").select("*").eq("kit_id",t).order("created_at",{ascending:!1});if(z)throw z;const F=[...new Set(P.map(K=>K.user_id))],{data:q}=await J.from("profiles").select("id, name").in("id",F),V=new Map((q==null?void 0:q.map(K=>[K.id,K.name]))||[]);return P.map(K=>({...K,user_name:V.get(K.user_id)||"Unknown User"}))},enabled:!!t}),_=cr({mutationFn:async P=>{const{error:z}=await J.from("resource_kit_comments").insert({kit_id:t,user_id:e.id,content:P});if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),i(""),s({title:"Comment added!"})},onError:P=>{s({title:"Error adding comment",description:P.message,variant:"destructive"})}}),j=cr({mutationFn:async P=>{const{error:z}=await J.from("resource_kit_comments").delete().eq("id",P);if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),s({title:"Comment deleted"})}}),C=cr({mutationFn:async()=>{const P=x.find(z=>z.user_id===(e==null?void 0:e.id));if(P){const{error:z}=await J.from("resource_kit_likes").delete().eq("id",P.id);if(z)throw z}else{const{error:z}=await J.from("resource_kit_likes").insert({kit_id:t,user_id:e.id});if(z)throw z}},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-likes",t]})}}),N=x.some(P=>P.user_id===(e==null?void 0:e.id)),A=P=>P.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),E=P=>P?P<1024?P+" B":P<1024*1024?(P/1024).toFixed(1)+" KB":(P/(1024*1024)).toFixed(1)+" MB":"",T=P=>{P.preventDefault(),!(!l.trim()||!e)&&_.mutate(l.trim())};return p?r.jsx(Lr,{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"})})}):h?r.jsx(Lr,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/toolbox",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Toolbox"]})}),h.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:h.featured_image_url,alt:h.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:h.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/toolbox?edit=${h.id}`,children:[r.jsx(fi,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(f3,{resourceType:"resource_kit",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:N?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(gd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}})]}),h.files&&h.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(La,{className:"h-4 w-4"}),"Included Resources (",h.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.files.map(P=>r.jsxs("a",{href:P.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.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(La,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:P.name}),P.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:E(P.file_size)})]})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},P.id))})]})}),h.links&&h.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(Ls,{className:"h-4 w-4"}),"Canva Templates (",h.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(P=>r.jsxs("a",{href:P.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.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(Ls,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:P.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},P.id))})]})}),r.jsx(cu,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{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:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(Do,{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(P=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:A(P.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:P.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:uu(new Date(P.created_at),{addSuffix:!0})}),P.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(P.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:P.content})]})]})})},P.id))})]})]})}):r.jsx(Lr,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(zl,{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(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Lmt=()=>{const t=Zn(),[e,n]=I.useState(""),[s,a]=I.useState("grid"),{data:o=[],isLoading:l}=Yt({queryKey:["social-swag"],queryFn:async()=>{const{data:p,error:x}=await J.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:_}=await J.from("social_swag_links").select("*").order("sort_order");if(_)throw _;const{data:j}=await J.from("social_swag_likes").select("swag_id"),{data:C}=await J.from("social_swag_comments").select("swag_id"),N=new Map;j==null||j.forEach(T=>{N.set(T.swag_id,(N.get(T.swag_id)||0)+1)});const A=new Map;return C==null||C.forEach(T=>{A.set(T.swag_id,(A.get(T.swag_id)||0)+1)}),(p||[]).map(T=>({...T,links:(y||[]).filter(P=>P.swag_id===T.id)||[],likesCount:N.get(T.id)||0,commentsCount:A.get(T.id)||0}))}}),i=o.filter(p=>{var y;return p.title.toLowerCase().includes(e.toLowerCase())||((y=p.description)==null?void 0:y.toLowerCase().includes(e.toLowerCase()))}),h=p=>{t(`/social-swag/${p}`)};return r.jsx(Lr,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search social swag...",value:e,onChange:p=>n(p.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(Yf,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(Xf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," item",i.length!==1?"s":""," found"]}),l&&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((p,x)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"})]})},x))}),!l&&i.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(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&i.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:i.map(p=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>h(p.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[p.preview_image_url?r.jsx("img",{src:p.preview_image_url,alt:p.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"}),p.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(Co,{className:"h-3 w-3"}),p.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:p.title}),p.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:p.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(gd,{className:"h-3.5 w-3.5"}),p.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),p.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),h(p.id)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Details"]})]})]},p.id))})]})})};var Ea=function(){return Ea=Object.assign||function(e){for(var n,s=1,a=arguments.length;s1&&(h||!p),y=e>1&&(p||!h),_=function(){s&&o(s)},j=function(){a&&o(a)};return r.jsx(fgt,{displayMonth:t.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:s,onPreviousClick:_,onNextClick:j})}function pgt(t){var e,n=rl(),s=n.classNames,a=n.disableNavigation,o=n.styles,l=n.captionLayout,i=n.components,h=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:FDe,p;return a?p=r.jsx(h,{id:t.id,displayMonth:t.displayMonth}):l==="dropdown"?p=r.jsx(kke,{displayMonth:t.displayMonth,id:t.id}):l==="dropdown-buttons"?p=r.jsxs(r.Fragment,{children:[r.jsx(kke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),r.jsx(Nke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):p=r.jsxs(r.Fragment,{children:[r.jsx(h,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(Nke,{displayMonth:t.displayMonth,id:t.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:p})}function mgt(t){var e=rl(),n=e.footer,s=e.styles,a=e.classNames.tfoot;return n?r.jsx("tfoot",{className:a,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function ggt(t,e,n){for(var s=n?cy(new Date):uf(new Date,{locale:t,weekStartsOn:e}),a=[],o=0;o<7;o++){var l=Kl(s,o);a.push(l)}return a}function xgt(){var t=rl(),e=t.classNames,n=t.styles,s=t.showWeekNumber,a=t.locale,o=t.weekStartsOn,l=t.ISOWeek,i=t.formatters.formatWeekdayName,h=t.labels.labelWeekday,p=ggt(a,o,l);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}),p.map(function(x,y){return r.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":h(x,{locale:a}),children:i(x,{locale:a})},y)})]})}function ygt(){var t,e=rl(),n=e.classNames,s=e.styles,a=e.components,o=(t=a==null?void 0:a.HeadRow)!==null&&t!==void 0?t:xgt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function vgt(t){var e=rl(),n=e.locale,s=e.formatters.formatDay;return r.jsx(r.Fragment,{children:s(t.date,{locale:n})})}var kxe=I.createContext(void 0);function _gt(t){if(!AI(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return r.jsx(kxe.Provider,{value:e,children:t.children})}return r.jsx(bgt,{initialProps:t.initialProps,children:t.children})}function bgt(t){var e=t.initialProps,n=t.children,s=e.selected,a=e.min,o=e.max,l=function(p,x,y){var _,j;(_=e.onDayClick)===null||_===void 0||_.call(e,p,x,y);var C=!!(x.selected&&a&&(s==null?void 0:s.length)===a);if(!C){var N=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!N){var A=s?DDe([],s):[];if(x.selected){var E=A.findIndex(function(T){return Jl(p,T)});A.splice(E,1)}else A.push(p);(j=e.onSelect)===null||j===void 0||j.call(e,A,p,x,y)}}},i={disabled:[]};s&&i.disabled.push(function(p){var x=o&&s.length>o-1,y=s.some(function(_){return Jl(_,p)});return!!(x&&!y)});var h={selected:s,onDayClick:l,modifiers:i};return r.jsx(kxe.Provider,{value:h,children:n})}function Nxe(){var t=I.useContext(kxe);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function wgt(t,e){var n=e||{},s=n.from,a=n.to;return s&&a?Jl(a,t)&&Jl(s,t)?void 0:Jl(a,t)?{from:a,to:void 0}:Jl(s,t)?void 0:fte(s,t)?{from:t,to:a}:{from:s,to:t}:a?fte(t,a)?{from:a,to:t}:{from:t,to:a}:s?fse(t,s)?{from:t,to:s}:{from:s,to:t}:{from:t,to:void 0}}var Sxe=I.createContext(void 0);function jgt(t){if(!EI(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(Sxe.Provider,{value:e,children:t.children})}return r.jsx(kgt,{initialProps:t.initialProps,children:t.children})}function kgt(t){var e=t.initialProps,n=t.children,s=e.selected,a=s||{},o=a.from,l=a.to,i=e.min,h=e.max,p=function(j,C,N){var A,E;(A=e.onDayClick)===null||A===void 0||A.call(e,j,C,N);var T=wgt(j,s);(E=e.onSelect)===null||E===void 0||E.call(e,T,j,C,N)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],Jl(o,l)||(x.range_middle=[{after:o,before:l}])):x.range_end=[o]):l&&(x.range_start=[l],x.range_end=[l]),i&&(o&&!l&&x.disabled.push({after:Hle(o,i-1),before:Kl(o,i-1)}),o&&l&&x.disabled.push({after:o,before:Kl(o,i-1)}),!o&&l&&x.disabled.push({after:Hle(l,i-1),before:Kl(l,i-1)})),h){if(o&&!l&&(x.disabled.push({before:Kl(o,-h+1)}),x.disabled.push({after:Kl(o,h-1)})),o&&l){var y=dm(l,o)+1,_=h-y;x.disabled.push({before:Hle(o,_)}),x.disabled.push({after:Kl(l,_)})}!o&&l&&(x.disabled.push({before:Kl(l,-h+1)}),x.disabled.push({after:Kl(l,h-1)}))}return r.jsx(Sxe.Provider,{value:{selected:s,onDayClick:p,modifiers:x},children:n})}function Cxe(){var t=I.useContext(Sxe);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function iee(t){return Array.isArray(t)?DDe([],t):t!==void 0?[t]:[]}function Ngt(t){var e={};return Object.entries(t).forEach(function(n){var s=n[0],a=n[1];e[s]=iee(a)}),e}var km;(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"})(km||(km={}));var Sgt=km.Selected,mx=km.Disabled,Cgt=km.Hidden,Mgt=km.Today,Xle=km.RangeEnd,Qle=km.RangeMiddle,Jle=km.RangeStart,Tgt=km.Outside;function Agt(t,e,n){var s,a=(s={},s[Sgt]=iee(t.selected),s[mx]=iee(t.disabled),s[Cgt]=iee(t.hidden),s[Mgt]=[t.today],s[Xle]=[],s[Qle]=[],s[Jle]=[],s[Tgt]=[],s);return t.fromDate&&a[mx].push({before:t.fromDate}),t.toDate&&a[mx].push({after:t.toDate}),AI(t)?a[mx]=a[mx].concat(e.modifiers[mx]):EI(t)&&(a[mx]=a[mx].concat(n.modifiers[mx]),a[Jle]=n.modifiers[Jle],a[Qle]=n.modifiers[Qle],a[Xle]=n.modifiers[Xle]),a}var $De=I.createContext(void 0);function Egt(t){var e=rl(),n=Nxe(),s=Cxe(),a=Agt(e,n,s),o=Ngt(e.modifiers),l=Ea(Ea({},a),o);return r.jsx($De.Provider,{value:l,children:t.children})}function UDe(){var t=I.useContext($De);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function Igt(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Pgt(t){return!!(t&&typeof t=="object"&&"from"in t)}function Lgt(t){return!!(t&&typeof t=="object"&&"after"in t)}function Ogt(t){return!!(t&&typeof t=="object"&&"before"in t)}function Dgt(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Rgt(t,e){var n,s=e.from,a=e.to;if(s&&a){var o=dm(a,s)<0;o&&(n=[a,s],s=n[0],a=n[1]);var l=dm(t,s)>=0&&dm(a,t)>=0;return l}return a?Jl(a,t):s?Jl(s,t):!1}function Fgt(t){return exe(t)}function zgt(t){return Array.isArray(t)&&t.every(exe)}function Bgt(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(Fgt(n))return Jl(t,n);if(zgt(n))return n.includes(t);if(Pgt(n))return Rgt(t,n);if(Dgt(n))return n.dayOfWeek.includes(t.getDay());if(Igt(n)){var s=dm(n.before,t),a=dm(n.after,t),o=s>0,l=a<0,i=fte(n.before,n.after);return i?l&&o:o||l}return Lgt(n)?dm(t,n.after)>0:Ogt(n)?dm(n.before,t)>0:typeof n=="function"?n(t):!1})}function Mxe(t,e,n){var s=Object.keys(e).reduce(function(o,l){var i=e[l];return Bgt(t,i)&&o.push(l),o},[]),a={};return s.forEach(function(o){return a[o]=!0}),n&&!lxe(t,n)&&(a.outside=!0),a}function $gt(t,e){for(var n=_h(t[0]),s=use(t[t.length-1]),a,o,l=n;l<=s;){var i=Mxe(l,e),h=!i.disabled&&!i.hidden;if(!h){l=Kl(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=Kl(l,1)}return o||a}var Ugt=365;function qDe(t,e){var n=e.moveBy,s=e.direction,a=e.context,o=e.modifiers,l=e.retry,i=l===void 0?{count:0,lastFocused:t}:l,h=a.weekStartsOn,p=a.fromDate,x=a.toDate,y=a.locale,_={day:Kl,week:Uw,month:wh,year:tct,startOfWeek:function(A){return a.ISOWeek?cy(A):uf(A,{locale:y,weekStartsOn:h})},endOfWeek:function(A){return a.ISOWeek?fOe(A):txe(A,{locale:y,weekStartsOn:h})}},j=_[n](t,s==="after"?1:-1);s==="before"&&p?j=rct([p,j]):s==="after"&&x&&(j=nct([x,j]));var C=!0;if(o){var N=Mxe(j,o);C=!N.disabled&&!N.hidden}return C?j:i.count>Ugt?i.lastFocused:qDe(j,{moveBy:n,direction:s,context:a,modifiers:o,retry:Ea(Ea({},i),{count:i.count+1})})}var VDe=I.createContext(void 0);function qgt(t){var e=II(),n=UDe(),s=I.useState(),a=s[0],o=s[1],l=I.useState(),i=l[0],h=l[1],p=$gt(e.displayMonths,n),x=a??(i&&e.isDateDisplayed(i))?i:p,y=function(){h(a),o(void 0)},_=function(A){o(A)},j=rl(),C=function(A,E){if(a){var T=qDe(a,{moveBy:A,direction:E,context:j,modifiers:n});Jl(a,T)||(e.goToDate(T,a),_(T))}},N={focusedDay:a,focusTarget:x,blur:y,focus:_,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(VDe.Provider,{value:N,children:t.children})}function Txe(){var t=I.useContext(VDe);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function Vgt(t,e){var n=UDe(),s=Mxe(t,n,e);return s}var Axe=I.createContext(void 0);function Hgt(t){if(!Nse(t.initialProps)){var e={selected:void 0};return r.jsx(Axe.Provider,{value:e,children:t.children})}return r.jsx(Wgt,{initialProps:t.initialProps,children:t.children})}function Wgt(t){var e=t.initialProps,n=t.children,s=function(o,l,i){var h,p,x;if((h=e.onDayClick)===null||h===void 0||h.call(e,o,l,i),l.selected&&!e.required){(p=e.onSelect)===null||p===void 0||p.call(e,void 0,o,l,i);return}(x=e.onSelect)===null||x===void 0||x.call(e,o,o,l,i)},a={selected:e.selected,onDayClick:s};return r.jsx(Axe.Provider,{value:a,children:n})}function HDe(){var t=I.useContext(Axe);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function Ggt(t,e){var n=rl(),s=HDe(),a=Nxe(),o=Cxe(),l=Txe(),i=l.focusDayAfter,h=l.focusDayBefore,p=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,_=l.focus,j=l.focusMonthBefore,C=l.focusMonthAfter,N=l.focusYearBefore,A=l.focusYearAfter,E=l.focusStartOfWeek,T=l.focusEndOfWeek,P=function(he){var ue,_e,Ae,Ce;Nse(n)?(ue=s.onDayClick)===null||ue===void 0||ue.call(s,t,e,he):AI(n)?(_e=a.onDayClick)===null||_e===void 0||_e.call(a,t,e,he):EI(n)?(Ae=o.onDayClick)===null||Ae===void 0||Ae.call(o,t,e,he):(Ce=n.onDayClick)===null||Ce===void 0||Ce.call(n,t,e,he)},z=function(he){var ue;_(t),(ue=n.onDayFocus)===null||ue===void 0||ue.call(n,t,e,he)},F=function(he){var ue;y(),(ue=n.onDayBlur)===null||ue===void 0||ue.call(n,t,e,he)},q=function(he){var ue;(ue=n.onDayMouseEnter)===null||ue===void 0||ue.call(n,t,e,he)},V=function(he){var ue;(ue=n.onDayMouseLeave)===null||ue===void 0||ue.call(n,t,e,he)},K=function(he){var ue;(ue=n.onDayPointerEnter)===null||ue===void 0||ue.call(n,t,e,he)},G=function(he){var ue;(ue=n.onDayPointerLeave)===null||ue===void 0||ue.call(n,t,e,he)},te=function(he){var ue;(ue=n.onDayTouchCancel)===null||ue===void 0||ue.call(n,t,e,he)},ie=function(he){var ue;(ue=n.onDayTouchEnd)===null||ue===void 0||ue.call(n,t,e,he)},oe=function(he){var ue;(ue=n.onDayTouchMove)===null||ue===void 0||ue.call(n,t,e,he)},ye=function(he){var ue;(ue=n.onDayTouchStart)===null||ue===void 0||ue.call(n,t,e,he)},ae=function(he){var ue;(ue=n.onDayKeyUp)===null||ue===void 0||ue.call(n,t,e,he)},pe=function(he){var ue;switch(he.key){case"ArrowLeft":he.preventDefault(),he.stopPropagation(),n.dir==="rtl"?i():h();break;case"ArrowRight":he.preventDefault(),he.stopPropagation(),n.dir==="rtl"?h():i();break;case"ArrowDown":he.preventDefault(),he.stopPropagation(),p();break;case"ArrowUp":he.preventDefault(),he.stopPropagation(),x();break;case"PageUp":he.preventDefault(),he.stopPropagation(),he.shiftKey?N():j();break;case"PageDown":he.preventDefault(),he.stopPropagation(),he.shiftKey?A():C();break;case"Home":he.preventDefault(),he.stopPropagation(),E();break;case"End":he.preventDefault(),he.stopPropagation(),T();break}(ue=n.onDayKeyDown)===null||ue===void 0||ue.call(n,t,e,he)},se={onClick:P,onFocus:z,onBlur:F,onKeyDown:pe,onKeyUp:ae,onMouseEnter:q,onMouseLeave:V,onPointerEnter:K,onPointerLeave:G,onTouchCancel:te,onTouchEnd:ie,onTouchMove:oe,onTouchStart:ye};return se}function Kgt(){var t=rl(),e=HDe(),n=Nxe(),s=Cxe(),a=Nse(t)?e.selected:AI(t)?n.selected:EI(t)?s.selected:void 0;return a}function Zgt(t){return Object.values(km).includes(t)}function Ygt(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(s){var a=t.modifiersClassNames[s];if(a)n.push(a);else if(Zgt(s)){var o=t.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Xgt(t,e){var n=Ea({},t.styles.day);return Object.keys(e).forEach(function(s){var a;n=Ea(Ea({},n),(a=t.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function Qgt(t,e,n){var s,a,o,l=rl(),i=Txe(),h=Vgt(t,e),p=Ggt(t,h),x=Kgt(),y=!!(l.onDayClick||l.mode!=="default");I.useEffect(function(){var q;h.outside||i.focusedDay&&y&&Jl(i.focusedDay,t)&&((q=n.current)===null||q===void 0||q.focus())},[i.focusedDay,t,n,y,h.outside]);var _=Ygt(l,h).join(" "),j=Xgt(l,h),C=!!(h.outside&&!l.showOutsideDays||h.hidden),N=(o=(a=l.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:vgt,A=r.jsx(N,{date:t,displayMonth:e,activeModifiers:h}),E={style:j,className:_,children:A,role:"gridcell"},T=i.focusTarget&&Jl(i.focusTarget,t)&&!h.outside,P=i.focusedDay&&Jl(i.focusedDay,t),z=Ea(Ea(Ea({},E),(s={disabled:h.disabled,role:"gridcell"},s["aria-selected"]=h.selected,s.tabIndex=P||T?0:-1,s)),p),F={isButton:y,isHidden:C,activeModifiers:h,selectedDays:x,buttonProps:z,divProps:E};return F}function Jgt(t){var e=I.useRef(null),n=Qgt(t.date,t.displayMonth,e);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(vte,Ea({name:"day",ref:e},n.buttonProps)):r.jsx("div",Ea({},n.divProps))}function ext(t){var e=t.number,n=t.dates,s=rl(),a=s.onWeekNumberClick,o=s.styles,l=s.classNames,i=s.locale,h=s.labels.labelWeekNumber,p=s.formatters.formatWeekNumber,x=p(Number(e),{locale:i});if(!a)return r.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:x});var y=h(Number(e),{locale:i}),_=function(j){a(e,n,j)};return r.jsx(vte,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:_,children:x})}function txt(t){var e,n,s=rl(),a=s.styles,o=s.classNames,l=s.showWeekNumber,i=s.components,h=(e=i==null?void 0:i.Day)!==null&&e!==void 0?e:Jgt,p=(n=i==null?void 0:i.WeekNumber)!==null&&n!==void 0?n:ext,x;return l&&(x=r.jsx("td",{className:o.cell,style:a.cell,children:r.jsx(p,{number:t.weekNumber,dates:t.dates})})),r.jsxs("tr",{className:o.row,style:a.row,children:[x,t.dates.map(function(y){return r.jsx("td",{className:o.cell,style:a.cell,role:"presentation",children:r.jsx(h,{displayMonth:t.displayMonth,date:y})},odt(y))})]})}function Ske(t,e,n){for(var s=n!=null&&n.ISOWeek?fOe(e):txe(e,n),a=n!=null&&n.ISOWeek?cy(t):uf(t,n),o=dm(s,a),l=[],i=0;i<=o;i++)l.push(Kl(a,i));var h=l.reduce(function(p,x){var y=n!=null&&n.ISOWeek?rxe(x):sxe(x,n),_=p.find(function(j){return j.weekNumber===y});return _?(_.dates.push(x),p):(p.push({weekNumber:y,dates:[x]}),p)},[]);return h}function rxt(t,e){var n=Ske(_h(t),use(t),e);if(e!=null&&e.useFixedWeeks){var s=cdt(t,e);if(s<6){var a=n[n.length-1],o=a.dates[a.dates.length-1],l=Uw(o,6-s),i=Ske(Uw(o,1),l,e);n.push.apply(n,i)}}return n}function nxt(t){var e,n,s,a=rl(),o=a.locale,l=a.classNames,i=a.styles,h=a.hideHead,p=a.fixedWeeks,x=a.components,y=a.weekStartsOn,_=a.firstWeekContainsDate,j=a.ISOWeek,C=rxt(t.displayMonth,{useFixedWeeks:!!p,ISOWeek:j,locale:o,weekStartsOn:y,firstWeekContainsDate:_}),N=(e=x==null?void 0:x.Head)!==null&&e!==void 0?e:ygt,A=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:txt,E=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:mgt;return r.jsxs("table",{id:t.id,className:l.table,style:i.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!h&&r.jsx(N,{}),r.jsx("tbody",{className:l.tbody,style:i.tbody,children:C.map(function(T){return r.jsx(A,{displayMonth:t.displayMonth,dates:T.dates,weekNumber:T.weekNumber},T.weekNumber)})}),r.jsx(E,{displayMonth:t.displayMonth})]})}function sxt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var axt=sxt()?I.useLayoutEffect:I.useEffect,ece=!1,ixt=0;function Cke(){return"react-day-picker-".concat(++ixt)}function oxt(t){var e,n=t??(ece?Cke():null),s=I.useState(n),a=s[0],o=s[1];return axt(function(){a===null&&o(Cke())},[]),I.useEffect(function(){ece===!1&&(ece=!0)},[]),(e=t??a)!==null&&e!==void 0?e:void 0}function lxt(t){var e,n,s=rl(),a=s.dir,o=s.classNames,l=s.styles,i=s.components,h=II().displayMonths,p=oxt(s.id?"".concat(s.id,"-").concat(t.displayIndex):void 0),x=s.id?"".concat(s.id,"-grid-").concat(t.displayIndex):void 0,y=[o.month],_=l.month,j=t.displayIndex===0,C=t.displayIndex===h.length-1,N=!j&&!C;a==="rtl"&&(e=[j,C],C=e[0],j=e[1]),j&&(y.push(o.caption_start),_=Ea(Ea({},_),l.caption_start)),C&&(y.push(o.caption_end),_=Ea(Ea({},_),l.caption_end)),N&&(y.push(o.caption_between),_=Ea(Ea({},_),l.caption_between));var A=(n=i==null?void 0:i.Caption)!==null&&n!==void 0?n:pgt;return r.jsxs("div",{className:y.join(" "),style:_,children:[r.jsx(A,{id:p,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(nxt,{id:x,"aria-labelledby":p,displayMonth:t.displayMonth})]},t.displayIndex)}function cxt(t){var e=rl(),n=e.classNames,s=e.styles;return r.jsx("div",{className:n.months,style:s.months,children:t.children})}function dxt(t){var e,n,s=t.initialProps,a=rl(),o=Txe(),l=II(),i=I.useState(!1),h=i[0],p=i[1];I.useEffect(function(){a.initialFocus&&o.focusTarget&&(h||(o.focus(o.focusTarget),p(!0)))},[a.initialFocus,h,o.focus,o.focusTarget,o]);var x=[a.classNames.root,a.className];a.numberOfMonths>1&&x.push(a.classNames.multiple_months),a.showWeekNumber&&x.push(a.classNames.with_weeknumber);var y=Ea(Ea({},a.styles.root),a.style),_=Object.keys(s).filter(function(C){return C.startsWith("data-")}).reduce(function(C,N){var A;return Ea(Ea({},C),(A={},A[N]=s[N],A))},{}),j=(n=(e=s.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:cxt;return r.jsx("div",Ea({className:x.join(" "),style:y,dir:a.dir,id:a.id,nonce:s.nonce,title:s.title,lang:s.lang},_,{children:r.jsx(j,{children:l.displayMonths.map(function(C,N){return r.jsx(lxt,{displayIndex:N,displayMonth:C},N)})})}))}function uxt(t){var e=t.children,n=Omt(t,["children"]);return r.jsx(egt,{initialProps:n,children:r.jsx(dgt,{children:r.jsx(Hgt,{initialProps:n,children:r.jsx(_gt,{initialProps:n,children:r.jsx(jgt,{initialProps:n,children:r.jsx(Egt,{children:r.jsx(qgt,{children:e})})})})})})})}function hxt(t){return r.jsx(uxt,Ea({},t,{children:r.jsx(dxt,{initialProps:t})}))}function Yx({className:t,classNames:e,showOutsideDays:n=!0,...s}){return r.jsx(hxt,{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(eE({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(eE({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:({...a})=>r.jsx(Ac,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(Vi,{className:"h-4 w-4"})},...s})}Yx.displayName="Calendar";var Sse="Popover",[WDe]=rc(Sse,[Bg]),PI=Bg(),[fxt,cv]=WDe(Sse),GDe=t=>{const{__scopePopover:e,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!1}=t,i=PI(e),h=I.useRef(null),[p,x]=I.useState(!1),[y,_]=$u({prop:s,defaultProp:a??!1,onChange:o,caller:Sse});return r.jsx(fI,{...i,children:r.jsx(fxt,{scope:e,contentId:Kc(),triggerRef:h,open:y,onOpenChange:_,onOpenToggle:I.useCallback(()=>_(j=>!j),[_]),hasCustomAnchor:p,onCustomAnchorAdd:I.useCallback(()=>x(!0),[]),onCustomAnchorRemove:I.useCallback(()=>x(!1),[]),modal:l,children:n})})};GDe.displayName=Sse;var KDe="PopoverAnchor",pxt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=cv(KDe,n),o=PI(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return I.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(e3,{...o,...s,ref:e})});pxt.displayName=KDe;var ZDe="PopoverTrigger",YDe=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=cv(ZDe,n),o=PI(n),l=ta(e,a.triggerRef),i=r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":tRe(a.open),...s,ref:l,onClick:on(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(e3,{asChild:!0,...o,children:i})});YDe.displayName=ZDe;var Exe="PopoverPortal",[mxt,gxt]=WDe(Exe,{forceMount:void 0}),XDe=t=>{const{__scopePopover:e,forceMount:n,children:s,container:a}=t,o=cv(Exe,e);return r.jsx(mxt,{scope:e,forceMount:n,children:r.jsx(xc,{present:n||o.open,children:r.jsx(ZC,{asChild:!0,container:a,children:s})})})};XDe.displayName=Exe;var gC="PopoverContent",QDe=I.forwardRef((t,e)=>{const n=gxt(gC,t.__scopePopover),{forceMount:s=n.forceMount,...a}=t,o=cv(gC,t.__scopePopover);return r.jsx(xc,{present:s||o.open,children:o.modal?r.jsx(yxt,{...a,ref:e}):r.jsx(vxt,{...a,ref:e})})});QDe.displayName=gC;var xxt=z1("PopoverContent.RemoveScroll"),yxt=I.forwardRef((t,e)=>{const n=cv(gC,t.__scopePopover),s=I.useRef(null),a=ta(e,s),o=I.useRef(!1);return I.useEffect(()=>{const l=s.current;if(l)return Rne(l)},[]),r.jsx(_I,{as:xxt,allowPinchZoom:!0,children:r.jsx(JDe,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:on(t.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:on(t.onPointerDownOutside,l=>{const i=l.detail.originalEvent,h=i.button===0&&i.ctrlKey===!0,p=i.button===2||h;o.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:on(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),vxt=I.forwardRef((t,e)=>{const n=cv(gC,t.__scopePopover),s=I.useRef(!1),a=I.useRef(!1);return r.jsx(JDe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),JDe=I.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:x,...y}=t,_=cv(gC,n),j=PI(n);return Dne(),r.jsx(yI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(rv,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:i,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>_.onOpenChange(!1),children:r.jsx(pI,{"data-state":tRe(_.open),role:"dialog",id:_.contentId,...j,...y,ref:e,style:{...y.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)"}})})})}),eRe="PopoverClose",_xt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=cv(eRe,n);return r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:on(t.onClick,()=>a.onOpenChange(!1))})});_xt.displayName=eRe;var bxt="PopoverArrow",wxt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=PI(n);return r.jsx(mI,{...a,...s,ref:e})});wxt.displayName=bxt;function tRe(t){return t?"open":"closed"}var jxt=GDe,kxt=YDe,Nxt=XDe,rRe=QDe;const hu=jxt,fu=kxt,Bd=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},a)=>r.jsx(Nxt,{children:r.jsx(rRe,{ref:a,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})}));Bd.displayName=rRe.displayName;const Sxt=YC("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"}}),Ixe=I.forwardRef(({className:t,variant:e,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:zt(Sxt({variant:e}),t),...n}));Ixe.displayName="Alert";const Cxt=I.forwardRef(({className:t,...e},n)=>r.jsx("h5",{ref:n,className:zt("mb-1 font-medium leading-none tracking-tight",t),...e}));Cxt.displayName="AlertTitle";const Pxe=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("text-sm [&_p]:leading-relaxed",t),...e}));Pxe.displayName="AlertDescription";function Mxt({open:t,onOpenChange:e,imageUrl:n,imageId:s,defaultCaption:a="",swagItemId:o,reelId:l}){const i=Vr(),[h,p]=I.useState(a),[x,y]=I.useState([]),[_,j]=I.useState(null),[C,N]=I.useState("now"),[A,E]=I.useState(Yje(nke(new Date),1)),[T,P]=I.useState("12"),[z,F]=I.useState("00"),[q,V]=I.useState("PM");I.useEffect(()=>{if(t){p(a),N("now"),y([]);const ge=Yje(nke(new Date),1);E(ge);const Le=ge.getHours();P(String(Le>12?Le-12:Le===0?12:Le)),F("00"),V(Le>=12?"PM":"AM")}},[t,a]);const K=()=>{if(!A)return null;let ge=parseInt(T);const Le=parseInt(z);return q==="PM"&&ge!==12&&(ge+=12),q==="AM"&&ge===12&&(ge=0),wOe(bOe(A,ge),Le)},{data:G,isLoading:te}=Yt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ge}}=await J.auth.getUser();if(!ge)return[];const{data:Le,error:ke}=await J.from("social_accounts").select("*").eq("user_id",ge.id).eq("is_active",!0).order("platform",{ascending:!0});if(ke)throw ke;return console.log("Fetched social accounts for posting:",Le),Le},enabled:t,staleTime:0}),ie=cr({mutationFn:async({accountId:ge,platform:Le})=>{j(ge);const{data:ke,error:Be}=await J.functions.invoke("social-post",{body:{platform:Le,accountId:ge,imageUrl:n,caption:h}});if(Be)throw Be;if(ke!=null&&ke.error)throw new Error(ke.error);return ke},onSuccess:ge=>{const Le=ge.platform==="facebook"?"Facebook":ge.platform==="instagram"?"Instagram":ge.platform==="linkedin"?"LinkedIn":"Google Business";ze.success(`Posted to ${Le}!`)},onError:ge=>{ze.error(`Failed to post: ${ge.message}`)},onSettled:()=>{j(null)}}),oe=cr({mutationFn:async({accountId:ge,platform:Le,scheduledFor:ke})=>{const{data:{user:Be}}=await J.auth.getUser();if(!Be)throw new Error("Not authenticated");const{error:Ee}=await J.from("scheduled_posts").insert({user_id:Be.id,social_account_id:ge,platform:Le,image_url:n,caption:h,swag_item_id:o||null,reel_id:l||null,scheduled_for:ke.toISOString(),status:"scheduled"});if(Ee)throw Ee;return{platform:Le}},onSuccess:ge=>{const Le=ge.platform==="facebook"?"Facebook":ge.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Post scheduled for ${Le}!`)},onError:ge=>{ze.error(`Failed to schedule: ${ge.message}`)}}),ye=async()=>{if(x.length===0){ze.error("Please select at least one account");return}if(C==="schedule"){const ge=K();if(!ge||ge<=new Date){ze.error("Please select a future date and time");return}for(const Le of x){const ke=G==null?void 0:G.find(Be=>Be.id===Le);ke&&await oe.mutateAsync({accountId:Le,platform:ke.platform,scheduledFor:ge})}i.invalidateQueries({queryKey:["scheduled-posts"]}),ze.success(`${x.length} post(s) scheduled for ${xn(ge,"PPp")}`)}else for(const ge of x){const Le=G==null?void 0:G.find(ke=>ke.id===ge);Le&&await ie.mutateAsync({accountId:ge,platform:Le.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),p(""),y([]),e(!1)},ae=ge=>{y(Le=>Le.includes(ge)?Le.filter(ke=>ke!==ge):[...Le,ge])},pe=(G==null?void 0:G.filter(ge=>ge.platform==="facebook"))||[],se=(G==null?void 0:G.filter(ge=>ge.platform==="instagram"))||[],he=(G==null?void 0:G.filter(ge=>ge.platform==="linkedin"))||[],ue=(G==null?void 0:G.filter(ge=>ge.platform==="google_business"))||[],_e=((G==null?void 0:G.length)||0)>0,Ae=ie.isPending||oe.isPending,Ce=Array.from({length:12},(ge,Le)=>String(Le+1)),Se=["00","15","30","45"];return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create Social Post"}),r.jsx(Qn,{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(He,{htmlFor:"caption",children:"Caption"}),r.jsx(ps,{id:"caption",placeholder:"Write a caption for your post...",value:h,onChange:ge=>p(ge.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{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:()=>N("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:()=>N("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(Ya,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("justify-start text-left font-normal flex-1",!A&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),A?xn(A,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:A,onSelect:E,disabled:ge=>ger.jsx(qt,{value:ge,children:ge},ge))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(gn,{value:z,onValueChange:F,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:Se.map(ge=>r.jsx(qt,{value:ge,children:ge},ge))})]}),r.jsxs(gn,{value:q,onValueChange:ge=>V(ge),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"AM",children:"AM"}),r.jsx(qt,{value:"PM",children:"PM"})]})]})]})]}),A&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",xn(K()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Post to"}),te&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-6 w-6 animate-spin"})}),!te&&!_e&&r.jsxs(Ixe,{children:[r.jsx(fl,{className:"h-4 w-4"}),r.jsxs(Pxe,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(co,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(md,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),pe.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(zd,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),pe.map(ge=>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(Dl,{checked:x.includes(ge.id),onCheckedChange:()=>ae(ge.id),disabled:_===ge.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:ge.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(zd,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ge.page_name||ge.platform_username}),_===ge.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},ge.id))]}),se.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(du,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),se.map(ge=>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(Dl,{checked:x.includes(ge.id),onCheckedChange:()=>ae(ge.id),disabled:_===ge.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:ge.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(du,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",ge.platform_username]}),_===ge.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},ge.id))]}),he.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(xm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),he.map(ge=>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(Dl,{checked:x.includes(ge.id),onCheckedChange:()=>ae(ge.id),disabled:_===ge.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:ge.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(xm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ge.platform_username}),_===ge.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},ge.id))]}),ue.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(Mo,{className:"h-4 w-4 text-red-600"})," Google Business"]}),ue.map(ge=>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(Dl,{checked:x.includes(ge.id),onCheckedChange:()=>ae(ge.id),disabled:_===ge.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:ge.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(Mo,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ge.page_name||ge.platform_username}),_===ge.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},ge.id))]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{onClick:ye,disabled:x.length===0||Ae,className:"gap-2",children:[Ae?r.jsx(en,{className:"h-4 w-4 animate-spin"}):C==="schedule"?r.jsx(Os,{className:"h-4 w-4"}):r.jsx(Do,{className:"h-4 w-4"}),C==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}function Txt(){const t=Vr(),[e,n]=I.useState(void 0),[s,a]=I.useState("all"),[o,l]=I.useState(null),[i,h]=I.useState(""),[p,x]=I.useState(void 0),[y,_]=I.useState("12"),[j,C]=I.useState("00"),[N,A]=I.useState("PM"),{data:E=[],isLoading:T}=Yt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:ue,error:_e}=await J.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(_e)throw _e;return ue}}),P=E.filter(ue=>{if(s!=="all"&&ue.status!==s)return!1;if(e&&ue.scheduled_for){const _e=new Date(ue.scheduled_for);if(!Jl(_e,e))return!1}return!0}),z=E.filter(ue=>ue.scheduled_for).map(ue=>hf(new Date(ue.scheduled_for))),F=cr({mutationFn:async ue=>{const{error:_e}=await J.from("scheduled_posts").update({caption:ue.caption,scheduled_for:ue.scheduled_for}).eq("id",ue.id);if(_e)throw _e},onSuccess:()=>{ze.success("Post updated!"),t.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:ue=>{ze.error(`Failed to update: ${ue.message}`)}}),q=cr({mutationFn:async ue=>{const{error:_e}=await J.from("scheduled_posts").update({status:"cancelled"}).eq("id",ue);if(_e)throw _e},onSuccess:()=>{ze.success("Post cancelled"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{ze.error(`Failed to cancel: ${ue.message}`)}}),V=cr({mutationFn:async ue=>{const{error:_e}=await J.from("scheduled_posts").delete().eq("id",ue);if(_e)throw _e},onSuccess:()=>{ze.success("Post deleted"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{ze.error(`Failed to delete: ${ue.message}`)}}),K=cr({mutationFn:async ue=>{const{data:_e,error:Ae}=await J.functions.invoke("social-post",{body:{platform:ue.platform,accountId:ue.social_account_id,imageUrl:ue.image_url,caption:ue.caption}});if(Ae)throw Ae;if(_e!=null&&_e.error)throw new Error(_e.error);return await J.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:_e.postId}).eq("id",ue.id),_e},onSuccess:ue=>{const _e=ue.platform==="facebook"?"Facebook":ue.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Posted to ${_e}!`),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{ze.error(`Failed to post: ${ue.message}`)}}),G=ue=>{if(l(ue),h(ue.caption||""),ue.scheduled_for){const _e=new Date(ue.scheduled_for);x(_e);const Ae=_e.getHours();_(String(Ae>12?Ae-12:Ae===0?12:Ae)),C(String(_e.getMinutes()).padStart(2,"0")),A(Ae>=12?"PM":"AM")}},te=()=>{if(!o||!p)return;let ue=parseInt(y);const _e=parseInt(j);N==="PM"&&ue!==12&&(ue+=12),N==="AM"&&ue===12&&(ue=0);const Ae=wOe(bOe(p,ue),_e);F.mutate({id:o.id,caption:i,scheduled_for:Ae.toISOString()})},ie=ue=>{switch(ue){case"facebook":return r.jsx(zd,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(du,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(xm,{className:"h-4 w-4 text-blue-700"});default:return null}},oe=ue=>{switch(ue){case"scheduled":return r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Ot,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(Yi,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Ot,{variant:"destructive",className:"gap-1",children:[r.jsx(Vc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Ot,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(fl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Ot,{variant:"outline",children:ue})}},ye=Array.from({length:12},(ue,_e)=>String(_e+1)),ae=["00","15","30","45"],pe=E.filter(ue=>ue.status==="scheduled").length,se=E.filter(ue=>ue.status==="posted").length,he=E.filter(ue=>ue.status==="scheduled"&&ue.scheduled_for&&ddt(new Date(ue.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:pe}),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:he}),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:se}),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:E.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(mm,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Yx,{mode:"single",selected:e,onSelect:n,className:zt("pointer-events-auto"),modifiers:{hasPost:z},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),e&&r.jsx(ee,{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(v1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(ue=>r.jsx(ee,{variant:s===ue?"default":"outline",size:"sm",onClick:()=>a(ue),className:"capitalize",children:ue},ue))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!T&&P.length===0&&r.jsxs(Ye,{className:"p-8 text-center",children:[r.jsx(Os,{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 ${xn(e,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:P.map(ue=>{var _e,Ae;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:ue.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:[ie(ue.platform),r.jsx("span",{className:"font-medium",children:((_e=ue.social_accounts)==null?void 0:_e.page_name)||((Ae=ue.social_accounts)==null?void 0:Ae.platform_username)||"Unknown"}),oe(ue.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[ue.status==="scheduled"&&r.jsxs(gI,{children:[r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>G(ue),children:r.jsx(fi,{className:"h-4 w-4"})})}),r.jsx(vm,{children:"Edit post"})]}),r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>K.mutate(ue),disabled:K.isPending,children:K.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(Do,{className:"h-4 w-4"})})}),r.jsx(vm,{children:"Post now"})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Cancel this scheduled post?"}),r.jsx(ou,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Keep"}),r.jsx(Dd,{onClick:()=>q.mutate(ue.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Dd,{onClick:()=>V.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(ue.status==="posted"||ue.status==="cancelled"||ue.status==="failed")&&r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Delete this post?"}),r.jsx(ou,{children:"This will permanently remove this post from your history."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>V.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),ue.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:ue.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),ue.status==="posted"&&ue.posted_at?`Posted ${xn(new Date(ue.posted_at),"PPp")}`:ue.scheduled_for?`Scheduled for ${xn(new Date(ue.scheduled_for),"PPp")}`:"Not scheduled"]}),ue.status==="failed"&&ue.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",ue.error_message]})]})]})},ue.id)})})]})]}),r.jsx(Fr,{open:!!o,onOpenChange:ue=>!ue&&l(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Scheduled Post"}),r.jsx(Qn,{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(He,{children:"Caption"}),r.jsx(ps,{value:i,onChange:ue=>h(ue.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(He,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("justify-start text-left font-normal flex-1",!p&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),p?xn(p,"PPP"):"Pick a date"]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:p,onSelect:x,disabled:ue=>uer.jsx(qt,{value:ue,children:ue},ue))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(gn,{value:j,onValueChange:C,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:ae.map(ue=>r.jsx(qt,{value:ue,children:ue},ue))})]}),r.jsxs(gn,{value:N,onValueChange:ue=>A(ue),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"AM",children:"AM"}),r.jsx(qt,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(ee,{onClick:te,disabled:F.isPending,children:[F.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function jL(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 nRe={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,a,o){function l(p,x){if(!a[p]){if(!s[p]){var y=typeof jL=="function"&&jL;if(!x&&y)return y(p,!0);if(i)return i(p,!0);var _=new Error("Cannot find module '"+p+"'");throw _.code="MODULE_NOT_FOUND",_}var j=a[p]={exports:{}};s[p][0].call(j.exports,function(C){var N=s[p][1][C];return l(N||C)},j,j.exports,n,s,a,o)}return a[p].exports}for(var i=typeof jL=="function"&&jL,h=0;h>2,j=(3&p)<<4|x>>4,C=1>6:64,N=2>4,x=(15&_)<<4|(j=i.indexOf(h.charAt(N++)))>>2,y=(3&j)<<6|(C=i.indexOf(h.charAt(N++))),T[A++]=p,j!==64&&(T[A++]=x),C!==64&&(T[A++]=y);return T}},{"./support":30,"./utils":32}],2:[function(n,s,a){var o=n("./external"),l=n("./stream/DataWorker"),i=n("./stream/Crc32Probe"),h=n("./stream/DataLengthProbe");function p(x,y,_,j,C){this.compressedSize=x,this.uncompressedSize=y,this.crc32=_,this.compression=j,this.compressedContent=C}p.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),y=this;return x.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new l(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},p.createWorkerFrom=function(x,y,_){return x.pipe(new i).pipe(new h("uncompressedSize")).pipe(y.compressWorker(_)).pipe(new h("compressedSize")).withStreamInfo("compression",y)},s.exports=p},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,a){var o=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,a){var o=n("./utils"),l=function(){for(var i,h=[],p=0;p<256;p++){i=p;for(var x=0;x<8;x++)i=1&i?3988292384^i>>>1:i>>>1;h[p]=i}return h}();s.exports=function(i,h){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(p,x,y,_){var j=l,C=_+y;p^=-1;for(var N=_;N>>8^j[255&(p^x[N])];return-1^p}(0|h,i,i.length,0):function(p,x,y,_){var j=l,C=_+y;p^=-1;for(var N=_;N>>8^j[255&(p^x.charCodeAt(N))];return-1^p}(0|h,i,i.length,0):0}},{"./utils":32}],5:[function(n,s,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,s,a){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,a){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),i=n("./utils"),h=n("./stream/GenericWorker"),p=o?"uint8array":"array";function x(y,_){h.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=_,this.meta={}}a.magic="\b\0",i.inherits(x,h),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(p,y.data),!1)},x.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(_){y.push({data:_,meta:y.meta})}},a.compressWorker=function(y){return new x("Deflate",y)},a.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,a){function o(j,C){var N,A="";for(N=0;N>>=8;return A}function l(j,C,N,A,E,T){var P,z,F=j.file,q=j.compression,V=T!==p.utf8encode,K=i.transformTo("string",T(F.name)),G=i.transformTo("string",p.utf8encode(F.name)),te=F.comment,ie=i.transformTo("string",T(te)),oe=i.transformTo("string",p.utf8encode(te)),ye=G.length!==F.name.length,ae=oe.length!==te.length,pe="",se="",he="",ue=F.dir,_e=F.date,Ae={crc32:0,compressedSize:0,uncompressedSize:0};C&&!N||(Ae.crc32=j.crc32,Ae.compressedSize=j.compressedSize,Ae.uncompressedSize=j.uncompressedSize);var Ce=0;C&&(Ce|=8),V||!ye&&!ae||(Ce|=2048);var Se=0,ge=0;ue&&(Se|=16),E==="UNIX"?(ge=798,Se|=function(ke,Be){var Ee=ke;return ke||(Ee=Be?16893:33204),(65535&Ee)<<16}(F.unixPermissions,ue)):(ge=20,Se|=function(ke){return 63&(ke||0)}(F.dosPermissions)),P=_e.getUTCHours(),P<<=6,P|=_e.getUTCMinutes(),P<<=5,P|=_e.getUTCSeconds()/2,z=_e.getUTCFullYear()-1980,z<<=4,z|=_e.getUTCMonth()+1,z<<=5,z|=_e.getUTCDate(),ye&&(se=o(1,1)+o(x(K),4)+G,pe+="up"+o(se.length,2)+se),ae&&(he=o(1,1)+o(x(ie),4)+oe,pe+="uc"+o(he.length,2)+he);var Le="";return Le+=` \0`,Le+=o(Ce,2),Le+=q.magic,Le+=o(P,2),Le+=o(z,2),Le+=o(Ae.crc32,4),Le+=o(Ae.compressedSize,4),Le+=o(Ae.uncompressedSize,4),Le+=o(K.length,2),Le+=o(pe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+Le+K+pe,dirRecord:y.CENTRAL_FILE_HEADER+o(ge,2)+Le+o(ie.length,2)+"\0\0\0\0"+o(Se,4)+o(A,4)+K+pe+ie}}var i=n("../utils"),h=n("../stream/GenericWorker"),p=n("../utf8"),x=n("../crc32"),y=n("../signature");function _(j,C,N,A){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=C,this.zipPlatform=N,this.encodeFileName=A,this.streamFiles=j,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(_,h),_.prototype.push=function(j){var C=j.meta.percent||0,N=this.entriesCount,A=this._sources.length;this.accumulate?this.contentBuffer.push(j):(this.bytesWritten+=j.data.length,h.prototype.push.call(this,{data:j.data,meta:{currentFile:this.currentFile,percent:N?(C+100*(N-A-1))/N:100}}))},_.prototype.openedSource=function(j){this.currentSourceOffset=this.bytesWritten,this.currentFile=j.file.name;var C=this.streamFiles&&!j.file.dir;if(C){var N=l(j,C,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:N.fileRecord,meta:{percent:0}})}else this.accumulate=!0},_.prototype.closedSource=function(j){this.accumulate=!1;var C=this.streamFiles&&!j.file.dir,N=l(j,C,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(N.dirRecord),C)this.push({data:function(A){return y.DATA_DESCRIPTOR+o(A.crc32,4)+o(A.compressedSize,4)+o(A.uncompressedSize,4)}(j),meta:{percent:100}});else for(this.push({data:N.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},_.prototype.flush=function(){for(var j=this.bytesWritten,C=0;C=this.index;h--)p=(p<<8)+this.byteAt(h);return this.index+=i,p},readString:function(i){return o.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},s.exports=l},{"../utils":32}],19:[function(n,s,a){var o=n("./Uint8ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){this.checkOffset(i);var h=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,h},s.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,a){var o=n("./DataReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},l.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},l.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},l.prototype.readData=function(i){this.checkOffset(i);var h=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,h},s.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,s,a){var o=n("./ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,h},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,a){var o=n("../utils"),l=n("../support"),i=n("./ArrayReader"),h=n("./StringReader"),p=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(y){var _=o.getTypeOf(y);return o.checkSupport(_),_!=="string"||l.uint8array?_==="nodebuffer"?new p(y):l.uint8array?new x(o.transformTo("uint8array",y)):new i(o.transformTo("array",y)):new h(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,a){var o=n("./GenericWorker"),l=n("../utils");function i(h){o.call(this,"ConvertWorker to "+h),this.destType=h}l.inherits(i,o),i.prototype.processChunk=function(h){this.push({data:l.transformTo(this.destType,h.data),meta:h.meta})},s.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,a){var o=n("./GenericWorker"),l=n("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(i,o),i.prototype.processChunk=function(h){this.streamInfo.crc32=l(h.data,this.streamInfo.crc32||0),this.push(h)},s.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(h){l.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}o.inherits(i,l),i.prototype.processChunk=function(h){if(h){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+h.data.length}l.prototype.processChunk.call(this,h)},s.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(h){l.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(x){p.dataIsReady=!0,p.data=x,p.max=x&&x.length||0,p.type=o.getTypeOf(x),p.isPaused||p._tickAndRepeat()},function(x){p.error(x)})}o.inherits(i,l),i.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,p);break;case"uint8array":h=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":h=this.data.slice(this.index,p)}return this.index=p,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,a){function o(l){this.name=l||"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(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,i){return this._listeners[l].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,i){if(this._listeners[l])for(var h=0;h "+l:l}},s.exports=o},{}],29:[function(n,s,a){var o=n("../utils"),l=n("./ConvertWorker"),i=n("./GenericWorker"),h=n("../base64"),p=n("../support"),x=n("../external"),y=null;if(p.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function _(C,N){return new x.Promise(function(A,E){var T=[],P=C._internalType,z=C._outputType,F=C._mimeType;C.on("data",function(q,V){T.push(q),N&&N(V)}).on("error",function(q){T=[],E(q)}).on("end",function(){try{var q=function(V,K,G){switch(V){case"blob":return o.newBlob(o.transformTo("arraybuffer",K),G);case"base64":return h.encode(K);default:return o.transformTo(V,K)}}(z,function(V,K){var G,te=0,ie=null,oe=0;for(G=0;G"u")a.blob=!1;else{var o=new ArrayBuffer(0);try{a.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),a.blob=l.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!n("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,a){for(var o=n("./utils"),l=n("./support"),i=n("./nodejsUtils"),h=n("./stream/GenericWorker"),p=new Array(256),x=0;x<256;x++)p[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;p[254]=p[254]=1;function y(){h.call(this,"utf-8 decode"),this.leftOver=null}function _(){h.call(this,"utf-8 encode")}a.utf8encode=function(j){return l.nodebuffer?i.newBufferFrom(j,"utf-8"):function(C){var N,A,E,T,P,z=C.length,F=0;for(T=0;T>>6:(A<65536?N[P++]=224|A>>>12:(N[P++]=240|A>>>18,N[P++]=128|A>>>12&63),N[P++]=128|A>>>6&63),N[P++]=128|63&A);return N}(j)},a.utf8decode=function(j){return l.nodebuffer?o.transformTo("nodebuffer",j).toString("utf-8"):function(C){var N,A,E,T,P=C.length,z=new Array(2*P);for(N=A=0;N>10&1023,z[A++]=56320|1023&E)}return z.length!==A&&(z.subarray?z=z.subarray(0,A):z.length=A),o.applyFromCharCode(z)}(j=o.transformTo(l.uint8array?"uint8array":"array",j))},o.inherits(y,h),y.prototype.processChunk=function(j){var C=o.transformTo(l.uint8array?"uint8array":"array",j.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var N=C;(C=new Uint8Array(N.length+this.leftOver.length)).set(this.leftOver,0),C.set(N,this.leftOver.length)}else C=this.leftOver.concat(C);this.leftOver=null}var A=function(T,P){var z;for((P=P||T.length)>T.length&&(P=T.length),z=P-1;0<=z&&(192&T[z])==128;)z--;return z<0||z===0?P:z+p[T[z]]>P?z:P}(C),E=C;A!==C.length&&(l.uint8array?(E=C.subarray(0,A),this.leftOver=C.subarray(A,C.length)):(E=C.slice(0,A),this.leftOver=C.slice(A,C.length))),this.push({data:a.utf8decode(E),meta:j.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=y,o.inherits(_,h),_.prototype.processChunk=function(j){this.push({data:a.utf8encode(j.data),meta:j.meta})},a.Utf8EncodeWorker=_},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,a){var o=n("./support"),l=n("./base64"),i=n("./nodejsUtils"),h=n("./external");function p(N){return N}function x(N,A){for(var E=0;E>8;this.dir=!!(16&this.externalFileAttributes),j==0&&(this.dosPermissions=63&this.externalFileAttributes),j==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var j=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=j.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=j.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=j.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=j.readInt(4))}},readExtraFields:function(j){var C,N,A,E=j.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});j.index+4>>6:(j<65536?_[A++]=224|j>>>12:(_[A++]=240|j>>>18,_[A++]=128|j>>>12&63),_[A++]=128|j>>>6&63),_[A++]=128|63&j);return _},a.buf2binstring=function(y){return x(y,y.length)},a.binstring2buf=function(y){for(var _=new o.Buf8(y.length),j=0,C=_.length;j>10&1023,T[C++]=56320|1023&N)}return x(T,C)},a.utf8border=function(y,_){var j;for((_=_||y.length)>y.length&&(_=y.length),j=_-1;0<=j&&(192&y[j])==128;)j--;return j<0||j===0?_:j+h[y[j]]>_?j:_}},{"./common":41}],43:[function(n,s,a){s.exports=function(o,l,i,h){for(var p=65535&o|0,x=o>>>16&65535|0,y=0;i!==0;){for(i-=y=2e3>>1:l>>>1;i[h]=l}return i}();s.exports=function(l,i,h,p){var x=o,y=p+h;l^=-1;for(var _=p;_>>8^x[255&(l^i[_])];return-1^l}},{}],46:[function(n,s,a){var o,l=n("../utils/common"),i=n("./trees"),h=n("./adler32"),p=n("./crc32"),x=n("./messages"),y=0,_=4,j=0,C=-2,N=-1,A=4,E=2,T=8,P=9,z=286,F=30,q=19,V=2*z+1,K=15,G=3,te=258,ie=te+G+1,oe=42,ye=113,ae=1,pe=2,se=3,he=4;function ue(me,yt){return me.msg=x[yt],yt}function _e(me){return(me<<1)-(4me.avail_out&&(rt=me.avail_out),rt!==0&&(l.arraySet(me.output,yt.pending_buf,yt.pending_out,rt,me.next_out),me.next_out+=rt,yt.pending_out+=rt,me.total_out+=rt,me.avail_out-=rt,yt.pending-=rt,yt.pending===0&&(yt.pending_out=0))}function Se(me,yt){i._tr_flush_block(me,0<=me.block_start?me.block_start:-1,me.strstart-me.block_start,yt),me.block_start=me.strstart,Ce(me.strm)}function ge(me,yt){me.pending_buf[me.pending++]=yt}function Le(me,yt){me.pending_buf[me.pending++]=yt>>>8&255,me.pending_buf[me.pending++]=255&yt}function ke(me,yt){var rt,at,Me=me.max_chain_length,ft=me.strstart,qe=me.prev_length,Oe=me.nice_match,Qe=me.strstart>me.w_size-ie?me.strstart-(me.w_size-ie):0,nt=me.window,gt=me.w_mask,mt=me.prev,Mt=me.strstart+te,wt=nt[ft+qe-1],Qt=nt[ft+qe];me.prev_length>=me.good_match&&(Me>>=2),Oe>me.lookahead&&(Oe=me.lookahead);do if(nt[(rt=yt)+qe]===Qt&&nt[rt+qe-1]===wt&&nt[rt]===nt[ft]&&nt[++rt]===nt[ft+1]){ft+=2,rt++;do;while(nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&ftQe&&--Me!=0);return qe<=me.lookahead?qe:me.lookahead}function Be(me){var yt,rt,at,Me,ft,qe,Oe,Qe,nt,gt,mt=me.w_size;do{if(Me=me.window_size-me.lookahead-me.strstart,me.strstart>=mt+(mt-ie)){for(l.arraySet(me.window,me.window,mt,mt,0),me.match_start-=mt,me.strstart-=mt,me.block_start-=mt,yt=rt=me.hash_size;at=me.head[--yt],me.head[yt]=mt<=at?at-mt:0,--rt;);for(yt=rt=mt;at=me.prev[--yt],me.prev[yt]=mt<=at?at-mt:0,--rt;);Me+=mt}if(me.strm.avail_in===0)break;if(qe=me.strm,Oe=me.window,Qe=me.strstart+me.lookahead,nt=Me,gt=void 0,gt=qe.avail_in,nt=G)for(ft=me.strstart-me.insert,me.ins_h=me.window[ft],me.ins_h=(me.ins_h<=G&&(me.ins_h=(me.ins_h<=G)if(at=i._tr_tally(me,me.strstart-me.match_start,me.match_length-G),me.lookahead-=me.match_length,me.match_length<=me.max_lazy_match&&me.lookahead>=G){for(me.match_length--;me.strstart++,me.ins_h=(me.ins_h<=G&&(me.ins_h=(me.ins_h<=G&&me.match_length<=me.prev_length){for(Me=me.strstart+me.lookahead-G,at=i._tr_tally(me,me.strstart-1-me.prev_match,me.prev_length-G),me.lookahead-=me.prev_length-1,me.prev_length-=2;++me.strstart<=Me&&(me.ins_h=(me.ins_h<me.pending_buf_size-5&&(rt=me.pending_buf_size-5);;){if(me.lookahead<=1){if(Be(me),me.lookahead===0&&yt===y)return ae;if(me.lookahead===0)break}me.strstart+=me.lookahead,me.lookahead=0;var at=me.block_start+rt;if((me.strstart===0||me.strstart>=at)&&(me.lookahead=me.strstart-at,me.strstart=at,Se(me,!1),me.strm.avail_out===0)||me.strstart-me.block_start>=me.w_size-ie&&(Se(me,!1),me.strm.avail_out===0))return ae}return me.insert=0,yt===_?(Se(me,!0),me.strm.avail_out===0?se:he):(me.strstart>me.block_start&&(Se(me,!1),me.strm.avail_out),ae)}),new Fe(4,4,8,4,Ee),new Fe(4,5,16,8,Ee),new Fe(4,6,32,32,Ee),new Fe(4,4,16,16,Ue),new Fe(8,16,32,32,Ue),new Fe(8,16,128,128,Ue),new Fe(8,32,128,256,Ue),new Fe(32,128,258,1024,Ue),new Fe(32,258,258,4096,Ue)],a.deflateInit=function(me,yt){return Ke(me,yt,T,15,8,0)},a.deflateInit2=Ke,a.deflateReset=Te,a.deflateResetKeep=tt,a.deflateSetHeader=function(me,yt){return me&&me.state?me.state.wrap!==2?C:(me.state.gzhead=yt,j):C},a.deflate=function(me,yt){var rt,at,Me,ft;if(!me||!me.state||5>8&255),ge(at,at.gzhead.time>>16&255),ge(at,at.gzhead.time>>24&255),ge(at,at.level===9?2:2<=at.strategy||at.level<2?4:0),ge(at,255&at.gzhead.os),at.gzhead.extra&&at.gzhead.extra.length&&(ge(at,255&at.gzhead.extra.length),ge(at,at.gzhead.extra.length>>8&255)),at.gzhead.hcrc&&(me.adler=p(me.adler,at.pending_buf,at.pending,0)),at.gzindex=0,at.status=69):(ge(at,0),ge(at,0),ge(at,0),ge(at,0),ge(at,0),ge(at,at.level===9?2:2<=at.strategy||at.level<2?4:0),ge(at,3),at.status=ye);else{var qe=T+(at.w_bits-8<<4)<<8;qe|=(2<=at.strategy||at.level<2?0:at.level<6?1:at.level===6?2:3)<<6,at.strstart!==0&&(qe|=32),qe+=31-qe%31,at.status=ye,Le(at,qe),at.strstart!==0&&(Le(at,me.adler>>>16),Le(at,65535&me.adler)),me.adler=1}if(at.status===69)if(at.gzhead.extra){for(Me=at.pending;at.gzindex<(65535&at.gzhead.extra.length)&&(at.pending!==at.pending_buf_size||(at.gzhead.hcrc&&at.pending>Me&&(me.adler=p(me.adler,at.pending_buf,at.pending-Me,Me)),Ce(me),Me=at.pending,at.pending!==at.pending_buf_size));)ge(at,255&at.gzhead.extra[at.gzindex]),at.gzindex++;at.gzhead.hcrc&&at.pending>Me&&(me.adler=p(me.adler,at.pending_buf,at.pending-Me,Me)),at.gzindex===at.gzhead.extra.length&&(at.gzindex=0,at.status=73)}else at.status=73;if(at.status===73)if(at.gzhead.name){Me=at.pending;do{if(at.pending===at.pending_buf_size&&(at.gzhead.hcrc&&at.pending>Me&&(me.adler=p(me.adler,at.pending_buf,at.pending-Me,Me)),Ce(me),Me=at.pending,at.pending===at.pending_buf_size)){ft=1;break}ft=at.gzindexMe&&(me.adler=p(me.adler,at.pending_buf,at.pending-Me,Me)),ft===0&&(at.gzindex=0,at.status=91)}else at.status=91;if(at.status===91)if(at.gzhead.comment){Me=at.pending;do{if(at.pending===at.pending_buf_size&&(at.gzhead.hcrc&&at.pending>Me&&(me.adler=p(me.adler,at.pending_buf,at.pending-Me,Me)),Ce(me),Me=at.pending,at.pending===at.pending_buf_size)){ft=1;break}ft=at.gzindexMe&&(me.adler=p(me.adler,at.pending_buf,at.pending-Me,Me)),ft===0&&(at.status=103)}else at.status=103;if(at.status===103&&(at.gzhead.hcrc?(at.pending+2>at.pending_buf_size&&Ce(me),at.pending+2<=at.pending_buf_size&&(ge(at,255&me.adler),ge(at,me.adler>>8&255),me.adler=0,at.status=ye)):at.status=ye),at.pending!==0){if(Ce(me),me.avail_out===0)return at.last_flush=-1,j}else if(me.avail_in===0&&_e(yt)<=_e(rt)&&yt!==_)return ue(me,-5);if(at.status===666&&me.avail_in!==0)return ue(me,-5);if(me.avail_in!==0||at.lookahead!==0||yt!==y&&at.status!==666){var Oe=at.strategy===2?function(Qe,nt){for(var gt;;){if(Qe.lookahead===0&&(Be(Qe),Qe.lookahead===0)){if(nt===y)return ae;break}if(Qe.match_length=0,gt=i._tr_tally(Qe,0,Qe.window[Qe.strstart]),Qe.lookahead--,Qe.strstart++,gt&&(Se(Qe,!1),Qe.strm.avail_out===0))return ae}return Qe.insert=0,nt===_?(Se(Qe,!0),Qe.strm.avail_out===0?se:he):Qe.last_lit&&(Se(Qe,!1),Qe.strm.avail_out===0)?ae:pe}(at,yt):at.strategy===3?function(Qe,nt){for(var gt,mt,Mt,wt,Qt=Qe.window;;){if(Qe.lookahead<=te){if(Be(Qe),Qe.lookahead<=te&&nt===y)return ae;if(Qe.lookahead===0)break}if(Qe.match_length=0,Qe.lookahead>=G&&0Qe.lookahead&&(Qe.match_length=Qe.lookahead)}if(Qe.match_length>=G?(gt=i._tr_tally(Qe,1,Qe.match_length-G),Qe.lookahead-=Qe.match_length,Qe.strstart+=Qe.match_length,Qe.match_length=0):(gt=i._tr_tally(Qe,0,Qe.window[Qe.strstart]),Qe.lookahead--,Qe.strstart++),gt&&(Se(Qe,!1),Qe.strm.avail_out===0))return ae}return Qe.insert=0,nt===_?(Se(Qe,!0),Qe.strm.avail_out===0?se:he):Qe.last_lit&&(Se(Qe,!1),Qe.strm.avail_out===0)?ae:pe}(at,yt):o[at.level].func(at,yt);if(Oe!==se&&Oe!==he||(at.status=666),Oe===ae||Oe===se)return me.avail_out===0&&(at.last_flush=-1),j;if(Oe===pe&&(yt===1?i._tr_align(at):yt!==5&&(i._tr_stored_block(at,0,0,!1),yt===3&&(Ae(at.head),at.lookahead===0&&(at.strstart=0,at.block_start=0,at.insert=0))),Ce(me),me.avail_out===0))return at.last_flush=-1,j}return yt!==_?j:at.wrap<=0?1:(at.wrap===2?(ge(at,255&me.adler),ge(at,me.adler>>8&255),ge(at,me.adler>>16&255),ge(at,me.adler>>24&255),ge(at,255&me.total_in),ge(at,me.total_in>>8&255),ge(at,me.total_in>>16&255),ge(at,me.total_in>>24&255)):(Le(at,me.adler>>>16),Le(at,65535&me.adler)),Ce(me),0=rt.w_size&&(ft===0&&(Ae(rt.head),rt.strstart=0,rt.block_start=0,rt.insert=0),nt=new l.Buf8(rt.w_size),l.arraySet(nt,yt,gt-rt.w_size,rt.w_size,0),yt=nt,gt=rt.w_size),qe=me.avail_in,Oe=me.next_in,Qe=me.input,me.avail_in=gt,me.next_in=0,me.input=yt,Be(rt);rt.lookahead>=G;){for(at=rt.strstart,Me=rt.lookahead-(G-1);rt.ins_h=(rt.ins_h<>>=G=K>>>24,P-=G,(G=K>>>16&255)===0)pe[x++]=65535&K;else{if(!(16&G)){if(!(64&G)){K=z[(65535&K)+(T&(1<>>=G,P-=G),P<15&&(T+=ae[h++]<>>=G=K>>>24,P-=G,!(16&(G=K>>>16&255))){if(!(64&G)){K=F[(65535&K)+(T&(1<>>=G,P-=G,(G=x-y)>3,T&=(1<<(P-=te<<3))-1,o.next_in=h,o.next_out=x,o.avail_in=h>>24&255)+(oe>>>8&65280)+((65280&oe)<<8)+((255&oe)<<24)}function T(){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 P(oe){var ye;return oe&&oe.state?(ye=oe.state,oe.total_in=oe.total_out=ye.total=0,oe.msg="",ye.wrap&&(oe.adler=1&ye.wrap),ye.mode=C,ye.last=0,ye.havedict=0,ye.dmax=32768,ye.head=null,ye.hold=0,ye.bits=0,ye.lencode=ye.lendyn=new o.Buf32(N),ye.distcode=ye.distdyn=new o.Buf32(A),ye.sane=1,ye.back=-1,_):j}function z(oe){var ye;return oe&&oe.state?((ye=oe.state).wsize=0,ye.whave=0,ye.wnext=0,P(oe)):j}function F(oe,ye){var ae,pe;return oe&&oe.state?(pe=oe.state,ye<0?(ae=0,ye=-ye):(ae=1+(ye>>4),ye<48&&(ye&=15)),ye&&(ye<8||15=he.wsize?(o.arraySet(he.window,ye,ae-he.wsize,he.wsize,0),he.wnext=0,he.whave=he.wsize):(pe<(se=he.wsize-he.wnext)&&(se=pe),o.arraySet(he.window,ye,ae-pe,se,he.wnext),(pe-=se)?(o.arraySet(he.window,ye,ae-pe,pe,0),he.wnext=pe,he.whave=he.wsize):(he.wnext+=se,he.wnext===he.wsize&&(he.wnext=0),he.whave>>8&255,ae.check=i(ae.check,ft,2,0),Se=Ce=0,ae.mode=2;break}if(ae.flags=0,ae.head&&(ae.head.done=!1),!(1&ae.wrap)||(((255&Ce)<<8)+(Ce>>8))%31){oe.msg="incorrect header check",ae.mode=30;break}if((15&Ce)!=8){oe.msg="unknown compression method",ae.mode=30;break}if(Se-=4,me=8+(15&(Ce>>>=4)),ae.wbits===0)ae.wbits=me;else if(me>ae.wbits){oe.msg="invalid window size",ae.mode=30;break}ae.dmax=1<>8&1),512&ae.flags&&(ft[0]=255&Ce,ft[1]=Ce>>>8&255,ae.check=i(ae.check,ft,2,0)),Se=Ce=0,ae.mode=3;case 3:for(;Se<32;){if(_e===0)break e;_e--,Ce+=pe[he++]<>>8&255,ft[2]=Ce>>>16&255,ft[3]=Ce>>>24&255,ae.check=i(ae.check,ft,4,0)),Se=Ce=0,ae.mode=4;case 4:for(;Se<16;){if(_e===0)break e;_e--,Ce+=pe[he++]<>8),512&ae.flags&&(ft[0]=255&Ce,ft[1]=Ce>>>8&255,ae.check=i(ae.check,ft,2,0)),Se=Ce=0,ae.mode=5;case 5:if(1024&ae.flags){for(;Se<16;){if(_e===0)break e;_e--,Ce+=pe[he++]<>>8&255,ae.check=i(ae.check,ft,2,0)),Se=Ce=0}else ae.head&&(ae.head.extra=null);ae.mode=6;case 6:if(1024&ae.flags&&(_e<(ke=ae.length)&&(ke=_e),ke&&(ae.head&&(me=ae.head.extra_len-ae.length,ae.head.extra||(ae.head.extra=new Array(ae.head.extra_len)),o.arraySet(ae.head.extra,pe,he,ke,me)),512&ae.flags&&(ae.check=i(ae.check,pe,ke,he)),_e-=ke,he+=ke,ae.length-=ke),ae.length))break e;ae.length=0,ae.mode=7;case 7:if(2048&ae.flags){if(_e===0)break e;for(ke=0;me=pe[he+ke++],ae.head&&me&&ae.length<65536&&(ae.head.name+=String.fromCharCode(me)),me&&ke<_e;);if(512&ae.flags&&(ae.check=i(ae.check,pe,ke,he)),_e-=ke,he+=ke,me)break e}else ae.head&&(ae.head.name=null);ae.length=0,ae.mode=8;case 8:if(4096&ae.flags){if(_e===0)break e;for(ke=0;me=pe[he+ke++],ae.head&&me&&ae.length<65536&&(ae.head.comment+=String.fromCharCode(me)),me&&ke<_e;);if(512&ae.flags&&(ae.check=i(ae.check,pe,ke,he)),_e-=ke,he+=ke,me)break e}else ae.head&&(ae.head.comment=null);ae.mode=9;case 9:if(512&ae.flags){for(;Se<16;){if(_e===0)break e;_e--,Ce+=pe[he++]<>9&1,ae.head.done=!0),oe.adler=ae.check=0,ae.mode=12;break;case 10:for(;Se<32;){if(_e===0)break e;_e--,Ce+=pe[he++]<>>=7&Se,Se-=7&Se,ae.mode=27;break}for(;Se<3;){if(_e===0)break e;_e--,Ce+=pe[he++]<>>=1)){case 0:ae.mode=14;break;case 1:if(te(ae),ae.mode=20,ye!==6)break;Ce>>>=2,Se-=2;break e;case 2:ae.mode=17;break;case 3:oe.msg="invalid block type",ae.mode=30}Ce>>>=2,Se-=2;break;case 14:for(Ce>>>=7&Se,Se-=7&Se;Se<32;){if(_e===0)break e;_e--,Ce+=pe[he++]<>>16^65535)){oe.msg="invalid stored block lengths",ae.mode=30;break}if(ae.length=65535&Ce,Se=Ce=0,ae.mode=15,ye===6)break e;case 15:ae.mode=16;case 16:if(ke=ae.length){if(_e>>=5,Se-=5,ae.ndist=1+(31&Ce),Ce>>>=5,Se-=5,ae.ncode=4+(15&Ce),Ce>>>=4,Se-=4,286>>=3,Se-=3}for(;ae.have<19;)ae.lens[qe[ae.have++]]=0;if(ae.lencode=ae.lendyn,ae.lenbits=7,rt={bits:ae.lenbits},yt=p(0,ae.lens,0,19,ae.lencode,0,ae.work,rt),ae.lenbits=rt.bits,yt){oe.msg="invalid code lengths set",ae.mode=30;break}ae.have=0,ae.mode=19;case 19:for(;ae.have>>16&255,be=65535&Me,!((Ue=Me>>>24)<=Se);){if(_e===0)break e;_e--,Ce+=pe[he++]<>>=Ue,Se-=Ue,ae.lens[ae.have++]=be;else{if(be===16){for(at=Ue+2;Se>>=Ue,Se-=Ue,ae.have===0){oe.msg="invalid bit length repeat",ae.mode=30;break}me=ae.lens[ae.have-1],ke=3+(3&Ce),Ce>>>=2,Se-=2}else if(be===17){for(at=Ue+3;Se>>=Ue)),Ce>>>=3,Se-=3}else{for(at=Ue+7;Se>>=Ue)),Ce>>>=7,Se-=7}if(ae.have+ke>ae.nlen+ae.ndist){oe.msg="invalid bit length repeat",ae.mode=30;break}for(;ke--;)ae.lens[ae.have++]=me}}if(ae.mode===30)break;if(ae.lens[256]===0){oe.msg="invalid code -- missing end-of-block",ae.mode=30;break}if(ae.lenbits=9,rt={bits:ae.lenbits},yt=p(x,ae.lens,0,ae.nlen,ae.lencode,0,ae.work,rt),ae.lenbits=rt.bits,yt){oe.msg="invalid literal/lengths set",ae.mode=30;break}if(ae.distbits=6,ae.distcode=ae.distdyn,rt={bits:ae.distbits},yt=p(y,ae.lens,ae.nlen,ae.ndist,ae.distcode,0,ae.work,rt),ae.distbits=rt.bits,yt){oe.msg="invalid distances set",ae.mode=30;break}if(ae.mode=20,ye===6)break e;case 20:ae.mode=21;case 21:if(6<=_e&&258<=Ae){oe.next_out=ue,oe.avail_out=Ae,oe.next_in=he,oe.avail_in=_e,ae.hold=Ce,ae.bits=Se,h(oe,Le),ue=oe.next_out,se=oe.output,Ae=oe.avail_out,he=oe.next_in,pe=oe.input,_e=oe.avail_in,Ce=ae.hold,Se=ae.bits,ae.mode===12&&(ae.back=-1);break}for(ae.back=0;Fe=(Me=ae.lencode[Ce&(1<>>16&255,be=65535&Me,!((Ue=Me>>>24)<=Se);){if(_e===0)break e;_e--,Ce+=pe[he++]<>tt)])>>>16&255,be=65535&Me,!(tt+(Ue=Me>>>24)<=Se);){if(_e===0)break e;_e--,Ce+=pe[he++]<>>=tt,Se-=tt,ae.back+=tt}if(Ce>>>=Ue,Se-=Ue,ae.back+=Ue,ae.length=be,Fe===0){ae.mode=26;break}if(32&Fe){ae.back=-1,ae.mode=12;break}if(64&Fe){oe.msg="invalid literal/length code",ae.mode=30;break}ae.extra=15&Fe,ae.mode=22;case 22:if(ae.extra){for(at=ae.extra;Se>>=ae.extra,Se-=ae.extra,ae.back+=ae.extra}ae.was=ae.length,ae.mode=23;case 23:for(;Fe=(Me=ae.distcode[Ce&(1<>>16&255,be=65535&Me,!((Ue=Me>>>24)<=Se);){if(_e===0)break e;_e--,Ce+=pe[he++]<>tt)])>>>16&255,be=65535&Me,!(tt+(Ue=Me>>>24)<=Se);){if(_e===0)break e;_e--,Ce+=pe[he++]<>>=tt,Se-=tt,ae.back+=tt}if(Ce>>>=Ue,Se-=Ue,ae.back+=Ue,64&Fe){oe.msg="invalid distance code",ae.mode=30;break}ae.offset=be,ae.extra=15&Fe,ae.mode=24;case 24:if(ae.extra){for(at=ae.extra;Se>>=ae.extra,Se-=ae.extra,ae.back+=ae.extra}if(ae.offset>ae.dmax){oe.msg="invalid distance too far back",ae.mode=30;break}ae.mode=25;case 25:if(Ae===0)break e;if(ke=Le-Ae,ae.offset>ke){if((ke=ae.offset-ke)>ae.whave&&ae.sane){oe.msg="invalid distance too far back",ae.mode=30;break}Be=ke>ae.wnext?(ke-=ae.wnext,ae.wsize-ke):ae.wnext-ke,ke>ae.length&&(ke=ae.length),Ee=ae.window}else Ee=se,Be=ue-ae.offset,ke=ae.length;for(AeV?(G=Be[Ee+A[ye]],Se[ge+A[ye]]):(G=96,0),T=1<>ue)+(P-=T)]=K<<24|G<<16|te|0,P!==0;);for(T=1<>=1;if(T!==0?(Ce&=T-1,Ce+=T):Ce=0,ye++,--Le[oe]==0){if(oe===pe)break;oe=y[_+A[ye]]}if(se>>7)]}function ge(Me,ft){Me.pending_buf[Me.pending++]=255&ft,Me.pending_buf[Me.pending++]=ft>>>8&255}function Le(Me,ft,qe){Me.bi_valid>E-qe?(Me.bi_buf|=ft<>E-Me.bi_valid,Me.bi_valid+=qe-E):(Me.bi_buf|=ft<>>=1,qe<<=1,0<--ft;);return qe>>>1}function Ee(Me,ft,qe){var Oe,Qe,nt=new Array(A+1),gt=0;for(Oe=1;Oe<=A;Oe++)nt[Oe]=gt=gt+qe[Oe-1]<<1;for(Qe=0;Qe<=ft;Qe++){var mt=Me[2*Qe+1];mt!==0&&(Me[2*Qe]=Be(nt[mt]++,mt))}}function Ue(Me){var ft;for(ft=0;ft<_;ft++)Me.dyn_ltree[2*ft]=0;for(ft=0;ft>1;1<=qe;qe--)tt(Me,nt,qe);for(Qe=Mt;qe=Me.heap[1],Me.heap[1]=Me.heap[Me.heap_len--],tt(Me,nt,1),Oe=Me.heap[1],Me.heap[--Me.heap_max]=qe,Me.heap[--Me.heap_max]=Oe,nt[2*Qe]=nt[2*qe]+nt[2*Oe],Me.depth[Qe]=(Me.depth[qe]>=Me.depth[Oe]?Me.depth[qe]:Me.depth[Oe])+1,nt[2*qe+1]=nt[2*Oe+1]=Qe,Me.heap[1]=Qe++,tt(Me,nt,1),2<=Me.heap_len;);Me.heap[--Me.heap_max]=Me.heap[1],function(Qt,Cr){var cn,jn,Qr,Pn,js,hr,xs=Cr.dyn_tree,ka=Cr.max_code,xa=Cr.stat_desc.static_tree,zi=Cr.stat_desc.has_stree,Bi=Cr.stat_desc.extra_bits,nl=Cr.stat_desc.extra_base,xo=Cr.stat_desc.max_length,Hs=0;for(Pn=0;Pn<=A;Pn++)Qt.bl_count[Pn]=0;for(xs[2*Qt.heap[Qt.heap_max]+1]=0,cn=Qt.heap_max+1;cn>=7;Qe>>=1)if(1&wt&&mt.dyn_ltree[2*Mt]!==0)return l;if(mt.dyn_ltree[18]!==0||mt.dyn_ltree[20]!==0||mt.dyn_ltree[26]!==0)return i;for(Mt=32;Mt>>3,(nt=Me.static_len+3+7>>>3)<=Qe&&(Qe=nt)):Qe=nt=qe+5,qe+4<=Qe&&ft!==-1?at(Me,ft,qe,Oe):Me.strategy===4||nt===Qe?(Le(Me,2+(Oe?1:0),3),Te(Me,ie,oe)):(Le(Me,4+(Oe?1:0),3),function(mt,Mt,wt,Qt){var Cr;for(Le(mt,Mt-257,5),Le(mt,wt-1,5),Le(mt,Qt-4,4),Cr=0;Cr>>8&255,Me.pending_buf[Me.d_buf+2*Me.last_lit+1]=255&ft,Me.pending_buf[Me.l_buf+Me.last_lit]=255&qe,Me.last_lit++,ft===0?Me.dyn_ltree[2*qe]++:(Me.matches++,ft--,Me.dyn_ltree[2*(ae[qe]+y+1)]++,Me.dyn_dtree[2*Se(ft)]++),Me.last_lit===Me.lit_bufsize-1},a._tr_align=function(Me){Le(Me,2,3),ke(Me,P,ie),function(ft){ft.bi_valid===16?(ge(ft,ft.bi_buf),ft.bi_buf=0,ft.bi_valid=0):8<=ft.bi_valid&&(ft.pending_buf[ft.pending++]=255&ft.bi_buf,ft.bi_buf>>=8,ft.bi_valid-=8)}(Me)}},{"../utils/common":41}],53:[function(n,s,a){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,a){(function(o){(function(l,i){if(!l.setImmediate){var h,p,x,y,_=1,j={},C=!1,N=l.document,A=Object.getPrototypeOf&&Object.getPrototypeOf(l);A=A&&A.setTimeout?A:l,h={}.toString.call(l.process)==="[object process]"?function(z){process.nextTick(function(){T(z)})}:function(){if(l.postMessage&&!l.importScripts){var z=!0,F=l.onmessage;return l.onmessage=function(){z=!1},l.postMessage("","*"),l.onmessage=F,z}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",P,!1):l.attachEvent("onmessage",P),function(z){l.postMessage(y+z,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(z){T(z.data)},function(z){x.port2.postMessage(z)}):N&&"onreadystatechange"in N.createElement("script")?(p=N.documentElement,function(z){var F=N.createElement("script");F.onreadystatechange=function(){T(z),F.onreadystatechange=null,p.removeChild(F),F=null},p.appendChild(F)}):function(z){setTimeout(T,0,z)},A.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var F=new Array(arguments.length-1),q=0;q"u"?o===void 0?this:o:self)}).call(this,typeof Ix<"u"?Ix:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(nRe);var Axt=nRe.exports;const Ext=Hi(Axt),Ixt=()=>{const{isAdmin:t}=Xr(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState("all"),[i,h]=I.useState(new Set),[p,x]=I.useState(!1),[y,_]=I.useState(!1),[j,C]=I.useState("images"),[N,A]=I.useState(null),{data:E=[],isLoading:T}=Yt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ae)throw Ae;return _e}}),{data:P=[]}=Yt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ae)throw Ae;return _e}}),{data:z=[]}=Yt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ae)throw Ae;return _e}}),{data:F=[]}=Yt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ae)throw Ae;return _e||[]}}),q=F.length>0,V=I.useMemo(()=>o==="all"?null:z.find(_e=>_e.month===o)||null,[o,z]),K=I.useMemo(()=>[...new Set(E.map(Ae=>Ae.month))].sort((Ae,Ce)=>Ce.localeCompare(Ae)),[E]);I.useEffect(()=>{K.length>0&&o==="all"&&l(K[0])},[K,o]);const G=_e=>{try{const Ae=oxe(_e,"yyyy-MM",new Date);return xn(Ae,"MMMM yyyy")}catch{return _e}},te=I.useMemo(()=>o==="all"?E:E.filter(_e=>_e.month===o),[o,E]),ie=I.useMemo(()=>{var _e;return o==="all"?null:((_e=P.find(Ae=>Ae.month===o))==null?void 0:_e.canva_link)||null},[o,P]),oe=async _e=>{try{await navigator.clipboard.writeText(_e),ze.success("Caption copied to clipboard!")}catch{ze.error("Failed to copy caption")}},ye=async(_e,Ae)=>{try{const Se=await(await fetch(_e)).blob(),ge=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),Le=navigator.canShare&&navigator.canShare({files:[new File([Se],"test.jpg",{type:"image/jpeg"})]});if(ge&&Le){const ke=new File([Se],`social-swag-${Ae}.jpg`,{type:"image/jpeg"});await navigator.share({files:[ke],title:"Social Swag Image"}),ze.success("Image ready to save!")}else{const ke=window.URL.createObjectURL(Se),Be=document.createElement("a");Be.href=ke,Be.download=`social-swag-${Ae}.jpg`,document.body.appendChild(Be),Be.click(),document.body.removeChild(Be),window.URL.revokeObjectURL(ke),ze.success("Image downloaded!")}}catch(Ce){Ce.name!=="AbortError"&&ze.error("Failed to download image")}},ae=_e=>{h(Ae=>{const Ce=new Set(Ae);return Ce.has(_e)?Ce.delete(_e):Ce.add(_e),Ce})},pe=()=>{h(new Set(te.map(_e=>_e.id)))},se=()=>{h(new Set),x(!1)},he=async()=>{const _e=te.filter(Ae=>i.has(Ae.id));if(_e.length===0){ze.error("No images selected");return}_(!0),ze.info(`Preparing ${_e.length} images for download...`);try{const Ae=new Ext,Ce=[..._e].sort((Be,Ee)=>Be.sort_order-Ee.sort_order);for(let Be=0;Be{p?ae(_e.id):n(_e)};return r.jsx(Lr,{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(Ot,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Ot,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Pl,{className:"h-3 w-3 mr-1"}),E.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(Ii,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(wi,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(nn,{value:"gallery",className:"gap-2",children:[r.jsx(Pl,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(nn,{value:"scheduled",className:"gap-2",children:[r.jsx(mm,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Sn,{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(ee,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(co,{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(zd,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(du,{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(ee,{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(co,{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(Ya,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(zd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(du,{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(Ot,{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(_e=>r.jsx("button",{onClick:()=>l(_e),className:zt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===_e?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(_e)},_e))}),o!=="all"&&(ie?r.jsxs("a",{href:ie,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 ",G(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 ",G(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"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Pl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Id,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",te.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(_s,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ee,{size:"sm",onClick:he,disabled:y,className:"gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.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(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="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:te.map(_e=>{const Ae=i.has(_e.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",p&&Ae&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(_e),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:_e.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&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",Ae?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ae&&r.jsx(Ai,{className:"h-4 w-4"})}),!p&&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"})})]})},_e.id)})}),te.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pl,{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."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:V?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:()=>a(V),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:V.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(Ot,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Id,{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(Id,{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(Fr,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Rr,{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(Os,{className:"h-4 w-4"}),xn(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(ee,{onClick:()=>{A({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(Do,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(ee,{variant:"outline",onClick:()=>oe(e.caption),className:"flex-1 gap-2",children:[r.jsx(Qo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Fr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Rr,{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(Id,{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(ee,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Qo,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(ee,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(Mxt,{open:!!N,onOpenChange:_e=>!_e&&A(null),imageUrl:(N==null?void 0:N.imageUrl)||"",imageId:(N==null?void 0:N.imageId)||"",defaultCaption:(N==null?void 0:N.caption)||"",swagItemId:N==null?void 0:N.imageId})]}),r.jsx(Sn,{value:"scheduled",children:r.jsx(Txt,{})})]}):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(Ya,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(zd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(du,{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(Ot,{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(_e=>r.jsx("button",{onClick:()=>l(_e),className:zt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===_e?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(_e)},_e))}),o!=="all"&&(ie?r.jsxs("a",{href:ie,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 ",G(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 ",G(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"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Pl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Id,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",te.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(_s,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(ee,{size:"sm",onClick:he,disabled:y,className:"gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]})]}):r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="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:te.map(_e=>{const Ae=i.has(_e.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",p&&Ae&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(_e),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:_e.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&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",Ae?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ae&&r.jsx(Ai,{className:"h-4 w-4"})}),!p&&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"})})]})},_e.id)})}),te.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pl,{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."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:V?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:()=>a(V),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:V.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(Ot,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Id,{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(Id,{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(Fr,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Rr,{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(Os,{className:"h-4 w-4"}),xn(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(ee,{variant:"outline",onClick:()=>oe(e.caption),className:"flex-1 gap-2",children:[r.jsx(Qo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Fr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Rr,{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(Id,{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(ee,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Qo,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(ee,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},Pxt=()=>{const{swagId:t}=Yc(),{user:e}=Xr(),{toast:n}=pi(),s=Vr(),{trackEngagement:a}=TI(),[o,l]=I.useState(""),{data:i,isLoading:h}=Yt({queryKey:["social-swag-detail",t],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag").select("*").eq("id",t).single();if(T)throw T;const{data:P}=await J.from("social_swag_links").select("*").eq("swag_id",t).order("sort_order");return{...E,links:P||[]}},enabled:!!t});I.useEffect(()=>{i&&a("social_swag",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:p=[]}=Yt({queryKey:["social-swag-likes",t],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag_likes").select("*").eq("swag_id",t);if(T)throw T;return E},enabled:!!t}),{data:x=[]}=Yt({queryKey:["social-swag-comments",t],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag_comments").select("*").eq("swag_id",t).order("created_at",{ascending:!1});if(T)throw T;const P=[...new Set(E.map(q=>q.user_id))],{data:z}=await J.from("profiles").select("id, name").in("id",P),F=new Map((z==null?void 0:z.map(q=>[q.id,q.name]))||[]);return E.map(q=>({...q,user_name:F.get(q.user_id)||"Unknown User"}))},enabled:!!t}),y=cr({mutationFn:async E=>{const{error:T}=await J.from("social_swag_comments").insert({swag_id:t,user_id:e.id,content:E});if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),l(""),n({title:"Comment added!"})},onError:E=>{n({title:"Error adding comment",description:E.message,variant:"destructive"})}}),_=cr({mutationFn:async E=>{const{error:T}=await J.from("social_swag_comments").delete().eq("id",E);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const E=p.find(T=>T.user_id===(e==null?void 0:e.id));if(E){const{error:T}=await J.from("social_swag_likes").delete().eq("id",E.id);if(T)throw T}else{const{error:T}=await J.from("social_swag_likes").insert({swag_id:t,user_id:e.id});if(T)throw T}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",t]})}}),C=p.some(E=>E.user_id===(e==null?void 0:e.id)),N=E=>E.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),A=E=>{E.preventDefault(),!(!o.trim()||!e)&&y.mutate(o.trim())};return h?r.jsx(Lr,{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"})})}):i?r.jsx(Lr,{title:i.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/social-swag",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Social Swag"]})}),i.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:i.preview_image_url,alt:i.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:i.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(f3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),r.jsxs(ee,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!e||j.isPending,children:[r.jsx(gd,{className:`h-4 w-4 ${C?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),i.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.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(Co,{className:"h-4 w-4"}),i.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:i.links.map(E=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{a("social_swag",i.id,i.title,"click_canva"),window.open(E.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:E.title}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground"})]},E.id))})]})}),r.jsx(cu,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:E=>l(E.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Do,{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:x.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!"})})}):x.map(E=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:N(E.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:E.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:uu(new Date(E.created_at),{addSuffix:!0})}),E.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>_.mutate(E.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:E.content})]})]})})},E.id))})]})]})}):r.jsx(Lr,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Co,{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(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/social-swag",children:"Back to Social Swag"})})]})})},Lxt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=I.useState(!0),[i,h]=I.useState(!0),[p,x]=I.useState(!0),y=_=>_.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2);return r.jsx("aside",{className:"w-64 shrink-0 hidden lg:block relative z-0",children:r.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto overscroll-contain",children:r.jsxs("div",{className:"space-y-2 pr-4",children:[r.jsxs(ee,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(nS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(SS,{open:o,onOpenChange:l,children:[r.jsx(CS,{asChild:!0,children:r.jsxs(ee,{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(Fd,{className:"h-4 w-4"}):r.jsx(Vi,{className:"h-4 w-4"})]})}),r.jsx(MS,{className:"space-y-1 pl-2",children:t.map(_=>r.jsxs(ee,{variant:n===_.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(_.id),children:[r.jsx("span",{className:"mr-2",children:_.icon||"📂"}),r.jsx("span",{className:"truncate",children:_.name})]},_.id))})]}),e.length>0&&r.jsxs(SS,{open:i,onOpenChange:h,children:[r.jsx(CS,{asChild:!0,children:r.jsxs(ee,{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(Qf,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(Fd,{className:"h-4 w-4"}):r.jsx(Vi,{className:"h-4 w-4"})]})}),r.jsx(MS,{className:"space-y-1 pl-2",children:e.map(_=>r.jsxs(ee,{variant:n===`group:${_.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${_.id}`),children:[r.jsx("span",{className:"mr-2",children:_.icon||"🔒"}),r.jsx("span",{className:"truncate",children:_.name})]},_.id))})]}),r.jsxs(SS,{open:p,onOpenChange:x,children:[r.jsx(CS,{asChild:!0,children:r.jsxs(ee,{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(Bn,{className:"h-3 w-3"}),"Online Now",a.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:a.length})]}),p?r.jsx(Fd,{className:"h-4 w-4"}):r.jsx(Vi,{className:"h-4 w-4"})]})}),r.jsx(MS,{className:"pl-2 space-y-1",children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):a.map(_=>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(Ks,{className:"h-7 w-7",children:[r.jsx(Ei,{src:_.avatarUrl}),r.jsx(Zs,{className:"text-xs",children:y(_.name)})]}),r.jsx(Bu,{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:_.name})]},_.id))})]})]})})})},Oxt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=I.useState(!1),i=p=>p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),h=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),y=e.find(_=>_.id===x);return y?`🔒 ${y.name}`:"Private Group"}const p=t.find(x=>x.id===n);return p?`${p.icon||"📂"} ${p.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:h()}),r.jsx(Fd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(Gu,{className:"w-56 bg-background border",children:[r.jsxs(di,{onClick:()=>s("all"),children:[r.jsx(nS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(Bj,{}),r.jsx(ehe,{className:"text-xs text-muted-foreground",children:"Categories"}),t.map(p=>r.jsxs(di,{onClick:()=>s(p.id),children:[r.jsx("span",{className:"mr-2",children:p.icon||"📂"}),p.name]},p.id)),e.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Bj,{}),r.jsxs(ehe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Qf,{className:"h-3 w-3"}),"Your Groups"]}),e.map(p=>r.jsxs(di,{onClick:()=>s(`group:${p.id}`),children:[r.jsx("span",{className:"mr-2",children:p.icon||"🔒"}),p.name]},p.id))]})]})]}),r.jsxs(Jne,{open:o,onOpenChange:l,children:[r.jsx(Rge,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(Bn,{className:"h-4 w-4"}),a.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:a.length})]})}),r.jsxs(SI,{children:[r.jsx(ese,{children:r.jsxs(tse,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(tl,{className:"h-[calc(100vh-8rem)] mt-4",children:a.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:a.map(p=>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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:p.avatarUrl}),r.jsx(Zs,{children:i(p.name)})]}),r.jsx(Bu,{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:p.name})]},p.id))})})]})]})]})};var tce,Cse="HoverCard",[sRe]=rc(Cse,[Bg]),Mse=Bg(),[Dxt,Lxe]=sRe(Cse),aRe=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=t,h=Mse(e),p=I.useRef(0),x=I.useRef(0),y=I.useRef(!1),_=I.useRef(!1),[j,C]=$u({prop:s,defaultProp:a??!1,onChange:o,caller:Cse}),N=I.useCallback(()=>{clearTimeout(x.current),p.current=window.setTimeout(()=>C(!0),l)},[l,C]),A=I.useCallback(()=>{clearTimeout(p.current),!y.current&&!_.current&&(x.current=window.setTimeout(()=>C(!1),i))},[i,C]),E=I.useCallback(()=>C(!1),[C]);return I.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(x.current)},[]),r.jsx(Dxt,{scope:e,open:j,onOpenChange:C,onOpen:N,onClose:A,onDismiss:E,hasSelectionRef:y,isPointerDownOnContentRef:_,children:r.jsx(fI,{...h,children:n})})};aRe.displayName=Cse;var iRe="HoverCardTrigger",oRe=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,a=Lxe(iRe,n),o=Mse(n);return r.jsx(e3,{asChild:!0,...o,children:r.jsx(Rn.a,{"data-state":a.open?"open":"closed",...s,ref:e,onPointerEnter:on(t.onPointerEnter,bte(a.onOpen)),onPointerLeave:on(t.onPointerLeave,bte(a.onClose)),onFocus:on(t.onFocus,a.onOpen),onBlur:on(t.onBlur,a.onClose),onTouchStart:on(t.onTouchStart,l=>l.preventDefault())})})});oRe.displayName=iRe;var Rxt="HoverCardPortal",[VKt,Fxt]=sRe(Rxt,{forceMount:void 0}),_te="HoverCardContent",lRe=I.forwardRef((t,e)=>{const n=Fxt(_te,t.__scopeHoverCard),{forceMount:s=n.forceMount,...a}=t,o=Lxe(_te,t.__scopeHoverCard);return r.jsx(xc,{present:s||o.open,children:r.jsx(zxt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:on(t.onPointerEnter,bte(o.onOpen)),onPointerLeave:on(t.onPointerLeave,bte(o.onClose)),ref:e})})});lRe.displayName=_te;var zxt=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=t,h=Lxe(_te,n),p=Mse(n),x=I.useRef(null),y=ta(e,x),[_,j]=I.useState(!1);return I.useEffect(()=>{if(_){const C=document.body;return tce=C.style.userSelect||C.style.webkitUserSelect,C.style.userSelect="none",C.style.webkitUserSelect="none",()=>{C.style.userSelect=tce,C.style.webkitUserSelect=tce}}},[_]),I.useEffect(()=>{if(x.current){const C=()=>{j(!1),h.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var A;((A=document.getSelection())==null?void 0:A.toString())!==""&&(h.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",C),()=>{document.removeEventListener("pointerup",C),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!1}}},[h.isPointerDownOnContentRef,h.hasSelectionRef]),I.useEffect(()=>{x.current&&Uxt(x.current).forEach(N=>N.setAttribute("tabindex","-1"))}),r.jsx(rv,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:on(o,C=>{C.preventDefault()}),onDismiss:h.onDismiss,children:r.jsx(pI,{...p,...i,onPointerDown:on(i.onPointerDown,C=>{C.currentTarget.contains(C.target)&&j(!0),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!0}),ref:y,style:{...i.style,userSelect:_?"text":void 0,WebkitUserSelect:_?"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)"}})})}),Bxt="HoverCardArrow",$xt=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,a=Mse(n);return r.jsx(mI,{...a,...s,ref:e})});$xt.displayName=Bxt;function bte(t){return e=>e.pointerType==="touch"?void 0:t()}function Uxt(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 qxt=aRe,Vxt=oRe,cRe=lRe;const Hxt=qxt,Wxt=Vxt,dRe=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},a)=>r.jsx(cRe,{ref:a,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}));dRe.displayName=cRe.displayName;const Gxt=[{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"}],Kxt=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),uRe=({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(Hxt,{openDelay:200,closeDelay:100,children:[r.jsx(Wxt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:e})}),r.jsx(dRe,{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,a])=>{const o=Gxt.find(l=>l.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," (",a.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[a.slice(0,10).map(l=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ks,{className:"h-6 w-6",children:[r.jsx(Ei,{src:l.user_avatar||void 0}),r.jsx(Zs,{className:"text-[10px]",children:Kxt(l.user_name||"U")})]}),r.jsx("span",{className:"text-sm text-foreground truncate",children:l.user_name||"Unknown User"})]},l.id)),a.length>10&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",a.length-10," more"]})]})]},s)})})})]})};function Zxt({images:t,initialIndex:e=0,open:n,onOpenChange:s}){const[a,o]=I.useState(e),[l,i]=I.useState(!1);I.useEffect(()=>{n&&(o(e),i(!1))},[n,e]);const h=()=>{o(_=>_>0?_-1:t.length-1),i(!1)},p=()=>{o(_=>_{n&&(_.key==="ArrowLeft"&&h(),_.key==="ArrowRight"&&p(),_.key==="Escape"&&s(!1))},[n,t.length]);I.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=t[a];return r.jsx(Fr,{open:n,onOpenChange:s,children:r.jsxs(Rr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(ee,{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(_s,{className:"h-6 w-6"})}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{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:h,children:r.jsx(Ac,{className:"h-8 w-8"})}),r.jsx(ee,{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:p,children:r.jsx(Vi,{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:[a+1," / ",t.length]}),(y==null?void 0:y.type)==="image"&&r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>i(!l),children:l?r.jsx(vS,{className:"h-5 w-5"}):r.jsx(yS,{className:"h-5 w-5"})}),r.jsx("div",{className:zt("flex items-center justify-center w-full h-full min-h-[50vh] p-4",l?"cursor-zoom-out overflow-auto":"cursor-zoom-in"),onClick:()=>(y==null?void 0:y.type)==="image"&&i(!l),children:(y==null?void 0:y.type)==="video"?r.jsx("video",{src:y.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:_=>_.stopPropagation()}):r.jsx("img",{src:y==null?void 0:y.url,alt:"",className:zt("object-contain transition-transform duration-200",l?"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((_,j)=>r.jsx("button",{onClick:()=>{o(j),i(!1)},className:zt("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",a===j?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:_.type==="video"?r.jsx("video",{src:_.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:_.url,alt:"",className:"w-full h-full object-cover"})},j))})]})})}const kL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],Yxt=({commentId:t,reactions:e,currentUserId:n})=>{var p,x;const s=Vr(),[a,o]=I.useState(!1),l=e.find(y=>y.user_id===n),i=cr({mutationFn:async y=>{l?l.reaction_type===y?await J.from("community_comment_reactions").delete().eq("id",l.id):await J.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await J.from("community_comment_reactions").insert({comment_id:t,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),h={};return e.forEach(y=>{h[y.reaction_type]=(h[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.length>0&&r.jsx(uRe,{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(h).slice(0,2).map(y=>{var _;return r.jsx("span",{className:"text-sm",children:(_=kL.find(j=>j.type===y))==null?void 0:_.emoji},y)})}),r.jsx("span",{children:e.length})]})}),n&&r.jsxs(hu,{open:a,onOpenChange:o,children:[r.jsx(fu,{asChild:!0,children:r.jsx("button",{className:`text-xs hover:text-primary transition-colors ${l?"text-primary font-medium":"text-muted-foreground"}`,children:l?r.jsxs("span",{children:[(p=kL.find(y=>y.type===l.reaction_type))==null?void 0:p.emoji," ",(x=kL.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ci,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(Bd,{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:kL.map(y=>r.jsx("button",{onClick:()=>i.mutate(y.type),className:"text-xl hover:scale-125 transition-transform p-1",title:y.label,children:y.emoji},y.type))})})]})]})};function Oxe({content:t,className:e}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let a=0,o,l=0;for(;(o=n.exec(t))!==null;){if(o.index>a&&s.push(t.substring(a,o.index)),o[1]){const i=o[1],h=o[2],p=o[3],x=i==="#";s.push(r.jsx(co,{to:x?`/templates/${p}`:`/profile?user=${p}`,className:zt("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:x?h:`@${h}`},`mention-${l++}`))}else if(o[4]){const i=o[4],h=i.replace(/[.,;:!?)]+$/,""),p=i.slice(h.length);let x;try{const y=new URL(h);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=h.length>40?h.slice(0,40)+"...":h}s.push(r.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:x},`url-${l++}`)),p&&s.push(p)}a=o.index+o[0].length}return ar.jsx(I.Fragment,{children:i},h))})}function wte({value:t,onChange:e,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:a="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:i,mentionFormat:h="encoded",enableTemplateMentions:p=!1}){const x=I.useRef(null),y=I.useRef(null),[_,j]=I.useState(!1),[C,N]=I.useState("user"),[A,E]=I.useState(""),[T,P]=I.useState(null),[z,F]=I.useState(0),[q,V]=I.useState({top:0,left:0,width:0}),K=I.useRef(new Map),G=I.useRef(new Map),te=Se=>{if(h==="plain"){const Be=[];return K.current.forEach((Ue,Fe)=>{Se.includes(`@${Fe}`)&&Be.push(Ue)}),[...new Set(Be)]}const ge=/@\[([^\]]+)\]\(([^)]+)\)/g,Le=[];let ke;for(;(ke=ge.exec(Se))!==null;)Le.push(ke[2]);return[...new Set(Le)]},ie=Se=>{if(h==="plain"){const Be=[];return G.current.forEach((Ue,Fe)=>{Se.includes(`#${Fe}`)&&Be.push(Ue)}),[...new Set(Be)]}const ge=/#\[([^\]]+)\]\(([^)]+)\)/g,Le=[];let ke;for(;(ke=ge.exec(Se))!==null;)Le.push(ke[2]);return[...new Set(Le)]};I.useEffect(()=>{if(o){const Se=te(t);o(Se)}if(l){const Se=ie(t);l(Se)}},[t,o,l,h]);const{data:oe=[],isLoading:ye}=Yt({queryKey:["mention-users",A],queryFn:async()=>{const Se=J.from("profiles").select("id, name").limit(8),ge=A.length>=1?Se.ilike("name",`%${A}%`):Se.order("name"),{data:Le,error:ke}=await ge;if(ke)throw ke;const Be=Le.map(Ue=>Ue.id),Ee=await CLe(Be);return Le.map(Ue=>({id:Ue.id,name:Ue.name||"Unknown",avatar_url:Ee.get(Ue.id)}))},enabled:_&&C==="user",staleTime:3e4}),{data:ae=[],isLoading:pe}=Yt({queryKey:["mention-templates",A],queryFn:async()=>{let Se=J.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);A.length>=1&&(Se=Se.ilike("name",`%${A}%`));const{data:ge,error:Le}=await Se;if(Le)throw Le;return ge||[]},enabled:_&&C==="template"&&p,staleTime:3e4}),se=C==="user"?ye:pe,he=C==="user"?oe:ae,ue=Se=>Se.split(" ").map(ge=>ge[0]).join("").toUpperCase().slice(0,2),_e=Se=>{const ge=Se.target.value,Le=Se.target.selectionStart;e(ge);const ke=ge.substring(0,Le),Be=ke.lastIndexOf("@"),Ee=p?ke.lastIndexOf("#"):-1;let Ue=-1,Fe="user";if(Be>Ee?(Ue=Be,Fe="user"):Ee>Be&&p&&(Ue=Ee,Fe="template"),Ue!==-1){const be=ke.substring(Ue+1),tt=be.includes(" "),Te=be.includes(` `);if(!tt&&!Te&&be.length<=30){P(Ue),E(be),N(Fe),j(!0),F(0);return}}j(!1),P(null)},Ae=Se=>{if(T===null)return;const ge=t.substring(0,T),Le=t.substring(T+A.length+1),ke=C==="user"?"@":"#",Be=h==="plain"?`${ke}${Se.name} `:`${ke}[${Se.name}](${Se.id}) `;h==="plain"&&(C==="user"?K.current.set(Se.name,Se.id):G.current.set(Se.name,Se.id));const Ee=ge+Be+Le;e(Ee),j(!1),P(null),E(""),setTimeout(()=>{if(x.current){const Ue=ge.length+Be.length;x.current.focus(),x.current.setSelectionRange(Ue,Ue)}},0)},Ce=Se=>{if(!(!_||he.length===0))switch(Se.key){case"ArrowDown":Se.preventDefault(),F(ge=>(ge+1)%he.length);break;case"ArrowUp":Se.preventDefault(),F(ge=>(ge-1+he.length)%he.length);break;case"Enter":he[z]&&(Se.preventDefault(),Ae(he[z]));break;case"Escape":Se.preventDefault(),j(!1);break;case"Tab":he[z]&&(Se.preventDefault(),Ae(he[z]));break}};return I.useEffect(()=>{const Se=ge=>{y.current&&!y.current.contains(ge.target)&&x.current&&!x.current.contains(ge.target)&&j(!1)};return document.addEventListener("mousedown",Se),()=>document.removeEventListener("mousedown",Se)},[]),I.useEffect(()=>{if(!_)return;const Se=()=>{const ge=x.current;if(!ge)return;const Le=ge.getBoundingClientRect();V({top:Le.bottom+4,left:Le.left,width:Le.width})};return Se(),window.addEventListener("resize",Se),window.addEventListener("scroll",Se,!0),()=>{window.removeEventListener("resize",Se),window.removeEventListener("scroll",Se,!0)}},[_,t]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ps,{ref:x,value:t,onChange:_e,onKeyDown:Se=>{Ce(Se),Se.defaultPrevented||i==null||i(Se)},placeholder:n,className:zt("resize-none",s),style:{minHeight:a}}),_&&gy.createPortal(r.jsxs("div",{ref:y,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"}),se?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):he.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:A.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:he.map((Se,ge)=>r.jsx("li",{className:zt("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",ge===z?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ae(Se),onMouseEnter:()=>F(ge),children:C==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Ks,{className:"h-6 w-6",children:[r.jsx(Ei,{src:Se.avatar_url}),r.jsx(Zs,{className:"text-xs",children:ue(Se.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:Se.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:Se.preview_image_url?r.jsx("img",{src:Se.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(pd,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:Se.name})]})},Se.id))})]}),document.body)]})}function Xxt(t){const e=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=e.exec(t))!==null;)n.push(s[2]);return[...new Set(n)]}const Mke=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2);function hRe({comment:t,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l=0}){const i=Vr(),[h,p]=I.useState(!1),[x,y]=I.useState(""),[_,j]=I.useState([]),C=cr({mutationFn:async({content:T,parentCommentId:P})=>{const{data:z,error:F}=await J.from("community_comments").insert({post_id:e,user_id:n,content:T,parent_comment_id:P}).select("id").single();if(F)throw F;const q=_;if(q.length>0&&z){const V=q.filter(K=>K!==n).map(K=>({comment_id:z.id,mentioned_user_id:K,mentioned_by_user_id:n}));V.length>0&&await J.from("community_comment_mentions").insert(V)}},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),y(""),j([]),p(!1)}}),N=cr({mutationFn:async T=>{const{error:P}=await J.from("community_comments").delete().eq("id",T);if(P)throw P},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),A=()=>{x.trim()&&C.mutate({content:x,parentCommentId:t.id})};return r.jsxs("div",{className:l>0?"ml-8 border-l-2 border-muted pl-3":"",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Ks,{className:"h-8 w-8 shrink-0",children:[r.jsx(Ei,{src:t.user_avatar||void 0}),r.jsx(Zs,{className:"text-xs",children:Mke(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(Oxe,{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:uu(new Date(t.created_at),{addSuffix:!0})}),r.jsx(Yxt,{commentId:t.id,reactions:t.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>p(!h),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(GT,{className:"h-3 w-3"}),"Reply"]}),(t.user_id===n||o)&&r.jsx("button",{onClick:()=>N.mutate(t.id),className:"hover:text-destructive",children:t.user_id!==n?"Remove":"Delete"})]}),h&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Ks,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Ei,{src:s||void 0}),r.jsx(Zs,{className:"text-xs",children:Mke((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(wte,{placeholder:`Reply to ${t.user_name}...`,value:x,onChange:y,onMentionsChange:j,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:A,disabled:!x.trim()||C.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(Do,{className:"h-3 w-3"})})]})]})]})]}),t.replies&&t.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:t.replies.map(T=>r.jsx(hRe,{comment:T,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l+1},T.id))})]})}const NL=[{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"}],Qxt=()=>{const{user:t,isBrokerageManager:e,managedBrokerages:n,isAdmin:s}=Xr(),{avatarUrl:a}=SLe(t==null?void 0:t.id),{onlineUsers:o}=n8e(),{toast:l}=pi(),i=Vr(),h=I.useRef(null),[p,x]=I.useState("all"),[y,_]=I.useState(""),[j,C]=I.useState(""),[N,A]=I.useState(""),[E,T]=I.useState([]),[P,z]=I.useState([]),[F,q]=I.useState(""),[V,K]=I.useState(!1),[G,te]=I.useState(null),[ie,oe]=I.useState(""),[ye,ae]=I.useState(new Set),[pe,se]=I.useState({}),[he,ue]=I.useState({}),[_e,Ae]=I.useState([]),[Ce,Se]=I.useState([]),[ge,Le]=I.useState({open:!1,images:[],index:0});I.useEffect(()=>{if(p.startsWith("group:")){const wt=p.replace("group:","");A(wt),C("")}else p!=="all"?(C(p),A("")):(C(""),A(""))},[p]);const{data:ke=[]}=Yt({queryKey:["community-categories"],queryFn:async()=>{const{data:wt,error:Qt}=await J.from("community_categories").select("*").order("sort_order");if(Qt)throw Qt;return wt}}),{data:Be=[]}=Yt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:wt,error:Qt}=await J.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(Qt)throw Qt;return wt}}),Ee=20,{data:Ue,isLoading:Fe,hasNextPage:be,fetchNextPage:tt,isFetchingNextPage:Te}=BQe({queryKey:["community-posts",p],initialPageParam:0,queryFn:async({pageParam:wt})=>{var Ie;const Qt=wt*Ee,Cr=Qt+Ee;let cn=J.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(Qt,Cr);if(p.startsWith("group:")){const Ge=p.replace("group:","");cn=cn.eq("private_group_id",Ge)}else p==="all"||(cn=cn.eq("category_id",p).is("private_group_id",null));const{data:jn,error:Qr}=await cn;if(Qr)throw Qr;const Pn=((jn==null?void 0:jn.length)||0)>Ee,js=(jn||[]).slice(0,Ee);if(js.length===0)return{posts:[],hasMore:!1,nextPage:wt+1};const hr=js.map(Ge=>Ge.id),xs=[...new Set(js.filter(Ge=>Ge.category_id).map(Ge=>Ge.category_id))].filter(Boolean),[ka,xa,zi,Bi,nl]=await Promise.all([xs.length?J.from("community_categories").select("*").in("id",xs):Promise.resolve({data:[]}),J.from("community_post_media").select("*").in("post_id",hr).order("sort_order"),J.from("community_reactions").select("*").in("post_id",hr),J.from("community_comments").select("*").in("post_id",hr).order("created_at",{ascending:!0}),J.from("community_post_resources").select("*").in("post_id",hr)]),xo=ka==null?void 0:ka.data,Hs=xa==null?void 0:xa.data,Xa=zi==null?void 0:zi.data,Ns=Bi==null?void 0:Bi.data,Fa=nl==null?void 0:nl.data,Oa=(Ns||[]).map(Ge=>Ge.id),[Ro,ir]=await Promise.all([Oa.length?J.from("community_comment_reactions").select("*").in("comment_id",Oa):Promise.resolve({data:[]}),(()=>{const Ge=(Fa||[]).filter(kt=>kt.resource_type==="template").map(kt=>kt.resource_id);return Ge.length===0?Promise.resolve({data:[]}):J.from("canva_templates").select("id, name, preview_image_url").in("id",Ge)})()]),fo=(Ro==null?void 0:Ro.data)||[],ml=(ir==null?void 0:ir.data)||[],Ao=new Map(ml.map(Ge=>[Ge.id,{name:Ge.name,preview_image_url:Ge.preview_image_url}])),ss=Array.from(new Set([...js.map(Ge=>Ge.user_id),...(Xa||[]).map(Ge=>Ge.user_id),...(Ns||[]).map(Ge=>Ge.user_id),...fo.map(Ge=>Ge.user_id)])),[yo,xu]=await Promise.all([ss.length?J.from("profiles").select("id, name").in("id",ss):Promise.resolve({data:[]}),CLe(ss)]),$l=new Map(((Ie=yo==null?void 0:yo.data)==null?void 0:Ie.map(Ge=>[Ge.id,Ge.name]))||[]),yu=new Map((xo||[]).map(Ge=>[Ge.id,Ge])),et=Ge=>{const kt=new Map,vt=[];return Ge.forEach(At=>{kt.set(At.id,{...At,user_name:$l.get(At.user_id)||"Unknown User",user_avatar:xu.get(At.user_id),reactions:fo.filter(Bt=>Bt.comment_id===At.id).map(Bt=>({...Bt,user_name:$l.get(Bt.user_id)||"Unknown User",user_avatar:xu.get(Bt.user_id)})),replies:[]})}),Ge.forEach(At=>{const Bt=kt.get(At.id);if(At.parent_comment_id&&kt.has(At.parent_comment_id)){const Pt=kt.get(At.parent_comment_id);Pt.replies=Pt.replies||[],Pt.replies.push(Bt)}else vt.push(Bt)}),vt};return{posts:js.map(Ge=>{const kt=(Fa||[]).filter(vt=>vt.post_id===Ge.id).map(vt=>{let At="",Bt=null;if(vt.resource_type==="template"){const Pt=Ao.get(vt.resource_id);At=(Pt==null?void 0:Pt.name)||"Unknown Template",Bt=(Pt==null?void 0:Pt.preview_image_url)||null}return{id:vt.id,resource_type:vt.resource_type,resource_id:vt.resource_id,resource_name:At,resource_preview_url:Bt}});return{...Ge,user_name:$l.get(Ge.user_id)||"Unknown User",user_avatar:xu.get(Ge.user_id),category:Ge.category_id?yu.get(Ge.category_id):null,media:(Hs||[]).filter(vt=>vt.post_id===Ge.id),reactions:((Xa||[]).filter(vt=>vt.post_id===Ge.id)||[]).map(vt=>({...vt,user_name:$l.get(vt.user_id)||"Unknown User",user_avatar:xu.get(vt.user_id)})),comments:et((Ns||[]).filter(vt=>vt.post_id===Ge.id)),resources:kt}}),hasMore:Pn,nextPage:wt+1}},getNextPageParam:wt=>wt.hasMore?wt.nextPage:void 0}),Ke=I.useMemo(()=>(Ue==null?void 0:Ue.pages.flatMap(wt=>wt.posts))??[],[Ue]),me=cr({mutationFn:async()=>{K(!0);const{data:wt,error:Qt}=await J.from("community_posts").insert({user_id:t.id,category_id:N?null:j||null,private_group_id:N||null,content:y,link_url:F||null}).select().single();if(Qt)throw Qt;for(let cn=0;cn0){const cn=_e.filter(jn=>jn!==t.id).map(jn=>({post_id:wt.id,mentioned_user_id:jn,mentioned_by_user_id:t.id}));cn.length>0&&await J.from("community_post_mentions").insert(cn)}const Cr=Xxt(y);if(Cr.length>0){const cn=Cr.map(jn=>({post_id:wt.id,resource_type:"template",resource_id:jn}));await J.from("community_post_resources").insert(cn)}return wt},onSuccess:async wt=>{var Qt;i.invalidateQueries({queryKey:["community-posts"]}),_(""),Ae([]),Se([]),C(""),A(""),T([]),z([]),q(""),l({title:"Post created!"});try{const Cr=((Qt=t==null?void 0:t.user_metadata)==null?void 0:Qt.name)||"Someone",cn=y.length>50?y.substring(0,50)+"...":y;await J.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Cr}: ${cn}`,url:"/community"}})}catch(Cr){console.error("Failed to send push notification:",Cr)}},onError:wt=>{l({title:"Error creating post",description:wt.message,variant:"destructive"})},onSettled:()=>K(!1)}),yt=cr({mutationFn:async({postId:wt,content:Qt})=>{const{error:Cr}=await J.from("community_posts").update({content:Qt}).eq("id",wt);if(Cr)throw Cr},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),te(null),oe(""),l({title:"Post updated!"})}}),rt=cr({mutationFn:async wt=>{const{error:Qt}=await J.from("community_posts").delete().eq("id",wt);if(Qt)throw Qt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),at=cr({mutationFn:async({postId:wt,isPinned:Qt})=>{const{error:Cr}=await J.from("community_posts").update({is_pinned:!Qt,pinned_at:Qt?null:new Date().toISOString(),pinned_by:Qt?null:t==null?void 0:t.id}).eq("id",wt);if(Cr)throw Cr},onSuccess:(wt,{isPinned:Qt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:Qt?"Post unpinned":"Post pinned to top"})}}),Me=cr({mutationFn:async({postId:wt,reactionType:Qt})=>{var cn;const Cr=(cn=Ke.find(jn=>jn.id===wt))==null?void 0:cn.reactions.find(jn=>jn.user_id===(t==null?void 0:t.id));Cr?Cr.reaction_type===Qt?await J.from("community_reactions").delete().eq("id",Cr.id):await J.from("community_reactions").update({reaction_type:Qt}).eq("id",Cr.id):await J.from("community_reactions").insert({post_id:wt,user_id:t.id,reaction_type:Qt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),ft=cr({mutationFn:async({postId:wt,content:Qt})=>{const{data:Cr,error:cn}=await J.from("community_comments").insert({post_id:wt,user_id:t.id,content:Qt}).select("id").single();if(cn)throw cn;const jn=he[wt]||[];if(jn.length>0&&Cr){const Qr=jn.filter(Pn=>Pn!==t.id).map(Pn=>({comment_id:Cr.id,mentioned_user_id:Pn,mentioned_by_user_id:t.id}));Qr.length>0&&await J.from("community_comment_mentions").insert(Qr)}},onSuccess:(wt,{postId:Qt})=>{i.invalidateQueries({queryKey:["community-posts"]}),se(Cr=>({...Cr,[Qt]:""})),ue(Cr=>({...Cr,[Qt]:[]}))}});cr({mutationFn:async wt=>{const{error:Qt}=await J.from("community_comments").delete().eq("id",wt);if(Qt)throw Qt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const qe=wt=>{const Qt=Array.from(wt.target.files||[]);if(Qt.length+E.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(Cr=>[...Cr,...Qt]),Qt.forEach(Cr=>{const cn=new FileReader;cn.onloadend=()=>{z(jn=>[...jn,cn.result])},cn.readAsDataURL(Cr)})},Oe=wt=>{T(Qt=>Qt.filter((Cr,cn)=>cn!==wt)),z(Qt=>Qt.filter((Cr,cn)=>cn!==wt))},Qe=wt=>wt.split(" ").map(Qt=>Qt[0]).join("").toUpperCase().slice(0,2),nt=wt=>{const Qt={};return wt.forEach(Cr=>{Qt[Cr.reaction_type]=(Qt[Cr.reaction_type]||0)+1}),Qt},gt=wt=>{var Qt;return(Qt=wt.find(Cr=>Cr.user_id===(t==null?void 0:t.id)))==null?void 0:Qt.reaction_type},mt=wt=>wt.reduce((Qt,Cr)=>Qt+1+(Cr.replies?mt(Cr.replies):0),0),Mt=wt=>{if(s)return!0;if(!e||!wt.private_group_id)return!1;const Qt=Be.find(Cr=>Cr.id===wt.private_group_id);return Qt!=null&&Qt.brokerage_id?n.some(Cr=>Cr.id===Qt.brokerage_id):!1};return r.jsx(Lr,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(Lxt,{categories:ke,privateGroups:Be,selectedFilter:p,onFilterChange:x,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(Oxt,{categories:ke,privateGroups:Be,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:a||void 0}),r.jsx(Zs,{children:t!=null&&t.email?Qe(t.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(wte,{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:y,onChange:_,onMentionsChange:Ae,onTemplatesChange:Se,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),P.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:P.map((wt,Qt)=>{var Cr;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Cr=E[Qt])!=null&&Cr.type.startsWith("video/")?r.jsx("video",{src:wt,className:"w-full h-full object-cover"}):r.jsx("img",{src:wt,alt:"",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Oe(Qt),children:r.jsx(_s,{className:"h-3 w-3"})})]},Qt)})}),F&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:F,onChange:wt=>q(wt.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>q(""),children:r.jsx(_s,{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:h,onChange:qe,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var wt;return(wt=h.current)==null?void 0:wt.click()},children:[r.jsx(Pl,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var wt;return(wt=h.current)==null?void 0:wt.click()},children:[r.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>q("https://"),children:[r.jsx(Co,{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:[Be.length>0?r.jsxs(gn,{value:N||j||"none",onValueChange:wt=>{wt==="none"?(C(""),A("")):wt.startsWith("group:")?(A(wt.replace("group:","")),C("")):(C(wt),A(""))},children:[r.jsx(fn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(yn,{placeholder:"Select..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No category"}),ke.map(wt=>r.jsxs(qt,{value:wt.id,children:[wt.icon," ",wt.name]},wt.id)),Be.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"}),Be.map(wt=>r.jsxs(qt,{value:`group:${wt.id}`,children:[wt.icon||"🔒"," ",wt.name]},wt.id))]})]})]}):r.jsxs(gn,{value:j,onValueChange:C,children:[r.jsx(fn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(yn,{placeholder:"Category"})}),r.jsx(pn,{children:ke.map(wt=>r.jsxs(qt,{value:wt.id,children:[wt.icon," ",wt.name]},wt.id))})]}),r.jsxs(ee,{size:"sm",onClick:()=>me.mutate(),disabled:!y.trim()||V,children:[r.jsx(Do,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Fe?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((wt,Qt)=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ir,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Ir,{className:"h-4 w-32"}),r.jsx(Ir,{className:"h-4 w-full"}),r.jsx(Ir,{className:"h-4 w-3/4"})]})]})})},Qt))}):Ke.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Fl,{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.jsxs("div",{className:"space-y-4",children:[Ke.map(wt=>{var Qt,Cr,cn,jn;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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:wt.user_avatar||void 0}),r.jsx(Zs,{children:Qe(wt.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:wt.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:uu(new Date(wt.created_at),{addSuffix:!0})}),wt.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:[wt.category.icon," ",wt.category.name]})]})]})]})]}),(wt.user_id===(t==null?void 0:t.id)||Mt(wt))&&r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(nm,{className:"h-4 w-4"})})}),r.jsxs(Gu,{align:"end",children:[Mt(wt)&&wt.private_group_id&&r.jsx(di,{onClick:()=>at.mutate({postId:wt.id,isPinned:wt.is_pinned}),children:wt.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(qT,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(k1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),wt.user_id===(t==null?void 0:t.id)&&r.jsxs(di,{onClick:()=>{te(wt),oe(wt.content)},children:[r.jsx(fi,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(di,{className:"text-destructive",onClick:()=>rt.mutate(wt.id),children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),wt.user_id!==(t==null?void 0:t.id)?"Remove (Moderate)":"Delete"]})]})]})]}),wt.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(k1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(Oxe,{content:wt.content})}),wt.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${wt.media.length===1?"grid-cols-1":wt.media.length===2?"grid-cols-2":wt.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:wt.media.slice(0,4).map((Qr,Pn)=>{const js=Pn===3&&wt.media.length>4,hr=wt.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${wt.media.length===1?"max-h-[500px]":wt.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>Le({open:!0,images:wt.media.map(xs=>({url:xs.media_url,type:xs.media_type==="video"?"video":"image"})),index:Pn}),children:[Qr.media_type==="video"?r.jsx("video",{src:Qr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Qr.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"})})})}),js&&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:["+",hr]})})]},Qr.id)})}),wt.link_url&&r.jsxs("a",{href:wt.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[wt.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:wt.link_image,alt:wt.link_title||"Link preview",className:"w-full h-full object-cover",onError:Qr=>{Qr.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:wt.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:wt.link_title}),wt.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:wt.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(wt.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(Co,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:wt.link_url})]})})]}),wt.reactions.length>0&&r.jsx(uRe,{reactions:wt.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(nt(wt.reactions)).slice(0,3).map(([Qr])=>{var Pn;return r.jsx("span",{className:"text-base",children:(Pn=NL.find(js=>js.type===Qr))==null?void 0:Pn.emoji},Qr)})}),r.jsx("span",{children:wt.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",children:[gt(wt.reactions)?r.jsx("span",{className:"mr-1",children:(Qt=NL.find(Qr=>Qr.type===gt(wt.reactions)))==null?void 0:Qt.emoji}):r.jsx(gd,{className:"h-4 w-4 mr-1"}),gt(wt.reactions)?(Cr=NL.find(Qr=>Qr.type===gt(wt.reactions)))==null?void 0:Cr.label:"Like"]})}),r.jsx(Bd,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:NL.map(Qr=>r.jsx("button",{onClick:()=>Me.mutate({postId:wt.id,reactionType:Qr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Qr.label,children:Qr.emoji},Qr.type))})})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ae(Qr=>{const Pn=new Set(Qr);return Pn.has(wt.id)?Pn.delete(wt.id):Pn.add(wt.id),Pn}),children:[r.jsx(Fl,{className:"h-4 w-4 mr-1"}),(()=>{const Qr=mt(wt.comments);return Qr>0?`Comment (${Qr})`:"Comment"})()]})]}),ye.has(wt.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[wt.comments.map(Qr=>r.jsx(hRe,{comment:Qr,postId:wt.id,currentUserId:t==null?void 0:t.id,currentUserAvatar:a,currentUserEmail:t==null?void 0:t.email,canModerate:Mt(wt)},Qr.id)),t&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:a||void 0}),r.jsx(Zs,{className:"text-xs",children:Qe(((cn=t.email)==null?void 0:cn.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(wte,{placeholder:"Write a comment... (use @ to mention)",value:pe[wt.id]||"",onChange:Qr=>se(Pn=>({...Pn,[wt.id]:Qr})),onMentionsChange:Qr=>ue(Pn=>({...Pn,[wt.id]:Qr})),mentionFormat:"plain",onKeyDown:Qr=>{var Pn;Qr.defaultPrevented||Qr.key==="Enter"&&!Qr.shiftKey&&((Pn=pe[wt.id])!=null&&Pn.trim())&&(Qr.preventDefault(),ft.mutate({postId:wt.id,content:pe[wt.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{var Qr;(Qr=pe[wt.id])!=null&&Qr.trim()&&ft.mutate({postId:wt.id,content:pe[wt.id]})},disabled:!((jn=pe[wt.id])!=null&&jn.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(Do,{className:"h-4 w-4"})})]})]})]})]})},wt.id)}),be&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(ee,{variant:"outline",onClick:()=>tt(),disabled:Te,children:Te?"Loading…":"Load more posts"})})]}),r.jsx(Fr,{open:!!G,onOpenChange:()=>te(null),children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Edit Post"})}),r.jsx(ps,{value:ie,onChange:wt=>oe(wt.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>te(null),children:"Cancel"}),r.jsx(ee,{onClick:()=>{G&&yt.mutate({postId:G.id,content:ie})},disabled:!ie.trim(),children:"Save Changes"})]})]})}),r.jsx(Zxt,{images:ge.images,initialIndex:ge.index,open:ge.open,onOpenChange:wt=>Le(Qt=>({...Qt,open:wt}))})]})]})})},u4={open:{label:"Open",icon:Ya,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Fl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Yi,color:"bg-green-500"},closed:{label:"Closed",icon:Vc,color:"bg-muted-foreground"}},Tke={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Jxt(){const{user:t}=Xr(),e=Vr(),[n,s]=I.useState(null),[a,o]=I.useState(""),{data:l=[],isLoading:i}=Yt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:_}=await J.from("support_tickets").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(_)throw _;return y},enabled:!!t}),{data:h=[]}=Yt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:_}=await J.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(_)throw _;return y},enabled:!!n}),p=cr({mutationFn:async y=>{if(!n||!t)throw new Error("Missing data");const{error:_}=await J.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:y,is_admin_reply:!1});if(_)throw _},onSuccess:()=>{e.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),x=()=>{a.trim()&&p.mutate(a)};if(n){const y=u4[n.status].icon;return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(so,{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(Ot,{variant:"secondary",children:Tke[n.category]}),r.jsxs(Ot,{className:u4[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),u4[n.status].label]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Tn,{children:["Created on ",xn(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(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Je,{children:[r.jsx(tl,{className:"h-[300px] pr-4",children:h.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:h.map(_=>{var j;return r.jsxs("div",{className:`p-4 rounded-lg ${_.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:_.is_admin_reply?"Support Team":((j=_.profiles)==null?void 0:j.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(_.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:_.content})]},_.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(cu,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:a,onChange:_=>o(_.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:x,disabled:!a.trim()||p.isPending,className:"self-end",children:r.jsx(Do,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Lr,{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(Cx,{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(ghe,{trigger:r.jsxs(ee,{size:"lg",className:"gap-2",children:[r.jsx(bn,{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(bi,{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(ghe,{trigger:r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"New Ticket"]})})]}),i?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):l.length===0?r.jsx(Ye,{className:"border-dashed",children:r.jsxs(Je,{className:"text-center py-12",children:[r.jsx(Fl,{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:l.map(y=>{const _=u4[y.status].icon;return r.jsx(Ye,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),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:y.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ot,{variant:"outline",className:"text-xs",children:Tke[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Ot,{className:u4[y.status].color,children:[r.jsx(_,{className:"h-3 w-3 mr-1"}),u4[y.status].label]})]})})},y.id)})})]})})}function eyt({open:t,onOpenChange:e}){return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(qr,{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(Os,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Schedule Agent Onboarding"}),r.jsx(Qn,{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 tyt({open:t,onOpenChange:e}){const{brokerageId:n}=Xr(),[s,a]=I.useState(""),[o,l]=I.useState([]),[i,h]=I.useState(!1),{data:p,isLoading:x}=Yt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:N,error:A}=await J.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(A)throw A;return N},enabled:t&&!!n}),y=p==null?void 0:p.filter(N=>N.name.toLowerCase().includes(s.toLowerCase())||N.email.toLowerCase().includes(s.toLowerCase())),_=N=>{l(A=>A.includes(N)?A.filter(E=>E!==N):[...A,N])},j=async()=>{if(o.length===0){ze.error("Please select at least one agent");return}h(!0);try{const{data:N,error:A}=await J.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(A)throw A;ze.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),e(!1)}catch(N){console.error("Error sending onboarding link:",N),ze.error(N.message||"Failed to send onboarding link")}finally{h(!1)}},C=N=>{N||(l([]),a("")),e(N)};return r.jsx(Fr,{open:t,onOpenChange:C,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsx(qr,{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(Do,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Send Onboarding Link"}),r.jsx(Qn,{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(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:s,onChange:N=>a(N.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(y==null?void 0:y.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Bn,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(tl,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:y==null?void 0:y.map(N=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>_(N.id),children:[r.jsx(Dl,{checked:o.includes(N.id),onCheckedChange:()=>_(N.id)}),r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"text-xs",children:N.name.split(" ").map(A=>A[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:N.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.email})]})]},N.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(ee,{onClick:j,disabled:o.length===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function ryt(){const[t,e]=I.useState(!1),[n,s]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"mb-8",children:[r.jsx(Gt,{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(Bn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Agent Onboarding"}),r.jsx(Tn,{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(ee,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(ee,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(eyt,{open:t,onOpenChange:e}),r.jsx(tyt,{open:n,onOpenChange:s})]})}function nyt({open:t,onOpenChange:e}){return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(qr,{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(_g,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Schedule Launch Meeting"}),r.jsx(Qn,{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 syt(){const[t,e]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"mb-8",children:[r.jsx(Gt,{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(_g,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Launch or ReLaunch Meeting"}),r.jsx(Tn,{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(ee,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(_g,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(nyt,{open:t,onOpenChange:e})]})}function ayt(){const t=Zn(),[e,n]=I.useState(""),[s,a]=I.useState(null),{data:o,isLoading:l}=Yt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(A)throw A;return N}}),{data:i}=Yt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(A)throw A;return N}}),{data:h}=Yt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_pdfs").select("resource_id");if(A)throw A;return N}}),{data:p}=Yt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_videos").select("resource_id");if(A)throw A;return N}}),{data:x}=Yt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_links").select("resource_id");if(A)throw A;return N}}),y=o==null?void 0:o.filter(N=>{var T;const A=N.title.toLowerCase().includes(e.toLowerCase())||((T=N.description)==null?void 0:T.toLowerCase().includes(e.toLowerCase())),E=!s||N.category_id===s;return A&&E}),_=i==null?void 0:i.filter(N=>o==null?void 0:o.some(A=>A.category_id===N.id)),j=N=>{const A=(h==null?void 0:h.filter(P=>P.resource_id===N).length)||0,E=(p==null?void 0:p.filter(P=>P.resource_id===N).length)||0,T=(x==null?void 0:x.filter(P=>P.resource_id===N).length)||0;return{pdfCount:A,videoCount:E,linkCount:T}},C=N=>{t(`/brokerage-resources/${N}`)};return r.jsx(Lr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ryt,{}),r.jsx(syt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search resources...",value:e,onChange:N=>n(N.target.value),className:"pl-10"})]}),_&&_.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Ot,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),_.map(N=>r.jsx(Ot,{variant:s===N.id?"default":"outline",className:"cursor-pointer",onClick:()=>a(N.id),children:N.name},N.id))]}),!l&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(y==null?void 0:y.length)||0," resource",(y==null?void 0:y.length)!==1?"s":""," available"]}),l?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((N,A)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-40 w-full"}),r.jsx(Gt,{children:r.jsx(Ir,{className:"h-5 w-3/4"})}),r.jsxs(Je,{children:[r.jsx(Ir,{className:"h-4 w-full mb-2"}),r.jsx(Ir,{className:"h-4 w-2/3"})]})]},A))}):(y==null?void 0:y.length)===0?r.jsxs(Ye,{className:"p-12 text-center",children:[r.jsx(vh,{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:y==null?void 0:y.map(N=>{const{pdfCount:A,videoCount:E,linkCount:T}=j(N.id),P=i==null?void 0:i.find(z=>z.id===N.category_id);return r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>C(N.id),children:[N.preview_image_url?r.jsx("img",{src:N.preview_image_url,alt:N.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(vh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Zt,{className:"text-lg line-clamp-1",children:N.title}),P&&r.jsx(Ot,{variant:"secondary",className:"shrink-0 text-xs",children:P.name})]})}),r.jsxs(Je,{children:[N.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:N.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4"}),A]}),E>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Pa,{className:"h-4 w-4"}),E]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Co,{className:"h-4 w-4"}),T]})]})]})]},N.id)})})]})})}const iyt=()=>{const{resourceId:t}=Yc(),{data:e,isLoading:n}=Yt({queryKey:["brokerage-resource-detail",t],queryFn:async()=>{const{data:a,error:o}=await J.from("brokerage_resources").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;const{data:l}=await J.from("brokerage_resource_pdfs").select("*").eq("resource_id",t).order("sort_order"),{data:i}=await J.from("brokerage_resource_videos").select("*").eq("resource_id",t).order("sort_order"),{data:h}=await J.from("brokerage_resource_links").select("*").eq("resource_id",t).order("sort_order");return{...a,pdfs:l||[],videos:i||[],links:h||[]}},enabled:!!t}),s=a=>a?a<1024?a+" B":a<1024*1024?(a/1024).toFixed(1)+" KB":(a/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Lr,{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(Lr,{title:e.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/brokerage-resources",children:[r.jsx(so,{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(Pa,{className:"h-4 w-4"}),"Videos (",e.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:e.videos.map(a=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:a.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:a.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})})]},a.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(La,{className:"h-4 w-4"}),"Documents (",e.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.pdfs.map(a=>r.jsxs("a",{href:a.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(La,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:a.name}),a.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(a.file_size)})]})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.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(Ls,{className:"h-4 w-4"}),"Canva Templates (",e.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.links.map(a=>r.jsxs("a",{href:a.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(Ls,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})})]})}):r.jsx(Lr,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(vh,{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(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function oyt(){const{onlineUsers:t,totalOnline:e}=n8e();return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Ot,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Bu,{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(tl,{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(Ks,{className:"h-9 w-9",children:[r.jsx(Ei,{src:n.avatarUrl,alt:n.name}),r.jsx(Zs,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(a=>a[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 ",uu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const Ake={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:Bn,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:JT,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:gm,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:Ng,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:pc,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:pd,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:_1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:Zx,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Ms,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Ms,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:Gx,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:mm,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:vh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:vh,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:yj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:$h,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:ua,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:ym,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:ET,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:wg,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:Ki,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:Zi,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:"Agent Cards",description:"Manage digital business cards for agents",icon:Bn,path:"/admin/agent-cards",color:"bg-gradient-to-br from-violet-500/20 to-purple-500/10 text-violet-600"},{title:"Notification Settings",description:"Test and manage push notifications",icon:ym,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:Oo,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:lS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:w1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:vs,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:ua,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:dc,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:ci,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:da,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function lyt(){const t=Zn();return r.jsx(Lr,{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(oyt,{})})]}),r.jsxs(Ii,{defaultValue:"users",className:"w-full",children:[r.jsx(wi,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(Ake).map(([e,n])=>r.jsx(nn,{value:e,className:"data-[state=active]:bg-background",children:n.label},e))}),Object.entries(Ake).map(([e,n])=>r.jsx(Sn,{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(Gt,{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(Zt,{className:"text-base",children:s.title})]}),r.jsx(Je,{className:"pt-0",children:r.jsx(Tn,{className:"text-sm",children:s.description})})]},s.path))})},e))]})]})})}const Us=I.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})}));Us.displayName="Table";const qs=I.forwardRef(({className:t,...e},n)=>r.jsx("thead",{ref:n,className:zt("[&_tr]:border-b",t),...e}));qs.displayName="TableHeader";const Vs=I.forwardRef(({className:t,...e},n)=>r.jsx("tbody",{ref:n,className:zt("[&_tr:last-child]:border-0",t),...e}));Vs.displayName="TableBody";const cyt=I.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}));cyt.displayName="TableFooter";const Ar=I.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}));Ar.displayName="TableRow";const It=I.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}));It.displayName="TableHead";const Nt=I.forwardRef(({className:t,...e},n)=>r.jsx("td",{ref:n,className:zt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));Nt.displayName="TableCell";const dyt=I.forwardRef(({className:t,...e},n)=>r.jsx("caption",{ref:n,className:zt("mt-4 text-sm text-muted-foreground",t),...e}));dyt.displayName="TableCaption";const uyt=()=>{const{isAdmin:t}=Xr(),e=Zn(),[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(!1),[h,p]=I.useState(null);I.useEffect(()=>{if(!t){e("/dashboard");return}x()},[t]);const x=async()=>{try{const{data:N,error:A}=await J.from("app_tiles").select("*").order("name");if(A)throw A;s(N||[])}catch(N){console.error("Error loading apps:",N),ze.error("Failed to load apps")}finally{o(!1)}},y=async N=>{N.preventDefault();const A=new FormData(N.currentTarget),E={name:A.get("name"),description:A.get("description"),icon:A.get("icon"),app_id:A.get("app_id"),target_url:A.get("target_url"),required_tags:A.get("required_tags").split(",").map(T=>T.trim()).filter(Boolean)};try{if(h){const{error:T}=await J.from("app_tiles").update(E).eq("id",h.id);if(T)throw T;ze.success("App updated successfully")}else{const{error:T}=await J.from("app_tiles").insert([E]);if(T)throw T;ze.success("App created successfully")}i(!1),p(null),x()}catch(T){console.error("Error saving app:",T),ze.error("Failed to save app")}},_=async N=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:A}=await J.from("app_tiles").delete().eq("id",N);if(A)throw A;ze.success("App deleted successfully"),x()}catch(A){console.error("Error deleting app:",A),ze.error("Failed to delete app")}},j=N=>{p(N),i(!0)},C=()=>{p(null),i(!0)};return a?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(ee,{variant:"ghost",size:"sm",onClick:()=>e("/dashboard"),children:[r.jsx(so,{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(Fr,{open:l,onOpenChange:i,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{onClick:C,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:h?"Edit App":"Create New App"}),r.jsx(Qn,{children:"Configure the application tile settings"})]}),r.jsxs("form",{onSubmit:y,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(He,{htmlFor:"name",children:"App Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:h==null?void 0:h.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"app_id",children:"App ID"}),r.jsx(dt,{id:"app_id",name:"app_id",defaultValue:h==null?void 0:h.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:h==null?void 0:h.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:h==null?void 0:h.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"target_url",children:"Target URL"}),r.jsx(dt,{id:"target_url",name:"target_url",type:"url",defaultValue:h==null?void 0:h.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(dt,{id:"required_tags",name:"required_tags",defaultValue:h==null?void 0:h.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",children:h?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Application Tiles"}),r.jsx(Tn,{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(ee,{onClick:C,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"App ID"}),r.jsx(It,{children:"Target URL"}),r.jsx(It,{children:"Tags"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:n.map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-2xl",children:N.icon}),r.jsx(Nt,{className:"font-medium",children:N.name}),r.jsx(Nt,{className:"font-mono text-sm",children:N.app_id}),r.jsx(Nt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:N.target_url}),r.jsx(Nt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:N.required_tags.map(A=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:A},A))})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>j(N),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>_(N.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},N.id))})]})})]})})]})};function Ku({title:t,description:e,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(co,{to:"/admin",children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(so,{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 Eke=({expiresAt:t,className:e})=>{const n=new Date().getTime(),s=new Date(t).getTime(),a=Math.ceil((s-n)/(1e3*60*60*24));return a<=0?r.jsxs(Ot,{variant:"destructive",className:zt("gap-1",e),children:[r.jsx(Hh,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(Ot,{variant:"destructive",className:zt("gap-1",e),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?r.jsxs(Ot,{className:zt("gap-1 bg-amber-500 hover:bg-amber-600",e),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(Ot,{variant:"secondary",className:zt("gap-1",e),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},fRe=({open:t,onOpenChange:e,brokerages:n,fixedBrokerageId:s,onSuccess:a})=>{const{toast:o}=pi(),l=I.useRef(null),[i,h]=I.useState([]),[p,x]=I.useState(""),[y,_]=I.useState(!1),[j,C]=I.useState("upload"),[N,A]=I.useState(null),E=()=>{h([]),x(""),C("upload"),A(null),l.current&&(l.current.value="")},T=()=>{E(),e(!1)},P=K=>{const G=K.split(` `).map(ae=>ae.trim()).filter(ae=>ae);if(G.length===0)return[];const te=G[0].toLowerCase(),oe=te.includes("first")||te.includes("last")||te.includes("email")||te.includes("name")||te.includes("phone")||te.includes("sms")||te.includes("consent")?G.slice(1):G,ye=[];for(const ae of oe){const se=(ae.includes(" ")?ae.split(" "):ae.split(",")).map(he=>he.trim().replace(/^["']|["']$/g,""));if(se.length>=2){let he="",ue="",_e="",Ae="",Ce;if(se.length===2){const Le=se[0].split(" ");he=Le[0]||"",ue=Le.slice(1).join(" ")||"",_e=se[1]}else if(se.length===3)he=se[0],ue=se[1],_e=se[2];else if(se.length===4)he=se[0],ue=se[1],_e=se[2],Ae=se[3];else if(se.length>=5){he=se[0],ue=se[1],_e=se[2],Ae=se[3];const Le=se[4].toLowerCase();Ce=Le==="true"||Le==="yes"||Le==="1"||Le==="y"}const ge=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_e);ye.push({firstName:he.trim(),lastName:ue.trim(),email:_e.trim().toLowerCase(),phone:Ae.trim()||void 0,smsConsent:Ce,isValid:ge&&he.trim().length>0,error:ge?he.trim()?void 0:"Missing name":"Invalid email"})}}return ye},z=K=>{var ie;const G=(ie=K.target.files)==null?void 0:ie[0];if(!G)return;const te=new FileReader;te.onload=oe=>{var pe;const ye=(pe=oe.target)==null?void 0:pe.result,ae=P(ye);if(ae.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}h(ae),C("preview")},te.readAsText(G)},F=async()=>{const K=i.filter(te=>te.isValid);if(K.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const G=s||p||null;_(!0);try{const{data:{session:te}}=await J.auth.getSession(),ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${te==null?void 0:te.access_token}`},body:JSON.stringify({users:K.map(ye=>({firstName:ye.firstName,lastName:ye.lastName,email:ye.email,phone:ye.phone,smsConsent:ye.smsConsent})),brokerageId:G})}),oe=await ie.json();if(!ie.ok)throw new Error(oe.error||"Failed to import users");A(oe),C("result"),oe.created>0&&a(),o({title:"Import Complete",description:`${oe.created} user(s) created successfully.${oe.failed>0?` ${oe.failed} failed.`:""}`})}catch(te){console.error("Import error:",te),o({title:"Import Failed",description:te.message||"Failed to import users",variant:"destructive"})}finally{_(!1)}},q=i.filter(K=>K.isValid).length,V=i.filter(K=>!K.isValid).length;return r.jsx(Fr,{open:t,onOpenChange:T,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(y1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Qn,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),j==="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:l,onChange:z,className:"hidden"}),r.jsx(uo,{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(ee,{onClick:()=>{var K;return(K=l.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."})]})]}),j==="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(He,{children:"Assign to Brokerage (optional)"}),r.jsxs(gn,{value:p||"none",onValueChange:K=>x(K==="none"?"":K),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a brokerage..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No brokerage"}),n.map(K=>r.jsx(qt,{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(Xi,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[q," valid"]})]}),V>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(fl,{className:"h-4 w-4"}),r.jsxs("span",{children:[V," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"SMS"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:i.slice(0,100).map((K,G)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:K.firstName}),r.jsx(Nt,{children:K.lastName}),r.jsx(Nt,{children:K.email}),r.jsx(Nt,{className:"text-muted-foreground",children:K.phone||"-"}),r.jsx(Nt,{className:"text-muted-foreground",children:K.smsConsent===!0?"✓":K.smsConsent===!1?"✗":"-"}),r.jsx(Nt,{children:K.isValid?r.jsx(Ot,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ot,{variant:"destructive",children:K.error||"Invalid"})})]},G))})]}),i.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",i.length," users"]})]})]}),j==="result"&&N&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Xi,{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:[N.created," agent(s) created and invited"]}),N.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[N.failed," failed to create"]})]}),N.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:[N.errors.slice(0,10).map((K,G)=>r.jsxs("li",{children:["• ",K]},G)),N.errors.length>10&&r.jsxs("li",{children:["...and ",N.errors.length-10," more"]})]})]})]}),r.jsxs(ea,{children:[j==="upload"&&r.jsx(ee,{variant:"outline",onClick:T,children:"Cancel"}),j==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:E,children:"Back"}),r.jsx(ee,{onClick:F,disabled:y||q===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${q} Agent${q!==1?"s":""}`})]}),j==="result"&&r.jsx(ee,{onClick:T,children:"Done"})]})]})})},hyt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:vs},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:Zi},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Ec}];function pRe({open:t,onOpenChange:e,userId:n,userName:s}){const[a,o]=I.useState("custom"),[l,i]=I.useState(""),[h,p]=I.useState(""),x=Pat(),y=j=>{o(j.type),i(j.title),p(j.message)},_=async j=>{if(j.preventDefault(),!l.trim()){ma({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:a,title:l.trim(),message:h.trim()||void 0}),ma({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),e(!1),i(""),p(""),o("custom")}catch{ma({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Ec,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(Qn,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(He,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:hyt.map((j,C)=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>y(j),className:"text-xs",children:[r.jsx(j.icon,{className:"h-3 w-3 mr-1"}),j.title]},C))})]}),r.jsxs("form",{onSubmit:_,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(gn,{value:a,onValueChange:j=>o(j),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:"h-4 w-4"})," Custom"]})}),r.jsx(qt,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(qt,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(qt,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:l,onChange:j=>i(j.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"message",children:"Message (optional)"}),r.jsx(ps,{id:"message",value:h,onChange:j=>p(j.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[r.jsx(Ec,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const rce={points_earned:{label:"Points Earned",icon:Zi,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:da,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:fd,color:"bg-green-500"},custom:{label:"Custom",icon:Ms,color:"bg-purple-500"}};function fyt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState("all"),{data:l=[],isLoading:i}=Yt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await J.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const _=[...new Set([...x.map(N=>N.user_id),...x.map(N=>N.created_by).filter(Boolean)])],{data:j}=await J.from("profiles").select("id, name, email").in("id",_),C=new Map((j==null?void 0:j.map(N=>[N.id,N]))||[]);return x.map(N=>{var A,E,T;return{...N,user_name:((A=C.get(N.user_id))==null?void 0:A.name)||"Unknown",user_email:((E=C.get(N.user_id))==null?void 0:E.email)||"",creator_name:N.created_by?((T=C.get(N.created_by))==null?void 0:T.name)||"System":"Auto-triggered"}})}}),h=l.filter(x=>{var C,N;const y=((C=x.user_name)==null?void 0:C.toLowerCase().includes(t.toLowerCase()))||((N=x.user_email)==null?void 0:N.toLowerCase().includes(t.toLowerCase()))||x.title.toLowerCase().includes(t.toLowerCase()),_=n==="all"||x.celebration_type===n,j=a==="all"||a==="seen"&&x.seen_at||a==="unseen"&&!x.seen_at;return y&&_&&j}),p={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(rce).reduce((x,y)=>(x[y]=l.filter(_=>_.celebration_type===y).length,x),{})};return i?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:p.total})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{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:p.seen})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{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:p.unseen})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{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:p.byType.custom||0})})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ec,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(Tn,{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(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by agent name, email, or title...",value:t,onChange:x=>e(x.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),Object.entries(rce).map(([x,y])=>r.jsx(qt,{value:x,children:y.label},x))]})]}),r.jsxs(gn,{value:a,onValueChange:o,children:[r.jsx(fn,{className:"w-[140px]",children:r.jsx(yn,{placeholder:"Status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"seen",children:"Seen"}),r.jsx(qt,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Points"}),r.jsx(It,{children:"Created By"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:h.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):h.map(x=>{const y=rce[x.celebration_type],_=y.icon;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(_,{className:"h-3 w-3"}),y.label]})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.user_name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:x.user_email})]})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.title}),x.message&&r.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:x.message})]})}),r.jsx(Nt,{children:x.points_amount?r.jsxs(Ot,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:xn(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(Nt,{children:x.seen_at?r.jsx(Ot,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Ot,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),h.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",h.length," of ",l.length," celebrations"]})]})]})]})}const pyt=()=>{const t=Zn(),{user:e,isAdmin:n}=Xr(),{startImpersonation:s,isLoading:a}=VIe(),{toast:o}=pi(),[l,i]=I.useState([]),[h,p]=I.useState([]),[x,y]=I.useState([]),[_,j]=I.useState({}),[C,N]=I.useState(!0),[A,E]=I.useState({}),[T,P]=I.useState(!1),[z,F]=I.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[q,V]=I.useState(!1),[K,G]=I.useState(""),[te,ie]=I.useState(1),[oe,ye]=I.useState(50),[ae,pe]=I.useState("all"),[se,he]=I.useState("all"),[ue,_e]=I.useState("all"),[Ae,Ce]=I.useState("all"),[Se,ge]=I.useState(!1),[Le,ke]=I.useState(!1),[Be,Ee]=I.useState(null),[Ue,Fe]=I.useState(null),[be,tt]=I.useState(!1),[Te,Ke]=I.useState({name:"",email:"",brokerage_id:"",phone:""}),[me,yt]=I.useState(null),[rt,at]=I.useState(!1),[Me,ft]=I.useState(""),[qe,Oe]=I.useState(!1),[Qe,nt]=I.useState(!1),[gt,mt]=I.useState(null),[Mt,wt]=I.useState(""),[Qt,Cr]=I.useState(!1),[cn,jn]=I.useState(!1),[Qr,Pn]=I.useState(null),[js,hr]=I.useState(!1),[xs,ka]=I.useState(!1),[xa,zi]=I.useState(null),[Bi,nl]=I.useState(""),[xo,Hs]=I.useState(!1),[Xa,Ns]=I.useState({email:"",name:"",password:"",phone:""}),[Fa,Oa]=I.useState(!1),[Ro,ir]=I.useState(!1),[fo,ml]=I.useState(""),[Ao,ss]=I.useState(!1),[yo,xu]=I.useState(!1),[$l,yu]=I.useState(""),[et,xe]=I.useState(new Set),[Ie,Ge]=I.useState(!1),[kt,vt]=I.useState(!1),[At,Bt]=I.useState(null),[Pt,Ut]=I.useState(!1),[fr,ar]=I.useState(null),[Wr,wn]=I.useState([]),[Ur,es]=I.useState([]),[ts,Yn]=I.useState(!1),[Ds,Li]=I.useState({});I.useEffect(()=>{!e||!n||(ha(),vo())},[e,n]);const po=async()=>{try{const{data:jt,error:gr}=await J.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(gr)throw gr;const Pr={};for(const Hn of jt??[])Pr[Hn.brokerage_id]||(Pr[Hn.brokerage_id]=[]),Pr[Hn.brokerage_id].push(Hn.user_id);j(Pr)}catch(jt){console.error("Error loading brokerage manager assignments:",jt)}},ha=async()=>{try{N(!0);const{data:jt,error:gr}=await J.functions.invoke("get-user-details");if(gr)throw gr;const Pr=jt.users||[];i(Pr),y(jt.brokerages||[]),await po();const Hn=Pr.filter(rs=>rs.roles.includes("assistant"));if(Hn.length>0){const rs=Hn.map(ra=>ra.id),{data:Na}=await J.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",rs);if(Na&&Na.length>0){const ra=[...new Set(Na.map(gp=>gp.agent_id))],{data:mi}=await J.from("profiles").select("id, name, email").in("id",ra),xl={};for(const gp of Na){const xp=mi==null?void 0:mi.find(Wd=>Wd.id===gp.agent_id);xp&&(xl[gp.assistant_id]={agent_name:xp.name||"",agent_email:xp.email||""})}Li(xl)}}}catch(jt){console.error("Error loading members:",jt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{N(!1)}},vo=async()=>{try{const{data:jt,error:gr}=await J.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(gr)throw gr;p(jt||[])}catch(jt){console.error("Error loading apps:",jt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},ji=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:Pr}=await J.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(Pr)throw Pr;o({title:"Success",description:"Member details updated successfully"}),Ee(null),ha()}catch(Pr){console.error("Error updating member:",Pr),o({title:"Error",description:Pr.message||"Failed to update member",variant:"destructive"})}},Ws=async jt=>{try{const{data:{session:gr}}=await J.auth.getSession(),Pr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${gr==null?void 0:gr.access_token}`},body:JSON.stringify({userId:jt})}),Hn=await Pr.json();if(!Pr.ok)throw new Error(Hn.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(gr){console.error("Error resending welcome email:",gr),o({title:"Error",description:gr.message||"Failed to resend welcome email",variant:"destructive"})}},ki=async(jt,gr)=>{try{const{error:Pr}=await J.functions.invoke("send-password-reset",{body:{email:jt,redirectTo:window.location.origin}});if(Pr)throw Pr;o({title:"Password Reset Sent",description:`Password reset email sent to ${gr}`})}catch(Pr){console.error("Error sending password reset:",Pr),o({title:"Error",description:Pr.message||"Failed to send password reset email",variant:"destructive"})}},za=async(jt,gr)=>{if(confirm(`Are you sure you want to delete ${gr}? This action cannot be undone.`))try{const{data:{session:Pr}}=await J.auth.getSession(),Hn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:jt})}),rs=await Hn.json();if(!Hn.ok)throw new Error(rs.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),ha()}catch(Pr){console.error("Error deleting user:",Pr),o({title:"Error",description:Pr.message||"Failed to delete user",variant:"destructive"})}},Ss=async()=>{if(!z.email||!z.name||!z.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(z.role==="brokerage_manager"&&!z.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}P(!0);try{const{data:{session:jt}}=await J.auth.getSession(),gr=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(z)}),Pr=await gr.json();if(!gr.ok)throw new Error(Pr.error||"Failed to create user");if(z.role&&z.role!=="user"&&Pr.userId){const Hn=z.role==="brokerage_manager"?z.brokerage_id:void 0;await Ni(Pr.userId,z.role,"add",Hn)}o({title:"Success",description:`User ${z.email} created successfully`}),F({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),V(!1),ha()}catch(jt){console.error("Error creating user:",jt),o({title:"Error",description:jt.message||"Failed to create user",variant:"destructive"})}finally{P(!1)}},Ni=async(jt,gr,Pr,Hn)=>{try{const{data:{session:rs}}=await J.auth.getSession(),Na={userId:jt,role:gr,action:Pr};if(gr==="brokerage_manager"){if(!Hn){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}Na.brokerageId=Hn}const ra=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rs==null?void 0:rs.access_token}`},body:JSON.stringify(Na)}),mi=await ra.json();if(!ra.ok)throw new Error(mi.error||"Failed to manage user role");o({title:"Success",description:`Role ${Pr==="add"?"added":"removed"} successfully`}),ha()}catch(rs){console.error("Error managing user role:",rs),o({title:"Error",description:rs.message||"Failed to manage user role",variant:"destructive"})}},gl=(jt,gr)=>gr.length===0?!0:gr.some(Pr=>jt.includes(Pr)),Cl=async(jt,gr,Pr)=>{const Hn=`${jt}-${gr.id}`;yt(Hn);try{if(Pr){const rs=l.find(ra=>ra.id===jt),Na=gr.required_tags.filter(ra=>rs==null?void 0:rs.tags.includes(ra));for(const ra of Na){const{error:mi}=await J.from("user_tags").delete().eq("user_id",jt).eq("tag",ra);if(mi)throw mi}o({title:"Access Removed",description:`Removed access to ${gr.name}`})}else if(gr.required_tags.length>0){const{error:rs}=await J.from("user_tags").insert({user_id:jt,tag:gr.required_tags[0]});if(rs)throw rs;o({title:"Access Granted",description:`Granted access to ${gr.name}`})}await ha()}catch(rs){console.error("Error toggling access:",rs),o({title:"Error",description:rs.message||"Failed to update access",variant:"destructive"})}finally{yt(null)}},Oc=async()=>{const jt=Me.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(x.find(Pr=>Pr.name.toLowerCase()===jt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Oe(!0);try{const{error:Pr}=await J.from("brokerages").insert({name:jt});if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${jt}" created successfully`}),ft(""),at(!1),ha()}catch(Pr){console.error("Error creating brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to create brokerage",variant:"destructive"})}finally{Oe(!1)}},gf=jt=>{mt(jt),wt(jt.name),nt(!0)},$o=()=>{mt(null),wt(""),nt(!1)},wd=async()=>{if(!gt)return;const jt=Mt.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}Cr(!0);try{const{error:gr}=await J.from("brokerages").update({name:jt}).eq("id",gt.id);if(gr)throw gr;o({title:"Success",description:"Brokerage updated successfully"}),$o(),ha()}catch(gr){console.error("Error updating brokerage:",gr),o({title:"Error",description:gr.message||"Failed to update brokerage",variant:"destructive"})}finally{Cr(!1)}},nc=async(jt,gr)=>{var Pr;if(!gr||typeof gr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const Hn={userId:jt,role:"brokerage_manager",action:"add",brokerageId:gr};console.debug("[assignManagerToBrokerage] payload",Hn);const{data:{session:rs}}=await J.auth.getSession(),Na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rs==null?void 0:rs.access_token}`},body:JSON.stringify(Hn)}),ra=await Na.json();if(!Na.ok&&!((Pr=ra.error)!=null&&Pr.includes("duplicate")))throw new Error(ra.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await ha()}catch(Hn){console.error("Error assigning manager:",Hn),o({title:"Error",description:Hn.message||"Failed to assign manager",variant:"destructive"})}},Zu=jt=>{Pn(jt),jn(!0)},Uo=async()=>{if(Qr){hr(!0);try{const jt=l.filter(Hn=>Hn.brokerage_id===Qr.id),{data:{session:gr}}=await J.auth.getSession();for(const Hn of jt){const rs=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${gr==null?void 0:gr.access_token}`},body:JSON.stringify({userId:Hn.id})});if(!rs.ok){const Na=await rs.json();console.error(`Failed to delete user ${Hn.email}:`,Na.error)}}const{error:Pr}=await J.from("brokerages").delete().eq("id",Qr.id);if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${Qr.name}" and ${jt.length} member(s) deleted`}),jn(!1),Pn(null),ha()}catch(jt){console.error("Error deleting brokerage:",jt),o({title:"Error",description:jt.message||"Failed to delete brokerage",variant:"destructive"})}finally{hr(!1)}}},fp=jt=>{zi(jt),nl(""),ka(!0)},Em=()=>{zi(null),nl(""),ka(!1)},jy=async jt=>{try{const{error:gr}=await J.from("profiles").update({brokerage_id:null}).eq("id",jt);if(gr)throw gr;o({title:"Success",description:"User removed from brokerage"}),ha()}catch(gr){console.error("Error removing user from brokerage:",gr),o({title:"Error",description:gr.message||"Failed to remove user",variant:"destructive"})}},ky=async(jt,gr)=>{try{const{error:Pr}=await J.from("profiles").update({brokerage_id:gr}).eq("id",jt);if(Pr)throw Pr;o({title:"Success",description:"User added to brokerage"}),ha()}catch(Pr){console.error("Error adding user to brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to add user",variant:"destructive"})}},Ny=async()=>{if(!xa||!Xa.email||!Xa.name||!Xa.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Oa(!0);try{const{data:{session:jt}}=await J.auth.getSession(),gr=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({...Xa,brokerage_id:xa.id,role:"user"})}),Pr=await gr.json();if(!gr.ok)throw new Error(Pr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Xa.email} created successfully`}),Ns({email:"",name:"",password:"",phone:""}),Hs(!1),ha()}catch(jt){console.error("Error creating agent:",jt),o({title:"Error",description:jt.message||"Failed to create agent",variant:"destructive"})}finally{Oa(!1)}},Ch=jt=>l.filter(gr=>gr.brokerage_id===jt),vu=jt=>{const gr=Ch(jt);if(!Bi)return gr;const Pr=Bi.toLowerCase();return gr.filter(Hn=>Hn.name.toLowerCase().includes(Pr)||Hn.email.toLowerCase().includes(Pr))},Dc=jt=>l.filter(gr=>gr.brokerage_id!==jt),Hd=l.filter(jt=>{var gr;if(K){const Pr=K.toLowerCase();if(!(jt.name.toLowerCase().includes(Pr)||jt.email.toLowerCase().includes(Pr)||((gr=jt.brokerage_name)==null?void 0:gr.toLowerCase().includes(Pr))))return!1}return!(ae==="claimed"&&!jt.claimed||ae==="unclaimed"&&jt.claimed||se!=="all"&&!jt.roles.includes(se)||ue==="trial"&&!jt.is_trial||ue==="non-trial"&&jt.is_trial||Ae==="none"&&jt.brokerage_id||Ae!=="all"&&Ae!=="none"&&jt.brokerage_id!==Ae)}),Rc=Hd.length,_o=Math.ceil(Rc/oe),jd=(te-1)*oe,Yu=jd+oe,yc=Hd.slice(jd,Yu),Sy=jt=>{G(jt),ie(1)},pp=jt=>{ye(jt),ie(1)},mp=(jt,gr)=>{jt(gr),ie(1)},Cy=async(jt,gr)=>{ge(!0);try{const Pr=l.find(ra=>ra.id===jt);if(!Pr)return;const Hn=Pr.trial_expires_at?new Date(Pr.trial_expires_at):new Date,rs=new Date(Hn.getTime()+gr*24*60*60*1e3),{error:Na}=await J.from("profiles").update({trial_expires_at:rs.toISOString()}).eq("id",jt);if(Na)throw Na;o({title:"Trial Extended",description:`Trial extended by ${gr} days`}),ha()}catch(Pr){console.error("Error extending trial:",Pr),o({title:"Error",description:Pr.message||"Failed to extend trial",variant:"destructive"})}finally{ge(!1)}},Hg=async jt=>{ke(!0);try{const{error:gr}=await J.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",jt);if(gr)throw gr;o({title:"Account Converted",description:"User has been converted to a full account"}),ha(),Mh()}catch(gr){console.error("Error converting trial:",gr),o({title:"Error",description:gr.message||"Failed to convert account",variant:"destructive"})}finally{ke(!1)}},Qc=async jt=>{Yn(!0);try{const{data:gr}=await J.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",jt);if(gr&&gr.length>0){const Hn=gr.map(Na=>Na.assistant_id),{data:rs}=await J.from("profiles").select("id, name, email").in("id",Hn);wn(gr.map(Na=>{const ra=rs==null?void 0:rs.find(mi=>mi.id===Na.assistant_id);return{id:Na.id,assistant_id:Na.assistant_id,assistant_name:(ra==null?void 0:ra.name)||"Unknown",assistant_email:(ra==null?void 0:ra.email)||"",permissions:Na.permissions||{}}}))}else wn([]);const{data:Pr}=await J.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",jt);if(Pr&&Pr.length>0){const Hn=Pr.map(Na=>Na.agent_id),{data:rs}=await J.from("profiles").select("id, name, email").in("id",Hn);es(Pr.map(Na=>{const ra=rs==null?void 0:rs.find(mi=>mi.id===Na.agent_id);return{id:Na.id,agent_id:Na.agent_id,agent_name:(ra==null?void 0:ra.name)||"Unknown",agent_email:(ra==null?void 0:ra.email)||"",permissions:Na.permissions||{}}}))}else es([])}catch(gr){console.error("Error loading assistant data:",gr)}finally{Yn(!1)}},Wg=jt=>{Fe(jt),Ke({name:jt.name,email:jt.email,brokerage_id:jt.brokerage_id||"",phone:jt.phone||""}),tt(!0),Qc(jt.id)},Mh=()=>{Fe(null),tt(!1),Ke({name:"",email:"",brokerage_id:"",phone:""})},Th=async()=>{Ue&&(await ji(Ue.id),Mh())},T3=jt=>{xe(gr=>{const Pr=new Set(gr);return Pr.has(jt)?Pr.delete(jt):Pr.add(jt),Pr})},gk=()=>{if(et.size===yc.length&&yc.every(jt=>et.has(jt.id))){const jt=new Set(et);yc.forEach(gr=>jt.delete(gr.id)),xe(jt)}else{const jt=new Set(et);yc.forEach(gr=>jt.add(gr.id)),xe(jt)}},xf=()=>{xe(new Set)},Ys=async()=>{if(et.size===0)return;Ge(!0);let jt=0,gr=0;try{const{data:{session:Pr}}=await J.auth.getSession();for(const Hn of et)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:Hn})})).ok?jt++:gr++}catch{gr++}o({title:"Bulk Email Complete",description:`Sent ${jt} emails${gr>0?`, ${gr} failed`:""}`}),xf()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send emails",variant:"destructive"})}finally{Ge(!1)}},My=async()=>{if(et.size===0)return;Ge(!0);let jt=0,gr=0;try{const{data:{session:Pr}}=await J.auth.getSession();for(const Hn of et)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:Hn})})).ok?jt++:gr++}catch{gr++}o({title:"Bulk Password Reset Complete",description:`Sent ${jt} reset emails${gr>0?`, ${gr} failed`:""}`}),xf()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ge(!1)}},xv=async()=>{if(et.size===0)return;const jt=l.filter(rs=>et.has(rs.id)).map(rs=>rs.name).slice(0,5).join(", "),gr=et.size>5?` and ${et.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${et.size} users (${jt}${gr})? This action cannot be undone.`))return;Ge(!0);let Pr=0,Hn=0;try{const{data:{session:rs}}=await J.auth.getSession();for(const Na of et)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rs==null?void 0:rs.access_token}`},body:JSON.stringify({userId:Na})})).ok?Pr++:Hn++}catch{Hn++}o({title:"Bulk Delete Complete",description:`Deleted ${Pr} users${Hn>0?`, ${Hn} failed`:""}`}),xf(),ha()}catch(rs){o({title:"Error",description:rs.message||"Failed to delete users",variant:"destructive"})}finally{Ge(!1)}},xk=async()=>{vt(!0);try{const{data:{session:jt}}=await J.auth.getSession(),gr=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(!gr.ok){const Hn=await gr.json();throw new Error(Hn.error||"Failed to sync phones")}const Pr=await gr.json();o({title:"Phone Sync Complete",description:`Pulled ${Pr.summary.pulledFromGHL} from GHL, pushed ${Pr.summary.pushedToGHL} to GHL, ${Pr.summary.alreadySynced} already synced`}),ha()}catch(jt){o({title:"Error",description:jt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{vt(!1)}},yk=async(jt,gr)=>{Bt(jt);try{const{data:{session:Pr}}=await J.auth.getSession(),{data:Hn}=await J.from("profiles").select("phone").eq("id",jt).single(),rs=(Hn==null?void 0:Hn.phone)||"",Na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({email:gr,action:"update",phone:rs||void 0})});if(!Na.ok){const mi=await Na.json();throw new Error(mi.error||"Failed to sync with GHL")}const ra=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(gr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:rs?`Phone ${rs} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),ha()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to sync phone",variant:"destructive"})}finally{Bt(null)}},Ah=async jt=>{await s(jt)},Gg=()=>{if(et.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const jt=l.filter(mi=>et.has(mi.id)),gr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Pr=jt.map(mi=>[mi.name,mi.email,mi.phone||"",mi.brokerage_name||"",mi.roles.join("; "),mi.claimed?"Claimed":"Unclaimed",new Date(mi.created_at).toLocaleDateString()]),Hn=[gr.join(","),...Pr.map(mi=>mi.map(xl=>`"${(xl||"").replace(/"/g,'""')}"`).join(","))].join(` `),rs=new Blob([Hn],{type:"text/csv"}),Na=URL.createObjectURL(rs),ra=document.createElement("a");ra.href=Na,ra.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,ra.click(),URL.revokeObjectURL(Na),o({title:"Export complete",description:`Exported ${jt.length} member(s)`})};return C?r.jsx(Lr,{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(Lr,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{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(ee,{size:"sm",variant:"outline",onClick:xk,disabled:kt,children:[kt?r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(bi,{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(ee,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(y1,{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(Fr,{open:q,onOpenChange:V,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(sf,{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(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New User"}),r.jsx(Qn,{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(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",placeholder:"John Doe",value:z.name,onChange:jt=>F({...z,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",placeholder:"john@example.com",value:z.email,onChange:jt=>F({...z,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"password",children:"Password"}),r.jsx(dt,{id:"password",type:"password",placeholder:"Min 6 characters",value:z.password,onChange:jt=>F({...z,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"555-123-4567",value:z.phone,onChange:jt=>F({...z,phone:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"brokerage",children:["Brokerage",z.role==="brokerage_manager"?" (required)":""]}),r.jsxs(gn,{value:z.brokerage_id||"none",onValueChange:jt=>F({...z,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"brokerage",children:r.jsx(yn,{placeholder:z.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"None"}),x.map(jt=>r.jsx(qt,{value:jt.id,children:jt.name},jt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"role",children:"Role"}),r.jsxs(gn,{value:z.role,onValueChange:jt=>F({...z,role:jt}),children:[r.jsx(fn,{id:"role",children:r.jsx(yn,{placeholder:"Select role"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"user",children:"User"}),r.jsx(qt,{value:"moderator",children:"Moderator"}),r.jsx(qt,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(qt,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(gn,{value:z.trial_days||"none",onValueChange:jt=>F({...z,trial_days:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"trial_days",children:r.jsx(yn,{placeholder:"No trial (full access)"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No trial (full access)"}),r.jsx(qt,{value:"7",children:"7-day trial"}),r.jsx(qt,{value:"30",children:"30-day trial"}),r.jsx(qt,{value:"60",children:"60-day trial"}),r.jsx(qt,{value:"90",children:"90-day trial"}),r.jsx(qt,{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(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ss,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(Ii,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"members",children:"Members"}),r.jsx(nn,{value:"brokerages",children:"Brokerages"}),r.jsx(nn,{value:"access",children:"Access Matrix"}),r.jsx(nn,{value:"celebrations",children:"Celebrations"})]}),r.jsxs(Sn,{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(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search members...",value:K,onChange:jt=>Sy(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(gn,{value:ae,onValueChange:jt=>mp(pe,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"claimed",children:"Active"}),r.jsx(qt,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(gn,{value:se,onValueChange:jt=>mp(he,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Roles"}),r.jsx(qt,{value:"admin",children:"Admin"}),r.jsx(qt,{value:"brokerage_manager",children:"Manager"}),r.jsx(qt,{value:"assistant",children:"Assistant"}),r.jsx(qt,{value:"user",children:"User"})]})]}),r.jsxs(gn,{value:ue,onValueChange:jt=>mp(_e,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Users"}),r.jsx(qt,{value:"trial",children:"Trial Only"}),r.jsx(qt,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(gn,{value:Ae,onValueChange:jt=>mp(Ce,jt),children:[r.jsx(fn,{className:"w-[150px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Brokerages"}),r.jsx(qt,{value:"none",children:"No Brokerage"}),x.map(jt=>r.jsx(qt,{value:jt.id,children:jt.name},jt.id))]})]}),(K||ae!=="all"||se!=="all"||ue!=="all"||Ae!=="all")&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{G(""),pe("all"),he("all"),_e("all"),Ce("all"),ie(1)},children:[r.jsx(_s,{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 ",jd+1,"-",Math.min(Yu,Rc)," of ",Rc," members"]}),r.jsxs(gn,{value:oe.toString(),onValueChange:jt=>pp(Number(jt)),children:[r.jsx(fn,{className:"h-9 w-[110px]",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"50",children:"50 / page"}),r.jsx(qt,{value:"100",children:"100 / page"}),r.jsx(qt,{value:"250",children:"250 / page"})]})]})]})]}),et.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(w0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[et.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:Ys,disabled:Ie,children:[Ie?r.jsx(en,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(ua,{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(ee,{size:"sm",variant:"outline",onClick:My,disabled:Ie,children:[Ie?r.jsx(en,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(tf,{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(ee,{size:"sm",variant:"outline",onClick:Gg,children:[r.jsx(no,{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(ee,{size:"sm",variant:"destructive",onClick:xv,disabled:Ie,children:[Ie?r.jsx(en,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Vn,{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(ee,{size:"sm",variant:"ghost",onClick:xf,disabled:Ie,children:r.jsx(_s,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"w-[50px]",children:r.jsx(Dl,{checked:yc.length>0&&yc.every(jt=>et.has(jt.id)),onCheckedChange:gk,"aria-label":"Select all on page"})}),r.jsx(It,{className:"font-semibold",children:"Name"}),r.jsx(It,{className:"font-semibold",children:"Brokerage"}),r.jsx(It,{className:"font-semibold",children:"Status"}),r.jsx(It,{className:"font-semibold",children:"Role"}),r.jsx(It,{className:"font-semibold",children:"Last Login"}),r.jsx(It,{className:"w-[100px]"})]})}),r.jsx(Vs,{children:yc.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):yc.map(jt=>r.jsxs(Ar,{className:`hover:bg-muted/30 ${et.has(jt.id)?"bg-primary/5":""}`,children:[r.jsx(Nt,{children:r.jsx(Dl,{checked:et.has(jt.id),onCheckedChange:()=>T3(jt.id),"aria-label":`Select ${jt.name}`})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>Wg(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(Nt,{className:"text-muted-foreground",children:jt.brokerage_name||"—"}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ot,{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(Eke,{expiresAt:jt.trial_expires_at,className:"w-fit"})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[jt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:jt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"}),jt.roles.includes("assistant")&&r.jsxs(Ot,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",Ds[jt.id]?` → ${Ds[jt.id].agent_name||Ds[jt.id].agent_email}`:""]})]})}),r.jsx(Nt,{className:"text-muted-foreground",children:jt.last_sign_in_at?new Date(jt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ar(jt),Ut(!0)},title:"Send celebration",children:r.jsx(Ec,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Wg(jt),title:"Edit member",children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>yk(jt.id,jt.email),disabled:At===jt.id,title:"Sync phone with GHL",children:At===jt.id?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(bi,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ws(jt.id),title:"Resend welcome email",children:r.jsx(ua,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ki(jt.email,jt.name),title:"Send password reset",children:r.jsx(xj,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Ah(jt.id),disabled:a||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:a?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(dS,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>za(jt.id,jt.name),title:"Delete user",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),_o>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 ",te," of ",_o]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ie(1),disabled:te===1,children:"First"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.max(1,jt-1)),disabled:te===1,children:r.jsx(Ac,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,_o)},(jt,gr)=>{let Pr;return _o<=5||te<=3?Pr=gr+1:te>=_o-2?Pr=_o-4+gr:Pr=te-2+gr,r.jsx(ee,{variant:te===Pr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ie(Pr),children:Pr},Pr)})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.min(_o,jt+1)),disabled:te===_o,children:r.jsx(Vi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ie(_o),disabled:te===_o,children:"Last"})]})]})]}),r.jsx(Fr,{open:be,onOpenChange:tt,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Member"}),r.jsx(Qn,{children:"Update member details, roles, and app access"})]}),Ue&&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(He,{htmlFor:"edit-name",children:"Name"}),r.jsx(dt,{id:"edit-name",value:Te.name,onChange:jt=>Ke({...Te,name:jt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-email",children:"Email"}),r.jsx(dt,{id:"edit-email",type:"email",value:Te.email,onChange:jt=>Ke({...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(He,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(dt,{id:"edit-phone",type:"tel",value:Te.phone,onChange:jt=>Ke({...Te,phone:jt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(gn,{value:Te.brokerage_id||"none",onValueChange:jt=>Ke({...Te,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"edit-brokerage",children:r.jsx(yn,{placeholder:"Select brokerage"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"None"}),x.map(jt=>r.jsx(qt,{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:[Ue.roles.map(jt=>r.jsxs(Ot,{variant:"default",className:"gap-1",children:[r.jsx(nf,{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:()=>Ni(Ue.id,jt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(_s,{className:"h-3 w-3"})})]},jt)),Ue.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(gn,{onValueChange:jt=>Ni(Ue.id,jt,"add"),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(yn,{placeholder:"Add role..."})}),r.jsxs(pn,{children:[!Ue.roles.includes("admin")&&r.jsx(qt,{value:"admin",children:"Admin"}),!Ue.roles.includes("user")&&r.jsx(qt,{value:"user",children:"User"})]})]}),!Ue.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"})]}),(Wr.length>0||Ur.length>0||Ue.roles.includes("assistant"))&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Assistant Relationships"]}),ts?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):r.jsxs("div",{className:"space-y-3",children:[Wr.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Has assistants:"}),Wr.map(jt=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:jt.assistant_name}),r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Assistant"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:jt.assistant_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(jt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(Ot,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},jt.id))]}),Ur.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Assists agents:"}),Ur.map(jt=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:jt.agent_name}),r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Agent"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:jt.agent_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(jt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(Ot,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},jt.id))]})]})]}),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:h.map(jt=>{const gr=gl(Ue.tags,jt.required_tags),Pr=`${Ue.id}-${jt.id}`,Hn=me===Pr,rs=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}),rs&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:Hn?r.jsx(en,{className:"h-4 w-4 animate-spin text-muted-foreground"}):rs?r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Ps,{checked:gr,onCheckedChange:()=>Cl(Ue.id,jt,gr)})})]},jt.id)})})]}),Ue.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(Ya,{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:Ue.trial_expires_at&&r.jsx(Eke,{expiresAt:Ue.trial_expires_at})}),Ue.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Ue.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>Cy(Ue.id,7),disabled:Se,children:[r.jsx(uj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>Cy(Ue.id,14),disabled:Se,children:[r.jsx(uj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>Cy(Ue.id,30),disabled:Se,children:[r.jsx(uj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(ee,{size:"sm",variant:"default",onClick:()=>Hg(Ue.id),disabled:Le,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(kj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Ue.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Ue.trial_started_at).toLocaleDateString(),Ue.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Ue.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:[Ue.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Ue.email_confirmed_at).toLocaleString()]}),Ue.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Ue.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Ue.created_at).toLocaleString()]})]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:Mh,children:"Cancel"}),r.jsx(ee,{onClick:Th,children:"Save Changes"})]})]})}),r.jsxs(Sn,{value:"access",children:[h.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(ee,{onClick:()=>t("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Member Access Matrix"}),r.jsx(Tn,{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"}),h.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:[yc.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})]})}),h.map(gr=>{const Pr=gl(jt.tags,gr.required_tags),Hn=`${jt.id}-${gr.id}`,rs=me===Hn;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:rs?r.jsx(en,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Ps,{checked:Pr,onCheckedChange:()=>Cl(jt.id,gr,Pr),disabled:gr.required_tags.length===0})})},gr.id)})]},jt.id)),yc.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:h.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),_o>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 ",jd+1,"-",Math.min(Yu,Rc)," of ",Rc," • Page ",te," of ",_o]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.max(1,jt-1)),disabled:te===1,children:r.jsx(Ac,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.min(_o,jt+1)),disabled:te===_o,children:r.jsx(Vi,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(ee,{variant:"outline",onClick:()=>t("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(Sn,{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(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search brokerages...",value:fo,onChange:jt=>ml(jt.target.value),className:"pl-10"})]}),r.jsxs(Fr,{open:rt,onOpenChange:at,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(ai,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New Brokerage"}),r.jsx(Qn,{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(He,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage-name",placeholder:"Enter brokerage name",value:Me,onChange:jt=>ft(jt.target.value),maxLength:100})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>at(!1),children:"Cancel"}),r.jsx(ee,{onClick:Oc,disabled:qe,children:qe?"Creating...":"Create Brokerage"})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(It,{className:"font-semibold",children:"Manager(s)"}),r.jsx(It,{className:"font-semibold",children:"Agents"}),r.jsx(It,{className:"w-[150px]"})]})}),r.jsx(Vs,{children:(()=>{const jt=x.filter(gr=>gr.name.toLowerCase().includes(fo.toLowerCase()));return jt.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:fo?"No brokerages match your search":"No brokerages found"})}):jt.map(gr=>{const Pr=l.filter(ra=>ra.brokerage_id===gr.id),rs=(_[gr.id]??[]).map(ra=>l.find(mi=>mi.id===ra)).filter(Boolean),Na=Pr.length;return r.jsxs(Ar,{className:"hover:bg-muted/30",children:[r.jsx(Nt,{children:r.jsx("button",{onClick:()=>gf(gr),className:"text-primary hover:underline font-medium",children:gr.name})}),r.jsx(Nt,{children:rs.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:rs.map(ra=>r.jsx(Ot,{variant:"secondary",className:"text-xs",children:ra.name},ra.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(Nt,{children:[Na," member",Na!==1?"s":""]}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"h-8",onClick:()=>fp(gr),children:[r.jsx(Bn,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>gf(gr),title:"Edit brokerage",children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Zu(gr),title:"Delete brokerage",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},gr.id)})})()})]})}),r.jsx(Fr,{open:Qe,onOpenChange:nt,children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Brokerage"}),r.jsx(Qn,{children:"Update brokerage details and manage managers"})]}),gt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"edit-brokerage-name",value:Mt,onChange:jt=>wt(jt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{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 gr=(_[gt.id]??[]).map(Pr=>l.find(Hn=>Hn.id===Pr)).filter(Boolean);return gr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):gr.map(Pr=>r.jsxs(Ot,{variant:"default",className:"gap-1",children:[r.jsx(nf,{className:"h-3 w-3"}),Pr.name,r.jsx("button",{onClick:()=>Ni(Pr.id,"brokerage_manager","remove",gt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(_s,{className:"h-3 w-3"})})]},Pr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(hu,{open:Ao,onOpenChange:ss,children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":Ao,className:"w-full justify-between",children:["Search for a member...",r.jsx(wa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Bd,{className:"w-full p-0",align:"start",children:r.jsxs(W1,{children:[r.jsx(G1,{placeholder:"Search by name or email..."}),r.jsxs(K1,{className:"max-h-[200px]",children:[r.jsx(Z1,{children:"No members found."}),r.jsx(Y1,{children:(()=>{const jt=new Set(_[gt.id]??[]);return l.filter(gr=>!jt.has(gr.id)&&(n||gr.brokerage_id===gt.id)).map(gr=>r.jsxs(X1,{value:`${gr.name} ${gr.email}`,onSelect:()=>{nc(gr.id,gt.id),ss(!1)},children:[gr.name," (",gr.email,")"]},gr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(jt=>jt.brokerage_id===gt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(jt=>jt.brokerage_id===gt.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(Ot,{variant:"outline",className:"text-xs",children:"Manager"})]},jt.id))})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:$o,children:"Cancel"}),r.jsx(ee,{onClick:wd,disabled:Qt,children:Qt?"Saving...":"Save Changes"})]})]})}),r.jsx(Fr,{open:cn,onOpenChange:jn,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Qn,{children:['Are you sure you want to delete "',Qr==null?void 0:Qr.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 "',Qr==null?void 0:Qr.name,'"']}),r.jsxs("li",{children:["All ",l.filter(jt=>jt.brokerage_id===(Qr==null?void 0:Qr.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>jn(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Uo,disabled:js,children:js?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Fr,{open:xs,onOpenChange:ka,children:r.jsxs(Rr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-5 w-5"}),"Manage ",xa==null?void 0:xa.name]}),r.jsx(Qn,{children:"Add, remove, or manage users in this brokerage"})]}),xa&&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(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search members...",value:Bi,onChange:jt=>nl(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Fr,{open:xo,onOpenChange:Hs,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(sf,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add New Agent"}),r.jsxs(Qn,{children:["Create a new agent for ",xa.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-name",children:"Name"}),r.jsx(dt,{id:"agent-name",placeholder:"John Doe",value:Xa.name,onChange:jt=>Ns({...Xa,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-email",children:"Email"}),r.jsx(dt,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Xa.email,onChange:jt=>Ns({...Xa,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-password",children:"Password"}),r.jsx(dt,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Xa.password,onChange:jt=>Ns({...Xa,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(dt,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Xa.phone,onChange:jt=>Ns({...Xa,phone:jt.target.value})})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Hs(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ny,disabled:Fa,children:Fa?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(He,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(hu,{open:yo,onOpenChange:xu,children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":yo,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(wa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Bd,{className:"w-[300px] p-0",align:"start",children:r.jsxs(W1,{children:[r.jsx(G1,{placeholder:"Search users...",value:$l,onValueChange:yu}),r.jsxs(K1,{children:[r.jsx(Z1,{children:"No users found."}),r.jsx(Y1,{children:Dc(xa.id).filter(jt=>$l===""||jt.name.toLowerCase().includes($l.toLowerCase())||jt.email.toLowerCase().includes($l.toLowerCase())).map(jt=>r.jsxs(X1,{value:`${jt.name} ${jt.email}`,onSelect:()=>{ky(jt.id,xa.id),xu(!1),yu("")},children:[jt.name," (",jt.email,")"]},jt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Name"}),r.jsx(It,{className:"font-semibold",children:"Email"}),r.jsx(It,{className:"font-semibold",children:"Status"}),r.jsx(It,{className:"font-semibold",children:"Role"}),r.jsx(It,{className:"w-[120px]"})]})}),r.jsx(Vs,{children:vu(xa.id).length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:Bi?"No matching members found":"No members in this brokerage"})}):vu(xa.id).map(jt=>r.jsxs(Ar,{className:"hover:bg-muted/30",children:[r.jsx(Nt,{className:"font-medium",children:jt.name}),r.jsx(Nt,{className:"text-muted-foreground",children:jt.email}),r.jsx(Nt,{children:jt.claimed?r.jsx(Ot,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Ot,{variant:"secondary",children:"Pending"})}),r.jsx(Nt,{children:jt.roles.includes("brokerage_manager")?r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(nf,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!jt.claimed&&r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ws(jt.id),title:"Resend welcome email",children:r.jsx(ua,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>jy(jt.id),title:"Remove from brokerage",children:r.jsx(_s,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Ah(jt.id),disabled:a||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:a?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(dS,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>za(jt.id,jt.name),title:"Delete user",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Ch(xa.id).length," total member",Ch(xa.id).length!==1?"s":""," •",Ch(xa.id).filter(jt=>jt.roles.includes("brokerage_manager")).length," manager",Ch(xa.id).filter(jt=>jt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(ea,{children:r.jsx(ee,{variant:"outline",onClick:Em,children:"Close"})})]})})]}),r.jsx(Sn,{value:"celebrations",children:r.jsx(fyt,{})})]})]}),r.jsx(fRe,{open:Ro,onOpenChange:ir,brokerages:x,onSuccess:ha}),fr&&r.jsx(pRe,{open:Pt,onOpenChange:jt=>{Ut(jt),jt||ar(null)},userId:fr.id,userName:fr.name})]})},myt=()=>{const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(""),[_,j]=I.useState("");I.useEffect(()=>{C()},[]);const C=async()=>{const{data:F,error:q}=await J.from("invite_codes").select("*").order("created_at",{ascending:!1});q?(ze.error("Failed to load invite codes"),console.error(q)):e(F||[]),s(!1)},N=async F=>{if(F.preventDefault(),!l.trim()){ze.error("Please enter a code");return}o(!0);const{error:q}=await J.from("invite_codes").insert({code:l.trim().toUpperCase(),description:h.trim()||null,max_uses:x?parseInt(x):null,trial_days:_?parseInt(_):null});q?q.code==="23505"?ze.error("This code already exists"):(ze.error("Failed to create invite code"),console.error(q)):(ze.success("Invite code created"),i(""),p(""),y(""),j(""),C()),o(!1)},A=async(F,q)=>{const{error:V}=await J.from("invite_codes").update({is_active:!q}).eq("id",F);V?ze.error("Failed to update code"):e(t.map(K=>K.id===F?{...K,is_active:!q}:K))},E=async F=>{const{error:q}=await J.from("invite_codes").delete().eq("id",F);q?ze.error("Failed to delete code"):(ze.success("Code deleted"),e(t.filter(V=>V.id!==F)))},T="https://dashboard.relevelup.com",P=F=>{const q=`${T}/join?code=${F}`;navigator.clipboard.writeText(q),ze.success("Link copied to clipboard")},z=`${T}/join`;return r.jsx(Lr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Create New Code"}),r.jsxs(Tn,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:z})]})]}),r.jsx(Je,{children:r.jsxs("form",{onSubmit:N,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"code",children:"Code"}),r.jsx(dt,{id:"code",placeholder:"WELCOME2024",value:l,onChange:F=>i(F.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(He,{htmlFor:"description",children:"Description (optional)"}),r.jsx(dt,{id:"description",placeholder:"For marketing campaign",value:h,onChange:F=>p(F.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(dt,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:F=>y(F.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(dt,{id:"trialDays",type:"number",placeholder:"None",value:_,onChange:F=>j(F.target.value),className:"w-28"})]}),r.jsxs(ee,{type:"submit",disabled:a,children:[a?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Active Codes"})}),r.jsx(Je,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Code"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Uses"}),r.jsx(It,{children:"Trial"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Active"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono font-medium",children:F.code}),r.jsx(Nt,{className:"text-muted-foreground",children:F.description||"—"}),r.jsxs(Nt,{children:[F.uses_count,F.max_uses&&` / ${F.max_uses}`]}),r.jsx(Nt,{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(Nt,{className:"text-muted-foreground",children:xn(new Date(F.created_at),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx(Ps,{checked:F.is_active,onCheckedChange:()=>A(F.id,F.is_active)})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>P(F.code),title:"Copy invite link",children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>E(F.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},F.id))})]})})]})]})})};function Ed(t){this.content=t}Ed.prototype={constructor:Ed,find:function(t){for(var e=0;e>1}};Ed.from=function(t){if(t instanceof Ed)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ed(e)};function mRe(t,e,n){for(let s=0;;s++){if(s==t.childCount||s==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(s),o=e.child(s);if(a==o){n+=a.nodeSize;continue}if(!a.sameMarkup(o))return n;if(a.isText&&a.text!=o.text){for(let l=0;a.text[l]==o.text[l];l++)n++;return n}if(a.content.size||o.content.size){let l=mRe(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function gRe(t,e,n,s){for(let a=t.childCount,o=e.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:s};let l=t.child(--a),i=e.child(--o),h=l.nodeSize;if(l==i){n-=h,s-=h;continue}if(!l.sameMarkup(i))return{a:n,b:s};if(l.isText&&l.text!=i.text){let p=0,x=Math.min(l.text.length,i.text.length);for(;pe&&s(h,a+i,o||null,l)!==!1&&h.content.size){let x=i+1;h.nodesBetween(Math.max(0,e-x),Math.min(h.content.size,n-x),s,a+x)}i=p}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,s,a){let o="",l=!0;return this.nodesBetween(e,n,(i,h)=>{let p=i.isText?i.text.slice(Math.max(e,h)-h,n-h):i.isLeaf?a?typeof a=="function"?a(i):a:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&p||i.isTextblock)&&s&&(l?l=!1:o+=s),o+=p},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,s=e.firstChild,a=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(a[a.length-1]=n.withText(n.text+s.text),o=1);oe)for(let o=0,l=0;le&&((ln)&&(i.isText?i=i.cut(Math.max(0,e-l),Math.min(i.text.length,n-l)):i=i.cut(Math.max(0,e-l-1),Math.min(i.content.size,n-l-1))),s.push(i),a+=i.nodeSize),l=h}return new _n(s,a)}cutByIndex(e,n){return e==n?_n.empty:e==0&&n==this.content.length?this:new _n(this.content.slice(e,n))}replaceChild(e,n){let s=this.content[e];if(s==n)return this;let a=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return a[e]=n,new _n(a,o)}addToStart(e){return new _n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new _n(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 a=this.child(n),o=s+a.nodeSize;if(o>=e)return o==e?SL(n+1,o):SL(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 _n.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new _n(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return _n.empty;let n,s=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),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-a.type.rank),n}};Fo.none=[];class kte extends Error{}class fs{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=yRe(this.content,e+this.openStart,n);return s&&new fs(s,this.openStart,this.openEnd)}removeBetween(e,n){return new fs(xRe(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 fs.empty;let s=n.openStart||0,a=n.openEnd||0;if(typeof s!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fs(_n.fromJSON(e,n.content),s,a)}static maxOpen(e,n=!0){let s=0,a=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)a++;return new fs(e,s,a)}}fs.empty=new fs(_n.empty,0,0);function xRe(t,e,n){let{index:s,offset:a}=t.findIndex(e),o=t.maybeChild(s),{index:l,offset:i}=t.findIndex(n);if(a==e||o.isText){if(i!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(s,o.copy(xRe(o.content,e-a-1,n-a-1)))}function yRe(t,e,n,s){let{index:a,offset:o}=t.findIndex(e),l=t.maybeChild(a);if(o==e||l.isText)return s&&!s.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let i=yRe(l.content,e-o-1,n,l);return i&&t.replaceChild(a,l.copy(i))}function gyt(t,e,n){if(n.openStart>t.depth)throw new kte("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new kte("Inconsistent open depths");return vRe(t,e,n,0)}function vRe(t,e,n,s){let a=t.index(s),o=t.node(s);if(a==e.index(s)&&s=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function uA(t,e,n,s){let a=(e||t).node(n),o=0,l=e?e.index(n):a.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Nj(t.nodeAfter,s),o++));for(let i=o;ia&&Mhe(t,e,a+1),l=s.depth>a&&Mhe(n,s,a+1),i=[];return uA(null,t,a,i),o&&l&&e.index(a)==n.index(a)?(_Re(o,l),Nj(Sj(o,bRe(t,e,n,s,a+1)),i)):(o&&Nj(Sj(o,Nte(t,e,a+1)),i),uA(e,n,a,i),l&&Nj(Sj(l,Nte(n,s,a+1)),i)),uA(s,null,a,i),new _n(i)}function Nte(t,e,n){let s=[];if(uA(null,t,n,s),t.depth>n){let a=Mhe(t,e,n+1);Nj(Sj(a,Nte(t,e,n+1)),s)}return uA(e,null,n,s),new _n(s)}function xyt(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)a=e.node(o).copy(_n.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class oE{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],a=e.child(n);return s?e.child(n).cut(s):a}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],a=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 Ste(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=[],a=0,o=n;for(let l=e;;){let{index:i,offset:h}=l.content.findIndex(o),p=o-h;if(s.push(l,i,a+h),!p||(l=l.child(i),l.isText))break;o=p-1,a+=h+1}return new oE(n,s,o)}static resolveCached(e,n){let s=Ike.get(e);if(s)for(let o=0;oe&&this.nodesBetween(e,n,o=>(s.isInSet(o.marks)&&(a=!0),!a)),a}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()+")"),wRe(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=_n.empty,a=0,o=s.childCount){let l=this.contentMatchAt(e).matchFragment(s,a,o),i=l&&l.matchFragment(this.content,n);if(!i||!i.validEnd)return!1;for(let h=a;hn.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 a=_n.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};E1.prototype.text=void 0;class Cte extends E1{constructor(e,n,s,a){if(super(e,n,null,a),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wRe(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 Cte(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cte(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 wRe(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wj{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let s=new byt(e,n);if(s.next==null)return Wj.empty;let a=jRe(s);s.next&&s.err("Unexpected trailing text");let o=Myt(Cyt(a));return Tyt(o,s),o}matchType(e){for(let n=0;np.createAndFill()));for(let p=0;p=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 a=0;a{let o=a+(s.validEnd?"*":" ")+" ";for(let l=0;l"+e.indexOf(s.next[l].next);return o}).join(` `)}}Wj.empty=new Wj(!0);class byt{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 jRe(t){let e=[];do e.push(wyt(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function wyt(t){let e=[];do e.push(jyt(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jyt(t){let e=Syt(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=kyt(t,e);else break;return e}function Pke(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function kyt(t,e){let n=Pke(t),s=n;return t.eat(",")&&(t.next!="}"?s=Pke(t):s=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:e}}function Nyt(t,e){let n=t.nodeTypes,s=n[e];if(s)return[s];let a=[];for(let o in n){let l=n[o];l.isInGroup(e)&&a.push(l)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function Syt(t){if(t.eat("(")){let e=jRe(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=Nyt(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 Cyt(t){let e=[[]];return a(o(t,0),n()),e;function n(){return e.push([])-1}function s(l,i,h){let p={term:h,to:i};return e[l].push(p),p}function a(l,i){l.forEach(h=>h.to=i)}function o(l,i){if(l.type=="choice")return l.exprs.reduce((h,p)=>h.concat(o(p,i)),[]);if(l.type=="seq")for(let h=0;;h++){let p=o(l.exprs[h],i);if(h==l.exprs.length-1)return p;a(p,i=n())}else if(l.type=="star"){let h=n();return s(i,h),a(o(l.expr,h),h),[s(h)]}else if(l.type=="plus"){let h=n();return a(o(l.expr,i),h),a(o(l.expr,h),h),[s(h)]}else{if(l.type=="opt")return[s(i)].concat(o(l.expr,i));if(l.type=="range"){let h=i;for(let p=0;p{t[l].forEach(({term:i,to:h})=>{if(!i)return;let p;for(let x=0;x{p||a.push([i,p=[]]),p.indexOf(x)==-1&&p.push(x)})})});let o=e[s.join(",")]=new Wj(s.indexOf(t.length-1)>-1);for(let l=0;l-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 E1(this,this.computeAttrs(e),_n.from(n),Fo.setFrom(s))}createChecked(e=null,n,s){return n=_n.from(n),this.checkContent(n),new E1(this,this.computeAttrs(e),n,Fo.setFrom(s))}createAndFill(e=null,n,s){if(e=this.computeAttrs(e),n=_n.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let a=this.contentMatch.matchFragment(n),o=a&&a.fillBefore(_n.empty,!0);return o?new E1(this,e,n.append(o),Fo.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 TRe(o,n,l));let a=n.spec.topNode||"doc";if(!s[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");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 Ayt(t,e,n){let s=n.split("|");return a=>{let o=a===null?"null":typeof a;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${t}, got ${o}`)}}class Eyt{constructor(e,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Ayt(e,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class Tse{constructor(e,n,s,a){this.name=e,this.rank=n,this.schema=s,this.spec=a,this.attrs=MRe(e,a.attrs),this.excluded=null;let o=NRe(this.attrs);this.instance=o?new Fo(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Fo(this,SRe(this.attrs,e))}static compile(e,n){let s=Object.create(null),a=0;return e.forEach((o,l)=>s[o]=new Tse(o,a++,n,l)),s}removeFromSet(e){for(var n=0;n-1}}class ARe{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Ed.from(e.nodes),n.marks=Ed.from(e.marks||{}),this.nodes=Oke.compile(this.spec.nodes,this),this.marks=Tse.compile(this.spec.marks,this);let s=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let o=this.nodes[a],l=o.spec.content||"",i=o.spec.marks;if(o.contentMatch=s[l]||(s[l]=Wj.parse(l,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=i=="_"?null:i?Dke(this,i.split(" ")):i==""||!o.inlineContent?[]:null}for(let a in this.marks){let o=this.marks[a],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:Dke(this,l.split(" "))}this.nodeFromJSON=a=>E1.fromJSON(this,a),this.markFromJSON=a=>Fo.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,s,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Oke){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,a)}text(e,n){let s=this.nodes.text;return new Cte(s,s.defaultAttrs,e,Fo.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 Dke(t,e){let n=[];for(let s=0;s-1)&&n.push(l=h)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return n}function Iyt(t){return t.tag!=null}function Pyt(t){return t.style!=null}let hA=class Ahe{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(Iyt(a))this.tags.push(a);else if(Pyt(a)){let o=/[^=]*/.exec(a.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let o=e.nodes[a.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let s=new Fke(this,n,!1);return s.addAll(e,Fo.none,n.from,n.to),s.finish()}parseSlice(e,n={}){let s=new Fke(this,n,!0);return s.addAll(e,Fo.none,n.from,n.to),fs.maxOpen(s.finish())}matchTag(e,n,s){for(let a=s?this.tags.indexOf(s)+1:0;ae.length&&(i.charCodeAt(e.length)!=61||i.slice(e.length+1)!=n))){if(l.getAttrs){let h=l.getAttrs(n);if(h===!1)continue;l.attrs=h||void 0}return l}}}static schemaRules(e){let n=[];function s(a){let o=a.priority==null?50:a.priority,l=0;for(;l{s(l=zke(l)),l.mark||l.ignore||l.clearMark||(l.mark=a)})}for(let a in e.nodes){let o=e.nodes[a].spec.parseDOM;o&&o.forEach(l=>{s(l=zke(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ahe(e,Ahe.schemaRules(e)))}};const ERe={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},Lyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},IRe={ol:!0,ul:!0},lE=1,Ehe=2,fA=4;function Rke(t,e,n){return e!=null?(e?lE:0)|(e==="full"?Ehe:0):t&&t.whitespace=="pre"?lE|Ehe:n&~fA}class CL{constructor(e,n,s,a,o,l){this.type=e,this.attrs=n,this.marks=s,this.solid=a,this.options=l,this.content=[],this.activeMarks=Fo.none,this.match=o||(l&fA?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(_n.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,a;return(a=s.findWrapping(e.type))?(this.match=s,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&lE)){let s=this.content[this.content.length-1],a;if(s&&s.isText&&(a=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-a[0].length))}}let n=_n.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(_n.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&&!ERe.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Fke{constructor(e,n,s){this.parser=e,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let a=n.topNode,o,l=Rke(null,n.preserveWhitespace,0)|(s?fA:0);a?o=new CL(a.type,a.attrs,Fo.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new CL(null,null,Fo.none,!0,null,l):o=new CL(e.schema.topNodeType,null,Fo.none,!0,null,l),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,a=this.top,o=a.options&Ehe?"full":this.localPreserveWS||(a.options&lE)>0,{schema:l}=this.parser;if(o==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let i=s.split(/\r?\n|\r/);for(let h=0;h!h.clearMark(p)):n=n.concat(this.parser.schema.marks[h.mark].create(h.attrs)),h.consuming===!1)i=h;else break}}return n}addElementByRule(e,n,s,a){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),s,e.nodeName=="BR")||this.leafFallback(e,s);else{let h=this.enter(l,n.attrs||null,s,n.preserveWhitespace);h&&(o=!0,s=h)}else{let h=this.parser.schema.marks[n.mark];s=s.concat(h.create(n.attrs))}let i=this.top;if(l&&l.isLeaf)this.findInside(e);else if(a)this.addElement(e,s,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(h=>this.insertNode(h,s,!1));else{let h=e;typeof n.contentElement=="string"?h=e.querySelector(n.contentElement):typeof n.contentElement=="function"?h=n.contentElement(e):n.contentElement&&(h=n.contentElement),this.findAround(e,h,!0),this.addAll(h,s),this.findAround(e,h,!1)}o&&this.sync(i)&&this.open--}addAll(e,n,s,a){let o=s||0;for(let l=s?e.childNodes[s]:e.firstChild,i=a==null?null:e.childNodes[a];l!=i;l=l.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(l,n);this.findAtPoint(e,o)}findPlace(e,n,s){let a,o;for(let l=this.open,i=0;l>=0;l--){let h=this.nodes[l],p=h.findWrapping(e);if(p&&(!a||a.length>p.length+i)&&(a=p,o=h,!p.length))break;if(h.solid){if(s)break;i+=2}}if(!a)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(p.type):Bke(p.type,e))?(h=p.addToSet(h),!1):!0),this.nodes.push(new CL(e,n,h,a,null,i)),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|=lE)}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 a=s.length-1;a>=0;a--)e+=s[a].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,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(a?0:1),l=(i,h)=>{for(;i>=0;i--){let p=n[i];if(p==""){if(i==n.length-1||i==0)continue;for(;h>=o;h--)if(l(i-1,h))return!0;return!1}else{let x=h>0||h==0&&a?this.nodes[h].type:s&&h>=o?s.node(h-o).type:null;if(!x||x.name!=p&&!x.isInGroup(p))return!1;h--}}return!0};return l(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 Oyt(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&IRe.hasOwnProperty(s)&&n?(n.appendChild(e),e=n):s=="li"?n=e:s&&(n=null)}}function Dyt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function zke(t){let e={};for(let n in t)e[n]=t[n];return e}function Bke(t,e){let n=e.schema.nodes;for(let s in n){let a=n[s];if(!a.allowsMarkType(t))continue;let o=[],l=i=>{o.push(i);for(let h=0;h{if(o.length||l.marks.length){let i=0,h=0;for(;i=0;a--){let o=this.serializeMark(e.marks[a],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(e,n,s={}){let a=this.marks[e.type.name];return a&&oee(sce(s),a(e,n),null,e.attrs)}static renderSpec(e,n,s=null,a){return oee(e,n,s,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new dk(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=$ke(e.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(e){return $ke(e.marks)}}function $ke(t){let e={};for(let n in t){let s=t[n].spec.toDOM;s&&(e[n]=s)}return e}function sce(t){return t.document||window.document}const Uke=new WeakMap;function Ryt(t){let e=Uke.get(t);return e===void 0&&Uke.set(t,e=Fyt(t)),e}function Fyt(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 a=0;a-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 l=a.indexOf(" ");l>0&&(n=a.slice(0,l),a=a.slice(l+1));let i,h=n?t.createElementNS(n,a):t.createElement(a),p=e[1],x=1;if(p&&typeof p=="object"&&p.nodeType==null&&!Array.isArray(p)){x=2;for(let y in p)if(p[y]!=null){let _=y.indexOf(" ");_>0?h.setAttributeNS(y.slice(0,_),y.slice(_+1),p[y]):y=="style"&&h.style?h.style.cssText=p[y]:h.setAttribute(y,p[y])}}for(let y=x;yx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}else{let{dom:j,contentDOM:C}=oee(t,_,n,s);if(h.appendChild(j),C){if(i)throw new RangeError("Multiple content holes");i=C}}}return{dom:h,contentDOM:i}}const PRe=65535,LRe=Math.pow(2,16);function zyt(t,e){return t+e*LRe}function qke(t){return t&PRe}function Byt(t){return(t-(t&PRe))/LRe}const ORe=1,DRe=2,lee=4,RRe=8;class Ihe{constructor(e,n,s){this.pos=e,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&RRe)>0}get deletedBefore(){return(this.delInfo&(ORe|lee))>0}get deletedAfter(){return(this.delInfo&(DRe|lee))>0}get deletedAcross(){return(this.delInfo&lee)>0}}class Zh{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Zh.empty)return Zh.empty}recover(e){let n=0,s=qke(e);if(!this.inverted)for(let a=0;ae)break;let p=this.ranges[i+o],x=this.ranges[i+l],y=h+p;if(e<=y){let _=p?e==h?-1:e==y?1:n:n,j=h+a+(_<0?0:x);if(s)return j;let C=e==(n<0?h:y)?null:zyt(i/3,e-h),N=e==h?DRe:e==y?ORe:lee;return(n<0?e!=h:e!=y)&&(N|=RRe),new Ihe(j,N,C)}a+=x-p}return s?e+a:new Ihe(e+a,0,null)}touches(e,n){let s=0,a=qke(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let i=0;ie)break;let p=this.ranges[i+o],x=h+p;if(e<=x&&i==a*3)return!0;s+=this.ranges[i+l]-p}return!1}forEach(e){let n=this.inverted?2:1,s=this.inverted?1:2;for(let a=0,o=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?s-a-1:void 0)}}invert(){let e=new cE;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let s=this.from;so&&h!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),n.openStart,n.openEnd);return Tc.fromReplace(e,this.from,this.to,o)}invert(){return new hg(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 J0(n.pos,s.pos,this.mark)}merge(e){return e instanceof J0&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new J0(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 J0(n.from,n.to,e.markFromJSON(n.mark))}}gu.jsonID("addMark",J0);class hg extends gu{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 fs(Dxe(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Tc.fromReplace(e,this.from,this.to,s)}invert(){return new J0(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 hg(n.pos,s.pos,this.mark)}merge(e){return e instanceof hg&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hg(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 hg(n.from,n.to,e.markFromJSON(n.mark))}}gu.jsonID("removeMark",hg);class e1 extends gu{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Tc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Tc.fromReplace(e,this.pos,this.pos+1,new fs(_n.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 a=0;as.pos?null:new xd(n.pos,s.pos,a,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 xd(n.from,n.to,n.gapFrom,n.gapTo,fs.fromJSON(e,n.slice),n.insert,!!n.structure)}}gu.jsonID("replaceAround",xd);function Phe(t,e,n){let s=t.resolve(e),a=n-e,o=s.depth;for(;a>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,a--;if(a>0){let l=s.node(o).maybeChild(s.indexAfter(o));for(;a>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,a--}}return!1}function $yt(t,e,n,s){let a=[],o=[],l,i;t.doc.nodesBetween(e,n,(h,p,x)=>{if(!h.isInline)return;let y=h.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let _=Math.max(p,e),j=Math.min(p+h.nodeSize,n),C=s.addToSet(y);for(let N=0;Nt.step(h)),o.forEach(h=>t.step(h))}function Uyt(t,e,n,s){let a=[],o=0;t.doc.nodesBetween(e,n,(l,i)=>{if(!l.isInline)return;o++;let h=null;if(s instanceof Tse){let p=l.marks,x;for(;x=s.isInSet(p);)(h||(h=[])).push(x),p=x.removeFromSet(p)}else s?s.isInSet(l.marks)&&(h=[s]):h=l.marks;if(h&&h.length){let p=Math.min(i+l.nodeSize,n);for(let x=0;xt.step(new hg(l.from,l.to,l.style)))}function Rxe(t,e,n,s=n.contentMatch,a=!0){let o=t.doc.nodeAt(e),l=[],i=e+1;for(let h=0;h=0;h--)t.step(l[h])}function qyt(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function p3(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let s=t.depth,a=0,o=0;;--s){let l=t.$from.node(s),i=t.$from.index(s)+a,h=t.$to.indexAfter(s)-o;if(sn;C--)N||s.index(C)>0?(N=!0,x=_n.from(s.node(C).copy(x)),y++):h--;let _=_n.empty,j=0;for(let C=o,N=!1;C>n;C--)N||a.after(C+1)=0;l--){if(s.size){let i=n[l].type.contentMatch.matchFragment(s);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=_n.from(n[l].type.create(n[l].attrs,s))}let a=e.start,o=e.end;t.step(new xd(a,o,a,o,new fs(s,0,0),n.length,!0))}function Kyt(t,e,n,s,a){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(l,i)=>{let h=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(s,h)&&Zyt(t.doc,t.mapping.slice(o).map(i),s)){let p=null;if(s.schema.linebreakReplacement){let j=s.whitespace=="pre",C=!!s.contentMatch.matchType(s.schema.linebreakReplacement);j&&!C?p=!1:!j&&C&&(p=!0)}p===!1&&zRe(t,l,i,o),Rxe(t,t.mapping.slice(o).map(i,1),s,void 0,p===null);let x=t.mapping.slice(o),y=x.map(i,1),_=x.map(i+l.nodeSize,1);return t.step(new xd(y,_,y+1,_-1,new fs(_n.from(s.create(h,null,l.marks)),0,0),1,!0)),p===!0&&FRe(t,l,i,o),!1}})}function FRe(t,e,n,s){e.forEach((a,o)=>{if(a.isText){let l,i=/\r?\n|\r/g;for(;l=i.exec(a.text);){let h=t.mapping.slice(s).map(n+1+o+l.index);t.replaceWith(h,h+1,e.type.schema.linebreakReplacement.create())}}})}function zRe(t,e,n,s){e.forEach((a,o)=>{if(a.type==a.type.schema.linebreakReplacement){let l=t.mapping.slice(s).map(n+1+o);t.replaceWith(l,l+1,e.type.schema.text(` `))}})}function Zyt(t,e,n){let s=t.resolve(e),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function Yyt(t,e,n,s,a){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let l=n.create(s,null,a||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new xd(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new fs(_n.from(l),0,0),1,!0))}function Xx(t,e,n=1,s){let a=t.resolve(e),o=a.depth-n,l=s&&s[s.length-1]||a.parent;if(o<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!l.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let p=a.depth-1,x=n-2;p>o;p--,x--){let y=a.node(p),_=a.index(p);if(y.type.spec.isolating)return!1;let j=y.content.cutByIndex(_,y.childCount),C=s&&s[x+1];C&&(j=j.replaceChild(0,C.type.create(C.attrs)));let N=s&&s[x]||y;if(!y.canReplace(_+1,y.childCount)||!N.type.validContent(j))return!1}let i=a.indexAfter(o),h=s&&s[0];return a.node(o).canReplaceWith(i,i,h?h.type:a.node(o+1).type)}function Xyt(t,e,n=1,s){let a=t.doc.resolve(e),o=_n.empty,l=_n.empty;for(let i=a.depth,h=a.depth-n,p=n-1;i>h;i--,p--){o=_n.from(a.node(i).copy(o));let x=s&&s[p];l=_n.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}t.step(new cd(e,e,new fs(o.append(l),n,n),!0))}function dv(t,e){let n=t.resolve(e),s=n.index();return BRe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function Qyt(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:s}=t.type.schema;for(let a=0;a0?(o=s.node(a+1),i++,l=s.node(a).maybeChild(i)):(o=s.node(a).maybeChild(i-1),l=s.node(a+1)),o&&!o.isTextblock&&BRe(o,l)&&s.node(a).canReplace(i,i+1))return e;if(a==0)break;e=n<0?s.before(a):s.after(a)}}function Jyt(t,e,n){let s=null,{linebreakReplacement:a}=t.doc.type.schema,o=t.doc.resolve(e-n),l=o.node().type;if(a&&l.inlineContent){let x=l.whitespace=="pre",y=!!l.contentMatch.matchType(a);x&&!y?s=!1:!x&&y&&(s=!0)}let i=t.steps.length;if(s===!1){let x=t.doc.resolve(e+n);zRe(t,x.node(),x.before(),i)}l.inlineContent&&Rxe(t,e+n-1,l,o.node().contentMatchAt(o.index()),s==null);let h=t.mapping.slice(i),p=h.map(e-n);if(t.step(new cd(p,h.map(e+n,-1),fs.empty,!0)),s===!0){let x=t.doc.resolve(p);FRe(t,x.node(),x.before(),t.steps.length)}return t}function e0t(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 a=s.depth-1;a>=0;a--){let o=s.index(a);if(s.node(a).canReplaceWith(o,o,n))return s.before(a+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let a=s.depth-1;a>=0;a--){let o=s.indexAfter(a);if(s.node(a).canReplaceWith(o,o,n))return s.after(a+1);if(o=0;l--){let i=l==s.depth?0:s.pos<=(s.start(l+1)+s.end(l+1))/2?-1:1,h=s.index(l)+(i>0?1:0),p=s.node(l),x=!1;if(o==1)x=p.canReplace(h,h,a);else{let y=p.contentMatchAt(h).findWrapping(a.firstChild.type);x=y&&p.canReplaceWith(h,h,y[0])}if(x)return i==0?s.pos:i<0?s.before(l+1):s.after(l+1)}return null}function Ese(t,e,n=e,s=fs.empty){if(e==n&&!s.size)return null;let a=t.resolve(e),o=t.resolve(n);return URe(a,o,s)?new cd(e,n,s):new t0t(a,o,s).fit()}function URe(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class t0t{constructor(e,n,s){this.$from=e,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=_n.empty;for(let a=0;a<=e.depth;a++){let o=e.node(a);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=_n.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let p=this.findFittable();p?this.placeNodes(p):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,a=this.close(e<0?this.$to:s.doc.resolve(e));if(!a)return null;let o=this.placed,l=s.depth,i=a.depth;for(;l&&i&&o.childCount==1;)o=o.firstChild.content,l--,i--;let h=new fs(o,l,i);return e>-1?new xd(s.pos,e,this.$to.pos,this.$to.end(),h,n):h.size||s.pos!=this.$to.pos?new cd(s.pos,a.pos,h):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,a=this.unplaced.openEnd;s1&&(a=0),o.type.spec.isolating&&a<=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 a,o=null;s?(o=ice(this.unplaced.content,s-1).firstChild,a=o.content):a=this.unplaced.content;let l=a.firstChild;for(let i=this.depth;i>=0;i--){let{type:h,match:p}=this.frontier[i],x,y=null;if(n==1&&(l?p.matchType(l.type)||(y=p.fillBefore(_n.from(l),!1)):o&&h.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:i,parent:o,inject:y};if(n==2&&l&&(x=p.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:i,parent:o,wrap:x};if(o&&p.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:s}=this.unplaced,a=ice(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new fs(e,n+1,Math.max(s,a.size+n>=e.size-s?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:s}=this.unplaced,a=ice(e,n);if(a.childCount<=1&&n>0){let o=e.size-n<=n+a.size;this.unplaced=new fs(dT(e,n-1,1),n-1,o?n-1:s)}else this.unplaced=new fs(dT(e,n,1),n,s)}placeNodes({sliceDepth:e,frontierDepth:n,parent:s,inject:a,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let N=0;N1||h==0||N.content.size)&&(y=A,x.push(qRe(N.mark(_.allowedMarks(N.marks)),p==1?h:0,p==i.childCount?j:-1)))}let C=p==i.childCount;C||(j=-1),this.placed=uT(this.placed,n,_n.from(x)),this.frontier[n].match=y,C&&j<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,A=i;N1&&a==this.$to.end(--s);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:s,type:a}=this.frontier[n],o=n=0;i--){let{match:h,type:p}=this.frontier[i],x=oce(e,i,p,h,!0);if(!x||x.childCount)continue e}return{depth:n,fit:l,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=uT(this.placed,n.depth,n.fit)),e=n.move;for(let s=n.depth+1;s<=e.depth;s++){let a=e.node(s),o=a.type.contentMatch.fillBefore(a.content,!0,e.index(s));this.openFrontierNode(a.type,a.attrs,o)}return e}openFrontierNode(e,n=null,s){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=uT(this.placed,this.depth,_n.from(e.create(n,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(_n.empty,!0);n.childCount&&(this.placed=uT(this.placed,this.frontier.length,n))}}function dT(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(dT(t.firstChild.content,e-1,n)))}function uT(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(uT(t.lastChild.content,e-1,n)))}function ice(t,e){for(let n=0;n1&&(s=s.replaceChild(0,qRe(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(_n.empty,!0)))),t.copy(s)}function oce(t,e,n,s,a){let o=t.node(e),l=a?t.indexAfter(e):t.index(e);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let i=s.fillBefore(o.content,!0,l);return i&&!r0t(n,o.content,l)?i:null}function r0t(t,e,n){for(let s=n;s0;_--,j--){let C=a.node(_).type.spec;if(C.defining||C.definingAsContext||C.isolating)break;l.indexOf(_)>-1?i=_:a.before(_)==j&&l.splice(1,0,-_)}let h=l.indexOf(i),p=[],x=s.openStart;for(let _=s.content,j=0;;j++){let C=_.firstChild;if(p.push(C),j==s.openStart)break;_=C.content}for(let _=x-1;_>=0;_--){let j=p[_],C=n0t(j.type);if(C&&!j.sameMarkup(a.node(Math.abs(i)-1)))x=_;else if(C||!j.type.isTextblock)break}for(let _=s.openStart;_>=0;_--){let j=(_+x+1)%(s.openStart+1),C=p[j];if(C)for(let N=0;N=0&&(t.replace(e,n,s),!(t.steps.length>y));_--){let j=l[_];j<0||(e=a.before(j),n=o.after(j))}}function VRe(t,e,n,s,a){if(es){let o=a.contentMatchAt(0),l=o.fillBefore(t).append(t);t=l.append(o.matchFragment(l).fillBefore(_n.empty,!0))}return t}function a0t(t,e,n,s){if(!s.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=e0t(t.doc,e,s.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new fs(_n.from(s),0,0))}function i0t(t,e,n){let s=t.doc.resolve(e),a=t.doc.resolve(n),o=HRe(s,a);for(let l=0;l0&&(h||s.node(i-1).canReplace(s.index(i-1),a.indexAfter(i-1))))return t.delete(s.before(i),a.after(i))}for(let l=1;l<=s.depth&&l<=a.depth;l++)if(e-s.start(l)==s.depth-l&&n>s.end(l)&&a.end(l)-n!=a.depth-l&&s.start(l-1)==a.start(l-1)&&s.node(l-1).canReplace(s.index(l-1),a.index(l-1)))return t.delete(s.before(l),n);t.delete(e,n)}function HRe(t,e){let n=[],s=Math.min(t.depth,e.depth);for(let a=s;a>=0;a--){let o=t.start(a);if(oe.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(o==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==o-1)&&n.push(a)}return n}class IS extends gu{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 Tc.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 a=n.type.create(s,null,n.marks);return Tc.fromReplace(e,this.pos,this.pos+1,new fs(_n.from(a),0,n.isLeaf?0:1))}getMap(){return Zh.empty}invert(e){return new IS(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 IS(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 IS(n.pos,n.attr,n.value)}}gu.jsonID("attr",IS);class dE extends gu{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let s=e.type.create(n,e.content,e.marks);return Tc.ok(s)}getMap(){return Zh.empty}invert(e){return new dE(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 dE(n.attr,n.value)}}gu.jsonID("docAttr",dE);let xC=class extends Error{};xC=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};xC.prototype=Object.create(Error.prototype);xC.prototype.constructor=xC;xC.prototype.name="TransformError";class WRe{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new cE}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new xC(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=fs.empty){let a=Ese(this.doc,e,n,s);return a&&this.step(a),this}replaceWith(e,n,s){return this.replace(e,n,new fs(_n.from(s),0,0))}delete(e,n){return this.replace(e,n,fs.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,s){return s0t(this,e,n,s),this}replaceRangeWith(e,n,s){return a0t(this,e,n,s),this}deleteRange(e,n){return i0t(this,e,n),this}lift(e,n){return Vyt(this,e,n),this}join(e,n=1){return Jyt(this,e,n),this}wrap(e,n){return Gyt(this,e,n),this}setBlockType(e,n=e,s,a=null){return Kyt(this,e,n,s,a),this}setNodeMarkup(e,n,s=null,a){return Yyt(this,e,n,s,a),this}setNodeAttribute(e,n,s){return this.step(new IS(e,n,s)),this}setDocAttribute(e,n){return this.step(new dE(e,n)),this}addNodeMark(e,n){return this.step(new e1(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 Fo)n.isInSet(s.marks)&&this.step(new Gj(e,n));else{let a=s.marks,o,l=[];for(;o=n.isInSet(a);)l.push(new Gj(e,o)),a=o.removeFromSet(a);for(let i=l.length-1;i>=0;i--)this.step(l[i])}return this}split(e,n=1,s){return Xyt(this,e,n,s),this}addMark(e,n,s){return $yt(this,e,n,s),this}removeMark(e,n,s){return Uyt(this,e,n,s),this}clearIncompatible(e,n,s){return Rxe(this,e,n,s),this}}const lce=Object.create(null);class ui{constructor(e,n,s){this.$anchor=e,this.$head=n,this.ranges=s||[new o0t(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 l=n<0?w4(e.node(0),e.node(o),e.before(o+1),e.index(o),n,s):w4(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,s);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new of(e.node(0))}static atStart(e){return w4(e,e,0,0,1)||new of(e)}static atEnd(e){return w4(e,e,e.content.size,e.childCount,-1)||new of(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=lce[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 lce)throw new RangeError("Duplicate use of selection JSON ID "+e);return lce[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Va.between(this.$anchor,this.$head).getBookmark()}}ui.prototype.visible=!0;class o0t{constructor(e,n){this.$from=e,this.$to=n}}let Hke=!1;function Wke(t){!Hke&&!t.parent.inlineContent&&(Hke=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Va extends ui{constructor(e,n=e){Wke(e),Wke(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 ui.near(s);let a=e.resolve(n.map(this.anchor));return new Va(a.parent.inlineContent?a:s,s)}replace(e,n=fs.empty){if(super.replace(e,n),n==fs.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof Va&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ise(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 Va(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,s=n){let a=e.resolve(n);return new this(a,s==n?a:e.resolve(s))}static between(e,n,s){let a=e.pos-n.pos;if((!s||a)&&(s=a>=0?1:-1),!n.parent.inlineContent){let o=ui.findFrom(n,s,!0)||ui.findFrom(n,-s,!0);if(o)n=o.$head;else return ui.near(n,s)}return e.parent.inlineContent||(a==0?e=n:(e=(ui.findFrom(e,-s,!0)||ui.findFrom(e,s,!0)).$anchor,e.pos0?0:1);a>0?l=0;l+=a){let i=e.child(l);if(i.isAtom){if(!o&&aa.isSelectable(i))return aa.create(t,n-(a<0?i.nodeSize:0))}else{let h=w4(t,i,n+a,a<0?i.childCount:0,a,o);if(h)return h}n+=i.nodeSize*a}return null}function Gke(t,e,n){let s=t.steps.length-1;if(s{l==null&&(l=x)}),t.setSelection(ui.near(t.doc.resolve(l),n))}const Kke=1,ML=2,Zke=4;class c0t extends WRe{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|=ML,this}ensureMarks(e){return Fo.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&ML)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ML,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)||Fo.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,s){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(s==null&&(s=n),!e)return this.deleteRange(n,s);let o=this.storedMarks;if(!o){let l=this.doc.resolve(n);o=s==n?l.marks():l.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,a.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ui.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|=Zke,this}get scrolledIntoView(){return(this.updated&Zke)>0}}function Yke(t,e){return!e||!t?t:t.bind(e)}class hT{constructor(e,n,s){this.name=e,this.init=Yke(n.init,s),this.apply=Yke(n.apply,s)}}const d0t=[new hT("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new hT("selection",{init(t,e){return t.selection||ui.atStart(e.doc)},apply(t){return t.selection}}),new hT("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,s){return s.selection.$cursor?t.storedMarks:null}}),new hT("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class cce{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=d0t.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 hT(s.key,s.spec.state,s))})}}class R4{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 a=e[s],o=a.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(a,this[a.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 a=new cce(e.schema,e.plugins),o=new R4(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=E1.fromJSON(e.schema,n.doc);else if(l.name=="selection")o.selection=ui.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let i in s){let h=s[i],p=h.spec.state;if(h.key==l.name&&p&&p.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){o[l.name]=p.fromJSON.call(h,e,n[i],o);return}}o[l.name]=l.init(e,o)}}),o}}function GRe(t,e,n){for(let s in t){let a=t[s];a instanceof Function?a=a.bind(e):s=="handleDOMEvents"&&(a=GRe(a,e,{})),n[s]=a}return n}class Vd{constructor(e){this.spec=e,this.props={},e.props&&GRe(e.props,this,this.props),this.key=e.key?e.key.key:KRe("plugin")}getState(e){return e[this.key]}}const dce=Object.create(null);function KRe(t){return t in dce?t+"$"+ ++dce[t]:(dce[t]=0,t+"$")}class mf{constructor(e="key"){this.key=KRe(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ld=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},yC=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Lhe=null;const kx=function(t,e,n){let s=Lhe||(Lhe=document.createRange());return s.setEnd(t,n??t.nodeValue.length),s.setStart(t,e||0),s},u0t=function(){Lhe=null},Kj=function(t,e,n,s){return n&&(Xke(t,e,n,s,-1)||Xke(t,e,n,s,1))},h0t=/^(img|br|input|textarea|hr)$/i;function Xke(t,e,n,s,a){for(var o;;){if(t==n&&e==s)return!0;if(e==(a<0?0:qf(t))){let l=t.parentNode;if(!l||l.nodeType!=1||LI(t)||h0t.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ld(t)+(a<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(a<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=a;else return!1;else t=l,e=a<0?qf(t):0}else return!1}}function qf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function f0t(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=qf(t)}else if(t.parentNode&&!LI(t))e=Ld(t),t=t.parentNode;else return null}}function p0t(t,e){for(;;){if(t.nodeType==3&&e2),Ff=vC||(Og?/Mac/.test(Og.platform):!1),XRe=Og?/Win/.test(Og.platform):!1,Dx=/Android \d/.test(uv),OI=!!Qke&&"webkitFontSmoothing"in Qke.documentElement.style,y0t=OI?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function v0t(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 gx(t,e){return typeof t=="number"?t:t[e]}function _0t(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 Jke(t,e,n){let s=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(l.nodeType!=1){l=yC(l);continue}let i=l,h=i==o.body,p=h?v0t(o):_0t(i),x=0,y=0;if(e.topp.bottom-gx(s,"bottom")&&(y=e.bottom-e.top>p.bottom-p.top?e.top+gx(a,"top")-p.top:e.bottom-p.bottom+gx(a,"bottom")),e.leftp.right-gx(s,"right")&&(x=e.right-p.right+gx(a,"right")),x||y)if(h)o.defaultView.scrollBy(x,y);else{let j=i.scrollLeft,C=i.scrollTop;y&&(i.scrollTop+=y),x&&(i.scrollLeft+=x);let N=i.scrollLeft-j,A=i.scrollTop-C;e={left:e.left-N,top:e.top-A,right:e.right-N,bottom:e.bottom-A}}let _=h?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(_))break;l=_=="absolute"?l.offsetParent:yC(l)}}function b0t(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),s,a;for(let o=(e.left+e.right)/2,l=n+1;l=n-20){s=i,a=h.top;break}}return{refDOM:s,refTop:a,stack:QRe(t.dom)}}function QRe(t){let e=[],n=t.ownerDocument;for(let s=t;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),t!=n);s=yC(s));return e}function w0t({refDOM:t,refTop:e,stack:n}){let s=t?t.getBoundingClientRect().top:0;JRe(n,s==0?0:s-e)}function JRe(t,e){for(let n=0;n=i){l=Math.max(C.bottom,l),i=Math.min(C.top,i);let N=C.left>e.left?C.left-e.left:C.right=(C.left+C.right)/2?1:0));continue}}else C.top>e.top&&!h&&C.left<=e.left&&C.right>=e.left&&(h=x,p={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=y+1)}}return!n&&h&&(n=h,a=p,s=0),n&&n.nodeType==3?k0t(n,a):!n||s&&n.nodeType==1?{node:t,offset:o}:eFe(n,a)}function k0t(t,e){let n=t.nodeValue.length,s=document.createRange(),a;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return s.detach(),a||{node:t,offset:0}}function Bxe(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function N0t(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(s,a,o)}function C0t(t,e,n,s){let a=-1;for(let o=e,l=!1;o!=t.dom;){let i=t.docView.nearestDesc(o,!0),h;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((h=i.dom.getBoundingClientRect()).width||h.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!l&&h.left>s.left||h.top>s.top?a=i.posBefore:(!l&&h.right-1?a:t.docView.posFromDOM(e,n,-1)}function tFe(t,e,n){let s=t.childNodes.length;if(s&&n.tope.top&&a++}let p;OI&&a&&s.nodeType==1&&(p=s.childNodes[a-1]).nodeType==1&&p.contentEditable=="false"&&p.getBoundingClientRect().top>=e.top&&a--,s==t.dom&&a==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?i=t.state.doc.content.size:(a==0||s.nodeType!=1||s.childNodes[a-1].nodeName!="BR")&&(i=C0t(t,s,a,e))}i==null&&(i=S0t(t,l,e));let h=t.docView.nearestDesc(l,!0);return{pos:i,inside:h?h.posAtStart-h.border:-1}}function eNe(t){return t.top=0&&a==s.nodeValue.length?(h--,x=1):n<0?h--:p++,$M(x0(kx(s,h,p),x),x<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==qf(s))){let h=s.childNodes[a-1];if(h.nodeType==1)return uce(h.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(n<0||a==qf(s))){let h=s.childNodes[a-1],p=h.nodeType==3?kx(h,qf(h)-(l?0:1)):h.nodeType==1&&(h.nodeName!="BR"||!h.nextSibling)?h:null;if(p)return $M(x0(p,1),!1)}if(o==null&&a=0)}function $M(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 uce(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 nFe(t,e,n){let s=t.state,a=t.root.activeElement;s!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{s!=e&&t.updateState(s),a!=t.dom&&a&&a.focus()}}function A0t(t,e,n){let s=e.selection,a=n=="up"?s.$from:s.$to;return nFe(t,e,()=>{let{node:o}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let i=t.docView.nearestDesc(o,!0);if(!i)break;if(i.node.isBlock){o=i.contentDOM||i.dom;break}o=i.dom.parentNode}let l=rFe(t,a.pos,1);for(let i=o.firstChild;i;i=i.nextSibling){let h;if(i.nodeType==1)h=i.getClientRects();else if(i.nodeType==3)h=kx(i,0,i.nodeValue.length).getClientRects();else continue;for(let p=0;px.top+1&&(n=="up"?l.top-x.top>(x.bottom-l.top)*2:x.bottom-l.bottom>(l.bottom-x.top)*2))return!1}}return!0})}const E0t=/[\u0590-\u08ac]/;function I0t(t,e,n){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let a=s.parentOffset,o=!a,l=a==s.parent.content.size,i=t.domSelection();return i?!E0t.test(s.parent.textContent)||!i.modify?n=="left"||n=="backward"?o:l:nFe(t,e,()=>{let{focusNode:h,focusOffset:p,anchorNode:x,anchorOffset:y}=t.domSelectionRange(),_=i.caretBidiLevel;i.modify("move",n,"character");let j=s.depth?t.docView.domAfterPos(s.before()):t.dom,{focusNode:C,focusOffset:N}=t.domSelectionRange(),A=C&&!j.contains(C.nodeType==1?C:C.parentNode)||h==C&&p==N;try{i.collapse(x,y),h&&(h!=x||p!=y)&&i.extend&&i.extend(h,p)}catch{}return _!=null&&(i.caretBidiLevel=_),A}):s.pos==s.start()||s.pos==s.end()}let tNe=null,rNe=null,nNe=!1;function P0t(t,e,n){return tNe==e&&rNe==n?nNe:(tNe=e,rNe=n,nNe=n=="up"||n=="down"?A0t(t,e,n):I0t(t,e,n))}const np=0,sNe=1,qw=2,Dg=3;class DI{constructor(e,n,s,a){this.parent=e,this.children=n,this.dom=s,this.contentDOM=a,this.dirty=np,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;nLd(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){a=!1;break}if(o.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){a=!0;break}if(o.nextSibling)break}}return a??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let s=!0,a=e;a;a=a.parentNode){let o=this.getDesc(a),l;if(o&&(!n||o.node))if(s&&(l=o.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==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 a=e;a;a=a.parentNode){let o=this.getDesc(a);if(o)return o.localPosFromDOM(e,n,s)}return-1}descAt(e){for(let n=0,s=0;ne||l instanceof aFe){a=e-o;break}o=i}if(a)return this.children[s].domFromPos(a-this.children[s].border,n);for(let o;s&&!(o=this.children[s-1]).size&&o instanceof sFe&&o.side>=0;s--);if(n<=0){let o,l=!0;for(;o=s?this.children[s-1]:null,!(!o||o.dom.parentNode==this.contentDOM);s--,l=!1);return o&&n&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Ld(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=p-h.border&&h.node&&h.contentDOM&&this.contentDOM.contains(h.contentDOM))return h.parseRange(e,n,x);e=l;for(let y=i;y>0;y--){let _=this.children[y-1];if(_.size&&_.dom.parentNode==this.contentDOM&&!_.emptyChildAt(1)){a=Ld(_.dom)+1;break}e-=_.size}a==-1&&(a=0)}if(a>-1&&(p>n||i==this.children.length-1)){n=p;for(let x=i+1;xC&&ln){let C=i;i=h,h=C}let j=document.createRange();j.setEnd(h.node,h.offset),j.setStart(i.node,i.offset),p.removeAllRanges(),p.addRange(j)}}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,a=0;a=s:es){let i=s+o.border,h=l-o.border;if(e>=i&&n<=h){this.dirty=e==s||n==l?qw:sNe,e==i&&n==h&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Dg:o.markDirty(e-i,n-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?qw:Dg}s=l}this.dirty=qw}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let s=e==1?qw:sNe;n.dirty{if(!o)return a;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(l.nodeType!=1){let i=document.createElement("span");i.appendChild(l),l=i}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==np&&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 L0t extends DI{constructor(e,n,s,a){super(e,[],n,null),this.textDOM=s,this.text=a}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 Zj extends DI{constructor(e,n,s,a,o){super(e,[],s,a),this.mark=n,this.spec=o}static create(e,n,s,a){let o=a.nodeViews[n.type.name],l=o&&o(n,a,s);return(!l||!l.dom)&&(l=dk.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new Zj(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Dg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Dg&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=np){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=zhe(o,0,e,s));for(let i=0;i{if(!h)return l;if(h.parent)return h.parent.posBeforeChild(h)},s,a),x=p&&p.dom,y=p&&p.contentDOM;if(n.isText){if(!x)x=document.createTextNode(n.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:y}=dk.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!y&&!n.isText&&x.nodeName!="BR"&&(x.hasAttribute("contenteditable")||(x.contentEditable="false"),n.type.spec.draggable&&(x.draggable=!0));let _=x;return x=lFe(x,s,n),p?h=new O0t(e,n,s,a,x,y||null,_,p,o,l+1):n.isText?new Lse(e,n,s,a,x,_,o):new P1(e,n,s,a,x,y||null,_,o,l+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=()=>_n.empty)}return e}matchesNode(e,n,s){return this.dirty==np&&e.eq(this.node)&&Mte(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,a=n,o=e.composing?this.localCompositionInfo(e,n):null,l=o&&o.pos>-1?o:null,i=o&&o.pos<0,h=new R0t(this,l&&l.node,e);B0t(this.node,this.innerDeco,(p,x,y)=>{p.spec.marks?h.syncToMarks(p.spec.marks,s,e):p.type.side>=0&&!y&&h.syncToMarks(x==this.node.childCount?Fo.none:this.node.child(x).marks,s,e),h.placeWidget(p,e,a)},(p,x,y,_)=>{h.syncToMarks(p.marks,s,e);let j;h.findNodeMatch(p,x,y,_)||i&&e.state.selection.from>a&&e.state.selection.to-1&&h.updateNodeAt(p,x,y,j,e)||h.updateNextNode(p,x,y,e,_,a)||h.addNode(p,x,y,e,a),a+=p.nodeSize}),h.syncToMarks([],s,e),this.node.isTextblock&&h.addTextblockHacks(),h.destroyRest(),(h.changed||this.dirty==qw)&&(l&&this.protectLocalComposition(e,l),iFe(this.contentDOM,this.children,e),vC&&$0t(this.dom))}localCompositionInfo(e,n){let{from:s,to:a}=e.state.selection;if(!(e.state.selection instanceof Va)||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 l=o.nodeValue,i=U0t(this.node.content,l,s-n,a-n);return i<0?null:{node:o,pos:i,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:s,text:a}){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 l=new L0t(this,o,n,a);e.input.compositionNodes.push(l),this.children=zhe(this.children,s,s+a.length,e,l)}update(e,n,s,a){return this.dirty==Dg||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,s,a),!0)}updateInner(e,n,s,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=np}updateOuterDeco(e){if(Mte(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=oFe(this.dom,this.nodeDOM,Fhe(this.outerDeco,this.node,n),Fhe(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 aNe(t,e,n,s,a){lFe(s,e,t);let o=new P1(void 0,t,e,n,s,s,s,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class Lse extends P1{constructor(e,n,s,a,o,l,i){super(e,n,s,a,o,null,l,i,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,a){return this.dirty==Dg||this.dirty!=np&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=np||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=np,!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 a=this.node.cut(e,n),o=document.createTextNode(a.text);return new Lse(this.parent,a,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=Dg)}get domAtom(){return!1}isText(e){return this.node.text==e}}class aFe extends DI{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==np&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class O0t extends P1{constructor(e,n,s,a,o,l,i,h,p,x){super(e,n,s,a,o,l,i,p,x),this.spec=h}update(e,n,s,a){if(this.dirty==Dg)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,a),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,s,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,s,a){this.spec.setSelection?this.spec.setSelection(e,n,s.root):super.setSelection(e,n,s,a)}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 iFe(t,e,n){let s=t.firstChild,a=!1;for(let o=0;o>1,l=Math.min(o,e.length);for(;a-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let h=Zj.create(this.top,e[o],n,s);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,s,a){let o=-1,l;if(a>=this.preMatch.index&&(l=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,s))o=this.top.children.indexOf(l,this.index);else for(let i=this.index,h=Math.min(this.top.children.length,i+5);i0;){let i;for(;;)if(s){let p=n.children[s-1];if(p instanceof Zj)n=p,s=p.children.length;else{i=p,s--;break}}else{if(n==e)break e;s=n.parent.children.indexOf(n),n=n.parent}let h=i.node;if(h){if(h!=t.child(a-1))break;--a,o.set(i,a),l.push(i)}}return{index:a,matched:o,matches:l.reverse()}}function z0t(t,e){return t.type.side-e.type.side}function B0t(t,e,n,s){let a=e.locals(t),o=0;if(a.length==0){for(let p=0;po;)i.push(a[l++]);let C=o+_.nodeSize;if(_.isText){let A=C;l!A.inline):i.slice();s(_,N,e.forChild(o,_),j),o=C}}function $0t(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 U0t(t,e,n,s){for(let a=0,o=0;a=n){if(o>=s&&h.slice(s-e.length-i,s-i)==e)return s-e.length;let p=i=0&&p+e.length+i>=n)return i+p;if(n==s&&h.length>=s+e.length-i&&h.slice(s-i,s-i+e.length)==e)return s}}return-1}function zhe(t,e,n,s,a){let o=[];for(let l=0,i=0;l=n||x<=e?o.push(h):(pn&&o.push(h.slice(n-p,h.size,s)))}return o}function $xe(t,e=null){let n=t.domSelectionRange(),s=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),o=a&&a.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let i=s.resolve(l),h,p;if(Pse(n)){for(h=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&aa.isSelectable(y)&&a.parent&&!(y.isInline&&m0t(n.focusNode,n.focusOffset,a.dom))){let _=a.posBefore;p=new aa(l==_?i:s.resolve(_))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,_=l;for(let j=0;j{(n.anchorNode!=s||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!cFe(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function V0t(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,s=n.nodeName=="IMG";s?e.collapse(n.parentNode,Ld(n)+1):e.collapse(n,0),!s&&!t.state.selection.visible&&bh&&I1<=11&&(n.disabled=!0,n.disabled=!1)}function dFe(t,e){if(e instanceof aa){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(dNe(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else dNe(t)}function dNe(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Uxe(t,e,n,s){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Va.between(e,n,s)}function uNe(t){return t.editable&&!t.hasFocus()?!1:uFe(t)}function uFe(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 H0t(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Kj(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Bhe(t,e){let{$anchor:n,$head:s}=t.selection,a=e>0?n.max(s):n.min(s),o=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return o&&ui.findFrom(o,e)}function S0(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function hNe(t,e,n){let s=t.state.selection;if(s instanceof Va)if(n.indexOf("s")>-1){let{$head:a}=s,o=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=t.state.doc.resolve(a.pos+o.nodeSize*(e<0?-1:1));return S0(t,new Va(s.$anchor,l))}else if(s.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=Bhe(t.state,e);return a&&a instanceof aa?S0(t,a):!1}else if(!(Ff&&n.indexOf("m")>-1)){let a=s.$head,o=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,l;if(!o||o.isText)return!1;let i=e<0?a.pos-o.nodeSize:a.pos;return o.isAtom||(l=t.docView.descAt(i))&&!l.contentDOM?aa.isSelectable(o)?S0(t,new aa(e<0?t.state.doc.resolve(a.pos-o.nodeSize):a)):OI?S0(t,new Va(t.state.doc.resolve(e<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof aa&&s.node.isInline)return S0(t,new Va(e>0?s.$to:s.$from));{let a=Bhe(t.state,e);return a?S0(t,a):!1}}}function Tte(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function mA(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function f4(t,e){return e<0?W0t(t):G0t(t)}function W0t(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a,o,l=!1;for(rp&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let i=n.childNodes[s-1];if(mA(i,-1))a=n,o=--s;else if(i.nodeType==3)n=i,s=n.nodeValue.length;else break}}else{if(hFe(n))break;{let i=n.previousSibling;for(;i&&mA(i,-1);)a=n.parentNode,o=Ld(i),i=i.previousSibling;if(i)n=i,s=Tte(n);else{if(n=n.parentNode,n==t.dom)break;s=0}}}l?$he(t,n,s):a&&$he(t,a,o)}function G0t(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a=Tte(n),o,l;for(;;)if(s{t.state==a&&Qx(t)},50)}function fNe(t,e){let n=t.state.doc.resolve(e);if(!(ud||XRe)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),l=(o.top+o.bottom)/2;if(l>a.top&&l1)return o.lefta.top&&l1)return o.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function pNe(t,e,n){let s=t.state.selection;if(s instanceof Va&&!s.empty||n.indexOf("s")>-1||Ff&&n.indexOf("m")>-1)return!1;let{$from:a,$to:o}=s;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Bhe(t.state,e);if(l&&l instanceof aa)return S0(t,l)}if(!a.parent.inlineContent){let l=e<0?a:o,i=s instanceof of?ui.near(l,e):ui.findFrom(l,e);return i?S0(t,i):!1}return!1}function mNe(t,e){if(!(t.state.selection instanceof Va))return!0;let{$head:n,$anchor:s,empty:a}=t.state.selection;if(!n.sameParent(s))return!0;if(!a)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 l=t.state.tr;return e<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),t.dispatch(l),!0}return!1}function gNe(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Y0t(t){if(!mu||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;gNe(t,s,"true"),setTimeout(()=>gNe(t,s,"false"),20)}return!1}function X0t(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Q0t(t,e){let n=e.keyCode,s=X0t(e);if(n==8||Ff&&n==72&&s=="c")return mNe(t,-1)||f4(t,-1);if(n==46&&!e.shiftKey||Ff&&n==68&&s=="c")return mNe(t,1)||f4(t,1);if(n==13||n==27)return!0;if(n==37||Ff&&n==66&&s=="c"){let a=n==37?fNe(t,t.state.selection.from)=="ltr"?-1:1:-1;return hNe(t,a,s)||f4(t,a)}else if(n==39||Ff&&n==70&&s=="c"){let a=n==39?fNe(t,t.state.selection.from)=="ltr"?1:-1:1;return hNe(t,a,s)||f4(t,a)}else{if(n==38||Ff&&n==80&&s=="c")return pNe(t,-1,s)||f4(t,-1);if(n==40||Ff&&n==78&&s=="c")return Y0t(t)||pNe(t,1,s)||f4(t,1);if(s==(Ff?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function qxe(t,e){t.someProp("transformCopied",j=>{e=j(e,t)});let n=[],{content:s,openStart:a,openEnd:o}=e;for(;a>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){a--,o--;let j=s.firstChild;n.push(j.type.name,j.attrs!=j.type.defaultAttrs?j.attrs:null),s=j.content}let l=t.someProp("clipboardSerializer")||dk.fromSchema(t.state.schema),i=yFe(),h=i.createElement("div");h.appendChild(l.serializeFragment(s,{document:i}));let p=h.firstChild,x,y=0;for(;p&&p.nodeType==1&&(x=xFe[p.nodeName.toLowerCase()]);){for(let j=x.length-1;j>=0;j--){let C=i.createElement(x[j]);for(;h.firstChild;)C.appendChild(h.firstChild);h.appendChild(C),y++}p=h.firstChild}p&&p.nodeType==1&&p.setAttribute("data-pm-slice",`${a} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let _=t.someProp("clipboardTextSerializer",j=>j(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:h,text:_,slice:e}}function fFe(t,e,n,s,a){let o=a.parent.type.spec.code,l,i;if(!n&&!e)return null;let h=!!e&&(s||o||!n);if(h){if(t.someProp("transformPastedText",_=>{e=_(e,o||s,t)}),o)return i=new fs(_n.from(t.state.schema.text(e.replace(/\r\n?/g,` `))),0,0),t.someProp("transformPasted",_=>{i=_(i,t,!0)}),i;let y=t.someProp("clipboardTextParser",_=>_(e,a,s,t));if(y)i=y;else{let _=a.marks(),{schema:j}=t.state,C=dk.fromSchema(j);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let A=l.appendChild(document.createElement("p"));N&&A.appendChild(C.serializeNode(j.text(N,_)))})}}else t.someProp("transformPastedHTML",y=>{n=y(n,t)}),l=r1t(n),OI&&n1t(l);let p=l&&l.querySelector("[data-pm-slice]"),x=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice")||"");if(x&&x[3])for(let y=+x[3];y>0;y--){let _=l.firstChild;for(;_&&_.nodeType!=1;)_=_.nextSibling;if(!_)break;l=_}if(i||(i=(t.someProp("clipboardParser")||t.someProp("domParser")||hA.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(h||x),context:a,ruleFromNode(_){return _.nodeName=="BR"&&!_.nextSibling&&_.parentNode&&!J0t.test(_.parentNode.nodeName)?{ignore:!0}:null}})),x)i=s1t(xNe(i,+x[1],+x[2]),x[4]);else if(i=fs.maxOpen(e1t(i.content,a),!0),i.openStart||i.openEnd){let y=0,_=0;for(let j=i.content.firstChild;y{i=y(i,t,h)}),i}const J0t=/^(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 e1t(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),o,l=[];if(t.forEach(i=>{if(!l)return;let h=a.findWrapping(i.type),p;if(!h)return l=null;if(p=l.length&&o.length&&mFe(h,o,i,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=gFe(l[l.length-1],o.length));let x=pFe(i,h);l.push(x),a=a.matchType(x.type),o=h}}),l)return _n.from(l)}return t}function pFe(t,e,n=0){for(let s=e.length-1;s>=n;s--)t=e[s].create(null,_n.from(t));return t}function mFe(t,e,n,s,a){if(a1&&(o=0),a=n&&(i=e<0?l.contentMatchAt(0).fillBefore(i,o<=a).append(i):i.append(l.contentMatchAt(l.childCount).fillBefore(_n.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(i))}function xNe(t,e,n){return en})),fce.createHTML(t)):t}function r1t(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=yFe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(t),a;if((a=s&&xFe[s[1].toLowerCase()])&&(t=a.map(o=>"<"+o+">").join("")+t+a.map(o=>"").reverse().join("")),n.innerHTML=t1t(t),a)for(let o=0;o=0;i-=2){let h=n.nodes[s[i]];if(!h||h.hasRequiredAttrs())break;a=_n.from(h.create(s[i+1],a)),o++,l++}return new fs(a,o,l)}const Uu={},qu={},a1t={touchstart:!0,touchmove:!0};class i1t{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 o1t(t){for(let e in Uu){let n=Uu[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=s=>{c1t(t,s)&&!Vxe(t,s)&&(t.editable||!(s.type in qu))&&n(t,s)},a1t[e]?{passive:!0}:void 0)}mu&&t.dom.addEventListener("input",()=>null),qhe(t)}function t1(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function l1t(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 qhe(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=s=>Vxe(t,s))})}function Vxe(t,e){return t.someProp("handleDOMEvents",n=>{let s=n[e.type];return s?s(t,e)||e.defaultPrevented:!1})}function c1t(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 d1t(t,e){!Vxe(t,e)&&Uu[e.type]&&(t.editable||!(e.type in qu))&&Uu[e.type](t,e)}qu.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!_Fe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Dx&&ud&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),vC&&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",a=>a(t,Lw(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",s=>s(t,n))||Q0t(t,n)?n.preventDefault():t1(t,"key")};qu.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};qu.keypress=(t,e)=>{let n=e;if(_Fe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ff&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let s=t.state.selection;if(!(s instanceof Va)||!s.$from.sameParent(s.$to)){let a=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",l=>l(t,s.$from.pos,s.$to.pos,a,o))&&t.dispatch(o()),n.preventDefault()}};function Ose(t){return{left:t.clientX,top:t.clientY}}function u1t(t,e){let n=e.x-t.clientX,s=e.y-t.clientY;return n*n+s*s<100}function Hxe(t,e,n,s,a){if(s==-1)return!1;let o=t.state.doc.resolve(s);for(let l=o.depth+1;l>0;l--)if(t.someProp(e,i=>l>o.depth?i(t,n,o.nodeAfter,o.before(l),a,!0):i(t,n,o.node(l),o.before(l),a,!1)))return!0;return!1}function PS(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 h1t(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),s=n.nodeAfter;return s&&s.isAtom&&aa.isSelectable(s)?(PS(t,new aa(n)),!0):!1}function f1t(t,e){if(e==-1)return!1;let n=t.state.selection,s,a;n instanceof aa&&(s=n.node);let o=t.state.doc.resolve(e);for(let l=o.depth+1;l>0;l--){let i=l>o.depth?o.nodeAfter:o.node(l);if(aa.isSelectable(i)){s&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?a=o.before(n.$from.depth):a=o.before(l);break}}return a!=null?(PS(t,aa.create(t.state.doc,a)),!0):!1}function p1t(t,e,n,s,a){return Hxe(t,"handleClickOn",e,n,s)||t.someProp("handleClick",o=>o(t,e,s))||(a?f1t(t,n):h1t(t,n))}function m1t(t,e,n,s){return Hxe(t,"handleDoubleClickOn",e,n,s)||t.someProp("handleDoubleClick",a=>a(t,e,s))}function g1t(t,e,n,s){return Hxe(t,"handleTripleClickOn",e,n,s)||t.someProp("handleTripleClick",a=>a(t,e,s))||x1t(t,n,s)}function x1t(t,e,n){if(n.button!=0)return!1;let s=t.state.doc;if(e==-1)return s.inlineContent?(PS(t,Va.create(s,0,s.content.size)),!0):!1;let a=s.resolve(e);for(let o=a.depth+1;o>0;o--){let l=o>a.depth?a.nodeAfter:a.node(o),i=a.before(o);if(l.inlineContent)PS(t,Va.create(s,i+1,i+1+l.content.size));else if(aa.isSelectable(l))PS(t,aa.create(s,i));else continue;return!0}}function Wxe(t){return Ate(t)}const vFe=Ff?"metaKey":"ctrlKey";Uu.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let s=Wxe(t),a=Date.now(),o="singleClick";a-t.input.lastClick.time<500&&u1t(n,t.input.lastClick)&&!n[vFe]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=t.posAtCoords(Ose(n));l&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new y1t(t,l,n,!!s)):(o=="doubleClick"?m1t:g1t)(t,l.pos,l.inside,n)?n.preventDefault():t1(t,"pointer"))};class y1t{constructor(e,n,s,a){this.view=e,this.pos=n,this.event=s,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[vFe],this.allowDefault=s.shiftKey;let o,l;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),l=n.inside;else{let x=e.state.doc.resolve(n.pos);o=x.parent,l=x.depth?x.before():0}const i=a?null:s.target,h=i?e.docView.nearestDesc(i,!0):null;this.target=h&&h.nodeDOM.nodeType==1?h.nodeDOM:null;let{selection:p}=e.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||p instanceof aa&&p.from<=l&&p.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&rp&&!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)),t1(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(()=>Qx(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(Ose(e))),this.updateAllowDefault(e),this.allowDefault||!n?t1(this.view,"pointer"):p1t(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mu&&this.mightDrag&&!this.mightDrag.node.isAtom||ud&&!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)?(PS(this.view,ui.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):t1(this.view,"pointer")}move(e){this.updateAllowDefault(e),t1(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)}}Uu.touchstart=t=>{t.input.lastTouch=Date.now(),Wxe(t),t1(t,"pointer")};Uu.touchmove=t=>{t.input.lastTouch=Date.now(),t1(t,"pointer")};Uu.contextmenu=t=>Wxe(t);function _Fe(t,e){return t.composing?!0:mu&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const v1t=Dx?5e3:-1;qu.compositionstart=qu.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Va&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||ud&&XRe&&_1t(t)))t.markCursor=t.state.storedMarks||n.marks(),Ate(t,!0),t.markCursor=null;else if(Ate(t,!e.selection.empty),rp&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=t.domSelectionRange();for(let a=s.focusNode,o=s.focusOffset;a&&a.nodeType==1&&o!=0;){let l=o<0?a.lastChild:a.childNodes[o-1];if(!l)break;if(l.nodeType==3){let i=t.domSelection();i&&i.collapse(l,l.nodeValue.length);break}else a=l,o=-1}}t.input.composing=!0}bFe(t,v1t)};function _1t(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"}qu.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++,bFe(t,20))};function bFe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ate(t),e))}function wFe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=w1t());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function b1t(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=f0t(e.focusNode,e.focusOffset),s=p0t(e.focusNode,e.focusOffset);if(n&&s&&n!=s){let a=s.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!a||!a.isText(s.nodeValue))return s;if(t.input.compositionNode==s){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return s}}return n||s}function w1t(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ate(t,e=!1){if(!(Dx&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),wFe(t),e||t.docView&&t.docView.dirty){let n=$xe(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 j1t(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(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),s.removeAllRanges(),s.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const uE=bh&&I1<15||vC&&y0t<604;Uu.copy=qu.cut=(t,e)=>{let n=e,s=t.state.selection,a=n.type=="cut";if(s.empty)return;let o=uE?null:n.clipboardData,l=s.content(),{dom:i,text:h}=qxe(t,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",h)):j1t(t,i),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function k1t(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function N1t(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 a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),s.parentNode&&s.parentNode.removeChild(s),n?hE(t,s.value,null,a,e):hE(t,s.textContent,s.innerHTML,a,e)},50)}function hE(t,e,n,s,a){let o=fFe(t,e,n,s,t.state.selection.$from);if(t.someProp("handlePaste",h=>h(t,a,o||fs.empty)))return!0;if(!o)return!1;let l=k1t(o),i=l?t.state.tr.replaceSelectionWith(l,s):t.state.tr.replaceSelection(o);return t.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function jFe(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," "):""}qu.paste=(t,e)=>{let n=e;if(t.composing&&!Dx)return;let s=uE?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;s&&hE(t,jFe(s),s.getData("text/html"),a,n)?n.preventDefault():N1t(t,n)};class kFe{constructor(e,n,s){this.slice=e,this.move=n,this.node=s}}const S1t=Ff?"altKey":"ctrlKey";function NFe(t,e){let n=t.someProp("dragCopies",s=>!s(e));return n??!e[S1t]}Uu.dragstart=(t,e)=>{let n=e,s=t.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let a=t.state.selection,o=a.empty?null:t.posAtCoords(Ose(n)),l;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof aa?a.to-1:a.to))){if(s&&s.mightDrag)l=aa.create(t.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let y=t.docView.nearestDesc(n.target,!0);y&&y.node.type.spec.draggable&&y!=t.docView&&(l=aa.create(t.state.doc,y.posBefore))}}let i=(l||t.state.selection).content(),{dom:h,text:p,slice:x}=qxe(t,i);(!n.dataTransfer.files.length||!ud||YRe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(uE?"Text":"text/html",h.innerHTML),n.dataTransfer.effectAllowed="copyMove",uE||n.dataTransfer.setData("text/plain",p),t.dragging=new kFe(x,NFe(t,n),l)};Uu.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};qu.dragover=qu.dragenter=(t,e)=>e.preventDefault();qu.drop=(t,e)=>{try{C1t(t,e,t.dragging)}finally{t.dragging=null}};function C1t(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(Ose(e));if(!s)return;let a=t.state.doc.resolve(s.pos),o=n&&n.slice;o?t.someProp("transformPasted",j=>{o=j(o,t,!1)}):o=fFe(t,jFe(e.dataTransfer),uE?null:e.dataTransfer.getData("text/html"),!1,a);let l=!!(n&&NFe(t,e));if(t.someProp("handleDrop",j=>j(t,e,o||fs.empty,l))){e.preventDefault();return}if(!o)return;e.preventDefault();let i=o?$Re(t.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let h=t.state.tr;if(l){let{node:j}=n;j?j.replace(h):h.deleteSelection()}let p=h.mapping.map(i),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=h.doc;if(x?h.replaceRangeWith(p,p,o.content.firstChild):h.replaceRange(p,p,o),h.doc.eq(y))return;let _=h.doc.resolve(p);if(x&&aa.isSelectable(o.content.firstChild)&&_.nodeAfter&&_.nodeAfter.sameMarkup(o.content.firstChild))h.setSelection(new aa(_));else{let j=h.mapping.map(i);h.mapping.maps[h.mapping.maps.length-1].forEach((C,N,A,E)=>j=E),h.setSelection(Uxe(t,_,h.doc.resolve(j)))}t.focus(),t.dispatch(h.setMeta("uiEvent","drop"))}Uu.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())&&Qx(t)},20))};Uu.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)};Uu.beforeinput=(t,e)=>{if(ud&&Dx&&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,Lw(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in qu)Uu[t]=qu[t];function fE(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 Ete{constructor(e,n){this.toDOM=e,this.spec=n||Cj,this.side=this.spec.side||0}map(e,n,s,a){let{pos:o,deleted:l}=e.mapResult(n.from+a,this.side<0?-1:1);return l?null:new Wf(o-s,o-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Ete&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fE(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class L1{constructor(e,n){this.attrs=e,this.spec=n||Cj}map(e,n,s,a){let o=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-s,l=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-s;return o>=l?null:new Wf(o,l,this)}valid(e,n){return n.from=e&&(!o||o(i.spec))&&s.push(i.copy(i.from+a,i.to+a))}for(let l=0;le){let i=this.children[l]+1;this.children[l+2].findInner(e-i,n-i,s,a+i,o)}}map(e,n,s){return this==Qd||e.maps.length==0?this:this.mapInner(e,n,0,0,s||Cj)}mapInner(e,n,s,a,o){let l;for(let i=0;i{let p=h+s,x;if(x=CFe(n,i,p)){for(a||(a=this.children.slice());oi&&y.to=e){this.children[i]==e&&(s=this.children[i+2]);break}let o=e+1,l=o+n.content.size;for(let i=0;io&&h.type instanceof L1){let p=Math.max(o,h.from)-o,x=Math.min(l,h.to)-o;pa.map(e,n,Cj));return L0.from(s)}forChild(e,n){if(n.isLeaf)return qc.empty;let s=[];for(let a=0;an instanceof qc)?e:e.reduce((n,s)=>n.concat(s instanceof qc?s:s.members),[]))}}forEachSet(e){for(let n=0;n{let A=N-C-(j-_);for(let E=0;ET+x-y)continue;let P=i[E]+x-y;j>=P?i[E+1]=_<=P?-2:-1:_>=x&&A&&(i[E]+=A,i[E+1]+=A)}y+=A}),x=n.maps[p].map(x,-1)}let h=!1;for(let p=0;p=s.content.size){h=!0;continue}let _=n.map(t[p+1]+o,-1),j=_-a,{index:C,offset:N}=s.content.findIndex(y),A=s.maybeChild(C);if(A&&N==y&&N+A.nodeSize==j){let E=i[p+2].mapInner(n,A,x+1,t[p]+o+1,l);E!=Qd?(i[p]=y,i[p+1]=j,i[p+2]=E):(i[p+1]=-2,h=!0)}else h=!0}if(h){let p=T1t(i,t,e,n,a,o,l),x=Ite(p,s,0,l);e=x.local;for(let y=0;yn&&l.to{let p=CFe(t,i,h+n);if(p){o=!0;let x=Ite(p,i,n+h+1,s);x!=Qd&&a.push(h,h+i.nodeSize,x)}});let l=SFe(o?MFe(t):t,-n).sort(Mj);for(let i=0;i0;)e++;t.splice(e,0,n)}function pce(t){let e=[];return t.someProp("decorations",n=>{let s=n(t.state);s&&s!=Qd&&e.push(s)}),t.cursorWrapper&&e.push(qc.create(t.state.doc,[t.cursorWrapper.deco])),L0.from(e)}const A1t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},E1t=bh&&I1<=11;class I1t{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 P1t{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new I1t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():this.flush()}),E1t&&(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,A1t)),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(uNe(this.view)){if(this.suppressingSelectionUpdates)return Qx(this.view);if(bh&&I1<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Kj(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=yC(o))n.add(o);for(let o=e.anchorNode;o;o=yC(o))if(n.has(o)){s=o;break}let a=s&&this.view.docView.nearestDesc(s);if(a&&a.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(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&uNe(e)&&!this.ignoreSelectionChange(s),o=-1,l=-1,i=!1,h=[];if(e.editable)for(let x=0;xy.nodeName=="BR");if(x.length==2){let[y,_]=x;y.parentNode&&y.parentNode.parentNode==_.parentNode?_.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let _ of x){let j=_.parentNode;j&&j.nodeName=="LI"&&(!y||D1t(e,y)!=j)&&_.remove()}}}else if((ud||mu)&&h.some(x=>x.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let x of h)if(x.nodeName=="BR"&&x.parentNode){let y=x.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&x.parentNode.removeChild(x)}}let p=null;o<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(o>-1&&(e.docView.markDirty(o,l),L1t(e)),this.handleDOMChange(o,l,i,h),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||Qx(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 x=0;xa;A--){let E=s.childNodes[A-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){o=A;break}if(!T||T.size)break}let y=t.state.doc,_=t.someProp("domParser")||hA.fromSchema(t.state.schema),j=y.resolve(l),C=null,N=_.parse(s,{topNode:j.parent,topMatch:j.parent.contentMatchAt(j.index()),topOpen:!0,from:a,to:o,preserveWhitespace:j.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:F1t,context:j});if(p&&p[0].pos!=null){let A=p[0].pos,E=p[1]&&p[1].pos;E==null&&(E=A),C={anchor:A+l,head:E+l}}return{doc:N,sel:C,from:l,to:i}}function F1t(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mu&&/^(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||mu&&/^(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 z1t=/^(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 B1t(t,e,n,s,a){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let V=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,K=$xe(t,V);if(K&&!t.state.selection.eq(K)){if(ud&&Dx&&t.input.lastKeyCode===13&&Date.now()-100te(t,Lw(13,"Enter"))))return;let G=t.state.tr.setSelection(K);V=="pointer"?G.setMeta("pointer",!0):V=="key"&&G.scrollIntoView(),o&&G.setMeta("composition",o),t.dispatch(G)}return}let l=t.state.doc.resolve(e),i=l.sharedDepth(n);e=l.before(i+1),n=t.state.doc.resolve(n).after(i+1);let h=t.state.selection,p=R1t(t,e,n),x=t.state.doc,y=x.slice(p.from,p.to),_,j;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Dx)&&a.some(V=>V.nodeType==1&&!z1t.test(V.nodeName))&&(!C||C.endA>=C.endB)&&t.someProp("handleKeyDown",V=>V(t,Lw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!C)if(s&&h instanceof Va&&!h.empty&&h.$head.sameParent(h.$anchor)&&!t.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))C={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let V=jNe(t,t.state.doc,p.sel);if(V&&!V.eq(t.state.selection)){let K=t.state.tr.setSelection(V);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>=p.from?C.start=t.state.selection.from:C.endA=t.state.selection.to-2&&t.state.selection.to<=p.to&&(C.endB+=t.state.selection.to-C.endA,C.endA=t.state.selection.to)),bh&&I1<=11&&C.endB==C.start+1&&C.endA==C.start&&C.start>p.from&&p.doc.textBetween(C.start-p.from-1,C.start-p.from+1)=="  "&&(C.start--,C.endA--,C.endB--);let N=p.doc.resolveNoCache(C.start-p.from),A=p.doc.resolveNoCache(C.endB-p.from),E=x.resolve(C.start),T=N.sameParent(A)&&N.parent.inlineContent&&E.end()>=C.endA;if((vC&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(V=>V.nodeName=="DIV"||V.nodeName=="P"))||!T&&N.posV(t,Lw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>C.start&&U1t(x,C.start,C.endA,N,A)&&t.someProp("handleKeyDown",V=>V(t,Lw(8,"Backspace")))){Dx&&ud&&t.domObserver.suppressSelectionUpdates();return}ud&&C.endB==C.start&&(t.input.lastChromeDelete=Date.now()),Dx&&!T&&N.start()!=A.start()&&A.parentOffset==0&&N.depth==A.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==C.endA&&(C.endB-=2,A=p.doc.resolveNoCache(C.endB-p.from),setTimeout(()=>{t.someProp("handleKeyDown",function(V){return V(t,Lw(13,"Enter"))})},20));let P=C.start,z=C.endA,F=V=>{let K=V||t.state.tr.replace(P,z,p.doc.slice(C.start-p.from,C.endB-p.from));if(p.sel){let G=jNe(t,K.doc,p.sel);G&&!(ud&&t.composing&&G.empty&&(C.start!=C.endB||t.input.lastChromeDeleteQx(t),20));let V=F(t.state.tr.delete(P,z)),K=x.resolve(C.start).marksAcross(x.resolve(C.endA));K&&V.ensureMarks(K),t.dispatch(V)}else if(C.endA==C.endB&&(q=$1t(N.parent.content.cut(N.parentOffset,A.parentOffset),E.parent.content.cut(E.parentOffset,C.endA-E.start())))){let V=F(t.state.tr);q.type=="add"?V.addMark(P,z,q.mark):V.removeMark(P,z,q.mark),t.dispatch(V)}else if(N.parent.child(N.index()).isText&&N.index()==A.index()-(A.textOffset?0:1)){let V=N.parent.textBetween(N.parentOffset,A.parentOffset),K=()=>F(t.state.tr.insertText(V,P,z));t.someProp("handleTextInput",G=>G(t,P,z,V,K))||t.dispatch(K())}else t.dispatch(F());else t.dispatch(F())}function jNe(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Uxe(t,e.resolve(n.anchor),e.resolve(n.head))}function $1t(t,e){let n=t.firstChild.marks,s=e.firstChild.marks,a=n,o=s,l,i,h;for(let x=0;xx.mark(i.addToSet(x.marks));else if(a.length==0&&o.length==1)i=o[0],l="remove",h=x=>x.mark(i.removeFromSet(x.marks));else return null;let p=[];for(let x=0;xn||mce(l,!0,!1)0&&(e||t.indexAfter(s)==t.node(s).childCount);)s--,a++,e=!1;if(n){let o=t.node(s).maybeChild(t.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,a++}return a}function q1t(t,e,n,s,a){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:l,b:i}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let h=Math.max(0,o-Math.min(l,i));s-=l+h-o}if(l=l?o-s:0;o-=h,o&&o=i?o-s:0;o-=h,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class TFe{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 i1t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(TNe),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=CNe(this),SNe(this),this.nodeViews=MNe(this),this.docView=aNe(this.state.doc,NNe(this),pce(this),this.dom,this),this.domObserver=new P1t(this,(s,a,o,l)=>B1t(this,s,a,o,l)),this.domObserver.start(),o1t(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&&qhe(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(TNe),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 a=this.state,o=!1,l=!1;e.storedMarks&&this.composing&&(wFe(this),l=!0),this.state=e;let i=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(i||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let j=MNe(this);H1t(j,this.nodeViews)&&(this.nodeViews=j,o=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&qhe(this),this.editable=CNe(this),SNe(this);let h=pce(this),p=NNe(this),x=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(e.doc,p,h);(y||!e.selection.eq(a.selection))&&(l=!0);let _=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&b0t(this);if(l){this.domObserver.stop();let j=y&&(bh||ud)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&V1t(a.selection,e.selection);if(y){let C=ud?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=b1t(this)),(o||!this.docView.update(e.doc,p,h,this))&&(this.docView.updateOuterDeco(p),this.docView.destroy(),this.docView=aNe(e.doc,p,h,this.dom,this)),C&&!this.trackWrites&&(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&H0t(this))?Qx(this,j):(dFe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((s=this.dragging)===null||s===void 0)&&s.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():_&&w0t(_)}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 aa){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Jke(this,n.getBoundingClientRect(),e)}else Jke(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&&(a=o)}this.dragging=new kFe(e.slice,e.move,a<0?void 0:aa.create(this.state.doc,a))}someProp(e,n){let s=this._props&&this._props[e],a;if(s!=null&&(a=n?n(s):s))return a;for(let l=0;ln.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return M0t(this,e)}coordsAtPos(e,n=1){return rFe(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 a=this.docView.posFromDOM(e,n,s);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return P0t(this,n||this.state,e)}pasteHTML(e,n){return hE(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return hE(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return qxe(this,e)}destroy(){this.docView&&(l1t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],pce(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,u0t())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return d1t(this,e)}domSelectionRange(){let e=this.domSelection();return e?mu&&this.root.nodeType===11&&g0t(this.dom.ownerDocument)==this.dom&&O1t(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}TFe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function NNe(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"),[Wf.node(0,t.state.doc.content.size,e)]}function SNe(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:Wf.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function CNe(t){return!t.someProp("editable",e=>e(t.state)===!1)}function V1t(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 MNe(t){let e=Object.create(null);function n(s){for(let a in s)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=s[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function H1t(t,e){let n=0,s=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)s++;return n!=s}function TNe(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 Q1={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:"'"},Pte={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},W1t=typeof navigator<"u"&&/Mac/.test(navigator.platform),G1t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Od=0;Od<10;Od++)Q1[48+Od]=Q1[96+Od]=String(Od);for(var Od=1;Od<=24;Od++)Q1[Od+111]="F"+Od;for(var Od=65;Od<=90;Od++)Q1[Od]=String.fromCharCode(Od+32),Pte[Od]=String.fromCharCode(Od);for(var gce in Q1)Pte.hasOwnProperty(gce)||(Pte[gce]=Q1[gce]);function K1t(t){var e=W1t&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||G1t&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Pte:Q1)[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 Z1t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Y1t=typeof navigator<"u"&&/Win/.test(navigator.platform);function X1t(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let s,a,o,l;for(let i=0;it.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function EFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const IFe=(t,e,n)=>{let s=EFe(t,n);if(!s)return!1;let a=Yxe(s);if(!a){let l=s.blockRange(),i=l&&p3(l);return i==null?!1:(e&&e(t.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if($Fe(t,a,e,-1))return!0;if(s.parent.content.size==0&&(_C(o,"end")||aa.isSelectable(o)))for(let l=s.depth;;l--){let i=Ese(t.doc,s.before(l),s.after(l),fs.empty);if(i&&i.slice.size1)break}return o.isAtom&&a.depth==s.depth-1?(e&&e(t.tr.delete(a.pos-o.nodeSize,a.pos).scrollIntoView()),!0):!1},evt=(t,e,n)=>{let s=EFe(t,n);if(!s)return!1;let a=Yxe(s);return a?PFe(t,a,e):!1},tvt=(t,e,n)=>{let s=OFe(t,n);if(!s)return!1;let a=Xxe(s);return a?PFe(t,a,e):!1};function PFe(t,e,n){let s=e.nodeBefore,a=s,o=e.pos-1;for(;!a.isTextblock;o--){if(a.type.spec.isolating)return!1;let x=a.lastChild;if(!x)return!1;a=x}let l=e.nodeAfter,i=l,h=e.pos+1;for(;!i.isTextblock;h++){if(i.type.spec.isolating)return!1;let x=i.firstChild;if(!x)return!1;i=x}let p=Ese(t.doc,o,h,fs.empty);if(!p||p.from!=o||p instanceof cd&&p.slice.size>=h-o)return!1;if(n){let x=t.tr.step(p);x.setSelection(Va.create(x.doc,o)),n(x.scrollIntoView())}return!0}function _C(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 LFe=(t,e,n)=>{let{$head:s,empty:a}=t.selection,o=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):s.parentOffset>0)return!1;o=Yxe(s)}let l=o&&o.nodeBefore;return!l||!aa.isSelectable(l)?!1:(e&&e(t.tr.setSelection(aa.create(t.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function Yxe(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 OFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let s=OFe(t,n);if(!s)return!1;let a=Xxe(s);if(!a)return!1;let o=a.nodeAfter;if($Fe(t,a,e,1))return!0;if(s.parent.content.size==0&&(_C(o,"start")||aa.isSelectable(o))){let l=Ese(t.doc,s.before(),s.after(),fs.empty);if(l&&l.slice.size{let{$head:s,empty:a}=t.selection,o=s;if(!a)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 aa,a;if(s){if(n.node.isTextblock||!dv(t.doc,n.from))return!1;a=n.from}else if(a=Ase(t.doc,n.from,-1),a==null)return!1;if(e){let o=t.tr.join(a);s&&o.setSelection(aa.create(o.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},nvt=(t,e)=>{let n=t.selection,s;if(n instanceof aa){if(n.node.isTextblock||!dv(t.doc,n.to))return!1;s=n.to}else if(s=Ase(t.doc,n.to,1),s==null)return!1;return e&&e(t.tr.join(s).scrollIntoView()),!0},svt=(t,e)=>{let{$from:n,$to:s}=t.selection,a=n.blockRange(s),o=a&&p3(a);return o==null?!1:(e&&e(t.tr.lift(a,o).scrollIntoView()),!0)},FFe=(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 Qxe(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 a=n.node(-1),o=n.indexAfter(-1),l=Qxe(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(e){let i=n.after(),h=t.tr.replaceWith(i,i,l.createAndFill());h.setSelection(ui.near(h.doc.resolve(i),1)),e(h.scrollIntoView())}return!0},zFe=(t,e)=>{let n=t.selection,{$from:s,$to:a}=n;if(n instanceof of||s.parent.inlineContent||a.parent.inlineContent)return!1;let o=Qxe(a.parent.contentMatchAt(a.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let l=(!s.parentOffset&&a.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(Xx(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),a=s&&p3(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)};function ivt(t){return(e,n)=>{let{$from:s,$to:a}=e.selection;if(e.selection instanceof aa&&e.selection.node.isBlock)return!s.parentOffset||!Xx(e.doc,s.pos)?!1:(n&&n(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,i,h=!1,p=!1;for(let j=s.depth;;j--)if(s.node(j).isBlock){h=s.end(j)==s.pos+(s.depth-j),p=s.start(j)==s.pos-(s.depth-j),i=Qxe(s.node(j-1).contentMatchAt(s.indexAfter(j-1))),o.unshift(h&&i?{type:i}:null),l=j;break}else{if(j==1)return!1;o.unshift(null)}let x=e.tr;(e.selection instanceof Va||e.selection instanceof of)&&x.deleteSelection();let y=x.mapping.map(s.pos),_=Xx(x.doc,y,o.length,o);if(_||(o[0]=i?{type:i}:null,_=Xx(x.doc,y,o.length,o)),!_)return!1;if(x.split(y,o.length,o),!h&&p&&s.node(l).type!=i){let j=x.mapping.map(s.before(l)),C=x.doc.resolve(j);i&&s.node(l-1).canReplaceWith(C.index(),C.index()+1,i)&&x.setNodeMarkup(x.mapping.map(s.before(l)),i)}return n&&n(x.scrollIntoView()),!0}}const ovt=ivt(),lvt=(t,e)=>{let{$from:n,to:s}=t.selection,a,o=n.sharedDepth(s);return o==0?!1:(a=n.before(o),e&&e(t.tr.setSelection(aa.create(t.doc,a))),!0)};function cvt(t,e,n){let s=e.nodeBefore,a=e.nodeAfter,o=e.index();return!s||!a||!s.type.compatibleContent(a.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)||!(a.isTextblock||dv(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function $Fe(t,e,n,s){let a=e.nodeBefore,o=e.nodeAfter,l,i,h=a.type.spec.isolating||o.type.spec.isolating;if(!h&&cvt(t,e,n))return!0;let p=!h&&e.parent.canReplace(e.index(),e.index()+1);if(p&&(l=(i=a.contentMatchAt(a.childCount)).findWrapping(o.type))&&i.matchType(l[0]||o.type).validEnd){if(n){let j=e.pos+o.nodeSize,C=_n.empty;for(let E=l.length-1;E>=0;E--)C=_n.from(l[E].create(null,C));C=_n.from(a.copy(C));let N=t.tr.step(new xd(e.pos-1,j,e.pos,j,new fs(C,1,0),l.length,!0)),A=N.doc.resolve(j+2*l.length);A.nodeAfter&&A.nodeAfter.type==a.type&&dv(N.doc,A.pos)&&N.join(A.pos),n(N.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&h?null:ui.findFrom(e,1),y=x&&x.$from.blockRange(x.$to),_=y&&p3(y);if(_!=null&&_>=e.depth)return n&&n(t.tr.lift(y,_).scrollIntoView()),!0;if(p&&_C(o,"start",!0)&&_C(a,"end")){let j=a,C=[];for(;C.push(j),!j.isTextblock;)j=j.lastChild;let N=o,A=1;for(;!N.isTextblock;N=N.firstChild)A++;if(j.canReplace(j.childCount,j.childCount,N.content)){if(n){let E=_n.empty;for(let P=C.length-1;P>=0;P--)E=_n.from(C[P].copy(E));let T=t.tr.step(new xd(e.pos-C.length,e.pos+o.nodeSize,e.pos+A,e.pos+o.nodeSize-A,new fs(E,C.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function UFe(t){return function(e,n){let s=e.selection,a=t<0?s.$from:s.$to,o=a.depth;for(;a.node(o).isInline;){if(!o)return!1;o--}return a.node(o).isTextblock?(n&&n(e.tr.setSelection(Va.create(e.doc,t<0?a.start(o):a.end(o)))),!0):!1}}const dvt=UFe(-1),uvt=UFe(1);function hvt(t,e=null){return function(n,s){let{$from:a,$to:o}=n.selection,l=a.blockRange(o),i=l&&Fxe(l,t,e);return i?(s&&s(n.tr.wrap(l,i).scrollIntoView()),!0):!1}}function ANe(t,e=null){return function(n,s){let a=!1;for(let o=0;o{if(a)return!1;if(!(!h.isTextblock||h.hasMarkup(t,e)))if(h.type==t)a=!0;else{let x=n.doc.resolve(p),y=x.index();a=x.parent.canReplaceWith(y,y+1,t)}})}if(!a)return!1;if(s){let o=n.tr;for(let l=0;l=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let h=l.resolve(e.start-2);o=new Ste(h,h,e.depth),e.endIndex=0;x--)o=_n.from(n[x].type.create(n[x].attrs,o));t.step(new xd(e.start-(s?2:0),e.end,e.start,e.end,new fs(o,0,0),n.length,!0));let l=0;for(let x=0;xl.childCount>0&&l.firstChild.type==t);return o?n?s.node(o.depth-1).type==t?xvt(e,n,t,o):yvt(e,n,o):!0:!1}}function xvt(t,e,n,s){let a=t.tr,o=s.end,l=s.$to.end(s.depth);oN;C--)j-=a.child(C).nodeSize,s.delete(j-1,j+1);let o=s.doc.resolve(n.start),l=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let i=n.startIndex==0,h=n.endIndex==a.childCount,p=o.node(-1),x=o.index(-1);if(!p.canReplace(x+(i?0:1),x+1,l.content.append(h?_n.empty:_n.from(a))))return!1;let y=o.pos,_=y+l.nodeSize;return s.step(new xd(y-(i?1:0),_+(h?1:0),y+1,_-1,new fs((i?_n.empty:_n.from(a.copy(_n.empty))).append(h?_n.empty:_n.from(a.copy(_n.empty))),i?0:1,h?0:1),i?0:1)),e(s.scrollIntoView()),!0}function vvt(t){return function(e,n){let{$from:s,$to:a}=e.selection,o=s.blockRange(a,p=>p.childCount>0&&p.firstChild.type==t);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let i=o.parent,h=i.child(l-1);if(h.type!=t)return!1;if(n){let p=h.lastChild&&h.lastChild.type==i.type,x=_n.from(p?t.create():null),y=new fs(_n.from(t.create(null,_n.from(i.type.create(null,x)))),p?3:1,0),_=o.start,j=o.end;n(e.tr.step(new xd(_-(p?3:1),j,_,j,y,1,!0)).scrollIntoView())}return!0}}function Dse(t){const{state:e,transaction:n}=t;let{selection:s}=n,{doc:a}=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 a},get tr(){return s=n.selection,a=n.doc,o=n.storedMarks,n}}}class Rse{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:a}=n,{tr:o}=s,l=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([i,h])=>[i,(...x)=>{const y=h(...x)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i=[],h=!!e,p=e||o.tr,x=()=>(!h&&n&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(p),i.every(_=>_===!0)),y={...Object.fromEntries(Object.entries(s).map(([_,j])=>[_,(...N)=>{const A=this.buildProps(p,n),E=j(...N)(A);return i.push(E),y}])),run:x};return y}createCan(e){const{rawCommands:n,state:s}=this,a=!1,o=e||s.tr,l=this.buildProps(o,a);return{...Object.fromEntries(Object.entries(n).map(([h,p])=>[h,(...x)=>p(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,a)}}buildProps(e,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i={tr:e,editor:a,view:l,state:Dse({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(([h,p])=>[h,(...x)=>p(...x)(i)]))}};return i}}let _vt=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(a=>a.apply(this,n)),this}off(e,n){const s=this.callbacks[e];return s&&(n?this.callbacks[e]=s.filter(a=>a!==n):delete this.callbacks[e]),this}once(e,n){const s=(...a)=>{this.off(e,s),n.apply(this,a)};return this.on(e,s)}removeAllListeners(){this.callbacks={}}};function ks(t,e,n){return t.config[e]===void 0&&t.parent?ks(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ks(t.parent,e,n):null}):t.config[e]}function Fse(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),s=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:s}}function qFe(t){const e=[],{nodeExtensions:n,markExtensions:s}=Fse(t),a=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage,extensions:a},h=ks(l,"addGlobalAttributes",i);if(!h)return;h().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([_,j])=>{e.push({type:y,name:_,attribute:{...o,...j}})})})})}),a.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage},h=ks(l,"addAttributes",i);if(!h)return;const p=h();Object.entries(p).forEach(([x,y])=>{const _={...o,...y};typeof(_==null?void 0:_.default)=="function"&&(_.default=_.default()),_!=null&&_.isRequired&&(_==null?void 0:_.default)===void 0&&delete _.default,e.push({type:l.name,name:x,attribute:_})})}),e}function vd(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 _d(...t){return t.filter(e=>!!e).reduce((e,n)=>{const s={...e};return Object.entries(n).forEach(([a,o])=>{if(!s[a]){s[a]=o;return}if(a==="class"){const i=o?String(o).split(" "):[],h=s[a]?s[a].split(" "):[],p=i.filter(x=>!h.includes(x));s[a]=[...h,...p].join(" ")}else if(a==="style"){const i=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],h=s[a]?s[a].split(";").map(x=>x.trim()).filter(Boolean):[],p=new Map;h.forEach(x=>{const[y,_]=x.split(":").map(j=>j.trim());p.set(y,_)}),i.forEach(x=>{const[y,_]=x.split(":").map(j=>j.trim());p.set(y,_)}),s[a]=Array.from(p.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[a]=o}),s},{})}function Vhe(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)=>_d(n,s),{})}function VFe(t){return typeof t=="function"}function hi(t,e=void 0,...n){return VFe(t)?e?t.bind(e)(...n):t(...n):t}function bvt(t={}){return Object.keys(t).length===0&&t.constructor===Object}function wvt(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function ENe(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 a=e.reduce((o,l)=>{const i=l.attribute.parseHTML?l.attribute.parseHTML(n):wvt(n.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...s,...a}}}}function INe(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&bvt(n)?!1:n!=null))}function jvt(t,e){var n;const s=qFe(t),{nodeExtensions:a,markExtensions:o}=Fse(t),l=(n=a.find(p=>ks(p,"topNode")))===null||n===void 0?void 0:n.name,i=Object.fromEntries(a.map(p=>{const x=s.filter(E=>E.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:e},_=t.reduce((E,T)=>{const P=ks(T,"extendNodeSchema",y);return{...E,...P?P(p):{}}},{}),j=INe({..._,content:hi(ks(p,"content",y)),marks:hi(ks(p,"marks",y)),group:hi(ks(p,"group",y)),inline:hi(ks(p,"inline",y)),atom:hi(ks(p,"atom",y)),selectable:hi(ks(p,"selectable",y)),draggable:hi(ks(p,"draggable",y)),code:hi(ks(p,"code",y)),whitespace:hi(ks(p,"whitespace",y)),linebreakReplacement:hi(ks(p,"linebreakReplacement",y)),defining:hi(ks(p,"defining",y)),isolating:hi(ks(p,"isolating",y)),attrs:Object.fromEntries(x.map(E=>{var T;return[E.name,{default:(T=E==null?void 0:E.attribute)===null||T===void 0?void 0:T.default}]}))}),C=hi(ks(p,"parseHTML",y));C&&(j.parseDOM=C.map(E=>ENe(E,x)));const N=ks(p,"renderHTML",y);N&&(j.toDOM=E=>N({node:E,HTMLAttributes:Vhe(E,x)}));const A=ks(p,"renderText",y);return A&&(j.toText=A),[p.name,j]})),h=Object.fromEntries(o.map(p=>{const x=s.filter(A=>A.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:e},_=t.reduce((A,E)=>{const T=ks(E,"extendMarkSchema",y);return{...A,...T?T(p):{}}},{}),j=INe({..._,inclusive:hi(ks(p,"inclusive",y)),excludes:hi(ks(p,"excludes",y)),group:hi(ks(p,"group",y)),spanning:hi(ks(p,"spanning",y)),code:hi(ks(p,"code",y)),attrs:Object.fromEntries(x.map(A=>{var E;return[A.name,{default:(E=A==null?void 0:A.attribute)===null||E===void 0?void 0:E.default}]}))}),C=hi(ks(p,"parseHTML",y));C&&(j.parseDOM=C.map(A=>ENe(A,x)));const N=ks(p,"renderHTML",y);return N&&(j.toDOM=A=>N({mark:A,HTMLAttributes:Vhe(A,x)})),[p.name,j]}));return new ARe({topNode:l,nodes:i,marks:h})}function yce(t,e){return e.nodes[t]||e.marks[t]||null}function PNe(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function eye(t,e){const n=dk.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}const kvt=(t,e=500)=>{let n="";const s=t.parentOffset;return t.parent.nodesBetween(Math.max(0,s-e),s,(a,o,l,i)=>{var h,p;const x=((p=(h=a.type.spec).toText)===null||p===void 0?void 0:p.call(h,{node:a,pos:o,parent:l,index:i}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?x:x.slice(0,Math.max(0,s-o))}),n};function tye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class zse{constructor(e){this.find=e.find,this.handler=e.handler}}const Nvt=(t,e)=>{if(tye(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 TL(t){var e;const{editor:n,from:s,to:a,text:o,rules:l,plugin:i}=t,{view:h}=n;if(h.composing)return!1;const p=h.state.doc.resolve(s);if(p.parent.type.spec.code||!((e=p.nodeBefore||p.nodeAfter)===null||e===void 0)&&e.marks.find(_=>_.type.spec.code))return!1;let x=!1;const y=kvt(p)+o;return l.forEach(_=>{if(x)return;const j=Nvt(y,_.find);if(!j)return;const C=h.state.tr,N=Dse({state:h.state,transaction:C}),A={from:s-(j[0].length-o.length),to:a},{commands:E,chain:T,can:P}=new Rse({editor:n,state:N});_.handler({state:N,range:A,match:j,commands:E,chain:T,can:P})===null||!C.steps.length||(C.setMeta(i,{transform:C,from:s,to:a,text:o}),h.dispatch(C),x=!0)}),x}function Svt(t){const{editor:e,rules:n}=t,s=new Vd({state:{init(){return null},apply(a,o,l){const i=a.getMeta(s);if(i)return i;const h=a.getMeta("applyInputRules");return!!h&&setTimeout(()=>{let{text:x}=h;typeof x=="string"?x=x:x=eye(_n.from(x),l.schema);const{from:y}=h,_=y+x.length;TL({editor:e,from:y,to:_,text:x,rules:n,plugin:s})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return TL({editor:e,from:o,to:l,text:i,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&TL({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(a,o){if(o.key!=="Enter")return!1;const{$cursor:l}=a.state.selection;return l?TL({editor:e,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function Cvt(t){return Object.prototype.toString.call(t).slice(8,-1)}function AL(t){return Cvt(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Bse(t,e){const n={...t};return AL(t)&&AL(e)&&Object.keys(e).forEach(s=>{AL(e[s])&&AL(t[s])?n[s]=Bse(t[s],e[s]):n[s]=e[s]}),n}class Rg{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=hi(ks(this,"addOptions",{name:this.name}))),this.storage=hi(ks(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Rg(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Bse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Rg(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=hi(ks(n,"addOptions",{name:n.name})),n.storage=hi(ks(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:s}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const l=a.marks();if(!!!l.find(p=>(p==null?void 0:p.type.name)===n.name))return!1;const h=l.find(p=>(p==null?void 0:p.type.name)===n.name);return h&&s.removeStoredMark(h),s.insertText(" ",a.pos),e.view.dispatch(s),!0}return!1}}function Mvt(t){return typeof t=="number"}class Tvt{constructor(e){this.find=e.find,this.handler=e.handler}}const Avt=(t,e,n)=>{if(tye(e))return[...t.matchAll(e)];const s=e(t,n);return s?s.map(a=>{const o=[a.text];return o.index=a.index,o.input=t,o.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(a.replaceWith)),o}):[]};function Evt(t){const{editor:e,state:n,from:s,to:a,rule:o,pasteEvent:l,dropEvent:i}=t,{commands:h,chain:p,can:x}=new Rse({editor:e,state:n}),y=[];return n.doc.nodesBetween(s,a,(j,C)=>{if(!j.isTextblock||j.type.spec.code)return;const N=Math.max(s,C),A=Math.min(a,C+j.content.size),E=j.textBetween(N-C,A-C,void 0,"");Avt(E,o.find,l).forEach(P=>{if(P.index===void 0)return;const z=N+P.index+1,F=z+P[0].length,q={from:n.tr.mapping.map(z),to:n.tr.mapping.map(F)},V=o.handler({state:n,range:q,match:P,commands:h,chain:p,can:x,pasteEvent:l,dropEvent:i});y.push(V)})}),y.every(j=>j!==null)}let EL=null;const Ivt=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 Pvt(t){const{editor:e,rules:n}=t;let s=null,a=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,i;try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}const h=({state:x,from:y,to:_,rule:j,pasteEvt:C})=>{const N=x.tr,A=Dse({state:x,transaction:N});if(!(!Evt({editor:e,state:A,from:Math.max(y-1,0),to:_.b-1,rule:j,pasteEvent:C,dropEvent:i})||!N.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,N}};return n.map(x=>new Vd({view(y){const _=C=>{var N;s=!((N=y.dom.parentElement)===null||N===void 0)&&N.contains(C.target)?y.dom.parentElement:null,s&&(EL=e)},j=()=>{EL&&(EL=null)};return window.addEventListener("dragstart",_),window.addEventListener("dragend",j),{destroy(){window.removeEventListener("dragstart",_),window.removeEventListener("dragend",j)}}},props:{handleDOMEvents:{drop:(y,_)=>{if(o=s===y.dom.parentElement,i=_,!o){const j=EL;j!=null&&j.isEditable&&setTimeout(()=>{const C=j.state.selection;C&&j.commands.deleteRange({from:C.from,to:C.to})},10)}return!1},paste:(y,_)=>{var j;const C=(j=_.clipboardData)===null||j===void 0?void 0:j.getData("text/html");return l=_,a=!!(C!=null&&C.includes("data-pm-slice")),!1}}},appendTransaction:(y,_,j)=>{const C=y[0],N=C.getMeta("uiEvent")==="paste"&&!a,A=C.getMeta("uiEvent")==="drop"&&!o,E=C.getMeta("applyPasteRules"),T=!!E;if(!N&&!A&&!T)return;if(T){let{text:F}=E;typeof F=="string"?F=F:F=eye(_n.from(F),j.schema);const{from:q}=E,V=q+F.length,K=Ivt(F);return h({rule:x,state:j,from:q,to:{b:V},pasteEvt:K})}const P=_.doc.content.findDiffStart(j.doc.content),z=_.doc.content.findDiffEnd(j.doc.content);if(!(!Mvt(P)||!z||P===z.b))return h({rule:x,state:j,from:P,to:z,pasteEvt:l})}}))}function Lvt(t){const e=t.filter((n,s)=>t.indexOf(n)!==s);return Array.from(new Set(e))}class F4{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=F4.resolve(e),this.schema=jvt(this.extensions,n),this.setupExtensions()}static resolve(e){const n=F4.sort(F4.flatten(e)),s=Lvt(n.map(a=>a.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(a=>`'${a}'`).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},a=ks(n,"addExtensions",s);return a?[n,...this.flatten(a())]:n}).flat(10)}static sort(e){return e.sort((s,a)=>{const o=ks(s,"priority")||100,l=ks(a,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:yce(n.name,this.schema)},a=ks(n,"addCommands",s);return a?{...e,...a()}:e},{})}get plugins(){const{editor:e}=this,n=F4.sort([...this.extensions].reverse()),s=[],a=[],o=n.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:e,type:yce(l.name,this.schema)},h=[],p=ks(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&ks(l,"exitable",i)&&(x.ArrowRight=()=>Rg.handleExit({editor:e,mark:l})),p){const N=Object.fromEntries(Object.entries(p()).map(([A,E])=>[A,()=>E({editor:e})]));x={...x,...N}}const y=J1t(x);h.push(y);const _=ks(l,"addInputRules",i);PNe(l,e.options.enableInputRules)&&_&&s.push(..._());const j=ks(l,"addPasteRules",i);PNe(l,e.options.enablePasteRules)&&j&&a.push(...j());const C=ks(l,"addProseMirrorPlugins",i);if(C){const N=C();h.push(...N)}return h}).flat();return[Svt({editor:e,rules:s}),...Pvt({editor:e,rules:a}),...o]}get attributes(){return qFe(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Fse(this.extensions);return Object.fromEntries(n.filter(s=>!!ks(s,"addNodeView")).map(s=>{const a=this.attributes.filter(h=>h.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:e,type:vd(s.name,this.schema)},l=ks(s,"addNodeView",o);if(!l)return[];const i=(h,p,x,y,_)=>{const j=Vhe(h,a);return l()({node:h,view:p,getPos:x,decorations:y,innerDecorations:_,editor:e,extension:s,HTMLAttributes:j})};return[s.name,i]}))}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:yce(e.name,this.schema)};e.type==="mark"&&(!((n=hi(ks(e,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const a=ks(e,"onBeforeCreate",s),o=ks(e,"onCreate",s),l=ks(e,"onUpdate",s),i=ks(e,"onSelectionUpdate",s),h=ks(e,"onTransaction",s),p=ks(e,"onFocus",s),x=ks(e,"onBlur",s),y=ks(e,"onDestroy",s);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),l&&this.editor.on("update",l),i&&this.editor.on("selectionUpdate",i),h&&this.editor.on("transaction",h),p&&this.editor.on("focus",p),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class Ud{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=hi(ks(this,"addOptions",{name:this.name}))),this.storage=hi(ks(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ud(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Bse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ud({...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=hi(ks(n,"addOptions",{name:n.name})),n.storage=hi(ks(n,"addStorage",{name:n.name,options:n.options})),n}}function HFe(t,e,n){const{from:s,to:a}=e,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let i="";return t.nodesBetween(s,a,(h,p,x,y)=>{var _;h.isBlock&&p>s&&(i+=o);const j=l==null?void 0:l[h.type.name];if(j)return x&&(i+=j({node:h,pos:p,parent:x,index:y,range:e})),!1;h.isText&&(i+=(_=h==null?void 0:h.text)===null||_===void 0?void 0:_.slice(Math.max(s,p)-p,a-p))}),i}function WFe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Ovt=Ud.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Vd({key:new mf("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:s,selection:a}=e,{ranges:o}=a,l=Math.min(...o.map(x=>x.$from.pos)),i=Math.max(...o.map(x=>x.$to.pos)),h=WFe(n);return HFe(s,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:h})}}})]}}),Dvt=()=>({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),Rvt=(t=!1)=>({commands:e})=>e.setContent("",t),Fvt=()=>({state:t,tr:e,dispatch:n})=>{const{selection:s}=e,{ranges:a}=s;return n&&a.forEach(({$from:o,$to:l})=>{t.doc.nodesBetween(o.pos,l.pos,(i,h)=>{if(i.type.isText)return;const{doc:p,mapping:x}=e,y=p.resolve(x.map(h)),_=p.resolve(x.map(h+i.nodeSize)),j=y.blockRange(_);if(!j)return;const C=p3(j);if(i.type.isTextblock){const{defaultType:N}=y.parent.contentMatchAt(y.index());e.setNodeMarkup(j.start,N)}(C||C===0)&&e.lift(j,C)})}),!0},zvt=t=>e=>t(e),Bvt=()=>({state:t,dispatch:e})=>zFe(t,e),$vt=(t,e)=>({editor:n,tr:s})=>{const{state:a}=n,o=a.doc.slice(t.from,t.to);s.deleteRange(t.from,t.to);const l=s.mapping.map(e);return s.insert(l,o.content),s.setSelection(new Va(s.doc.resolve(Math.max(l-1,0)))),!0},Uvt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,s=n.$anchor.node();if(s.content.size>0)return!1;const a=t.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s.type){if(e){const i=a.before(o),h=a.after(o);t.delete(i,h).scrollIntoView()}return!0}return!1},qvt=t=>({tr:e,state:n,dispatch:s})=>{const a=vd(t,n.schema),o=e.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===a){if(s){const h=o.before(l),p=o.after(l);e.delete(h,p).scrollIntoView()}return!0}return!1},Vvt=t=>({tr:e,dispatch:n})=>{const{from:s,to:a}=t;return n&&e.delete(s,a),!0},Hvt=()=>({state:t,dispatch:e})=>Zxe(t,e),Wvt=()=>({commands:t})=>t.keyboardShortcut("Enter"),Gvt=()=>({state:t,dispatch:e})=>avt(t,e);function Lte(t,e,n={strict:!0}){const s=Object.keys(e);return s.length?s.every(a=>n.strict?e[a]===t[a]:tye(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function GFe(t,e,n={}){return t.find(s=>s.type===e&&Lte(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function LNe(t,e,n={}){return!!GFe(t,e,n)}function rye(t,e,n){var s;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(x=>x.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(x=>x.type===e)||(n=n||((s=a.node.marks[0])===null||s===void 0?void 0:s.attrs),!GFe([...a.node.marks],e,n)))return;let l=a.index,i=t.start()+a.offset,h=l+1,p=i+a.node.nodeSize;for(;l>0&&LNe([...t.parent.child(l-1).marks],e,n);)l-=1,i-=t.parent.child(l).nodeSize;for(;h({tr:n,state:s,dispatch:a})=>{const o=hv(t,s.schema),{doc:l,selection:i}=n,{$from:h,from:p,to:x}=i;if(a){const y=rye(h,o,e);if(y&&y.from<=p&&y.to>=x){const _=Va.create(l,y.from,y.to);n.setSelection(_)}}return!0},Zvt=t=>e=>{const n=typeof t=="function"?t(e):t;for(let s=0;s({editor:n,view:s,tr:a,dispatch:o})=>{e={scrollIntoView:!0,...e};const l=()=>{(nye()||Yvt())&&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&&!KFe(n.state.selection))return l(),!0;const i=ZFe(a.doc,t)||n.state.selection,h=n.state.selection.eq(i);return o&&(h||a.setSelection(i),h&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},Qvt=(t,e)=>n=>t.every((s,a)=>e(s,{...n,index:a})),Jvt=(t,e)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),YFe=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&&YFe(s)}return t};function IL(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return YFe(n)}function pE(t,e,n){if(t instanceof E1||t instanceof _n)return t;n={slice:!0,parseOptions:{},...n};const s=typeof t=="object"&&t!==null,a=typeof t=="string";if(s)try{if(Array.isArray(t)&&t.length>0)return _n.fromArray(t.map(i=>e.nodeFromJSON(i)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}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),pE("",e,n)}if(a){if(n.errorOnInvalidContent){let l=!1,i="";const h=new ARe({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:p=>(l=!0,i=typeof p=="string"?p:p.outerHTML,null)}]}})});if(n.slice?hA.fromSchema(h).parseSlice(IL(t),n.parseOptions):hA.fromSchema(h).parse(IL(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=hA.fromSchema(e);return n.slice?o.parseSlice(IL(t),n.parseOptions).content:o.parse(IL(t),n.parseOptions)}return pE("",e,n)}function e_t(t,e,n){const s=t.steps.length-1;if(s{l===0&&(l=x)}),t.setSelection(ui.near(t.doc.resolve(l),n))}const t_t=t=>!("type"in t),r_t=(t,e,n)=>({tr:s,dispatch:a,editor:o})=>{var l;if(a){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i;const h=A=>{o.emit("contentError",{editor:o,error:A,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{pE(e,o.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(A){h(A)}try{i=pE(e,o.schema,{parseOptions:p,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(A){return h(A),!1}let{from:x,to:y}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},_=!0,j=!0;if((t_t(i)?i:[i]).forEach(A=>{A.check(),_=_?A.isText&&A.marks.length===0:!1,j=j?A.isBlock:!1}),x===y&&j){const{parent:A}=s.doc.resolve(x);A.isTextblock&&!A.type.spec.code&&!A.childCount&&(x-=1,y+=1)}let N;if(_){if(Array.isArray(e))N=e.map(A=>A.text||"").join("");else if(e instanceof _n){let A="";e.forEach(E=>{E.text&&(A+=E.text)}),N=A}else typeof e=="object"&&e&&e.text?N=e.text:N=e;s.insertText(N,x,y)}else N=i,s.replaceWith(x,y,N);n.updateSelection&&e_t(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:x,text:N}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:x,text:N})}return!0},n_t=()=>({state:t,dispatch:e})=>rvt(t,e),s_t=()=>({state:t,dispatch:e})=>nvt(t,e),a_t=()=>({state:t,dispatch:e})=>IFe(t,e),i_t=()=>({state:t,dispatch:e})=>DFe(t,e),o_t=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Ase(t.doc,t.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},l_t=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Ase(t.doc,t.selection.$from.pos,1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},c_t=()=>({state:t,dispatch:e})=>evt(t,e),d_t=()=>({state:t,dispatch:e})=>tvt(t,e);function XFe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function u_t(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let s,a,o,l;for(let i=0;i({editor:e,view:n,tr:s,dispatch:a})=>{const o=u_t(t).split(/-(?!$)/),l=o.find(p=>!["Alt","Ctrl","Meta","Shift"].includes(p)),i=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),h=e.captureTransaction(()=>{n.someProp("handleKeyDown",p=>p(n,i))});return h==null||h.steps.forEach(p=>{const x=p.map(s.mapping);x&&a&&s.maybeStep(x)}),!0};function mE(t,e,n={}){const{from:s,to:a,empty:o}=t.selection,l=e?vd(e,t.schema):null,i=[];t.doc.nodesBetween(s,a,(y,_)=>{if(y.isText)return;const j=Math.max(s,_),C=Math.min(a,_+y.nodeSize);i.push({node:y,from:j,to:C})});const h=a-s,p=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>Lte(y.node.attrs,n,{strict:!1}));return o?!!p.length:p.reduce((y,_)=>y+_.to-_.from,0)>=h}const f_t=(t,e={})=>({state:n,dispatch:s})=>{const a=vd(t,n.schema);return mE(n,a,e)?svt(n,s):!1},p_t=()=>({state:t,dispatch:e})=>BFe(t,e),m_t=t=>({state:e,dispatch:n})=>{const s=vd(t,e.schema);return gvt(s)(e,n)},g_t=()=>({state:t,dispatch:e})=>FFe(t,e);function $se(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ONe(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((s,a)=>(n.includes(a)||(s[a]=t[a]),s),{})}const x_t=(t,e)=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=$se(typeof t=="string"?t:t.name,s.schema);return i?(i==="node"&&(o=vd(t,s.schema)),i==="mark"&&(l=hv(t,s.schema)),a&&n.selection.ranges.forEach(h=>{s.doc.nodesBetween(h.$from.pos,h.$to.pos,(p,x)=>{o&&o===p.type&&n.setNodeMarkup(x,void 0,ONe(p.attrs,e)),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&n.addMark(x,x+p.nodeSize,l.create(ONe(y.attrs,e)))})})}),!0):!1},y_t=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),v_t=()=>({tr:t,dispatch:e})=>{if(e){const n=new of(t.doc);t.setSelection(n)}return!0},__t=()=>({state:t,dispatch:e})=>LFe(t,e),b_t=()=>({state:t,dispatch:e})=>RFe(t,e),w_t=()=>({state:t,dispatch:e})=>lvt(t,e),j_t=()=>({state:t,dispatch:e})=>uvt(t,e),k_t=()=>({state:t,dispatch:e})=>dvt(t,e);function Hhe(t,e,n={},s={}){return pE(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const N_t=(t,e=!1,n={},s={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var h,p;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=Hhe(t,a.schema,n,{errorOnInvalidContent:(h=s.errorOnInvalidContent)!==null&&h!==void 0?h:a.options.enableContentCheck});return l&&o.replaceWith(0,x.content.size,y).setMeta("preventUpdate",!e),!0}return l&&o.setMeta("preventUpdate",!e),i.insertContentAt({from:0,to:x.content.size},t,{parseOptions:n,errorOnInvalidContent:(p=s.errorOnInvalidContent)!==null&&p!==void 0?p:a.options.enableContentCheck})};function QFe(t,e){const n=hv(e,t.schema),{from:s,to:a,empty:o}=t.selection,l=[];o?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(s,a,h=>{l.push(...h.marks)});const i=l.find(h=>h.type.name===n.name);return i?{...i.attrs}:{}}function S_t(t,e){const n=new WRe(t);return e.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function C_t(t){for(let e=0;e{n(a)&&s.push({node:a,pos:o})}),s}function T_t(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 sye(t){return e=>T_t(e.$from,t)}function A_t(t,e){const n={from:0,to:t.content.size};return HFe(t,n,e)}function E_t(t,e){const n=vd(e,t.schema),{from:s,to:a}=t.selection,o=[];t.doc.nodesBetween(s,a,i=>{o.push(i)});const l=o.reverse().find(i=>i.type.name===n.name);return l?{...l.attrs}:{}}function JFe(t,e){const n=$se(typeof e=="string"?e:e.name,t.schema);return n==="node"?E_t(t,e):n==="mark"?QFe(t,e):{}}function I_t(t,e=JSON.stringify){const n={};return t.filter(s=>{const a=e(s);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function P_t(t){const e=I_t(t);return e.length===1?e:e.filter((n,s)=>!e.filter((o,l)=>l!==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 L_t(t){const{mapping:e,steps:n}=t,s=[];return e.maps.forEach((a,o)=>{const l=[];if(a.ranges.length)a.forEach((i,h)=>{l.push({from:i,to:h})});else{const{from:i,to:h}=n[o];if(i===void 0||h===void 0)return;l.push({from:i,to:h})}l.forEach(({from:i,to:h})=>{const p=e.slice(o).map(i,-1),x=e.slice(o).map(h),y=e.invert().map(p,-1),_=e.invert().map(x);s.push({oldRange:{from:y,to:_},newRange:{from:p,to:x}})})}),P_t(s)}function aye(t,e,n){const s=[];return t===e?n.resolve(t).marks().forEach(a=>{const o=n.resolve(t),l=rye(o,a.type);l&&s.push({mark:a,...l})}):n.nodesBetween(t,e,(a,o)=>{!a||(a==null?void 0:a.nodeSize)===void 0||s.push(...a.marks.map(l=>({from:o,to:o+a.nodeSize,mark:l})))}),s}function cee(t,e,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const a=t.find(o=>o.type===e&&o.name===s);return a?a.attribute.keepOnSplit:!1}))}function Whe(t,e,n={}){const{empty:s,ranges:a}=t.selection,o=e?hv(e,t.schema):null;if(s)return!!(t.storedMarks||t.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>Lte(y.attrs,n,{strict:!1}));let l=0;const i=[];if(a.forEach(({$from:y,$to:_})=>{const j=y.pos,C=_.pos;t.doc.nodesBetween(j,C,(N,A)=>{if(!N.isText&&!N.marks.length)return;const E=Math.max(j,A),T=Math.min(C,A+N.nodeSize),P=T-E;l+=P,i.push(...N.marks.map(z=>({mark:z,from:E,to:T})))})}),l===0)return!1;const h=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>Lte(y.mark.attrs,n,{strict:!1})).reduce((y,_)=>y+_.to-_.from,0),p=i.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,_)=>y+_.to-_.from,0);return(h>0?h+p:h)>=l}function O_t(t,e,n={}){if(!e)return mE(t,null,n)||Whe(t,null,n);const s=$se(e,t.schema);return s==="node"?mE(t,e,n):s==="mark"?Whe(t,e,n):!1}function DNe(t,e){const{nodeExtensions:n}=Fse(e),s=n.find(l=>l.name===t);if(!s)return!1;const a={name:s.name,options:s.options,storage:s.storage},o=hi(ks(s,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function iye(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 a=!0;return t.content.forEach(o=>{a!==!1&&(iye(o,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function D_t(t){return t instanceof aa}function R_t(t,e,n){var s;const{selection:a}=e;let o=null;if(KFe(a)&&(o=a.$cursor),o){const i=(s=t.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(i)||!i.some(h=>h.type.excludes(n))}const{ranges:l}=a;return l.some(({$from:i,$to:h})=>{let p=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(i.pos,h.pos,(x,y,_)=>{if(p)return!1;if(x.isInline){const j=!_||_.type.allowsMarkType(n),C=!!n.isInSet(x.marks)||!x.marks.some(N=>N.type.excludes(n));p=j&&C}return!p}),p})}const F_t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{const{selection:o}=n,{empty:l,ranges:i}=o,h=hv(t,s.schema);if(a)if(l){const p=QFe(s,h);n.addStoredMark(h.create({...p,...e}))}else i.forEach(p=>{const x=p.$from.pos,y=p.$to.pos;s.doc.nodesBetween(x,y,(_,j)=>{const C=Math.max(j,x),N=Math.min(j+_.nodeSize,y);_.marks.find(E=>E.type===h)?_.marks.forEach(E=>{h===E.type&&n.addMark(C,N,h.create({...E.attrs,...e}))}):n.addMark(C,N,h.create(e))})});return R_t(s,n,h)},z_t=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),B_t=(t,e={})=>({state:n,dispatch:s,chain:a})=>{const o=vd(t,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?a().command(({commands:i})=>ANe(o,{...l,...e})(n)?!0:i.clearNodes()).command(({state:i})=>ANe(o,{...l,...e})(i,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},$_t=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,a=Hw(t,0,s.content.size),o=aa.create(s,a);e.setSelection(o)}return!0},U_t=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,{from:a,to:o}=typeof t=="number"?{from:t,to:t}:t,l=Va.atStart(s).from,i=Va.atEnd(s).to,h=Hw(a,l,i),p=Hw(o,l,i),x=Va.create(s,h,p);e.setSelection(x)}return!0},q_t=t=>({state:e,dispatch:n})=>{const s=vd(t,e.schema);return vvt(s)(e,n)};function RNe(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const s=n.filter(a=>e==null?void 0:e.includes(a.type.name));t.tr.ensureMarks(s)}}const V_t=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:s,editor:a})=>{const{selection:o,doc:l}=e,{$from:i,$to:h}=o,p=a.extensionManager.attributes,x=cee(p,i.node().type.name,i.node().attrs);if(o instanceof aa&&o.node.isBlock)return!i.parentOffset||!Xx(l,i.pos)?!1:(s&&(t&&RNe(n,a.extensionManager.splittableMarks),e.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const y=h.parentOffset===h.parent.content.size,_=i.depth===0?void 0:C_t(i.node(-1).contentMatchAt(i.indexAfter(-1)));let j=y&&_?[{type:_,attrs:x}]:void 0,C=Xx(e.doc,e.mapping.map(i.pos),1,j);if(!j&&!C&&Xx(e.doc,e.mapping.map(i.pos),1,_?[{type:_}]:void 0)&&(C=!0,j=_?[{type:_,attrs:x}]:void 0),s){if(C&&(o instanceof Va&&e.deleteSelection(),e.split(e.mapping.map(i.pos),1,j),_&&!y&&!i.parentOffset&&i.parent.type!==_)){const N=e.mapping.map(i.before()),A=e.doc.resolve(N);i.node(-1).canReplaceWith(A.index(),A.index()+1,_)&&e.setNodeMarkup(e.mapping.map(i.before()),_)}t&&RNe(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return C},H_t=(t,e={})=>({tr:n,state:s,dispatch:a,editor:o})=>{var l;const i=vd(t,s.schema),{$from:h,$to:p}=s.selection,x=s.selection.node;if(x&&x.isBlock||h.depth<2||!h.sameParent(p))return!1;const y=h.node(-1);if(y.type!==i)return!1;const _=o.extensionManager.attributes;if(h.parent.content.size===0&&h.node(-1).childCount===h.indexAfter(-1)){if(h.depth===2||h.node(-3).type!==i||h.index(-2)!==h.node(-2).childCount-1)return!1;if(a){let E=_n.empty;const T=h.index(-1)?1:h.index(-2)?2:3;for(let K=h.depth-T;K>=h.depth-3;K-=1)E=_n.from(h.node(K).copy(E));const P=h.indexAfter(-1){if(V>-1)return!1;K.isTextblock&&K.content.size===0&&(V=G+1)}),V>-1&&n.setSelection(Va.near(n.doc.resolve(V))),n.scrollIntoView()}return!0}const j=p.pos===h.end()?y.contentMatchAt(0).defaultType:null,C={...cee(_,y.type.name,y.attrs),...e},N={...cee(_,h.node().type.name,h.node().attrs),...e};n.delete(h.pos,p.pos);const A=j?[{type:i,attrs:C},{type:j,attrs:N}]:[{type:i,attrs:C}];if(!Xx(n.doc,h.pos,2))return!1;if(a){const{selection:E,storedMarks:T}=s,{splittableMarks:P}=o.extensionManager,z=T||E.$to.parentOffset&&E.$from.marks();if(n.split(h.pos,2,A).scrollIntoView(),!z||!a)return!0;const F=z.filter(q=>P.includes(q.type.name));n.ensureMarks(F)}return!0},vce=(t,e)=>{const n=sye(l=>l.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 a=t.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&dv(t.doc,n.pos)&&t.join(n.pos),!0},_ce=(t,e)=>{const n=sye(l=>l.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 a=t.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&dv(t.doc,s)&&t.join(s),!0},W_t=(t,e,n,s={})=>({editor:a,tr:o,state:l,dispatch:i,chain:h,commands:p,can:x})=>{const{extensions:y,splittableMarks:_}=a.extensionManager,j=vd(t,l.schema),C=vd(e,l.schema),{selection:N,storedMarks:A}=l,{$from:E,$to:T}=N,P=E.blockRange(T),z=A||N.$to.parentOffset&&N.$from.marks();if(!P)return!1;const F=sye(q=>DNe(q.type.name,y))(N);if(P.depth>=1&&F&&P.depth-F.depth<=1){if(F.node.type===j)return p.liftListItem(C);if(DNe(F.node.type.name,y)&&j.validContent(F.node.content)&&i)return h().command(()=>(o.setNodeMarkup(F.pos,j),!0)).command(()=>vce(o,j)).command(()=>_ce(o,j)).run()}return!n||!z||!i?h().command(()=>x().wrapInList(j,s)?!0:p.clearNodes()).wrapInList(j,s).command(()=>vce(o,j)).command(()=>_ce(o,j)).run():h().command(()=>{const q=x().wrapInList(j,s),V=z.filter(K=>_.includes(K.type.name));return o.ensureMarks(V),q?!0:p.clearNodes()}).wrapInList(j,s).command(()=>vce(o,j)).command(()=>_ce(o,j)).run()},G_t=(t,e={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:o=!1}=n,l=hv(t,s.schema);return Whe(s,l,e)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,e)},K_t=(t,e,n={})=>({state:s,commands:a})=>{const o=vd(t,s.schema),l=vd(e,s.schema),i=mE(s,o,n);let h;return s.selection.$anchor.sameParent(s.selection.$head)&&(h=s.selection.$anchor.parent.attrs),i?a.setNode(l,h):a.setNode(o,{...h,...n})},Z_t=(t,e={})=>({state:n,commands:s})=>{const a=vd(t,n.schema);return mE(n,a,e)?s.lift(a):s.wrapIn(a,e)},Y_t=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let s=0;s=0;h-=1)l.step(i.steps[h].invert(i.docs[h]));if(o.text){const h=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,t.schema.text(o.text,h))}else l.delete(o.from,o.to)}return!0}}return!1},X_t=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:s,ranges:a}=n;return s||e&&a.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},Q_t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=e,{selection:i}=n,h=hv(t,s.schema),{$from:p,empty:x,ranges:y}=i;if(!a)return!0;if(x&&l){let{from:_,to:j}=i;const C=(o=p.marks().find(A=>A.type===h))===null||o===void 0?void 0:o.attrs,N=rye(p,h,C);N&&(_=N.from,j=N.to),n.removeMark(_,j,h)}else y.forEach(_=>{n.removeMark(_.$from.pos,_.$to.pos,h)});return n.removeStoredMark(h),!0},J_t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=$se(typeof t=="string"?t:t.name,s.schema);return i?(i==="node"&&(o=vd(t,s.schema)),i==="mark"&&(l=hv(t,s.schema)),a&&n.selection.ranges.forEach(h=>{const p=h.$from.pos,x=h.$to.pos;let y,_,j,C;n.selection.empty?s.doc.nodesBetween(p,x,(N,A)=>{o&&o===N.type&&(j=Math.max(A,p),C=Math.min(A+N.nodeSize,x),y=A,_=N)}):s.doc.nodesBetween(p,x,(N,A)=>{A=p&&A<=x&&(o&&o===N.type&&n.setNodeMarkup(A,void 0,{...N.attrs,...e}),l&&N.marks.length&&N.marks.forEach(E=>{if(l===E.type){const T=Math.max(A,p),P=Math.min(A+N.nodeSize,x);n.addMark(T,P,l.create({...E.attrs,...e}))}}))}),_&&(y!==void 0&&n.setNodeMarkup(y,void 0,{..._.attrs,...e}),l&&_.marks.length&&_.marks.forEach(N=>{l===N.type&&n.addMark(j,C,l.create({...N.attrs,...e}))}))}),!0):!1},e2t=(t,e={})=>({state:n,dispatch:s})=>{const a=vd(t,n.schema);return hvt(a,e)(n,s)},t2t=(t,e={})=>({state:n,dispatch:s})=>{const a=vd(t,n.schema);return fvt(a,e)(n,s)};var r2t=Object.freeze({__proto__:null,blur:Dvt,clearContent:Rvt,clearNodes:Fvt,command:zvt,createParagraphNear:Bvt,cut:$vt,deleteCurrentNode:Uvt,deleteNode:qvt,deleteRange:Vvt,deleteSelection:Hvt,enter:Wvt,exitCode:Gvt,extendMarkRange:Kvt,first:Zvt,focus:Xvt,forEach:Qvt,insertContent:Jvt,insertContentAt:r_t,joinBackward:a_t,joinDown:s_t,joinForward:i_t,joinItemBackward:o_t,joinItemForward:l_t,joinTextblockBackward:c_t,joinTextblockForward:d_t,joinUp:n_t,keyboardShortcut:h_t,lift:f_t,liftEmptyBlock:p_t,liftListItem:m_t,newlineInCode:g_t,resetAttributes:x_t,scrollIntoView:y_t,selectAll:v_t,selectNodeBackward:__t,selectNodeForward:b_t,selectParentNode:w_t,selectTextblockEnd:j_t,selectTextblockStart:k_t,setContent:N_t,setMark:F_t,setMeta:z_t,setNode:B_t,setNodeSelection:$_t,setTextSelection:U_t,sinkListItem:q_t,splitBlock:V_t,splitListItem:H_t,toggleList:W_t,toggleMark:G_t,toggleNode:K_t,toggleWrap:Z_t,undoInputRule:Y_t,unsetAllMarks:X_t,unsetMark:Q_t,updateAttributes:J_t,wrapIn:e2t,wrapInList:t2t});const n2t=Ud.create({name:"commands",addCommands(){return{...r2t}}}),s2t=Ud.create({name:"drop",addProseMirrorPlugins(){return[new Vd({key:new mf("tiptapDrop"),props:{handleDrop:(t,e,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:s})}}})]}}),a2t=Ud.create({name:"editable",addProseMirrorPlugins(){return[new Vd({key:new mf("editable"),props:{editable:()=>this.editor.options.editable}})]}}),i2t=new mf("focusEvents"),o2t=Ud.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Vd({key:i2t,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}}}})]}}),l2t=Ud.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:i})=>{const{selection:h,doc:p}=i,{empty:x,$anchor:y}=h,{pos:_,parent:j}=y,C=y.parent.isTextblock&&_>0?i.doc.resolve(_-1):y,N=C.parent.type.spec.isolating,A=y.pos-y.parentOffset,E=N&&C.parent.childCount===1?A===y.pos:ui.atStart(p).from===_;return!x||!j.type.isTextblock||j.textContent.length||!E||E&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.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()},a={...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 nye()||XFe()?o:a},addProseMirrorPlugins(){return[new Vd({key:new mf("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(N=>N.getMeta("composition")))return;const s=t.some(N=>N.docChanged)&&!e.doc.eq(n.doc),a=t.some(N=>N.getMeta("preventClearDocument"));if(!s||a)return;const{empty:o,from:l,to:i}=e.selection,h=ui.atStart(e.doc).from,p=ui.atEnd(e.doc).to;if(o||!(l===h&&i===p)||!iye(n.doc))return;const _=n.tr,j=Dse({state:n,transaction:_}),{commands:C}=new Rse({editor:this.editor,state:j});if(C.clearNodes(),!!_.steps.length)return _}})]}}),c2t=Ud.create({name:"paste",addProseMirrorPlugins(){return[new Vd({key:new mf("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),d2t=Ud.create({name:"tabindex",addProseMirrorPlugins(){return[new Vd({key:new mf("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ow{get name(){return this.node.type.name}constructor(e,n,s=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=e,this.editor=n,this.currentNode=a}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 a=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=this.pos+s+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(l);if(!a&&i.depth<=this.depth)return;const h=new Ow(i,this.editor,a,a?n:null);a&&(h.actualDepth=this.depth+1),e.push(new Ow(i,this.editor,a,a?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,a=this.parent;for(;a&&!s;){if(a.node.type.name===e)if(Object.keys(n).length>0){const o=a.node.attrs,l=Object.keys(n);for(let i=0;i{s&&a.length>0||(l.node.type.name===e&&o.every(h=>n[h]===l.node.attrs[h])&&a.push(l),!(s&&a.length>0)&&(a=a.concat(l.querySelectorAll(e,n,s))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const u2t=`.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 h2t(t,e,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}class f2t extends _vt{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:a})=>this.options.onDrop(n,s,a)),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=h2t(u2t,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=VFe(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let s=n;if([].concat(e).forEach(o=>{const l=typeof o=="string"?`${o}$`:o.key;s=s.filter(i=>!i.key.startsWith(l))}),n.length===s.length)return;const a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}createExtensionManager(){var e,n;const a=[...this.options.enableCoreExtensions?[a2t,Ovt.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),n2t,o2t,l2t,d2t,s2t,c2t].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 F4(a,this)}createCommandManager(){this.commandManager=new Rse({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Hhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(i=>i.name!=="collaboration"),this.createExtensionManager()}}),n=Hhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=ZFe(n,this.options.autofocus);this.view=new TFe(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:R4.create({doc:n,selection:s||void 0})});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),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(l=>{var i;return(i=this.capturedTransaction)===null||i===void 0?void 0:i.step(l)});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 a=e.getMeta("focus"),o=e.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.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 JFe(this.state,e)}isActive(e,n){const s=typeof e=="string"?e:null,a=typeof e=="string"?n:e;return O_t(this.state,s,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return eye(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` `,textSerializers:s={}}=e||{};return A_t(this.state.doc,{blockSeparator:n,textSerializers:{...WFe(this.schema),...s}})}get isEmpty(){return iye(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 bC(t){return new zse({find:t.find,handler:({state:e,range:n,match:s})=>{const a=hi(t.getAttributes,void 0,s);if(a===!1||a===null)return null;const{tr:o}=e,l=s[s.length-1],i=s[0];if(l){const h=i.search(/\S/),p=n.from+i.indexOf(l),x=p+l.length;if(aye(n.from,n.to,e.doc).filter(j=>j.mark.type.excluded.find(N=>N===t.type&&N!==j.mark.type)).filter(j=>j.to>p).length)return null;xn.from&&o.delete(n.from+h,p);const _=n.from+h+l.length;o.addMark(n.from+h,_,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}function p2t(t){return new zse({find:t.find,handler:({state:e,range:n,match:s})=>{const a=hi(t.getAttributes,void 0,s)||{},{tr:o}=e,l=n.from;let i=n.to;const h=t.type.create(a);if(s[1]){const p=s[0].lastIndexOf(s[1]);let x=l+p;x>i?x=i:i=x+s[1].length;const y=s[0][s[0].length-1];o.insertText(y,l+s[0].length-1),o.replaceWith(x,i,h)}else if(s[0]){const p=t.type.isInline?l:l-1;o.insert(p,t.type.create(a)).delete(o.mapping.map(l),o.mapping.map(i))}o.scrollIntoView()}})}function Ghe(t){return new zse({find:t.find,handler:({state:e,range:n,match:s})=>{const a=e.doc.resolve(n.from),o=hi(t.getAttributes,void 0,s)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function gE(t){return new zse({find:t.find,handler:({state:e,range:n,match:s,chain:a})=>{const o=hi(t.getAttributes,void 0,s)||{},l=e.tr.delete(n.from,n.to),h=l.doc.resolve(n.from).blockRange(),p=h&&Fxe(h,t.type,o);if(!p)return null;if(l.wrap(h,p),t.keepMarks&&t.editor){const{selection:y,storedMarks:_}=e,{splittableMarks:j}=t.editor.extensionManager,C=_||y.$to.parentOffset&&y.$from.marks();if(C){const N=C.filter(A=>j.includes(A.type.name));l.ensureMarks(N)}}if(t.keepAttributes){const y=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(y,o).run()}const x=l.doc.resolve(n.from-1).nodeBefore;x&&x.type===t.type&&dv(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(s,x))&&l.join(n.from-1)}})}let Tm=class Khe{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=hi(ks(this,"addOptions",{name:this.name}))),this.storage=hi(ks(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Khe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Bse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Khe(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=hi(ks(n,"addOptions",{name:n.name})),n.storage=hi(ks(n,"addStorage",{name:n.name,options:n.options})),n}};function Yj(t){return new Tvt({find:t.find,handler:({state:e,range:n,match:s,pasteEvent:a})=>{const o=hi(t.getAttributes,void 0,s,a);if(o===!1||o===null)return null;const{tr:l}=e,i=s[s.length-1],h=s[0];let p=n.to;if(i){const x=h.search(/\S/),y=n.from+h.indexOf(i),_=y+i.length;if(aye(n.from,n.to,e.doc).filter(C=>C.mark.type.excluded.find(A=>A===t.type&&A!==C.mark.type)).filter(C=>C.to>y).length)return null;_n.from&&l.delete(n.from+x,y),p=n.from+x+i.length,l.addMark(n.from+x,p,t.type.create(o||{})),l.removeStoredMark(t.type)}}})}function m2t(t,e){const{selection:n}=t,{$from:s}=n;if(n instanceof aa){const o=s.index();return s.parent.canReplaceWith(o,o+1,e)}let a=s.depth;for(;a>=0;){const o=s.index(a);if(s.node(a).contentMatchAt(o).matchType(e))return!0;a-=1}return!1}function g2t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var eze={exports:{}},bce={};/** * @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 FNe;function x2t(){if(FNe)return bce;FNe=1;var t=st;function e(y,_){return y===_&&(y!==0||1/y===1/_)||y!==y&&_!==_}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,o=t.useLayoutEffect,l=t.useDebugValue;function i(y,_){var j=_(),C=s({inst:{value:j,getSnapshot:_}}),N=C[0].inst,A=C[1];return o(function(){N.value=j,N.getSnapshot=_,h(N)&&A({inst:N})},[y,j,_]),a(function(){return h(N)&&A({inst:N}),y(function(){h(N)&&A({inst:N})})},[y]),l(j),j}function h(y){var _=y.getSnapshot;y=y.value;try{var j=_();return!n(y,j)}catch{return!0}}function p(y,_){return _()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:i;return bce.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:x,bce}eze.exports=x2t();var oye=eze.exports;const y2t=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},v2t=({contentComponent:t})=>{const e=oye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return st.createElement(st.Fragment,null,Object.values(e))};function _2t(){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]:Ome.createPortal(s.reactElement,s.element,n)},t.forEach(a=>a())},removeRenderer(n){const s={...e};delete s[n],e=s,t.forEach(a=>a())}}}class b2t extends st.Component{constructor(e){var n;super(e),this.editorContentRef=st.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=_2t(),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 st.createElement(st.Fragment,null,st.createElement("div",{ref:y2t(n,this.editorContentRef),...s}),(e==null?void 0:e.contentComponent)&&st.createElement(v2t,{contentComponent:e.contentComponent}))}}const w2t=I.forwardRef((t,e)=>{const n=st.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return st.createElement(b2t,{key:n,innerRef:e,...t})}),tze=st.memo(w2t);var j2t=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,a,o;if(Array.isArray(e)){if(s=e.length,s!=n.length)return!1;for(a=s;a--!==0;)if(!t(e[a],n[a]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(a of e.entries())if(!n.has(a[0]))return!1;for(a of e.entries())if(!t(a[1],n.get(a[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(a of e.entries())if(!n.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(s=e.length,s!=n.length)return!1;for(a=s;a--!==0;)if(e[a]!==n[a])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(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=s;a--!==0;){var l=o[a];if(!(l==="_owner"&&e.$$typeof)&&!t(e[l],n[l]))return!1}return!0}return e!==e&&n!==n},k2t=g2t(j2t),rze={exports:{}},wce={};/** * @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 zNe;function N2t(){if(zNe)return wce;zNe=1;var t=st,e=oye;function n(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var s=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,o=t.useRef,l=t.useEffect,i=t.useMemo,h=t.useDebugValue;return wce.useSyncExternalStoreWithSelector=function(p,x,y,_,j){var C=o(null);if(C.current===null){var N={hasValue:!1,value:null};C.current=N}else N=C.current;C=i(function(){function E(q){if(!T){if(T=!0,P=q,q=_(q),j!==void 0&&N.hasValue){var V=N.value;if(j(V,q))return z=V}return z=q}if(V=z,s(P,q))return V;var K=_(q);return j!==void 0&&j(V,K)?V:(P=q,z=K)}var T=!1,P,z,F=y===void 0?null:y;return[function(){return E(x())},F===null?void 0:function(){return E(F())}]},[x,y,_,j]);var A=a(p,C[0],C[1]);return l(function(){N.hasValue=!0,N.value=A},[A]),h(A),A},wce}rze.exports=N2t();var S2t=rze.exports;const C2t=typeof window<"u"?I.useLayoutEffect:I.useEffect;class M2t{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(a=>a())},s=this.editor;return s.on("transaction",n),()=>{s.off("transaction",n)}}}}function T2t(t){var e;const[n]=I.useState(()=>new M2t(t.editor)),s=S2t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:k2t);return C2t(()=>n.watch(t.editor),[t.editor,n]),I.useDebugValue(s),s}const A2t=!1,Zhe=typeof window>"u",E2t=Zhe||!!(typeof window<"u"&&window.next);class lye{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?Zhe||E2t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...s)=>{var a,o;return(o=(a=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(a,...s)},onBlur:(...s)=>{var a,o;return(o=(a=this.options.current).onBlur)===null||o===void 0?void 0:o.call(a,...s)},onCreate:(...s)=>{var a,o;return(o=(a=this.options.current).onCreate)===null||o===void 0?void 0:o.call(a,...s)},onDestroy:(...s)=>{var a,o;return(o=(a=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(a,...s)},onFocus:(...s)=>{var a,o;return(o=(a=this.options.current).onFocus)===null||o===void 0?void 0:o.call(a,...s)},onSelectionUpdate:(...s)=>{var a,o;return(o=(a=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(a,...s)},onTransaction:(...s)=>{var a,o;return(o=(a=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(a,...s)},onUpdate:(...s)=>{var a,o;return(o=(a=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(a,...s)},onContentError:(...s)=>{var a,o;return(o=(a=this.options.current).onContentError)===null||o===void 0?void 0:o.call(a,...s)},onDrop:(...s)=>{var a,o;return(o=(a=this.options.current).onDrop)===null||o===void 0?void 0:o.call(a,...s)},onPaste:(...s)=>{var a,o;return(o=(a=this.options.current).onPaste)===null||o===void 0?void 0:o.call(a,...s)}};return new f2t(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((a,o)=>{var l;return a===((l=n.extensions)===null||l===void 0?void 0:l[o])}):e[s]===n[s])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?lye.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,a)=>s===e[a]))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 nze(t={},e=[]){const n=I.useRef(t);n.current=t;const[s]=I.useState(()=>new lye(n)),a=oye.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return I.useDebugValue(a),I.useEffect(s.onRender(e)),T2t({editor:a,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),a}const I2t=I.createContext({editor:null});I2t.Consumer;const P2t=I.createContext({onDragStart:void 0}),L2t=()=>I.useContext(P2t);st.forwardRef((t,e)=>{const{onDragStart:n}=L2t(),s=t.as||"div";return st.createElement(s,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const O2t=/^\s*>\s$/,D2t=Tm.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",_d(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[gE({find:O2t,type:this.type})]}}),R2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,F2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,z2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,B2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$2t=Rg.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",_d(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[bC({find:R2t,type:this.type}),bC({find:z2t,type:this.type})]},addPasteRules(){return[Yj({find:F2t,type:this.type}),Yj({find:B2t,type:this.type})]}}),U2t="listItem",BNe="textStyle",$Ne=/^\s*([-+*])\s$/,q2t=Tm.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",_d(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(U2t,this.editor.getAttributes(BNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=gE({find:$Ne,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=gE({find:$Ne,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(BNe),editor:this.editor})),[t]}}),V2t=/(^|[^`])`([^`]+)`(?!`)/,H2t=/(^|[^`])`([^`]+)`(?!`)/g,W2t=Rg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",_d(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[bC({find:V2t,type:this.type})]},addPasteRules(){return[Yj({find:H2t,type:this.type})]}}),G2t=/^```([a-z]+)?[\s\n]$/,K2t=/^~~~([a-z]+)?[\s\n]$/,Z2t=Tm.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(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",_d(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:a}=n;if(!a||s.parent.type!==this.type)return!1;const o=s.parentOffset===s.parent.nodeSize-2,l=s.parent.textContent.endsWith(` `);return!o||!l?!1:t.chain().command(({tr:i})=>(i.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:a,empty:o}=n;if(!o||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const i=a.after();return i===void 0?!1:s.nodeAt(i)?t.commands.command(({tr:p})=>(p.setSelection(ui.near(s.resolve(i))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ghe({find:G2t,type:this.type,getAttributes:t=>({language:t[1]})}),Ghe({find:K2t,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Vd({key:new mf("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"),a=s?JSON.parse(s):void 0,o=a==null?void 0:a.mode;if(!n||!o)return!1;const{tr:l,schema:i}=t.state,h=i.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},h)),l.selection.$from.parent.type!==this.type&&l.setSelection(Va.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),Y2t=Tm.create({name:"doc",topNode:!0,content:"block+"});function X2t(t={}){return new Vd({view(e){return new Q2t(e,t)}})}class Q2t{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(a=>{let o=l=>{this[a](l)};return e.dom.addEventListener(a,o),{name:a,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,a=this.editorView.dom,o=a.getBoundingClientRect(),l=o.width/a.offsetWidth,i=o.height/a.offsetHeight;if(n){let y=e.nodeBefore,_=e.nodeAfter;if(y||_){let j=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(j){let C=j.getBoundingClientRect(),N=y?C.bottom:C.top;y&&_&&(N=(N+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let A=this.width/2*i;s={left:C.left,right:C.right,top:N-A,bottom:N+A}}}}if(!s){let y=this.editorView.coordsAtPos(this.cursorPos),_=this.width/2*l;s={left:y.left-_,right:y.left+_,top:y.top,bottom:y.bottom}}let h=this.editorView.dom.offsetParent;this.element||(this.element=h.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 p,x;if(!h||h==document.body&&getComputedStyle(h).position=="static")p=-pageXOffset,x=-pageYOffset;else{let y=h.getBoundingClientRect(),_=y.width/h.offsetWidth,j=y.height/h.offsetHeight;p=y.left-h.scrollLeft*_,x=y.top-h.scrollTop*j}this.element.style.left=(s.left-p)/l+"px",this.element.style.top=(s.top-x)/i+"px",this.element.style.width=(s.right-s.left)/l+"px",this.element.style.height=(s.bottom-s.top)/i+"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),a=s&&s.type.spec.disableDropCursor,o=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=$Re(this.editorView.state.doc,l,this.editorView.dragging.slice);i!=null&&(l=i)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const J2t=Ud.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[X2t(this.options)]}});class Yl extends ui{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return Yl.valid(s)?new Yl(s):ui.near(s)}content(){return fs.empty}eq(e){return e instanceof Yl&&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 Yl(e.resolve(n.pos))}getBookmark(){return new cye(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!ebt(e)||!tbt(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&Yl.valid(e))return e;let a=e.pos,o=null;for(let l=e.depth;;l--){let i=e.node(l);if(n>0?e.indexAfter(l)0){o=i.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;a+=n;let h=e.doc.resolve(a);if(Yl.valid(h))return h}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!aa.isSelectable(o)){e=e.doc.resolve(a+o.nodeSize*n),s=!1;continue e}break}o=l,a+=n;let i=e.doc.resolve(a);if(Yl.valid(i))return i}return null}}}Yl.prototype.visible=!1;Yl.findFrom=Yl.findGapCursorFrom;ui.jsonID("gapcursor",Yl);class cye{constructor(e){this.pos=e}map(e){return new cye(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Yl.valid(n)?new Yl(n):ui.near(n)}}function sze(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function ebt(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 a=s.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||sze(a.type))return!0;if(a.inlineContent)return!1}}return!0}function tbt(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 a=s.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||sze(a.type))return!0;if(a.inlineContent)return!1}}return!0}function rbt(){return new Vd({props:{decorations:ibt,createSelectionBetween(t,e,n){return e.pos==n.pos&&Yl.valid(n)?new Yl(n):null},handleClick:sbt,handleKeyDown:nbt,handleDOMEvents:{beforeinput:abt}}})}const nbt=AFe({ArrowLeft:PL("horiz",-1),ArrowRight:PL("horiz",1),ArrowUp:PL("vert",-1),ArrowDown:PL("vert",1)});function PL(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,a,o){let l=s.selection,i=e>0?l.$to:l.$from,h=l.empty;if(l instanceof Va){if(!o.endOfTextblock(n)||i.depth==0)return!1;h=!1,i=s.doc.resolve(e>0?i.after():i.before())}let p=Yl.findGapCursorFrom(i,e,h);return p?(a&&a(s.tr.setSelection(new Yl(p))),!0):!1}}function sbt(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!Yl.valid(s))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&aa.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Yl(s))),!0)}function abt(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Yl))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 a=_n.empty;for(let l=s.length-1;l>=0;l--)a=_n.from(s[l].createAndFill(null,a));let o=t.state.tr.replace(n.pos,n.pos,new fs(a,0,0));return o.setSelection(Va.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function ibt(t){if(!(t.selection instanceof Yl))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",qc.create(t.doc,[Wf.widget(t.selection.head,e,{key:"gapcursor"})])}const obt=Ud.create({name:"gapCursor",addProseMirrorPlugins(){return[rbt()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=hi(ks(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),lbt=Tm.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",_d(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:a,storedMarks:o}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:i}=s.extensionManager,h=o||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:p,dispatch:x})=>{if(x&&h&&l){const y=h.filter(_=>i.includes(_.type.name));p.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cbt=Tm.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]}`,_d(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=>Ghe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ote=200,yd=function(){};yd.prototype.append=function(e){return e.length?(e=yd.from(e),!this.length&&e||e.length=n?yd.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};yd.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};yd.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)};yd.prototype.map=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var a=[];return this.forEach(function(o,l){return a.push(e(o,l))},n,s),a};yd.from=function(e){return e instanceof yd?e:e&&e.length?new aze(e):yd.empty};var aze=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(a,o){return a==0&&o==this.length?this:new e(this.values.slice(a,o))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,o,l,i){for(var h=o;h=l;h--)if(a(this.values[h],i+h)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=Ote)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Ote)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(yd);yd.empty=new aze([]);var dbt=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 si&&this.right.forEachInner(s,Math.max(a-i,0),Math.min(this.length,o)-i,l+i)===!1)return!1},e.prototype.forEachInvertedInner=function(s,a,o,l){var i=this.left.length;if(a>i&&this.right.forEachInvertedInner(s,a-i,Math.max(o,i)-i,l+i)===!1||o=o?this.right.slice(s-o,a-o):this.left.slice(s,o).append(this.right.slice(0,a-o))},e.prototype.leafAppend=function(s){var a=this.right.leafAppend(s);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(s){var a=this.left.leafPrepend(s);if(a)return new e(a,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}(yd);const ubt=500;class im{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 a,o;n&&(a=this.remapping(s,this.items.length),o=a.maps.length);let l=e.tr,i,h,p=[],x=[];return this.items.forEach((y,_)=>{if(!y.step){a||(a=this.remapping(s,_+1),o=a.maps.length),o--,x.push(y);return}if(a){x.push(new tg(y.map));let j=y.step.map(a.slice(o)),C;j&&l.maybeStep(j).doc&&(C=l.mapping.maps[l.mapping.maps.length-1],p.push(new tg(C,void 0,void 0,p.length+x.length))),o--,C&&a.appendMap(C,o)}else l.maybeStep(y.step);if(y.selection)return i=a?y.selection.map(a.slice(o)):y.selection,h=new im(this.items.slice(0,s).append(x.reverse().concat(p)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:l,selection:i}}addTransform(e,n,s,a){let o=[],l=this.eventCount,i=this.items,h=!a&&i.length?i.get(i.length-1):null;for(let x=0;xfbt&&(i=hbt(i,p),l-=p),new im(i.append(o),l)}remapping(e,n){let s=new cE;return this.items.forEach((a,o)=>{let l=a.mirrorOffset!=null&&o-a.mirrorOffset>=e?s.maps.length-a.mirrorOffset:void 0;s.appendMap(a.map,l)},e,n),s}addMaps(e){return this.eventCount==0?this:new im(this.items.append(e.map(n=>new tg(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let s=[],a=Math.max(0,this.items.length-n),o=e.mapping,l=e.steps.length,i=this.eventCount;this.items.forEach(_=>{_.selection&&i--},a);let h=n;this.items.forEach(_=>{let j=o.getMirror(--h);if(j==null)return;l=Math.min(l,j);let C=o.maps[j];if(_.step){let N=e.steps[j].invert(e.docs[j]),A=_.selection&&_.selection.map(o.slice(h+1,j));A&&i++,s.push(new tg(C,N,A))}else s.push(new tg(C))},a);let p=[];for(let _=n;_ubt&&(y=y.compress(this.items.length-s.length)),y}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,a=[],o=0;return this.items.forEach((l,i)=>{if(i>=e)a.push(l),l.selection&&o++;else if(l.step){let h=l.step.map(n.slice(s)),p=h&&h.getMap();if(s--,p&&n.appendMap(p,s),h){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new tg(p.invert(),h,x),_,j=a.length-1;(_=a.length&&a[j].merge(y))?a[j]=_:a.push(y)}}else l.map&&s--},this.items.length,0),new im(yd.from(a.reverse()),o)}}im.empty=new im(yd.empty,0);function hbt(t,e){let n;return t.forEach((s,a)=>{if(s.selection&&e--==0)return n=a,!1}),t.slice(n)}class tg{constructor(e,n,s,a){this.map=e,this.step=n,this.selection=s,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tg(n.getMap().invert(),n,this.selection)}}}class C0{constructor(e,n,s,a,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=a,this.prevComposition=o}}const fbt=20;function pbt(t,e,n,s){let a=n.getMeta(Tj),o;if(a)return a.historyState;n.getMeta(xbt)&&(t=new C0(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(Tj))return l.getMeta(Tj).redo?new C0(t.done.addTransform(n,void 0,s,dee(e)),t.undone,UNe(n.mapping.maps),t.prevTime,t.prevComposition):new C0(t.done,t.undone.addTransform(n,void 0,s,dee(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=n.getMeta("composition"),h=t.prevTime==0||!l&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-s.newGroupDelay||!mbt(n,t.prevRanges)),p=l?jce(t.prevRanges,n.mapping):UNe(n.mapping.maps);return new C0(t.done.addTransform(n,h?e.selection.getBookmark():void 0,s,dee(e)),im.empty,p,n.time,i??t.prevComposition)}else return(o=n.getMeta("rebased"))?new C0(t.done.rebased(n,o),t.undone.rebased(n,o),jce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new C0(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),jce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function mbt(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((s,a)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function UNe(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((s,a,o,l)=>e.push(o,l));return e}function jce(t,e){if(!t)return null;let n=[];for(let s=0;s{let a=Tj.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(s){let o=gbt(a,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const oze=ize(!1,!0),lze=ize(!0,!0),vbt=Ud.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>oze(t,e),redo:()=>({state:t,dispatch:e})=>lze(t,e)}},addProseMirrorPlugins(){return[ybt(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()}}}),_bt=Tm.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",_d(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!m2t(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:s,$to:a}=n,o=t();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:a.pos},{type:this.name}):D_t(n)?o.insertContentAt(a.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:i})=>{var h;if(i){const{$to:p}=l.selection,x=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(Va.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(aa.create(l.doc,p.pos)):l.setSelection(Va.create(l.doc,p.pos));else{const y=(h=p.parent.type.contentMatch.defaultType)===null||h===void 0?void 0:h.create();y&&(l.insert(x,y),l.setSelection(Va.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[p2t({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),bbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,wbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Nbt=Rg.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",_d(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[bC({find:bbt,type:this.type}),bC({find:jbt,type:this.type})]},addPasteRules(){return[Yj({find:wbt,type:this.type}),Yj({find:kbt,type:this.type})]}}),Sbt=Tm.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",_d(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)}}}),Cbt="listItem",VNe="textStyle",HNe=/^(\d+)\.\s$/,Mbt=Tm.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",_d(this.options.HTMLAttributes,n),0]:["ol",_d(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(Cbt,this.editor.getAttributes(VNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=gE({find:HNe,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=gE({find:HNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(VNe)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Tbt=Tm.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",_d(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Abt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ebt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ibt=Rg.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",_d(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[bC({find:Abt,type:this.type})]},addPasteRules(){return[Yj({find:Ebt,type:this.type})]}}),Pbt=Tm.create({name:"text",group:"inline"}),cze=Ud.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push($2t.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(D2t.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(q2t.configure(this.options.bulletList)),this.options.code!==!1&&t.push(W2t.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(Z2t.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Y2t.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(J2t.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(obt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(lbt.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(cbt.configure(this.options.heading)),this.options.history!==!1&&t.push(vbt.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(_bt.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Nbt.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Sbt.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Mbt.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Tbt.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Ibt.configure(this.options.strike)),this.options.text!==!1&&t.push(Pbt.configure(this.options.text)),t}}),Lbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Obt="ελ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",Yhe="numeric",Xhe="ascii",Qhe="alpha",gA="asciinumeric",fT="alphanumeric",Jhe="domain",dze="emoji",Dbt="scheme",Rbt="slashscheme",Nce="whitespace";function Fbt(t,e){return t in e||(e[t]=[]),e[t]}function Ww(t,e,n){e[Yhe]&&(e[gA]=!0,e[fT]=!0),e[Xhe]&&(e[gA]=!0,e[Qhe]=!0),e[gA]&&(e[fT]=!0),e[Qhe]&&(e[fT]=!0),e[fT]&&(e[Jhe]=!0),e[dze]&&(e[Jhe]=!0);for(const s in e){const a=Fbt(s,n);a.indexOf(t)<0&&a.push(t)}}function zbt(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function hh(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}hh.groups={};hh.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,a),ql=(t,e,n,s,a)=>t.tr(e,n,s,a),WNe=(t,e,n,s,a)=>t.ts(e,n,s,a),Nn=(t,e,n,s,a)=>t.tt(e,n,s,a),bx="WORD",efe="UWORD",uze="ASCIINUMERICAL",hze="ALPHANUMERICAL",xE="LOCALHOST",tfe="TLD",rfe="UTLD",uee="SCHEME",k4="SLASH_SCHEME",dye="NUM",nfe="WS",uye="NL",xA="OPENBRACE",yA="CLOSEBRACE",Dte="OPENBRACKET",Rte="CLOSEBRACKET",Fte="OPENPAREN",zte="CLOSEPAREN",Bte="OPENANGLEBRACKET",$te="CLOSEANGLEBRACKET",Ute="FULLWIDTHLEFTPAREN",qte="FULLWIDTHRIGHTPAREN",Vte="LEFTCORNERBRACKET",Hte="RIGHTCORNERBRACKET",Wte="LEFTWHITECORNERBRACKET",Gte="RIGHTWHITECORNERBRACKET",Kte="FULLWIDTHLESSTHAN",Zte="FULLWIDTHGREATERTHAN",Yte="AMPERSAND",Xte="APOSTROPHE",Qte="ASTERISK",M0="AT",Jte="BACKSLASH",ere="BACKTICK",tre="CARET",O0="COLON",hye="COMMA",rre="DOLLAR",rg="DOT",nre="EQUALS",fye="EXCLAMATION",Lf="HYPHEN",vA="PERCENT",sre="PIPE",are="PLUS",ire="POUND",_A="QUERY",pye="QUOTE",fze="FULLWIDTHMIDDLEDOT",mye="SEMI",ng="SLASH",bA="TILDE",ore="UNDERSCORE",pze="EMOJI",lre="SYM";var mze=Object.freeze({__proto__:null,ALPHANUMERICAL:hze,AMPERSAND:Yte,APOSTROPHE:Xte,ASCIINUMERICAL:uze,ASTERISK:Qte,AT:M0,BACKSLASH:Jte,BACKTICK:ere,CARET:tre,CLOSEANGLEBRACKET:$te,CLOSEBRACE:yA,CLOSEBRACKET:Rte,CLOSEPAREN:zte,COLON:O0,COMMA:hye,DOLLAR:rre,DOT:rg,EMOJI:pze,EQUALS:nre,EXCLAMATION:fye,FULLWIDTHGREATERTHAN:Zte,FULLWIDTHLEFTPAREN:Ute,FULLWIDTHLESSTHAN:Kte,FULLWIDTHMIDDLEDOT:fze,FULLWIDTHRIGHTPAREN:qte,HYPHEN:Lf,LEFTCORNERBRACKET:Vte,LEFTWHITECORNERBRACKET:Wte,LOCALHOST:xE,NL:uye,NUM:dye,OPENANGLEBRACKET:Bte,OPENBRACE:xA,OPENBRACKET:Dte,OPENPAREN:Fte,PERCENT:vA,PIPE:sre,PLUS:are,POUND:ire,QUERY:_A,QUOTE:pye,RIGHTCORNERBRACKET:Hte,RIGHTWHITECORNERBRACKET:Gte,SCHEME:uee,SEMI:mye,SLASH:ng,SLASH_SCHEME:k4,SYM:lre,TILDE:bA,TLD:tfe,UNDERSCORE:ore,UTLD:rfe,UWORD:efe,WORD:bx,WS:nfe});const xx=/[a-z]/,UM=new RegExp("\\p{L}","u"),Sce=new RegExp("\\p{Emoji}","u"),yx=/\d/,Cce=/\s/,GNe="\r",Mce=` `,Bbt="️",$bt="‍",Tce="";let LL=null,OL=null;function Ubt(t=[]){const e={};hh.groups=e;const n=new hh;LL==null&&(LL=KNe(Lbt)),OL==null&&(OL=KNe(Obt)),Nn(n,"'",Xte),Nn(n,"{",xA),Nn(n,"}",yA),Nn(n,"[",Dte),Nn(n,"]",Rte),Nn(n,"(",Fte),Nn(n,")",zte),Nn(n,"<",Bte),Nn(n,">",$te),Nn(n,"(",Ute),Nn(n,")",qte),Nn(n,"「",Vte),Nn(n,"」",Hte),Nn(n,"『",Wte),Nn(n,"』",Gte),Nn(n,"<",Kte),Nn(n,">",Zte),Nn(n,"&",Yte),Nn(n,"*",Qte),Nn(n,"@",M0),Nn(n,"`",ere),Nn(n,"^",tre),Nn(n,":",O0),Nn(n,",",hye),Nn(n,"$",rre),Nn(n,".",rg),Nn(n,"=",nre),Nn(n,"!",fye),Nn(n,"-",Lf),Nn(n,"%",vA),Nn(n,"|",sre),Nn(n,"+",are),Nn(n,"#",ire),Nn(n,"?",_A),Nn(n,'"',pye),Nn(n,"/",ng),Nn(n,";",mye),Nn(n,"~",bA),Nn(n,"_",ore),Nn(n,"\\",Jte),Nn(n,"・",fze);const s=ql(n,yx,dye,{[Yhe]:!0});ql(s,yx,s);const a=ql(s,xx,uze,{[gA]:!0}),o=ql(s,UM,hze,{[fT]:!0}),l=ql(n,xx,bx,{[Xhe]:!0});ql(l,yx,a),ql(l,xx,l),ql(a,yx,a),ql(a,xx,a);const i=ql(n,UM,efe,{[Qhe]:!0});ql(i,xx),ql(i,yx,o),ql(i,UM,i),ql(o,yx,o),ql(o,xx),ql(o,UM,o);const h=Nn(n,Mce,uye,{[Nce]:!0}),p=Nn(n,GNe,nfe,{[Nce]:!0}),x=ql(n,Cce,nfe,{[Nce]:!0});Nn(n,Tce,x),Nn(p,Mce,h),Nn(p,Tce,x),ql(p,Cce,x),Nn(x,GNe),Nn(x,Mce),ql(x,Cce,x),Nn(x,Tce,x);const y=ql(n,Sce,pze,{[dze]:!0});Nn(y,"#"),ql(y,Sce,y),Nn(y,Bbt,y);const _=Nn(y,$bt);Nn(_,"#"),ql(_,Sce,y);const j=[[xx,l],[yx,a]],C=[[xx,null],[UM,i],[yx,o]];for(let N=0;NN[0]>A[0]?1:-1);for(let N=0;N=0?T[Jhe]=!0:xx.test(A)?yx.test(A)?T[gA]=!0:T[Xhe]=!0:T[Yhe]=!0,WNe(n,A,A,T)}return WNe(n,"localhost",xE,{ascii:!0}),n.jd=new hh(lre),{start:n,tokens:Object.assign({groups:e},mze)}}function gze(t,e){const n=qbt(e.replace(/[A-Z]/g,i=>i.toLowerCase())),s=n.length,a=[];let o=0,l=0;for(;l=0&&(y+=n[l].length,_++),p+=n[l].length,o+=n[l].length,l++;o-=y,l-=_,p-=y,a.push({t:x.t,v:e.slice(o-p,o),s:o-p,e:o})}return a}function qbt(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(l),s+=l.length}return e}function f0(t,e,n,s,a){let o;const l=e.length;for(let i=0;i=0;)o++;if(o>0){e.push(n.join(""));for(let l=parseInt(t.substring(s,s+o),10);l>0;l--)n.pop();s+=o}else n.push(t[s]),s++}return e}const yE={defaultProtocol:"http",events:null,format:ZNe,formatHref:ZNe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function gye(t,e=null){let n=Object.assign({},yE);t&&(n=Object.assign(n,t instanceof gye?t.o:t));const s=n.ignoreTags,a=[];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=yE.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),a=t.get("tagName",n,e),o=this.toFormattedString(t),l={},i=t.get("className",n,e),h=t.get("target",n,e),p=t.get("rel",n,e),x=t.getObj("attributes",n,e),y=t.getObj("events",n,e);return l.href=s,i&&(l.class=i),h&&(l.target=h),p&&(l.rel=p),x&&Object.assign(l,x),{tagName:a,attributes:l,content:o,eventListeners:y}}};function Use(t,e){class n extends xze{constructor(a,o){super(a,o),this.t=t}}for(const s in e)n.prototype[s]=e[s];return n.t=t,n}const YNe=Use("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),XNe=Use("text"),Vbt=Use("nl"),DL=Use("url",{isLink:!0,toHref(t=yE.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==xE&&t[1].t===O0}}),Af=t=>new hh(t);function Hbt({groups:t}){const e=t.domain.concat([Yte,Qte,M0,Jte,ere,tre,rre,nre,Lf,dye,vA,sre,are,ire,ng,lre,bA,ore]),n=[Xte,O0,hye,rg,fye,vA,_A,pye,mye,Bte,$te,xA,yA,Rte,Dte,Fte,zte,Ute,qte,Vte,Hte,Wte,Gte,Kte,Zte],s=[Yte,Xte,Qte,Jte,ere,tre,rre,nre,Lf,xA,yA,vA,sre,are,ire,_A,ng,lre,bA,ore],a=Af(),o=Nn(a,bA);li(o,s,o),li(o,t.domain,o);const l=Af(),i=Af(),h=Af();li(a,t.domain,l),li(a,t.scheme,i),li(a,t.slashscheme,h),li(l,s,o),li(l,t.domain,l);const p=Nn(l,M0);Nn(o,M0,p),Nn(i,M0,p),Nn(h,M0,p);const x=Nn(o,rg);li(x,s,o),li(x,t.domain,o);const y=Af();li(p,t.domain,y),li(y,t.domain,y);const _=Nn(y,rg);li(_,t.domain,y);const j=Af(YNe);li(_,t.tld,j),li(_,t.utld,j),Nn(p,xE,j);const C=Nn(y,Lf);Nn(C,Lf,C),li(C,t.domain,y),li(j,t.domain,y),Nn(j,rg,_),Nn(j,Lf,C);const N=Nn(j,O0);li(N,t.numeric,YNe);const A=Nn(l,Lf),E=Nn(l,rg);Nn(A,Lf,A),li(A,t.domain,l),li(E,s,o),li(E,t.domain,l);const T=Af(DL);li(E,t.tld,T),li(E,t.utld,T),li(T,t.domain,l),li(T,s,o),Nn(T,rg,E),Nn(T,Lf,A),Nn(T,M0,p);const P=Nn(T,O0),z=Af(DL);li(P,t.numeric,z);const F=Af(DL),q=Af();li(F,e,F),li(F,n,q),li(q,e,F),li(q,n,q),Nn(T,ng,F),Nn(z,ng,F);const V=Nn(i,O0),K=Nn(h,O0),G=Nn(K,ng),te=Nn(G,ng);li(i,t.domain,l),Nn(i,rg,E),Nn(i,Lf,A),li(h,t.domain,l),Nn(h,rg,E),Nn(h,Lf,A),li(V,t.domain,F),Nn(V,ng,F),Nn(V,_A,F),li(te,t.domain,F),li(te,e,F),Nn(te,ng,F);const ie=[[xA,yA],[Dte,Rte],[Fte,zte],[Bte,$te],[Ute,qte],[Vte,Hte],[Wte,Gte],[Kte,Zte]];for(let oe=0;oe=0&&_++,a++,x++;if(_<0)a-=x,a0&&(o.push(Ace(XNe,e,l)),l=[]),a-=_,x-=_;const j=y.t,C=n.slice(a-x,a);o.push(Ace(j,e,C))}}return l.length>0&&o.push(Ace(XNe,e,l)),o}function Ace(t,e,n){const s=n[0].s,a=n[n.length-1].e,o=e.slice(s,a);return new t(o,n)}const Gbt=typeof console<"u"&&console&&console.warn||(()=>{}),Kbt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",dl={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Zbt(){return hh.groups={},dl.scanner=null,dl.parser=null,dl.tokenQueue=[],dl.pluginQueue=[],dl.customSchemes=[],dl.initialized=!1,dl}function QNe(t,e=!1){if(dl.initialized&&Gbt(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Kbt}`),!/^[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`);dl.customSchemes.push([t,e])}function Ybt(){dl.scanner=Ubt(dl.customSchemes);for(let t=0;t{const a=e.some(p=>p.docChanged)&&!n.doc.eq(s.doc),o=e.some(p=>p.getMeta("preventAutolink"));if(!a||o)return;const{tr:l}=s,i=S_t(n.doc,[...e]);if(L_t(i).forEach(({newRange:p})=>{const x=M_t(s.doc,p,j=>j.isTextblock);let y,_;if(x.length>1)y=x[0],_=s.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const j=s.doc.textBetween(p.from,p.to," "," ");if(!Qbt.test(j))return;y=x[0],_=s.doc.textBetween(y.pos,p.to,void 0," ")}if(y&&_){const j=_.split(Xbt).filter(Boolean);if(j.length<=0)return!1;const C=j[j.length-1],N=y.pos+_.lastIndexOf(C);if(!C)return!1;const A=xye(C).map(E=>E.toObject(t.defaultProtocol));if(!ewt(A))return!1;A.filter(E=>E.isLink).map(E=>({...E,from:N+E.start+1,to:N+E.end+1})).filter(E=>s.schema.marks.code?!s.doc.rangeHasMark(E.from,E.to,s.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{aye(E.from,E.to,s.doc).some(T=>T.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function rwt(t){return new Vd({key:new mf("handleClickLink"),props:{handleClick:(e,n,s)=>{var a,o;if(s.button!==0||!e.editable)return!1;let l=s.target;const i=[];for(;l.nodeName!=="DIV";)i.push(l),l=l.parentNode;if(!i.find(_=>_.nodeName==="A"))return!1;const h=JFe(e.state,t.type.name),p=s.target,x=(a=p==null?void 0:p.href)!==null&&a!==void 0?a:h.href,y=(o=p==null?void 0:p.target)!==null&&o!==void 0?o:h.target;return p&&x?(window.open(x,y),!0):!1}}})}function nwt(t){return new Vd({key:new mf("handlePasteLink"),props:{handlePaste:(e,n,s)=>{const{state:a}=e,{selection:o}=a,{empty:l}=o;if(l)return!1;let i="";s.content.forEach(p=>{i+=p.textContent});const h=yze(i,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===i);return!i||!h?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function l_(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(s=>{const a=typeof s=="string"?s:s.scheme;a&&n.push(a)}),!t||t.replace(Jbt,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const vze=Rg.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"){QNe(t);return}QNe(t.scheme,t.optionalSlashes)})},onDestroy(){Zbt()},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)=>!!l_(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=>!!l_(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=>!!l_(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",_d(this.options.HTMLAttributes,t),0]:["a",_d(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!l_(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=>!!l_(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[Yj({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,a=yze(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!l_(l,n),protocols:n,defaultProtocol:s}));a.length&&a.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(twt({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:a=>!!l_(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(rwt({type:this.type})),this.options.linkOnPaste&&t.push(nwt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),_ze=Ud.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")}}}),swt=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var s,a;const o=n.getAttribute("style"),l=(a=(s=n.parentElement)===null||s===void 0?void 0:s.closest("span"))===null||a===void 0?void 0:a.getAttribute("style");n.setAttribute("style",`${l};${o}`)})},bze=Rg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&swt(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",_d(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(a=>a.type===this.type).some(a=>Object.values(a.attrs).some(o=>!!o))||t.removeMark(s,s+n.nodeSize,this.type)}),!0}}}});function yy({content:t,onChange:e,placeholder:n="Enter content...",minHeight:s="150px"}){const[a,o]=I.useState(!1),[l,i]=I.useState(""),[h,p]=I.useState(!0),x=nze({extensions:[cze,vze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),_ze.configure({types:["heading","paragraph"]}),bze],content:t,onUpdate:({editor:C})=>{e(C.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n}}});I.useEffect(()=>{x&&t!==x.getHTML()&&x.commands.setContent(t)},[t,x]);const y=()=>{if(!x)return;const C=x.getAttributes("link").href||"",N=x.getAttributes("link").target;i(C),p(N==="_blank"),o(!0)},_=()=>{x&&(l===""?x.chain().focus().extendMarkRange("link").unsetLink().run():x.chain().focus().extendMarkRange("link").setLink({href:l,target:h?"_blank":null,rel:h?"noopener noreferrer nofollow":null}).run(),o(!1),i(""))},j=()=>{x&&x.chain().focus().extendMarkRange("link").unsetLink().run()};return x?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(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),className:x.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(LT,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),className:x.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(OT,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBold().run(),className:x.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(eS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleItalic().run(),className:x.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(iS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBulletList().run(),className:x.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(Xf,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleOrderedList().run(),className:x.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(cS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("left").run(),className:x.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(Q4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("center").run(),className:x.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("right").run(),className:x.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(J4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:y,className:x.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(Co,{className:"h-4 w-4"})}),x.isActive("link")&&r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:j,title:"Remove Link",children:r.jsx(Co,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().undo().run(),disabled:!x.can().undo(),title:"Undo",children:r.jsx(xS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().redo().run(),disabled:!x.can().redo(),title:"Redo",children:r.jsx(pS,{className:"h-4 w-4"})})]}),r.jsx(tze,{editor:x,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none",style:{minHeight:s}})]}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsx(qr,{children:r.jsx($r,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"link-url",children:"URL"}),r.jsx(dt,{id:"link-url",value:l,onChange:C=>i(C.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ps,{id:"link-new-tab",checked:h,onCheckedChange:p}),r.jsx(He,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{type:"button",onClick:_,children:l?"Apply Link":"Remove Link"})]})]})})]}):null}const qse=async t=>{try{const{data:e,error:n}=await J.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}},RI=async t=>{try{const{data:e,error:n}=await J.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}}},awt=async(t,e)=>await qse("new_templates")?RI({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}),iwt=async(t,e)=>RI({title:"New Academy Video",body:`New video added: ${t}`,url:`/academy/${e}`}),owt=async(t,e)=>await qse("new_events")?RI({title:"New Event",body:`New event: ${t}`,url:`/events/${e}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),lwt=async(t,e)=>await qse("new_toolbox")?RI({title:"New Resource Kit",body:`New resource kit available: ${t}`,url:`/toolbox/${e}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),sfe=async(t,e)=>await qse("new_social_swag")?RI({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}),RL={title:"",description:"",image_url:"",video_url:"",event_date:void 0,event_time:"12:00",zoom_link:"",zoom_meeting_id:"",capacity:"",is_published:!1,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0};function cwt(){const t=Zn(),e=Vr(),[n,s]=I.useState(!1),[a,o]=I.useState(null),[l,i]=I.useState(RL),[h,p]=I.useState(null),[x,y]=I.useState(null),[_,j]=I.useState(!1),C=I.useRef(null),[N,A]=I.useState(!1),[E,T]=I.useState(null),[P,z]=I.useState(!1),[F,q]=I.useState(null),[V,K]=I.useState(null),[G,te]=I.useState(!0),[ie,oe]=I.useState(""),{data:ye,isLoading:ae}=Yt({queryKey:["admin-events"],queryFn:async()=>{const{data:Me,error:ft}=await J.from("events").select("*").order("event_date",{ascending:!0});if(ft)throw ft;return Me}}),{data:pe}=Yt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:Me,error:ft}=await J.from("event_registrations").select("event_id");if(ft)throw ft;const qe={};return Me.forEach(Oe=>{qe[Oe.event_id]=(qe[Oe.event_id]||0)+1}),qe}}),{data:se,isLoading:he}=Yt({queryKey:["event-registrations-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Me,error:ft}=await J.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",E.id).order("registered_at",{ascending:!1});if(ft)throw ft;if(!Me||Me.length===0)return[];const qe=Me.map(nt=>nt.user_id).filter(Boolean);let Oe=[];if(qe.length>0){const{data:nt,error:gt}=await J.from("profiles").select("id, name, email").in("id",qe);if(gt)throw gt;Oe=nt||[]}const Qe=new Map((Oe==null?void 0:Oe.map(nt=>[nt.id,nt]))||[]);return Me.map(nt=>({...nt,profiles:nt.user_id&&Qe.get(nt.user_id)||null}))},enabled:!!E}),{data:ue,isLoading:_e}=Yt({queryKey:["event-attendees-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Me,error:ft}=await J.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",E.id).order("created_at",{ascending:!1});if(ft)throw ft;if(!Me||Me.length===0)return[];const qe=Me.map(mt=>mt.user_id).filter(Boolean);let Oe=[];if(qe.length>0){const{data:mt,error:Mt}=await J.from("profiles").select("id, name, email").in("id",qe);if(Mt)throw Mt;Oe=mt||[]}const{data:Qe}=await J.from("agent_points").select("user_id").eq("event_id",E.id),nt=new Set((Qe==null?void 0:Qe.map(mt=>mt.user_id))||[]),gt=new Map((Oe==null?void 0:Oe.map(mt=>[mt.id,mt]))||[]);return Me.map(mt=>({...mt,profiles:mt.user_id&>.get(mt.user_id)||null,points_awarded:mt.user_id?nt.has(mt.user_id):!1}))},enabled:!!E}),Ae=Me=>{T(Me),A(!0)},Ce=cr({mutationFn:async Me=>{const{data:{session:ft}}=await J.auth.getSession();if(!ft)throw new Error("Not authenticated");const qe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ft.access_token}`},body:JSON.stringify({event_id:Me})}),Oe=await qe.json();if(!qe.ok)throw new Error(Oe.error||"Failed to sync");return Oe},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-registrations-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-registrations-count"]}),ze.success(Me.message)},onError:Me=>{ze.error("Failed to sync: "+Me.message)}}),Se=cr({mutationFn:async Me=>{const{data:{session:ft}}=await J.auth.getSession();if(!ft)throw new Error("Not authenticated");const qe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ft.access_token}`},body:JSON.stringify({event_id:Me})}),Oe=await qe.json();if(!qe.ok)throw new Error(Oe.error||"Failed to sync attendees");return Oe},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]}),Me!=null&&Me.message?ze.success(Me.message):ze.success(`Synced ${Me.synced||0} attendees. ${Me.points_awarded||0} points awarded!`)},onError:Me=>{ze.error("Failed to sync attendees: "+Me.message)}}),ge=cr({mutationFn:async({eventId:Me,testMode:ft})=>{const{data:{session:qe}}=await J.auth.getSession();if(!qe)throw new Error("Not authenticated");const Oe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${qe.access_token}`},body:JSON.stringify({event_id:Me,test_mode:ft})}),Qe=await Oe.json();if(!Oe.ok)throw new Error(Qe.error||"Failed to send reminders");return Qe},onSuccess:Me=>{Me.test?ze.success(Me.message||"Test email sent!"):ze.success(Me.message||`Reminder emails sent to ${Me.sent} registrants!`)},onError:Me=>{ze.error("Failed to send reminders: "+Me.message)}}),{data:Le}=Yt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let Me=[],ft=0;const qe=1e3;for(;;){const{data:Oe,error:Qe}=await J.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(ft,ft+qe-1);if(Qe)throw Qe;if(!Oe||Oe.length===0||(Me=[...Me,...Oe],Oe.length{const{error:Qe}=await J.from("event_attendees").update({user_id:ft}).eq("id",Me);if(Qe)throw Qe;if(Oe&&qe){const{error:gt}=await J.from("zoom_email_aliases").upsert({user_id:ft,zoom_email:qe.toLowerCase()},{onConflict:"zoom_email"});gt&&console.error("Failed to save alias:",gt)}const nt=E==null?void 0:E.id;if(nt){const{data:gt}=await J.from("user_roles").select("id").eq("user_id",ft).eq("role","admin").single();if(!gt){const{data:mt}=await J.from("agent_points").select("id").eq("user_id",ft).eq("event_id",nt).single();mt||(await J.rpc("award_attendance_points",{p_user_id:ft,p_event_id:nt,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await J.rpc("check_and_award_badges",{p_user_id:ft}))}}return{userId:ft,zoomEmail:qe,shouldSaveAlias:Oe}},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]});let ft="Attendee linked and points awarded!";Me.shouldSaveAlias&&Me.zoomEmail&&(ft+=` Email "${Me.zoomEmail}" will be auto-matched in the future.`),ze.success(ft),z(!1),q(null),K(null),oe("")},onError:Me=>{ze.error("Failed to link attendee: "+Me.message)}}),Be=Me=>{q(Me),K(null),te(!0),oe(""),z(!0)},Ee=()=>{!F||!V||ke.mutate({attendeeId:F.id,userId:V,zoomEmail:F.zoom_email,shouldSaveAlias:G})},Ue=(Le==null?void 0:Le.filter(Me=>{var qe,Oe;if(!ie)return!0;const ft=ie.toLowerCase();return((qe=Me.name)==null?void 0:qe.toLowerCase().includes(ft))||((Oe=Me.email)==null?void 0:Oe.toLowerCase().includes(ft))}))||[],Fe=async Me=>{const ft=Me.name.split(".").pop(),Oe=`${`${crypto.randomUUID()}.${ft}`}`,{error:Qe}=await J.storage.from("event-images").upload(Oe,Me);if(Qe)throw Qe;const{data:{publicUrl:nt}}=J.storage.from("event-images").getPublicUrl(Oe);return nt},be=Me=>{var qe;const ft=(qe=Me.target.files)==null?void 0:qe[0];if(ft){if(ft.size>5*1024*1024){ze.error("Image must be less than 5MB");return}p(ft),y(URL.createObjectURL(ft))}},tt=()=>{p(null),y(null),i({...l,image_url:""}),C.current&&(C.current.value="")},Te=cr({mutationFn:async Me=>{j(!0);let ft=Me.image_url;h&&(ft=await Fe(h)||"");const qe=new Date(Me.event_date),[Oe,Qe]=Me.event_time.split(":");qe.setHours(parseInt(Oe),parseInt(Qe));const nt=[new Date(qe)];if(Me.is_recurring&&Me.recurrence_end_date){let wt=new Date(qe);for(;Me.recurrence_pattern==="weekly"?wt=Uw(wt,1):Me.recurrence_pattern==="biweekly"?wt=Uw(wt,2):wt=wh(wt,1),!(wt>Me.recurrence_end_date);)nt.push(new Date(wt))}const gt=nt.map(wt=>({title:Me.title,description:Me.description||null,image_url:ft||null,video_url:Me.video_url||null,event_date:wt.toISOString(),zoom_link:Me.zoom_link,zoom_meeting_id:Me.zoom_meeting_id||null,capacity:Me.capacity?parseInt(Me.capacity):null,is_published:Me.is_published})),{data:mt,error:Mt}=await J.from("events").insert(gt).select();if(Mt)throw Mt;return mt&&mt.length>0&&owt(Me.title,mt[0].id),nt.length},onSuccess:Me=>{e.invalidateQueries({queryKey:["admin-events"]}),ze.success(Me>1?`${Me} recurring events created successfully`:"Event created successfully"),s(!1),i(RL),p(null),y(null),j(!1)},onError:Me=>{ze.error("Failed to create event: "+Me.message),j(!1)}}),Ke=cr({mutationFn:async({id:Me,data:ft})=>{j(!0);let qe=ft.image_url;h&&(qe=await Fe(h)||"");const Oe=new Date(ft.event_date),[Qe,nt]=ft.event_time.split(":");Oe.setHours(parseInt(Qe),parseInt(nt));const{error:gt}=await J.from("events").update({title:ft.title,description:ft.description||null,image_url:qe||null,video_url:ft.video_url||null,event_date:Oe.toISOString(),zoom_link:ft.zoom_link,zoom_meeting_id:ft.zoom_meeting_id||null,capacity:ft.capacity?parseInt(ft.capacity):null,is_published:ft.is_published}).eq("id",Me);if(gt)throw gt},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event updated successfully"),s(!1),o(null),i(RL),p(null),y(null),j(!1)},onError:Me=>{ze.error("Failed to update event: "+Me.message),j(!1)}}),me=cr({mutationFn:async Me=>{const{error:ft}=await J.from("events").delete().eq("id",Me);if(ft)throw ft},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event deleted successfully")},onError:Me=>{ze.error("Failed to delete event: "+Me.message)}}),yt=Me=>{var qe;const ft=new Date(Me.event_date);o(Me),i({title:Me.title,description:Me.description||"",image_url:Me.image_url||"",video_url:Me.video_url||"",event_date:ft,event_time:xn(ft,"HH:mm"),zoom_link:Me.zoom_link,zoom_meeting_id:Me.zoom_meeting_id||"",capacity:((qe=Me.capacity)==null?void 0:qe.toString())||"",is_published:Me.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(Me.image_url||null),p(null),s(!0)},rt=Me=>{if(Me.preventDefault(),!l.event_date){ze.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){ze.error("Please select an end date for recurring events");return}a?Ke.mutate({id:a.id,data:l}):Te.mutate(l)},at=()=>{s(!1),o(null),i(RL),p(null),y(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(ee,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:r.jsx(so,{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(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"All Events"}),r.jsxs(Fr,{open:n,onOpenChange:Me=>!Me&&at(),children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:a?"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(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:l.title,onChange:Me=>i({...l,title:Me.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:l.description,onChange:Me=>i({...l,description:Me}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Event Image"}),r.jsx("input",{type:"file",ref:C,accept:"image/*",onChange:be,className:"hidden"}),x?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:x,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:tt,children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs(ee,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var Me;return(Me=C.current)==null?void 0:Me.click()},children:[r.jsx(uo,{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(He,{children:"Date *"}),r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),l.event_date?xn(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:l.event_date,onSelect:Me=>i({...l,event_date:Me}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"time",children:"Time *"}),r.jsx(dt,{id:"time",type:"time",value:l.event_time,onChange:Me=>i({...l,event_time:Me.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(dt,{id:"zoom_link",value:l.zoom_link,onChange:Me=>i({...l,zoom_link:Me.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(dt,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:Me=>i({...l,zoom_meeting_id:Me.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(He,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(dt,{id:"video_url",value:l.video_url,onChange:Me=>i({...l,video_url:Me.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(He,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(dt,{id:"capacity",type:"number",value:l.capacity,onChange:Me=>i({...l,capacity:Me.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),!a&&r.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(WT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(Ps,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:Me=>i({...l,is_recurring:Me})})]}),l.is_recurring&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Frequency"}),r.jsxs(gn,{value:l.recurrence_pattern,onValueChange:Me=>i({...l,recurrence_pattern:Me}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"weekly",children:"Weekly"}),r.jsx(qt,{value:"biweekly",children:"Every 2 Weeks"}),r.jsx(qt,{value:"monthly",children:"Monthly"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Repeat Until"}),r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?xn(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:l.recurrence_end_date,onSelect:Me=>i({...l,recurrence_end_date:Me}),disabled:Me=>Me<(l.event_date||new Date),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),l.event_date&&l.recurrence_end_date&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["This will create ",(()=>{let Me=1,ft=new Date(l.event_date);for(;ft=l.recurrence_pattern==="weekly"?Uw(ft,1):l.recurrence_pattern==="biweekly"?Uw(ft,2):wh(ft,1),!(ft>l.recurrence_end_date);)Me++;return Me})()," events with the same Zoom link"]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{htmlFor:"is_published",children:"Published"}),r.jsx(Ps,{id:"is_published",checked:l.is_published,onCheckedChange:Me=>i({...l,is_published:Me})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:at,className:"flex-1",children:"Cancel"}),r.jsx(ee,{type:"submit",className:"flex-1",disabled:Te.isPending||Ke.isPending||_,children:_?"Uploading...":a?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),r.jsx(Je,{children:ae?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(ye==null?void 0:ye.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Date & Time"}),r.jsx(It,{children:"Registrations"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ye==null?void 0:ye.map(Me=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:Me.title}),r.jsx(Nt,{children:xn(new Date(Me.event_date),"PPP p")}),r.jsx(Nt,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ae(Me),children:[r.jsx(Bn,{className:"h-4 w-4"}),(pe==null?void 0:pe[Me.id])||0,Me.capacity&&` / ${Me.capacity}`]})}),r.jsx(Nt,{children:r.jsx("span",{className:zt("px-2 py-1 rounded-full text-xs font-medium",Me.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:Me.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(Me.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Ls,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>yt(Me),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&me.mutate(Me.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},Me.id))})]})})]}),r.jsx(Fr,{open:N,onOpenChange:A,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),E==null?void 0:E.title]}),r.jsx(Qn,{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(ee,{variant:"ghost",size:"sm",onClick:()=>ge.mutate({eventId:E.id,testMode:!0}),disabled:ge.isPending,children:[r.jsx(ua,{className:zt("h-4 w-4 mr-2",ge.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>ge.mutate({eventId:E.id}),disabled:ge.isPending||!(se!=null&&se.length),children:[r.jsx(ua,{className:zt("h-4 w-4 mr-2",ge.isPending&&"animate-spin")}),ge.isPending?"Sending...":"Send Reminder to All"]}),(E==null?void 0:E.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Ce.mutate(E.id),disabled:Ce.isPending,children:[r.jsx(Gl,{className:zt("h-4 w-4 mr-2",Ce.isPending&&"animate-spin")}),Ce.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(ee,{variant:"default",size:"sm",onClick:()=>Se.mutate(E.id),disabled:Se.isPending,children:[r.jsx(Zi,{className:zt("h-4 w-4 mr-2",Se.isPending&&"animate-spin")}),Se.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(Ii,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsxs(nn,{value:"registrations",className:"gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Registrations (",(se==null?void 0:se.length)||0,")"]}),r.jsxs(nn,{value:"attendees",className:"gap-2",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Attendees (",(ue==null?void 0:ue.length)||0,")"]})]}),r.jsx(Sn,{value:"registrations",className:"mt-4",children:he?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(se==null?void 0:se.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Registered"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:se==null?void 0:se.map(Me=>{var Qe,nt;const ft=((Qe=Me.profiles)==null?void 0:Qe.name)||Me.zoom_name||"Unknown",qe=((nt=Me.profiles)==null?void 0:nt.email)||Me.zoom_email||null,Oe=!Me.user_id;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ft,Oe&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(Nt,{children:qe?r.jsxs("a",{href:`mailto:${qe}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ua,{className:"h-3 w-3"}),qe]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(Nt,{className:"text-muted-foreground text-sm",children:xn(new Date(Me.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(Nt,{children:Me.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"})})]},Me.id)})})]})}),r.jsx(Sn,{value:"attendees",className:"mt-4",children:_e?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(ue==null?void 0:ue.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(E==null?void 0:E.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:[(ue==null?void 0:ue.filter(Me=>!Me.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(fl,{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 (",ue==null?void 0:ue.filter(Me=>!Me.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:ue==null?void 0:ue.filter(Me=>!Me.user_id).map(Me=>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:Me.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Me.zoom_email||"No email"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Be(Me),className:"gap-1",children:[r.jsx(rf,{className:"h-3 w-3"}),"Link to Profile"]})]},Me.id))})]}),r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Points"})]})}),r.jsx(Vs,{children:ue==null?void 0:ue.filter(Me=>Me.user_id).map(Me=>{var Oe,Qe;const ft=((Oe=Me.profiles)==null?void 0:Oe.name)||Me.zoom_name||"Unknown",qe=((Qe=Me.profiles)==null?void 0:Qe.email)||Me.zoom_email||null;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ft,Me.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(Nt,{children:qe?r.jsxs("a",{href:`mailto:${qe}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ua,{className:"h-3 w-3"}),qe]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(Nt,{children:Me.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Ya,{className:"h-3 w-3"}),Me.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:Me.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(Zi,{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"})})]},Me.id)})})]})]})})]})]})}),r.jsx(Fr,{open:P,onOpenChange:z,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(rf,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Qn,{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(He,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:ie,onChange:Me=>oe(Me.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Ue.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:Ue.slice(0,20).map(Me=>r.jsxs("button",{type:"button",onClick:()=>K(Me.id),className:zt("w-full p-3 text-left hover:bg-muted/50 transition-colors",V===Me.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:Me.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Me.email})]},Me.id))})}),F.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Dl,{id:"save-alias",checked:G,onCheckedChange:Me=>te(Me)}),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(ee,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ee,disabled:!V||ke.isPending,children:ke.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const dwt=()=>{const{user:t}=Xr(),{toast:e}=pi(),n=Vr(),[s,a]=qd(),[o,l]=I.useState(!1),[i,h]=I.useState(null),[p,x]=I.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:""}),[y,_]=I.useState(null),[j,C]=I.useState(0),[N,A]=I.useState(!1),[E,T]=I.useState(null),[P,z]=I.useState(""),[F,q]=I.useState(""),[V,K]=I.useState(""),[G,te]=I.useState(!1),[ie,oe]=I.useState(!1),{data:ye=[]}=Yt({queryKey:["template-categories"],queryFn:async()=>{const{data:Ke,error:me}=await J.from("template_categories").select("*").order("name");if(me)throw me;return Ke}}),{data:ae=[]}=Yt({queryKey:["template-types"],queryFn:async()=>{const{data:Ke,error:me}=await J.from("template_types").select("*").order("name");if(me)throw me;return Ke}}),{data:pe=[],isLoading:se}=Yt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Ke,error:me}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(me)throw me;const{data:yt,error:rt}=await J.from("template_links").select("*").order("sort_order");if(rt)throw rt;const{data:at,error:Me}=await J.from("template_guides").select("*").order("sort_order");if(Me)throw Me;return Ke.map(qe=>({...qe,links:(yt==null?void 0:yt.filter(Oe=>Oe.template_id===qe.id))||[],guides:(at==null?void 0:at.filter(Oe=>Oe.template_id===qe.id))||[]}))}});I.useEffect(()=>{const Ke=s.get("edit");if(Ke&&pe.length>0){const me=pe.find(yt=>yt.id===Ke);me&&(Se(me),a({},{replace:!0}))}},[pe,s]);const he=cr({mutationFn:async Ke=>{const{data:me,error:yt}=await J.from("template_categories").insert({name:Ke}).select().single();if(yt)throw yt;return me},onSuccess:Ke=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...p,category_id:Ke.id}),q(""),te(!1),e({title:"Category added"})},onError:Ke=>{e({title:"Error adding category",description:Ke.message,variant:"destructive"})}}),ue=cr({mutationFn:async Ke=>{const{data:me,error:yt}=await J.from("template_types").insert({name:Ke}).select().single();if(yt)throw yt;return me},onSuccess:Ke=>{n.invalidateQueries({queryKey:["template-types"]}),x({...p,type_id:Ke.id}),K(""),oe(!1),e({title:"Type added"})},onError:Ke=>{e({title:"Error adding type",description:Ke.message,variant:"destructive"})}}),_e=cr({mutationFn:async Ke=>{var Me;let me=Ke.existingImageUrl;if(Ke.image){const ft=Ke.image.name.split(".").pop(),qe=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ft}`,{error:Oe}=await J.storage.from("template-previews").upload(qe,Ke.image);if(Oe)throw Oe;const{data:Qe}=J.storage.from("template-previews").getPublicUrl(qe);me=Qe.publicUrl}const yt={name:Ke.template.name,description:Ke.template.description||null,category_id:Ke.template.category_id||null,type_id:Ke.template.type_id||null,preview_image_url:me,video_url:Ke.videoUrl||null,publish_date:Ke.template.publish_date?new Date(Ke.template.publish_date).toISOString():new Date().toISOString(),created_by:t==null?void 0:t.id};let rt=Ke.templateId;if(rt){const{error:ft}=await J.from("canva_templates").update(yt).eq("id",rt);if(ft)throw ft;const{error:qe}=await J.from("template_links").delete().eq("template_id",rt);if(qe)throw qe;const Oe=((Me=Ke.existingGuides)==null?void 0:Me.map(gt=>gt.id).filter(Boolean))||[],Qe=Ke.template.guides.map(gt=>gt.id).filter(Boolean),nt=Oe.filter(gt=>!Qe.includes(gt));nt.length>0&&await J.from("template_guides").delete().in("id",nt)}else{const{data:ft,error:qe}=await J.from("canva_templates").insert(yt).select().single();if(qe)throw qe;rt=ft.id,awt(Ke.template.name,ft.id)}const at=Ke.template.links.filter(ft=>ft.title.trim()&&ft.canva_share_link.trim());if(at.length>0){const ft=at.map((Oe,Qe)=>({template_id:rt,title:Oe.title.trim(),canva_share_link:Oe.canva_share_link.trim(),sort_order:Qe})),{error:qe}=await J.from("template_links").insert(ft);if(qe)throw qe}for(let ft=0;ft{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),Ce(),l(!1),e({title:i?"Template updated":"Template created"})},onError:Ke=>{e({title:"Error saving template",description:Ke.message,variant:"destructive"})}}),Ae=cr({mutationFn:async Ke=>{const{error:me}=await J.from("canva_templates").delete().eq("id",Ke);if(me)throw me},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),e({title:"Template deleted"})},onError:Ke=>{e({title:"Error deleting template",description:Ke.message,variant:"destructive"})}}),Ce=()=>{x({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:""}),T(null),z(""),h(null),te(!1),oe(!1),q(""),K(""),_(null),C(0),A(!1)},Se=Ke=>{var me;h(Ke),x({name:Ke.name,description:Ke.description||"",category_id:Ke.category_id||"",type_id:Ke.type_id||"",publish_date:Ke.publish_date?new Date(Ke.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Ke.links&&Ke.links.length>0?Ke.links.map(yt=>({id:yt.id,title:yt.title,canva_share_link:yt.canva_share_link,sort_order:yt.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((me=Ke.guides)==null?void 0:me.map(yt=>({id:yt.id,name:yt.name,file_url:yt.file_url,file_type:yt.file_type,file_size:yt.file_size,sort_order:yt.sort_order})))||[],video_url:Ke.video_url||""}),z(Ke.preview_image_url||""),_(null),l(!0)},ge=Ke=>{var yt;const me=(yt=Ke.target.files)==null?void 0:yt[0];me&&(T(me),z(URL.createObjectURL(me)))},Le=()=>{x({...p,links:[...p.links,{title:"",canva_share_link:"",sort_order:p.links.length}]})},ke=Ke=>{if(p.links.length<=1)return;const me=p.links.filter((yt,rt)=>rt!==Ke);x({...p,links:me})},Be=(Ke,me,yt)=>{const rt=[...p.links];rt[Ke]={...rt[Ke],[me]:yt},x({...p,links:rt})},Ee=Ke=>{const me=Ke.target.files;if(!me)return;const yt=Array.from(me).map((rt,at)=>({name:rt.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:rt.type,file_size:rt.size,sort_order:p.guides.length+at,file:rt}));x({...p,guides:[...p.guides,...yt]}),Ke.target.value=""},Ue=Ke=>{const me=p.guides.filter((yt,rt)=>rt!==Ke);x({...p,guides:me})},Fe=(Ke,me)=>{const yt=[...p.guides];yt[Ke]={...yt[Ke],name:me},x({...p,guides:yt})},be=async()=>{if(!y)return null;A(!0),C(0);try{const{data:Ke,error:me}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:p.name||y.name}});if(me)throw new Error(me.message);const{videoId:yt,libraryId:rt}=Ke,{data:at,error:Me}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:yt}});if(Me)throw new Error(Me.message);const ft=new XMLHttpRequest;return await new Promise((Oe,Qe)=>{ft.upload.addEventListener("progress",nt=>{if(nt.lengthComputable){const gt=Math.round(nt.loaded/nt.total*100);C(gt)}}),ft.addEventListener("load",()=>{ft.status>=200&&ft.status<300?Oe():Qe(new Error(`Upload failed with status ${ft.status}`))}),ft.addEventListener("error",()=>Qe(new Error("Upload failed"))),ft.open("PUT",at.uploadUrl),ft.setRequestHeader("AccessKey",at.apiKey),ft.send(y)}),`https://player.mediadelivery.net/embed/${rt}/${yt}`}catch(Ke){return console.error("Bunny upload error:",Ke),e({title:"Video upload failed",description:Ke instanceof Error?Ke.message:"Unknown error",variant:"destructive"}),null}finally{A(!1)}},tt=Ke=>{var yt;const me=(yt=Ke.target.files)==null?void 0:yt[0];me&&_(me),Ke.target.value=""},Te=async Ke=>{if(Ke.preventDefault(),!p.name.trim()){e({title:"Please enter a template name",variant:"destructive"});return}if(p.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 yt=p.video_url;if(y){const rt=await be();if(!rt)return;yt=rt}_e.mutate({template:p,image:E,existingImageUrl:(i==null?void 0:i.preview_image_url)||null,templateId:i==null?void 0:i.id,existingGuides:i==null?void 0:i.guides,videoUrl:yt})};return r.jsx(Lr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:pe.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:ye.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:ae.length})})]})]}),r.jsxs(Fr,{open:o,onOpenChange:Ke=>{l(Ke),Ke||Ce()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:i?"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(He,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:p.name,onChange:Ke=>x({...p,name:Ke.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:p.description,onChange:Ke=>x({...p,description:Ke}),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(He,{children:"Canva Links *"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Le,className:"gap-1",children:[r.jsx(bn,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:p.links.map((Ke,me)=>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(dt,{value:Ke.title,onChange:yt=>Be(me,"title",yt.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(dt,{value:Ke.canva_share_link,onChange:yt=>Be(me,"canva_share_link",yt.target.value),placeholder:"https://www.canva.com/design/..."})]}),p.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>ke(me),children:r.jsx(_s,{className:"h-4 w-4"})})]},me))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Category"}),G?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:F,onChange:Ke=>q(Ke.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>F.trim()&&he.mutate(F.trim()),disabled:he.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{te(!1),q("")},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:p.category_id,onValueChange:Ke=>x({...p,category_id:Ke}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:ye.map(Ke=>r.jsx(qt,{value:Ke.id,children:Ke.name},Ke.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>te(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Template Type"}),ie?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:V,onChange:Ke=>K(Ke.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>V.trim()&&ue.mutate(V.trim()),disabled:ue.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{oe(!1),K("")},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:p.type_id,onValueChange:Ke=>x({...p,type_id:Ke}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select type"})}),r.jsx(pn,{children:ae.map(Ke=>r.jsx(qt,{value:Ke.id,children:Ke.name},Ke.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>oe(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:p.publish_date,onChange:Ke=>x({...p,publish_date:Ke.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(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[P?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:P,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(ee,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{T(null),z("")},children:r.jsx(_s,{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(Pl,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:ge,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(He,{children:"Video (Optional)"}),p.video_url&&!y?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(Pa,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x({...p,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:p.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):N?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(en,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",j,"%"]})]}),r.jsx(Zc,{value:j,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Pa,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:y.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(y.size/1024/1024).toFixed(1)," MB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>_(null),children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(dt,{type:"file",accept:"video/*",onChange:tt,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(Pa,{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(He,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(dt,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ee,className:"hidden"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(uo,{className:"h-3 w-3"}),"Add Files"]})})]})]}),p.guides.length>0?r.jsx("div",{className:"space-y-2",children:p.guides.map((Ke,me)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(La,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(dt,{value:Ke.name,onChange:yt=>Fe(me,yt.target.value),placeholder:"Guide name",className:"flex-1"}),Ke.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Ke.file_size/1024).toFixed(0)," KB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Ue(me),children:r.jsx(_s,{className:"h-4 w-4"})})]},Ke.id||me))}):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(ee,{type:"button",variant:"outline",onClick:()=>{l(!1),Ce()},children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:_e.isPending,children:_e.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:se?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):pe.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:pe.map(Ke=>{var me,yt,rt,at,Me;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Ke.preview_image_url?r.jsx("img",{src:Ke.preview_image_url,alt:Ke.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Pl,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(Nt,{className:"font-medium",children:Ke.name}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Ot,{variant:"secondary",children:[((me=Ke.links)==null?void 0:me.length)||0," link",(((yt=Ke.links)==null?void 0:yt.length)||0)!==1?"s":""]}),(((rt=Ke.guides)==null?void 0:rt.length)||0)>0&&r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(La,{className:"h-3 w-3"}),(at=Ke.guides)==null?void 0:at.length," guide",(((Me=Ke.guides)==null?void 0:Me.length)||0)!==1?"s":""]})]})}),r.jsx(Nt,{children:Ke.category?r.jsx(Ot,{variant:"secondary",children:Ke.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(Nt,{children:Ke.type?r.jsx(Ot,{variant:"outline",children:Ke.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(Nt,{className:"text-muted-foreground",children:new Date(Ke.publish_date).toLocaleDateString()}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"icon",variant:"ghost",onClick:()=>Se(Ke),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ae.mutate(Ke.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Ke.id)})})]})})})]})})},uwt=[{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"}],hwt=()=>{const{user:t}=Xr(),{toast:e}=pi(),n=Vr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,_]=I.useState(""),[j,C]=I.useState([]),[N,A]=I.useState([]),[E,T]=I.useState([]),[P,z]=I.useState(""),[F,q]=I.useState(!1),[V,K]=I.useState(null),[G,te]=I.useState(0),[ie,oe]=I.useState(!1),[ye,ae]=I.useState(null),{data:pe=[]}=Yt({queryKey:["academy-categories"],queryFn:async()=>{const{data:be,error:tt}=await J.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(tt)throw tt;return be}}),{data:se=[],isLoading:he}=Yt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:be,error:tt}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(tt)throw tt;const{data:Te,error:Ke}=await J.from("academy_resources").select("*").order("sort_order");if(Ke)throw Ke;return be.map(yt=>({...yt,resources:(Te==null?void 0:Te.filter(rt=>rt.video_id===yt.id))||[]}))}}),ue=cr({mutationFn:async be=>{const{data:tt,error:Te}=await J.from("academy_categories").insert({name:be,sort_order:pe.length}).select().single();if(Te)throw Te;return tt},onSuccess:be=>{n.invalidateQueries({queryKey:["academy-categories"]}),h({...i,category_id:be.id}),z(""),q(!1),e({title:"Category added"})},onError:be=>{e({title:"Error adding category",description:be.message,variant:"destructive"})}}),_e=cr({mutationFn:async be=>{let tt=be.existingThumbnailUrl;if(be.thumbnail){const me=be.thumbnail.name.split(".").pop(),yt=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${me}`,{error:rt}=await J.storage.from("academy-resources").upload(yt,be.thumbnail);if(rt)throw rt;const{data:at}=J.storage.from("academy-resources").getPublicUrl(yt);tt=at.publicUrl}const Te={title:be.video.title,description:be.video.description||null,video_url:be.video.video_url,video_type:be.video.video_type,duration:be.video.duration||null,thumbnail_url:tt,category_id:be.video.category_id||null,publish_date:be.video.publish_date?new Date(be.video.publish_date).toISOString():new Date().toISOString(),is_published:be.video.is_published,created_by:t==null?void 0:t.id};let Ke=be.videoId;if(Ke){const{error:me}=await J.from("academy_videos").update(Te).eq("id",Ke);if(me)throw me}else{const{data:me,error:yt}=await J.from("academy_videos").insert(Te).select().single();if(yt)throw yt;Ke=me.id,iwt(be.video.title,me.id)}if(be.resourcesToDelete.length>0){const{error:me}=await J.from("academy_resources").delete().in("id",be.resourcesToDelete);if(me)throw me}for(let me=0;me{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),Se(),a(!1),e({title:o?"Video updated":"Video created"})},onError:be=>{e({title:"Error saving video",description:be.message,variant:"destructive"})}}),Ae=cr({mutationFn:async be=>{const{error:tt}=await J.from("academy_videos").delete().eq("id",be);if(tt)throw tt},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),e({title:"Video deleted"})},onError:be=>{e({title:"Error deleting video",description:be.message,variant:"destructive"})}}),Ce=cr({mutationFn:async({id:be,is_published:tt})=>{const{error:Te}=await J.from("academy_videos").update({is_published:tt}).eq("id",be);if(Te)throw Te},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]})},onError:be=>{e({title:"Error updating video",description:be.message,variant:"destructive"})}}),Se=()=>{h({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),C([]),A([]),T([]),l(null),q(!1),z(""),K(null),te(0),oe(!1),ae(null)},ge=be=>{l(be),h({title:be.title,description:be.description||"",video_url:be.video_url,video_type:be.video_type,duration:be.duration||"",category_id:be.category_id||"",publish_date:be.publish_date?new Date(be.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:be.is_published}),_(be.thumbnail_url||""),A(be.resources||[]),C([]),T([]),a(!0)},Le=be=>{var Te;const tt=(Te=be.target.files)==null?void 0:Te[0];tt&&(x(tt),_(URL.createObjectURL(tt)))},ke=be=>{const tt=be.target.files;if(tt){const Te=Array.from(tt).map(Ke=>({file:Ke,title:Ke.name.replace(/\.[^/.]+$/,"")}));C([...j,...Te])}be.target.value=""},Be=be=>{C(j.filter((tt,Te)=>Te!==be))},Ee=be=>{T([...E,be]),A(N.filter(tt=>tt.id!==be))},Ue=async()=>{if(!V)return null;oe(!0),te(0);try{const{data:be,error:tt}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:i.title||V.name}});if(tt)throw new Error(tt.message);const{videoId:Te,libraryId:Ke}=be;ae(Te);const{data:me,error:yt}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Te}});if(yt)throw new Error(yt.message);const rt=new XMLHttpRequest;return await new Promise((Me,ft)=>{rt.upload.addEventListener("progress",qe=>{if(qe.lengthComputable){const Oe=Math.round(qe.loaded/qe.total*100);te(Oe)}}),rt.addEventListener("load",()=>{rt.status>=200&&rt.status<300?Me():ft(new Error(`Upload failed with status ${rt.status}`))}),rt.addEventListener("error",()=>ft(new Error("Upload failed"))),rt.open("PUT",me.uploadUrl),rt.setRequestHeader("AccessKey",me.apiKey),rt.send(V)}),`https://player.mediadelivery.net/embed/${Ke}/${Te}`}catch(be){return console.error("Bunny upload error:",be),e({title:"Video upload failed",description:be instanceof Error?be.message:"Unknown error",variant:"destructive"}),null}finally{oe(!1)}},Fe=async be=>{if(be.preventDefault(),!i.title.trim()){e({title:"Please enter a video title",variant:"destructive"});return}let tt=i.video_url;if(i.video_type==="bunny_stream"&&V&&!o){const Te=await Ue();if(!Te)return;tt=Te}else if(!i.video_url.trim()&&i.video_type!=="bunny_stream"){e({title:"Please enter a video URL",variant:"destructive"});return}else if(i.video_type==="bunny_stream"&&!V&&!i.video_url&&!o){e({title:"Please select a video file to upload",variant:"destructive"});return}_e.mutate({video:{...i,video_url:tt},thumbnail:p,existingThumbnailUrl:(o==null?void 0:o.thumbnail_url)||null,videoId:o==null?void 0:o.id,newResources:j,resourcesToDelete:E})};return r.jsx(Lr,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:se.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:se.filter(be=>be.is_published).length})})]})]}),r.jsxs(Fr,{open:s,onOpenChange:be=>{a(be),be||Se()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Fe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:i.title,onChange:be=>h({...i,title:be.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:i.description,onChange:be=>h({...i,description:be}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Video Type"}),r.jsxs(gn,{value:i.video_type,onValueChange:be=>{h({...i,video_type:be,video_url:""}),K(null)},disabled:ie,children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:uwt.map(be=>r.jsx(qt,{value:be.value,children:be.label},be.value))})]})]}),i.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(He,{children:["Upload Video File ",!o&&"*"]}),o&&i.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:i.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx(dt,{type:"file",accept:"video/*",onChange:be=>{var Te;const tt=(Te=be.target.files)==null?void 0:Te[0];tt&&K(tt)},disabled:ie}),V&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Pa,{className:"h-4 w-4"}),V.name," (",(V.size/(1024*1024)).toFixed(1)," MB)"]}),ie&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Zc,{value:G,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[G,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(dt,{id:"video_url",value:i.video_url,onChange:be=>h({...i,video_url:be.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(He,{htmlFor:"duration",children:"Duration"}),r.jsx(dt,{id:"duration",value:i.duration,onChange:be=>h({...i,duration:be.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:be=>h({...i,publish_date:be.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Category"}),F?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:P,onChange:be=>z(be.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>P.trim()&&ue.mutate(P.trim()),disabled:ue.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),z("")},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:i.category_id,onValueChange:be=>h({...i,category_id:be}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:pe.map(be=>r.jsx(qt,{value:be.id,children:be.name},be.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[y&&r.jsx("img",{src:y,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:Le,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(He,{children:"Resource Files"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(uo,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:ke,className:"hidden"})]})})]}),(N.length>0||j.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[N.map(be=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:be.title}),r.jsx(Ot,{variant:"outline",className:"text-xs",children:be.file_type}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ee(be.id),className:"text-destructive hover:text-destructive",children:r.jsx(_s,{className:"h-4 w-4"})})]},be.id)),j.map((be,tt)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:be.title,onChange:Te=>{const Ke=[...j];Ke[tt].title=Te.target.value,C(Ke)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Be(tt),className:"text-destructive hover:text-destructive",children:r.jsx(_s,{className:"h-4 w-4"})})]},tt))]}),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(Ps,{id:"is_published",checked:i.is_published,onCheckedChange:be=>h({...i,is_published:be})}),r.jsx(He,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(ea,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:ie,children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:_e.isPending||ie,children:ie?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):_e.isPending?"Saving...":o?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:he?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"})}):se.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Pa,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Vs,{children:se.map(be=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[be.thumbnail_url?r.jsx("img",{src:be.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(Pa,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:be.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:be.video_type.replace("_"," ")})]})]})}),r.jsx(Nt,{children:be.category?r.jsx(Ot,{variant:"outline",children:be.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(Nt,{children:be.duration||"-"}),r.jsx(Nt,{children:be.resources&&be.resources.length>0?r.jsxs(Ot,{variant:"secondary",children:[be.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(Nt,{children:new Date(be.publish_date).toLocaleDateString()}),r.jsx(Nt,{children:r.jsx(Ps,{checked:be.is_published,onCheckedChange:tt=>Ce.mutate({id:be.id,is_published:tt})})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>ge(be),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Ae.mutate(be.id),className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},be.id))})]})})})]})})};function fwt(){var Ce,Se,ge;const t=Vr(),[e,n]=qd(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,_]=I.useState(""),[j,C]=I.useState([]),[N,A]=I.useState([]),[E,T]=I.useState(null),{data:P,isLoading:z}=Yt({queryKey:["resource-kits"],queryFn:async()=>{const{data:Le,error:ke}=await J.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(ke)throw ke;return Le}}),{data:F}=Yt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Le,error:ke}=await J.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(ke)throw ke;return Le}}),{data:q}=Yt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Le,error:ke}=await J.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(ke)throw ke;return Le}});I.useEffect(()=>{const Le=e.get("edit");if(Le&&P&&P.length>0&&F&&q){const ke=P.find(Be=>Be.id===Le);ke&&(K(ke),n({},{replace:!0}))}},[P,F,q,e]);const V=()=>{h({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),C([]),A([]),l(null)},K=Le=>{l(Le),h({name:Le.name,description:Le.description||"",publish_date:Le.publish_date.split("T")[0],is_published:Le.is_published}),_(Le.featured_image_url||"");const ke=(F==null?void 0:F.filter(Ee=>Ee.kit_id===Le.id))||[];C(ke.map(Ee=>({id:Ee.id,name:Ee.name,file_url:Ee.file_url,file_type:Ee.file_type,file_size:Ee.file_size,sort_order:Ee.sort_order})));const Be=(q==null?void 0:q.filter(Ee=>Ee.kit_id===Le.id))||[];A(Be.map(Ee=>({id:Ee.id,title:Ee.title,canva_share_link:Ee.canva_share_link,sort_order:Ee.sort_order}))),a(!0)},G=Le=>{var Be;const ke=(Be=Le.target.files)==null?void 0:Be[0];ke&&(x(ke),_(URL.createObjectURL(ke)))},te=()=>{C([...j,{name:"",file_url:"",sort_order:j.length}])},ie=Le=>{C(j.filter((ke,Be)=>Be!==Le))},oe=(Le,ke,Be)=>{const Ee=[...j];Ee[Le]={...Ee[Le],[ke]:Be},C(Ee)},ye=()=>{A([...N,{title:"",canva_share_link:"",sort_order:N.length}])},ae=Le=>{A(N.filter((ke,Be)=>Be!==Le))},pe=(Le,ke,Be)=>{const Ee=[...N];Ee[Le]={...Ee[Le],[ke]:Be},A(Ee)},se=(Le,ke)=>{var Ee;const Be=(Ee=ke.target.files)==null?void 0:Ee[0];if(Be){const Ue=[...j],Fe=Be.name.replace(/\.[^/.]+$/,"");Ue[Le]={...Ue[Le],file:Be,file_type:Be.type,file_size:Be.size,name:Ue[Le].name||Fe},C(Ue)}},he=cr({mutationFn:async()=>{let Le=(o==null?void 0:o.featured_image_url)||null;if(p){const Fe=p.name.split(".").pop(),be=`${Date.now()}.${Fe}`,{error:tt}=await J.storage.from("resource-kits").upload(`featured/${be}`,p);if(tt)throw tt;const{data:Te}=J.storage.from("resource-kits").getPublicUrl(`featured/${be}`);Le=Te.publicUrl}const ke={name:i.name,description:i.description||null,featured_image_url:Le,publish_date:i.publish_date,is_published:i.is_published};let Be;const Ee=!o,Ue=(o==null?void 0:o.is_published)||!1;if(o){const{error:Fe}=await J.from("resource_kits").update(ke).eq("id",o.id);if(Fe)throw Fe;Be=o.id;const be=(F==null?void 0:F.filter(rt=>rt.kit_id===o.id).map(rt=>rt.id))||[],tt=j.filter(rt=>rt.id).map(rt=>rt.id),Te=be.filter(rt=>!tt.includes(rt));Te.length>0&&await J.from("resource_kit_files").delete().in("id",Te);const Ke=(q==null?void 0:q.filter(rt=>rt.kit_id===o.id).map(rt=>rt.id))||[],me=N.filter(rt=>rt.id).map(rt=>rt.id),yt=Ke.filter(rt=>!me.includes(rt));yt.length>0&&await J.from("resource_kit_links").delete().in("id",yt)}else{const{data:Fe,error:be}=await J.from("resource_kits").insert(ke).select().single();if(be)throw be;Be=Fe.id}for(let Fe=0;Fe{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),t.invalidateQueries({queryKey:["resource-kit-links"]}),ze.success(o?"Resource kit updated":"Resource kit created"),Le.isPublished&&(Le.isNewKit||!Le.wasPublished)&&lwt(Le.kitName,Le.kitId),a(!1),V()},onError:Le=>{ze.error("Failed to save resource kit: "+Le.message)}}),ue=cr({mutationFn:async Le=>{const{error:ke}=await J.from("resource_kits").delete().eq("id",Le);if(ke)throw ke},onSuccess:()=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),ze.success("Resource kit deleted")},onError:Le=>{ze.error("Failed to delete: "+Le.message)}}),_e=Le=>{if(Le.preventDefault(),!i.name){ze.error("Please enter a name");return}he.mutate()},Ae=Le=>(F==null?void 0:F.filter(ke=>ke.kit_id===Le).length)||0;return r.jsx(Lr,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(P==null?void 0:P.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(P==null?void 0:P.filter(Le=>Le.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{V(),a(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Files"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:z?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(P==null?void 0:P.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):P==null?void 0:P.map(Le=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Le.featured_image_url?r.jsx("img",{src:Le.featured_image_url,alt:Le.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(zl,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Le.name}),Le.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Le.description})]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),Ae(Le.id)]})}),r.jsx(Nt,{children:xn(new Date(Le.publish_date),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Le.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Le.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const ke=(F==null?void 0:F.filter(Ee=>Ee.kit_id===Le.id))||[],Be=(q==null?void 0:q.filter(Ee=>Ee.kit_id===Le.id))||[];T({...Le,files:ke,links:Be})},children:r.jsx(el,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>K(Le),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&ue.mutate(Le.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},Le.id))})]})})}),r.jsx(Fr,{open:s,onOpenChange:a,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[y?r.jsx("img",{src:y,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(zl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(dt,{type:"file",accept:"image/*",onChange:G})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:i.name,onChange:Le=>h({...i,name:Le.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:i.description,onChange:Le=>h({...i,description:Le}),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(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:Le=>h({...i,publish_date:Le.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ps,{checked:i.is_published,onCheckedChange:Le=>h({...i,is_published:Le})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:i.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(He,{children:"Resource Files"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:te,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),j.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:j.map((Le,ke)=>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 ",ke+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ie(ke),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsx(dt,{placeholder:"File name (e.g., Getting Started Guide)",value:Le.name,onChange:Be=>oe(ke,"name",Be.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dt,{type:"file",onChange:Be=>se(ke,Be),className:"flex-1"}),Le.file_url&&!Le.file&&r.jsx("a",{href:Le.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Le.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},ke))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:ye,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),N.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:N.map((Le,ke)=>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 ",ke+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ae(ke),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsx(dt,{placeholder:"Link title (e.g., Social Media Post Template)",value:Le.title,onChange:Be=>pe(ke,"title",Be.target.value)}),r.jsx(dt,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Le.canva_share_link,onChange:Be=>pe(ke,"canva_share_link",Be.target.value)})]},ke))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:he.isPending,children:he.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Fr,{open:!!E,onOpenChange:()=>T(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{children:E==null?void 0:E.name})}),r.jsxs("div",{className:"space-y-4",children:[(E==null?void 0:E.featured_image_url)&&r.jsx("img",{src:E.featured_image_url,alt:E.name,className:"w-full h-48 object-cover rounded-lg"}),(E==null?void 0:E.description)&&r.jsx("p",{className:"text-muted-foreground",children:E.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((Ce=E==null?void 0:E.files)==null?void 0:Ce.length)||0,")"]}),((Se=E==null?void 0:E.files)==null?void 0:Se.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:(ge=E==null?void 0:E.files)==null?void 0:ge.map(Le=>r.jsxs("a",{href:Le.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(La,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Le.name})]},Le.id))})]}),(E==null?void 0:E.links)&&E.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",E.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:E.links.map(Le=>r.jsxs("a",{href:Le.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(Co,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Le.title})]},Le.id))})]})]})]})})]})})}const pwt=()=>{const{user:t}=Xr(),{toast:e}=pi(),n=Vr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[p,x]=I.useState(null),[y,_]=I.useState(""),{data:j=[],isLoading:C}=Yt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:K,error:G}=await J.from("social_swag").select("*").order("publish_date",{ascending:!1});if(G)throw G;const{data:te,error:ie}=await J.from("social_swag_links").select("*").order("sort_order");if(ie)throw ie;return K.map(ye=>({...ye,links:(te==null?void 0:te.filter(ae=>ae.swag_id===ye.id))||[]}))}}),N=cr({mutationFn:async K=>{let G=K.existingImageUrl;if(K.image){const pe=K.image.name.split(".").pop(),se=`${Date.now()}-${Math.random().toString(36).substring(7)}.${pe}`,{error:he}=await J.storage.from("template-previews").upload(se,K.image);if(he)throw he;const{data:ue}=J.storage.from("template-previews").getPublicUrl(se);G=ue.publicUrl}const te={title:K.item.title,description:K.item.description||null,preview_image_url:G,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 ie=K.itemId;const oe=!ie,ye=(o==null?void 0:o.is_published)||!1;if(ie){const{error:pe}=await J.from("social_swag").update(te).eq("id",ie);if(pe)throw pe;await J.from("social_swag_links").delete().eq("swag_id",ie)}else{const{data:pe,error:se}=await J.from("social_swag").insert(te).select().single();if(se)throw se;ie=pe.id}const ae=K.item.links.filter(pe=>pe.title.trim()&&pe.canva_share_link.trim());if(ae.length>0){const pe=ae.map((he,ue)=>({swag_id:ie,title:he.title.trim(),canva_share_link:he.canva_share_link.trim(),sort_order:ue})),{error:se}=await J.from("social_swag_links").insert(pe);if(se)throw se}return{itemId:ie,itemTitle:K.item.title,isNewItem:oe,wasPublished:ye,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)&&sfe(K.itemTitle,K.itemId),a(!1),E()},onError:K=>{e({title:"Error saving item",description:K.message,variant:"destructive"})}}),A=cr({mutationFn:async K=>{const{error:G}=await J.from("social_swag").delete().eq("id",K);if(G)throw G},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"})}}),E=()=>{h({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),_(""),l(null)},T=K=>{l(K),h({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(G=>({id:G.id,title:G.title,canva_share_link:G.canva_share_link,sort_order:G.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),_(K.preview_image_url||""),a(!0)},P=K=>{var te;const G=(te=K.target.files)==null?void 0:te[0];G&&(x(G),_(URL.createObjectURL(G)))},z=()=>{h({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},F=K=>{if(i.links.length<=1)return;const G=i.links.filter((te,ie)=>ie!==K);h({...i,links:G})},q=(K,G,te)=>{const ie=[...i.links];ie[K]={...ie[K],[G]:te},h({...i,links:ie})},V=K=>{if(K.preventDefault(),!i.title.trim()){e({title:"Title is required",variant:"destructive"});return}N.mutate({item:i,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Lr,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(K=>K.is_published).length})})]})]}),r.jsxs(Fr,{open:s,onOpenChange:K=>{a(K),K||E()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:i.title,onChange:K=>h({...i,title:K.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:i.description,onChange:K=>h({...i,description:K}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:K=>h({...i,publish_date:K.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ps,{id:"is_published",checked:i.is_published,onCheckedChange:K=>h({...i,is_published:K})}),r.jsx(He,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),_("")},children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Pl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(dt,{type:"file",accept:"image/*",onChange:P,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:z,children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((K,G)=>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 ",G+1]}),i.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>F(G),children:r.jsx(_s,{className:"h-3 w-3"})})]}),r.jsx(dt,{placeholder:"Link title (e.g., Instagram Post)",value:K.title,onChange:te=>q(G,"title",te.target.value)}),r.jsx(dt,{placeholder:"Canva share link",value:K.canva_share_link,onChange:te=>q(G,"canva_share_link",te.target.value)})]})},G))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:N.isPending,children:N.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"})}):j.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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:j.map(K=>{var G;return r.jsxs(Ar,{children:[r.jsx(Nt,{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(Pl,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(Nt,{className:"font-medium",children:K.title}),r.jsxs(Nt,{children:[((G=K.links)==null?void 0:G.length)||0," links"]}),r.jsx(Nt,{children:new Date(K.publish_date).toLocaleDateString()}),r.jsx(Nt,{children:r.jsx(Ot,{variant:K.is_published?"default":"secondary",children:K.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${K.id}`,"_blank"),children:r.jsx(el,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(K),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&A.mutate(K.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},K.id)})})]})})})]})})},mwt=()=>{const t=Vr(),[e,n]=I.useState("all"),[s,a]=I.useState(!1),[o,l]=I.useState(xn(new Date,"yyyy-MM")),[i,h]=I.useState([]),[p,x]=I.useState(!1),[y,_]=I.useState(null),[j,C]=I.useState(!1),[N,A]=I.useState(xn(new Date,"yyyy-MM")),[E,T]=I.useState(null),[P,z]=I.useState(""),[F,q]=I.useState(""),[V,K]=I.useState(""),[G,te]=I.useState(!1),{data:ie=[],isLoading:oe}=Yt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:be,error:tt}=await J.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(tt)throw tt;return be}}),{data:ye=[]}=Yt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:be,error:tt}=await J.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(tt)throw tt;return be}}),{data:ae=[]}=Yt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:be,error:tt}=await J.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(tt)throw tt;return be}}),pe=[...new Set(ie.map(be=>be.month))].sort((be,tt)=>tt.localeCompare(be)),se=e==="all"?ie:ie.filter(be=>be.month===e),he=be=>{const tt=oxe(be,"yyyy-MM",new Date);return xn(tt,"MMMM yyyy")},ue=be=>{const Te=Array.from(be.target.files||[]).slice(0,16-i.length).map(Ke=>({file:Ke,preview:URL.createObjectURL(Ke),caption:""}));h(Ke=>[...Ke,...Te].slice(0,16))},_e=be=>{h(tt=>{const Te=[...tt];return URL.revokeObjectURL(Te[be].preview),Te.splice(be,1),Te})},Ae=(be,tt)=>{h(Te=>{const Ke=[...Te];return Ke[be]={...Ke[be],caption:tt},Ke})},Ce=async()=>{if(i.length===0){ze.error("Please add at least one image");return}if(i.filter(tt=>!tt.caption.trim()).length>0){ze.error("Please add captions to all images");return}x(!0);try{for(let tt=0;tt{const tt=be.image_url.split("/social-swag-2/");tt[1]&&await J.storage.from("social-swag-2").remove([tt[1]]);const{error:Te}=await J.from("social_swag_2").delete().eq("id",be.id);if(Te)throw Te},onSuccess:()=>{ze.success("Image deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{ze.error("Failed to delete image")}}),ge=cr({mutationFn:async({month:be,link:tt})=>{const{error:Te}=await J.from("social_swag_2_months").upsert({month:be,canva_link:tt||null},{onConflict:"month"});if(Te)throw Te},onSuccess:()=>{ze.success("Canva link updated"),_(null),t.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{ze.error("Failed to update Canva link")}}),Le=be=>{var tt;return((tt=ye.find(Te=>Te.month===be))==null?void 0:tt.canva_link)||""},ke=be=>ae.find(tt=>tt.month===be)||null,Be=be=>{var Te;const tt=(Te=be.target.files)==null?void 0:Te[0];tt&&(T(tt),z(URL.createObjectURL(tt)))},Ee=()=>{P&&URL.revokeObjectURL(P),T(null),z(""),q(""),K("")},Ue=async()=>{if(!E){ze.error("Please select an image");return}te(!0);try{const be=E.name.split(".").pop(),tt=`reels/${N}-${Date.now()}.${be}`,{error:Te}=await J.storage.from("social-swag-2").upload(tt,E);if(Te)throw Te;const{data:{publicUrl:Ke}}=J.storage.from("social-swag-2").getPublicUrl(tt),{error:me}=await J.from("social_swag_2_reels").upsert({month:N,image_url:Ke,canva_link:V||null,caption:F||null},{onConflict:"month"});if(me)throw me;ze.success("Reel uploaded successfully!"),sfe(`${he(N)} Reel`,"social-swag-2"),Ee(),C(!1),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(be){console.error("Reel upload error:",be),ze.error("Failed to upload reel")}finally{te(!1)}},Fe=cr({mutationFn:async be=>{const tt=be.image_url.split("/social-swag-2/");tt[1]&&await J.storage.from("social-swag-2").remove([tt[1]]);const{error:Te}=await J.from("social_swag_2_reels").delete().eq("id",be.id);if(Te)throw Te},onSuccess:()=>{ze.success("Reel deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{ze.error("Failed to delete reel")}});return r.jsx(Lr,{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(Fr,{open:s,onOpenChange:a,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Rr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Month"}),r.jsx(dt,{type:"month",value:o,onChange:be=>l(be.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{children:["Images (",i.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:ue,className:"hidden",id:"swag-upload",disabled:i.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(uo,{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)"})]})]})]}),i.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:i.map((be,tt)=>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:be.preview,alt:`Upload ${tt+1}`,className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>_e(tt),children:r.jsx(_s,{className:"h-3 w-3"})})]}),r.jsx(ps,{placeholder:"Caption...",value:be.caption,onChange:Te=>Ae(tt,Te.target.value),className:"text-xs h-20"})]},tt))}),r.jsx(ee,{onClick:Ce,disabled:p||i.length===0,className:"w-full gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),r.jsxs(Fr,{open:j,onOpenChange:be=>{C(be),be||Ee()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(Id,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Rr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Month"}),r.jsx(dt,{type:"month",value:N,onChange:be=>A(be.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Reel Preview Image"}),P?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:P,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(P),T(null),z("")},children:r.jsx(_s,{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:Be,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(Id,{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(He,{children:"Canva Download Link"}),r.jsx(dt,{value:V,onChange:be=>K(be.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Caption"}),r.jsx(ps,{value:F,onChange:be=>q(be.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(ee,{onClick:Ue,disabled:G||!E,className:"w-full gap-2",children:G?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{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:ie.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:pe.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ii,{value:e,onValueChange:n,children:r.jsxs(wi,{children:[r.jsx(nn,{value:"all",children:"All"}),pe.map(be=>r.jsx(nn,{value:be,children:he(be)},be))]})}),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(Co,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(He,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",he(e)]}),(y==null?void 0:y.month)===e?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(dt,{value:y.link,onChange:be=>_({...y,link:be.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(ee,{size:"sm",onClick:()=>ge.mutate(y),children:"Save"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>_(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:Le(e)||"No link set"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>_({month:e,link:Le(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(Id,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(He,{className:"text-sm text-muted-foreground",children:["Reel for ",he(e)]}),(()=>{const be=ke(e);return be?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:be.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:be.caption||"No caption"}),be.canva_link&&r.jsx("a",{href:be.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>Fe.mutate(be),children:r.jsx(Vn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),oe?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):se.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pl,{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:se.map(be=>r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:be.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>Se.mutate(be),children:r.jsx(Vn,{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:be.caption})})]},be.id))})]})})},gwt=()=>{const{toast:t}=pi(),e=Vr(),[n,s]=I.useState("categories"),[a,o]=I.useState(!1),[l,i]=I.useState(null),[h,p]=I.useState({name:"",description:"",icon:""}),[x,y]=I.useState(!1),[_,j]=I.useState(null),[C,N]=I.useState({name:"",description:"",icon:""}),[A,E]=I.useState(!1),[T,P]=I.useState(null),[z,F]=I.useState(""),{data:q=[],isLoading:V}=Yt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Fe,error:be}=await J.from("community_categories").select("*").order("sort_order");if(be)throw be;return Fe}}),{data:K=[],isLoading:G}=Yt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Fe,error:be}=await J.from("community_private_groups").select("*").order("sort_order");if(be)throw be;return Fe}}),{data:te=[]}=Yt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:Fe,error:be}=await J.from("community_private_group_members").select("*").eq("group_id",T.id);if(be)throw be;return Fe},enabled:!!T}),{data:ie=[]}=Yt({queryKey:["admin-all-profiles"],queryFn:async()=>{let be=[],tt=0,Te=!0;for(;Te;){const{data:Ke,error:me}=await J.from("profiles").select("id, name, email, brokerage_id").order("name").range(tt,tt+1e3-1);if(me)throw me;Ke&&Ke.length>0?(be=[...be,...Ke],tt+=1e3,Te=Ke.length===1e3):Te=!1}return be}}),{data:oe=[]}=Yt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Fe,error:be}=await J.from("brokerages").select("*").order("name");if(be)throw be;return Fe}}),ye=cr({mutationFn:async Fe=>{if(Fe.id){const{error:be}=await J.from("community_categories").update({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null}).eq("id",Fe.id);if(be)throw be}else{const be=Math.max(...q.map(Te=>Te.sort_order),0),{error:tt}=await J.from("community_categories").insert({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null,sort_order:be+1});if(tt)throw tt}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),p({name:"",description:"",icon:""}),t({title:l?"Category updated!":"Category created!"})},onError:Fe=>{t({title:"Error",description:Fe.message,variant:"destructive"})}}),ae=cr({mutationFn:async Fe=>{const{error:be}=await J.from("community_categories").delete().eq("id",Fe);if(be)throw be},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),t({title:"Category deleted"})}}),pe=cr({mutationFn:async({id:Fe,direction:be})=>{const tt=q.findIndex(Te=>Te.id===Fe);if(be==="up"&&tt>0){const Te=q[tt-1],Ke=q[tt];await J.from("community_categories").update({sort_order:Ke.sort_order}).eq("id",Te.id),await J.from("community_categories").update({sort_order:Te.sort_order}).eq("id",Ke.id)}else if(be==="down"&&tte.invalidateQueries({queryKey:["admin-community-categories"]})}),se=cr({mutationFn:async Fe=>{if(Fe.id){const{error:be}=await J.from("community_private_groups").update({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null}).eq("id",Fe.id);if(be)throw be}else{const be=Math.max(...K.map(Te=>Te.sort_order),0),{error:tt}=await J.from("community_private_groups").insert({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null,sort_order:be+1});if(tt)throw tt}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),j(null),N({name:"",description:"",icon:""}),t({title:_?"Private group updated!":"Private group created!"})},onError:Fe=>{t({title:"Error",description:Fe.message,variant:"destructive"})}}),he=cr({mutationFn:async Fe=>{const{error:be}=await J.from("community_private_groups").delete().eq("id",Fe);if(be)throw be},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),t({title:"Private group deleted"})}}),ue=cr({mutationFn:async({id:Fe,direction:be})=>{const tt=K.findIndex(Te=>Te.id===Fe);if(be==="up"&&tt>0){const Te=K[tt-1],Ke=K[tt];await J.from("community_private_groups").update({sort_order:Ke.sort_order}).eq("id",Te.id),await J.from("community_private_groups").update({sort_order:Te.sort_order}).eq("id",Ke.id)}else if(be==="down"&&tte.invalidateQueries({queryKey:["admin-private-groups"]})}),_e=cr({mutationFn:async({groupId:Fe,userId:be,isMember:tt})=>{if(tt){const{error:Te}=await J.from("community_private_group_members").delete().eq("group_id",Fe).eq("user_id",be);if(Te)throw Te}else{const{error:Te}=await J.from("community_private_group_members").insert({group_id:Fe,user_id:be});if(Te)throw Te}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ae=cr({mutationFn:async({groupId:Fe,brokerageId:be,isMember:tt})=>{if(tt){const{error:Te}=await J.from("community_private_group_members").delete().eq("group_id",Fe).eq("brokerage_id",be);if(Te)throw Te}else{const{error:Te}=await J.from("community_private_group_members").insert({group_id:Fe,brokerage_id:be});if(Te)throw Te}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ce=Fe=>{i(Fe),p({name:Fe.name,description:Fe.description||"",icon:Fe.icon||""}),o(!0)},Se=()=>{i(null),p({name:"",description:"",icon:""}),o(!0)},ge=Fe=>{j(Fe),N({name:Fe.name,description:Fe.description||"",icon:Fe.icon||""}),y(!0)},Le=()=>{j(null),N({name:"",description:"",icon:""}),y(!0)},ke=Fe=>{P(Fe),F(""),E(!0)},Be=Fe=>te.some(be=>be.user_id===Fe),Ee=Fe=>te.some(be=>be.brokerage_id===Fe),Ue=ie.filter(Fe=>Fe.name.toLowerCase().includes(z.toLowerCase())||Fe.email.toLowerCase().includes(z.toLowerCase()));return r.jsx(Lr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(Ii,{value:n,onValueChange:s,children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"categories",children:"Public Categories"}),r.jsxs(nn,{value:"private-groups",children:[r.jsx(Qf,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(Sn,{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(ee,{onClick:Se,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:V?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):q.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):q.map((Fe,be)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:be===0,onClick:()=>pe.mutate({id:Fe.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:be===q.length-1,onClick:()=>pe.mutate({id:Fe.id,direction:"down"}),children:"↓"})]})}),r.jsx(Nt,{className:"text-2xl",children:Fe.icon||"📁"}),r.jsx(Nt,{className:"font-medium",children:Fe.name}),r.jsx(Nt,{className:"text-muted-foreground",children:Fe.description||"—"}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ce(Fe),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ae.mutate(Fe.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Fe.id))})]})})})]}),r.jsxs(Sn,{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(ai,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(ee,{onClick:Le,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[120px]",children:"Members"}),r.jsx(It,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Vs,{children:G?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):K.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):K.map((Fe,be)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:be===0,onClick:()=>ue.mutate({id:Fe.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:be===K.length-1,onClick:()=>ue.mutate({id:Fe.id,direction:"down"}),children:"↓"})]})}),r.jsx(Nt,{className:"text-2xl",children:Fe.icon||"🔒"}),r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Fe.name,Fe.brokerage_id?r.jsxs(Ot,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:[r.jsx(Qf,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(Nt,{className:"text-muted-foreground",children:Fe.description||"—"}),r.jsx(Nt,{children:r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>ke(Fe),children:[r.jsx(Bn,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[!Fe.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>ge(Fe),children:r.jsx(fi,{className:"h-4 w-4"})}),!Fe.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&he.mutate(Fe.id)},children:r.jsx(Vn,{className:"h-4 w-4"})}),Fe.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Fe.id))})]})})})]})]}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:l?"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(dt,{value:h.icon,onChange:Fe=>p(be=>({...be,icon:Fe.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(dt,{value:h.name,onChange:Fe=>p(be=>({...be,name:Fe.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:h.description,onChange:Fe=>p(be=>({...be,description:Fe.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>ye.mutate({...h,id:l==null?void 0:l.id}),disabled:!h.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Fr,{open:x,onOpenChange:y,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:_?"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(dt,{value:C.icon,onChange:Fe=>N(be=>({...be,icon:Fe.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(dt,{value:C.name,onChange:Fe=>N(be=>({...be,name:Fe.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:Fe=>N(be=>({...be,description:Fe.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>se.mutate({...C,id:_==null?void 0:_.id}),disabled:!C.name.trim(),children:_?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ii,{defaultValue:"brokerages",children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(nn,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(nn,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(Sn,{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(tl,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[oe.map(Fe=>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(Dl,{checked:Ee(Fe.id),onCheckedChange:()=>{T&&Ae.mutate({groupId:T.id,brokerageId:Fe.id,isMember:Ee(Fe.id)})}}),r.jsx("span",{className:"font-medium",children:Fe.name})]}),r.jsxs(Ot,{variant:"secondary",children:[ie.filter(be=>be.brokerage_id===Fe.id).length," agents"]})]},Fe.id)),oe.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(Sn,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search users...",value:z,onChange:Fe=>F(Fe.target.value),className:"pl-9"})]}),r.jsx(tl,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Ue.map(Fe=>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(Dl,{checked:Be(Fe.id),onCheckedChange:()=>{T&&_e.mutate({groupId:T.id,userId:Fe.id,isMember:Be(Fe.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Fe.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Fe.email})]})]})},Fe.id)),Ue.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(ee,{onClick:()=>E(!1),children:"Done"})})]})]})})]})})},JNe=t=>{switch(t){case"academy_video":return r.jsx(fc,{className:"h-3 w-3"});case"template":return r.jsx(La,{className:"h-3 w-3"});case"toolbox":return r.jsx(zl,{className:"h-3 w-3"});case"newsletter":return r.jsx(Gx,{className:"h-3 w-3"});case"social_swag":return r.jsx(Ms,{className:"h-3 w-3"});default:return r.jsx(Ls,{className:"h-3 w-3"})}},xwt=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}},ywt=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}},vwt=()=>{const{toast:t}=pi(),[e,n]=I.useState([]),[s,a]=I.useState([]),[o,l]=I.useState([]),[i,h]=I.useState(!0),[p,x]=I.useState(""),[y,_]=I.useState(null),[j,C]=I.useState([]),[N,A]=I.useState([]);I.useEffect(()=>{E()},[]);const E=async()=>{try{h(!0);const{data:F,error:q}=await J.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:V,error:K}=await J.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 G=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:te}=await J.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",G),ie=new Map((te==null?void 0:te.map(se=>[se.id,se]))||[]),oe=(F==null?void 0:F.map(se=>{var he,ue,_e,Ae;return{id:se.id,user_id:se.user_id,app_name:se.app_name,launched_at:se.launched_at,user_name:((he=se.profiles)==null?void 0:he.name)||"Unknown",user_email:((ue=se.profiles)==null?void 0:ue.email)||"Unknown",brokerage_name:((Ae=(_e=se.profiles)==null?void 0:_e.brokerages)==null?void 0:Ae.name)||null}}))||[],ye=(V==null?void 0:V.map(se=>{var ue;const he=ie.get(se.user_id);return{id:se.id,user_id:se.user_id,resource_type:se.resource_type,resource_id:se.resource_id,resource_title:se.resource_title,action_type:se.action_type,created_at:se.created_at,user_name:(he==null?void 0:he.name)||"Unknown",user_email:(he==null?void 0:he.email)||"Unknown",brokerage_name:((ue=he==null?void 0:he.brokerages)==null?void 0:ue.name)||null}}))||[];n(oe),a(ye);const ae=new Map;oe.forEach(se=>{if(!ae.has(se.user_id))ae.set(se.user_id,{user_id:se.user_id,user_name:se.user_name,user_email:se.user_email,brokerage_name:se.brokerage_name,last_activity_type:"app",last_activity_name:se.app_name,last_activity_at:se.launched_at,total_app_launches:1,total_content_views:0});else{const he=ae.get(se.user_id);he.total_app_launches++,new Date(se.launched_at)>new Date(he.last_activity_at)&&(he.last_activity_type="app",he.last_activity_name=se.app_name,he.last_activity_at=se.launched_at)}}),ye.forEach(se=>{if(!ae.has(se.user_id))ae.set(se.user_id,{user_id:se.user_id,user_name:se.user_name,user_email:se.user_email,brokerage_name:se.brokerage_name,last_activity_type:se.resource_type,last_activity_name:se.resource_title,last_activity_at:se.created_at,total_app_launches:0,total_content_views:1});else{const he=ae.get(se.user_id);he.total_content_views++,new Date(se.created_at)>new Date(he.last_activity_at)&&(he.last_activity_type=se.resource_type,he.last_activity_name=se.resource_title,he.last_activity_at=se.created_at)}});const pe=Array.from(ae.values()).sort((se,he)=>new Date(he.last_activity_at).getTime()-new Date(se.last_activity_at).getTime());l(pe)}catch(F){console.error("Error loading activity:",F),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{h(!1)}},T=F=>{_({id:F.user_id,name:F.user_name,email:F.user_email});const q=e.filter(K=>K.user_id===F.user_id),V=s.filter(K=>K.user_id===F.user_id);C(q),A(V)},P=()=>{_(null),C([]),A([])},z=o.filter(F=>{var V;if(!p)return!0;const q=p.toLowerCase();return F.user_name.toLowerCase().includes(q)||F.user_email.toLowerCase().includes(q)||((V=F.brokerage_name)==null?void 0:V.toLowerCase().includes(q))});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.jsxs(Gt,{children:[r.jsx(Zt,{children:"User Activity"}),r.jsx(Tn,{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(wa,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or brokerage...",value:p,onChange:F=>x(F.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"Last Activity"}),r.jsx(It,{children:"Last Active"}),r.jsx(It,{className:"text-right",children:"Apps"}),r.jsx(It,{className:"text-right",children:"Content"})]})}),r.jsx(Vs,{children:z.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):z.map(F=>r.jsxs(Ar,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(F),children:[r.jsx(Nt,{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(Nt,{children:F.brokerage_name?r.jsx(Ot,{variant:"outline",children:F.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(Nt,{children:r.jsx("div",{className:"flex items-center gap-2",children:F.last_activity_type==="app"?r.jsxs(Ot,{variant:"secondary",children:[r.jsx(Ls,{className:"h-3 w-3 mr-1"}),F.last_activity_name]}):r.jsxs(Ot,{variant:"outline",className:"flex items-center gap-1",children:[JNe(F.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:F.last_activity_name})]})})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:uu(new Date(F.last_activity_at),{addSuffix:!0})}),r.jsx(Nt,{className:"text-right",children:r.jsx(Ot,{variant:"outline",children:F.total_app_launches})}),r.jsx(Nt,{className:"text-right",children:r.jsx(Ot,{variant:"outline",children:F.total_content_views})})]},F.user_id))})]})})]})]}),r.jsx(Fr,{open:!!y,onOpenChange:F=>!F&&P(),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Qn,{children:y==null?void 0:y.email})]}),r.jsxs(Ii,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsxs(nn,{value:"content",children:["Content (",N.length,")"]}),r.jsxs(nn,{value:"apps",children:["App Launches (",j.length,")"]})]}),r.jsx(Sn,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:N.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):N.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs(Ot,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[JNe(F.resource_type),xwt(F.resource_type)]})}),r.jsx(Nt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:F.resource_title})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"secondary",children:ywt(F.action_type)})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:uu(new Date(F.created_at),{addSuffix:!0})})]},F.id))})]})})}),r.jsx(Sn,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:j.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):j.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(Ot,{variant:"secondary",children:F.app_name})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:uu(new Date(F.launched_at),{addSuffix:!0})})]},F.id))})]})})})]})]})})]})},_wt=()=>{const{toast:t}=pi(),[e,n]=I.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,a]=I.useState(!0);I.useEffect(()=>{o()},[]);const o=async()=>{try{a(!0);const{count:l}=await J.from("profiles").select("*",{count:"exact",head:!0}),{count:i}=await J.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),h=(l||0)-(i||0),{count:p}=await J.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await J.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:_}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),j=new Date;j.setMonth(j.getMonth()-1);const{count:C}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",j.toISOString()),{data:N}=await J.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),A=new Set(N==null?void 0:N.map(E=>E.user_id)).size;n({totalUsers:l||0,activeUsers:i||0,pendingUsers:h,totalBrokerages:p||0,totalLaunches:x||0,launchesThisWeek:_||0,launchesThisMonth:C||0,uniqueActiveThisWeek:A})}catch(l){console.error("Error loading analytics:",l),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{a(!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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(Bn,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(Yi,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ya,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(ai,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(gg,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(gg,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(gg,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(ep,{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"})]})]})]})},e4e={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},t4e={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 wze({brokerageOnly:t=!1,brokerageId:e}){const[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(""),[h,p]=I.useState("all");I.useEffect(()=>{x()},[e]);const x=async()=>{o(!0);try{let E=[];if(t&&e){const{data:G}=await J.from("profiles").select("id").eq("brokerage_id",e);if(E=(G==null?void 0:G.map(te=>te.id))||[],E.length===0){s([]),o(!1);return}}let T=J.from("resource_shares").select("*").order("created_at",{ascending:!1});t&&E.length>0&&(T=T.or(`sender_id.in.(${E.join(",")}),recipient_id.in.(${E.join(",")})`));const{data:P,error:z}=await T;if(z)throw z;const F=new Set;P==null||P.forEach(G=>{F.add(G.sender_id),F.add(G.recipient_id)});const{data:q}=await J.from("profiles").select("id, name, email").in("id",Array.from(F)),V=new Map((q==null?void 0:q.map(G=>[G.id,G]))||[]),K=(P==null?void 0:P.map(G=>({...G,sender:V.get(G.sender_id),recipient:V.get(G.recipient_id)})))||[];s(K)}catch(E){console.error("Error loading shares:",E)}finally{o(!1)}},y=n.filter(E=>{var z,F;const T=l===""||E.resource_title.toLowerCase().includes(l.toLowerCase())||((z=E.sender)==null?void 0:z.name.toLowerCase().includes(l.toLowerCase()))||((F=E.recipient)==null?void 0:F.name.toLowerCase().includes(l.toLowerCase())),P=h==="all"||E.resource_type===h;return T&&P}),_=n.length,j=new Set(n.map(E=>E.sender_id)).size,C=new Set(n.map(E=>E.recipient_id)).size,N=n.length>0?Math.round(n.filter(E=>E.is_read).length/n.length*100):0,A=n.reduce((E,T)=>(E[T.resource_type]=(E[T.resource_type]||0)+1,E),{});return a?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((E,T)=>r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Ir,{className:"h-4 w-20"})}),r.jsx(Je,{children:r.jsx(Ir,{className:"h-8 w-16"})})]},T))}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-6",children:r.jsx(Ir,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(pc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:_})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:j})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(ep,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(La,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[N,"%"]})})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{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(A).map(([E,T])=>r.jsxs(Ot,{variant:"secondary",className:t4e[E],children:[e4e[E],": ",T]},E)),Object.keys(A).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Share History"}),r.jsxs(Tn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:E=>i(E.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:h,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Resource type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),r.jsx(qt,{value:"event",children:"Events"}),r.jsx(qt,{value:"template",children:"Templates"}),r.jsx(qt,{value:"academy_video",children:"Academy Videos"}),r.jsx(qt,{value:"resource_kit",children:"Resource Kits"}),r.jsx(qt,{value:"newsletter",children:"Newsletters"}),r.jsx(qt,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(tl,{className:"h-[400px]",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Sender"}),r.jsx(It,{children:"Recipient"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Vs,{children:y.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(E=>{var T,P;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium max-w-[200px] truncate",children:E.resource_title}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"secondary",className:t4e[E.resource_type],children:e4e[E.resource_type]})}),r.jsx(Nt,{children:((T=E.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(Nt,{children:((P=E.recipient)==null?void 0:P.name)||"Unknown"}),r.jsx(Nt,{children:r.jsx(Ot,{variant:E.is_read?"default":"outline",children:E.is_read?"Read":"Unread"})}),r.jsx(Nt,{className:"text-muted-foreground",children:xn(new Date(E.created_at),"MMM d, yyyy")})]},E.id)})})]})})]})]})]})}const bwt=()=>r.jsx(Lr,{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(Ii,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"analytics",children:"Analytics"}),r.jsx(nn,{value:"activity",children:"Activity"}),r.jsx(nn,{value:"shares",children:"Shares"})]}),r.jsx(Sn,{value:"analytics",className:"space-y-4",children:r.jsx(_wt,{})}),r.jsx(Sn,{value:"activity",className:"space-y-4",children:r.jsx(vwt,{})}),r.jsx(Sn,{value:"shares",className:"space-y-4",children:r.jsx(wze,{})})]})]})});function wwt(){const t=Vr(),[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[i,h]=I.useState(null),[p,x]=I.useState(""),[y,_]=I.useState([]),[j,C]=I.useState([]),[N,A]=I.useState([]),[E,T]=I.useState(!1),[P,z]=I.useState(null),[F,q]=I.useState(""),{data:V,isLoading:K}=Yt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Te,error:Ke}=await J.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Ke)throw Ke;return Te}}),{data:G}=Yt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Te,error:Ke}=await J.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Ke)throw Ke;return Te}}),{data:te}=Yt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Te,error:Ke}=await J.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Ke)throw Ke;return Te}}),{data:ie}=Yt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Te,error:Ke}=await J.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Ke)throw Ke;return Te}}),{data:oe,isLoading:ye}=Yt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Te,error:Ke}=await J.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Ke)throw Ke;return Te}}),ae=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),h(null),x(""),_([]),C([]),A([]),a(null),q("")},pe=Te=>{a(Te),l({title:Te.title,description:Te.description||"",publish_date:Te.publish_date.split("T")[0],is_published:Te.is_published,category_id:Te.category_id||""}),x(Te.preview_image_url||""),q("");const Ke=(G==null?void 0:G.filter(rt=>rt.resource_id===Te.id))||[];_(Ke.map(rt=>({id:rt.id,name:rt.name,file_url:rt.file_url,file_size:rt.file_size,sort_order:rt.sort_order})));const me=(te==null?void 0:te.filter(rt=>rt.resource_id===Te.id))||[];C(me.map(rt=>({id:rt.id,title:rt.title,video_url:rt.video_url,sort_order:rt.sort_order})));const yt=(ie==null?void 0:ie.filter(rt=>rt.resource_id===Te.id))||[];A(yt.map(rt=>({id:rt.id,title:rt.title,canva_share_link:rt.canva_share_link,sort_order:rt.sort_order}))),n(!0)},se=Te=>{var me;const Ke=(me=Te.target.files)==null?void 0:me[0];Ke&&(h(Ke),x(URL.createObjectURL(Ke)))},he=()=>{_([...y,{name:"",file_url:"",sort_order:y.length}])},ue=Te=>{_(y.filter((Ke,me)=>me!==Te))},_e=(Te,Ke,me)=>{const yt=[...y];if(Ke==="file"&&me instanceof File){const rt=me.name.replace(/\.[^/.]+$/,"");yt[Te]={...yt[Te],file:me,file_size:me.size,name:yt[Te].name||rt}}else yt[Te]={...yt[Te],[Ke]:me};_(yt)},Ae=()=>{C([...j,{title:"",video_url:"",sort_order:j.length}])},Ce=Te=>{C(j.filter((Ke,me)=>me!==Te))},Se=(Te,Ke,me)=>{const yt=[...j];Ke==="file"&&me instanceof File?yt[Te]={...yt[Te],file:me}:yt[Te]={...yt[Te],[Ke]:me},C(yt)},ge=()=>{A([...N,{title:"",canva_share_link:"",sort_order:N.length}])},Le=Te=>{A(N.filter((Ke,me)=>me!==Te))},ke=(Te,Ke,me)=>{const yt=[...N];yt[Te]={...yt[Te],[Ke]:me},A(yt)},Be=async(Te,Ke)=>{try{const me=await J.functions.invoke("bunny-upload",{body:{action:"create",title:Te.name}});if(me.error)throw me.error;const{videoId:yt,uploadUrl:rt,libraryId:at}=me.data,Me=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:yt,libraryId:at}});if(Me.error)throw Me.error;const{uploadUrl:ft,apiKey:qe}=Me.data,Oe=new XMLHttpRequest;return Oe.open("PUT",ft,!0),Oe.setRequestHeader("AccessKey",qe),Oe.upload.onprogress=Qe=>{if(Qe.lengthComputable){const nt=Math.round(Qe.loaded/Qe.total*100),gt=[...j];gt[Ke]={...gt[Ke],uploadProgress:nt},C(gt)}},await new Promise((Qe,nt)=>{Oe.onload=()=>Oe.status>=200&&Oe.status<300?Qe():nt(new Error("Upload failed")),Oe.onerror=()=>nt(new Error("Upload failed")),Oe.send(Te)}),`https://iframe.mediadelivery.net/embed/${at}/${yt}`}catch(me){throw console.error("Bunny upload error:",me),me}},Ee=cr({mutationFn:async Te=>{const{data:Ke,error:me}=await J.from("brokerage_resource_categories").insert({name:Te,sort_order:(oe==null?void 0:oe.length)||0}).select().single();if(me)throw me;return Ke},onSuccess:Te=>{t.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Te.id}),q(""),ze.success("Category created")},onError:Te=>{ze.error("Failed to create category: "+Te.message)}}),Ue=cr({mutationFn:async()=>{T(!0);let Te=(s==null?void 0:s.preview_image_url)||null;if(i){const yt=i.name.split(".").pop(),rt=`${Date.now()}.${yt}`,{error:at}=await J.storage.from("brokerage-resources").upload(`previews/${rt}`,i);if(at)throw at;const{data:Me}=J.storage.from("brokerage-resources").getPublicUrl(`previews/${rt}`);Te=Me.publicUrl}const Ke={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 me;if(s){const{error:yt}=await J.from("brokerage_resources").update(Ke).eq("id",s.id);if(yt)throw yt;me=s.id;const rt=(G==null?void 0:G.filter(mt=>mt.resource_id===s.id).map(mt=>mt.id))||[],at=y.filter(mt=>mt.id).map(mt=>mt.id),Me=rt.filter(mt=>!at.includes(mt));Me.length>0&&await J.from("brokerage_resource_pdfs").delete().in("id",Me);const ft=(te==null?void 0:te.filter(mt=>mt.resource_id===s.id).map(mt=>mt.id))||[],qe=j.filter(mt=>mt.id).map(mt=>mt.id),Oe=ft.filter(mt=>!qe.includes(mt));Oe.length>0&&await J.from("brokerage_resource_videos").delete().in("id",Oe);const Qe=(ie==null?void 0:ie.filter(mt=>mt.resource_id===s.id).map(mt=>mt.id))||[],nt=N.filter(mt=>mt.id).map(mt=>mt.id),gt=Qe.filter(mt=>!nt.includes(mt));gt.length>0&&await J.from("brokerage_resource_links").delete().in("id",gt)}else{const{data:yt,error:rt}=await J.from("brokerage_resources").insert(Ke).select().single();if(rt)throw rt;me=yt.id}for(let yt=0;yt{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success(s?"Resource updated":"Resource created"),n(!1),ae(),T(!1)},onError:Te=>{ze.error("Failed to save resource: "+Te.message),T(!1)}}),Fe=cr({mutationFn:async Te=>{const{error:Ke}=await J.from("brokerage_resources").delete().eq("id",Te);if(Ke)throw Ke},onSuccess:()=>{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success("Resource deleted")},onError:Te=>{ze.error("Failed to delete: "+Te.message)}}),be=Te=>{if(Te.preventDefault(),!o.title){ze.error("Please enter a title");return}Ue.mutate()},tt=Te=>{const Ke=(G==null?void 0:G.filter(rt=>rt.resource_id===Te).length)||0,me=(te==null?void 0:te.filter(rt=>rt.resource_id===Te).length)||0,yt=(ie==null?void 0:ie.filter(rt=>rt.resource_id===Te).length)||0;return{pdfCount:Ke,videoCount:me,linkCount:yt}};return r.jsx(Lr,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.filter(Te=>Te.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{ae(),n(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Content"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:K?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(V==null?void 0:V.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):V==null?void 0:V.map(Te=>{const{pdfCount:Ke,videoCount:me,linkCount:yt}=tt(Te.id),rt=oe==null?void 0:oe.find(at=>at.id===Te.category_id);return r.jsxs(Ar,{children:[r.jsx(Nt,{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(vh,{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(Nt,{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(Nt,{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(La,{className:"h-3.5 w-3.5"}),Ke]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Pa,{className:"h-3.5 w-3.5"}),me]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Co,{className:"h-3.5 w-3.5"}),yt]})]})}),r.jsx(Nt,{children:xn(new Date(Te.publish_date),"MMM d, yyyy")}),r.jsx(Nt,{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(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const at=(G==null?void 0:G.filter(qe=>qe.resource_id===Te.id))||[],Me=(te==null?void 0:te.filter(qe=>qe.resource_id===Te.id))||[],ft=(ie==null?void 0:ie.filter(qe=>qe.resource_id===Te.id))||[];z({...Te,pdfs:at,videos:Me,links:ft})},children:r.jsx(el,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>pe(Te),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Fe.mutate(Te.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},Te.id)})})]})})}),r.jsx(Fr,{open:e,onOpenChange:n,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:be,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[p?r.jsx("img",{src:p,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(vh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(dt,{type:"file",accept:"image/*",onChange:se})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:o.title,onChange:Te=>l({...o,title:Te.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(Ng,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:o.category_id,onValueChange:Te=>l({...o,category_id:Te}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select a category"})}),r.jsx(pn,{children:oe==null?void 0:oe.map(Te=>r.jsx(qt,{value:Te.id,children:Te.name},Te.id))})]}),o.category_id&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Or create new category...",value:F,onChange:Te=>q(Te.target.value),className:"flex-1"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",disabled:!F.trim()||Ee.isPending,onClick:()=>Ee.mutate(F.trim()),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:o.description,onChange:Te=>l({...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(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:o.publish_date,onChange:Te=>l({...o,publish_date:Te.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ps,{checked:o.is_published,onCheckedChange:Te=>l({...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(He,{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:he,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Te,Ke)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(dt,{placeholder:"PDF Name",value:Te.name,onChange:me=>_e(Ke,"name",me.target.value),className:"flex-1"}),r.jsx(dt,{type:"file",accept:".pdf",onChange:me=>{var rt;const yt=(rt=me.target.files)==null?void 0:rt[0];yt&&_e(Ke,"file",yt)},className:"flex-1"}),Te.file_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>ue(Ke),children:r.jsx(_s,{className:"h-4 w-4"})})]},Ke))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(Pa,{className:"h-4 w-4"}),"Videos (",j.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Ae,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),j.map((Te,Ke)=>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(dt,{placeholder:"Video Title",value:Te.title,onChange:me=>Se(Ke,"title",me.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>Ce(Ke),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsx(dt,{type:"file",accept:"video/*",onChange:me=>{var rt;const yt=(rt=me.target.files)==null?void 0:rt[0];yt&&Se(Ke,"file",yt)}}),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"})]},Ke))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-4 w-4"}),"Canva Links (",N.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:ge,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),N.map((Te,Ke)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(dt,{placeholder:"Link Title",value:Te.title,onChange:me=>ke(Ke,"title",me.target.value),className:"flex-1"}),r.jsx(dt,{placeholder:"Canva Share Link",value:Te.canva_share_link,onChange:me=>ke(Ke,"canva_share_link",me.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>Le(Ke),children:r.jsx(_s,{className:"h-4 w-4"})})]},Ke))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:Ue.isPending||E,children:Ue.isPending||E?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Fr,{open:!!P,onOpenChange:()=>z(null),children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:P==null?void 0:P.title})}),P&&r.jsxs("div",{className:"space-y-4",children:[P.preview_image_url&&r.jsx("img",{src:P.preview_image_url,alt:P.title,className:"w-full h-48 object-cover rounded-lg"}),P.description&&r.jsx("p",{className:"text-muted-foreground",children:P.description}),P.pdfs&&P.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4"}),"PDF Documents (",P.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.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))})]}),P.videos&&P.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Pa,{className:"h-4 w-4"}),"Videos (",P.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:P.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))})]}),P.links&&P.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Co,{className:"h-4 w-4"}),"Canva Links (",P.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.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 jze=[{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 jwt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(!1),[h,p]=I.useState(null),[x,y]=I.useState(!1),[_,j]=I.useState(!1),[C,N]=I.useState(""),[A,E]=I.useState(""),[T,P]=I.useState(""),[z,F]=I.useState(""),[q,V]=I.useState("Learn More"),[K,G]=I.useState("top"),[te,ie]=I.useState(""),[oe,ye]=I.useState(!0),[ae,pe]=I.useState(""),[se,he]=I.useState("");I.useEffect(()=>{ue()},[]);const ue=async()=>{try{const{data:Ee,error:Ue}=await J.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Ue)throw Ue;e(Ee||[])}catch(Ee){ze.error("Failed to load banners: "+Ee.message)}finally{s(!1)}},_e=()=>{N(""),E(""),P(""),F(""),V("Learn More"),G("top"),ie(""),ye(!0),pe(""),he(""),p(null)},Ae=Ee=>{p(Ee),N(Ee.title),E(Ee.description||""),P(Ee.image_url),F(Ee.link_url||""),V(Ee.link_text||"Learn More"),G(Ee.placement),ie(Ee.section_after||""),ye(Ee.is_active),pe(Ee.start_date?xn(new Date(Ee.start_date),"yyyy-MM-dd'T'HH:mm"):""),he(Ee.end_date?xn(new Date(Ee.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},Ce=async Ee=>{var Fe;const Ue=(Fe=Ee.target.files)==null?void 0:Fe[0];if(Ue){y(!0);try{const be=Ue.name.split(".").pop(),tt=`${Date.now()}.${be}`,{error:Te}=await J.storage.from("banner-images").upload(tt,Ue);if(Te)throw Te;const{data:{publicUrl:Ke}}=J.storage.from("banner-images").getPublicUrl(tt);P(Ke),ze.success("Image uploaded successfully")}catch(be){ze.error("Failed to upload image: "+be.message)}finally{y(!1)}}},Se=async()=>{if(!C.trim()||!T){ze.error("Please fill in required fields (title and image)");return}j(!0);try{const Ee={title:C.trim(),description:A.trim()||null,image_url:T,link_url:z.trim()||null,link_text:q.trim()||"Learn More",placement:K,section_after:K==="between"?te:null,is_active:oe,start_date:ae?new Date(ae).toISOString():null,end_date:se?new Date(se).toISOString():null};if(h){const{error:Ue}=await J.from("dashboard_banners").update(Ee).eq("id",h.id);if(Ue)throw Ue;ze.success("Banner updated successfully")}else{const Ue=t.filter(be=>be.placement===K).length,{error:Fe}=await J.from("dashboard_banners").insert({...Ee,sort_order:Ue});if(Fe)throw Fe;ze.success("Banner created successfully")}o(!1),_e(),ue()}catch(Ee){ze.error("Failed to save banner: "+Ee.message)}finally{j(!1)}},ge=async()=>{if(h)try{const{error:Ee}=await J.from("dashboard_banners").delete().eq("id",h.id);if(Ee)throw Ee;ze.success("Banner deleted successfully"),i(!1),p(null),ue()}catch(Ee){ze.error("Failed to delete banner: "+Ee.message)}},Le=async Ee=>{try{const{error:Ue}=await J.from("dashboard_banners").update({is_active:!Ee.is_active}).eq("id",Ee.id);if(Ue)throw Ue;ze.success(Ee.is_active?"Banner deactivated":"Banner activated"),ue()}catch(Ue){ze.error("Failed to update banner: "+Ue.message)}},ke=t.filter(Ee=>Ee.placement==="top"),Be=t.filter(Ee=>Ee.placement==="between");return n?r.jsx(Lr,{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(Lr,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Pl,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(Tn,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Fr,{open:a&&K==="top",onOpenChange:Ee=>{Ee||_e(),o(Ee),Ee&&G("top")},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{_e(),G("top")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[h?"Edit":"Create"," Banner"]}),r.jsx(Qn,{children:"Configure the banner's content and display settings"})]}),r.jsx(r4e,{title:C,setTitle:N,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:V,placement:K,setPlacement:G,sectionAfter:te,setSectionAfter:ie,isActive:oe,setIsActive:ye,startDate:ae,setStartDate:pe,endDate:se,setEndDate:he,handleImageUpload:Ce,uploading:x,showPlacementOptions:!1}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),_e()},children:"Cancel"}),r.jsx(ee,{onClick:Se,disabled:_,children:_?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Je,{children:ke.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:ke.map(Ee=>r.jsx(n4e,{banner:Ee,onEdit:()=>Ae(Ee),onDelete:()=>{p(Ee),i(!0)},onToggleActive:()=>Le(Ee)},Ee.id))})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Pl,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(Tn,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Fr,{open:a&&K==="between",onOpenChange:Ee=>{Ee||_e(),o(Ee),Ee&&G("between")},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{_e(),G("between")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[h?"Edit":"Create"," Section Banner"]}),r.jsx(Qn,{children:"Configure where this banner appears between sections"})]}),r.jsx(r4e,{title:C,setTitle:N,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:V,placement:K,setPlacement:G,sectionAfter:te,setSectionAfter:ie,isActive:oe,setIsActive:ye,startDate:ae,setStartDate:pe,endDate:se,setEndDate:he,handleImageUpload:Ce,uploading:x,showPlacementOptions:!0}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),_e()},children:"Cancel"}),r.jsx(ee,{onClick:Se,disabled:_,children:_?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Je,{children:Be.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:Be.map(Ee=>r.jsx(n4e,{banner:Ee,onEdit:()=>Ae(Ee),onDelete:()=>{p(Ee),i(!0)},onToggleActive:()=>Le(Ee),showSection:!0},Ee.id))})})]})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Delete Banner"}),r.jsxs(Qn,{children:['Are you sure you want to delete "',h==null?void 0:h.title,'"? This action cannot be undone.']})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:ge,children:"Delete"})]})]})})]})}function r4e({title:t,setTitle:e,description:n,setDescription:s,imageUrl:a,linkUrl:o,setLinkUrl:l,linkText:i,setLinkText:h,placement:p,setPlacement:x,sectionAfter:y,setSectionAfter:_,isActive:j,setIsActive:C,startDate:N,setStartDate:A,endDate:E,setEndDate:T,handleImageUpload:P,uploading:z,showPlacementOptions:F}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",placeholder:"Banner headline...",value:t,onChange:q=>e(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{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(He,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:P,disabled:z,className:"flex-1"}),z&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),a&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:a,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(He,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(dt,{id:"linkUrl",placeholder:"https://...",value:o,onChange:q=>l(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"linkText",children:"Button Text"}),r.jsx(dt,{id:"linkText",placeholder:"Learn More",value:i,onChange:q=>h(q.target.value)})]})]}),F&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Placement"}),r.jsxs(gn,{value:y,onValueChange:_,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select section placement..."})}),r.jsx(pn,{children:jze.map(q=>r.jsx(qt,{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(He,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(dt,{id:"startDate",type:"datetime-local",value:N,onChange:q=>A(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(dt,{id:"endDate",type:"datetime-local",value:E,onChange:q=>T(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(Ps,{id:"isActive",checked:j,onCheckedChange:C}),r.jsx(He,{htmlFor:"isActive",children:"Active"})]})})]})}function n4e({banner:t,onEdit:e,onDelete:n,onToggleActive:s,showSection:a=!1}){var l;const o=(l=jze.find(i=>i.value===t.section_after))==null?void 0:l.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(b1,{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(Ot,{variant:"secondary",children:"Inactive"}),t.start_date&&new Date(t.start_date)>new Date&&r.jsx(Ot,{variant:"outline",children:"Scheduled"})]}),t.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.description}),a&&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(ee,{variant:"ghost",size:"icon",children:r.jsx(Ls,{className:"h-4 w-4"})})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:s,children:t.is_active?r.jsx(el,{className:"h-4 w-4"}):r.jsx(g1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:e,children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})]})}const FL={open:{label:"Open",icon:Ya,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Fl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Yi,color:"bg-green-500"},closed:{label:"Closed",icon:Vc,color:"bg-muted-foreground"}},s4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function kwt(){var q,V;const{user:t}=Xr(),e=Vr(),[n,s]=I.useState(null),[a,o]=I.useState(""),[l,i]=I.useState("all"),[h,p]=I.useState("all"),[x,y]=I.useState(!1),{data:_=[],isLoading:j}=Yt({queryKey:["admin-support-tickets",l,h],queryFn:async()=>{let K=J.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(K=K.eq("status",l)),h!=="all"&&(K=K.eq("category",h));const{data:G,error:te}=await K;if(te)throw te;return G}}),{data:C=[]}=Yt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:K,error:G}=await J.from("user_roles").select("user_id").eq("role","admin");if(G)throw G;const te=K.map(se=>se.user_id),{data:ie,error:oe}=await J.from("profiles").select("id, name, email").in("id",te);if(oe)throw oe;const{data:ye,error:ae}=await J.from("support_notification_settings").select("user_id, receive_notifications");if(ae)throw ae;const pe=new Map((ye==null?void 0:ye.map(se=>[se.user_id,se.receive_notifications]))||[]);return ie.map(se=>({...se,receives_notifications:pe.get(se.id)||!1}))}}),{data:N=[]}=Yt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:K,error:G}=await J.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(G)throw G;return K},enabled:!!n}),A=cr({mutationFn:async({userId:K,enabled:G})=>{const{data:te}=await J.from("support_notification_settings").select("id").eq("user_id",K).maybeSingle();if(te){const{error:ie}=await J.from("support_notification_settings").update({receive_notifications:G}).eq("user_id",K);if(ie)throw ie}else{const{error:ie}=await J.from("support_notification_settings").insert({user_id:K,receive_notifications:G});if(ie)throw ie}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-users-notifications"]}),ze.success("Notification settings updated")},onError:()=>{ze.error("Failed to update settings")}}),E=cr({mutationFn:async({ticketId:K,status:G})=>{const{error:te}=await J.from("support_tickets").update({status:G}).eq("id",K);if(te)throw te},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),ze.success("Status updated")},onError:()=>{ze.error("Failed to update status")}}),T=cr({mutationFn:async({ticketId:K,assignedTo:G})=>{const{error:te}=await J.from("support_tickets").update({assigned_to:G}).eq("id",K);if(te)throw te},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),ze.success("Ticket assigned")},onError:()=>{ze.error("Failed to assign ticket")}}),P=cr({mutationFn:async K=>{var te,ie;if(!n||!t)throw new Error("Missing data");const{error:G}=await J.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:K,is_admin_reply:!0});if(G)throw G;try{await J.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:K,userEmail:(te=n.profiles)==null?void 0:te.email,userName:(ie=n.profiles)==null?void 0:ie.name}})}catch(oe){console.error("Failed to send reply notification:",oe)}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),z=()=>{a.trim()&&P.mutate(a)};I.useEffect(()=>{const K=J.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{J.removeChannel(K)}},[e]);const F=_.filter(K=>K.status==="open").length;return n?(FL[n.status].icon,r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(so,{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(Ot,{variant:"secondary",children:s4e[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((q=n.profiles)==null?void 0:q.name)||"Unknown"," (",(V=n.profiles)==null?void 0:V.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm",children:"Status"})}),r.jsx(Je,{children:r.jsxs(gn,{value:n.status,onValueChange:K=>{E.mutate({ticketId:n.id,status:K}),s({...n,status:K})},children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"open",children:"Open"}),r.jsx(qt,{value:"in_progress",children:"In Progress"}),r.jsx(qt,{value:"resolved",children:"Resolved"}),r.jsx(qt,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm",children:"Assigned To"})}),r.jsx(Je,{children:r.jsxs(gn,{value:n.assigned_to||"unassigned",onValueChange:K=>{const G=K==="unassigned"?null:K;T.mutate({ticketId:n.id,assignedTo:G}),s({...n,assigned_to:G})},children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Unassigned"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"unassigned",children:"Unassigned"}),C.map(K=>r.jsx(qt,{value:K.id,children:K.name},K.id))]})]})})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Tn,{children:["Created on ",xn(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(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Je,{children:[r.jsx(tl,{className:"h-[300px] pr-4",children:N.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:N.map(K=>{var G,te;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?`${((G=K.profiles)==null?void 0:G.name)||"Admin"} (Support)`:((te=K.profiles)==null?void 0:te.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(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(cu,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:a,onChange:K=>o(K.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:z,disabled:!a.trim()||P.isPending,className:"self-end",children:r.jsx(Do,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Lr,{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(Ot,{variant:"destructive",className:"ml-2",children:[F," open"]})]})]}),r.jsxs(Fr,{open:x,onOpenChange:y,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(md,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Email Notification Settings"}),r.jsx(Qn,{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(Ic,{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(yg,{className:"h-4 w-4 text-primary"}):r.jsx(cj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ps,{checked:K.receives_notifications,onCheckedChange:G=>A.mutate({userId:K.id,enabled:G})})]})]},K.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(Ii,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(wi,{children:[r.jsx(nn,{value:"all",children:"All"}),r.jsx(nn,{value:"open",children:"Open"}),r.jsx(nn,{value:"in_progress",children:"In Progress"}),r.jsx(nn,{value:"resolved",children:"Resolved"}),r.jsx(nn,{value:"closed",children:"Closed"})]})}),r.jsxs(gn,{value:h,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"All Categories"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Categories"}),r.jsx(qt,{value:"general",children:"General Support"}),r.jsx(qt,{value:"technology",children:"Technology Support"}),r.jsx(qt,{value:"crm",children:"CRM Support"}),r.jsx(qt,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:j?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):_.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"text-center py-12",children:[r.jsx(Fl,{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:_.map(K=>{var te,ie;const G=FL[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(Ot,{variant:"outline",className:"text-xs",children:s4e[K.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(te=K.profiles)==null?void 0:te.name," • ",xn(new Date(K.created_at),"MMM d, yyyy")]}),K.assigned_to&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(Ic,{className:"h-3 w-3"}),((ie=C.find(oe=>oe.id===K.assigned_to))==null?void 0:ie.name)||"Assigned"]})]})]}),r.jsxs(Ot,{className:FL[K.status].color,children:[r.jsx(G,{className:"h-3 w-3 mr-1"}),FL[K.status].label]})]})})},K.id)})})})]})]})})}const Nwt=Ud.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 Swt({content:t,onChange:e,variables:n}){const s=nze({extensions:[cze,vze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),_ze.configure({types:["heading","paragraph"]}),bze,Nwt],content:t,onUpdate:({editor:l})=>{e(l.getHTML())}});I.useEffect(()=>{s&&t!==s.getHTML()&&s.commands.setContent(t)},[t,s]);const a=l=>{s&&s.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!s)return;const l=s.getAttributes("link").href,i=window.prompt("URL",l);if(i!==null){if(i===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:i}).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(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(eS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(iS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(Xf,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(cS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(Q4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(J4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(Co,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(hj,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(xS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(pS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(nA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(Gu,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(di,{onClick:()=>a(l),className:"flex flex-col items-start",children:[r.jsx("span",{className:"font-medium",children:l.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${l.key}}}`}),l.description&&r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:l.description})]},l.key))})]})]}),r.jsx(tze,{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(l=>r.jsx(Ot,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 font-mono text-xs",onClick:()=>{navigator.clipboard.writeText(`{{${l.key}}}`)},children:`{{${l.key}}}`},l.key))})]})]}):null}function Cwt(){const t=Vr(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(""),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(!0),[j,C]=I.useState("visual"),{data:N,isLoading:A}=Yt({queryKey:["email-templates"],queryFn:async()=>{const{data:F,error:q}=await J.from("email_templates").select("*").order("name");if(q)throw q;return F.map(V=>({...V,available_variables:V.available_variables||[]}))}}),E=cr({mutationFn:async F=>{const{error:q}=await J.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"]}),ze.success("Email template updated successfully"),n(null)},onError:F=>{ze.error("Failed to update template: "+F.message)}}),T=F=>{n(F),l(F.subject),h(F.body_html),x(F.description||""),_(F.is_active),C("visual")},P=()=>{e&&E.mutate({id:e.id,subject:o,body_html:i,description:p,is_active:y})},z=(F,q)=>{let V=F;return q.forEach(K=>{const G=`{{${K.key}}}`,te=`[${K.label}]`;V=V.replace(new RegExp(G.replace(/[{}]/g,"\\$&"),"g"),te)}),V};return e?r.jsxs(Lr,{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(ee,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{variant:"outline",onClick:()=>a(e),children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{onClick:P,disabled:E.isPending,children:[r.jsx(bg,{className:"h-4 w-4 mr-2"}),E.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ua,{className:"h-5 w-5"}),e.name]}),r.jsxs(Tn,{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(He,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Ps,{id:"active-toggle",checked:y,onCheckedChange:_})]})]})}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:p,onChange:F=>x(F.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"subject",children:"Email Subject"}),r.jsx(dt,{id:"subject",value:o,onChange:F=>l(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(He,{children:"Email Body"}),r.jsx(Ii,{value:j,onValueChange:F=>C(F),children:r.jsxs(wi,{className:"h-8",children:[r.jsxs(nn,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(vj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(nn,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(hj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),j==="visual"?r.jsx(Swt,{content:i,onChange:h,variables:e.available_variables}):r.jsx(ps,{value:i,onChange:F=>h(F.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Fr,{open:!!s,onOpenChange:()=>a(null),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Email Preview"}),r.jsxs(Qn,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(i,e.available_variables)}})})]})})]}):r.jsx(Lr,{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"})]}),A?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((F,q)=>r.jsx(Ye,{children:r.jsxs(Gt,{children:[r.jsx(Ir,{className:"h-5 w-48"}),r.jsx(Ir,{className:"h-4 w-96"})]})},q))}):r.jsx("div",{className:"grid gap-4",children:N==null?void 0:N.map(F=>r.jsxs(Ye,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Zt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(ua,{className:"h-5 w-5 text-muted-foreground"}),F.name,!F.is_active&&r.jsx(Ot,{variant:"secondary",children:"Inactive"})]}),r.jsx(Tn,{children:F.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>a(F),children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{size:"sm",onClick:()=>T(F),children:[r.jsx(ic,{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(Ot,{variant:"outline",className:"font-mono text-xs",children:`{{${q.key}}}`},q.key))})]})]})})]},F.id))}),r.jsx(Fr,{open:!!s&&!e,onOpenChange:()=>a(null),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(Qn,{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:z(s.body_html,s.available_variables)}})})]})})]})})}const Mwt=({brokerageId:t})=>{var $l,yu;const{toast:e}=pi(),[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(""),[h,p]=I.useState("all"),[x,y]=I.useState(new Set),[_,j]=I.useState(!1),[C,N]=I.useState({}),[A,E]=I.useState(!1),[T,P]=I.useState(!1),[z,F]=I.useState({email:"",name:"",password:"",phone:""}),[q,V]=I.useState(!1),[K,G]=I.useState(null),[te,ie]=I.useState(!1),[oe,ye]=I.useState(!1),[ae,pe]=I.useState(!1),[se,he]=I.useState(""),[ue,_e]=I.useState(!1),[Ae,Ce]=I.useState([]),[Se,ge]=I.useState(!1),[Le,ke]=I.useState(!1),[Be,Ee]=I.useState(null),[Ue,Fe]=I.useState({name:"",phone:"",email:""}),[be,tt]=I.useState(!1),[Te,Ke]=I.useState(!1),[me,yt]=I.useState(null),[rt,at]=I.useState("asc"),[Me,ft]=I.useState(!1),[qe,Oe]=I.useState(null),[Qe,nt]=I.useState(!1),[gt,mt]=I.useState(null),[Mt,wt]=I.useState(""),[Qt,Cr]=I.useState(!1),[cn,jn]=I.useState(null);I.useEffect(()=>{Pn(),Qr()},[t]);const Qr=async()=>{try{const{data:et,error:xe}=await J.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",t);if(xe)throw xe;Ce((et==null?void 0:et.map(Ie=>Ie.user_id))||[])}catch(et){console.error("Error loading brokerage managers:",et)}},Pn=async()=>{try{o(!0);const{data:et,error:xe}=await J.functions.invoke("get-brokerage-agents",{body:{brokerageId:t}});if(xe)throw xe;const Ie=et.agents||[];if(s(Ie),Ie.length>0){const Ge=Ie.map(vt=>vt.id),{data:kt}=await J.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ge);if(kt&&kt.length>0){const vt=kt.map(Pt=>Pt.assistant_id),{data:At}=await J.from("profiles").select("id, name, email").in("id",vt),Bt={};for(const Pt of kt){const Ut=At==null?void 0:At.find(fr=>fr.id===Pt.assistant_id);Ut&&(Bt[Pt.agent_id]={name:Ut.name||"",email:Ut.email||""})}N(Bt)}else N({})}}catch(et){console.error("Error loading agents:",et),e({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},js=async()=>{if(!z.email||!z.name||!z.password){e({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}P(!0);try{const{data:{session:et}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${et==null?void 0:et.access_token}`},body:JSON.stringify({...z,brokerageId:t})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to create agent");e({title:"Success",description:`Agent ${z.email} created successfully`}),F({email:"",name:"",password:"",phone:""}),E(!1),Pn()}catch(et){console.error("Error creating agent:",et),e({title:"Error",description:et.message||"Failed to create agent",variant:"destructive"})}finally{P(!1)}},hr=async et=>{try{const{data:{session:xe}}=await J.auth.getSession(),Ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe==null?void 0:xe.access_token}`},body:JSON.stringify({userId:et})}),Ge=await Ie.json();if(!Ie.ok)throw new Error(Ge.error||"Failed to resend welcome email");e({title:"Success",description:"Welcome email sent successfully"})}catch(xe){console.error("Error resending welcome email:",xe),e({title:"Error",description:xe.message||"Failed to resend welcome email",variant:"destructive"})}},xs=async(et,xe)=>{try{const{error:Ie}=await J.functions.invoke("send-password-reset",{body:{email:et,redirectTo:window.location.origin}});if(Ie)throw Ie;e({title:"Password Reset Sent",description:`Password reset email sent to ${xe}`})}catch(Ie){console.error("Error sending password reset:",Ie),e({title:"Error",description:Ie.message||"Failed to send password reset email",variant:"destructive"})}},ka=et=>{G(et),V(!0)},xa=et=>{Ee(et),Fe({name:et.name,phone:et.phone||"",email:et.email}),ke(!0)},zi=async()=>{if(!Be)return;if(!Ue.name.trim()){e({title:"Error",description:"Name is required",variant:"destructive"});return}const et=Ue.email.trim().toLowerCase()!==Be.email.toLowerCase();tt(!0);try{if(et){if(!Ue.email.trim())throw new Error("Email is required");Ke(!0);const{data:{session:Ie}}=await J.auth.getSession(),Ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ie==null?void 0:Ie.access_token}`},body:JSON.stringify({agentId:Be.id,newEmail:Ue.email.trim(),brokerageId:t})}),kt=await Ge.json();if(Ke(!1),!Ge.ok)throw new Error(kt.error||"Failed to update email")}const{error:xe}=await J.from("profiles").update({name:Ue.name.trim(),phone:Ue.phone.trim()||null}).eq("id",Be.id);if(xe)throw xe;e({title:"Success",description:"Agent profile updated successfully"}),ke(!1),Ee(null),Pn()}catch(xe){console.error("Error updating agent:",xe),e({title:"Error",description:xe.message||"Failed to update agent",variant:"destructive"})}finally{tt(!1),Ke(!1)}},Bi=async()=>{if(!se){e({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}_e(!0);try{const{data:{session:et}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${et==null?void 0:et.access_token}`},body:JSON.stringify({userId:se,role:"brokerage_manager",action:"add",brokerageId:t})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to add brokerage manager");e({title:"Success",description:"Brokerage manager added successfully"}),pe(!1),he(""),Qr()}catch(et){console.error("Error adding brokerage manager:",et),e({title:"Error",description:et.message||"Failed to add brokerage manager",variant:"destructive"})}finally{_e(!1)}},nl=async et=>{try{const{data:{session:xe}}=await J.auth.getSession(),Ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe==null?void 0:xe.access_token}`},body:JSON.stringify({userId:et,role:"brokerage_manager",action:"remove",brokerageId:t})}),Ge=await Ie.json();if(!Ie.ok)throw new Error(Ge.error||"Failed to remove brokerage manager");e({title:"Success",description:"Brokerage manager role removed"}),Qr()}catch(xe){console.error("Error removing brokerage manager:",xe),e({title:"Error",description:xe.message||"Failed to remove brokerage manager",variant:"destructive"})}},xo=et=>Ae.includes(et),Hs=et=>{mt(et),wt(""),nt(!0)},Xa=async()=>{if(!(!gt||!Mt)){if(Mt.length<6){e({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}Cr(!0);try{const{data:{session:et}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${et==null?void 0:et.access_token}`},body:JSON.stringify({agentId:gt.id,brokerageId:t,action:"set_password",newPassword:Mt})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to set password");e({title:"Success",description:`Password set for ${gt.name}`}),nt(!1),mt(null),wt("")}catch(et){console.error("Error setting password:",et),e({title:"Error",description:et.message||"Failed to set password",variant:"destructive"})}finally{Cr(!1)}}},Ns=async et=>{jn(et.id);try{const{data:{session:xe}}=await J.auth.getSession(),Ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe==null?void 0:xe.access_token}`},body:JSON.stringify({agentId:et.id,brokerageId:t,action:"claim_account"})}),Ge=await Ie.json();if(!Ie.ok)throw new Error(Ge.error||"Failed to claim account");e({title:"Success",description:`Account claimed for ${et.name}`}),Pn()}catch(xe){console.error("Error claiming account:",xe),e({title:"Error",description:xe.message||"Failed to claim account",variant:"destructive"})}finally{jn(null)}},Fa=async()=>{if(K){ie(!0);try{const{data:{session:et}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${et==null?void 0:et.access_token}`},body:JSON.stringify({userId:K.id,brokerageId:t})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to remove agent");e({title:"Success",description:`${K.name} has been removed from your brokerage`}),V(!1),G(null),Pn()}catch(et){console.error("Error removing agent:",et),e({title:"Error",description:et.message||"Failed to remove agent",variant:"destructive"})}finally{ie(!1)}}},Oa=et=>{const xe=et.trim().split(" ");return xe.length>1?xe[xe.length-1].toLowerCase():et.toLowerCase()},Ro=et=>{me===et?at(rt==="asc"?"desc":"asc"):(yt(et),at("asc"))},ir=et=>me!==et?r.jsx(xg,{className:"ml-1 h-4 w-4"}):rt==="asc"?r.jsx(Zf,{className:"ml-1 h-4 w-4"}):r.jsx($x,{className:"ml-1 h-4 w-4"}),fo=n.filter(et=>{if(h==="active"&&!et.claimed||h==="pending"&&et.claimed)return!1;if(!l)return!0;const xe=l.toLowerCase();return et.name.toLowerCase().includes(xe)||et.email.toLowerCase().includes(xe)}),ml=[...fo].sort((et,xe)=>{if(!me)return 0;let Ie=0;return me==="name"?Ie=Oa(et.name).localeCompare(Oa(xe.name)):me==="status"&&(Ie=et.claimed===xe.claimed?0:et.claimed?-1:1),rt==="asc"?Ie:-Ie});fo.filter(et=>et.claimed&&!xo(et.id));const Ao=et=>{y(xe=>{const Ie=new Set(xe);return Ie.has(et)?Ie.delete(et):Ie.add(et),Ie})},ss=()=>{x.size===ml.length?y(new Set):y(new Set(ml.map(et=>et.id)))},yo=()=>{y(new Set)},xu=async()=>{const et=Array.from(x);if(et.length===0)return;j(!0);let xe=0,Ie=0;try{const{data:{session:Ge}}=await J.auth.getSession();for(const kt of et)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ge==null?void 0:Ge.access_token}`},body:JSON.stringify({userId:kt})})).ok?xe++:Ie++}catch{Ie++}xe>0?e({title:"Success",description:`Welcome emails sent to ${xe} agent${xe>1?"s":""}${Ie>0?` (${Ie} failed)`:""}`}):e({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),yo()}catch(Ge){console.error("Error bulk sending welcome emails:",Ge),e({title:"Error",description:Ge.message||"Failed to send welcome emails",variant:"destructive"})}finally{j(!1)}};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.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Agents"}),r.jsx(Tn,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>pe(!0),children:[r.jsx(nf,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(!0),children:[r.jsx(y1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(ee,{onClick:()=>E(!0),children:[r.jsx(sf,{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(wa,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:l,onChange:et=>i(et.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:h,onValueChange:et=>p(et),children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Agents"}),r.jsx(qt,{value:"active",children:"Active"}),r.jsx(qt,{value:"pending",children:"Pending"})]})]})]}),x.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:[x.size," agent",x.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:xu,disabled:_,children:[r.jsx(ua,{className:"mr-2 h-4 w-4"}),_?"Sending...":"Resend Welcome Email"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:yo,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Dl,{checked:ml.length>0&&x.size===ml.length,onCheckedChange:ss,"aria-label":"Select all"})}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ro("name"),children:["Name (Last)",ir("name")]})}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ro("status"),children:["Status",ir("status")]})}),r.jsx(It,{children:"Actions"})]})}),r.jsx(Vs,{children:ml.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):ml.map(et=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(Dl,{checked:x.has(et.id),onCheckedChange:()=>Ao(et.id),"aria-label":`Select ${et.name}`})}),r.jsx(Nt,{className:"font-medium",children:et.name}),r.jsx(Nt,{children:et.email}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[et.claimed?r.jsx(Ot,{variant:"default",children:"Active"}):r.jsx(Ot,{variant:"secondary",children:"Pending"}),xo(et.id)&&r.jsxs(Ot,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(YT,{className:"mr-1 h-3 w-3"}),"Manager"]}),C[et.id]&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:[r.jsx(Bn,{className:"mr-1 h-3 w-3"}),"Asst: ",C[et.id].name||C[et.id].email]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{Oe(et),ft(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Ec,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>xa(et),title:"Edit agent",children:r.jsx(fi,{className:"h-4 w-4"})}),!et.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>hr(et.id),title:"Resend welcome email",children:r.jsx(ua,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>Ns(et),title:"Claim account for agent",disabled:cn===et.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(kj,{className:"h-4 w-4"})})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>Hs(et),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(Qf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>xs(et.email,et.name),title:"Send password reset email",children:r.jsx(xj,{className:"h-4 w-4"})}),xo(et.id)&&r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>nl(et.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(nf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ka(et),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},et.id))})]})})]})]}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add New Agent"}),r.jsx(Qn,{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(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:z.name,onChange:et=>F({...z,name:et.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:z.email,onChange:et=>F({...z,email:et.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(dt,{id:"phone",type:"tel",value:z.phone,onChange:et=>F({...z,phone:et.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"password",children:"Temporary Password"}),r.jsx(dt,{id:"password",type:"password",value:z.password,onChange:et=>F({...z,password:et.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),r.jsx(ee,{onClick:js,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Fr,{open:q,onOpenChange:V,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Remove Agent"}),r.jsxs(Qn,{children:["Are you sure you want to remove ",r.jsx("strong",{children:K==null?void 0:K.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Fa,disabled:te,children:te?"Removing...":"Remove Agent"})]})]})}),r.jsx(fRe,{open:oe,onOpenChange:ye,fixedBrokerageId:t,onSuccess:Pn}),r.jsx(Fr,{open:ae,onOpenChange:pe,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add Brokerage Manager"}),r.jsx(Qn,{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(He,{children:"Select Agent"}),r.jsxs(hu,{open:Se,onOpenChange:ge,children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":Se,className:"w-full justify-between",children:[se?(($l=n.find(et=>et.id===se))==null?void 0:$l.name)+" ("+((yu=n.find(et=>et.id===se))==null?void 0:yu.email)+")":"Select an agent to promote...",r.jsx(p1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Bd,{className:"w-full p-0",align:"start",children:r.jsxs(W1,{children:[r.jsx(G1,{placeholder:"Search by name or email..."}),r.jsxs(K1,{className:"max-h-[200px]",children:[r.jsx(Z1,{children:"No eligible agents found."}),r.jsx(Y1,{children:n.filter(et=>!xo(et.id)).map(et=>r.jsxs(X1,{value:`${et.name} ${et.email}`,onSelect:()=>{he(et.id),ge(!1)},children:[r.jsx(Ai,{className:`mr-2 h-4 w-4 ${se===et.id?"opacity-100":"opacity-0"}`}),et.name," (",et.email,")"]},et.id))})]})]})})]}),n.filter(et=>!xo(et.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>pe(!1),children:"Cancel"}),r.jsx(ee,{onClick:Bi,disabled:ue||!se,children:ue?"Adding...":"Add as Manager"})]})]})}),r.jsx(Fr,{open:Le,onOpenChange:ke,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Agent"}),r.jsxs(Qn,{children:["Update profile information for ",Be==null?void 0:Be.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"edit-name",children:"Name"}),r.jsx(dt,{id:"edit-name",value:Ue.name,onChange:et=>Fe({...Ue,name:et.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"edit-email",children:"Email"}),r.jsx(dt,{id:"edit-email",type:"email",value:Ue.email,onChange:et=>Fe({...Ue,email:et.target.value}),placeholder:"agent@example.com"}),Ue.email.trim().toLowerCase()!==(Be==null?void 0:Be.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(He,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(dt,{id:"edit-phone",type:"tel",value:Ue.phone,onChange:et=>Fe({...Ue,phone:et.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>ke(!1),children:"Cancel"}),r.jsx(ee,{onClick:zi,disabled:be||Te,children:Te?"Updating email...":be?"Saving...":"Save Changes"})]})]})}),qe&&r.jsx(pRe,{open:Me,onOpenChange:et=>{ft(et),et||Oe(null)},userId:qe.id,userName:qe.name}),r.jsx(Fr,{open:Qe,onOpenChange:nt,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Set Password"}),r.jsxs(Qn,{children:["Set a new password for ",gt==null?void 0:gt.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(He,{htmlFor:"new-password",children:"New Password"}),r.jsx(dt,{id:"new-password",type:"password",value:Mt,onChange:et=>wt(et.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(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>nt(!1),children:"Cancel"}),r.jsx(ee,{onClick:Xa,disabled:Qt||!Mt||Mt.length<6,children:Qt?"Setting...":"Set Password"})]})]})})]})},Twt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},Awt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},Ewt=t=>{switch(t){case"academy_video":return r.jsx(Pa,{className:"h-4 w-4"});case"template":return r.jsx(La,{className:"h-4 w-4"});case"toolbox":return r.jsx(La,{className:"h-4 w-4"});case"newsletter":return r.jsx(Gx,{className:"h-4 w-4"});case"social_swag":return r.jsx(Ms,{className:"h-4 w-4"});case"event":return r.jsx(Os,{className:"h-4 w-4"});default:return r.jsx(Ls,{className:"h-4 w-4"})}},Iwt=({brokerageId:t})=>{const{toast:e}=pi(),[n,s]=I.useState([]),[a,o]=I.useState([]),[l,i]=I.useState([]),[h,p]=I.useState(!0),[x,y]=I.useState(null);I.useEffect(()=>{_()},[t]);const _=async()=>{try{p(!0);const{data:N,error:A}=await J.from("profiles").select("id, name, email").eq("brokerage_id",t);if(A)throw A;const E=N.map(ie=>ie.id),T=new Map(N.map(ie=>[ie.id,ie]));if(E.length===0){s([]),o([]),i([]);return}const{data:P,error:z}=await J.from("activity_logs").select("*").in("user_id",E).order("launched_at",{ascending:!1});if(z)throw z;const F=P.map(ie=>{var oe,ye;return{id:ie.id,user_id:ie.user_id,app_name:ie.app_name,launched_at:ie.launched_at,user_name:((oe=T.get(ie.user_id))==null?void 0:oe.name)||"Unknown",user_email:((ye=T.get(ie.user_id))==null?void 0:ye.email)||"Unknown"}});s(F);const{data:q,error:V}=await J.from("content_engagement_logs").select("*").in("user_id",E).order("created_at",{ascending:!1});if(V)throw V;const K=(q||[]).map(ie=>{var oe,ye;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:((oe=T.get(ie.user_id))==null?void 0:oe.name)||"Unknown",user_email:((ye=T.get(ie.user_id))==null?void 0:ye.email)||"Unknown"}});o(K);const G=new Map;N.forEach(ie=>{G.set(ie.id,{user_id:ie.id,user_name:ie.name,user_email:ie.email,app_launches:0,content_views:0,last_activity:""})}),F.forEach(ie=>{const oe=G.get(ie.user_id);oe&&(oe.app_launches++,(!oe.last_activity||new Date(ie.launched_at)>new Date(oe.last_activity))&&(oe.last_activity=ie.launched_at))}),K.forEach(ie=>{const oe=G.get(ie.user_id);oe&&(oe.content_views++,(!oe.last_activity||new Date(ie.created_at)>new Date(oe.last_activity))&&(oe.last_activity=ie.created_at))});const te=Array.from(G.values()).filter(ie=>ie.app_launches>0||ie.content_views>0).sort((ie,oe)=>new Date(oe.last_activity).getTime()-new Date(ie.last_activity).getTime());i(te)}catch(N){console.error("Error loading activity:",N),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{p(!1)}},j=N=>n.filter(A=>A.user_id===N),C=N=>a.filter(A=>A.user_id===N);return h?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(Gt,{children:[r.jsx(Zt,{children:"Agent Activity"}),r.jsx(Tn,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"App Launches"}),r.jsx(It,{className:"text-center",children:"Content Views"}),r.jsx(It,{children:"Last Active"})]})}),r.jsx(Vs,{children:l.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(N=>r.jsxs(Ar,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:N.user_id,name:N.user_name,email:N.user_email}),children:[r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:N.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:N.user_email})]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(fc,{className:"h-3 w-3"}),N.app_launches]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(La,{className:"h-3 w-3"}),N.content_views]})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:N.last_activity&&uu(new Date(N.last_activity),{addSuffix:!0})})]},N.user_id))})]})})})]}),r.jsx(Fr,{open:!!x,onOpenChange:N=>!N&&y(null),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Qn,{children:x==null?void 0:x.email})]}),r.jsxs(Ii,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsx(nn,{value:"content",children:"Content Engagement"}),r.jsx(nn,{value:"apps",children:"App Launches"})]}),r.jsx(Sn,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:x&&C(x.id).length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&C(x.id).map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"max-w-[200px] truncate font-medium",children:N.resource_title}),r.jsx(Nt,{children:r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[Ewt(N.resource_type),Twt[N.resource_type]||N.resource_type]})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:Awt[N.action_type]||N.action_type})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:uu(new Date(N.created_at),{addSuffix:!0})})]},N.id))})]})})}),r.jsx(Sn,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:x&&j(x.id).length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&j(x.id).map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:N.app_name})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:uu(new Date(N.launched_at),{addSuffix:!0})})]},N.id))})]})})})]})]})})]})},Pwt=({brokerageId:t})=>{const{toast:e}=pi(),[n,s]=I.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[a,o]=I.useState(!0);I.useEffect(()=>{l()},[t]);const l=async()=>{try{o(!0);const{data:i,error:h}=await J.from("profiles").select("id").eq("brokerage_id",t);if(h)throw h;const p=i.map(F=>F.id),x=p.length;if(p.length===0){o(!1);return}const{data:y,error:_}=await J.from("profiles").select("id, email").in("id",p);if(_)throw _;const{count:j}=await J.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",t).not("last_login","is",null),C=j||0,N=x-C,{count:A}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p),E=new Date;E.setDate(E.getDate()-7);const{count:T}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",E.toISOString()),P=new Date;P.setMonth(P.getMonth()-1);const{count:z}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",P.toISOString());s({totalAgents:x,activeAgents:C,pendingAgents:N,totalLaunches:A||0,launchesThisWeek:T||0,launchesThisMonth:z||0})}catch(i){console.error("Error loading analytics:",i),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};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("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(Bn,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(Yi,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ya,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(gg,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(gg,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(gg,{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"})]})]})]})},Lwt=({brokerageId:t})=>{const[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState({description:"",maxUses:""});I.useEffect(()=>{y()},[t]);const y=async()=>{try{const{data:E,error:T}=await J.from("invite_codes").select("*").eq("brokerage_id",t).order("created_at",{ascending:!1});if(T)throw T;n(E||[])}catch(E){console.error("Error loading invite codes:",E),ze.error("Failed to load invite links")}finally{a(!1)}},_=()=>Math.random().toString(36).substring(2,8).toUpperCase(),j=async()=>{l(!0);try{const E=_(),{error:T}=await J.from("invite_codes").insert({code:E,description:p.description||null,max_uses:p.maxUses?parseInt(p.maxUses):null,brokerage_id:t,is_active:!0});if(T)throw T;ze.success("Invite link created!"),h(!1),x({description:"",maxUses:""}),y()}catch(E){console.error("Error creating invite code:",E),ze.error("Failed to create invite link")}finally{l(!1)}},C=async E=>{try{const{error:T}=await J.from("invite_codes").delete().eq("id",E);if(T)throw T;ze.success("Invite link deleted"),n(e.filter(P=>P.id!==E))}catch(T){console.error("Error deleting invite code:",T),ze.error("Failed to delete invite link")}},N=async(E,T)=>{try{const{error:P}=await J.from("invite_codes").update({is_active:!T}).eq("id",E);if(P)throw P;n(e.map(z=>z.id===E?{...z,is_active:!T}:z)),ze.success(`Invite link ${T?"deactivated":"activated"}`)}catch(P){console.error("Error toggling invite code:",P),ze.error("Failed to update invite link")}},A=E=>{const T=`${window.location.origin}/join?code=${E}`;navigator.clipboard.writeText(T),ze.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(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(Tn,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Fr,{open:i,onOpenChange:h,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create Invite Link"}),r.jsx(Qn,{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(He,{htmlFor:"description",children:"Description (optional)"}),r.jsx(dt,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:p.description,onChange:E=>x({...p,description:E.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(dt,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:p.maxUses,onChange:E=>x({...p,maxUses:E.target.value})})]}),r.jsx(ee,{onClick:j,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(en,{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(Co,{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(E=>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:E.code}),r.jsx(Ot,{variant:E.is_active?"default":"secondary",children:E.is_active?"Active":"Inactive"})]}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:E.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[E.uses_count," uses",E.max_uses&&` / ${E.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>A(E.code),title:"Copy link",children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(E.id,E.is_active),title:E.is_active?"Deactivate":"Activate",children:E.is_active?"Disable":"Enable"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>C(E.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Vn,{className:"h-4 w-4"})})]})]},E.id))})})]})},Owt=({open:t,onOpenChange:e,referralCode:n,brokerageId:s,senderName:a,brokerageName:o,onInvitesSent:l})=>{const[i,h]=I.useState(""),[p,x]=I.useState([]),[y,_]=I.useState(""),[j,C]=I.useState(!1),N=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z),A=()=>{const z=i.trim().toLowerCase();if(z&&N(z)&&!p.includes(z)){if(p.length>=10){ze.error("Maximum 10 emails per invite");return}x([...p,z]),h("")}else z&&!N(z)?ze.error("Please enter a valid email address"):p.includes(z)&&ze.error("Email already added")},E=z=>{x(p.filter(F=>F!==z))},T=z=>{(z.key==="Enter"||z.key===",")&&(z.preventDefault(),A())},P=async()=>{if(p.length===0){ze.error("Please add at least one email address");return}C(!0);try{const{data:z,error:F}=await J.functions.invoke("send-referral-invite",{body:{emails:p,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:a,brokerageName:o}});if(F)throw F;z.successCount===z.totalCount?ze.success(`${z.successCount} invite${z.successCount>1?"s":""} sent successfully!`):ze.warning(`${z.successCount} of ${z.totalCount} invites sent. Some failed.`),x([]),_(""),e(!1),l==null||l()}catch(z){console.error("Error sending invites:",z),ze.error("Failed to send invites. Please try again.")}finally{C(!1)}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-[550px]",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(ua,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Qn,{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(Ki,{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(He,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:i,onChange:z=>h(z.target.value),onKeyDown:T,onBlur:A}),r.jsx(ee,{type:"button",variant:"secondary",onClick:A,children:"Add"})]}),p.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.map(z=>r.jsxs(Ot,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[z,r.jsx("button",{type:"button",onClick:()=>E(z),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(_s,{className:"h-3 w-3"})})]},z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{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:y,onChange:z=>_(z.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[y.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(Ms,{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(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{onClick:P,disabled:p.length===0||j,children:j?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(Do,{className:"h-4 w-4 mr-2"}),"Send ",p.length>0&&`(${p.length})`," Invite",p.length!==1?"s":""]})})]})]})})},Dwt=({brokerageId:t,refreshTrigger:e})=>{const[n,s]=I.useState([]),[a,o]=I.useState(!0);I.useEffect(()=>{l()},[t,e]);const l=async()=>{try{const{data:h,error:p}=await J.from("referral_invites").select("*").eq("referrer_brokerage_id",t).order("sent_at",{ascending:!1}).limit(20);if(p)throw p;s(h||[])}catch(h){console.error("Error fetching invites:",h)}finally{o(!1)}},i=h=>{switch(h){case"signed_up":return r.jsxs(Ot,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(Yi,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Ot,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(Vc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),"Pending"]})}};return a?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(ua,{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(h=>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:h.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",xn(new Date(h.sent_at),"MMM d, yyyy")]})]}),i(h.status)]},h.id))]})},Rwt=()=>{const{brokerageId:t,user:e}=Xr(),[n,s]=I.useState(null),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState([]),[x,y]=I.useState(!0),[_,j]=I.useState(!1),[C,N]=I.useState(0);I.useEffect(()=>{t&&A()},[t]);const A=async()=>{try{const[q,V]=await Promise.all([J.from("brokerages").select("name").eq("id",t).single(),e?J.from("profiles").select("name").eq("id",e.id).single():Promise.resolve({data:null})]);q.data&&o(q.data.name),V.data&&i(V.data.name||"A LevelUp Member");const{data:K}=await J.from("referral_codes").select("code").eq("brokerage_id",t).single();if(K)s(K.code);else{const te=`REF${t==null?void 0:t.slice(0,8).toUpperCase()}`;await J.from("referral_codes").insert({brokerage_id:t,code:te}),s(te)}const{data:G}=await J.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});p(G||[])}catch(q){console.error("Error fetching referral data:",q)}finally{y(!1)}},E=()=>{const q=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(q),ze.success("Referral link copied to clipboard!")},T=h.filter(q=>q.status==="qualified").length,P=h.filter(q=>q.status==="pending").length,z=T*25,F=Math.max(0,Math.ceil((299-z)/25));return x?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(Ki,{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:["$",z]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),z>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(Yi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),F>0&&z<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"})]}),z>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Ms,{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(ee,{onClick:()=>j(!0),className:"w-full",size:"lg",children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(ee,{onClick:E,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Qo,{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(fd,{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:["$",z]}),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(Bn,{className:"h-5 w-5 mx-auto text-primary mb-1"}),r.jsx("p",{className:"text-2xl font-bold",children:T}),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(Ya,{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:P}),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(Dwt,{brokerageId:t,refreshTrigger:C}),h.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),h.slice(0,5).map(q=>{var V,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:((V=q.referred_brokerage)==null?void 0:V.name)||((K=q.referred_user)==null?void 0:K.email)||"Pending setup"}),r.jsxs(Ot,{variant:q.status==="qualified"?"default":q.status==="pending"?"secondary":"destructive",className:q.status==="qualified"?"bg-green-600":"",children:[q.status==="qualified"&&r.jsx(Yi,{className:"h-3 w-3 mr-1"}),q.status]})]},q.id)})]})]})]}),r.jsx(Owt,{open:_,onOpenChange:j,referralCode:n||"",brokerageId:t||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>N(q=>q+1)})]})},Fwt=()=>{const{user:t,isBrokerageManager:e,brokerageId:n,isAdmin:s,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=Xr(),i=Zn(),{toast:h}=pi(),[p,x]=I.useState(""),[y,_]=I.useState(!0),j=o||(a.length>0?a[0].id:n);I.useEffect(()=>{if(!t||!e&&!s){i("/dashboard");return}!o&&a.length>0&&l(a[0].id),j?C():a.length===0&&!n&&_(!1)},[t,e,s,j,i,a,o]);const C=async()=>{if(!j){_(!1);return}try{const{data:N,error:A}=await J.from("brokerages").select("name").eq("id",j).single();if(A)throw A;x(N.name)}catch(N){console.error("Error loading brokerage info:",N),h({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{_(!1)}};return y?r.jsx(Lr,{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"})})}):j?r.jsx(Lr,{title:p||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[a.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(gn,{value:o||"",onValueChange:l,children:[r.jsxs(fn,{className:"w-[280px]",children:[r.jsx(ai,{className:"mr-2 h-4 w-4"}),r.jsx(yn,{placeholder:"Select brokerage"})]}),r.jsx(pn,{children:a.map(N=>r.jsx(qt,{value:N.id,children:N.name},N.id))})]})]}),r.jsxs(Ii,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(wi,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(nn,{value:"agents",children:"Agents"}),r.jsx(nn,{value:"invite",children:"Invite Links"}),r.jsx(nn,{value:"referrals",children:"Referrals"}),r.jsx(nn,{value:"leaderboard",children:"Leaderboard"}),r.jsx(nn,{value:"activity",children:"Activity"}),r.jsx(nn,{value:"analytics",children:"Analytics"}),r.jsx(nn,{value:"shares",children:"Shares"})]}),r.jsx(Sn,{value:"agents",className:"space-y-4",children:r.jsx(Mwt,{brokerageId:j})}),r.jsx(Sn,{value:"invite",className:"space-y-4",children:r.jsx(Lwt,{brokerageId:j})}),r.jsx(Sn,{value:"referrals",className:"space-y-4",children:r.jsx(Rwt,{})}),r.jsx(Sn,{value:"leaderboard",className:"space-y-4",children:r.jsx(PDe,{brokerageId:j,title:`${p} Event Leaderboard`,showUserStats:!1})}),r.jsx(Sn,{value:"activity",className:"space-y-4",children:r.jsx(Iwt,{brokerageId:j})}),r.jsx(Sn,{value:"analytics",className:"space-y-4",children:r.jsx(Pwt,{brokerageId:j})}),r.jsx(Sn,{value:"shares",className:"space-y-4",children:r.jsx(wze,{brokerageOnly:!0,brokerageId:j})})]})]})}):r.jsx(Lr,{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(ai,{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 zwt({brokerageId:t,canManage:e}){const{user:n}=Xr(),[s,a]=I.useState([]),[o,l]=I.useState(!0),[i,h]=I.useState(!1),[p,x]=I.useState(null),[y,_]=I.useState(null),[j,C]=I.useState(!1),[N,A]=I.useState(""),[E,T]=I.useState(""),[P,z]=I.useState(!1),F=async()=>{try{const{data:te,error:ie}=await J.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(ie)throw ie;const oe=te;if(oe&&oe.length>0){const ye=[...new Set(oe.map(he=>he.created_by))],{data:ae}=await J.from("profiles").select("id, name, avatar_url").in("id",ye),pe=new Map((ae==null?void 0:ae.map(he=>[he.id,he]))||[]),se=oe.map(he=>({...he,author:pe.get(he.created_by)||{name:"Unknown",avatar_url:null}}));a(se)}else a([])}catch(te){console.error("Error fetching announcements:",te)}finally{l(!1)}};I.useEffect(()=>{F()},[t]);const q=()=>{A(""),T(""),z(!1),x(null)},V=te=>{te?(x(te),A(te.title),T(te.content),z(te.is_pinned)):q(),h(!0)},K=async()=>{if(!N.trim()||!E.trim()){ze.error("Please fill in all fields");return}C(!0);try{if(p){const{error:te}=await J.from("brokerage_announcements").update({title:N.trim(),content:E.trim(),is_pinned:P,pinned_at:P?new Date().toISOString():null}).eq("id",p.id);if(te)throw te;ze.success("Announcement updated")}else{const{error:te}=await J.from("brokerage_announcements").insert({brokerage_id:t,created_by:n==null?void 0:n.id,title:N.trim(),content:E.trim(),is_pinned:P,pinned_at:P?new Date().toISOString():null});if(te)throw te;ze.success("Announcement created")}h(!1),q(),F()}catch(te){console.error("Error saving announcement:",te),ze.error("Failed to save announcement")}finally{C(!1)}},G=async()=>{if(y)try{const{error:te}=await J.from("brokerage_announcements").delete().eq("id",y);if(te)throw te;ze.success("Announcement deleted"),F()}catch(te){console.error("Error deleting announcement:",te),ze.error("Failed to delete announcement")}finally{_(null)}};return o?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ym,{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(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ym,{className:"h-5 w-5 text-primary"}),"Announcements"]}),e&&r.jsxs(ee,{size:"sm",onClick:()=>V(),className:"gap-1",children:[r.jsx(bn,{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(te=>{var ie,oe,ye,ae;return r.jsx("div",{className:`p-4 rounded-lg border ${te.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:[te.is_pinned&&r.jsx(k1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:te.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:te.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(Ks,{className:"h-5 w-5",children:[r.jsx(Ei,{src:((ie=te.author)==null?void 0:ie.avatar_url)||void 0}),r.jsx(Zs,{className:"text-[10px]",children:((ye=(oe=te.author)==null?void 0:oe.name)==null?void 0:ye.charAt(0))||"?"})]}),r.jsx("span",{children:(ae=te.author)==null?void 0:ae.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:xn(new Date(te.created_at),"MMM d, yyyy")})]})]}),e&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>V(te),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>_(te.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})},te.id)})})})]}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:p?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",value:N,onChange:te=>A(te.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"content",children:"Content"}),r.jsx(ps,{id:"content",value:E,onChange:te=>T(te.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(Ps,{id:"pinned",checked:P,onCheckedChange:z}),r.jsxs(He,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(k1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{onClick:K,disabled:j,children:j?"Saving...":p?"Update":"Create"})]})]})]})}),r.jsx(Ou,{open:!!y,onOpenChange:()=>_(null),children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Delete Announcement"}),r.jsx(ou,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Bwt({brokerageId:t}){const[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(""),[i,h]=I.useState(new Set);I.useEffect(()=>{(async()=>{try{const{data:y,error:_}=await J.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(_)throw _;if(n(y||[]),y&&y.length>0){const j=y.map(N=>N.id),{data:C}=await J.from("agent_assistant_assignments").select("agent_id").in("agent_id",j);C&&h(new Set(C.map(N=>N.agent_id)))}}catch(y){console.error("Error fetching agents:",y)}finally{a(!1)}})()},[t]);const p=e.filter(x=>{var y,_;return x.name.toLowerCase().includes(o.toLowerCase())||x.email.toLowerCase().includes(o.toLowerCase())||((y=x.title)==null?void 0:y.toLowerCase().includes(o.toLowerCase()))||((_=x.areas_served)==null?void 0:_.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{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(x=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},x))})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:o,onChange:x=>l(x.target.value),className:"pl-9"})]})]}),r.jsx(Je,{children:p.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:p.map(x=>r.jsx($wt,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function $wt({agent:t,hasAssistant:e}){const n=t.name.split(" ").map(s=>s[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(Ks,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:t.name}),r.jsx(Zs,{className:"text-lg bg-primary/10 text-primary",children:n})]}),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}),e&&r.jsx(Ot,{variant:"outline",className:"text-[10px] mt-1",children:"Has Assistant"})]}),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(Mo,{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(ee,{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(bi,{className:"h-4 w-4"})})}),r.jsx(ee,{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(ua,{className:"h-4 w-4"})})}),t.linkedin_url&&r.jsx(ee,{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(xm,{className:"h-4 w-4"})})}),t.instagram_url&&r.jsx(ee,{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(du,{className:"h-4 w-4"})})})]})]})}function Uwt({brokerageId:t}){const[e,n]=I.useState([]),[s,a]=I.useState(!0);if(I.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await J.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(p)throw p;if(!h||h.length===0){n([]),a(!1);return}const x=h.map(N=>N.id),{data:y,error:_}=await J.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(_)throw _;const j=new Map(h.map(N=>[N.id,N])),C=(y||[]).filter(N=>N.total_points>0).map(N=>{const A=j.get(N.user_id);return{user_id:N.user_id,total_points:N.total_points,name:(A==null?void 0:A.name)||"Unknown",avatar_url:(A==null?void 0:A.avatar_url)||null}});n(C)}catch(h){console.error("Error fetching leaderboard:",h)}finally{a(!1)}})()},[t]),s)return r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{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(i=>r.jsx("div",{className:"h-12 bg-muted rounded"},i))})})]});const o=i=>i===1?"text-yellow-500":i===2?"text-gray-400":i===3?"text-amber-600":"text-muted-foreground",l=i=>i<=3?r.jsx(Wx,{className:zt("h-5 w-5",o(i))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:i});return r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{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((i,h)=>{const p=i.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=h+1;return r.jsxs("div",{className:zt("flex items-center gap-3 p-2 rounded-lg",x<=3&&"bg-muted/50"),children:[r.jsx("div",{className:"w-6 flex justify-center",children:l(x)}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:i.avatar_url||void 0}),r.jsx(Zs,{className:"text-xs",children:p})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:i.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[i.total_points.toLocaleString()," pts"]})]},i.user_id)})})})]})}function qwt({brokerageId:t}){const e=Zn(),[n,s]=I.useState([]),[a,o]=I.useState(!0);I.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await J.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(p)throw p;if(!h||h.length===0){s([]),o(!1);return}const x=h.map(N=>N.id),y=new Map(h.map(N=>[N.id,N])),{data:_,error:j}=await J.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",x).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(j)throw j;const C=(_||[]).map(N=>({id:N.id,slug:N.slug,property_address:N.property_address,city:N.city,price:N.price,property_type:N.property_type,agent_id:N.agent_id,agent:y.get(N.agent_id)||null,photos:N.listing_photos||[]}));s(C)}catch(h){console.error("Error fetching listings:",h)}finally{o(!1)}})()},[t]);const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(i);return a?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(da,{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(i=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},i))})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>e("/mission-control/listings"),className:"gap-1",children:[r.jsx(bn,{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(da,{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(ee,{size:"sm",onClick:()=>e("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(bn,{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(i=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${i.slug||i.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:[i.photos&&i.photos.length>0?r.jsx("img",{src:i.photos[0].photo_url,alt:i.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(da,{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:i.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:l(i.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:i.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.city}),i.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",i.agent.name]})]})]},i.id))}),n.length>0&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>e("/mission-control/listings"),children:["View All Listings",r.jsx(Ls,{className:"h-3 w-3 ml-1"})]})]})]})}function Vwt(){const{user:t,isAdmin:e,isBrokerageManager:n}=Xr(),s=Zn(),[a,o]=I.useState(!0),[l,i]=I.useState(null),[h,p]=I.useState(""),[x,y]=I.useState(0),[_,j]=I.useState(!1),[C,N]=I.useState(!1);return I.useEffect(()=>{(async()=>{if(t)try{const{data:E}=await J.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle();if(!(E!=null&&E.brokerage_id)){o(!1);return}i(E.brokerage_id);const{data:T}=await J.from("brokerages").select("name").eq("id",E.brokerage_id).maybeSingle();T&&p(T.name);const{count:P}=await J.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",E.brokerage_id);if(y(P||0),e)j(!0),N(!0);else if(n){const{data:z}=await J.from("brokerage_manager_assignments").select("id").eq("user_id",t.id).eq("brokerage_id",E.brokerage_id).maybeSingle();j(!!z),N(!!z)}}catch(E){console.error("Error fetching brokerage info:",E)}finally{o(!1)}})()},[t,e,n]),a?r.jsx(Lr,{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"})})}):l?r.jsx(Lr,{title:h||"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(Bn,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),C&&r.jsxs(ee,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(zwt,{brokerageId:l,canManage:_}),r.jsx(Bwt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(Uwt,{brokerageId:l}),r.jsx(qwt,{brokerageId:l})]})]})}):r.jsx(Lr,{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(ai,{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 Hwt(){const t=Zn(),[e,n]=I.useState(""),[s,a]=I.useState("grid"),{data:o,isLoading:l}=Yt({queryKey:["newsletters"],queryFn:async()=>{const{data:P,error:z}=await J.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(z)throw z;return P}}),{data:i}=Yt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:P}=await J.from("newsletter_likes").select("newsletter_id");return P||[]}}),{data:h}=Yt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:P}=await J.from("newsletter_comments").select("newsletter_id");return P||[]}}),{data:p}=Yt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[P,z,F,q]=await Promise.all([J.from("newsletter_canva_links").select("newsletter_id"),J.from("newsletter_pdfs").select("newsletter_id"),J.from("newsletter_videos").select("newsletter_id"),J.from("newsletter_drive_links").select("newsletter_id")]);return{canva:P.data||[],pdfs:z.data||[],videos:F.data||[],drives:q.data||[]}}}),x=P=>(i==null?void 0:i.filter(z=>z.newsletter_id===P).length)||0,y=P=>(h==null?void 0:h.filter(z=>z.newsletter_id===P).length)||0,_=P=>{var z;return((z=p==null?void 0:p.canva)==null?void 0:z.filter(F=>F.newsletter_id===P).length)||0},j=P=>{var z;return((z=p==null?void 0:p.pdfs)==null?void 0:z.filter(F=>F.newsletter_id===P).length)||0},C=P=>{var z;return((z=p==null?void 0:p.videos)==null?void 0:z.filter(F=>F.newsletter_id===P).length)||0},N=P=>{var z;return((z=p==null?void 0:p.drives)==null?void 0:z.filter(F=>F.newsletter_id===P).length)||0},A=P=>_(P)+j(P)+C(P)+N(P),E=o==null?void 0:o.filter(P=>{var z;return P.title.toLowerCase().includes(e.toLowerCase())||((z=P.description)==null?void 0:z.toLowerCase().includes(e.toLowerCase()))}),T=P=>{t(`/newsletters/${P}`)};return r.jsx(Lr,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search newsletters...",value:e,onChange:P=>n(P.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(Yf,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(Xf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(E==null?void 0:E.length)||0," item",(E==null?void 0:E.length)!==1?"s":""," found"]}),l&&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((P,z)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-0",children:[r.jsx(Ir,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-full"})]})]})},z))}),!l&&(E==null?void 0:E.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(La,{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(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&E&&E.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-3",children:E.map(P=>{const z=A(P.id),F=_(P.id),q=j(P.id),V=C(P.id);return s==="grid"?r.jsxs(Ye,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(P.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:P.preview_image_url?r.jsx("img",{src:P.preview_image_url,alt:P.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(La,{className:"h-16 w-16"})})}),r.jsxs(Je,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:P.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[r.jsx(Os,{className:"h-3 w-3"}),xn(new Date(P.publish_date),"MMM d, yyyy")]})]}),P.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:P.description.replace(/<[^>]*>/g,"")}),z>0&&r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[F>0&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(pd,{className:"h-3 w-3"})," ",F," Template",F>1?"s":""]}),q>0&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(no,{className:"h-3 w-3"})," ",q," PDF",q>1?"s":""]}),V>0&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(fc,{className:"h-3 w-3"})," ",V," Video",V>1?"s":""]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground pt-1 border-t border-border/50",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(gd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]},P.id):r.jsx(Ye,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(P.id),children:r.jsxs("div",{className:"flex flex-row",children:[r.jsx("div",{className:"relative overflow-hidden bg-muted w-40 sm:w-48 shrink-0",children:P.preview_image_url?r.jsx("img",{src:P.preview_image_url,alt:P.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 min-h-[100px]",children:r.jsx(La,{className:"h-10 w-10"})})}),r.jsxs(Je,{className:"p-4 flex-1 flex flex-col justify-center gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:P.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[r.jsx(Os,{className:"h-3 w-3"}),xn(new Date(P.publish_date),"MMM d, yyyy")]})]}),P.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:P.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[z>0&&r.jsxs("span",{children:[z," resource",z>1?"s":""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(gd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]})},P.id)})})]})})}function Wwt({rows:t}){if(!t||t.length===0)return null;const e=t.filter(n=>n.columns.some(s=>s.title||s.description||s.image_url));return e.length===0?null:r.jsx("div",{className:"space-y-6",children:e.map((n,s)=>{const a=n.columns.filter(o=>o.title||o.description||o.image_url);return a.length===0?null:r.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},children:a.map((o,l)=>r.jsxs(Ye,{className:"overflow-hidden border-border/50",children:[o.image_url&&r.jsx("img",{src:o.image_url,alt:o.title||"",className:"w-full h-40 object-cover"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[o.title&&r.jsx("h4",{className:"font-semibold text-foreground",children:o.title}),o.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})]},l))},s)})})}function Gwt(){const{id:t}=Yc(),e=Zn(),{user:n}=Xr(),{toast:s}=pi(),a=Vr(),{trackEngagement:o}=TI(),[l,i]=I.useState(""),{data:h,isLoading:p}=Yt({queryKey:["newsletter",t],queryFn:async()=>{const{data:F,error:q}=await J.from("newsletter_content").select("*").eq("id",t).single();if(q)throw q;return F},enabled:!!t});I.useEffect(()=>{h&&o("newsletter",h.id,h.title,"view")},[h==null?void 0:h.id]);const{data:x}=Yt({queryKey:["newsletter-drives",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_drive_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:y}=Yt({queryKey:["newsletter-pdfs",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_pdfs").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:_}=Yt({queryKey:["newsletter-videos",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_videos").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:j}=Yt({queryKey:["newsletter-canva-links",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_canva_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:C}=Yt({queryKey:["newsletter-likes",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_likes").select("*").eq("newsletter_id",t);return F||[]},enabled:!!t}),{data:N}=Yt({queryKey:["newsletter-comments",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",t).order("created_at",{ascending:!1});return F||[]},enabled:!!t}),A=C==null?void 0:C.some(F=>F.user_id===(n==null?void 0:n.id)),E=cr({mutationFn:async()=>{A?await J.from("newsletter_likes").delete().eq("newsletter_id",t).eq("user_id",n==null?void 0:n.id):await J.from("newsletter_likes").insert({newsletter_id:t,user_id:n==null?void 0:n.id})},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-likes",t]})}}),T=cr({mutationFn:async F=>{const{error:q}=await J.from("newsletter_comments").insert({newsletter_id:t,user_id:n==null?void 0:n.id,content:F});if(q)throw q},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),i(""),s({title:"Comment added"})}}),P=cr({mutationFn:async F=>{const{error:q}=await J.from("newsletter_comments").delete().eq("id",F);if(q)throw q},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),s({title:"Comment deleted"})}}),z=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(fc,{className:"h-4 w-4"})," Watch Video"]})};return p?r.jsx(Lr,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-32"}),r.jsx(Ir,{className:"h-64 w-full"}),r.jsx(Ir,{className:"h-32 w-full"})]})}):h?r.jsx(Lr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/newsletters"),className:"mb-4",children:[r.jsx(so,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),h.preview_image_url&&r.jsx("img",{src:h.preview_image_url,alt:h.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:h.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:xn(new Date(h.publish_date),"MMMM d, yyyy")})]}),h.description&&r.jsx("div",{className:"text-lg 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:h.description}}),r.jsx(Wwt,{rows:h.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(f3,{resourceType:"newsletter",resourceId:h.id,resourceTitle:h.title}),r.jsxs(ee,{variant:A?"default":"outline",size:"sm",onClick:()=>E.mutate(),children:[r.jsx(ci,{className:`h-4 w-4 mr-1 ${A?"fill-current":""}`}),(C==null?void 0:C.length)||0," ",(C==null?void 0:C.length)===1?"Like":"Likes"]})]}),j&&j.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(Je,{className:"space-y-2",children:j.map(F=>r.jsxs("a",{href:F.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(pd,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:F.title}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},F.id))})]}),x&&x.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(Je,{className:"space-y-2",children:x.map(F=>r.jsxs("a",{href:F.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ls,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:F.title})]},F.id))})]}),y&&y.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(Je,{className:"space-y-2",children:y.map(F=>r.jsxs("a",{href:F.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(La,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:F.name}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground"})]},F.id))})]}),_&&_.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Videos"})}),r.jsx(Je,{className:"space-y-6",children:_.map(F=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:F.title}),z(F.video_url)]},F.id))})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"text-lg",children:["Comments (",(N==null?void 0:N.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:l,onChange:F=>i(F.target.value),className:"flex-1"}),r.jsx(ee,{onClick:()=>l.trim()&&T.mutate(l),disabled:!l.trim()||T.isPending,children:r.jsx(Do,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:N==null?void 0:N.map(F=>{var q,V,K;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{children:((V=(q=F.profiles)==null?void 0:q.name)==null?void 0:V[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:xn(new Date(F.created_at),"MMM d, yyyy")}),F.user_id===(n==null?void 0:n.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>P.mutate(F.id),children:r.jsx(Vn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.content})]})]},F.id)})})]})]})]})}):r.jsx(Lr,{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(ee,{variant:"link",onClick:()=>e("/newsletters"),children:"Back to Newsletters"})]})})}function Kwt({rows:t,onChange:e}){const[n,s]=I.useState(null),a=()=>{e([...t,{columns:[{title:"",description:""},{title:"",description:""},{title:"",description:""}]}])},o=p=>{e(t.filter((x,y)=>y!==p))},l=(p,x,y,_)=>{const j=[...t];j[p]={...j[p],columns:j[p].columns.map((C,N)=>N===x?{...C,[y]:_}:C)},e(j)},i=async(p,x,y)=>{var C;const _=(C=y.target.files)==null?void 0:C[0];if(!_)return;const j=`${p}-${x}`;s(j);try{const N=`content-blocks/${Date.now()}-${_.name}`,{error:A}=await J.storage.from("newsletter-content").upload(N,_);if(!A){const{data:E}=J.storage.from("newsletter-content").getPublicUrl(N);l(p,x,"image_url",E.publicUrl)}}finally{s(null)}},h=(p,x)=>{l(p,x,"image_url","")};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Content Blocks (3-Column Rows)"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:a,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Row"]})]}),t.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No content block rows yet. Add a row to create a 3-column layout."}),t.map((p,x)=>r.jsxs(Ye,{className:"relative",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"absolute top-2 right-2 h-6 w-6 text-muted-foreground hover:text-destructive",onClick:()=>o(x),children:r.jsx(_s,{className:"h-4 w-4"})}),r.jsxs(Je,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Row ",x+1]})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3",children:p.columns.map((y,_)=>{const j=`${x}-${_}`;return r.jsxs("div",{className:"space-y-2 border border-border/50 rounded-md p-3 bg-muted/20",children:[r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:["Column ",_+1]}),y.image_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:y.image_url,alt:"",className:"w-full h-20 object-cover rounded"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(x,_),children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${j}`,onChange:C=>i(x,_,C)}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:n===j,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${j}`,className:"cursor-pointer",children:n===j?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(Pl,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(dt,{placeholder:"Title",value:y.title,onChange:C=>l(x,_,"title",C.target.value),className:"h-8 text-sm"}),r.jsx(ps,{placeholder:"Description",value:y.description,onChange:C=>l(x,_,"description",C.target.value),className:"text-sm min-h-[60px] resize-none"})]},_)})})]})]},x))]})}function Zwt(){const{toast:t}=pi(),e=Vr(),[n,s]=I.useState(!1),[a,o]=I.useState(null),[l,i]=I.useState({title:"",description:"",publish_date:xn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[h,p]=I.useState(null),[x,y]=I.useState(null),[_,j]=I.useState([]),[C,N]=I.useState([]),[A,E]=I.useState([]),[T,P]=I.useState([]),[z,F]=I.useState([]),[q,V]=I.useState([]),[K,G]=I.useState(!1),{data:te,isLoading:ie}=Yt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:ke,error:Be}=await J.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Be)throw Be;return ke}}),oe=cr({mutationFn:async ke=>{const{data:Be,error:Ee}=await J.from("newsletter_content").insert({title:ke.title,description:ke.description||null,preview_image_url:ke.preview_image_url,publish_date:ke.publish_date,is_published:ke.is_published,content_blocks:ke.content_blocks}).select().single();if(Ee)throw Ee;return Be},onSuccess:async ke=>{await pe(ke.id),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter created successfully"}),ue()},onError:ke=>{t({title:"Error creating newsletter",description:ke.message,variant:"destructive"})}}),ye=cr({mutationFn:async ke=>{const{error:Be}=await J.from("newsletter_content").update({title:ke.title,description:ke.description||null,preview_image_url:ke.preview_image_url,publish_date:ke.publish_date,is_published:ke.is_published,content_blocks:ke.content_blocks}).eq("id",ke.id);if(Be)throw Be;return ke.id},onSuccess:async ke=>{await pe(ke),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter updated successfully"}),ue()},onError:ke=>{t({title:"Error updating newsletter",description:ke.message,variant:"destructive"})}}),ae=cr({mutationFn:async ke=>{const{error:Be}=await J.from("newsletter_content").delete().eq("id",ke);if(Be)throw Be},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter deleted successfully"})},onError:ke=>{t({title:"Error deleting newsletter",description:ke.message,variant:"destructive"})}}),pe=async ke=>{await J.from("newsletter_drive_links").delete().eq("newsletter_id",ke),await J.from("newsletter_pdfs").delete().eq("newsletter_id",ke),await J.from("newsletter_videos").delete().eq("newsletter_id",ke),await J.from("newsletter_canva_links").delete().eq("newsletter_id",ke);for(const Be of q){const Ee=`${ke}/${Date.now()}-${Be.file.name}`,{error:Ue}=await J.storage.from("newsletter-content").upload(Ee,Be.file);if(!Ue){const{data:Fe}=J.storage.from("newsletter-content").getPublicUrl(Ee);C.push({name:Be.name,file_url:Fe.publicUrl,file_size:Be.file.size,sort_order:C.length})}}_.length>0&&await J.from("newsletter_drive_links").insert(_.map((Be,Ee)=>({newsletter_id:ke,title:Be.title,drive_url:Be.drive_url,sort_order:Ee}))),C.length>0&&await J.from("newsletter_pdfs").insert(C.map((Be,Ee)=>({newsletter_id:ke,name:Be.name,file_url:Be.file_url,file_size:Be.file_size||null,sort_order:Ee}))),A.length>0&&await J.from("newsletter_videos").insert(A.map((Be,Ee)=>({newsletter_id:ke,title:Be.title,video_url:Be.video_url,sort_order:Ee}))),T.length>0&&await J.from("newsletter_canva_links").insert(T.map((Be,Ee)=>({newsletter_id:ke,title:Be.title,canva_share_link:Be.canva_share_link,sort_order:Ee})))},se=async ke=>{o(ke),i({title:ke.title,description:ke.description||"",publish_date:xn(new Date(ke.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:ke.is_published}),y(ke.preview_image_url),F(ke.content_blocks||[]);const[Be,Ee,Ue,Fe]=await Promise.all([J.from("newsletter_drive_links").select("*").eq("newsletter_id",ke.id).order("sort_order"),J.from("newsletter_pdfs").select("*").eq("newsletter_id",ke.id).order("sort_order"),J.from("newsletter_videos").select("*").eq("newsletter_id",ke.id).order("sort_order"),J.from("newsletter_canva_links").select("*").eq("newsletter_id",ke.id).order("sort_order")]);j(Be.data||[]),N(Ee.data||[]),E(Ue.data||[]),P(Fe.data||[]),V([]),s(!0)},he=async ke=>{const[Be,Ee,Ue,Fe]=await Promise.all([J.from("newsletter_drive_links").select("*").eq("newsletter_id",ke.id).order("sort_order"),J.from("newsletter_pdfs").select("*").eq("newsletter_id",ke.id).order("sort_order"),J.from("newsletter_videos").select("*").eq("newsletter_id",ke.id).order("sort_order"),J.from("newsletter_canva_links").select("*").eq("newsletter_id",ke.id).order("sort_order")]);o(null),i({title:`${ke.title} (Copy)`,description:ke.description||"",publish_date:xn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(ke.preview_image_url),F(ke.content_blocks||[]),j((Be.data||[]).map(({id:be,...tt})=>tt)),N((Ee.data||[]).map(({id:be,...tt})=>tt)),E((Ue.data||[]).map(({id:be,...tt})=>tt)),P((Fe.data||[]).map(({id:be,...tt})=>tt)),V([]),s(!0)},ue=()=>{s(!1),o(null),i({title:"",description:"",publish_date:xn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),p(null),y(null),j([]),N([]),E([]),P([]),F([]),V([])},_e=async ke=>{var Ee;const Be=(Ee=ke.target.files)==null?void 0:Ee[0];Be&&(p(Be),y(URL.createObjectURL(Be)))},Ae=async()=>{if(!l.title){t({title:"Title is required",variant:"destructive"});return}G(!0);let ke=x;if(h){const Be=`previews/${Date.now()}-${h.name}`,{error:Ee}=await J.storage.from("newsletter-content").upload(Be,h);if(!Ee){const{data:Ue}=J.storage.from("newsletter-content").getPublicUrl(Be);ke=Ue.publicUrl}}a?ye.mutate({id:a.id,...l,preview_image_url:ke,content_blocks:z}):oe.mutate({...l,preview_image_url:ke,content_blocks:z}),G(!1)},Ce=()=>j([..._,{title:"",drive_url:"",sort_order:_.length}]),Se=()=>E([...A,{title:"",video_url:"",sort_order:A.length}]),ge=()=>P([...T,{title:"",canva_share_link:"",sort_order:T.length}]),Le=ke=>{const Be=ke.target.files;if(!Be)return;const Ee=Array.from(Be).map(Ue=>({file:Ue,name:Ue.name.replace(/\.[^/.]+$/,"")}));V([...q,...Ee])};return r.jsx(Lr,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(te==null?void 0:te.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(te==null?void 0:te.filter(ke=>ke.is_published).length)||0})})]})]}),r.jsxs(Fr,{open:n,onOpenChange:ke=>!ke&&ue(),children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Rr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:a?"Edit Newsletter":"Add Newsletter"})}),r.jsxs("div",{className:"space-y-6",children:[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(He,{children:"Title *"}),r.jsx(dt,{value:l.title,onChange:ke=>i({...l,title:ke.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Publish Date"}),r.jsx(dt,{type:"datetime-local",value:l.publish_date,onChange:ke=>i({...l,publish_date:ke.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:l.description,onChange:ke=>i({...l,description:ke}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[x&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:x,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute -top-2 -right-2 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{p(null),y(null)},children:r.jsx(_s,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:_e,className:"hidden",id:"preview-upload"}),r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(uo,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{checked:l.is_published,onCheckedChange:ke=>i({...l,is_published:ke})}),r.jsx(He,{children:"Published"})]}),r.jsx(Kwt,{rows:z,onChange:F}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:ge,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((ke,Be)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Link title",value:ke.title,onChange:Ee=>{const Ue=[...T];Ue[Be].title=Ee.target.value,P(Ue)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Canva share link",value:ke.canva_share_link,onChange:Ee=>{const Ue=[...T];Ue[Be].canva_share_link=Ee.target.value,P(Ue)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(T.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},Be))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Ce,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),_.map((ke,Be)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Link title",value:ke.title,onChange:Ee=>{const Ue=[..._];Ue[Be].title=Ee.target.value,j(Ue)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Google Drive URL",value:ke.drive_url,onChange:Ee=>{const Ue=[..._];Ue[Be].drive_url=Ee.target.value,j(Ue)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(_.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},Be))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:".pdf",multiple:!0,onChange:Le,className:"hidden",id:"pdf-upload"}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(uo,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),C.map((ke,Be)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:ke.name}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>N(C.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},`existing-${Be}`)),q.map((ke,Be)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:ke.name,onChange:Ee=>{const Ue=[...q];Ue[Be].name=Ee.target.value,V(Ue)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>V(q.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},`pending-${Be}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Se,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),A.map((ke,Be)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Video title",value:ke.title,onChange:Ee=>{const Ue=[...A];Ue[Be].title=Ee.target.value,E(Ue)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Video URL",value:ke.video_url,onChange:Ee=>{const Ue=[...A];Ue[Be].video_url=Ee.target.value,E(Ue)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(A.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},Be))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(ee,{variant:"outline",onClick:ue,children:"Cancel"}),r.jsx(ee,{onClick:Ae,disabled:K||oe.isPending||ye.isPending,children:K?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ie?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(te==null?void 0:te.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):te==null?void 0:te.map(ke=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[ke.preview_image_url?r.jsx("img",{src:ke.preview_image_url,alt:ke.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(La,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:ke.title}),ke.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:ke.description.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(Nt,{children:xn(new Date(ke.publish_date),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${ke.is_published?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:ke.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>se(ke),title:"Edit",children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>he(ke),title:"Duplicate",children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",title:"Delete",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ae.mutate(ke.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},ke.id))})]})})})]})})}const a4e={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 Ywt(){const{user:t}=Xr(),{toast:e}=pi(),n=Zn(),s=Vr(),[a,o]=I.useState(""),[l,i]=I.useState("popular"),[h,p]=I.useState(!1),[x,y]=I.useState(""),[_,j]=I.useState(""),[C,N]=I.useState(!1),{data:A=[],isLoading:E}=Yt({queryKey:["wishlist-items",l,C],queryFn:async()=>{let q=J.from("wishlist_items").select("*");C&&t&&(q=q.eq("user_id",t.id)),l==="latest"?q=q.order("created_at",{ascending:!1}):l==="popular"?q=q.order("vote_count",{ascending:!1}):l==="trending"&&(q=q.order("vote_count",{ascending:!1}));const{data:V,error:K}=await q;if(K)throw K;const G=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:te}=await J.from("profiles").select("id, name").in("id",G),ie=new Map((te==null?void 0:te.map(se=>[se.id,se]))||[]);let oe=[];if(t){const{data:se}=await J.from("wishlist_votes").select("item_id").eq("user_id",t.id);oe=(se==null?void 0:se.map(he=>he.item_id))||[]}const ye=(V==null?void 0:V.map(se=>se.id))||[],{data:ae}=await J.from("wishlist_comments").select("item_id").in("item_id",ye),pe=new Map;return ae==null||ae.forEach(se=>{pe.set(se.item_id,(pe.get(se.item_id)||0)+1)}),V==null?void 0:V.map(se=>{const he=ie.get(se.user_id),ue=(he==null?void 0:he.name)||"Unknown";return{...se,user_name:ue,user_initials:ue.split(" ").map(_e=>_e[0]).join("").toUpperCase().slice(0,2),has_voted:oe.includes(se.id),comment_count:pe.get(se.id)||0}})}}),T=cr({mutationFn:async({title:q,description:V})=>{const{error:K}=await J.from("wishlist_items").insert({user_id:t.id,title:q,description:V});if(K)throw K},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),p(!1),y(""),j(""),e({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),P=cr({mutationFn:async({itemId:q,hasVoted:V})=>{if(V){const{error:K}=await J.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 J.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 V=A.find(G=>G.id===q.itemId),K=((V==null?void 0:V.vote_count)||0)+1;J.functions.invoke("wishlist-notify",{body:{itemId:q.itemId,voteCount:K}}).catch(console.error)}},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),z=A.filter(q=>q.title.toLowerCase().includes(a.toLowerCase())||q.description.toLowerCase().includes(a.toLowerCase())),F=()=>{if(!x.trim()||!_.trim()){e({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}T.mutate({title:x.trim(),description:_.trim()})};return r.jsx(Lr,{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(w1,{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(Fr,{open:h,onOpenChange:p,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{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(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:q=>y(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{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:_,onChange:q=>j(q.target.value),rows:4})]}),r.jsx(ee,{onClick:F,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search ideas...",value:a,onChange:q=>o(q.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(Ii,{value:l,onValueChange:q=>i(q),children:r.jsxs(wi,{children:[r.jsx(nn,{value:"popular",children:"Most Popular"}),r.jsx(nn,{value:"latest",children:"Latest"}),r.jsx(nn,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(ee,{variant:C?"default":"outline",size:"sm",onClick:()=>N(!C),children:C?"Show All Ideas":"My Ideas"})}),E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):z.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(w1,{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(ee,{onClick:()=>p(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:z.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:V=>{V.stopPropagation(),P.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(Zf,{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(Ks,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Zs,{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(Ot,{className:zt("text-xs",a4e[q.status].color),children:a4e[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(Oo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:q.comment_count})]})]})},q.id))})]})})}const i4e={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 Xwt(){const{itemId:t}=Yc(),e=Zn(),{user:n}=Xr(),{toast:s}=pi(),a=Vr(),[o,l]=I.useState(""),{data:i=!1}=Yt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:A,error:E}=await J.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!E&&!!A},enabled:!!n}),{data:h,isLoading:p}=Yt({queryKey:["wishlist-item",t],queryFn:async()=>{const{data:A,error:E}=await J.from("wishlist_items").select("*").eq("id",t).single();if(E)throw E;const{data:T}=await J.from("profiles").select("name").eq("id",A.user_id).single();let P=!1;if(n){const{data:z}=await J.from("wishlist_votes").select("id").eq("item_id",t).eq("user_id",n.id).maybeSingle();P=!!z}return{...A,user_name:(T==null?void 0:T.name)||"Unknown",user_initials:((T==null?void 0:T.name)||"U").split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),has_voted:P}}}),{data:x=[],isLoading:y}=Yt({queryKey:["wishlist-comments",t],queryFn:async()=>{const{data:A,error:E}=await J.from("wishlist_comments").select("*").eq("item_id",t).order("created_at",{ascending:!0});if(E)throw E;const T=[...new Set((A==null?void 0:A.map(F=>F.user_id))||[])],{data:P}=await J.from("profiles").select("id, name").in("id",T),z=new Map((P==null?void 0:P.map(F=>[F.id,F]))||[]);return A==null?void 0:A.map(F=>{const q=z.get(F.user_id),V=(q==null?void 0:q.name)||"Unknown";return{...F,user_name:V,user_initials:V.split(" ").map(K=>K[0]).join("").toUpperCase().slice(0,2)}})}}),_=cr({mutationFn:async A=>{if(A){const{error:E}=await J.from("wishlist_votes").delete().eq("item_id",t).eq("user_id",n.id);if(E)throw E;return{wasAdded:!1}}else{const{error:E}=await J.from("wishlist_votes").insert({item_id:t,user_id:n.id});if(E)throw E;return{wasAdded:!0}}},onSuccess:async A=>{if(a.invalidateQueries({queryKey:["wishlist-item",t]}),a.invalidateQueries({queryKey:["wishlist-items"]}),A!=null&&A.wasAdded&&h){const E=(h.vote_count||0)+1;J.functions.invoke("wishlist-notify",{body:{itemId:t,voteCount:E}}).catch(console.error)}},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),j=cr({mutationFn:async A=>{const{error:E}=await J.from("wishlist_comments").insert({item_id:t,user_id:n.id,content:A});if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),l(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),C=cr({mutationFn:async A=>{const{error:E}=await J.from("wishlist_comments").delete().eq("id",A);if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),s({title:"Comment deleted"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),N=()=>{o.trim()&&j.mutate(o.trim())};return p?r.jsx(Lr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Ir,{className:"h-8 w-32 mb-6"}),r.jsx(Ir,{className:"h-48 w-full mb-6"}),r.jsx(Ir,{className:"h-32 w-full"})]})}):h?r.jsx(Lr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/wishlist"),className:"mb-4",children:[r.jsx(so,{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:()=>_.mutate(h.has_voted),className:zt("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",h.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(Zf,{className:zt("h-5 w-5",h.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:h.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:h.title}),r.jsx(Ot,{className:zt("text-xs",i4e[h.status].color),children:i4e[h.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:h.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ks,{className:"h-6 w-6",children:r.jsx(Zs,{className:"bg-primary/20 text-primary text-xs",children:h.user_initials})}),r.jsx("span",{children:h.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(h.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 (",x.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(wte,{placeholder:i?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:l,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:i}),r.jsx(ee,{onClick:N,disabled:!o.trim()||j.isPending,size:"icon",className:"h-auto",children:j.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(Do,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(A=>r.jsx(Ir,{className:"h-20 w-full"},A))}):x.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:x.map(A=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"bg-primary/20 text-primary text-xs",children:A.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:A.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(A.created_at).toLocaleDateString()})]}),r.jsx(Oxe,{content:A.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===A.user_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>C.mutate(A.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]},A.id))})]})]})}):r.jsx(Lr,{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(ee,{variant:"link",onClick:()=>e("/wishlist"),children:"Go back to Wishlist"})]})})}const o4e={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"}},l4e=["open","under_review","planned","in_progress","launched","declined"];function Qwt(){const{toast:t}=pi(),e=Zn(),n=Vr(),[s,a]=I.useState(""),[o,l]=I.useState("all"),[i,h]=I.useState(!1),[p,x]=I.useState(null),{data:y=[],isLoading:_}=Yt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:E,error:T}=await J.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const P=[...new Set((E==null?void 0:E.map(G=>G.user_id))||[])],{data:z}=await J.from("profiles").select("id, name, email").in("id",P),F=new Map((z==null?void 0:z.map(G=>[G.id,G]))||[]),q=(E==null?void 0:E.map(G=>G.id))||[],{data:V}=await J.from("wishlist_comments").select("item_id").in("item_id",q),K=new Map;return V==null||V.forEach(G=>{K.set(G.item_id,(K.get(G.item_id)||0)+1)}),E==null?void 0:E.map(G=>{const te=F.get(G.user_id);return{...G,user_name:(te==null?void 0:te.name)||"Unknown",user_email:(te==null?void 0:te.email)||"",comment_count:K.get(G.id)||0}})}}),j=cr({mutationFn:async({itemId:E,status:T})=>{const{error:P}=await J.from("wishlist_items").update({status:T}).eq("id",E);if(P)throw P},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),t({title:"Status updated!"})},onError:E=>{t({title:"Error",description:E.message,variant:"destructive"})}}),C=cr({mutationFn:async E=>{const{error:T}=await J.from("wishlist_items").delete().eq("id",E);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),h(!1),x(null),t({title:"Item deleted!"})},onError:E=>{t({title:"Error",description:E.message,variant:"destructive"})}}),N=y.filter(E=>{const T=E.title.toLowerCase().includes(s.toLowerCase())||E.description.toLowerCase().includes(s.toLowerCase())||E.user_name.toLowerCase().includes(s.toLowerCase()),P=o==="all"||E.status===o;return T&&P}),A={total:y.length,open:y.filter(E=>E.status==="open").length,inProgress:y.filter(E=>E.status==="in_progress").length,launched:y.filter(E=>E.status==="launched").length,highVotes:y.filter(E=>E.vote_count>=10).length};return r.jsx(Lr,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>e("/admin"),children:r.jsx(so,{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:A.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:A.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:A.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:A.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:A.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search ideas, users...",value:s,onChange:E=>a(E.target.value),className:"pl-10"})]}),r.jsxs(gn,{value:o,onValueChange:E=>l(E),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),l4e.map(E=>r.jsx(qt,{value:E,children:o4e[E].label},E))]})]})]}),_?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(E=>r.jsx(Ir,{className:"h-16 w-full"},E))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[60px]",children:"Votes"}),r.jsx(It,{children:"Title"}),r.jsx(It,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(It,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:N.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):N.map(E=>r.jsxs(Ar,{className:zt(E.vote_count>=10&&"bg-primary/5"),children:[r.jsx(Nt,{children:r.jsx(Ot,{variant:E.vote_count>=10?"default":"secondary",children:E.vote_count})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:E.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:E.description})]})}),r.jsx(Nt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:E.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:E.user_email})]})}),r.jsx(Nt,{className:"hidden sm:table-cell",children:E.comment_count}),r.jsx(Nt,{children:r.jsxs(gn,{value:E.status,onValueChange:T=>j.mutate({itemId:E.id,status:T}),children:[r.jsx(fn,{className:"w-[140px] h-8",children:r.jsx(yn,{})}),r.jsx(pn,{children:l4e.map(T=>r.jsx(qt,{value:T,children:o4e[T].label},T))})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${E.id}`,"_blank"),children:r.jsx(Ls,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(E.id),h(!0)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},E.id))})]})}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{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(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:()=>p&&C.mutate(p),disabled:C.isPending,children:C.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function Jwt(){const{user:t}=Xr(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(null),[p,x]=I.useState(!1),[y,_]=I.useState(null),[j,C]=I.useState(""),[N,A]=I.useState(""),[E,T]=I.useState(""),[P,z]=I.useState(""),[F,q]=I.useState(""),[V,K]=I.useState(!1),[G,te]=I.useState(""),[ie,oe]=I.useState("once"),[ye,ae]=I.useState([]),[pe,se]=I.useState([]),[he,ue]=I.useState(!1),[_e,Ae]=I.useState(!1),[Ce,Se]=I.useState([]),[ge,Le]=I.useState({total:0,dismissed:0});I.useEffect(()=>{ke()},[]);const ke=async()=>{const{data:nt,error:gt}=await J.from("levelup_briefs").select("*").order("created_at",{ascending:!1});gt?(ze.error("Failed to fetch briefs"),console.error(gt)):n(nt||[]),a(!1)},Be=()=>{C(""),A(""),T(""),z(""),q(""),K(!1),te(new Date().toISOString().slice(0,16)),oe("once"),ae([]),se([]),h(null)},Ee=()=>{Be(),l(!0)},Ue=async nt=>{h(nt),C(nt.title),A(nt.description||""),T(nt.video_url||""),z(nt.graphic_url||""),q(nt.graphic_link_url||""),K(nt.is_published),te(nt.publish_date.slice(0,16)),oe(nt.show_frequency);const{data:gt}=await J.from("levelup_brief_links").select("*").eq("brief_id",nt.id).order("sort_order");ae((gt==null?void 0:gt.map(Mt=>({title:Mt.title,url:Mt.url})))||[]);const{data:mt}=await J.from("levelup_brief_polls").select("*").eq("brief_id",nt.id).order("sort_order");if(mt){const Mt=[];for(const wt of mt){const{data:Qt}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",wt.id).order("sort_order");Mt.push({question:wt.question,poll_type:wt.poll_type,options:(Qt==null?void 0:Qt.map(Cr=>Cr.option_text))||[]})}se(Mt)}l(!0)},Fe=async nt=>{var mt;const gt=(mt=nt.target.files)==null?void 0:mt[0];if(gt){ue(!0);try{const Mt=await J.functions.invoke("bunny-upload",{body:{action:"create",title:gt.name.replace(/\.[^/.]+$/,"")}});if(Mt.error)throw Mt.error;const{videoId:wt,libraryId:Qt}=Mt.data,Cr=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:wt}});if(Cr.error)throw Cr.error;const{uploadUrl:cn,apiKey:jn}=Cr.data,Qr=new XMLHttpRequest;await new Promise((js,hr)=>{Qr.upload.addEventListener("progress",xs=>{if(xs.lengthComputable){const ka=Math.round(xs.loaded/xs.total*100);console.log("Upload progress:",ka)}}),Qr.addEventListener("load",()=>{Qr.status>=200&&Qr.status<300?js():hr(new Error(`Upload failed with status ${Qr.status}`))}),Qr.addEventListener("error",()=>hr(new Error("Upload failed"))),Qr.open("PUT",cn),Qr.setRequestHeader("AccessKey",jn),Qr.send(gt)});const Pn=`https://player.mediadelivery.net/embed/${Qt}/${wt}`;T(Pn),ze.success("Video uploaded successfully! It may take a few minutes to process.")}catch(Mt){console.error("Upload error:",Mt),ze.error("Failed to upload video")}finally{ue(!1)}}},be=async()=>{if(!j.trim()){ze.error("Title is required");return}try{let nt;if(i){const{error:gt}=await J.from("levelup_briefs").update({title:j,description:N||null,video_url:E||null,graphic_url:P||null,graphic_link_url:F||null,is_published:V,publish_date:G,show_frequency:ie}).eq("id",i.id);if(gt)throw gt;nt=i.id,await J.from("levelup_brief_links").delete().eq("brief_id",nt);const{data:mt}=await J.from("levelup_brief_polls").select("id").eq("brief_id",nt);if(mt)for(const Mt of mt)await J.from("levelup_brief_poll_options").delete().eq("poll_id",Mt.id);await J.from("levelup_brief_polls").delete().eq("brief_id",nt)}else{const{data:gt,error:mt}=await J.from("levelup_briefs").insert({title:j,description:N||null,video_url:E||null,graphic_url:P||null,graphic_link_url:F||null,is_published:V,publish_date:G,show_frequency:ie,created_by:t==null?void 0:t.id}).select().single();if(mt)throw mt;nt=gt.id}if(ye.length>0){const gt=ye.map((mt,Mt)=>({brief_id:nt,title:mt.title,url:mt.url,sort_order:Mt}));await J.from("levelup_brief_links").insert(gt)}for(let gt=0;gt0){const Qt=mt.options.map((Cr,cn)=>({poll_id:Mt.id,option_text:Cr,sort_order:cn}));await J.from("levelup_brief_poll_options").insert(Qt)}}ze.success(i?"Brief updated":"Brief created"),l(!1),Be(),ke()}catch(nt){console.error("Error saving brief:",nt),ze.error("Failed to save brief")}},tt=async nt=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:gt}=await J.from("levelup_briefs").delete().eq("id",nt);if(gt)throw gt;ze.success("Brief deleted"),ke()}catch(gt){console.error("Error deleting brief:",gt),ze.error("Failed to delete brief")}},Te=async nt=>{_(nt);const{count:gt}=await J.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",nt.id),{count:mt}=await J.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",nt.id).not("dismissed_at","is",null);Le({total:gt||0,dismissed:mt||0});const{data:Mt}=await J.from("levelup_brief_polls").select("*").eq("brief_id",nt.id).order("sort_order");if(Mt){const wt=[];for(const Qt of Mt){const{data:Cr}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",Qt.id).order("sort_order"),{data:cn}=await J.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",Qt.id),jn={};let Qr=0;Cr&&Cr.forEach(Pn=>{const js=(cn==null?void 0:cn.filter(hr=>hr.option_id===Pn.id).length)||0;jn[Pn.id]=js,Qr+=js}),wt.push({...Qt,options:Cr||[],results:jn,totalResponses:Qt.poll_type==="single"?new Set(cn==null?void 0:cn.map(Pn=>Pn.option_id)).size:Qr})}Se(wt)}x(!0)},Ke=()=>{ae([...ye,{title:"",url:""}])},me=(nt,gt,mt)=>{const Mt=[...ye];Mt[nt][gt]=mt,ae(Mt)},yt=nt=>{ae(ye.filter((gt,mt)=>mt!==nt))},rt=()=>{se([...pe,{question:"",poll_type:"single",options:["",""]}])},at=(nt,gt)=>{const mt=[...pe];mt[nt].question=gt,se(mt)},Me=(nt,gt)=>{const mt=[...pe];mt[nt].poll_type=gt,se(mt)},ft=nt=>{const gt=[...pe];gt[nt].options.push(""),se(gt)},qe=(nt,gt,mt)=>{const Mt=[...pe];Mt[nt].options[gt]=mt,se(Mt)},Oe=(nt,gt)=>{const mt=[...pe];mt[nt].options=mt[nt].options.filter((Mt,wt)=>wt!==gt),se(mt)},Qe=nt=>{se(pe.filter((gt,mt)=>mt!==nt))};return r.jsxs(Lr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(ee,{onClick:Ee,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Frequency"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:s?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):e.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):e.map(nt=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:nt.title}),r.jsx(Nt,{children:r.jsx(Ot,{variant:nt.is_published?"default":"secondary",children:nt.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"capitalize",children:nt.show_frequency.replace("_"," ")}),r.jsx(Nt,{children:xn(new Date(nt.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Te(nt),children:r.jsx(dc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ue(nt),children:r.jsx(ic,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>tt(nt.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},nt.id))})]})})})]}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(Ii,{defaultValue:"content",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-4",children:[r.jsx(nn,{value:"content",children:"Content"}),r.jsx(nn,{value:"media",children:"Media"}),r.jsx(nn,{value:"links",children:"Links"}),r.jsx(nn,{value:"polls",children:"Polls"})]}),r.jsxs(Sn,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Title *"}),r.jsx(dt,{value:j,onChange:nt=>C(nt.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:N,onChange:nt=>A(nt),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(He,{children:"Publish Date"}),r.jsx(dt,{type:"datetime-local",value:G,onChange:nt=>te(nt.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Show Frequency"}),r.jsxs(gn,{value:ie,onValueChange:oe,children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"once",children:"Once (until dismissed)"}),r.jsx(qt,{value:"every_login",children:"Every login"}),r.jsx(qt,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ps,{checked:V,onCheckedChange:K}),r.jsx(He,{children:"Publish immediately"})]})]}),r.jsxs(Sn,{value:"media",className:"space-y-6 mt-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Video (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(dt,{type:"file",accept:"video/*",onChange:Fe,disabled:he})}),he&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Or paste embed URL"}),r.jsx(dt,{value:E,onChange:nt=>T(nt.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),E&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:E,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs("div",{className:"border-t pt-4 space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Graphic / Image (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(dt,{type:"file",accept:"image/*",onChange:async nt=>{var mt;const gt=(mt=nt.target.files)==null?void 0:mt[0];if(gt){Ae(!0);try{const Mt=gt.name.split(".").pop(),wt=`brief-graphics/${Date.now()}.${Mt}`,{error:Qt}=await J.storage.from("banner-images").upload(wt,gt,{upsert:!0});if(Qt)throw Qt;const{data:Cr}=J.storage.from("banner-images").getPublicUrl(wt);z(Cr.publicUrl),ze.success("Image uploaded!")}catch(Mt){console.error(Mt),ze.error("Failed to upload image")}finally{Ae(!1)}}},disabled:_e})}),_e&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Or paste Image URL"}),r.jsx(dt,{value:P,onChange:nt=>z(nt.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Click-through Link (optional)"}),r.jsx(dt,{value:F,onChange:nt=>q(nt.target.value),placeholder:"https://example.com/landing-page"})]}),P&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:r.jsx("img",{src:P,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),r.jsxs(Sn,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Quick Links"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:Ke,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),ye.map((nt,gt)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(dt,{value:nt.title,onChange:mt=>me(gt,"title",mt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(dt,{value:nt.url,onChange:mt=>me(gt,"url",mt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>yt(gt),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]},gt)),ye.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(Sn,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Polls"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:rt,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),pe.map((nt,gt)=>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(dt,{value:nt.question,onChange:mt=>at(gt,mt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(gn,{value:nt.poll_type,onValueChange:mt=>Me(gt,mt),children:[r.jsx(fn,{className:"w-32",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"single",children:"Single"}),r.jsx(qt,{value:"multi",children:"Multi-select"})]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Qe(gt),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[nt.options.map((mt,Mt)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:mt,onChange:wt=>qe(gt,Mt,wt.target.value),placeholder:`Option ${Mt+1}`}),nt.options.length>2&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Oe(gt,Mt),children:r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"})})]},Mt)),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ft(gt),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},gt)),pe.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(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:be,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Fr,{open:p,onOpenChange:x,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Results: ",y==null?void 0:y.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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(Je,{children:r.jsx("p",{className:"text-2xl font-bold",children:ge.total})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(Je,{children:r.jsx("p",{className:"text-2xl font-bold",children:ge.dismissed})})]})]}),Ce.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),Ce.map(nt=>r.jsxs(Ye,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:nt.question}),r.jsx("div",{className:"space-y-2",children:nt.options.map(gt=>{const mt=nt.results[gt.id]||0,Mt=nt.totalResponses>0?Math.round(mt/nt.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:gt.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[mt," (",Mt,"%)"]})]}),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:`${Mt}%`}})})]},gt.id)})})]},nt.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const ejt=()=>{const{user:t}=Xr(),{toast:e}=pi(),n=Vr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,_]=I.useState(""),{data:j=[],isLoading:C}=Yt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:F,error:q}=await J.from("additional_services").select("*").order("publish_date",{ascending:!1});if(q)throw q;return F}}),N=cr({mutationFn:async F=>{let q=F.existingImageUrl;if(F.image){const K=F.image.name.split(".").pop(),G=`${Date.now()}-${Math.random().toString(36).substring(7)}.${K}`,{error:te}=await J.storage.from("service-images").upload(G,F.image);if(te)throw te;const{data:ie}=J.storage.from("service-images").getPublicUrl(G);q=ie.publicUrl}const V={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 J.from("additional_services").update(V).eq("id",F.itemId);if(K)throw K}else{const{error:K}=await J.from("additional_services").insert(V);if(K)throw K}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:o?"Service updated":"Service created"}),a(!1),E()},onError:F=>{e({title:"Error saving service",description:F.message,variant:"destructive"})}}),A=cr({mutationFn:async F=>{const{error:q}=await J.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"})}}),E=()=>{h({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),l(null)},T=F=>{l(F),h({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}),_(F.preview_image_url||""),a(!0)},P=F=>{var V;const q=(V=F.target.files)==null?void 0:V[0];q&&(x(q),_(URL.createObjectURL(q)))},z=F=>{if(F.preventDefault(),!i.name.trim()){e({title:"Name is required",variant:"destructive"});return}if(!i.signup_link_url.trim()){e({title:"Signup link URL is required",variant:"destructive"});return}N.mutate({item:i,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Lr,{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(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(F=>F.is_published).length})})]})]}),r.jsxs(Fr,{open:s,onOpenChange:F=>{a(F),F||E()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:i.name,onChange:F=>h({...i,name:F.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(yy,{content:i.description,onChange:F=>h({...i,description:F}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(dt,{id:"signup_link_url",type:"url",value:i.signup_link_url,onChange:F=>h({...i,signup_link_url:F.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:F=>h({...i,publish_date:F.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ps,{id:"is_published",checked:i.is_published,onCheckedChange:F=>h({...i,is_published:F})}),r.jsx(He,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),_("")},children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Pl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(dt,{type:"file",accept:"image/*",onChange:P,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:N.isPending,children:N.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"})}):j.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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Signup Link"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:j.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{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(Pl,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(Nt,{className:"font-medium",children:F.name}),r.jsx(Nt,{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(Ls,{className:"h-3 w-3"}),"Link"]})}),r.jsx(Nt,{children:new Date(F.publish_date).toLocaleDateString()}),r.jsx(Nt,{children:r.jsx(Ot,{variant:F.is_published?"default":"secondary",children:F.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(F),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&A.mutate(F.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})})})]})})};function tjt(){const{toast:t}=pi(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});I.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:A,error:E}=await J.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(E)throw E;n(A.coupons||[])}catch(A){console.error("Error fetching coupons:",A),t({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{a(!1)}},_=async()=>{if(!p.name){t({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(p.discountType==="percent"&&!p.percentOff){t({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(p.discountType==="amount"&&!p.amountOff){t({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(p.duration==="repeating"&&!p.durationInMonths){t({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const A={action:"create",name:p.name,duration:p.duration,promotion_code:p.promotionCode.trim()||void 0};p.discountType==="percent"?A.percent_off=parseFloat(p.percentOff):(A.amount_off=Math.round(parseFloat(p.amountOff)*100),A.currency="usd"),p.duration==="repeating"&&(A.duration_in_months=parseInt(p.durationInMonths));const{data:E,error:T}=await J.functions.invoke("stripe-manage-coupons",{body:A});if(T)throw T;t({title:"Success",description:"Coupon created successfully"}),h(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(A){console.error("Error creating coupon:",A),t({title:"Error",description:A.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},j=async A=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:E}=await J.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:A}});if(E)throw E;t({title:"Success",description:"Coupon deleted successfully"}),y()}catch(E){console.error("Error deleting coupon:",E),t({title:"Error",description:E.message||"Failed to delete coupon",variant:"destructive"})}},C=A=>A.percent_off?`${A.percent_off}% off`:A.amount_off?`$${(A.amount_off/100).toFixed(2)} off`:"N/A",N=A=>{switch(A.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${A.duration_in_months} months`;default:return A.duration}};return r.jsx(Lr,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Fr,{open:i,onOpenChange:h,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New Coupon"}),r.jsx(Qn,{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(He,{children:"Promotion Code (what users will type)"}),r.jsx(dt,{placeholder:"e.g., BROKERAGE50",value:p.promotionCode,onChange:A=>x({...p,promotionCode:A.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(He,{children:"Coupon Name (internal label)"}),r.jsx(dt,{placeholder:"e.g., 50% Off Brokerage Launch",value:p.name,onChange:A=>x({...p,name:A.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Discount Type"}),r.jsxs(gn,{value:p.discountType,onValueChange:A=>{const E=A==="amount"&&p.duration==="forever"?"once":p.duration;x({...p,discountType:A,duration:E})},children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(fS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(qt,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(fd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),p.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{type:"number",min:"1",max:"100",placeholder:"20",value:p.percentOff,onChange:A=>x({...p,percentOff:A.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(He,{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(dt,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:p.amountOff,onChange:A=>x({...p,amountOff:A.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Duration"}),r.jsxs(gn,{value:p.duration,onValueChange:A=>x({...p,duration:A}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"once",children:"Once (first payment only)"}),r.jsx(qt,{value:"repeating",children:"Multiple months"}),r.jsxs(qt,{value:"forever",disabled:p.discountType==="amount",children:["Forever ",p.discountType==="amount"&&"(% discounts only)"]})]})]}),p.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),p.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Number of Months"}),r.jsx(dt,{type:"number",min:"1",placeholder:"3",value:p.durationInMonths,onChange:A=>x({...p,durationInMonths:A.target.value})})]}),r.jsx(ee,{onClick:_,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Active Coupons"}),r.jsx(Tn,{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(en,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Promo Code"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Discount"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Redemptions"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:e.map(A=>{var E;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono font-medium",children:((E=A.promotion_codes)==null?void 0:E.length)>0?A.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(Nt,{children:A.name||"-"}),r.jsx(Nt,{children:C(A)}),r.jsx(Nt,{children:N(A)}),r.jsx(Nt,{children:A.times_redeemed}),r.jsx(Nt,{children:r.jsx(Ot,{variant:A.valid?"default":"secondary",children:A.valid?"Active":"Inactive"})}),r.jsx(Nt,{className:"text-right",children:r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>j(A.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})})]},A.id)})})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{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 Ece={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 rjt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState(null),{data:l,isLoading:i,refetch:h}=Yt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:C,error:N}=await J.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(N)throw N;return C}}),{data:p}=Yt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:C,error:N}=await J.from("brokerages").select("*").order("name");if(N)throw N;return await Promise.all((C||[]).map(async E=>{const{data:T}=await J.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",E.id),{data:P}=await J.from("user_roles").select("user_id").eq("role","brokerage_manager"),z=(P==null?void 0:P.map(V=>V.user_id))||[],F=(T==null?void 0:T.filter(V=>z.includes(V.id)))||[],q=(T==null?void 0:T.length)||0;return{...E,managers:F,agentCount:q}}))}}),x=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 N=Ece[C.subscription_product_id];return{status:(N==null?void 0:N.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"}},y=l==null?void 0:l.filter(C=>{var A,E;if(!(((A=C.name)==null?void 0:A.toLowerCase().includes(t.toLowerCase()))||((E=C.email)==null?void 0:E.toLowerCase().includes(t.toLowerCase()))))return!1;switch(x(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}}),_={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(C=>C.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(C=>C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(C=>C.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(C=>C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(C=>C.subscription_status==="active"&&C.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(C=>C.subscription_status==="active"&&(C.subscription_product_id==="prod_Tc08MupgoVySDG"||C.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},j=C=>{window.open(`https://dashboard.stripe.com/customers/${C}`,"_blank")};return r.jsx(Lr,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(ee,{onClick:()=>h(),variant:"outline",size:"sm",children:[r.jsx(Gl,{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(Bn,{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:_.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(gm,{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:_.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(Ya,{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:_.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(m1,{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:_.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(ai,{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:_.brokerageMembers})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kj,{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:_.individualSubscribers})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",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:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:_.brokerageSubscribers})]})})]}),r.jsxs(Ii,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"users",children:"All Users"}),r.jsx(nn,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(Sn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:t,onChange:C=>e(C.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:n,onValueChange:C=>s(C),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Users"}),r.jsx(qt,{value:"active",children:"Active Subscriptions"}),r.jsx(qt,{value:"trialing",children:"Trials"}),r.jsx(qt,{value:"grandfathered",children:"Grandfathered"}),r.jsx(qt,{value:"brokerage",children:"Brokerage Members"}),r.jsx(qt,{value:"expired",children:"Expired/Canceled"}),r.jsx(qt,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Plan"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"End Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:i?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(C=>{var E,T;const N=x(C),A=Ece[C.subscription_product_id];return r.jsxs(Ar,{children:[r.jsx(Nt,{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(Nt,{children:r.jsx(Ot,{variant:N.variant,children:N.badge})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm",children:C.is_grandfathered?"Legacy Access":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||N.status})}),r.jsx(Nt,{children:(E=C.brokerages)!=null&&E.name?r.jsx("span",{className:"text-sm",children:C.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(Nt,{children:C.subscription_end_date?r.jsx("span",{className:"text-sm",children:xn(new Date(C.subscription_end_date),"MMM d, yyyy")}):C.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",xn(new Date(C.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[C.stripe_customer_id&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>j(C.stripe_customer_id),children:r.jsx(Ls,{className:"h-4 w-4"})}),r.jsxs(Fr,{children:[r.jsx(Bo,{asChild:!0,children:r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o(C),children:"Details"})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Subscription Details"}),r.jsxs(Qn,{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(Ot,{variant:N.variant,className:"mt-1",children:N.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":(A==null?void 0:A.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:((T=C.brokerages)==null?void 0:T.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:xn(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:xn(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(ee,{className:"w-full",onClick:()=>j(C.stripe_customer_id),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},C.id)})})]})})})]}),r.jsx(Sn,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:p==null?void 0:p.map(C=>{var A,E;const N=(A=C.managers)==null?void 0:A.some(T=>T.subscription_status==="active"&&(T.subscription_product_id==="prod_Tc08MupgoVySDG"||T.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ye,{children:[r.jsx(Gt,{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(ai,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:C.name}),r.jsxs(Tn,{children:[C.agentCount," agents"]})]})]}),r.jsx(Ot,{variant:N?"default":"outline",children:N?"Active Subscription":"No Active Subscription"})]})}),r.jsx(Je,{children:((E=C.managers)==null?void 0:E.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(T=>{const P=Ece[T.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:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.email})]}),r.jsx("div",{className:"text-right",children:P?r.jsxs("div",{children:[r.jsx(Ot,{variant:"default",children:P.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:P.price})]}):r.jsx(Ot,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},C.id)})})})]})]})})}function njt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(""),[l,i]=I.useState("all"),[h,p]=I.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:C,error:N}=await J.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(N)throw N;e(C||[]);const A=(C==null?void 0:C.filter(P=>P.status==="qualified").length)||0,E=(C==null?void 0:C.filter(P=>P.status==="pending").length)||0,T=(C==null?void 0:C.filter(P=>P.status==="cancelled").length)||0;p({total:(C==null?void 0:C.length)||0,qualified:A,pending:E,cancelled:T,totalDiscounts:A*25})}catch(C){console.error("Error fetching referrals:",C),ze.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{ze.loading("Processing qualifications...");const{error:C}=await J.functions.invoke("process-referral-qualifications");if(C)throw C;ze.dismiss(),ze.success("Qualifications processed successfully"),x()}catch(C){ze.dismiss(),console.error("Error processing qualifications:",C),ze.error("Failed to process qualifications")}},_=t.filter(C=>{var E,T,P,z,F,q;const N=((T=(E=C.referrer_brokerage)==null?void 0:E.name)==null?void 0:T.toLowerCase().includes(a.toLowerCase()))||((z=(P=C.referred_brokerage)==null?void 0:P.name)==null?void 0:z.toLowerCase().includes(a.toLowerCase()))||((q=(F=C.referred_user)==null?void 0:F.email)==null?void 0:q.toLowerCase().includes(a.toLowerCase())),A=l==="all"||C.status===l;return N&&A}),j=C=>{switch(C){case"qualified":return r.jsxs(Ot,{className:"bg-green-100 text-green-800",children:[r.jsx(Yi,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Ot,{variant:"secondary",children:[r.jsx(Ya,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Ot,{variant:"destructive",children:[r.jsx(Vc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Ot,{children:C})}};return r.jsx(Lr,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(ee,{onClick:y,variant:"outline",children:[r.jsx(Gl,{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(Bn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.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(Yi,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.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(Ya,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.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(Vc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.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(fd,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",h.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"All Referrals"}),r.jsx(Tn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by brokerage or email...",value:a,onChange:C=>o(C.target.value),className:"pl-10"})]}),r.jsxs(gn,{value:l,onValueChange:i,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),r.jsx(qt,{value:"pending",children:"Pending"}),r.jsx(qt,{value:"qualified",children:"Qualified"}),r.jsx(qt,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Referrer"}),r.jsx(It,{children:"Referred"}),r.jsx(It,{children:"Signup Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Qualified Date"}),r.jsx(It,{children:"Discount"})]})}),r.jsx(Vs,{children:_.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):_.map(C=>{var N,A,E,T;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:((N=C.referrer_brokerage)==null?void 0:N.name)||"Unknown"}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((A=C.referred_brokerage)==null?void 0:A.name)||((E=C.referred_user)==null?void 0:E.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=C.referred_user)==null?void 0:T.email})]})}),r.jsx(Nt,{children:xn(new Date(C.signup_date),"MMM d, yyyy")}),r.jsx(Nt,{children:j(C.status)}),r.jsx(Nt,{children:C.qualified_date?xn(new Date(C.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(Nt,{children:C.discount_applied?r.jsx(Ot,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},C.id)})})]})]})]})]})})}const Ice=[{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"}],sjt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function ajt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(null),[h,p]=I.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:T,error:P}=await J.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(P)throw P;e(T||[])}catch(T){console.error("Error fetching checklist items:",T),ze.error("Failed to load checklist items")}finally{s(!1)}},y=()=>{i(null),p({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},_=T=>{i(T),p({title:T.title,description:T.description||"",action_type:T.action_type,target_role:T.target_role,is_active:T.is_active}),o(!0)},j=async()=>{if(!h.title.trim()){ze.error("Title is required");return}try{if(l){const{error:T}=await J.from("onboarding_checklist_items").update({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active}).eq("id",l.id);if(T)throw T;ze.success("Checklist item updated")}else{const T=t.filter(z=>z.target_role===h.target_role).reduce((z,F)=>Math.max(z,F.sort_order),-1),{error:P}=await J.from("onboarding_checklist_items").insert({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active,sort_order:T+1});if(P)throw P;ze.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),ze.error("Failed to save checklist item")}},C=async T=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:P}=await J.from("onboarding_checklist_items").delete().eq("id",T);if(P)throw P;ze.success("Checklist item deleted"),x()}catch(P){console.error("Error deleting checklist item:",P),ze.error("Failed to delete checklist item")}},N=async T=>{try{const{error:P}=await J.from("onboarding_checklist_items").update({is_active:!T.is_active}).eq("id",T.id);if(P)throw P;ze.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(P){console.error("Error toggling item:",P),ze.error("Failed to update item")}},A=t.filter(T=>T.target_role==="brokerage_manager"),E=t.filter(T=>T.target_role==="agent");return r.jsxs(Lr,{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(ee,{onClick:y,className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ot,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(Je,{children:A.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:A.map((T,P)=>{var z;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-muted-foreground",children:P+1}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:((z=Ice.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(Nt,{children:r.jsx(Ps,{checked:T.is_active,onCheckedChange:()=>N(T)})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(T),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>C(T.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ot,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(Je,{children:E.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:E.map((T,P)=>{var z;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-muted-foreground",children:P+1}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:((z=Ice.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(Nt,{children:r.jsx(Ps,{checked:T.is_active,onCheckedChange:()=>N(T)})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(T),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>C(T.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:l?"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(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:h.title,onChange:T=>p({...h,title:T.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:h.description,onChange:T=>p({...h,description:T.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(He,{children:"Target Role"}),r.jsxs(gn,{value:h.target_role,onValueChange:T=>p({...h,target_role:T}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:sjt.map(T=>r.jsx(qt,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Action Type"}),r.jsxs(gn,{value:h.action_type,onValueChange:T=>p({...h,action_type:T}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:Ice.map(T=>r.jsx(qt,{value:T.value,children:T.label},T.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_active",checked:h.is_active,onCheckedChange:T=>p({...h,is_active:T})}),r.jsx(He,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:j,children:l?"Save Changes":"Create Item"})]})]})})]})}function ijt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState("name"),[l,i]=I.useState("asc"),[h,p]=I.useState(""),[x,y]=I.useState(""),[_,j]=I.useState(""),[C,N]=I.useState(""),{data:A}=Yt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:G,error:te}=await J.from("brokerages").select("id, name").order("name");if(te)throw te;return G}}),E=async G=>{let ie=[],oe=0,ye=!0;for(;ye;){const{data:ae,error:pe}=await G(oe,oe+1e3-1);if(pe)throw pe;ae&&ae.length>0?(ie=[...ie,...ae],oe+=1e3,ye=ae.length===1e3):ye=!1}return ie},{data:T,isLoading:P}=Yt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const G=await E((ge,Le)=>J.from("profiles").select("id, name, email, brokerage_id, created_at").range(ge,Le)),{data:te}=await J.from("brokerages").select("id, name"),ie=new Map((te==null?void 0:te.map(ge=>[ge.id,ge.name]))||[]),{data:oe}=await J.rpc("get_admin_contact_counts"),ye=new Map;oe==null||oe.forEach(ge=>{ye.set(ge.owner_user_id,ge.contact_count)});const{data:ae}=await J.rpc("get_admin_video_counts"),pe=new Map;ae==null||ae.forEach(ge=>{pe.set(ge.owner_user_id,ge.video_count)});const{data:se}=await J.rpc("get_admin_popby_counts"),he=new Map;se==null||se.forEach(ge=>{he.set(ge.owner_user_id,ge.popby_count)});const{data:ue}=await J.rpc("get_admin_listing_counts"),_e=new Map;ue==null||ue.forEach(ge=>{_e.set(ge.agent_id,ge.listing_count)});const{data:Ae}=await J.rpc("get_admin_deal_counts"),Ce=new Map;return Ae==null||Ae.forEach(ge=>{Ce.set(ge.owner_user_id,ge.deal_count)}),G.map(ge=>({id:ge.id,name:ge.name||"Unknown",email:ge.email||"",brokerage_id:ge.brokerage_id,brokerage_name:ge.brokerage_id&&ie.get(ge.brokerage_id)||null,contact_count:ye.get(ge.id)||0,video_count:pe.get(ge.id)||0,popby_count:he.get(ge.id)||0,listing_count:_e.get(ge.id)||0,deal_count:Ce.get(ge.id)||0,created_at:ge.created_at}))}}),z=I.useMemo(()=>{if(!T)return[];let G=T.filter(te=>{const ie=t.toLowerCase(),oe=!t||te.name.toLowerCase().includes(ie)||te.email.toLowerCase().includes(ie),ye=n==="all"||n==="none"&&!te.brokerage_id||te.brokerage_id===n,ae=parseInt(h)||0,pe=parseInt(x)||0,se=parseInt(_)||0,he=parseInt(C)||0,ue=te.contact_count>=ae&&te.video_count>=pe&&te.popby_count>=se&&te.listing_count>=he;return oe&&ye&&ue});return G.sort((te,ie)=>{let oe=0;return a==="name"?oe=te.name.localeCompare(ie.name):oe=te[a]-ie[a],l==="asc"?oe:-oe}),G},[T,t,n,a,l,h,x,_,C]),F=G=>{a===G?i(l==="asc"?"desc":"asc"):(o(G),i("desc"))},q=()=>{const G=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings","Deals"],te=z.map(pe=>[pe.name,pe.email,pe.brokerage_name||"None",pe.contact_count,pe.video_count,pe.popby_count,pe.listing_count,pe.deal_count]),ie=[G.join(","),...te.map(pe=>pe.map(se=>`"${se}"`).join(","))].join(` `),oe=new Blob([ie],{type:"text/csv"}),ye=URL.createObjectURL(oe),ae=document.createElement("a");ae.href=ye,ae.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ae.click(),URL.revokeObjectURL(ye)},V=I.useMemo(()=>z.length?z.reduce((G,te)=>({contacts:G.contacts+te.contact_count,videos:G.videos+te.video_count,popbys:G.popbys+te.popby_count,listings:G.listings+te.listing_count,deals:G.deals+te.deal_count}),{contacts:0,videos:0,popbys:0,listings:0,deals:0}):{contacts:0,videos:0,popbys:0,listings:0,deals:0},[z]),K=({field:G,children:te})=>r.jsx(It,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>F(G),children:r.jsxs("div",{className:"flex items-center gap-1",children:[te,r.jsx(xg,{className:`h-3 w-3 ${a===G?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(Tn,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:q,children:[r.jsx(no,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:t,onChange:G=>e(G.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(gn,{value:n,onValueChange:s,children:[r.jsxs(fn,{children:[r.jsx(ai,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(yn,{placeholder:"Brokerage"})]}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Brokerages"}),r.jsx(qt,{value:"none",children:"No Brokerage"}),A==null?void 0:A.map(G=>r.jsx(qt,{value:G.id,children:G.name},G.id))]})]})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min contacts",value:h,onChange:G=>p(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min videos",value:x,onChange:G=>y(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min popbys",value:_,onChange:G=>j(G.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-6 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:z.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:V.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:V.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:V.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:V.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.deals.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Deals"})]})]}),P?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(K,{field:"name",children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{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(K,{field:"deal_count",children:"Deals"})]})}),r.jsx(Vs,{children:z.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):z.map(G=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:G.name}),r.jsx(Nt,{className:"text-muted-foreground",children:G.email}),r.jsx(Nt,{children:G.brokerage_name?r.jsx(Ot,{variant:"secondary",children:G.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.contact_count>0?"default":"outline",children:G.contact_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.video_count>0?"default":"outline",children:G.video_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.popby_count>0?"default":"outline",children:G.popby_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.listing_count>0?"default":"outline",children:G.listing_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.deal_count>0?"default":"outline",children:G.deal_count})})]},G.id))})]})})]})]})}function ojt(){pi(),Vr();const[t,e]=I.useState("user-analytics"),{data:n}=Yt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:j,error:C}=await J.from("feature_flags").select("*").order("key");if(C)throw C;return j}}),{data:s,isLoading:a}=Yt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:j,error:C}=await J.from("relationship_types").select("*").order("sort_order");if(C)throw C;return j}}),{data:o,isLoading:l}=Yt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:j,error:C}=await J.from("action_types").select("*").order("sort_order");if(C)throw C;return j}}),{data:i,isLoading:h}=Yt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:j,error:C}=await J.from("action_scripts").select("*, action_type:action_types(*)");if(C)throw C;return j}}),{data:p,isLoading:x}=Yt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:j,error:C}=await J.from("touchpoint_plans").select("*").order("name");if(C)throw C;return j}}),{data:y,isLoading:_}=Yt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:j,error:C}=await J.from("popby_items").select("*").is("owner_user_id",null).order("name");if(C)throw C;return j}});return r.jsx(Lr,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(Ii,{value:t,onValueChange:e,children:[r.jsxs(wi,{className:"grid w-full grid-cols-9",children:[r.jsxs(nn,{value:"user-analytics",className:"gap-2",children:[r.jsx(dc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(nn,{value:"relationship-types",className:"gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(nn,{value:"action-types",className:"gap-2",children:[r.jsx(bi,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(nn,{value:"scripts",className:"gap-2",children:[r.jsx(La,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(nn,{value:"video-scripts",className:"gap-2",children:[r.jsx(Id,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(nn,{value:"plans",className:"gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(nn,{value:"popbys",className:"gap-2",children:[r.jsx(Ki,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(nn,{value:"settings",className:"gap-2",children:[r.jsx(md,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(nn,{value:"feature-flags",className:"gap-2",children:[r.jsx(Ux,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(Sn,{value:"user-analytics",className:"mt-6",children:r.jsx(ijt,{})}),r.jsx(Sn,{value:"relationship-types",className:"mt-6",children:r.jsx(ljt,{types:s||[],isLoading:a})}),r.jsx(Sn,{value:"action-types",className:"mt-6",children:r.jsx(cjt,{types:o||[],isLoading:l})}),r.jsx(Sn,{value:"scripts",className:"mt-6",children:r.jsx(djt,{scripts:i||[],actionTypes:o||[],isLoading:h})}),r.jsx(Sn,{value:"video-scripts",className:"mt-6",children:r.jsx(pjt,{})}),r.jsx(Sn,{value:"plans",className:"mt-6",children:r.jsx(ujt,{plans:p||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(Sn,{value:"popbys",className:"mt-6",children:r.jsx(fjt,{items:y||[],isLoading:_})}),r.jsx(Sn,{value:"settings",className:"mt-6",children:r.jsx(mjt,{})}),r.jsx(Sn,{value:"feature-flags",className:"mt-6",children:r.jsx(hjt,{flags:n||[]})})]})]})})}function ljt({types:t,isLoading:e}){const{toast:n}=pi(),s=Vr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await J.from("relationship_types").update({name:x.name,description:x.description,icon:x.icon}).eq("id",x.id);if(y)throw y}else{const{error:y}=await J.from("relationship_types").insert([{name:x.name,description:x.description,icon:x.icon,sort_order:t.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await J.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Relationship Types"}),r.jsx(Tn,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(ee,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{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(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(x=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(b1,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(Nt,{className:"font-medium",children:x.name}),r.jsx(Nt,{className:"text-muted-foreground",children:x.description}),r.jsx(Nt,{children:r.jsx(Ps,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(Nt,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(fi,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[a?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"icon",children:"Icon"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function cjt({types:t,isLoading:e}){const{toast:n}=pi(),s=Vr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await J.from("action_types").update({name:x.name,description:x.description,icon:x.icon,color:x.color}).eq("id",x.id);if(y)throw y}else{const{error:y}=await J.from("action_types").insert([{name:x.name,description:x.description,icon:x.icon,color:x.color,sort_order:t.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await J.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Action Types"}),r.jsx(Tn,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(ee,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{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(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Color"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(x=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:x.name}),r.jsx(Nt,{className:"text-muted-foreground",children:x.description}),r.jsx(Nt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(Nt,{children:r.jsx(Ps,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(Nt,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(fi,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[a?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon"),color:y.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"icon",children:"Icon"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"color",children:"Color"}),r.jsx(dt,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function djt({scripts:t,actionTypes:e,isLoading:n}){const{toast:s}=pi(),a=Vr(),[o,l]=I.useState(null),[i,h]=I.useState(!1),p=cr({mutationFn:async y=>{if(y.id){const{error:_}=await J.from("action_scripts").update({title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:y.active}).eq("id",y.id);if(_)throw _}else{const{error:_}=await J.from("action_scripts").insert([{title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:!0}]);if(_)throw _}},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),h(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=cr({mutationFn:async y=>{const{error:_}=await J.from("action_scripts").delete().eq("id",y);if(_)throw _},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Script Library"}),r.jsx(Tn,{children:"Create and manage scripts for each action type"})]}),r.jsxs(ee,{onClick:()=>{l(null),h(!0)},children:[r.jsx(bn,{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(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Tone"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(y=>{var _;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:y.title}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:((_=y.action_type)==null?void 0:_.name)||"Unknown"})}),r.jsx(Nt,{className:"text-muted-foreground",children:y.tone}),r.jsx(Nt,{children:r.jsx(Ot,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(Nt,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{l(y),h(!0)},children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const _=new FormData(y.currentTarget);p.mutate({id:o==null?void 0:o.id,title:_.get("title"),action_type_id:_.get("action_type_id"),tone:_.get("tone"),script_body:_.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(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(gn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select action type"})}),r.jsx(pn,{children:e.map(y=>r.jsx(qt,{value:y.id,children:y.name},y.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(dt,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(He,{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(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:p.isPending,children:[p.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function ujt({plans:t,actionTypes:e,scripts:n,isLoading:s}){const{toast:a}=pi(),o=Vr(),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(null),[_,j]=I.useState(!1),[C,N]=I.useState(null),[A,E]=I.useState(null),{data:T}=Yt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:G,error:te}=await J.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(te)throw te;return G},enabled:!!x}),P=cr({mutationFn:async G=>{if(G.id){const{error:te}=await J.from("touchpoint_plans").update({name:G.name,description:G.description,active:G.active}).eq("id",G.id);if(te)throw te}else{const{error:te}=await J.from("touchpoint_plans").insert([{name:G.name,description:G.description,active:!0}]);if(te)throw te}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),p(!1),i(null),a({title:"Saved successfully"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),z=cr({mutationFn:async G=>{if(G.id){const{error:te}=await J.from("touchpoint_plan_items").update({action_type_id:G.action_type_id,default_script_id:G.default_script_id,notes:G.notes}).eq("id",G.id);if(te)throw te}else{const{error:te}=await J.from("touchpoint_plan_items").insert([{plan_id:G.plan_id,month_number:G.month_number,action_type_id:G.action_type_id,default_script_id:G.default_script_id,notes:G.notes}]);if(te)throw te}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),a({title:"Item saved"})}}),F=cr({mutationFn:async G=>{const{error:te}=await J.from("touchpoint_plan_items").delete().eq("id",G);if(te)throw te},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),q=cr({mutationFn:async G=>{const{data:te,error:ie}=await J.from("action_scripts").insert([{...G,active:!0}]).select().single();if(ie)throw ie;return te},onSuccess:async G=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),C&&await z.mutateAsync({id:C.itemId,plan_id:x,month_number:C.month,action_type_id:C.actionTypeId,default_script_id:G.id}),j(!1),N(null),a({title:"Script created and assigned"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),V=(G,te,ie)=>{N({month:G,actionTypeId:te,itemId:ie}),j(!0)},K=G=>n.find(te=>te.id===G);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Touchpoint Plans"}),r.jsx(Tn,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(ee,{onClick:()=>{i(null),p(!0)},children:[r.jsx(bn,{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(en,{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(G=>r.jsxs(Ye,{className:`cursor-pointer transition-colors ${x===G.id?"border-primary":""}`,onClick:()=>y(G.id),children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Zt,{className:"text-base",children:G.name}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:te=>{te.stopPropagation(),i(G),p(!0)},children:r.jsx(fi,{className:"h-4 w-4"})})]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:G.description}),r.jsx(Ot,{variant:G.active?"default":"secondary",className:"mt-2",children:G.active?"Active":"Inactive"})]})]},G.id))})})]}),x&&r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Plan Schedule"}),r.jsx(Tn,{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},(G,te)=>te+1).map(G=>{const te=T==null?void 0:T.find(ye=>ye.month_number===G),ie=te!=null&&te.default_script_id?K(te.default_script_id):null,oe=n.filter(ye=>ye.action_type_id===(te==null?void 0:te.action_type_id)&&ye.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 ",G]}),r.jsxs(gn,{value:(te==null?void 0:te.action_type_id)||"none",onValueChange:ye=>{ye==="none"&&te?F.mutate(te.id):ye!=="none"&&z.mutate({id:te==null?void 0:te.id,plan_id:x,month_number:G,action_type_id:ye,default_script_id:null})},children:[r.jsx(fn,{className:"w-40",children:r.jsx(yn,{placeholder:"No action"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No action"}),e.filter(ye=>ye.active).map(ye=>r.jsx(qt,{value:ye.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[ye.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ye.color}}),ye.name]})},ye.id))]})]}),te&&r.jsxs(r.Fragment,{children:[r.jsxs(gn,{value:te.default_script_id||"none",onValueChange:ye=>{E(null),z.mutate({id:te.id,default_script_id:ye==="none"?null:ye})},children:[r.jsx(fn,{className:"w-56",children:r.jsx(yn,{placeholder:"Select script"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No default script"}),oe.map(ye=>r.jsxs(qt,{value:ye.id,children:[ye.title," ",ye.tone&&`(${ye.tone})`]},ye.id))]})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>V(G,te.action_type_id,te.id),children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"New Script"]}),ie&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>E((A==null?void 0:A.id)===ie.id?null:ie),children:(A==null?void 0:A.id)===ie.id?"Hide":"Preview"})]})]}),A&&(te==null?void 0:te.default_script_id)===A.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(Ot,{variant:"outline",children:A.title}),A.tone&&r.jsx(Ot,{variant:"secondary",children:A.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:A.script_body})]})]},G)})})})]}),r.jsx(Fr,{open:h,onOpenChange:p,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const te=new FormData(G.currentTarget);P.mutate({id:l==null?void 0:l.id,name:te.get("name"),description:te.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:P.isPending,children:[P.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Fr,{open:_,onOpenChange:j,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New Script"}),r.jsxs(Qn,{children:["Create a script for Month ",C==null?void 0:C.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const te=new FormData(G.currentTarget);q.mutate({title:te.get("title"),action_type_id:C.actionTypeId,tone:te.get("tone"),script_body:te.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(He,{htmlFor:"script_title",children:"Title"}),r.jsx(dt,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script_tone",children:"Tone"}),r.jsx(dt,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(He,{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(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:q.isPending,children:[q.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function hjt({flags:t}){const{toast:e}=pi(),n=Vr(),s=async(a,o)=>{const{error:l}=await J.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",a.id);l?e({title:"Error",description:l.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),e({title:"Flag updated"}))};return r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Feature Flags"}),r.jsx(Tn,{children:"Control which features are enabled for members"})]}),r.jsx(Je,{children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Flag"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Notes"}),r.jsx(It,{children:"Last Updated"})]})}),r.jsx(Vs,{children:t.map(a=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono text-sm",children:a.key}),r.jsx(Nt,{children:r.jsx(Ps,{checked:a.enabled,onCheckedChange:o=>s(a,{enabled:o})})}),r.jsx(Nt,{children:r.jsx(dt,{defaultValue:a.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==a.notes&&s(a,{notes:o.target.value})}})}),r.jsx(Nt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function fjt({items:t,isLoading:e}){const{toast:n}=pi(),s=Vr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=cr({mutationFn:async y=>{if(y.id){const{error:_}=await J.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(_)throw _}else{const{error:_}=await J.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(_)throw _}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),p=async y=>{await J.from("popby_items").update({is_active:!y.is_active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},x=async y=>{await J.from("popby_items").delete().eq("id",y),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Popby Ideas"}),r.jsx(Tn,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(ee,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{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(en,{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(Ki,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(y=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:y.name}),r.jsx(Nt,{className:"text-muted-foreground",children:y.description}),r.jsx(Nt,{children:r.jsx(Ps,{checked:y.is_active,onCheckedChange:()=>p(y)})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[a?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const _=new FormData(y.currentTarget);h.mutate({id:a==null?void 0:a.id,name:_.get("name"),description:_.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function pjt(){var j;const{toast:t}=pi(),e=Vr(),[n,s]=I.useState(null),[a,o]=I.useState(!1),{data:l,isLoading:i}=Yt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:C,error:N}=await J.from("video_script_categories").select("*").order("sort_order");if(N)throw N;return C}}),{data:h,isLoading:p}=Yt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:C,error:N}=await J.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(N)throw N;return C}}),x=cr({mutationFn:async C=>{var N,A;if(C.id){const{error:E}=await J.from("video_scripts").update({title:C.title,script_text:C.script_text,category_id:C.category_id,tags:((N=C.tags)==null?void 0:N.split(",").map(T=>T.trim()).filter(Boolean))||[]}).eq("id",C.id);if(E)throw E}else{const{error:E}=await J.from("video_scripts").insert([{title:C.title,script_text:C.script_text,category_id:C.category_id||null,tags:((A=C.tags)==null?void 0:A.split(",").map(T=>T.trim()).filter(Boolean))||[]}]);if(E)throw E}},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"})}),y=async C=>{await J.from("video_scripts").update({is_active:!C.is_active}).eq("id",C.id),e.invalidateQueries({queryKey:["admin-video-scripts"]})},_=async C=>{confirm("Delete this video script?")&&(await J.from("video_scripts").delete().eq("id",C),e.invalidateQueries({queryKey:["admin-video-scripts"]}),t({title:"Script deleted"}))};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Video Scripts"}),r.jsx(Tn,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(ee,{onClick:()=>{s(null),o(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Je,{children:p?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:h==null?void 0:h.map(C=>{var N;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:C.title}),r.jsx(Nt,{className:"text-muted-foreground",children:((N=C.category)==null?void 0:N.name)||"Uncategorized"}),r.jsx(Nt,{children:r.jsx(Ps,{checked:C.is_active,onCheckedChange:()=>y(C)})}),r.jsxs(Nt,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{s(C),o(!0)},children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(C.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]},C.id)})})]})}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:C=>{C.preventDefault();const N=new FormData(C.currentTarget);x.mutate({id:n==null?void 0:n.id,title:N.get("title"),script_text:N.get("script_text"),category_id:N.get("category_id")||null,tags:N.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"category_id",children:"Category"}),r.jsxs(gn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:l==null?void 0:l.map(C=>r.jsx(qt,{value:C.id,children:C.name},C.id))})]})]}),r.jsxs("div",{children:[r.jsx(He,{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(He,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(dt,{id:"tags",name:"tags",defaultValue:((j=n==null?void 0:n.tags)==null?void 0:j.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function mjt(){const{toast:t}=pi(),[e,n]=I.useState(""),[s,a]=I.useState(!0),[o,l]=I.useState(!1);I.useEffect(()=>{(async()=>{a(!0);try{const{data:p}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();p!=null&&p.value&&n(p.value)}catch(p){console.error("Error fetching settings:",p)}a(!1)})()},[]);const i=async()=>{l(!0);try{await J.from("settings").upsert({key:"mapbox_public_token",value:e.trim()}),t({title:"Mapbox token saved!"})}catch{t({title:"Error saving token",variant:"destructive"})}l(!1)};return s?r.jsx(Ye,{children:r.jsx(Je,{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(Tn,{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(He,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(dt,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:e,onChange:h=>n(h.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(ee,{onClick:i,disabled:o,children:[o&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),e&&r.jsx(Ot,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const gjt=()=>{const[t,e]=I.useState(""),[n,s]=I.useState("grid"),a=Zn(),{data:o=[],isLoading:l}=Yt({queryKey:["additional-services"],queryFn:async()=>{const{data:h,error:p}=await J.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(p)throw p;return h}}),i=o.filter(h=>{var x;return h.name.toLowerCase().includes(t.toLowerCase())||((x=h.description)==null?void 0:x.toLowerCase().includes(t.toLowerCase()))});return r.jsx(Lr,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search services...",value:t,onChange:h=>e(h.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>e(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(Yf,{className:"h-4 w-4"})}),r.jsx(ee,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(Xf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," service",i.length!==1?"s":""," found"]}),l&&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((h,p)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"})]})},p))}),!l&&i.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(ee,{variant:"outline",onClick:()=>e(""),children:"Clear Search"})]}),!l&&i.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:i.map(h=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${h.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:h.preview_image_url?r.jsx("img",{src:h.preview_image_url,alt:h.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(Ms,{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:h.name}),h.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:Sne(h.description)})]})]},h.id))})]})})},xjt=()=>{const{serviceId:t}=Yc(),e=Zn(),{data:n,isLoading:s}=Yt({queryKey:["additional-service",t],queryFn:async()=>{const{data:a,error:o}=await J.from("additional_services").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;return a},enabled:!!t});return s?r.jsx(Lr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Ir,{className:"h-8 w-48"}),r.jsx(Ir,{className:"h-64 w-full rounded-lg"}),r.jsx(Ir,{className:"h-24 w-full"})]})}):n?r.jsx(Lr,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/additional-services"),className:"gap-2",children:[r.jsx(so,{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(Ms,{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(Os,{className:"h-4 w-4 mr-1"}),"Published ",xn(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(ee,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Ls,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Lr,{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(ee,{onClick:()=>e("/additional-services"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},qM=[{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 yjt(){const[t,e]=I.useState(qM[0].id),n=qM.find(s=>s.id===t)||qM[0];return r.jsx(Lr,{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(tS,{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(gn,{value:t,onValueChange:e,children:[r.jsx(fn,{className:"w-full",children:r.jsx(yn,{placeholder:"Select a tool"})}),r.jsx(pn,{children:qM.map(s=>r.jsx(qt,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(Ii,{value:t,onValueChange:e,className:"w-full",children:r.jsx(wi,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:qM.map(s=>r.jsx(nn,{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 c4e="agent-os-onboarding-completed",zL=[{icon:_g,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:Sg,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:Bn,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:mm,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:Ki,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:dc,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"]}],vjt=()=>{const[t,e]=I.useState(!1),[n,s]=I.useState(0),[a,o]=I.useState(!1);I.useEffect(()=>{if(!localStorage.getItem(c4e)){const C=setTimeout(()=>e(!0),500);return()=>clearTimeout(C)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):h()},i=()=>{h()},h=()=>{localStorage.setItem(c4e,"true"),e(!1)},p=zL[n],x=p.icon,y=n===zL.length-1,_=j=>{j||h(),e(j)};return r.jsx(Fr,{open:t,onOpenChange:_,children:r.jsxs(Rr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${p.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 ${a?"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(x,{className:`h-10 w-10 ${p.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(Ms,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(qr,{className:"text-center sm:text-center pb-2",children:[r.jsx($r,{className:`text-2xl font-bold transition-all duration-300 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.title}),r.jsx(Qn,{className:`text-base pt-2 transition-all duration-300 delay-75 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.description})]}),p.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.highlights.map((j,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 ${p.bgGradient} shadow-sm`,children:r.jsx(Ai,{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:j})]},C))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:zL.map((j,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 "+p.bgGradient:C{const{user:t}=Xr();return Yt({queryKey:["contact-snoozes",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return e},enabled:!!t})},bjt=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async({contactId:n,days:s})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const a=Kl(new Date,s);await J.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await J.from("contact_snoozes").insert({contact_id:n,owner_user_id:e.id,snoozed_until:a.toISOString()});if(o)throw o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),t.invalidateQueries({queryKey:["popby-logs"]}),ma({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{ma({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},wjt=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("contact_snoozes").delete().eq("contact_id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),ma({title:"Snooze cancelled"})},onError:e=>{ma({title:"Error cancelling snooze",description:e.message,variant:"destructive"})}})},jjt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function vye({open:t,onOpenChange:e,contactId:n,contactName:s}){const[a,o]=I.useState(null),l=bjt(),i=async()=>{a&&(await l.mutateAsync({contactId:n,days:a}),o(null),e(!1))},h=p=>xn(Kl(new Date,p),"MMM d, yyyy");return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Qn,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:jjt.map(p=>r.jsxs("button",{type:"button",onClick:()=>o(p.days),className:zt("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",a===p.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[r.jsx("span",{className:"font-medium",children:p.label}),r.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Os,{className:"h-3.5 w-3.5"}),"Until ",h(p.days)]})]},p.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const kjt={Crown:m1,FileText:La,Users:Bn,Globe:Vx,Star:vs,Phone:bi,MessageSquare:Oo,PenTool:bj,Video:Pa,Gift:Ki};function Njt({actions:t,onMarkComplete:e,onViewScript:n,isLoading:s,buildSmsLink:a,buildEmailLink:o}){const l=Zn(),[i,h]=I.useState("name"),[p,x]=I.useState("asc"),[y,_]=I.useState(null),[j,C]=I.useState(""),N=z=>{i===z?x(F=>F==="asc"?"desc":"asc"):(h(z),x("asc"))},A=I.useMemo(()=>[...t].sort((z,F)=>{var V,K;let q=0;switch(i){case"name":{const G=`${z.contact.first_name} ${z.contact.last_name||""}`.toLowerCase(),te=`${F.contact.first_name} ${F.contact.last_name||""}`.toLowerCase();q=G.localeCompare(te);break}case"relationship_type":q=(z.relationshipTypeName||"").localeCompare(F.relationshipTypeName||"");break;case"action_type":q=(((V=z.actionType)==null?void 0:V.name)||"").localeCompare(((K=F.actionType)==null?void 0:K.name)||"");break;case"last_touch":q=(z.monthNumber||0)-(F.monthNumber||0);break}return p==="asc"?q:-q}),[t,i,p]),E=z=>kjt[z||"Phone"]||bi,T=({field:z,children:F})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>N(z),children:[F,i===z?p==="asc"?r.jsx(Zf,{className:"ml-2 h-4 w-4"}):r.jsx($x,{className:"ml-2 h-4 w-4"}):r.jsx(xg,{className:"ml-2 h-4 w-4 opacity-50"})]}),P=(z,F,q)=>{_(z),C(`${F} ${q||""}`.trim())};return t.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.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[180px]",children:r.jsx(T,{field:"name",children:"Contact"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(T,{field:"relationship_type",children:"Type"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(T,{field:"action_type",children:"Action"})}),r.jsx(It,{className:"w-[130px]",children:"Phone"}),r.jsx(It,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Vs,{children:A.map((z,F)=>{var ie,oe,ye,ae,pe,se;const q=z.isSpecialDate,V=z.specialDateType,K=q?V==="birthday"?Jh:da:E(((ie=z.actionType)==null?void 0:ie.icon)||null),G=z.contact.phone,te=z.contact.email;return r.jsxs(Ar,{className:zt("hover:bg-muted/50 transition-colors",q&&V==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",q&&V==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(Nt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>l(`/mission-control/contacts/${z.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[z.contact.first_name," ",z.contact.last_name]})})}),r.jsx(Nt,{children:z.relationshipTypeName?r.jsx(Ot,{variant:"secondary",className:"text-xs",children:z.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:q?r.jsx(Ot,{className:zt("gap-1",V==="birthday"&&"bg-pink-500 hover:bg-pink-600",V==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:V==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(Jh,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(da,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(K,{className:"h-3 w-3"}),(oe=z.actionType)==null?void 0:oe.name]})})}),r.jsx(Nt,{children:G?r.jsx("span",{className:"text-sm font-mono",children:z.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[G&&r.jsx("a",{href:`tel:${z.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(bi,{className:"h-3.5 w-3.5"})}),G&&r.jsx("a",{href:a(z.contact.phone,(ye=z.script)==null?void 0:ye.script_body,z.contact),className:"p-1.5 rounded bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 transition-colors",title:"Text",children:r.jsx(Oo,{className:"h-3.5 w-3.5"})}),te&&r.jsx("a",{href:o(z.contact.email,(ae=z.script)==null?void 0:ae.script_body,(pe=z.script)==null?void 0:pe.email_subject,(se=z.actionType)==null?void 0:se.name,z.contact),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Email",children:r.jsx(ua,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>P(z.contact.id,z.contact.first_name,z.contact.last_name),title:"Snooze",children:r.jsx(Jf,{className:"h-3.5 w-3.5"})}),r.jsxs(ee,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var he;return e(z.contact.id,z.actionType.id,(he=z.script)==null?void 0:he.id)},disabled:s,children:[r.jsx(Xi,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${z.contact.id}-${F}`)})})]})}),r.jsx(vye,{open:!!y,onOpenChange:z=>!z&&_(null),contactId:y||"",contactName:j})]})}const d4e={Crown:m1,FileText:La,Users:Bn,Globe:Vx,Star:vs,Phone:bi,MessageSquare:Oo,PenTool:bj,Video:Pa,Gift:Ki},Sjt={"Top 25":"bg-primary text-primary-foreground","Past Client":"bg-sky-500 text-white","Referral Partner":"bg-orange-500 text-white",Sphere:"bg-emerald-500 text-white",VIP:"bg-amber-500 text-white"};function Cjt(){const t=Zn(),{user:e}=Xr(),{data:n}=Mm(),{data:s}=c8e(),{data:a}=dp(),{data:o}=yxe(),{data:l}=g8e(),i=Rft(),h=m8e(),p=Oft(90),x=h8e(),[y,_]=I.useState(null),[j,C]=I.useState(null),[N,A]=I.useState(!1),[E,T]=I.useState(""),[P,z]=I.useState(!1),[F,q]=I.useState(""),[V,K]=I.useState(xte()),[G,te]=I.useState("cards"),ie=()=>{const be=parseInt(F,10);if(isNaN(be)||be<1){ma({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}K(be),p8e(be),z(!1),ma({title:"Goal updated",description:`Weekly touch goal set to ${be}`})},oe=()=>{q(V.toString()),z(!0)};I.useEffect(()=>{(async()=>{if(!(e!=null&&e.id))return;const{data:tt}=await J.from("profiles").select("name").eq("id",e.id).single();tt!=null&&tt.name&&T(tt.name.split(" ")[0])})()},[e==null?void 0:e.id]),I.useEffect(()=>{i.mutate()},[]);const ye=hf(new Date),ae=Kl(ye,7),pe=be=>{if(!be)return null;const tt=new Date(be);return new Date(ye.getFullYear(),tt.getMonth(),tt.getDate())},se=(a==null?void 0:a.filter(be=>{const tt=pe(be.birthday),Te=pe(be.home_anniversary);return tt&&Jl(tt,ye)||Te&&Jl(Te,ye)}))||[],he=(a==null?void 0:a.filter(be=>{if(!be.birthday&&!be.home_anniversary)return!1;const tt=Te=>{if(!Te)return!1;const Ke=pe(Te);return Ke?fte(Ke,ye)&&fse(Ke,ae):!1};return tt(be.birthday)||tt(be.home_anniversary)}).slice(0,5))||[],ue=se.map(be=>{var me,yt,rt;const tt=pe(be.birthday),Te=tt&&Jl(tt,ye),Ke=(o==null?void 0:o.find(at=>at.name==="Call"))||(o==null?void 0:o[0]);return{contact:be,actionType:Ke||{id:"special-date",name:Te?"Birthday Call":"Anniversary Call",icon:Te?"Cake":"Home",color:Te?"#EC4899":"#8B5CF6",description:Te?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Te?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((rt=(yt=(me=be.tags)==null?void 0:me[0])==null?void 0:yt.relationship_type)==null?void 0:rt.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Te?"birthday":"anniversary"}}),Ae=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((be,tt)=>{var Ke,me,yt;const Te=o==null?void 0:o[tt%((o==null?void 0:o.length)||1)];return Te?{contact:be,actionType:Te,planName:"Quick Touch",relationshipTypeName:((yt=(me=(Ke=be.tags)==null?void 0:Ke[0])==null?void 0:me.relationship_type)==null?void 0:yt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Ce=[...ue,...Ae],Se=async(be,tt,Te)=>{await x.mutateAsync({contactId:be,actionTypeId:tt,scriptUsedId:Te}),A(!1),C(null)},ge=be=>{be.script?(C(be),A(!0)):Se(be.contact.id,be.actionType.id)},Le=be=>d4e[be||"Phone"]||bi,ke=be=>d4e[be||"Users"]||Bn,Be=(be,tt)=>be.replace(/\{\{FirstName\}\}/g,tt.first_name).replace(/\{\{LastName\}\}/g,tt.last_name||"").replace(/\{\{AgentName\}\}/g,E||"there"),Ee=(be,tt)=>({Call:`Thinking of you, ${tt}!`,Text:`Quick hello, ${tt}`,Email:`Checking in, ${tt}`,"Handwritten Note":`A note for ${tt}`,Video:`Video message for ${tt}`,Gift:`Something special for you, ${tt}`})[be]||`Hello ${tt}!`,Ue=(be,tt,Te)=>{const Ke=`sms:${be}`;if(tt&&Te){const me=Be(tt,Te);return`${Ke}?body=${encodeURIComponent(me)}`}return Ke},Fe=(be,tt,Te,Ke,me)=>{const yt=`mailto:${be}`,rt=[];if(me){const at=Te||Ee(Ke||"Email",me.first_name);if(rt.push(`subject=${encodeURIComponent(at)}`),tt){const Me=Be(tt,me);rt.push(`body=${encodeURIComponent(Me)}`)}}return rt.length>0?`${yt}?${rt.join("&")}`:yt};return r.jsxs(Lr,{title:"Mission Control",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:"Mission Control"}),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 Sphere"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:n==null?void 0:n.filter(be=>be.active).map(be=>{const tt=ke(be.icon),Te=(s==null?void 0:s[be.id])||0,Ke=y===be.id,me=Sjt[be.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Ke?(_(null),t("/mission-control/contacts")):(_(be.id),t(`/mission-control/contacts?type=${be.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ke?me:"bg-card hover:bg-accent"} `,children:[r.jsx(tt,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:be.name}),r.jsxs("div",{className:`text-sm ${Ke?"opacity-90":"text-muted-foreground"}`,children:[Te," Contacts"]})]})]},be.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(ee,{onClick:()=>t("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Id,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(ee,{onClick:()=>t("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Vi,{className:"h-4 w-4 ml-1"})]}),r.jsx(ee,{variant:"outline",onClick:()=>t("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(ee,{variant:"outline",onClick:()=>t("/mission-control/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"}),l!==void 0&&r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(Ms,{className:"h-3 w-3"}),"Plan-based"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-1 border rounded-lg p-0.5",children:[r.jsx(ee,{variant:G==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>te("cards"),title:"Card view",children:r.jsx(Yf,{className:"h-4 w-4"})}),r.jsx(ee,{variant:G==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>te("table"),title:"Table view",children:r.jsx(Xf,{className:"h-4 w-4"})})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:Ce.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(ee,{variant:"outline",className:"mt-4",onClick:()=>t("/mission-control/plans"),children:"Manage Plans"})]}):G==="table"?r.jsx(Njt,{actions:Ce,onMarkComplete:Se,onViewScript:ge,isLoading:x.isPending,buildSmsLink:Ue,buildEmailLink:Fe}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Ce.map((be,tt)=>{var ft,qe,Oe,Qe,nt,gt,mt;const Te=be.isSpecialDate,Ke=be.specialDateType,me=Te?Ke==="birthday"?Jh:da:Le(((ft=be.actionType)==null?void 0:ft.icon)||null),yt=be.contact.phone,rt=be.contact.email,at=Te?Ke==="birthday"?"#EC4899":"#8B5CF6":((qe=be.actionType)==null?void 0:qe.color)||"#3B82F6",Me=Te?Ke==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Oe=be.actionType)==null?void 0:Oe.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Te?"ring-2 ring-offset-2":""}`,style:Te?{"--tw-ring-color":at}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:at},children:[r.jsx(me,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:Me})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>t(`/mission-control/contacts/${be.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[be.contact.first_name," ",be.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[yt&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${be.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(bi,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:Ue(be.contact.phone,(Qe=be.script)==null?void 0:Qe.script_body,be.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(Oo,{className:"h-3 w-3"}),"Text"]})]}),rt&&r.jsxs("a",{href:Fe(be.contact.email,(nt=be.script)==null?void 0:nt.script_body,(gt=be.script)==null?void 0:gt.email_subject,(mt=be.actionType)==null?void 0:mt.name,be.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(ua,{className:"h-3 w-3"}),"Email"]})]}),!yt&&!rt&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[be.relationshipTypeName&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:be.relationshipTypeName}),be.monthNumber>0&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:["Month ",be.monthNumber]})]}),be.script&&r.jsx(ee,{size:"sm",variant:"outline",className:"w-full",onClick:()=>ge(be),children:"View Script"}),r.jsx(ee,{size:"sm",className:"w-full",onClick:()=>{var Mt;return Se(be.contact.id,be.actionType.id,(Mt=be.script)==null?void 0:Mt.id)},disabled:x.isPending,children:"Mark Complete"})]})]},be.contact.id+tt)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"h-full w-full",children:[r.jsx(nm,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(Gu,{children:r.jsx(di,{onClick:()=>t("/mission-control/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(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{className:"text-lg",children:"Momentum"}),r.jsxs(Fr,{open:P,onOpenChange:z,children:[r.jsx(Bo,{asChild:!0,children:r.jsx("button",{onClick:oe,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(md,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Rr,{className:"sm:max-w-[360px]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Set Weekly Goal"}),r.jsx(Qn,{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(He,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(dt,{id:"weekly-goal-ic",type:"number",min:"1",value:F,onChange:be=>q(be.target.value),placeholder:"20",onKeyDown:be=>{be.key==="Enter"&&ie()}})]}),r.jsx(ee,{onClick:ie,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx(Zc,{value:Math.min(h.actionsThisWeek/V*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(ef,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[h.actionsThisWeek," / ",V]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),h.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! (",h.streak," days)"]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(Je,{className:"space-y-3",children:[he.length>0?he.map(be=>{const tt=be.birthday,Te=be.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[tt?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:[be.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",tt?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[tt&&be.birthday&&xn(new Date(be.birthday),"MMM d"),Te&&be.home_anniversary&&xn(new Date(be.home_anniversary),"MMM d")]})]})]},be.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),p.count>0&&r.jsxs("button",{onClick:()=>t("/mission-control/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(Ya,{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:[p.count," Contact",p.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Vi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(E8e,{})]})]}),r.jsx(Fr,{open:N,onOpenChange:A,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsx(qr,{children:r.jsx($r,{className:"flex items-center gap-2",children:j&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:j.actionType.color||"#3B82F6"}}),j.actionType.name," Script"]})})}),j&&j.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:[j.contact.first_name," ",j.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Be(j.script.script_body,j.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>A(!1),children:"Close"}),r.jsx(ee,{className:"flex-1",onClick:()=>{var be;return Se(j.contact.id,j.actionType.id,(be=j.script)==null?void 0:be.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(vjt,{})]})}const kze=()=>{const{user:t}=Xr();return Yt({queryKey:["popby-items",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.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})},Vse=t=>{const{user:e}=Xr();return Yt({queryKey:["popby-logs",e==null?void 0:e.id,t],queryFn:async()=>{let n=J.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:a}=await n;if(a)throw a;return s},enabled:!!e})},_ye=()=>{const{user:t}=Xr();return Yt({queryKey:["relationship-type-popby-defaults",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("relationship_type_popby_defaults").select("*");if(n)throw n;return e},enabled:!!t})},Nze=()=>{const{user:t}=Xr();return Yt({queryKey:["contact-popby-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_popby_settings").select("*");if(n)throw n;return e},enabled:!!t})},Sze=()=>{const{data:t}=dp(),{data:e}=Mm(),{data:n}=Vse(),{data:s}=Nze(),{data:a}=_ye(),o=new Map;n==null||n.forEach(x=>{const y=o.get(x.contact_id);(!y||new Date(x.completed_at)>new Date(y))&&o.set(x.contact_id,x.completed_at)});const l=new Map;a==null||a.forEach(x=>l.set(x.relationship_type_id,x.frequency_days));const i=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{i.set(x.contact_id,x.frequency_days)});const h=hf(new Date);return(t||[]).map(x=>{let y=90;if(i.has(x.id))y=i.get(x.id);else if(x.tags&&x.tags.length>0){const A=x.tags.map(E=>l.get(E.relationship_type_id)).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}const _=o.get(x.id)||null,j=_?dy(h,hf(new Date(_))):null,C=j===null||j>=y,N=C&&j!==null?j-y:0;return{...x,lastPopby:_,daysSinceLastPopby:j,frequencyDays:y,isDue:C,daysOverdue:N}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},Cze=()=>Sze().filter(e=>e.isDue),Mjt=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{error:s}=await J.from("popby_items").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-items"]}),ma({title:"Popby item created!"})},onError:n=>{ma({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},Mze=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{error:s}=await J.from("popby_logs").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-logs"]}),ma({title:"Popby logged!"})},onError:n=>{ma({title:"Error logging popby",description:n.message,variant:"destructive"})}})},Tjt=()=>{const t=Vr(),{user:e}=Xr();return cr({mutationFn:async n=>{const{error:s}=await J.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"]}),ma({title:"Frequency updated!"})},onError:n=>{ma({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},Ajt=()=>{const{data:t}=Vse(30),e=Cze(),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,a=(t==null?void 0:t.length)||0;return{thisWeekCount:s,thisMonthCount:a,dueCount:e.length}};function Ejt(){const{user:t}=Xr();return Yt({queryKey:["contact-touch-logs",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function Tze(t){const{data:e}=Ejt(),{data:n}=Nze(),{data:s}=_ye(),{data:a}=_jt();return I.useMemo(()=>{const o=a==null?void 0:a.find(A=>A.contact_id===t.id),l=o?new Date(o.snoozed_until):null,i=hf(new Date);if(l&&!fse(l,i))return{nextTouchDate:l,daysUntil:dy(l,i),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const p=((e==null?void 0:e.filter(A=>A.contact_id===t.id))||[]).sort((A,E)=>new Date(E.completed_at).getTime()-new Date(A.completed_at).getTime())[0],x=p?new Date(p.completed_at):null;let y=90;const _=n==null?void 0:n.find(A=>A.contact_id===t.id&&A.is_active);if(_)y=_.frequency_days;else if(t.tags&&t.tags.length>0){const A=t.tags.map(E=>{const T=s==null?void 0:s.find(P=>P.relationship_type_id===E.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const j=Kl(hf(x),y),C=dy(j,i);let N;return C<0?N="overdue":C<=7?N="due-soon":N="on-track",{nextTouchDate:j,daysUntil:C,status:N,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[t,e,n,s,a])}function afe({contact:t}){const e=Tze(t),s=(()=>{switch(e.status){case"overdue":return{variant:"destructive",icon:fl,text:`${Math.abs(e.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ya,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:Xi,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:Jf,text:`Snoozed until ${xn(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:Os,text:"Never touched",className:"border-dashed"}}})(),a=s.icon;return r.jsxs(Ot,{variant:s.variant,className:zt("gap-1",s.className),children:[r.jsx(a,{className:"h-3 w-3"}),s.text]})}function Ijt({contact:t,onLogTouch:e,onSnooze:n}){const s=Tze(t),a=wjt(),[o,l]=I.useState(!1),i=()=>{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"}},h=()=>{switch(s.status){case"overdue":return r.jsx(fl,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Ya,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(Xi,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(Jf,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(Os,{className:"h-5 w-5 text-muted-foreground"})}},p=()=>{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"}},x=async()=>{await a.mutateAsync(t.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(Os,{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:[h(),r.jsx("span",{className:zt("font-medium",i()),children:p()})]}),s.status==="snoozed"&&s.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",xn(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:"})," ",xn(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:"})," ",xn(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(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:a.isPending,children:[r.jsx(_s,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),e&&r.jsx(ee,{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(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(Jf,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&e&&r.jsx(ee,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:e,children:"Log Touch"})]})]})]}),r.jsx(vye,{open:o,onOpenChange:l,contactId:t.id,contactName:`${t.first_name} ${t.last_name||""}`.trim()})]})}const Pce=768;function m3(){const[t,e]=I.useState(void 0);return I.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Pce-1}px)`),s=()=>{e(window.innerWidthn.removeEventListener("change",s)},[]),!!t}const Pjt={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"}},Ljt={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 Lce({score:t,showScore:e=!1,showTooltip:n=!0,size:s="sm",className:a}){const o=Pjt[t.status],l=Ljt[s],i=r.jsxs("div",{className:zt("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,a),children:[r.jsx("span",{className:zt("rounded-full",o.bgClass,l.dot)}),e?r.jsx("span",{children:t.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(gI,{children:r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:i}),r.jsx(vm,{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"})]})})]})}):i}const Ojt=[{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:"spouse_email",label:"Spouse Email",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}],Djt=({open:t,onOpenChange:e,relationshipTypes:n,onSuccess:s})=>{const{user:a}=Xr(),{toast:o}=pi(),l=I.useRef(null),[i,h]=I.useState("upload"),[p,x]=I.useState([]),[y,_]=I.useState([]),[j,C]=I.useState({}),[N,A]=I.useState([]),[E,T]=I.useState([]),[P,z]=I.useState(!1),[F,q]=I.useState(null),V=()=>{h("upload"),x([]),_([]),C({}),A([]),T([]),q(null),l.current&&(l.current.value="")},K=()=>{V(),e(!1)},G=he=>{const ue=he.split(` `).map(Se=>Se.trim()).filter(Se=>Se);if(ue.length===0)return{headers:[],data:[]};const _e=Se=>{const ge=[];let Le="",ke=!1;for(let Be=0;Be{var Ae;const ue=(Ae=he.target.files)==null?void 0:Ae[0];if(!ue)return;const _e=new FileReader;_e.onload=Ce=>{var Be;const Se=(Be=Ce.target)==null?void 0:Be.result,{headers:ge,data:Le}=G(Se);if(ge.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(ge),_(Le);const ke={};ge.forEach(Ee=>{const Ue=Ee.toLowerCase().replace(/[_\s-]/g,"");Ue.includes("firstname")||Ue==="first"?ke.first_name=Ee:Ue.includes("lastname")||Ue==="last"?ke.last_name=Ee:Ue.includes("email")?ke.email=Ee:Ue.includes("phone")||Ue.includes("mobile")||Ue.includes("cell")?ke.phone=Ee:Ue.includes("address")||Ue.includes("street")?ke.address=Ee:Ue==="city"?ke.city=Ee:Ue==="state"||Ue==="province"?ke.state=Ee:Ue==="zip"||Ue==="zipcode"||Ue==="postalcode"?ke.zip=Ee:Ue.includes("spouse")&&Ue.includes("email")?ke.spouse_email=Ee:Ue.includes("spouse")||Ue.includes("partner")?ke.spouse_name=Ee:Ue.includes("company")||Ue.includes("organization")||Ue.includes("business")?ke.company_name=Ee:Ue.includes("jobtitle")||Ue.includes("title")||Ue.includes("position")?ke.job_title=Ee:Ue.includes("birthday")||Ue.includes("dob")||Ue.includes("birthdate")?ke.birthday=Ee:Ue.includes("anniversary")||Ue.includes("homeanniversary")?ke.home_anniversary=Ee:(Ue.includes("notes")||Ue.includes("comment"))&&(ke.notes=Ee)}),C(ke),h("mapping")},_e.readAsText(ue)},ie=(he,ue)=>{C(_e=>{if(ue==="none"){const{[he]:Ae,...Ce}=_e;return Ce}return{..._e,[he]:ue}})},oe=he=>{A(ue=>ue.includes(he)?ue.filter(_e=>_e!==he):[...ue,he])},ye=()=>{const he=y.map(ue=>{const _e=Se=>{const ge=j[Se];if(!ge)return"";const Le=p.indexOf(ge);return Le>=0?(ue[Le]||"").trim():""},Ae=_e("first_name"),Ce=Ae.length>0;return{first_name:Ae,last_name:_e("last_name"),email:_e("email"),phone:_e("phone"),address:_e("address"),city:_e("city"),state:_e("state"),zip:_e("zip"),spouse_name:_e("spouse_name"),spouse_email:_e("spouse_email"),company_name:_e("company_name"),job_title:_e("job_title"),birthday:_e("birthday"),home_anniversary:_e("home_anniversary"),notes:_e("notes"),isValid:Ce,error:Ce?void 0:"First name is required"}});T(he),h("preview")},ae=async()=>{if(!(a!=null&&a.id))return;const he=E.filter(Ce=>Ce.isValid);if(he.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}z(!0);let ue=0,_e=0,Ae=0;try{for(const Ce of he)try{let Se=null;if(Ce.email){const{data:Le}=await J.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",Ce.email).maybeSingle();Se=Le}if(!Se&&Ce.phone){const{data:Le}=await J.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",Ce.phone).maybeSingle();Se=Le}const ge={owner_user_id:a.id,first_name:Ce.first_name,last_name:Ce.last_name||null,email:Ce.email||null,phone:Ce.phone||null,address:Ce.address||null,city:Ce.city||null,state:Ce.state||null,zip:Ce.zip||null,spouse_name:Ce.spouse_name||null,spouse_email:Ce.spouse_email||null,company_name:Ce.company_name||null,job_title:Ce.job_title||null,birthday:Ce.birthday||null,home_anniversary:Ce.home_anniversary||null,notes:Ce.notes||null};if(Se)await J.from("innercircle_contacts").update(ge).eq("id",Se.id),_e++;else{const{data:Le}=await J.from("innercircle_contacts").insert(ge).select("id").single();Le&&N.length>0&&await J.from("innercircle_contact_tags").insert(N.map(ke=>({contact_id:Le.id,relationship_type_id:ke}))),ue++}}catch(Se){console.error("Error importing contact:",Se),Ae++}q({created:ue,updated:_e,failed:Ae}),h("result"),(ue>0||_e>0)&&s(),o({title:"Import Complete",description:`${ue} created, ${_e} updated${Ae>0?`, ${Ae} failed`:""}.`})}catch(Ce){console.error("Import error:",Ce),o({title:"Import Failed",description:Ce.message||"Failed to import contacts",variant:"destructive"})}finally{z(!1)}},pe=E.filter(he=>he.isValid).length,se=E.filter(he=>!he.isValid).length;return r.jsx(Fr,{open:t,onOpenChange:K,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(y1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Qn,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),i==="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:l,onChange:te,className:"hidden"}),r.jsx(uo,{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(ee,{onClick:()=>{var he;return(he=l.current)==null?void 0:he.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(ee,{variant:"outline",size:"sm",onClick:()=>{const he=`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`,ue=new Blob([he],{type:"text/csv"}),_e=URL.createObjectURL(ue),Ae=document.createElement("a");Ae.href=_e,Ae.download="contact_import_template.csv",Ae.click(),URL.revokeObjectURL(_e)},children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),i==="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(He,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:Ojt.map(he=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(He,{className:"w-40 text-sm",children:[he.label,he.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(gn,{value:j[he.key]||"none",onValueChange:ue=>ie(he.key,ue),children:[r.jsx(fn,{className:"w-48",children:r.jsx(yn,{placeholder:"Select column..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"-- Not mapped --"}),p.map(ue=>r.jsx(qt,{value:ue,children:ue},ue))]})]})]},he.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(he=>r.jsx(Ot,{variant:N.includes(he.id)?"default":"outline",className:"cursor-pointer",onClick:()=>oe(he.id),children:he.name},he.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",y.length," row(s) found in CSV"]})})]}),i==="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(Xi,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[pe," valid"]})]}),se>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(fl,{className:"h-4 w-4"}),r.jsxs("span",{children:[se," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:E.slice(0,100).map((he,ue)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:he.first_name}),r.jsx(Nt,{children:he.last_name}),r.jsx(Nt,{children:he.email}),r.jsx(Nt,{children:he.phone}),r.jsx(Nt,{children:he.isValid?r.jsx(Ot,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ot,{variant:"destructive",children:he.error||"Invalid"})})]},ue))})]}),E.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",E.length," contacts"]})]})]}),i==="result"&&F&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(Xi,{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(ea,{children:[i==="upload"&&r.jsx(ee,{variant:"outline",onClick:K,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:V,children:"Back"}),r.jsx(ee,{onClick:ye,disabled:!j.first_name,children:"Continue"})]}),i==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h("mapping"),children:"Back"}),r.jsx(ee,{onClick:ae,disabled:P||pe===0,children:P?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${pe} Contact${pe!==1?"s":""}`})]}),i==="result"&&r.jsx(ee,{onClick:K,children:"Done"})]})]})})};function Rjt(){return"contacts"in navigator&&"ContactsManager"in window}function Fjt(t){const e=[],n=t.split("BEGIN:VCARD").filter(s=>s.trim());for(const s of n){const a=s.split(/\r?\n/);let o="",l="",i="",h="",p="";for(const x of a){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const j=y.substring(y.indexOf(":")+1).split(";");l=(j[0]||"").trim(),o=(j[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const j=y.substring(y.indexOf(":")+1).trim().split(" ");o=j[0]||"",l=j.slice(1).join(" ")}(y.startsWith("EMAIL")||y.match(/^item\d+\.EMAIL/i))&&!i&&(i=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("TEL")||y.match(/^item\d+\.TEL/i))&&!h&&(h=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!p&&(p=y.substring(y.indexOf(":")+1).split(";").map(C=>C.trim()).filter(Boolean).join(", "))}(o||l)&&e.push({first_name:o,last_name:l,email:i,phone:h,address:p})}return e}function zjt({open:t,onOpenChange:e,onComplete:n}){const{user:s}=Xr(),{data:a}=dp(),o=gxe(),l=I.useRef(null),[i,h]=I.useState("choose"),[p,x]=I.useState([]),[y,_]=I.useState(new Set),[j,C]=I.useState(0),[N,A]=I.useState(0),E=Rjt(),T=I.useCallback(ie=>{if(!a)return ie;const oe=new Set(a.filter(ae=>ae.email).map(ae=>ae.email.toLowerCase())),ye=new Set(a.filter(ae=>ae.phone).map(ae=>ae.phone.replace(/\D/g,"")));return ie.map(ae=>{var he,ue;const pe=(he=ae.email)==null?void 0:he.toLowerCase(),se=(ue=ae.phone)==null?void 0:ue.replace(/\D/g,"");return pe&&oe.has(pe)?{...ae,isDuplicate:!0,duplicateField:"email"}:se&&se.length>=7&&ye.has(se)?{...ae,isDuplicate:!0,duplicateField:"phone"}:ae})},[a]),P=async()=>{try{const ie=["name","email","tel","address"],oe=await navigator.contacts.select(ie,{multiple:!0});if(!oe||oe.length===0)return;const ye=oe.map(se=>{var _e,Ae,Ce,Se;const ue=(((_e=se.name)==null?void 0:_e[0])||"").split(" ");return{first_name:ue[0]||"",last_name:ue.slice(1).join(" "),email:((Ae=se.email)==null?void 0:Ae[0])||"",phone:((Ce=se.tel)==null?void 0:Ce[0])||"",address:(Se=se.address)!=null&&Se[0]?[se.address[0].streetAddress,se.address[0].city,se.address[0].region,se.address[0].postalCode].filter(Boolean).join(", "):""}}),ae=T(ye);x(ae);const pe=new Set;ae.forEach((se,he)=>{se.isDuplicate||pe.add(he)}),_(pe),h("preview")}catch(ie){console.error("Contact Picker error:",ie),ma({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},z=ie=>{var ae;const oe=(ae=ie.target.files)==null?void 0:ae[0];if(!oe)return;const ye=new FileReader;ye.onload=pe=>{var Ae;const se=(Ae=pe.target)==null?void 0:Ae.result,he=Fjt(se);if(he.length===0){ma({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const ue=T(he);x(ue);const _e=new Set;ue.forEach((Ce,Se)=>{Ce.isDuplicate||_e.add(Se)}),_(_e),h("preview")},ye.readAsText(oe),l.current&&(l.current.value="")},F=async()=>{const ie=p.filter((ye,ae)=>y.has(ae));if(ie.length===0)return;h("importing");let oe=0;for(const ye of ie)try{await o.mutateAsync({first_name:ye.first_name,last_name:ye.last_name||void 0,email:ye.email||void 0,phone:ye.phone||void 0,address:ye.address||void 0}),oe++,A(Math.round(oe/ie.length*100))}catch(ae){console.error(`Failed to import ${ye.first_name} ${ye.last_name}:`,ae)}C(oe),h("done")},q=ie=>{_(oe=>{const ye=new Set(oe);return ye.has(ie)?ye.delete(ie):ye.add(ie),ye})},V=()=>{y.size===p.length?_(new Set):_(new Set(p.map((ie,oe)=>oe)))},K=ie=>{ie||(h("choose"),x([]),_(new Set),C(0),A(0),i==="done"&&n()),e(ie)},G=p.filter(ie=>ie.isDuplicate).length,te=y.size;return r.jsx(Fr,{open:t,onOpenChange:K,children:r.jsxs(Rr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(jg,{className:"h-5 w-5 text-primary"}),i==="choose"&&"Import Phone Contacts",i==="preview"&&"Select Contacts to Import",i==="importing"&&"Importing Contacts...",i==="done"&&"Import Complete"]}),i==="choose"&&r.jsx(Qn,{children:"Add contacts from your phone directly into Agent OS."})]}),i==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[E&&r.jsxs(ee,{onClick:P,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(jg,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Select from Phone"}),r.jsx("div",{className:"text-xs opacity-80",children:"Pick contacts directly from your device"})]})]}),r.jsxs("div",{className:"relative",children:[E&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),E&&r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),r.jsxs(ee,{variant:E?"outline":"default",onClick:()=>{var ie;return(ie=l.current)==null?void 0:ie.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(uo,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Upload Contact File"}),r.jsx("div",{className:"text-xs opacity-80",children:E?"Import a .vcf file exported from your Contacts app":"Export contacts from your phone as a .vcf file, then upload here"})]})]}),r.jsx("input",{ref:l,type:"file",accept:".vcf,.vcard",onChange:z,className:"hidden"}),!E&&r.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{className:"font-medium",children:"How to export contacts:"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),r.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"Android:"}),r.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),i==="preview"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{children:[p.length," contact",p.length!==1?"s":""," found",G>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",G," already exist)"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:V,children:y.size===p.length?"Deselect All":"Select All"})]}),r.jsx(tl,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:p.map((ie,oe)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ie.isDuplicate?"opacity-60":""}`,onClick:()=>q(oe),children:[r.jsx(Dl,{checked:y.has(oe),onCheckedChange:()=>q(oe),className:"mt-0.5"}),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:[ie.first_name," ",ie.last_name]}),ie.isDuplicate&&r.jsxs(Ot,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",ie.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ie.phone&&r.jsx("div",{children:ie.phone}),ie.email&&r.jsx("div",{className:"truncate",children:ie.email})]})]})]},oe))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>h("choose"),children:"Back"}),r.jsxs(ee,{onClick:F,disabled:te===0,children:["Import ",te," Contact",te!==1?"s":""]})]})]}),i==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(en,{className:"h-8 w-8 animate-spin text-primary"}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"font-medium",children:"Importing contacts..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[N,"% complete"]})]}),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:`${N}%`}})})]}),i==="done"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-emerald-500/10 flex items-center justify-center",children:r.jsx(Ai,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[j," contact",j!==1?"s":""," imported!"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your contacts are now in Agent OS and ready for touchpoint plans."})]}),r.jsx(ee,{onClick:()=>K(!1),className:"mt-2",children:"Done"})]})]})})}function Bjt({selectedIds:t,contacts:e,onClearSelection:n}){const{data:s}=Mm(),a=xxe(),o=Vr(),[l,i]=I.useState(!1),h=t.size;if(h===0)return null;const p=async _=>{i(!0);try{const C=Array.from(t).map(A=>({contact_id:A,relationship_type_id:_})),{error:N}=await J.from("innercircle_contact_tags").upsert(C,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(N)throw N;o.invalidateQueries({queryKey:["innercircle-contacts"]}),o.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:`Assigned type to ${h} contacts`}),n()}catch(j){ma({title:"Error assigning type",description:j.message,variant:"destructive"})}finally{i(!1)}},x=()=>{const _=e.filter(P=>t.has(P.id)),j=["First Name","Last Name","Email","Phone","Address","Birthday","Home Anniversary","Notes","Relationship Types"],C=_.map(P=>{var z;return[P.first_name,P.last_name||"",P.email||"",P.phone||"",P.address||"",P.birthday||"",P.home_anniversary||"",P.notes||"",((z=P.tags)==null?void 0:z.map(F=>{var q;return(q=F.relationship_type)==null?void 0:q.name}).join("; "))||""]}),N=[j.join(","),...C.map(P=>P.map(z=>`"${(z||"").replace(/"/g,'""')}"`).join(","))].join(` `),A=new Blob([N],{type:"text/csv"}),E=URL.createObjectURL(A),T=document.createElement("a");T.href=E,T.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,T.click(),URL.revokeObjectURL(E),ma({title:`Exported ${h} contacts`})},y=async()=>{if(confirm(`Are you sure you want to delete ${h} contacts? This cannot be undone.`)){i(!0);try{const _=Array.from(t);for(const j of _)await a.mutateAsync(j);n()}catch(_){ma({title:"Error deleting contacts",description:_.message,variant:"destructive"})}finally{i(!1)}}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[r.jsxs(Ot,{variant:"secondary",className:"font-semibold",children:[h," selected"]}),r.jsxs(gn,{onValueChange:p,disabled:l,children:[r.jsx(fn,{className:"w-[180px] h-8",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ng,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"text-sm",children:"Assign Type"})]})}),r.jsx(pn,{children:s==null?void 0:s.filter(_=>_.active).map(_=>r.jsx(qt,{value:_.id,children:_.name},_.id))})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:x,disabled:l,children:[r.jsx(no,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:y,disabled:l,className:"text-destructive hover:text-destructive",children:[r.jsx(Vn,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:n,className:"ml-auto",children:[r.jsx(_s,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]})}function u4e({contact:t,onEdit:e,onDelete:n,onSnooze:s}){const a=Zn(),o=`${t.first_name} ${t.last_name||""}`.trim();return r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:l=>l.stopPropagation(),children:r.jsx(nm,{className:"h-4 w-4"})})}),r.jsxs(Gu,{align:"end",onClick:l=>l.stopPropagation(),children:[r.jsxs(di,{onClick:()=>a(`/mission-control/contacts/${t.id}?tab=activity&action=log`),children:[r.jsx(bi,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(di,{onClick:()=>a(`/mission-control/video?contactId=${t.id}`),children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(di,{onClick:()=>a(`/mission-control/popbys?contactId=${t.id}`),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(di,{onClick:()=>s(t.id,o),children:[r.jsx(Jf,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(di,{onClick:()=>e(t),children:[r.jsx(fi,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(di,{onClick:()=>n(t.id),className:"text-destructive focus:text-destructive",children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function $jt(){const{user:t}=Xr();return Yt({queryKey:["contact-smart-lists",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function Ujt(){const t=Vr(),{user:e}=Xr();return cr({mutationFn:async({name:n,filters:s,sort_by:a})=>{const{data:o,error:l}=await J.from("contact_smart_lists").insert({owner_user_id:e.id,name:n,filters:s,sort_by:a}).select().single();if(l)throw l;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),ma({title:"Smart list saved"})},onError:n=>{ma({title:"Error saving smart list",description:n.message,variant:"destructive"})}})}function qjt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("contact_smart_lists").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),ma({title:"Smart list deleted"})}})}function Vjt({currentFilters:t,currentSortBy:e,onApplySmartList:n}){const{data:s}=$jt(),a=Ujt(),o=qjt(),[l,i]=I.useState(!1),[h,p]=I.useState(""),x=t.search||t.type&&t.type!=="all"||t.status&&t.status!=="all",y=async()=>{h.trim()&&(await a.mutateAsync({name:h.trim(),filters:t,sort_by:e}),p(""),i(!1))};return r.jsxs(r.Fragment,{children:[r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(v1,{className:"h-3.5 w-3.5"}),"Smart Lists",s&&s.length>0&&r.jsx(Ot,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:s.length}),r.jsx(Fd,{className:"h-3.5 w-3.5"})]})}),r.jsxs(Gu,{align:"start",className:"w-56",children:[s&&s.length>0?r.jsxs(r.Fragment,{children:[s.map(_=>r.jsxs(di,{className:"flex items-center justify-between group",children:[r.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>n(_.filters,_.sort_by),children:_.name}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:j=>{j.stopPropagation(),o.mutate(_.id)},children:r.jsx(Vn,{className:"h-3 w-3 text-destructive"})})]},_.id)),r.jsx(Bj,{})]}):r.jsx(di,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved lists yet"}),x&&r.jsxs(di,{onClick:()=>i(!0),children:[r.jsx(MT,{className:"h-4 w-4 mr-2"}),"Save Current Filters"]})]})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{className:"max-w-sm",children:[r.jsx(qr,{children:r.jsx($r,{children:"Save Smart List"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(dt,{placeholder:"e.g. Buyers in 40205",value:h,onChange:_=>p(_.target.value),onKeyDown:_=>_.key==="Enter"&&y(),autoFocus:!0}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:y,disabled:!h.trim()||a.isPending,children:"Save"})]})]})]})})]})}function pT(t){if(!t)return null;try{const e=new Date(t);if(isNaN(e.getTime()))return null;const n=new Date;n.setHours(0,0,0,0);let s=mte(e,n.getFullYear());return s.setHours(0,0,0,0),sn)return null;const a=e==="birthday"?"🎂":"🏡",o=s===0?e==="birthday"?"Birthday today!":"Anniversary today!":s===1?e==="birthday"?"Birthday tomorrow":"Anniversary tomorrow":`${a} in ${s}d`;return{emoji:a,label:o,daysUntil:s}}function f4e({birthday:t,homeAnniversary:e,className:n}){const s=h4e(t,"birthday",7),a=h4e(e,"anniversary",7);return!s&&!a?null:r.jsxs("div",{className:zt("flex flex-wrap gap-1",n),children:[s&&r.jsx(Ot,{variant:"secondary",className:zt("text-[10px] gap-0.5 font-medium",s.daysUntil===0?"bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400 animate-pulse":"bg-pink-50 text-pink-600 dark:bg-pink-900/20 dark:text-pink-400"),children:s.label}),a&&r.jsx(Ot,{variant:"secondary",className:zt("text-[10px] gap-0.5 font-medium",a.daysUntil===0?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 animate-pulse":"bg-blue-50 text-blue-600 dark:bg-blue-900/20 dark:text-blue-400"),children:a.label})]})}function p4e({deal:t}){if(!t||!t.stage)return null;const{stage:e}=t;return r.jsxs(Ot,{variant:"outline",className:"text-[10px] gap-1 font-medium whitespace-nowrap",style:{borderColor:e.color,color:e.color,backgroundColor:`${e.color}10`},children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:e.color}}),e.name]})}function Hjt(){const t=Lc();return Yt({queryKey:["contact-deals-map",t],queryFn:async()=>{const{data:e,error:n}=await J.from("deal_pipeline").select(` id, deal_name, contact_id, stage:deal_pipeline_stages(id, name, color, icon, is_won_stage, is_lost_stage) `).not("contact_id","is",null);if(n)throw n;const s={};return(e||[]).forEach(a=>{a.contact_id&&!s[a.contact_id]&&(s[a.contact_id]=a)}),s},enabled:!!t})}function Wjt(){const t=Zn(),[e]=qd(),{user:n}=Xr(),s=m3(),a=Vr(),o=e.get("type"),l=e.get("filter")??e.get("status"),i=e.get("new")==="true",{contactsWithScores:h,isLoading:p}=_xe(),{data:x}=Mm(),{data:y}=Hjt(),_=gxe(),j=d8e(),C=xxe(),[N,A]=I.useState(""),[E,T]=I.useState(o||"all"),[P,z]=I.useState(l||"all"),[F,q]=I.useState("name"),[V,K]=I.useState(i),[G,te]=I.useState(null),[ie,oe]=I.useState(!1),[ye,ae]=I.useState(!1),[pe,se]=I.useState(null),[he,ue]=I.useState(""),[_e,Ae]=I.useState(new Set),[Ce,Se]=I.useState(!1),[ge,Le]=I.useState(1),[ke,Be]=I.useState(50),Ee=I.useCallback(Oe=>{Se(!1),Ae(Qe=>{const nt=new Set(Qe);return nt.has(Oe)?nt.delete(Oe):nt.add(Oe),nt})},[]);I.useEffect(()=>{if(!(n!=null&&n.id))return;const Oe=J.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{a.invalidateQueries({queryKey:["innercircle-contacts"]}),a.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{J.removeChannel(Oe)}},[a,n==null?void 0:n.id]),I.useEffect(()=>{l&&z(l)},[l]);const[Ue,Fe]=I.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]});I.useEffect(()=>{i&&K(!0)},[i]),I.useEffect(()=>{var Oe;G&&Fe({first_name:G.first_name||"",last_name:G.last_name||"",email:G.email||"",phone:G.phone||"",address:G.address||"",city:G.city||"",state:G.state||"",zip_code:G.zip_code||"",birthday:G.birthday||"",home_anniversary:G.home_anniversary||"",spouse_name:G.spouse_name||"",spouse_email:G.spouse_email||"",notes:G.notes||"",tagIds:((Oe=G.tags)==null?void 0:Oe.map(Qe=>Qe.relationship_type_id))||[]})},[G]);const be=I.useMemo(()=>{if(!h)return[];let Oe=h.filter(Qe=>{var mt,Mt,wt;const nt=N===""||`${Qe.first_name} ${Qe.last_name}`.toLowerCase().includes(N.toLowerCase())||((mt=Qe.email)==null?void 0:mt.toLowerCase().includes(N.toLowerCase()))||((Mt=Qe.phone)==null?void 0:Mt.includes(N)),gt=E==="all"||((wt=Qe.tags)==null?void 0:wt.some(Qt=>Qt.relationship_type_id===E));return nt&>});return P==="not-touched-90"?Oe=Oe.filter(Qe=>{const nt=Qe.relationshipScore.daysSinceTouch;return nt===null||nt>90}):P==="at-risk"?Oe=Oe.filter(Qe=>Qe.relationshipScore.status==="at-risk"):P==="cooling"?Oe=Oe.filter(Qe=>Qe.relationshipScore.status==="cooling"):P==="warm"&&(Oe=Oe.filter(Qe=>Qe.relationshipScore.status==="warm")),Oe=[...Oe].sort((Qe,nt)=>{switch(F){case"important-dates":{const gt=pT(Qe.birthday),mt=pT(nt.birthday),Mt=pT(Qe.home_anniversary),wt=pT(nt.home_anniversary),Qt=[gt,Mt].filter(cn=>cn!==null).sort((cn,jn)=>(cn??1/0)-(jn??1/0))[0]??1/0,Cr=[mt,wt].filter(cn=>cn!==null).sort((cn,jn)=>(cn??1/0)-(jn??1/0))[0]??1/0;return Qt-Cr}case"last-touched":{const gt=Qe.relationshipScore.lastTouchDate,mt=nt.relationshipScore.lastTouchDate;return!gt&&!mt?0:gt?mt?new Date(gt).getTime()-new Date(mt).getTime():1:-1}case"next-touch":{const gt=Qe.relationshipScore.daysSinceTouch,mt=nt.relationshipScore.daysSinceTouch;return gt===null&&mt===null?0:gt===null?-1:mt===null?1:mt-gt}case"score":return Qe.relationshipScore.score-nt.relationshipScore.score;case"date-added":{const gt=Qe.created_at,mt=nt.created_at;return!gt&&!mt?0:gt?mt?new Date(mt).getTime()-new Date(gt).getTime():-1:1}case"name":default:{const gt=`${Qe.first_name||""} ${Qe.last_name||""}`.toLowerCase(),mt=`${nt.first_name||""} ${nt.last_name||""}`.toLowerCase();return gt.localeCompare(mt)}}}),Oe},[h,N,E,P,F]),tt=be.length,Te=Math.max(1,Math.ceil(tt/ke)),Ke=Math.min(ge,Te),me=I.useMemo(()=>{const Oe=(Ke-1)*ke;return be.slice(Oe,Oe+ke)},[be,Ke,ke]);I.useEffect(()=>{Le(1)},[N,E,P,F]);const yt=I.useCallback(()=>{Se(!1),Ae(Oe=>Oe.size>0?new Set:new Set(me.map(Qe=>Qe.id)))},[me]),rt=I.useCallback(()=>{Se(!0),Ae(new Set(be.map(Oe=>Oe.id)))},[be]),at=I.useCallback((Oe,Qe)=>{A(Oe.search||""),T(Oe.type||"all"),z(Oe.status||"all"),q(Qe||"name")},[]),Me=()=>{Fe({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},ft=async Oe=>{Oe.preventDefault(),G?(await j.mutateAsync({id:G.id,...Ue}),te(null)):(await _.mutateAsync(Ue),K(!1)),Me()},qe=async Oe=>{confirm("Are you sure you want to delete this contact?")&&await C.mutateAsync(Oe)};return r.jsx(Lr,{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(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(Ac,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or phone...",value:N,onChange:Oe=>A(Oe.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:E,onValueChange:T,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(yn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),x==null?void 0:x.filter(Oe=>Oe.active).map(Oe=>r.jsx(qt,{value:Oe.id,children:Oe.name},Oe.id))]})]}),r.jsxs(gn,{value:P,onValueChange:z,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"warm",children:"🟢 Warm"}),r.jsx(qt,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(qt,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(gn,{value:F,onValueChange:q,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(yn,{placeholder:"Sort by"})]})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"name",children:"Name (A-Z)"}),r.jsx(qt,{value:"important-dates",children:"Important Dates"}),r.jsx(qt,{value:"last-touched",children:"Last Touched"}),r.jsx(qt,{value:"next-touch",children:"Next Touch Due"}),r.jsx(qt,{value:"score",children:"Relationship Score"}),r.jsx(qt,{value:"date-added",children:"Date Added"})]})]}),r.jsx(Vjt,{currentFilters:{search:N,type:E,status:P},currentSortBy:F,onApplySmartList:at}),r.jsxs(ee,{onClick:()=>K(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(ee,{variant:"outline",onClick:()=>oe(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ae(!0),children:[r.jsx(jg,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),r.jsx(Bjt,{selectedIds:_e,contacts:be,onClearSelection:()=>{Ae(new Set),Se(!1)}}),_e.size>0&&_e.size===me.length&&!Ce&&tt>ke&&r.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/5 border border-primary/20 rounded-lg text-sm",children:[r.jsxs("span",{children:["All ",me.length," contacts on this page are selected."]}),r.jsxs(ee,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:rt,children:["Select all ",tt.toLocaleString()," matching contacts"]})]}),Ce&&r.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/10 border border-primary/30 rounded-lg text-sm font-medium",children:["All ",tt.toLocaleString()," matching contacts are selected.",r.jsx(ee,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>{Ae(new Set),Se(!1)},children:"Clear selection"})]}),s?r.jsx("div",{className:"space-y-3",children:p?r.jsx(Ye,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):be.length===0?r.jsx(Ye,{className:"p-6 text-center text-muted-foreground",children:N||E!=="all"||P!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):me.map(Oe=>{var nt;const{relationshipScore:Qe}=Oe;return r.jsx(Ye,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const gt=new URLSearchParams;N&>.set("search",N),E!=="all"&>.set("type",E),P!=="all"&>.set("filter",P);const mt=gt.toString();t(`/mission-control/contacts/${Oe.id}${mt?`?${mt}`:""}`)},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(Vi,{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(ua,{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(bi,{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(Lce,{score:Qe,size:"sm"}),r.jsx(afe,{contact:Oe}),(nt=Oe.tags)==null?void 0:nt.map(gt=>{var mt;return r.jsx(Ot,{variant:"secondary",className:"text-xs",children:(mt=gt.relationship_type)==null?void 0:mt.name},gt.id)}),r.jsx(p4e,{deal:y==null?void 0:y[Oe.id]})]}),r.jsx(f4e,{birthday:Oe.birthday,homeAnniversary:Oe.home_anniversary,className:"mb-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Qe.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),xn(new Date(Qe.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(Os,{className:"h-3 w-3"}),xn(new Date(Oe.birthday),"MMM d")]}),Oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(da,{className:"h-3 w-3"}),xn(new Date(Oe.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:gt=>gt.stopPropagation(),children:r.jsx(u4e,{contact:Oe,onEdit:te,onDelete:qe,onSnooze:(gt,mt)=>{se(gt),ue(mt)}})})]})})},Oe.id)})}):r.jsx(Ye,{children:r.jsx(Je,{className:"p-0 overflow-x-auto",children:r.jsxs(Us,{className:"min-w-[800px]",children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Dl,{checked:me.length>0&&me.every(Oe=>_e.has(Oe.id)),onCheckedChange:()=>yt()})}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Score"}),r.jsx(It,{children:"Contact Info"}),r.jsx(It,{children:"Types / Pipeline"}),r.jsx(It,{children:"Last Contact"}),r.jsx(It,{children:"Important Dates"}),r.jsx(It,{className:"w-[50px]",children:"Actions"})]})}),r.jsx(Vs,{children:p?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):be.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:N||E!=="all"||P!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):me.map(Oe=>{var gt;const{relationshipScore:Qe}=Oe,nt=y==null?void 0:y[Oe.id];return r.jsxs(Ar,{className:`cursor-pointer hover:bg-accent/50 ${_e.has(Oe.id)?"bg-accent/30":""}`,onClick:()=>{const mt=new URLSearchParams;N&&mt.set("search",N),E!=="all"&&mt.set("type",E),P!=="all"&&mt.set("status",P);const Mt=mt.toString();t(`/mission-control/contacts/${Oe.id}${Mt?`?${Mt}`:""}`)},children:[r.jsx(Nt,{onClick:mt=>mt.stopPropagation(),children:r.jsx(Dl,{checked:_e.has(Oe.id),onCheckedChange:()=>Ee(Oe.id)})}),r.jsxs(Nt,{className:"font-medium",children:[Oe.first_name," ",Oe.last_name]}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Lce,{score:Qe,size:"sm"}),r.jsx(afe,{contact:Oe})]})}),r.jsx(Nt,{children:r.jsx(Lce,{score:Qe,size:"sm",showScore:!0})}),r.jsx(Nt,{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(ua,{className:"h-3 w-3"}),Oe.email]}),Oe.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(bi,{className:"h-3 w-3"}),Oe.phone]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(gt=Oe.tags)==null?void 0:gt.map(mt=>{var Mt;return r.jsx(Ot,{variant:"secondary",className:"text-xs",children:(Mt=mt.relationship_type)==null?void 0:Mt.name},mt.id)}),r.jsx(p4e,{deal:nt})]})}),r.jsx(Nt,{children:r.jsx("div",{className:"text-sm",children:Qe.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ya,{className:"h-3 w-3"}),xn(new Date(Qe.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(Nt,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsx(f4e,{birthday:Oe.birthday,homeAnniversary:Oe.home_anniversary}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Os,{className:"h-3 w-3"}),xn(new Date(Oe.birthday),"MMM d")]}),Oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(da,{className:"h-3 w-3"}),xn(new Date(Oe.home_anniversary),"MMM d")]})]})]})}),r.jsx(Nt,{children:r.jsx(u4e,{contact:Oe,onEdit:te,onDelete:qe,onSnooze:(mt,Mt)=>{se(mt),ue(Mt)}})})]},Oe.id)})})]})})}),tt>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsxs("span",{children:["Showing ",(Ke-1)*ke+1,"–",Math.min(Ke*ke,tt)," of ",tt.toLocaleString()," contacts"]}),r.jsxs(gn,{value:String(ke),onValueChange:Oe=>{Be(Number(Oe)),Le(1)},children:[r.jsx(fn,{className:"w-[80px] h-8",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"50",children:"50"}),r.jsx(qt,{value:"100",children:"100"}),r.jsx(qt,{value:"250",children:"250"})]})]}),r.jsx("span",{className:"text-xs",children:"per page"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",disabled:Ke<=1,onClick:()=>Le(1),children:"First"}),r.jsx(ee,{variant:"outline",size:"sm",disabled:Ke<=1,onClick:()=>Le(Oe=>Oe-1),children:r.jsx(Ac,{className:"h-4 w-4"})}),r.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",Ke," of ",Te]}),r.jsx(ee,{variant:"outline",size:"sm",disabled:Ke>=Te,onClick:()=>Le(Oe=>Oe+1),children:r.jsx(Vi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",disabled:Ke>=Te,onClick:()=>Le(Te),children:"Last"})]})]}),r.jsx(Fr,{open:V||!!G,onOpenChange:Oe=>{Oe||(K(!1),te(null),Me())},children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:G?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:ft,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"first_name",children:"First Name *"}),r.jsx(dt,{id:"first_name",value:Ue.first_name,onChange:Oe=>Fe({...Ue,first_name:Oe.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"last_name",children:"Last Name"}),r.jsx(dt,{id:"last_name",value:Ue.last_name,onChange:Oe=>Fe({...Ue,last_name:Oe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:Ue.email,onChange:Oe=>Fe({...Ue,email:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",value:Ue.phone,onChange:Oe=>Fe({...Ue,phone:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"address",children:"Address"}),r.jsx(dt,{id:"address",value:Ue.address,onChange:Oe=>Fe({...Ue,address:Oe.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:Ue.city,onChange:Oe=>Fe({...Ue,city:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:Ue.state,onChange:Oe=>Fe({...Ue,state:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"zip_code",children:"Zip"}),r.jsx(dt,{id:"zip_code",value:Ue.zip_code,onChange:Oe=>Fe({...Ue,zip_code:Oe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"birthday",children:"Birthday"}),r.jsx(dt,{id:"birthday",type:"date",value:Ue.birthday,onChange:Oe=>Fe({...Ue,birthday:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(dt,{id:"home_anniversary",type:"date",value:Ue.home_anniversary,onChange:Oe=>Fe({...Ue,home_anniversary:Oe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(dt,{id:"spouse_name",value:Ue.spouse_name,onChange:Oe=>Fe({...Ue,spouse_name:Oe.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(dt,{id:"spouse_email",type:"email",value:Ue.spouse_email,onChange:Oe=>Fe({...Ue,spouse_email:Oe.target.value}),placeholder:"Spouse/partner email"})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(Oe=>Oe.active).map(Oe=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Dl,{checked:Ue.tagIds.includes(Oe.id),onCheckedChange:Qe=>{Fe(Qe?{...Ue,tagIds:[...Ue.tagIds,Oe.id]}:{...Ue,tagIds:Ue.tagIds.filter(nt=>nt!==Oe.id)})}}),r.jsx("span",{className:"text-sm",children:Oe.name})]},Oe.id))})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:Ue.notes,onChange:Oe=>Fe({...Ue,notes:Oe.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{K(!1),te(null),Me()},children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:_.isPending||j.isPending,children:[G?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(Djt,{open:ie,onOpenChange:oe,relationshipTypes:(x==null?void 0:x.filter(Oe=>Oe.active))||[],onSuccess:()=>{oe(!1)}}),r.jsx(zjt,{open:ye,onOpenChange:ae,onComplete:()=>ae(!1)}),r.jsx(vye,{open:!!pe,onOpenChange:Oe=>{Oe||se(null)},contactId:pe||"",contactName:he})]})})}function Gjt(){return Yt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:t,error:e}=await J.from("video_script_categories").select("*").order("sort_order");if(e)throw e;return t}})}function Kjt(t){return Yt({queryKey:["video-scripts",t],queryFn:async()=>{let e=J.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 Zjt(){const{user:t}=Xr();return Yt({queryKey:["user-video-scripts",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await J.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 Yjt(){const{user:t}=Xr(),e=Vr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:a}=await J.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(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["user-video-scripts"]})}})}function Xjt(t){const{user:e}=Xr();return Yt({queryKey:["agent-videos",e==null?void 0:e.id,t],queryFn:async()=>{if(!(e!=null&&e.id))return[];let n=J.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:a}=await n;if(a)throw a;return s},enabled:!!(e!=null&&e.id)})}function Qjt(t){return Yt({queryKey:["agent-video",t],queryFn:async()=>{const{data:e,error:n}=await J.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 Aze(){const{user:t}=Xr(),e=Vr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:a}=await J.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(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function Jjt(){const t=Vr();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:a,error:o}=await J.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:",a)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",e);const{error:a}=await J.from("agent_videos").delete().eq("id",e);if(a)throw a}else{console.log("Soft deleting from database:",e);const{error:a}=await J.from("agent_videos").update({is_deleted:!0}).eq("id",e);if(a)throw a}console.log("Video deletion complete")},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function bye(){const{user:t}=Xr();return Yt({queryKey:["storage-usage",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await J.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 ekt(){const{data:t,isLoading:e}=bye(),n=t?t.total_storage_mb0?t.total_storage_mb/t.max_storage_mb*100:0,o=a>=80;return{canRecord:n,remainingMb:s,usagePercent:a,isNearLimit:o,storage:t,isLoading:e}}async function tkt(t){const{data:e,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:t,isAgentVideo:!0}});if(n)throw n;return e}async function rkt(t){const{data:e,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}async function nkt(t){const{data:e,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"status",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}function skt(){const{user:t}=Xr(),e=Vr();return cr({mutationFn:async({contactId:n,videoId:s,notes:a})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:o}=await J.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:l,error:i}=await J.from("contact_touch_logs").insert([{owner_user_id:t.id,contact_id:n,action_type_id:o.id,notes:a||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(i)throw i;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts"]})}})}function akt(t){return Yt({queryKey:["contact-video-replies",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.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 ikt({videoId:t}){var l;const{data:e,isLoading:n,error:s}=Qjt(t);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ir,{className:"w-full aspect-video rounded-lg"}),r.jsx(Ir,{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(Hh,{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 a=i=>{let h=i;return h.includes("iframe.mediadelivery.net/play/")&&(h=h.replace("/play/","/embed/"),h+=(h.includes("?")?"&":"?")+"autoplay=true&responsive=true"),h},o=(l=e.playback_url)==null?void 0:l.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:a(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 okt(){var ke,Be;const{contactId:t}=Yc(),e=Zn(),[n]=qd(),s=n.get("search")||"",a=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:i}=kft(t||""),{data:h}=Mm(),{data:p}=yxe(),{data:x}=yse(365),{data:y}=Vse(365),{data:_}=akt(t),{contactsWithScores:j}=_xe(),C=d8e(),N=xxe(),A=h8e(),[E,T]=I.useState(!1),[P,z]=I.useState({}),[F,q]=I.useState(!1),[V,K]=I.useState(null),[G,te]=I.useState(""),[ie,oe]=I.useState(null),ye=Ee=>{if(!Ee)return null;const Ue=Ee.match(/Video ID:\s*([a-f0-9-]+)/i);return Ue?Ue[1]:null},ae=I.useMemo(()=>{if(!j)return[];let Ee=j.filter(Ue=>{var tt,Te,Ke;const Fe=s===""||`${Ue.first_name} ${Ue.last_name}`.toLowerCase().includes(s.toLowerCase())||((tt=Ue.email)==null?void 0:tt.toLowerCase().includes(s.toLowerCase()))||((Te=Ue.phone)==null?void 0:Te.includes(s)),be=a==="all"||((Ke=Ue.tags)==null?void 0:Ke.some(me=>me.relationship_type_id===a));return Fe&&be});return o==="not-touched-90"?Ee=Ee.filter(Ue=>{const Fe=Ue.relationshipScore.daysSinceTouch;return Fe===null||Fe>90}):o==="at-risk"?Ee=Ee.filter(Ue=>Ue.relationshipScore.status==="at-risk"):o==="cooling"?Ee=Ee.filter(Ue=>Ue.relationshipScore.status==="cooling"):o==="warm"&&(Ee=Ee.filter(Ue=>Ue.relationshipScore.status==="warm")),Ee.map(Ue=>Ue.id)},[j,s,a,o]),pe=ae.indexOf(t||""),se=pe>0?ae[pe-1]:null,he=pe1&&pe!==-1,_e=Ee=>{const Ue=new URLSearchParams;s&&Ue.set("search",s),a!=="all"&&Ue.set("type",a),o!=="all"&&Ue.set("status",o);const Fe=Ue.toString();return`/mission-control/contacts/${Ee}${Fe?`?${Fe}`:""}`},Ae=I.useMemo(()=>{const Ee=((x==null?void 0:x.filter(Fe=>Fe.contact_id===t))||[]).map(Fe=>{var tt,Te;const be=ye(Fe.notes);return{id:Fe.id,type:"touch",completed_at:Fe.completed_at,name:((tt=Fe.action_type)==null?void 0:tt.name)||"Touch",color:((Te=Fe.action_type)==null?void 0:Te.color)||"#3B82F6",notes:Fe.notes,videoId:be}}),Ue=((y==null?void 0:y.filter(Fe=>Fe.contact_id===t))||[]).map(Fe=>({id:Fe.id,type:"popby",completed_at:Fe.completed_at,name:"Pop-by",color:"#F97316",notes:Fe.notes,videoId:null}));return[...Ee,...Ue].sort((Fe,be)=>new Date(be.completed_at).getTime()-new Date(Fe.completed_at).getTime())},[x,y,t]),Ce=()=>{var Ee;l&&(z({first_name:l.first_name||"",last_name:l.last_name||"",email:l.email||"",phone:l.phone||"",address:l.address||"",city:l.city||"",state:l.state||"",zip_code:l.zip_code||"",birthday:l.birthday||"",home_anniversary:l.home_anniversary||"",spouse_name:l.spouse_name||"",spouse_email:l.spouse_email||"",company_name:l.company_name||"",job_title:l.job_title||"",notes:l.notes||"",tagIds:((Ee=l.tags)==null?void 0:Ee.map(Ue=>Ue.relationship_type_id))||[]}),T(!0))},Se=async()=>{await C.mutateAsync({id:t,...P}),T(!1)},ge=async()=>{confirm("Are you sure you want to delete this contact?")&&(await N.mutateAsync(t),e("/mission-control/contacts"))},Le=async()=>{V&&(await A.mutateAsync({contactId:t,actionTypeId:V,notes:G}),q(!1),K(null),te(""))};return i?r.jsx(Lr,{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"})})}):l?r.jsx(Lr,{title:`${l.first_name} ${l.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(ee,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/contacts"),children:[r.jsx(Ac,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),ue&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>se&&e(_e(se)),disabled:!se,className:"px-2",children:[r.jsx(Ac,{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:[pe+1," of ",ae.length]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>he&&e(_e(he)),disabled:!he,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Vi,{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(ee,{variant:"default",onClick:()=>e(`/mission-control/video/record?contact_id=${t}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Fr,{open:F,onOpenChange:q,children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:p==null?void 0:p.filter(Ee=>Ee.active).map(Ee=>r.jsxs("button",{onClick:()=>K(Ee.id),className:` p-3 rounded-lg border text-left transition-all ${V===Ee.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Ee.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ee.description})]},Ee.id))})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(ps,{id:"action-notes",value:G,onChange:Ee=>te(Ee.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(ee,{onClick:Le,disabled:!V||A.isPending,className:"w-full",children:[r.jsx(Ai,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(ee,{variant:"outline",onClick:Ce,children:[r.jsx(ic,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:ge,children:r.jsx(Vn,{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:[l.first_name," ",l.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[l.email&&r.jsxs("a",{href:`mailto:${l.email}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(ua,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.email})]}),l.phone&&r.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(bi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.phone})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(afe,{contact:l}),(ke=l.tags)==null?void 0:ke.map(Ee=>{const Ue=h==null?void 0:h.find(Fe=>Fe.id===Ee.relationship_type_id);return Ue?r.jsx(Ot,{variant:"secondary",className:"text-xs",children:Ue.name},Ee.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(Gt,{children:r.jsx(Zt,{children:"Contact Information"})}),r.jsx(Je,{children:E?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(He,{htmlFor:"first_name",children:"First Name"}),r.jsx(dt,{id:"first_name",value:P.first_name,onChange:Ee=>z({...P,first_name:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"last_name",children:"Last Name"}),r.jsx(dt,{id:"last_name",value:P.last_name,onChange:Ee=>z({...P,last_name:Ee.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:P.email,onChange:Ee=>z({...P,email:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",value:P.phone,onChange:Ee=>z({...P,phone:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"address",children:"Street Address"}),r.jsx(dt,{id:"address",value:P.address,onChange:Ee=>z({...P,address:Ee.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(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:P.city,onChange:Ee=>z({...P,city:Ee.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:P.state,onChange:Ee=>z({...P,state:Ee.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(dt,{id:"zip_code",value:P.zip_code,onChange:Ee=>z({...P,zip_code:Ee.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(He,{htmlFor:"birthday",children:"Birthday"}),r.jsx(dt,{id:"birthday",type:"date",value:P.birthday,onChange:Ee=>z({...P,birthday:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(dt,{id:"home_anniversary",type:"date",value:P.home_anniversary,onChange:Ee=>z({...P,home_anniversary:Ee.target.value})})]})]}),r.jsx(cu,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(dt,{id:"spouse_name",value:P.spouse_name,onChange:Ee=>z({...P,spouse_name:Ee.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(dt,{id:"spouse_email",type:"email",value:P.spouse_email,onChange:Ee=>z({...P,spouse_email:Ee.target.value}),placeholder:"Enter spouse email"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"company_name",children:"Company"}),r.jsx(dt,{id:"company_name",value:P.company_name,onChange:Ee=>z({...P,company_name:Ee.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"job_title",children:"Job Title"}),r.jsx(dt,{id:"job_title",value:P.job_title,onChange:Ee=>z({...P,job_title:Ee.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:h==null?void 0:h.filter(Ee=>Ee.active).map(Ee=>{var Ue;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Dl,{checked:(Ue=P.tagIds)==null?void 0:Ue.includes(Ee.id),onCheckedChange:Fe=>{var be;z(Fe?{...P,tagIds:[...P.tagIds||[],Ee.id]}:{...P,tagIds:(be=P.tagIds)==null?void 0:be.filter(tt=>tt!==Ee.id)})}}),r.jsx("span",{className:"text-sm",children:Ee.name})]},Ee.id)})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:P.notes,onChange:Ee=>z({...P,notes:Ee.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{onClick:Se,disabled:C.isPending,children:"Save Changes"}),r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ae.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(Os,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",xn(new Date(Ae[0].completed_at),"MMM d, yyyy")," ","(",Ae[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[l.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(ua,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`mailto:${l.email}`,className:"text-primary hover:underline truncate",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bi,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`tel:${l.phone}`,className:"text-primary hover:underline",children:l.phone})]})]}),(l.address||l.city||l.state||l.zip_code)&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex flex-col",children:[l.address&&r.jsx("span",{children:l.address}),(l.city||l.state||l.zip_code)&&r.jsxs("span",{className:"text-muted-foreground",children:[[l.city,l.state].filter(Boolean).join(", "),l.zip_code&&` ${l.zip_code}`]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.birthday&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",xn(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",xn(new Date(l.home_anniversary),"MMMM d")]})]})]}),(l.spouse_name||l.spouse_email||l.company_name||l.job_title)&&r.jsxs(r.Fragment,{children:[r.jsx(cu,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(l.spouse_name||l.spouse_email)&&r.jsxs("div",{className:"space-y-1",children:[l.spouse_name&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Spouse: ",l.spouse_name]})]}),l.spouse_email&&r.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[r.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:`mailto:${l.spouse_email}`,className:"text-primary hover:underline",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:l.job_title&&l.company_name?`${l.job_title} at ${l.company_name}`:l.job_title||l.company_name})]})]})]}),r.jsx(cu,{}),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:(Be=l.tags)!=null&&Be.length?l.tags.map(Ee=>{var Ue;return r.jsx(Ot,{variant:"secondary",children:(Ue=Ee.relationship_type)==null?void 0:Ue.name},Ee.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(cu,{}),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:l.notes})]})]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ijt,{contact:l,onLogTouch:()=>q(!0)}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Activity Log"})}),r.jsx(Je,{children:Ae.length>0?r.jsx("div",{className:"space-y-4",children:Ae.map(Ee=>{var Ue;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:Ee.color},children:Ee.type==="popby"?r.jsx(Ki,{className:"h-4 w-4"}):(Ue=Ee.name)==null?void 0:Ue.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:Ee.name}),Ee.videoId&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>oe(Ee.videoId),children:[r.jsx(fc,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:xn(new Date(Ee.completed_at),"MMM d, yyyy h:mm a")}),Ee.notes&&!Ee.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ee.notes})]})]},Ee.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),_&&_.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:_.map(Ee=>{var Ue,Fe;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Ue=Ee.video)!=null&&Ue.thumbnail_url?r.jsx("img",{src:Ee.video.thumbnail_url,alt:Ee.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>oe(Ee.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:()=>oe(Ee.video_id),children:r.jsx(Pa,{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: ",((Fe=Ee.video)==null?void 0:Fe.title)||"Untitled Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>oe(Ee.video_id),children:[r.jsx(fc,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:xn(new Date(Ee.created_at),"MMM d, yyyy h:mm a")}),Ee.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Ee.message,'"']})]})]},Ee.id)})})})]})]}),r.jsx(Fr,{open:!!ie,onOpenChange:Ee=>!Ee&&oe(null),children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsx($r,{children:"Video Preview"})}),ie&&r.jsx(ikt,{videoId:ie})]})})]})]})}):r.jsx(Lr,{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(ee,{onClick:()=>e("/mission-control/contacts"),children:"Back to Contacts"})]})})}const m4e={Crown:m1,FileText:La,Users:Bn,Globe:Vx,Star:vs,Phone:bi,MessageSquare:Oo,PenTool:bj,Video:Pa,Gift:Ki},Oce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function lkt(){var gt,mt;const t=Zn(),{user:e}=Xr(),{data:n}=Mm(),{data:s}=Sft(),{data:a}=Pft(),{data:o}=c8e(),{data:l}=yxe(),{data:i}=Nft(),h=Lft(),p=Cft(),x=Tft(),y=Aft(),_=Eft(),j=Ift(),C=Mft(),[N,A]=I.useState(null),[E,T]=I.useState(!1),[P,z]=I.useState(null),[F,q]=I.useState(""),[V,K]=I.useState(""),[G,te]=I.useState([]),[ie,oe]=I.useState(null),[ye,ae]=I.useState(null),[pe,se]=I.useState(!1),[he,ue]=I.useState(""),[_e,Ae]=I.useState(""),[Ce,Se]=I.useState(""),[ge,Le]=I.useState(""),ke=(Mt,wt)=>a==null?void 0:a.some(Qt=>Qt.plan_id===Mt&&Qt.relationship_type_id===wt&&Qt.active),Be=Mt=>a==null?void 0:a.find(wt=>wt.relationship_type_id===Mt&&wt.active),Ee=async(Mt,wt)=>{const Qt=ke(Mt,wt);await h.mutateAsync({planId:Mt,relationshipTypeId:wt,active:!Qt})},Ue=(s==null?void 0:s.filter(Mt=>Mt.active&&!Mt.owner_user_id))||[],Fe=(s==null?void 0:s.filter(Mt=>Mt.owner_user_id===(e==null?void 0:e.id)))||[],be=n==null?void 0:n.find(Mt=>Mt.id===N),tt=N?Be(N):null,Te=s==null?void 0:s.find(Mt=>Mt.id===(tt==null?void 0:tt.plan_id)),Ke=async()=>{if(!F.trim())return;const Mt=await p.mutateAsync({name:F,description:V});Mt&&G.length>0&&await _.mutateAsync({planId:Mt.id,items:G}),rt()},me=async()=>{!F.trim()||!P||(await x.mutateAsync({id:P,name:F,description:V}),await _.mutateAsync({planId:P,items:G}),rt())},yt=Mt=>{var wt;z(Mt.id),q(Mt.name),K(Mt.description||""),te(((wt=Mt.items)==null?void 0:wt.map(Qt=>({month_number:Qt.month_number,action_type_id:Qt.action_type_id,default_script_id:Qt.default_script_id||void 0,notes:Qt.notes||void 0})))||[]),T(!0)},rt=()=>{T(!1),z(null),q(""),K(""),te([])},at=(Mt,wt)=>{ae(wt)},Me=(Mt,wt,Qt)=>{te(Cr=>[...Cr.filter(jn=>jn.month_number!==Mt),{month_number:Mt,action_type_id:wt,default_script_id:Qt}]),oe(null),ae(null)},ft=Mt=>{te(wt=>wt.filter(Qt=>Qt.month_number!==Mt))},qe=async()=>{if(!he.trim()||!_e.trim()||!ye)return;const Mt=await j.mutateAsync({actionTypeId:ye,title:he,scriptBody:_e,emailSubject:Ce||void 0,tone:ge||void 0});Mt&&ie!==null&&Me(ie,ye,Mt.id),se(!1),ue(""),Ae(""),Se(""),Le("")},Oe=ye?i==null?void 0:i.filter(Mt=>Mt.action_type_id===ye&&Mt.active):[],Qe=Mt=>m4e[Mt||"Phone"]||bi,nt=Mt=>m4e[Mt||"Users"]||Bn;return r.jsxs(Lr,{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(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(Ac,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(ee,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(bn,{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(Mt=>Mt.active).map(Mt=>{const wt=nt(Mt.icon),Qt=(o==null?void 0:o[Mt.id])||0,Cr=Be(Mt.id),cn=s==null?void 0:s.find(Qr=>Qr.id===(Cr==null?void 0:Cr.plan_id)),jn=N===Mt.id;return r.jsxs("button",{onClick:()=>A(Mt.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${jn?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(wt,{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:Mt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Qt," contacts"]})]}),cn?r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:[r.jsx(Yi,{className:"h-3 w-3 mr-1"}),cn.name.split(" ")[0]]}):r.jsx(Ot,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},Mt.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:N&&be?r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[(()=>{const Mt=nt(be.icon);return r.jsx(Mt,{className:"h-5 w-5"})})(),be.name," Touchpoint Plan"]}),r.jsxs(Tn,{children:["Choose a plan for your ",be.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(Yi,{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(ee,{variant:"outline",size:"sm",onClick:()=>Ee(Te.id,N),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(Os,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Oce.map((Mt,wt)=>{var jn,Qr;const Qt=((jn=Te.items)==null?void 0:jn.filter(Pn=>Pn.month_number===wt+1))||[],Cr=(Qr=Qt[0])==null?void 0:Qr.action_type,cn=Cr?Qe(Cr.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${Qt.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:Mt}),cn&&r.jsx(cn,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Cr==null?void 0:Cr.color)||"#3B82F6"}})]},wt)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Te?"Switch to a Different Plan":"Choose a Plan"}),Ue.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"}),Ue.map(Mt=>{var Qt;const wt=(Te==null?void 0:Te.id)===Mt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${wt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Mt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Qt=Mt.items)==null?void 0:Qt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:C.isPending,onClick:()=>{const Cr=`${Mt.name} (Copy)`;C.mutate({sourcePlanId:Mt.id,newName:Cr})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:wt?"outline":"default",disabled:wt||h.isPending,onClick:()=>Ee(Mt.id,N),children:wt?"Active":"Use This"})]})]},Mt.id)})]}),Fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Fe.map(Mt=>{var Qt;const wt=(Te==null?void 0:Te.id)===Mt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${wt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Mt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Qt=Mt.items)==null?void 0:Qt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>yt(Mt),children:r.jsx(b0,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(Mt.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})}),r.jsx(ee,{size:"sm",variant:wt?"outline":"default",disabled:wt||h.isPending,onClick:()=>Ee(Mt.id,N),children:wt?"Active":"Use This"})]})]},Mt.id)})]}),Ue.length===0&&Fe.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(Os,{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(Fr,{open:E,onOpenChange:Mt=>{Mt?T(!0):rt()},children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:P?"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(He,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(dt,{id:"plan-name",value:F,onChange:Mt=>q(Mt.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(ps,{id:"plan-description",value:V,onChange:Mt=>K(Mt.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(He,{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:Oce.map((Mt,wt)=>{const Qt=wt+1,Cr=G.find(Qr=>Qr.month_number===Qt),cn=Cr?l==null?void 0:l.find(Qr=>Qr.id===Cr.action_type_id):null,jn=cn?Qe(cn.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>oe(ie===Qt?null:Qt),className:` w-full p-3 rounded-lg border text-center transition-all ${Cr?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ie===Qt?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:Mt}),jn?r.jsx(jn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(cn==null?void 0:cn.color)||"#3B82F6"}}):r.jsx(bn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Cr&&r.jsx("button",{type:"button",onClick:Qr=>{Qr.stopPropagation(),ft(Qt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(_s,{className:"h-3 w-3"})})]},wt)})}),ie!==null&&!ye&&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 ",Oce[ie-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(Mt=>Mt.active).map(Mt=>{const wt=Qe(Mt.icon);return r.jsxs("button",{type:"button",onClick:()=>at(ie,Mt.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(wt,{className:"h-4 w-4",style:{color:Mt.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:Mt.name})]},Mt.id)})})]}),ie!==null&&ye&&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(ee,{variant:"ghost",size:"sm",onClick:()=>ae(null),children:[r.jsx(Ac,{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:()=>Me(ie,ye),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"})]})}),Oe==null?void 0:Oe.map(Mt=>r.jsx("button",{type:"button",onClick:()=>Me(ie,ye,Mt.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:Mt.title}),Mt.tone&&r.jsx(Ot,{variant:"secondary",className:"text-xs mt-1",children:Mt.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[Mt.script_body.substring(0,100),"..."]})]})},Mt.id)),r.jsxs("button",{type:"button",onClick:()=>se(!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(bn,{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"})]})]})]})]})]}),G.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.length," touchpoint",G.length!==1?"s":""," per year"]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:rt,children:"Cancel"}),r.jsxs(ee,{onClick:P?me:Ke,disabled:!F.trim()||p.isPending||x.isPending,children:[r.jsx(bg,{className:"h-4 w-4 mr-2"}),P?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Fr,{open:pe,onOpenChange:se,children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-title",children:"Script Title"}),r.jsx(dt,{id:"script-title",value:he,onChange:Mt=>ue(Mt.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(gn,{value:ge,onValueChange:Le,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select tone..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"friendly",children:"Friendly"}),r.jsx(qt,{value:"professional",children:"Professional"}),r.jsx(qt,{value:"casual",children:"Casual"}),r.jsx(qt,{value:"formal",children:"Formal"})]})]})]}),((mt=(gt=l==null?void 0:l.find(Mt=>Mt.id===ye))==null?void 0:gt.name)==null?void 0:mt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(dt,{id:"script-email-subject",value:Ce,onChange:Mt=>Se(Mt.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-body",children:"Script Content"}),r.jsx(ps,{id:"script-body",value:_e,onChange:Mt=>Ae(Mt.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(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>se(!1),children:"Cancel"}),r.jsxs(ee,{onClick:qe,disabled:!he.trim()||!_e.trim()||j.isPending,children:[r.jsx(bg,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const ckt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",dkt=[{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 ukt(){const t=Zn(),e=Cze(),{data:n}=kze(),{data:s}=Mm(),{data:a}=_ye(),{data:o}=Vse(90),{data:l}=dp(),i=Ajt(),h=Mze(),p=Mjt(),x=Tjt(),{data:y=[],isLoading:_}=Yt({queryKey:["popby-templates"],queryFn:async()=>{const{data:pe,error:se}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",ckt).order("publish_date",{ascending:!1});if(se)throw se;const{data:he}=await J.from("template_likes").select("template_id"),{data:ue}=await J.from("template_comments").select("template_id"),_e=new Map;he==null||he.forEach(Ce=>{_e.set(Ce.template_id,(_e.get(Ce.template_id)||0)+1)});const Ae=new Map;return ue==null||ue.forEach(Ce=>{Ae.set(Ce.template_id,(Ae.get(Ce.template_id)||0)+1)}),(pe||[]).map(Ce=>({...Ce,likesCount:_e.get(Ce.id)||0,commentsCount:Ae.get(Ce.id)||0}))}}),j=pe=>{const se=l==null?void 0:l.find(he=>he.id===pe);return se?`${se.first_name} ${se.last_name||""}`.trim():"Unknown"},C=pe=>{if(!pe)return null;const se=n==null?void 0:n.find(he=>he.id===pe);return(se==null?void 0:se.name)||null},[N,A]=I.useState(null),[E,T]=I.useState(!1),[P,z]=I.useState(!1),[F,q]=I.useState(!1),[V,K]=I.useState({popby_item_id:"",notes:""}),[G,te]=I.useState({name:"",description:""}),ie=async()=>{N&&(await h.mutateAsync({contact_id:N.id,popby_item_id:V.popby_item_id||void 0,notes:V.notes||void 0}),T(!1),A(null),K({popby_item_id:"",notes:""}))},oe=async()=>{G.name.trim()&&(await p.mutateAsync({name:G.name.trim(),description:G.description.trim()||void 0}),q(!1),te({name:"",description:""}))},ye=async(pe,se)=>{await x.mutateAsync({relationship_type_id:pe,frequency_days:parseInt(se)})},ae=pe=>{var he;const se=a==null?void 0:a.find(ue=>ue.relationship_type_id===pe);return((he=se==null?void 0:se.frequency_days)==null?void 0:he.toString())||"90"};return r.jsx(Lr,{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:i.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:i.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:i.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(ee,{onClick:()=>t("/mission-control/popbys/map"),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(ee,{variant:"outline",onClick:()=>z(!0),children:[r.jsx(md,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(ee,{variant:"outline",onClick:()=>q(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(Ii,{defaultValue:"due",children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"due",children:"Due for Popby"}),r.jsx(nn,{value:"activity",children:"Recent Activity"}),r.jsx(nn,{value:"library",children:"Popby Library"}),r.jsx(nn,{value:"templates",children:"Popby Templates"})]}),r.jsx(Sn,{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(Ki,{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(pe=>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:[pe.first_name," ",pe.last_name]}),pe.daysOverdue>0&&r.jsxs(Ot,{variant:"destructive",className:"text-xs",children:[pe.daysOverdue,"+ days overdue"]}),pe.daysSinceLastPopby===null&&r.jsx(Ot,{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:[pe.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Mo,{className:"h-3 w-3"}),pe.city||pe.address]}),pe.tags&&pe.tags.length>0&&r.jsx("span",{children:pe.tags.map(se=>{var he;return(he=se.relationship_type)==null?void 0:he.name}).join(", ")})]}),pe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",xn(new Date(pe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[pe.phone&&r.jsx(ee,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${pe.phone}`,children:r.jsx(bi,{className:"h-4 w-4"})})}),r.jsxs(ee,{size:"sm",onClick:()=>{A(pe),T(!0)},children:[r.jsx(Yi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},pe.id))})}),r.jsx(Sn,{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(Ya,{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(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(Je,{className:"space-y-3",children:o.map(pe=>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(Ki,{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:j(pe.contact_id)}),C(pe.popby_item_id)&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:C(pe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:xn(new Date(pe.completed_at),"MMM d, yyyy h:mm a")}),pe.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:pe.notes})]})]},pe.id))})]})}),r.jsx(Sn,{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(pe=>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(Ki,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:pe.name}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:pe.description}),!pe.owner_user_id&&r.jsx(Ot,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},pe.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(bn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(Sn,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[y.length," template",y.length!==1?"s":""," found"]}),_&&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((pe,se)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ir,{className:"h-5 w-16"}),r.jsx(Ir,{className:"h-5 w-20"})]})]})},se))}),!_&&y.length===0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(zl,{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."})]})}),!_&&y.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:y.map(pe=>r.jsxs(Ye,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>t(`/templates/${pe.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:pe.preview_image_url?r.jsx("img",{src:pe.preview_image_url,alt:pe.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:pe.name}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Sne(pe.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Ot,{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(gd,{className:"h-3.5 w-3.5"}),pe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),pe.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:se=>{se.stopPropagation(),t(`/templates/${pe.id}`)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Template"]})]})]},pe.id))})]})]}),r.jsx(Fr,{open:E,onOpenChange:T,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:["Log Popby for ",N==null?void 0:N.first_name," ",N==null?void 0:N.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Popby Item (optional)"}),r.jsxs(gn,{value:V.popby_item_id,onValueChange:pe=>K(se=>({...se,popby_item_id:pe})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:n==null?void 0:n.map(pe=>r.jsx(qt,{value:pe.id,children:pe.name},pe.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:V.notes,onChange:pe=>K(se=>({...se,notes:pe.target.value}))})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(ee,{onClick:ie,disabled:h.isPending,children:"Log Popby"})]})]})}),r.jsx(Fr,{open:P,onOpenChange:z,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsx(qr,{children:r.jsx($r,{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(pe=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(He,{className:"font-medium",children:pe.name}),r.jsxs(gn,{value:ae(pe.id),onValueChange:se=>ye(pe.id,se),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:dkt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]},pe.id))]}),r.jsx(ea,{children:r.jsx(ee,{onClick:()=>z(!1),children:"Done"})})]})}),r.jsx(Fr,{open:F,onOpenChange:q,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Name *"}),r.jsx(dt,{placeholder:"e.g., Homemade cookies",value:G.name,onChange:pe=>te(se=>({...se,name:pe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(ps,{placeholder:"Optional description...",value:G.description,onChange:pe=>te(se=>({...se,description:pe.target.value}))})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(ee,{onClick:oe,disabled:!G.name.trim()||p.isPending,children:"Add Item"})]})]})})]})})}function hkt(){const t=Zn(),{isAdmin:e}=Xr(),n=I.useRef(null),s=I.useRef(null),a=I.useRef([]),o=Sze(),{data:l}=kze(),i=Mze(),[h,p]=I.useState(""),[x,y]=I.useState(""),[_,j]=I.useState(!0),[C,N]=I.useState(null),[A,E]=I.useState(null),[T,P]=I.useState(!1),[z,F]=I.useState({popby_item_id:"",notes:""}),q=o.filter(te=>te.address||te.city&&te.state);I.useEffect(()=>{(async()=>{j(!0);try{const{data:ie}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ie!=null&&ie.value&&p(ie.value)}catch(ie){console.error("Error fetching mapbox token:",ie)}j(!1)})()},[]),I.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(te=>{N([te.coords.longitude,te.coords.latitude])},te=>{console.log("Could not get location:",te)})},[]),I.useEffect(()=>{if(!(!n.current||!h||s.current))return Xl.accessToken=h,s.current=new Xl.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:C?12:4,center:C||[-98.5795,39.8283]}),s.current.addControl(new Xl.NavigationControl,"top-right"),()=>{var te;(te=s.current)==null||te.remove(),s.current=null}},[h,C]),I.useEffect(()=>{!s.current||!h||(a.current.forEach(te=>te.remove()),a.current=[],q.forEach(async te=>{var oe;const ie=[te.address,te.city,te.state,te.zip].filter(Boolean).join(", ");if(ie)try{const ae=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ie)}.json?access_token=${h}`)).json();if(ae.features&&ae.features.length>0){const[pe,se]=ae.features[0].center,he=document.createElement("div");he.className="cursor-pointer",he.innerHTML=`
${te.first_name[0]}${((oe=te.last_name)==null?void 0:oe[0])||""}
${te.isDue?'
':""}
`;const ue=new Xl.Marker(he).setLngLat([pe,se]).addTo(s.current);he.addEventListener("click",()=>{E(te)}),a.current.push(ue)}}catch(ye){console.error("Geocoding error for",te.first_name,ye)}}))},[q,h]);const V=()=>{C&&s.current?s.current.flyTo({center:C,zoom:13}):ma({title:"Location not available",description:"Please enable location services",variant:"destructive"})},K=async()=>{A&&(await i.mutateAsync({contact_id:A.id,popby_item_id:z.popby_item_id||void 0,notes:z.notes||void 0,latitude:C==null?void 0:C[1],longitude:C==null?void 0:C[0]}),P(!1),E(null),F({popby_item_id:"",notes:""}))},G=async()=>{if(x.trim())try{await J.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),p(x.trim()),ma({title:"Mapbox token saved!"})}catch{ma({title:"Error saving token",variant:"destructive"})}};return _?r.jsx(Lr,{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"})})}):h?r.jsx(Lr,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(ee,{onClick:V,children:[r.jsx(DT,{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(fl,{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."})]})})]}),A&&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:[A.first_name," ",A.last_name]}),A.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[A.city,", ",A.state]})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>E(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[A.isDue?r.jsxs(Ot,{variant:"destructive",children:[A.daysOverdue,"+ days overdue"]}):r.jsx(Ot,{variant:"secondary",children:"Up to date"}),A.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",xn(new Date(A.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[A.phone&&r.jsx(ee,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${A.phone}`,children:[r.jsx(bi,{className:"h-4 w-4 mr-1"}),"Call"]})}),A.address&&r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const te=[A.address,A.city,A.state,A.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(te)}`,"_blank")},children:[r.jsx(UT,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(ee,{size:"sm",className:"flex-1",onClick:()=>P(!0),children:[r.jsx(Ki,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Fr,{open:T,onOpenChange:P,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:["Log Popby for ",A==null?void 0:A.first_name," ",A==null?void 0:A.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Popby Item (optional)"}),r.jsxs(gn,{value:z.popby_item_id,onValueChange:te=>F(ie=>({...ie,popby_item_id:te})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:l==null?void 0:l.map(te=>r.jsx(qt,{value:te.id,children:te.name},te.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:z.notes,onChange:te=>F(ie=>({...ie,notes:te.target.value}))})]}),C&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Mo,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsxs(ee,{onClick:K,disabled:i.isPending,children:[r.jsx(Yi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):e?r.jsx(Lr,{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(Mo,{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(He,{children:"Mapbox Public Token"}),r.jsx(dt,{placeholder:"pk.eyJ1I...",value:x,onChange:te=>y(te.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(ee,{onClick:G,className:"w-full",children:"Save Token"}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Lr,{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(fl,{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(ee,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const fkt=u3({property_address:oc().min(1,"Property address is required"),city:oc().optional(),state:oc().optional(),zip:oc().optional(),transaction_type:NLe(["buyer","seller"]),close_date:oc().min(1,"Close date is required"),sale_price:lA().min(0,"Sale price must be positive"),commission_amount:lA().optional(),lead_source_id:oc().optional(),client_type_id:oc().optional(),contact_id:oc().optional(),notes:oc().optional(),is_win:Qot()});function Eze({open:t,onOpenChange:e,transaction:n}){const[s,a]=I.useState(!1),[o,l]=I.useState(""),[i,h]=I.useState(!1),[p,x]=I.useState(""),y=_se(),_=apt(),{data:j}=vse(),{data:C}=Mm(),{data:N}=dp(),A=gxe(),E=spt(),{data:T}=bse(),P=(T==null?void 0:T.show_commission)??!0,z=ose({resolver:lse(fkt),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}});I.useEffect(()=>{n?z.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}):z.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,z]);const F=async G=>{const te={property_address:G.property_address,transaction_type:G.transaction_type,close_date:G.close_date,sale_price:G.sale_price,is_win:G.is_win,commission_amount:G.commission_amount||null,lead_source_id:G.lead_source_id||null,client_type_id:G.client_type_id||null,contact_id:G.contact_id||null,city:G.city||null,state:G.state||null,zip:G.zip||null,notes:G.notes||null};n?await _.mutateAsync({id:n.id,...te}):await y.mutateAsync(te),e(!1)},q=async()=>{if(!o.trim())return;const[G,...te]=o.trim().split(" "),ie=te.join(" ")||null,oe=await A.mutateAsync({first_name:G,last_name:ie,tagIds:[]});oe&&(z.setValue("contact_id",oe.id),l(""),h(!1),a(!1))},V=async()=>{if(!p.trim())return;const G=await E.mutateAsync(p.trim());G&&(z.setValue("lead_source_id",G.id),x(""))},K=N==null?void 0:N.find(G=>G.id===z.watch("contact_id"));return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(qr,{children:r.jsx($r,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(tl,{className:"max-h-[70vh] pr-4",children:r.jsx(cse,{...z,children:r.jsxs("form",{onSubmit:z.handleSubmit(F),className:"space-y-4",children:[r.jsx(Al,{control:z.control,name:"property_address",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Property Address *"}),r.jsx(kl,{children:r.jsx(dt,{placeholder:"123 Main St",...G})}),r.jsx(Lu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Al,{control:z.control,name:"city",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"City"}),r.jsx(kl,{children:r.jsx(dt,{placeholder:"City",...G})})]})}),r.jsx(Al,{control:z.control,name:"state",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"State"}),r.jsx(kl,{children:r.jsx(dt,{placeholder:"TX",...G})})]})}),r.jsx(Al,{control:z.control,name:"zip",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Zip"}),r.jsx(kl,{children:r.jsx(dt,{placeholder:"75001",...G})})]})})]}),r.jsx(Al,{control:z.control,name:"transaction_type",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Transaction Type *"}),r.jsxs(gn,{onValueChange:G.onChange,value:G.value,children:[r.jsx(kl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select type"})})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]}),r.jsx(Lu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Al,{control:z.control,name:"close_date",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Close Date *"}),r.jsx(kl,{children:r.jsx(dt,{type:"date",...G})}),r.jsx(Lu,{})]})}),r.jsx(Al,{control:z.control,name:"sale_price",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Sale Price *"}),r.jsx(kl,{children:r.jsx(dt,{type:"number",placeholder:"0",...G,onChange:te=>G.onChange(Number(te.target.value))})}),r.jsx(Lu,{})]})})]}),P&&r.jsx(Al,{control:z.control,name:"commission_amount",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Commission"}),r.jsx(kl,{children:r.jsx(dt,{type:"number",placeholder:"0",...G,value:G.value??"",onChange:te=>G.onChange(te.target.value?Number(te.target.value):void 0)})})]})}),r.jsx(Al,{control:z.control,name:"lead_source_id",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Lead Source"}),r.jsxs(gn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(kl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select source"})})}),r.jsx(pn,{children:j==null?void 0:j.map(te=>r.jsx(qt,{value:te.id,children:te.name},te.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add custom source...",value:p,onChange:G=>x(G.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:V,disabled:!p.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsx(Al,{control:z.control,name:"client_type_id",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Client Type"}),r.jsxs(gn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(kl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select client type"})})}),r.jsx(pn,{children:C==null?void 0:C.map(te=>r.jsx(qt,{value:te.id,children:te.name},te.id))})]})]})}),r.jsx(Al,{control:z.control,name:"contact_id",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Client Contact"}),r.jsxs(hu,{open:s,onOpenChange:a,children:[r.jsx(fu,{asChild:!0,children:r.jsx(kl,{children:r.jsxs(ee,{variant:"outline",role:"combobox",className:zt("w-full justify-between",!G.value&&"text-muted-foreground"),children:[K?`${K.first_name} ${K.last_name||""}`.trim():"Select contact",r.jsx(p1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(Bd,{className:"w-full p-0",align:"start",children:[r.jsxs(W1,{children:[r.jsx(G1,{placeholder:"Search contacts..."}),r.jsxs(K1,{children:[r.jsx(Z1,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!i&&r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>h(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(Y1,{children:N==null?void 0:N.map(te=>r.jsxs(X1,{value:`${te.first_name} ${te.last_name||""}`,onSelect:()=>{G.onChange(te.id),a(!1)},children:[r.jsx(Ai,{className:zt("mr-2 h-4 w-4",te.id===G.value?"opacity-100":"opacity-0")}),te.first_name," ",te.last_name||""]},te.id))})]})]}),i&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(dt,{placeholder:"Enter contact name...",value:o,onChange:te=>l(te.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",onClick:q,disabled:!o.trim()||A.isPending,children:"Add Contact"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>{h(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(Al,{control:z.control,name:"notes",render:({field:G})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Notes"}),r.jsx(kl,{children:r.jsx(ps,{placeholder:"Any notes about this transaction...",...G})})]})}),r.jsx(Al,{control:z.control,name:"is_win",render:({field:G})=>r.jsxs(wl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(jl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(kl,{children:r.jsx(Ps,{checked:G.value,onCheckedChange:G.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:y.isPending||_.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function Ize({transactions:t,showCommission:e,isLoading:n}){const[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(""),[p,x]=I.useState("all"),[y,_]=I.useState("all"),[j,C]=I.useState("all"),[N,A]=I.useState(!1),E=ipt(),T=_se(),{data:P}=vse(),{data:z}=Mm(),F=m3(),q=G=>{const{id:te,created_at:ie,updated_at:oe,lead_source:ye,client_type:ae,contact:pe,...se}=G;T.mutate(se)},V=()=>{o&&(E.mutate(o),l(null))},K=t.filter(G=>{var pe,se,he,ue;const te=i===""||G.property_address.toLowerCase().includes(i.toLowerCase())||((se=(pe=G.contact)==null?void 0:pe.first_name)==null?void 0:se.toLowerCase().includes(i.toLowerCase()))||((ue=(he=G.contact)==null?void 0:he.last_name)==null?void 0:ue.toLowerCase().includes(i.toLowerCase())),ie=p==="all"||G.transaction_type===p,oe=y==="all"||G.lead_source_id===y,ye=j==="all"||G.client_type_id===j,ae=!N||G.is_win;return te&&ie&&oe&&ye&&ae});return n?r.jsx(Ye,{children:r.jsx(Je,{className:"p-6 space-y-4",children:[1,2,3].map(G=>r.jsx(Ir,{className:"h-16 w-full"},G))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{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(Zt,{children:["Transactions (",K.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search...",value:i,onChange:G=>h(G.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(gn,{value:p,onValueChange:x,children:[r.jsx(fn,{className:"w-[100px]",children:r.jsx(yn,{placeholder:"Type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]}),r.jsxs(gn,{value:y,onValueChange:_,children:[r.jsx(fn,{className:"w-[130px]",children:r.jsx(yn,{placeholder:"Lead Source"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Sources"}),P==null?void 0:P.map(G=>r.jsx(qt,{value:G.id,children:G.name},G.id))]})]}),r.jsxs(ee,{variant:N?"default":"outline",size:"sm",onClick:()=>A(!N),children:[r.jsx(Ol,{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(G=>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:G.property_address}),G.is_win&&r.jsx(Ol,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.city,G.state?`, ${G.state}`:""]})]}),r.jsx(Ot,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.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: "}),Gbe(G.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),Pd(G.sale_price)]}),e&&G.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),Pd(G.commission_amount)]}),G.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),G.lead_source.name]}),G.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),G.contact.first_name," ",G.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>a(G),children:r.jsx(ic,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>q(G),children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>l(G.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})]},G.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Close Date"}),r.jsx(It,{children:"Sale Price"}),e&&r.jsx(It,{children:"Commission"}),r.jsx(It,{children:"Lead Source"}),r.jsx(It,{children:"Client"}),r.jsx(It,{className:"w-[50px]"})]})}),r.jsx(Vs,{children:K.map(G=>{var te;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[G.is_win&&r.jsx(Ol,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:G.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.city,G.state?`, ${G.state}`:""]})]})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})}),r.jsx(Nt,{children:Gbe(G.close_date)}),r.jsx(Nt,{children:Pd(G.sale_price)}),e&&r.jsx(Nt,{children:G.commission_amount?Pd(G.commission_amount):"-"}),r.jsx(Nt,{children:((te=G.lead_source)==null?void 0:te.name)||"-"}),r.jsx(Nt,{children:G.contact?`${G.contact.first_name} ${G.contact.last_name||""}`.trim():"-"}),r.jsx(Nt,{children:r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(Mx,{className:"h-4 w-4"})})}),r.jsxs(Gu,{align:"end",children:[r.jsxs(di,{onClick:()=>a(G),children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(di,{onClick:()=>q(G),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(di,{onClick:()=>l(G.id),className:"text-destructive",children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},G.id)})})]})})})]}),r.jsx(Eze,{open:!!s,onOpenChange:G=>!G&&a(null),transaction:s||void 0}),r.jsx(Ou,{open:!!o,onOpenChange:G=>!G&&l(null),children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Delete Transaction?"}),r.jsx(ou,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:V,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function Pze({goals:t,stats:e,year:n,showCommission:s}){const a=new Date().getMonth()+1,o=new Date().getFullYear()===n?a:12,l=12-o,i=(_,j)=>{if(!j||j===0)return null;const C=Math.min(_/j*100,100),N=Math.max(j-_,0),A=l>0?N/l:0,E=o/12*100,T=C>=E?"ahead":C>=E*.8?"on-track":"behind";return{percent:C,remaining:N,pace:A,status:T}},h=i(e.totalTransactions,t.transactions_goal),p=i(e.totalVolume,t.volume_goal),x=s?i(e.totalCommission,t.gci_goal):null,y=_=>{switch(_){case"ahead":return r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(ep,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Ot,{variant:"secondary",children:[r.jsx(j1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Ot,{variant:"destructive",children:[r.jsx(jj,{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(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kx,{className:"h-5 w-5 text-primary"}),r.jsxs(Zt,{children:[n," Goals Progress"]})]})}),r.jsx(Je,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[t.transactions_goal&&h&&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"}),y(h.status)]}),r.jsx(Zc,{value:h.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(h.percent),"%"]})]}),h.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(h.pace),"/month to hit goal"]})]}),t.volume_goal&&p&&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"}),y(p.status)]}),r.jsx(Zc,{value:p.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Pd(e.totalVolume,!0)," of ",Pd(t.volume_goal,!0)]}),r.jsxs("span",{children:[Math.round(p.percent),"%"]})]}),p.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Pd(p.pace,!0),"/month"]})]}),s&&t.gci_goal&&x&&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"}),y(x.status)]}),r.jsx(Zc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Pd(e.totalCommission,!0)," of ",Pd(t.gci_goal,!0)]}),r.jsxs("span",{children:[Math.round(x.percent),"%"]})]}),x.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Pd(x.pace,!0),"/month"]})]})]})})]})}var pkt=Array.isArray,Sh=pkt,mkt=typeof Ix=="object"&&Ix&&Ix.Object===Object&&Ix,Lze=mkt,gkt=Lze,xkt=typeof self=="object"&&self&&self.Object===Object&&self,ykt=gkt||xkt||Function("return this")(),qg=ykt,vkt=qg,_kt=vkt.Symbol,FI=_kt,g4e=FI,Oze=Object.prototype,bkt=Oze.hasOwnProperty,wkt=Oze.toString,VM=g4e?g4e.toStringTag:void 0;function jkt(t){var e=bkt.call(t,VM),n=t[VM];try{t[VM]=void 0;var s=!0}catch{}var a=wkt.call(t);return s&&(e?t[VM]=n:delete t[VM]),a}var kkt=jkt,Nkt=Object.prototype,Skt=Nkt.toString;function Ckt(t){return Skt.call(t)}var Mkt=Ckt,x4e=FI,Tkt=kkt,Akt=Mkt,Ekt="[object Null]",Ikt="[object Undefined]",y4e=x4e?x4e.toStringTag:void 0;function Pkt(t){return t==null?t===void 0?Ikt:Ekt:y4e&&y4e in Object(t)?Tkt(t):Akt(t)}var vy=Pkt;function Lkt(t){return t!=null&&typeof t=="object"}var _y=Lkt,Okt=vy,Dkt=_y,Rkt="[object Symbol]";function Fkt(t){return typeof t=="symbol"||Dkt(t)&&Okt(t)==Rkt}var g3=Fkt,zkt=Sh,Bkt=g3,$kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ukt=/^\w*$/;function qkt(t,e){if(zkt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Bkt(t)?!0:Ukt.test(t)||!$kt.test(t)||e!=null&&t in Object(e)}var wye=qkt;function Vkt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var fv=Vkt;const x3=Hi(fv);var Hkt=vy,Wkt=fv,Gkt="[object AsyncFunction]",Kkt="[object Function]",Zkt="[object GeneratorFunction]",Ykt="[object Proxy]";function Xkt(t){if(!Wkt(t))return!1;var e=Hkt(t);return e==Kkt||e==Zkt||e==Gkt||e==Ykt}var jye=Xkt;const Ua=Hi(jye);var Qkt=qg,Jkt=Qkt["__core-js_shared__"],eNt=Jkt,Dce=eNt,v4e=function(){var t=/[^.]+$/.exec(Dce&&Dce.keys&&Dce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function tNt(t){return!!v4e&&v4e in t}var rNt=tNt,nNt=Function.prototype,sNt=nNt.toString;function aNt(t){if(t!=null){try{return sNt.call(t)}catch{}try{return t+""}catch{}}return""}var Dze=aNt,iNt=jye,oNt=rNt,lNt=fv,cNt=Dze,dNt=/[\\^$.*+?()[\]{}|]/g,uNt=/^\[object .+?Constructor\]$/,hNt=Function.prototype,fNt=Object.prototype,pNt=hNt.toString,mNt=fNt.hasOwnProperty,gNt=RegExp("^"+pNt.call(mNt).replace(dNt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xNt(t){if(!lNt(t)||oNt(t))return!1;var e=iNt(t)?gNt:uNt;return e.test(cNt(t))}var yNt=xNt;function vNt(t,e){return t==null?void 0:t[e]}var _Nt=vNt,bNt=yNt,wNt=_Nt;function jNt(t,e){var n=wNt(t,e);return bNt(n)?n:void 0}var uk=jNt,kNt=uk,NNt=kNt(Object,"create"),Hse=NNt,_4e=Hse;function SNt(){this.__data__=_4e?_4e(null):{},this.size=0}var CNt=SNt;function MNt(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var TNt=MNt,ANt=Hse,ENt="__lodash_hash_undefined__",INt=Object.prototype,PNt=INt.hasOwnProperty;function LNt(t){var e=this.__data__;if(ANt){var n=e[t];return n===ENt?void 0:n}return PNt.call(e,t)?e[t]:void 0}var ONt=LNt,DNt=Hse,RNt=Object.prototype,FNt=RNt.hasOwnProperty;function zNt(t){var e=this.__data__;return DNt?e[t]!==void 0:FNt.call(e,t)}var BNt=zNt,$Nt=Hse,UNt="__lodash_hash_undefined__";function qNt(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=$Nt&&e===void 0?UNt:e,this}var VNt=qNt,HNt=CNt,WNt=TNt,GNt=ONt,KNt=BNt,ZNt=VNt;function y3(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var h4t=u4t,f4t=Wse;function p4t(t,e){var n=this.__data__,s=f4t(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this}var m4t=p4t,g4t=QNt,x4t=i4t,y4t=c4t,v4t=h4t,_4t=m4t;function v3(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},Gw=function(e){return Xj(e)&&e.indexOf("%")===e.length-1},Dn=function(e){return BSt(e)&&!zI(e)},VSt=function(e){return _i(e)},Gc=function(e){return Dn(e)||Xj(e)},HSt=0,BI=function(e){var n=++HSt;return"".concat(e||"").concat(n)},Ru=function(e,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Dn(e)&&!Xj(e))return s;var o;if(Gw(e)){var l=e.indexOf("%");o=n*parseFloat(e.slice(0,l))/100}else o=+e;return zI(o)&&(o=s),a&&o>n&&(o=n),o},D0=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},WSt=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,s={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function JSt(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 C4e={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"},Jx=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},M4e=null,Fce=null,Pye=function t(e){if(e===M4e&&Array.isArray(Fce))return Fce;var n=[];return I.Children.forEach(e,function(s){_i(s)||(OSt.isFragment(s)?n=n.concat(t(s.props.children)):n.push(s))}),Fce=n,M4e=e,n};function sp(t,e){var n=[],s=[];return Array.isArray(e)?s=e.map(function(a){return Jx(a)}):s=[Jx(e)],Pye(t).forEach(function(a){var o=lf(a,"type.displayName")||lf(a,"type.name");s.indexOf(o)!==-1&&n.push(a)}),n}function qh(t,e){var n=sp(t,e);return n&&n[0]}var T4e=function(e){if(!e||!e.props)return!1;var n=e.props,s=n.width,a=n.height;return!(!Dn(s)||s<=0||!Dn(a)||a<=0)},eCt=["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"],tCt=function(e){return e&&e.type&&Xj(e.type)&&eCt.indexOf(e.type)>=0},rCt=function(e,n,s,a){var o,l=(o=Rce==null?void 0:Rce[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ua(e)&&(a&&l.includes(n)||ZSt.includes(n))||s&&Iye.includes(n)},Ia=function(e,n,s){if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(I.isValidElement(e)&&(a=e.props),!x3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;rCt((i=a)===null||i===void 0?void 0:i[l],l,n,s)&&(o[l]=a[l])}),o},lfe=function t(e,n){if(e===n)return!0;var s=I.Children.count(e);if(s!==I.Children.count(n))return!1;if(s===0)return!0;if(s===1)return A4e(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function oCt(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 dfe(t){var e=t.children,n=t.width,s=t.height,a=t.viewBox,o=t.className,l=t.style,i=t.title,h=t.desc,p=iCt(t,aCt),x=a||{width:n,height:s,x:0,y:0},y=si("recharts-surface",o);return st.createElement("svg",cfe({},Ia(p,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),st.createElement("title",null,i),st.createElement("desc",null,h),e)}var lCt=["children","className"];function ufe(){return ufe=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 dCt(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 No=st.forwardRef(function(t,e){var n=t.children,s=t.className,a=cCt(t,lCt),o=si("recharts-layer",s);return st.createElement("g",ufe({className:o},Ia(a,!0),{ref:e}),n)}),_m=function(e,n){for(var s=arguments.length,a=new Array(s>2?s-2:0),o=2;oa?0:a+e),n=n>a?a:n,n<0&&(n+=a),a=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(a);++s=s?t:fCt(t,e,n)}var mCt=pCt,gCt="\\ud800-\\udfff",xCt="\\u0300-\\u036f",yCt="\\ufe20-\\ufe2f",vCt="\\u20d0-\\u20ff",_Ct=xCt+yCt+vCt,bCt="\\ufe0e\\ufe0f",wCt="\\u200d",jCt=RegExp("["+wCt+gCt+_Ct+bCt+"]");function kCt(t){return jCt.test(t)}var Wze=kCt;function NCt(t){return t.split("")}var SCt=NCt,Gze="\\ud800-\\udfff",CCt="\\u0300-\\u036f",MCt="\\ufe20-\\ufe2f",TCt="\\u20d0-\\u20ff",ACt=CCt+MCt+TCt,ECt="\\ufe0e\\ufe0f",ICt="["+Gze+"]",hfe="["+ACt+"]",ffe="\\ud83c[\\udffb-\\udfff]",PCt="(?:"+hfe+"|"+ffe+")",Kze="[^"+Gze+"]",Zze="(?:\\ud83c[\\udde6-\\uddff]){2}",Yze="[\\ud800-\\udbff][\\udc00-\\udfff]",LCt="\\u200d",Xze=PCt+"?",Qze="["+ECt+"]?",OCt="(?:"+LCt+"(?:"+[Kze,Zze,Yze].join("|")+")"+Qze+Xze+")*",DCt=Qze+Xze+OCt,RCt="(?:"+[Kze+hfe+"?",hfe,Zze,Yze,ICt].join("|")+")",FCt=RegExp(ffe+"(?="+ffe+")|"+RCt+DCt,"g");function zCt(t){return t.match(FCt)||[]}var BCt=zCt,$Ct=SCt,UCt=Wze,qCt=BCt;function VCt(t){return UCt(t)?qCt(t):$Ct(t)}var HCt=VCt,WCt=mCt,GCt=Wze,KCt=HCt,ZCt=Bze;function YCt(t){return function(e){e=ZCt(e);var n=GCt(e)?KCt(e):void 0,s=n?n[0]:e.charAt(0),a=n?WCt(n,1).join(""):e.slice(1);return s[t]()+a}}var XCt=YCt,QCt=XCt,JCt=QCt("toUpperCase"),e3t=JCt;const iae=Hi(e3t);function Yo(t){return function(){return t}}const Jze=Math.cos,dre=Math.sin,Am=Math.sqrt,ure=Math.PI,oae=2*ure,pfe=Math.PI,mfe=2*pfe,Tw=1e-6,t3t=mfe-Tw;function e7e(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return e7e;const n=10**e;return function(s){this._+=s[0];for(let a=1,o=s.length;aTw)if(!(Math.abs(y*h-p*x)>Tw)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let j=s-l,C=a-i,N=h*h+p*p,A=j*j+C*C,E=Math.sqrt(N),T=Math.sqrt(_),P=o*Math.tan((pfe-Math.acos((N+_-A)/(2*E*T)))/2),z=P/T,F=P/E;Math.abs(z-1)>Tw&&this._append`L${e+z*x},${n+z*y}`,this._append`A${o},${o},0,0,${+(y*j>x*C)},${this._x1=e+F*h},${this._y1=n+F*p}`}}arc(e,n,s,a,o,l){if(e=+e,n=+n,s=+s,l=!!l,s<0)throw new Error(`negative radius: ${s}`);let i=s*Math.cos(a),h=s*Math.sin(a),p=e+i,x=n+h,y=1^l,_=l?a-o:o-a;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Tw||Math.abs(this._y1-x)>Tw)&&this._append`L${p},${x}`,s&&(_<0&&(_=_%mfe+mfe),_>t3t?this._append`A${s},${s},0,1,${y},${e-i},${n-h}A${s},${s},0,1,${y},${this._x1=p},${this._y1=x}`:_>Tw&&this._append`A${s},${s},0,${+(_>=pfe)},${y},${this._x1=e+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(e,n,s,a){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function Lye(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 n3t(e)}function Oye(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function t7e(t){this._context=t}t7e.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 lae(t){return new t7e(t)}function r7e(t){return t[0]}function n7e(t){return t[1]}function s7e(t,e){var n=Yo(!0),s=null,a=lae,o=null,l=Lye(i);t=typeof t=="function"?t:t===void 0?r7e:Yo(t),e=typeof e=="function"?e:e===void 0?n7e:Yo(e);function i(h){var p,x=(h=Oye(h)).length,y,_=!1,j;for(s==null&&(o=a(j=l())),p=0;p<=x;++p)!(p=j;--C)i.point(P[C],z[C]);i.lineEnd(),i.areaEnd()}E&&(P[_]=+t(A,_,y),z[_]=+e(A,_,y),i.point(s?+s(A,_,y):P[_],n?+n(A,_,y):z[_]))}if(T)return i=null,T+""||null}function x(){return s7e().defined(a).curve(l).context(o)}return p.x=function(y){return arguments.length?(t=typeof y=="function"?y:Yo(+y),s=null,p):t},p.x0=function(y){return arguments.length?(t=typeof y=="function"?y:Yo(+y),p):t},p.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:Yo(+y),p):s},p.y=function(y){return arguments.length?(e=typeof y=="function"?y:Yo(+y),n=null,p):e},p.y0=function(y){return arguments.length?(e=typeof y=="function"?y:Yo(+y),p):e},p.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:Yo(+y),p):n},p.lineX0=p.lineY0=function(){return x().x(t).y(e)},p.lineY1=function(){return x().x(t).y(n)},p.lineX1=function(){return x().x(s).y(e)},p.defined=function(y){return arguments.length?(a=typeof y=="function"?y:Yo(!!y),p):a},p.curve=function(y){return arguments.length?(l=y,o!=null&&(i=l(o)),p):l},p.context=function(y){return arguments.length?(y==null?o=i=null:i=l(o=y),p):o},p}class a7e{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 s3t(t){return new a7e(t,!0)}function a3t(t){return new a7e(t,!1)}const Dye={draw(t,e){const n=Am(e/ure);t.moveTo(n,0),t.arc(0,0,n,0,oae)}},i3t={draw(t,e){const n=Am(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()}},i7e=Am(1/3),o3t=i7e*2,l3t={draw(t,e){const n=Am(e/o3t),s=n*i7e;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}},c3t={draw(t,e){const n=Am(e),s=-n/2;t.rect(s,s,n,n)}},d3t=.8908130915292852,o7e=dre(ure/10)/dre(7*ure/10),u3t=dre(oae/10)*o7e,h3t=-Jze(oae/10)*o7e,f3t={draw(t,e){const n=Am(e*d3t),s=u3t*n,a=h3t*n;t.moveTo(0,-n),t.lineTo(s,a);for(let o=1;o<5;++o){const l=oae*o/5,i=Jze(l),h=dre(l);t.lineTo(h*n,-i*n),t.lineTo(i*s-h*a,h*s+i*a)}t.closePath()}},zce=Am(3),p3t={draw(t,e){const n=-Am(e/(zce*3));t.moveTo(0,n*2),t.lineTo(-zce*n,-n),t.lineTo(zce*n,-n),t.closePath()}},Ef=-.5,If=Am(3)/2,gfe=1/Am(12),m3t=(gfe/2+1)*3,g3t={draw(t,e){const n=Am(e/m3t),s=n/2,a=n*gfe,o=s,l=n*gfe+n,i=-o,h=l;t.moveTo(s,a),t.lineTo(o,l),t.lineTo(i,h),t.lineTo(Ef*s-If*a,If*s+Ef*a),t.lineTo(Ef*o-If*l,If*o+Ef*l),t.lineTo(Ef*i-If*h,If*i+Ef*h),t.lineTo(Ef*s+If*a,Ef*a-If*s),t.lineTo(Ef*o+If*l,Ef*l-If*o),t.lineTo(Ef*i+If*h,Ef*h-If*i),t.closePath()}};function x3t(t,e){let n=null,s=Lye(a);t=typeof t=="function"?t:Yo(t||Dye),e=typeof e=="function"?e:Yo(e===void 0?64:+e);function a(){let o;if(n||(n=o=s()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return a.type=function(o){return arguments.length?(t=typeof o=="function"?o:Yo(o),a):t},a.size=function(o){return arguments.length?(e=typeof o=="function"?o:Yo(+o),a):e},a.context=function(o){return arguments.length?(n=o??null,a):n},a}function hre(){}function fre(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 l7e(t){this._context=t}l7e.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:fre(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:fre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function y3t(t){return new l7e(t)}function c7e(t){this._context=t}c7e.prototype={areaStart:hre,areaEnd:hre,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:fre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function v3t(t){return new c7e(t)}function d7e(t){this._context=t}d7e.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:fre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function _3t(t){return new d7e(t)}function u7e(t){this._context=t}u7e.prototype={areaStart:hre,areaEnd:hre,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 b3t(t){return new u7e(t)}function I4e(t){return t<0?-1:1}function P4e(t,e,n){var s=t._x1-t._x0,a=e-t._x1,o=(t._y1-t._y0)/(s||a<0&&-0),l=(n-t._y1)/(a||s<0&&-0),i=(o*a+l*s)/(s+a);return(I4e(o)+I4e(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function L4e(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Bce(t,e,n){var s=t._x0,a=t._y0,o=t._x1,l=t._y1,i=(o-s)/3;t._context.bezierCurveTo(s+i,a+i*e,o-i,l-i*n,o,l)}function pre(t){this._context=t}pre.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:Bce(this,this._t0,L4e(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,Bce(this,L4e(this,n=P4e(this,t,e)),n);break;default:Bce(this,this._t0,n=P4e(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function h7e(t){this._context=new f7e(t)}(h7e.prototype=Object.create(pre.prototype)).point=function(t,e){pre.prototype.point.call(this,e,t)};function f7e(t){this._context=t}f7e.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,a,o){this._context.bezierCurveTo(e,t,s,n,o,a)}};function w3t(t){return new pre(t)}function j3t(t){return new h7e(t)}function p7e(t){this._context=t}p7e.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=O4e(t),a=O4e(e),o=0,l=1;l=0;--e)a[e]=(l[e]-a[e+1])/o[e];for(o[n-1]=(t[n]+a[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 N3t(t){return new cae(t,.5)}function S3t(t){return new cae(t,0)}function C3t(t){return new cae(t,1)}function wC(t,e){if((l=t.length)>1)for(var n=1,s,a,o=t[e[0]],l,i=o.length;n=0;)n[e]=e;return n}function M3t(t,e){return t[e]}function T3t(t){const e=[];return e.key=t,e}function A3t(){var t=Yo([]),e=xfe,n=wC,s=M3t;function a(o){var l=Array.from(t.apply(this,arguments),T3t),i,h=l.length,p=-1,x;for(const y of o)for(i=0,++p;i0){for(var n,s,a=0,o=t[0].length,l;a0){for(var n=0,s=t[e[0]],a,o=s.length;n0)||!((o=(a=t[e[0]]).length)>0))){for(var n=0,s=1,a,o,l;s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function z3t(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 m7e={symbolCircle:Dye,symbolCross:i3t,symbolDiamond:l3t,symbolSquare:c3t,symbolStar:f3t,symbolTriangle:p3t,symbolWye:g3t},B3t=Math.PI/180,$3t=function(e){var n="symbol".concat(iae(e));return m7e[n]||Dye},U3t=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 a=18*B3t;return 1.25*e*e*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),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}},q3t=function(e,n){m7e["symbol".concat(iae(e))]=n},Rye=function(e){var n=e.type,s=n===void 0?"circle":n,a=e.size,o=a===void 0?64:a,l=e.sizeType,i=l===void 0?"area":l,h=F3t(e,L3t),p=R4e(R4e({},h),{},{type:s,size:o,sizeType:i}),x=function(){var A=$3t(s),E=x3t().type(A).size(U3t(o,i,s));return E()},y=p.className,_=p.cx,j=p.cy,C=Ia(p,!0);return _===+_&&j===+j&&o===+o?st.createElement("path",yfe({},C,{className:si("recharts-symbols",y),transform:"translate(".concat(_,", ").concat(j,")"),d:x()})):null};Rye.registerSymbol=q3t;function jC(t){"@babel/helpers - typeof";return jC=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},jC(t)}function vfe(){return vfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var T=j.inactive?p:j.color;return st.createElement("li",vfe({className:A,style:y,key:"legend-item-".concat(C)},Qj(s.props,j,C)),st.createElement(dfe,{width:l,height:l,viewBox:x,style:_},s.renderIcon(j)),st.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},N?N(E,j,C):E))})}},{key:"render",value:function(){var s=this.props,a=s.payload,o=s.layout,l=s.align;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return st.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(I.PureComponent);_E(Fye,"displayName","Legend");_E(Fye,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var J3t=Gse;function e5t(){this.__data__=new J3t,this.size=0}var t5t=e5t;function r5t(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var n5t=r5t;function s5t(t){return this.__data__.get(t)}var a5t=s5t;function i5t(t){return this.__data__.has(t)}var o5t=i5t,l5t=Gse,c5t=Nye,d5t=Sye,u5t=200;function h5t(t,e){var n=this.__data__;if(n instanceof l5t){var s=n.__data__;if(!c5t||s.lengthi))return!1;var p=o.get(t),x=o.get(e);if(p&&x)return p==e&&x==t;var y=-1,_=!0,j=n&L5t?new A5t:void 0;for(o.set(t,e),o.set(e,t);++y-1&&t%1==0&&t-1&&t%1==0&&t<=FMt}var Uye=zMt,BMt=vy,$Mt=Uye,UMt=_y,qMt="[object Arguments]",VMt="[object Array]",HMt="[object Boolean]",WMt="[object Date]",GMt="[object Error]",KMt="[object Function]",ZMt="[object Map]",YMt="[object Number]",XMt="[object Object]",QMt="[object RegExp]",JMt="[object Set]",eTt="[object String]",tTt="[object WeakMap]",rTt="[object ArrayBuffer]",nTt="[object DataView]",sTt="[object Float32Array]",aTt="[object Float64Array]",iTt="[object Int8Array]",oTt="[object Int16Array]",lTt="[object Int32Array]",cTt="[object Uint8Array]",dTt="[object Uint8ClampedArray]",uTt="[object Uint16Array]",hTt="[object Uint32Array]",cl={};cl[sTt]=cl[aTt]=cl[iTt]=cl[oTt]=cl[lTt]=cl[cTt]=cl[dTt]=cl[uTt]=cl[hTt]=!0;cl[qMt]=cl[VMt]=cl[rTt]=cl[HMt]=cl[nTt]=cl[WMt]=cl[GMt]=cl[KMt]=cl[ZMt]=cl[YMt]=cl[XMt]=cl[QMt]=cl[JMt]=cl[eTt]=cl[tTt]=!1;function fTt(t){return UMt(t)&&$Mt(t.length)&&!!cl[BMt(t)]}var pTt=fTt;function mTt(t){return function(e){return t(e)}}var S7e=mTt,yre={exports:{}};yre.exports;(function(t,e){var n=Lze,s=e&&!e.nodeType&&e,a=s&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===s,l=o&&n.process,i=function(){try{var h=a&&a.require&&a.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}}();t.exports=i})(yre,yre.exports);var gTt=yre.exports,xTt=pTt,yTt=S7e,V4e=gTt,H4e=V4e&&V4e.isTypedArray,vTt=H4e?yTt(H4e):xTt,C7e=vTt,_Tt=jMt,bTt=Bye,wTt=Sh,jTt=N7e,kTt=$ye,NTt=C7e,STt=Object.prototype,CTt=STt.hasOwnProperty;function MTt(t,e){var n=wTt(t),s=!n&&bTt(t),a=!n&&!s&&jTt(t),o=!n&&!s&&!a&&NTt(t),l=n||s||a||o,i=l?_Tt(t.length,String):[],h=i.length;for(var p in t)(e||CTt.call(t,p))&&!(l&&(p=="length"||a&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||kTt(p,h)))&&i.push(p);return i}var TTt=MTt,ATt=Object.prototype;function ETt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||ATt;return t===n}var ITt=ETt;function PTt(t,e){return function(n){return t(e(n))}}var M7e=PTt,LTt=M7e,OTt=LTt(Object.keys,Object),DTt=OTt,RTt=ITt,FTt=DTt,zTt=Object.prototype,BTt=zTt.hasOwnProperty;function $Tt(t){if(!RTt(t))return FTt(t);var e=[];for(var n in Object(t))BTt.call(t,n)&&n!="constructor"&&e.push(n);return e}var UTt=$Tt,qTt=jye,VTt=Uye;function HTt(t){return t!=null&&VTt(t.length)&&!qTt(t)}var $I=HTt,WTt=TTt,GTt=UTt,KTt=$I;function ZTt(t){return KTt(t)?WTt(t):GTt(t)}var dae=ZTt,YTt=uMt,XTt=bMt,QTt=dae;function JTt(t){return YTt(t,QTt,XTt)}var eAt=JTt,W4e=eAt,tAt=1,rAt=Object.prototype,nAt=rAt.hasOwnProperty;function sAt(t,e,n,s,a,o){var l=n&tAt,i=W4e(t),h=i.length,p=W4e(e),x=p.length;if(h!=x&&!l)return!1;for(var y=h;y--;){var _=i[y];if(!(l?_ in e:nAt.call(e,_)))return!1}var j=o.get(t),C=o.get(e);if(j&&C)return j==e&&C==t;var N=!0;o.set(t,e),o.set(e,t);for(var A=l;++y-1}var rIt=tIt;function nIt(t,e,n){for(var s=-1,a=t==null?0:t.length;++s=yIt){var p=e?null:gIt(t);if(p)return xIt(p);l=!1,a=mIt,h=new hIt}else h=e?[]:i;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function LIt(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 OIt(t){return t.value}function DIt(t,e){if(st.isValidElement(t))return st.cloneElement(t,e);if(typeof t=="function")return st.createElement(t,e);e.ref;var n=PIt(e,NIt);return st.createElement(Fye,n)}var lSe=1,OS=function(t){function e(){var n;SIt(this,e);for(var s=arguments.length,a=new Array(s),o=0;olSe||Math.abs(a.height-this.lastBoundingBox.height)>lSe)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,s&&s(a)):(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?vx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,o=a.layout,l=a.align,i=a.verticalAlign,h=a.margin,p=a.chartWidth,x=a.chartHeight,y,_;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(l==="center"&&o==="vertical"){var j=this.getBBoxSnapshot();y={left:((p||0)-j.width)/2}}else y=l==="right"?{right:h&&h.right||0}:{left:h&&h.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(i==="middle"){var C=this.getBBoxSnapshot();_={top:((x||0)-C.height)/2}}else _=i==="bottom"?{bottom:h&&h.bottom||0}:{top:h&&h.top||0};return vx(vx({},y),_)}},{key:"render",value:function(){var s=this,a=this.props,o=a.content,l=a.width,i=a.height,h=a.wrapperStyle,p=a.payloadUniqBy,x=a.payload,y=vx(vx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(h)),h);return st.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(j){s.wrapperNode=j}},DIt(o,vx(vx({},this.props),{},{payload:O7e(x,p,OIt)})))}}],[{key:"getWithHeight",value:function(s,a){var o=vx(vx({},this.defaultProps),s.props),l=o.layout;return l==="vertical"&&Dn(s.props.height)?{height:s.props.height}:l==="horizontal"?{width:s.props.width||a}:null}}])}(I.PureComponent);uae(OS,"displayName","Legend");uae(OS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var cSe=FI,RIt=Bye,FIt=Sh,dSe=cSe?cSe.isConcatSpreadable:void 0;function zIt(t){return FIt(t)||RIt(t)||!!(dSe&&t&&t[dSe])}var BIt=zIt,$It=j7e,UIt=BIt;function F7e(t,e,n,s,a){var o=-1,l=t.length;for(n||(n=UIt),a||(a=[]);++o0&&n(i)?e>1?F7e(i,e-1,n,s,a):$It(a,i):s||(a[a.length]=i)}return a}var z7e=F7e;function qIt(t){return function(e,n,s){for(var a=-1,o=Object(e),l=s(e),i=l.length;i--;){var h=l[t?i:++a];if(n(o[h],h,o)===!1)break}return e}}var VIt=qIt,HIt=VIt,WIt=HIt(),GIt=WIt,KIt=GIt,ZIt=dae;function YIt(t,e){return t&&KIt(t,e,ZIt)}var B7e=YIt,XIt=$I;function QIt(t,e){return function(n,s){if(n==null)return n;if(!XIt(n))return t(n,s);for(var a=n.length,o=e?a:-1,l=Object(n);(e?o--:++oe||o&&l&&h&&!i&&!p||s&&l&&h||!n&&h||!a)return 1;if(!s&&!o&&!p&&t=i)return h;var p=n[s];return h*(p=="desc"?-1:1)}}return t.index-e.index}var hPt=uPt,Vce=Mye,fPt=Tye,pPt=Vg,mPt=$7e,gPt=oPt,xPt=S7e,yPt=hPt,vPt=j3,_Pt=Sh;function bPt(t,e,n){e.length?e=Vce(e,function(o){return _Pt(o)?function(l){return fPt(l,o.length===1?o[0]:o)}:o}):e=[vPt];var s=-1;e=Vce(e,xPt(pPt));var a=mPt(t,function(o,l,i){var h=Vce(e,function(p){return p(o)});return{criteria:h,index:++s,value:o}});return gPt(a,function(o,l){return yPt(o,l,n)})}var wPt=bPt;function jPt(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 kPt=jPt,NPt=kPt,hSe=Math.max;function SPt(t,e,n){return e=hSe(e===void 0?t.length-1:e,0),function(){for(var s=arguments,a=-1,o=hSe(s.length-e,0),l=Array(o);++a0){if(++e>=DPt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var BPt=zPt,$Pt=OPt,UPt=BPt,qPt=UPt($Pt),VPt=qPt,HPt=j3,WPt=CPt,GPt=VPt;function KPt(t,e){return GPt(WPt(t,e,HPt),t+"")}var ZPt=KPt,YPt=kye,XPt=$I,QPt=$ye,JPt=fv;function e6t(t,e,n){if(!JPt(n))return!1;var s=typeof e;return(s=="number"?XPt(n)&&QPt(e,n.length):s=="string"&&e in n)?YPt(n[e],t):!1}var hae=e6t,t6t=z7e,r6t=wPt,n6t=ZPt,pSe=hae,s6t=n6t(function(t,e){if(t==null)return[];var n=e.length;return n>1&&pSe(t,e[0],e[1])?e=[]:n>2&&pSe(e[0],e[1],e[2])&&(e=[e[0]]),r6t(t,t6t(e,1),[])}),a6t=s6t;const Hye=Hi(a6t);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 Cfe(){return Cfe=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(HM,"-left"),Dn(n)&&e&&Dn(e.x)&&n=e.y),"".concat(HM,"-top"),Dn(s)&&e&&Dn(e.y)&&sN?Math.max(x,h[s]):Math.max(y,h[s])}function _6t(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 b6t(t){var e=t.allowEscapeViewBox,n=t.coordinate,s=t.offsetTopLeft,a=t.position,o=t.reverseDirection,l=t.tooltipBox,i=t.useTranslate3d,h=t.viewBox,p,x,y;return l.height>0&&l.width>0&&n?(x=xSe({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:h,viewBoxDimension:h.width}),y=xSe({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:h,viewBoxDimension:h.height}),p=_6t({translateX:x,translateY:y,useTranslate3d:i})):p=y6t,{cssProperties:p,cssClasses:v6t({translateX:x,translateY:y,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 ySe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function vSe(t){for(var e=1;e_Se||Math.abs(s.height-this.state.lastBoundingBox.height)>_Se)&&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,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,o=a.active,l=a.allowEscapeViewBox,i=a.animationDuration,h=a.animationEasing,p=a.children,x=a.coordinate,y=a.hasPayload,_=a.isAnimationActive,j=a.offset,C=a.position,N=a.reverseDirection,A=a.useTranslate3d,E=a.viewBox,T=a.wrapperStyle,P=b6t({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:j,position:C,reverseDirection:N,tooltipBox:this.state.lastBoundingBox,useTranslate3d:A,viewBox:E}),z=P.cssClasses,F=P.cssProperties,q=vSe(vSe({transition:_&&o?"transform ".concat(i,"ms ").concat(h):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return st.createElement("div",{tabIndex:-1,className:z,style:q,ref:function(K){s.wrapperNode=K}},p)}}])}(I.PureComponent),E6t=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},k3={isSsr:E6t()};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 bSe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function wSe(t){for(var e=1;e0;return st.createElement(A6t,{allowEscapeViewBox:l,animationDuration:i,animationEasing:h,isAnimationActive:_,active:o,coordinate:x,hasPayload:q,offset:j,position:A,reverseDirection:E,useTranslate3d:T,viewBox:P,wrapperStyle:z},$6t(p,wSe(wSe({},this.props),{},{payload:F})))}}])}(I.PureComponent);Wye(em,"displayName","Tooltip");Wye(em,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!k3.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 U6t=qg,q6t=function(){return U6t.Date.now()},V6t=q6t,H6t=/\s/;function W6t(t){for(var e=t.length;e--&&H6t.test(t.charAt(e)););return e}var G6t=W6t,K6t=G6t,Z6t=/^\s+/;function Y6t(t){return t&&t.slice(0,K6t(t)+1).replace(Z6t,"")}var X6t=Y6t,Q6t=X6t,jSe=fv,J6t=g3,kSe=NaN,eLt=/^[-+]0x[0-9a-f]+$/i,tLt=/^0b[01]+$/i,rLt=/^0o[0-7]+$/i,nLt=parseInt;function sLt(t){if(typeof t=="number")return t;if(J6t(t))return kSe;if(jSe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=jSe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Q6t(t);var n=tLt.test(t);return n||rLt.test(t)?nLt(t.slice(2),n?2:8):eLt.test(t)?kSe:+t}var G7e=sLt,aLt=fv,Wce=V6t,NSe=G7e,iLt="Expected a function",oLt=Math.max,lLt=Math.min;function cLt(t,e,n){var s,a,o,l,i,h,p=0,x=!1,y=!1,_=!0;if(typeof t!="function")throw new TypeError(iLt);e=NSe(e)||0,aLt(n)&&(x=!!n.leading,y="maxWait"in n,o=y?oLt(NSe(n.maxWait)||0,e):o,_="trailing"in n?!!n.trailing:_);function j(q){var V=s,K=a;return s=a=void 0,p=q,l=t.apply(K,V),l}function C(q){return p=q,i=setTimeout(E,e),x?j(q):l}function N(q){var V=q-h,K=q-p,G=e-V;return y?lLt(G,o-K):G}function A(q){var V=q-h,K=q-p;return h===void 0||V>=e||V<0||y&&K>=o}function E(){var q=Wce();if(A(q))return T(q);i=setTimeout(E,N(q))}function T(q){return i=void 0,_&&s?j(q):(s=a=void 0,l)}function P(){i!==void 0&&clearTimeout(i),p=0,s=h=a=i=void 0}function z(){return i===void 0?l:T(Wce())}function F(){var q=Wce(),V=A(q);if(s=arguments,a=this,h=q,V){if(i===void 0)return C(h);if(y)return clearTimeout(i),i=setTimeout(E,e),j(h)}return i===void 0&&(i=setTimeout(E,e)),l}return F.cancel=P,F.flush=z,F}var dLt=cLt,uLt=dLt,hLt=fv,fLt="Expected a function";function pLt(t,e,n){var s=!0,a=!0;if(typeof t!="function")throw new TypeError(fLt);return hLt(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),uLt(t,e,{leading:s,maxWait:e,trailing:a})}var mLt=pLt;const K7e=Hi(mLt);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 SSe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function qL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&(ye=K7e(ye,N,{trailing:!0,leading:!1}));var ae=new ResizeObserver(ye),pe=F.current.getBoundingClientRect(),se=pe.width,he=pe.height;return ie(se,he),ae.observe(F.current),function(){ae.disconnect()}},[ie,N]);var oe=I.useMemo(function(){var ye=G.containerWidth,ae=G.containerHeight;if(ye<0||ae<0)return null;_m(Gw(l)||Gw(h),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,h),_m(!n||n>0,"The aspect(%s) must be greater than zero.",n);var pe=Gw(l)?ye:l,se=Gw(h)?ae:h;n&&n>0&&(pe?se=pe/n:se&&(pe=se*n),_&&se>_&&(se=_)),_m(pe>0||se>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.`,pe,se,l,h,x,y,n);var he=!Array.isArray(j)&&Jx(j.type).endsWith("Chart");return st.Children.map(j,function(ue){return st.isValidElement(ue)?I.cloneElement(ue,qL({width:pe,height:se},he?{style:qL({height:"100%",width:"100%",maxHeight:se,maxWidth:pe},ue.props.style)}:{})):ue})},[n,j,h,_,y,x,G,l]);return st.createElement("div",{id:A?"".concat(A):void 0,className:si("recharts-responsive-container",E),style:qL(qL({},z),{},{width:l,height:h,minWidth:x,minHeight:y,maxHeight:_}),ref:F},oe)}),fae=function(e){return null};fae.displayName="Cell";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 MSe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Ife(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||k3.isSsr)return{width:0,height:0};var s=TLt(n),a=JSON.stringify({text:e,copyStyle:s});if(p4.widthCache[a])return p4.widthCache[a];try{var o=document.getElementById(TSe);o||(o=document.createElement("span"),o.setAttribute("id",TSe),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Ife(Ife({},MLt),s);Object.assign(o.style,l),o.textContent="".concat(e);var i=o.getBoundingClientRect(),h={width:i.width,height:i.height};return p4.widthCache[a]=h,++p4.cacheCount>CLt&&(p4.cacheCount=0,p4.widthCache={}),h}catch{return{width:0,height:0}}},ALt=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 wre(t,e){return LLt(t)||PLt(t,e)||ILt(t,e)||ELt()}function ELt(){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 ILt(t,e){if(t){if(typeof t=="string")return ASe(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 ASe(t,e)}}function ASe(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 KLt(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 DSe(t,e){return QLt(t)||XLt(t,e)||YLt(t,e)||ZLt()}function ZLt(){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 YLt(t,e){if(t){if(typeof t=="string")return RSe(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 RSe(t,e)}}function RSe(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 pe.reduce(function(se,he){var ue=he.word,_e=he.width,Ae=se[se.length-1];if(Ae&&(a==null||o||Ae.width+_e+she.width?se:he})};if(!x)return j;for(var N="…",A=function(pe){var se=y.slice(0,pe),he=Q7e({breakAll:p,style:h,children:se+N}).wordsWithComputedWidth,ue=_(he),_e=ue.length>l||C(ue).width>Number(a);return[_e,ue]},E=0,T=y.length-1,P=0,z;E<=T&&P<=y.length-1;){var F=Math.floor((E+T)/2),q=F-1,V=A(q),K=DSe(V,2),G=K[0],te=K[1],ie=A(F),oe=DSe(ie,1),ye=oe[0];if(!G&&!ye&&(E=F+1),G&&ye&&(T=F-1),!G&&ye){z=te;break}P++}return z||j},FSe=function(e){var n=_i(e)?[]:e.toString().split(X7e);return[{words:n}]},eOt=function(e){var n=e.width,s=e.scaleToFit,a=e.children,o=e.style,l=e.breakAll,i=e.maxLines;if((n||s)&&!k3.isSsr){var h,p,x=Q7e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,_=x.spaceWidth;h=y,p=_}else return FSe(a);return JLt({breakAll:l,children:a,maxLines:i,style:o},h,p,n,s)}return FSe(a)},zSe="#808080",Jj=function(e){var n=e.x,s=n===void 0?0:n,a=e.y,o=a===void 0?0:a,l=e.lineHeight,i=l===void 0?"1em":l,h=e.capHeight,p=h===void 0?"0.71em":h,x=e.scaleToFit,y=x===void 0?!1:x,_=e.textAnchor,j=_===void 0?"start":_,C=e.verticalAnchor,N=C===void 0?"end":C,A=e.fill,E=A===void 0?zSe:A,T=OSe(e,WLt),P=I.useMemo(function(){return eOt({breakAll:T.breakAll,children:T.children,maxLines:T.maxLines,scaleToFit:y,style:T.style,width:T.width})},[T.breakAll,T.children,T.maxLines,y,T.style,T.width]),z=T.dx,F=T.dy,q=T.angle,V=T.className,K=T.breakAll,G=OSe(T,GLt);if(!Gc(s)||!Gc(o))return null;var te=s+(Dn(z)?z:0),ie=o+(Dn(F)?F:0),oe;switch(N){case"start":oe=Gce("calc(".concat(p,")"));break;case"middle":oe=Gce("calc(".concat((P.length-1)/2," * -").concat(i," + (").concat(p," / 2))"));break;default:oe=Gce("calc(".concat(P.length-1," * -").concat(i,")"));break}var ye=[];if(y){var ae=P[0].width,pe=T.width;ye.push("scale(".concat((Dn(pe)?pe/ae:1)/ae,")"))}return q&&ye.push("rotate(".concat(q,", ").concat(te,", ").concat(ie,")")),ye.length&&(G.transform=ye.join(" ")),st.createElement("text",Pfe({},Ia(G,!0),{x:te,y:ie,className:si("recharts-text",V),textAnchor:j,fill:E.includes("url")?zSe:E}),P.map(function(se,he){var ue=se.words.join(K?"":" ");return st.createElement("tspan",{x:te,dy:he===0?oe:i,key:"".concat(ue,"-").concat(he)},ue)}))};function O1(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function tOt(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Gye(t){let e,n,s;t.length!==2?(e=O1,n=(i,h)=>O1(t(i),h),s=(i,h)=>t(i)-h):(e=t===O1||t===tOt?t:rOt,n=t,s=t);function a(i,h,p=0,x=i.length){if(p>>1;n(i[y],h)<0?p=y+1:x=y}while(p>>1;n(i[y],h)<=0?p=y+1:x=y}while(pp&&s(i[y-1],h)>-s(i[y],h)?y-1:y}return{left:a,center:l,right:o}}function rOt(){return 0}function J7e(t){return t===null?NaN:+t}function*nOt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const sOt=Gye(O1),UI=sOt.right;Gye(J7e).center;class BSe extends Map{constructor(e,n=oOt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[s,a]of e)this.set(s,a)}get(e){return super.get($Se(this,e))}has(e){return super.has($Se(this,e))}set(e,n){return super.set(aOt(this,e),n)}delete(e){return super.delete(iOt(this,e))}}function $Se({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):n}function aOt({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):(t.set(s,n),n)}function iOt({_intern:t,_key:e},n){const s=e(n);return t.has(s)&&(n=t.get(s),t.delete(s)),n}function oOt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function lOt(t=O1){if(t===O1)return e9e;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 e9e(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const cOt=Math.sqrt(50),dOt=Math.sqrt(10),uOt=Math.sqrt(2);function jre(t,e,n){const s=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(s)),o=s/Math.pow(10,a),l=o>=cOt?10:o>=dOt?5:o>=uOt?2:1;let i,h,p;return a<0?(p=Math.pow(10,-a)/l,i=Math.round(t*p),h=Math.round(e*p),i/pe&&--h,p=-p):(p=Math.pow(10,a)*l,i=Math.round(t/p),h=Math.round(e/p),i*pe&&--h),h0))return[];if(t===e)return[t];const s=e=a))return[];const i=o-a+1,h=new Array(i);if(s)if(l<0)for(let p=0;p=s)&&(n=s);return n}function qSe(t,e){let n;for(const s of t)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function t9e(t,e,n=0,s=1/0,a){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(a=a===void 0?e9e:lOt(a);s>n;){if(s-n>600){const h=s-n+1,p=e-n+1,x=Math.log(h),y=.5*Math.exp(2*x/3),_=.5*Math.sqrt(x*y*(h-y)/h)*(p-h/2<0?-1:1),j=Math.max(n,Math.floor(e-p*y/h+_)),C=Math.min(s,Math.floor(e+(h-p)*y/h+_));t9e(t,e,j,C,a)}const o=t[e];let l=n,i=s;for(WM(t,n,e),a(t[s],o)>0&&WM(t,n,s);l0;)--i}a(t[n],o)===0?WM(t,n,i):(++i,WM(t,i,s)),i<=e&&(n=i+1),e<=i&&(s=i-1)}return t}function WM(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function hOt(t,e,n){if(t=Float64Array.from(nOt(t)),!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return qSe(t);if(e>=1)return USe(t);var s,a=(s-1)*e,o=Math.floor(a),l=USe(t9e(t,o).subarray(0,o+1)),i=qSe(t.subarray(o+1));return l+(i-l)*(a-o)}}function fOt(t,e,n=J7e){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,a=(s-1)*e,o=Math.floor(a),l=+n(t[o],o,t),i=+n(t[o+1],o+1,t);return l+(i-l)*(a-o)}}function pOt(t,e,n){t=+t,e=+e,n=(a=arguments.length)<2?(e=t,t=0,1):a<3?1:+n;for(var s=-1,a=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(a);++s>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?HL(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?HL(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=gOt.exec(t))?new mh(e[1],e[2],e[3],1):(e=xOt.exec(t))?new mh(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=yOt.exec(t))?HL(e[1],e[2],e[3],e[4]):(e=vOt.exec(t))?HL(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=_Ot.exec(t))?YSe(e[1],e[2]/100,e[3]/100,1):(e=bOt.exec(t))?YSe(e[1],e[2]/100,e[3]/100,e[4]):VSe.hasOwnProperty(t)?GSe(VSe[t]):t==="transparent"?new mh(NaN,NaN,NaN,0):null}function GSe(t){return new mh(t>>16&255,t>>8&255,t&255,1)}function HL(t,e,n,s){return s<=0&&(t=e=n=NaN),new mh(t,e,n,s)}function kOt(t){return t instanceof qI||(t=TE(t)),t?(t=t.rgb(),new mh(t.r,t.g,t.b,t.opacity)):new mh}function Ffe(t,e,n,s){return arguments.length===1?kOt(t):new mh(t,e,n,s??1)}function mh(t,e,n,s){this.r=+t,this.g=+e,this.b=+n,this.opacity=+s}Zye(mh,Ffe,n9e(qI,{brighter(t){return t=t==null?kre:Math.pow(kre,t),new mh(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?CE:Math.pow(CE,t),new mh(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new mh(Aj(this.r),Aj(this.g),Aj(this.b),Nre(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:KSe,formatHex:KSe,formatHex8:NOt,formatRgb:ZSe,toString:ZSe}));function KSe(){return`#${Kw(this.r)}${Kw(this.g)}${Kw(this.b)}`}function NOt(){return`#${Kw(this.r)}${Kw(this.g)}${Kw(this.b)}${Kw((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZSe(){const t=Nre(this.opacity);return`${t===1?"rgb(":"rgba("}${Aj(this.r)}, ${Aj(this.g)}, ${Aj(this.b)}${t===1?")":`, ${t})`}`}function Nre(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Aj(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Kw(t){return t=Aj(t),(t<16?"0":"")+t.toString(16)}function YSe(t,e,n,s){return s<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new om(t,e,n,s)}function s9e(t){if(t instanceof om)return new om(t.h,t.s,t.l,t.opacity);if(t instanceof qI||(t=TE(t)),!t)return new om;if(t instanceof om)return t;t=t.rgb();var e=t.r/255,n=t.g/255,s=t.b/255,a=Math.min(e,n,s),o=Math.max(e,n,s),l=NaN,i=o-a,h=(o+a)/2;return i?(e===o?l=(n-s)/i+(n0&&h<1?0:l,new om(l,i,h,t.opacity)}function SOt(t,e,n,s){return arguments.length===1?s9e(t):new om(t,e,n,s??1)}function om(t,e,n,s){this.h=+t,this.s=+e,this.l=+n,this.opacity=+s}Zye(om,SOt,n9e(qI,{brighter(t){return t=t==null?kre:Math.pow(kre,t),new om(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?CE:Math.pow(CE,t),new om(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,a=2*n-s;return new mh(Kce(t>=240?t-240:t+120,a,s),Kce(t,a,s),Kce(t<120?t+240:t-120,a,s),this.opacity)},clamp(){return new om(XSe(this.h),WL(this.s),WL(this.l),Nre(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=Nre(this.opacity);return`${t===1?"hsl(":"hsla("}${XSe(this.h)}, ${WL(this.s)*100}%, ${WL(this.l)*100}%${t===1?")":`, ${t})`}`}}));function XSe(t){return t=(t||0)%360,t<0?t+360:t}function WL(t){return Math.max(0,Math.min(1,t||0))}function Kce(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 Yye=t=>()=>t;function COt(t,e){return function(n){return t+n*e}}function MOt(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 TOt(t){return(t=+t)==1?a9e:function(e,n){return n-e?MOt(e,n,t):Yye(isNaN(e)?n:e)}}function a9e(t,e){var n=e-t;return n?COt(t,n):Yye(isNaN(t)?e:t)}const QSe=function t(e){var n=TOt(e);function s(a,o){var l=n((a=Ffe(a)).r,(o=Ffe(o)).r),i=n(a.g,o.g),h=n(a.b,o.b),p=a9e(a.opacity,o.opacity);return function(x){return a.r=l(x),a.g=i(x),a.b=h(x),a.opacity=p(x),a+""}}return s.gamma=t,s}(1);function AOt(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,s=e.slice(),a;return function(o){for(a=0;an&&(o=e.slice(n,o),i[l]?i[l]+=o:i[++l]=o),(s=s[0])===(a=a[0])?i[l]?i[l]+=a:i[++l]=a:(i[++l]=null,h.push({i:l,x:Sre(s,a)})),n=Zce.lastIndex;return ne&&(n=t,t=e,e=n),function(s){return Math.max(t,Math.min(e,s))}}function $Ot(t,e,n){var s=t[0],a=t[1],o=e[0],l=e[1];return a2?UOt:$Ot,h=p=null,y}function y(_){return _==null||isNaN(_=+_)?o:(h||(h=i(t.map(s),e,n)))(s(l(_)))}return y.invert=function(_){return l(a((p||(p=i(e,t.map(s),Sre)))(_)))},y.domain=function(_){return arguments.length?(t=Array.from(_,Cre),x()):t.slice()},y.range=function(_){return arguments.length?(e=Array.from(_),x()):e.slice()},y.rangeRound=function(_){return e=Array.from(_),n=Xye,x()},y.clamp=function(_){return arguments.length?(l=_?!0:Fu,x()):l!==Fu},y.interpolate=function(_){return arguments.length?(n=_,x()):n},y.unknown=function(_){return arguments.length?(o=_,y):o},function(_,j){return s=_,a=j,x()}}function Qye(){return pae()(Fu,Fu)}function qOt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Mre(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 CC(t){return t=Mre(Math.abs(t)),t?t[1]:NaN}function VOt(t,e){return function(n,s){for(var a=n.length,o=[],l=0,i=t[0],h=0;a>0&&i>0&&(h+i+1>s&&(i=Math.max(1,s-h)),o.push(n.substring(a-=i,a+i)),!((h+=i+1)>s));)i=t[l=(l+1)%t.length];return o.reverse().join(e)}}function HOt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var WOt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function AE(t){if(!(e=WOt.exec(t)))throw new Error("invalid format: "+t);var e;return new Jye({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]})}AE.prototype=Jye.prototype;function Jye(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+""}Jye.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 GOt(t){e:for(var e=t.length,n=1,s=-1,a;n0&&(s=0);break}return s>0?t.slice(0,s)+t.slice(a+1):t}var i9e;function KOt(t,e){var n=Mre(t,e);if(!n)return t+"";var s=n[0],a=n[1],o=a-(i9e=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,l=s.length;return o===l?s:o>l?s+new Array(o-l+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+Mre(t,Math.max(0,e+o-1))[0]}function eCe(t,e){var n=Mre(t,e);if(!n)return t+"";var s=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+s:s.length>a+1?s.slice(0,a+1)+"."+s.slice(a+1):s+new Array(a-s.length+2).join("0")}const tCe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:qOt,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)=>eCe(t*100,e),r:eCe,s:KOt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function rCe(t){return t}var nCe=Array.prototype.map,sCe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ZOt(t){var e=t.grouping===void 0||t.thousands===void 0?rCe:VOt(nCe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",s=t.currency===void 0?"":t.currency[1]+"",a=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?rCe:HOt(nCe.call(t.numerals,String)),l=t.percent===void 0?"%":t.percent+"",i=t.minus===void 0?"−":t.minus+"",h=t.nan===void 0?"NaN":t.nan+"";function p(y){y=AE(y);var _=y.fill,j=y.align,C=y.sign,N=y.symbol,A=y.zero,E=y.width,T=y.comma,P=y.precision,z=y.trim,F=y.type;F==="n"?(T=!0,F="g"):tCe[F]||(P===void 0&&(P=12),z=!0,F="g"),(A||_==="0"&&j==="=")&&(A=!0,_="0",j="=");var q=N==="$"?n:N==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",V=N==="$"?s:/[%p]/.test(F)?l:"",K=tCe[F],G=/[defgprs%]/.test(F);P=P===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function te(ie){var oe=q,ye=V,ae,pe,se;if(F==="c")ye=K(ie)+ye,ie="";else{ie=+ie;var he=ie<0||1/ie<0;if(ie=isNaN(ie)?h:K(Math.abs(ie),P),z&&(ie=GOt(ie)),he&&+ie==0&&C!=="+"&&(he=!1),oe=(he?C==="("?C:i:C==="-"||C==="("?"":C)+oe,ye=(F==="s"?sCe[8+i9e/3]:"")+ye+(he&&C==="("?")":""),G){for(ae=-1,pe=ie.length;++aese||se>57){ye=(se===46?a+ie.slice(ae+1):ie.slice(ae))+ye,ie=ie.slice(0,ae);break}}}T&&!A&&(ie=e(ie,1/0));var ue=oe.length+ie.length+ye.length,_e=ue>1)+oe+ie+ye+_e.slice(ue);break;default:ie=_e+oe+ie+ye;break}return o(ie)}return te.toString=function(){return y+""},te}function x(y,_){var j=p((y=AE(y),y.type="f",y)),C=Math.max(-8,Math.min(8,Math.floor(CC(_)/3)))*3,N=Math.pow(10,-C),A=sCe[8+C/3];return function(E){return j(N*E)+A}}return{format:p,formatPrefix:x}}var GL,e0e,o9e;YOt({thousands:",",grouping:[3],currency:["$",""]});function YOt(t){return GL=ZOt(t),e0e=GL.format,o9e=GL.formatPrefix,GL}function XOt(t){return Math.max(0,-CC(Math.abs(t)))}function QOt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(CC(e)/3)))*3-CC(Math.abs(t)))}function JOt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,CC(e)-CC(t))+1}function l9e(t,e,n,s){var a=Dfe(t,e,n),o;switch(s=AE(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(t),Math.abs(e));return s.precision==null&&!isNaN(o=QOt(a,l))&&(s.precision=o),o9e(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=JOt(a,Math.max(Math.abs(t),Math.abs(e))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=XOt(a))&&(s.precision=o-(s.type==="%")*2);break}}return e0e(s)}function pv(t){var e=t.domain;return t.ticks=function(n){var s=e();return Lfe(s[0],s[s.length-1],n??10)},t.tickFormat=function(n,s){var a=e();return l9e(a[0],a[a.length-1],n??10,s)},t.nice=function(n){n==null&&(n=10);var s=e(),a=0,o=s.length-1,l=s[a],i=s[o],h,p,x=10;for(i0;){if(p=Ofe(l,i,n),p===h)return s[a]=l,s[o]=i,e(s);if(p>0)l=Math.floor(l/p)*p,i=Math.ceil(i/p)*p;else if(p<0)l=Math.ceil(l*p)/p,i=Math.floor(i*p)/p;else break;h=p}return t},t}function Tre(){var t=Qye();return t.copy=function(){return VI(t,Tre())},hp.apply(t,arguments),pv(t)}function c9e(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,Cre),n):t.slice()},n.unknown=function(s){return arguments.length?(e=s,n):e},n.copy=function(){return c9e(t).unknown(e)},t=arguments.length?Array.from(t,Cre):[0,1],pv(n)}function d9e(t,e){t=t.slice();var n=0,s=t.length-1,a=t[n],o=t[s],l;return oMath.pow(t,e)}function s8t(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 oCe(t){return(e,n)=>-t(-e,n)}function t0e(t){const e=t(aCe,iCe),n=e.domain;let s=10,a,o;function l(){return a=s8t(s),o=n8t(s),n()[0]<0?(a=oCe(a),o=oCe(o),t(e8t,t8t)):t(aCe,iCe),e}return e.base=function(i){return arguments.length?(s=+i,l()):s},e.domain=function(i){return arguments.length?(n(i),l()):n()},e.ticks=i=>{const h=n();let p=h[0],x=h[h.length-1];const y=x0){for(;_<=j;++_)for(C=1;Cx)break;E.push(N)}}else for(;_<=j;++_)for(C=s-1;C>=1;--C)if(N=_>0?C/o(-_):C*o(_),!(Nx)break;E.push(N)}E.length*2{if(i==null&&(i=10),h==null&&(h=s===10?"s":","),typeof h!="function"&&(!(s%1)&&(h=AE(h)).precision==null&&(h.trim=!0),h=e0e(h)),i===1/0)return h;const p=Math.max(1,s*i/e.ticks().length);return x=>{let y=x/o(Math.round(a(x)));return y*sn(d9e(n(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),e}function u9e(){const t=t0e(pae()).domain([1,10]);return t.copy=()=>VI(t,u9e()).base(t.base()),hp.apply(t,arguments),t}function lCe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function cCe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function r0e(t){var e=1,n=t(lCe(e),cCe(e));return n.constant=function(s){return arguments.length?t(lCe(e=+s),cCe(e)):e},pv(n)}function h9e(){var t=r0e(pae());return t.copy=function(){return VI(t,h9e()).constant(t.constant())},hp.apply(t,arguments)}function dCe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function a8t(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function i8t(t){return t<0?-t*t:t*t}function n0e(t){var e=t(Fu,Fu),n=1;function s(){return n===1?t(Fu,Fu):n===.5?t(a8t,i8t):t(dCe(n),dCe(1/n))}return e.exponent=function(a){return arguments.length?(n=+a,s()):n},pv(e)}function s0e(){var t=n0e(pae());return t.copy=function(){return VI(t,s0e()).exponent(t.exponent())},hp.apply(t,arguments),t}function o8t(){return s0e.apply(null,arguments).exponent(.5)}function uCe(t){return Math.sign(t)*t*t}function l8t(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function f9e(){var t=Qye(),e=[0,1],n=!1,s;function a(o){var l=l8t(t(o));return isNaN(l)?s:n?Math.round(l):l}return a.invert=function(o){return t.invert(uCe(o))},a.domain=function(o){return arguments.length?(t.domain(o),a):t.domain()},a.range=function(o){return arguments.length?(t.range((e=Array.from(o,Cre)).map(uCe)),a):e.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(n=!!o,a):n},a.clamp=function(o){return arguments.length?(t.clamp(o),a):t.clamp()},a.unknown=function(o){return arguments.length?(s=o,a):s},a.copy=function(){return f9e(t.domain(),e).round(n).clamp(t.clamp()).unknown(s)},hp.apply(a,arguments),pv(a)}function p9e(){var t=[],e=[],n=[],s;function a(){var l=0,i=Math.max(1,e.length);for(n=new Array(i-1);++l0?n[i-1]:t[0],i=n?[s[n-1],e]:[s[p-1],s[p]]},l.unknown=function(h){return arguments.length&&(o=h),l},l.thresholds=function(){return s.slice()},l.copy=function(){return m9e().domain([t,e]).range(a).unknown(o)},hp.apply(pv(l),arguments)}function g9e(){var t=[.5],e=[0,1],n,s=1;function a(o){return o!=null&&o<=o?e[UI(t,o,0,s)]:n}return a.domain=function(o){return arguments.length?(t=Array.from(o),s=Math.min(t.length,e.length-1),a):t.slice()},a.range=function(o){return arguments.length?(e=Array.from(o),s=Math.min(t.length,e.length-1),a):e.slice()},a.invertExtent=function(o){var l=e.indexOf(o);return[t[l-1],t[l]]},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return g9e().domain(t).range(e).unknown(n)},hp.apply(a,arguments)}const Yce=new Date,Xce=new Date;function Xc(t,e,n,s){function a(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(t(o=new Date(+o)),o),a.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),a.round=o=>{const l=a(o),i=a.ceil(o);return o-l(e(o=new Date(+o),l==null?1:Math.floor(l)),o),a.range=(o,l,i)=>{const h=[];if(o=a.ceil(o),i=i==null?1:Math.floor(i),!(o0))return h;let p;do h.push(p=new Date(+o)),e(o,i),t(o);while(pXc(l=>{if(l>=l)for(;t(l),!o(l);)l.setTime(l-1)},(l,i)=>{if(l>=l)if(i<0)for(;++i<=0;)for(;e(l,-1),!o(l););else for(;--i>=0;)for(;e(l,1),!o(l););}),n&&(a.count=(o,l)=>(Yce.setTime(+o),Xce.setTime(+l),t(Yce),t(Xce),Math.floor(n(Yce,Xce))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(s?l=>s(l)%o===0:l=>a.count(0,l)%o===0):a)),a}const Are=Xc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Are.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Xc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Are);Are.range;const Rx=1e3,Gf=Rx*60,Fx=Gf*60,uy=Fx*24,a0e=uy*7,hCe=uy*30,Qce=uy*365,Zw=Xc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Rx)},(t,e)=>(e-t)/Rx,t=>t.getUTCSeconds());Zw.range;const i0e=Xc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Rx)},(t,e)=>{t.setTime(+t+e*Gf)},(t,e)=>(e-t)/Gf,t=>t.getMinutes());i0e.range;const o0e=Xc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Gf)},(t,e)=>(e-t)/Gf,t=>t.getUTCMinutes());o0e.range;const l0e=Xc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Rx-t.getMinutes()*Gf)},(t,e)=>{t.setTime(+t+e*Fx)},(t,e)=>(e-t)/Fx,t=>t.getHours());l0e.range;const c0e=Xc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Fx)},(t,e)=>(e-t)/Fx,t=>t.getUTCHours());c0e.range;const HI=Xc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Gf)/uy,t=>t.getDate()-1);HI.range;const mae=Xc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/uy,t=>t.getUTCDate()-1);mae.range;const x9e=Xc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/uy,t=>Math.floor(t/uy));x9e.range;function hk(t){return Xc(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())*Gf)/a0e)}const gae=hk(0),Ere=hk(1),c8t=hk(2),d8t=hk(3),MC=hk(4),u8t=hk(5),h8t=hk(6);gae.range;Ere.range;c8t.range;d8t.range;MC.range;u8t.range;h8t.range;function fk(t){return Xc(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)/a0e)}const xae=fk(0),Ire=fk(1),f8t=fk(2),p8t=fk(3),TC=fk(4),m8t=fk(5),g8t=fk(6);xae.range;Ire.range;f8t.range;p8t.range;TC.range;m8t.range;g8t.range;const d0e=Xc(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());d0e.range;const u0e=Xc(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());u0e.range;const hy=Xc(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());hy.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Xc(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)});hy.range;const fy=Xc(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());fy.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Xc(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)});fy.range;function y9e(t,e,n,s,a,o){const l=[[Zw,1,Rx],[Zw,5,5*Rx],[Zw,15,15*Rx],[Zw,30,30*Rx],[o,1,Gf],[o,5,5*Gf],[o,15,15*Gf],[o,30,30*Gf],[a,1,Fx],[a,3,3*Fx],[a,6,6*Fx],[a,12,12*Fx],[s,1,uy],[s,2,2*uy],[n,1,a0e],[e,1,hCe],[e,3,3*hCe],[t,1,Qce]];function i(p,x,y){const _=xA).right(l,_);if(j===l.length)return t.every(Dfe(p/Qce,x/Qce,y));if(j===0)return Are.every(Math.max(Dfe(p,x,y),1));const[C,N]=l[_/l[j-1][2]53)return null;"w"in Te||(Te.w=1),"Z"in Te?(me=ede(GM(Te.y,0,1)),yt=me.getUTCDay(),me=yt>4||yt===0?Ire.ceil(me):Ire(me),me=mae.offset(me,(Te.V-1)*7),Te.y=me.getUTCFullYear(),Te.m=me.getUTCMonth(),Te.d=me.getUTCDate()+(Te.w+6)%7):(me=Jce(GM(Te.y,0,1)),yt=me.getDay(),me=yt>4||yt===0?Ere.ceil(me):Ere(me),me=HI.offset(me,(Te.V-1)*7),Te.y=me.getFullYear(),Te.m=me.getMonth(),Te.d=me.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),yt="Z"in Te?ede(GM(Te.y,0,1)).getUTCDay():Jce(GM(Te.y,0,1)).getDay(),Te.m=0,Te.d="W"in Te?(Te.w+6)%7+Te.W*7-(yt+5)%7:Te.w+Te.U*7-(yt+6)%7);return"Z"in Te?(Te.H+=Te.Z/100|0,Te.M+=Te.Z%100,ede(Te)):Jce(Te)}}function K(Fe,be,tt,Te){for(var Ke=0,me=be.length,yt=tt.length,rt,at;Ke=yt)return-1;if(rt=be.charCodeAt(Ke++),rt===37){if(rt=be.charAt(Ke++),at=F[rt in fCe?be.charAt(Ke++):rt],!at||(Te=at(Fe,tt,Te))<0)return-1}else if(rt!=tt.charCodeAt(Te++))return-1}return Te}function G(Fe,be,tt){var Te=p.exec(be.slice(tt));return Te?(Fe.p=x.get(Te[0].toLowerCase()),tt+Te[0].length):-1}function te(Fe,be,tt){var Te=j.exec(be.slice(tt));return Te?(Fe.w=C.get(Te[0].toLowerCase()),tt+Te[0].length):-1}function ie(Fe,be,tt){var Te=y.exec(be.slice(tt));return Te?(Fe.w=_.get(Te[0].toLowerCase()),tt+Te[0].length):-1}function oe(Fe,be,tt){var Te=E.exec(be.slice(tt));return Te?(Fe.m=T.get(Te[0].toLowerCase()),tt+Te[0].length):-1}function ye(Fe,be,tt){var Te=N.exec(be.slice(tt));return Te?(Fe.m=A.get(Te[0].toLowerCase()),tt+Te[0].length):-1}function ae(Fe,be,tt){return K(Fe,e,be,tt)}function pe(Fe,be,tt){return K(Fe,n,be,tt)}function se(Fe,be,tt){return K(Fe,s,be,tt)}function he(Fe){return l[Fe.getDay()]}function ue(Fe){return o[Fe.getDay()]}function _e(Fe){return h[Fe.getMonth()]}function Ae(Fe){return i[Fe.getMonth()]}function Ce(Fe){return a[+(Fe.getHours()>=12)]}function Se(Fe){return 1+~~(Fe.getMonth()/3)}function ge(Fe){return l[Fe.getUTCDay()]}function Le(Fe){return o[Fe.getUTCDay()]}function ke(Fe){return h[Fe.getUTCMonth()]}function Be(Fe){return i[Fe.getUTCMonth()]}function Ee(Fe){return a[+(Fe.getUTCHours()>=12)]}function Ue(Fe){return 1+~~(Fe.getUTCMonth()/3)}return{format:function(Fe){var be=q(Fe+="",P);return be.toString=function(){return Fe},be},parse:function(Fe){var be=V(Fe+="",!1);return be.toString=function(){return Fe},be},utcFormat:function(Fe){var be=q(Fe+="",z);return be.toString=function(){return Fe},be},utcParse:function(Fe){var be=V(Fe+="",!0);return be.toString=function(){return Fe},be}}}var fCe={"-":"",_:" ",0:"0"},bd=/^\s*\d+/,w8t=/^%/,j8t=/[\\^$*+?|[\]().{}]/g;function ao(t,e,n){var s=t<0?"-":"",a=(s?-t:t)+"",o=a.length;return s+(o[e.toLowerCase(),n]))}function N8t(t,e,n){var s=bd.exec(e.slice(n,n+1));return s?(t.w=+s[0],n+s[0].length):-1}function S8t(t,e,n){var s=bd.exec(e.slice(n,n+1));return s?(t.u=+s[0],n+s[0].length):-1}function C8t(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.U=+s[0],n+s[0].length):-1}function M8t(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.V=+s[0],n+s[0].length):-1}function T8t(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.W=+s[0],n+s[0].length):-1}function pCe(t,e,n){var s=bd.exec(e.slice(n,n+4));return s?(t.y=+s[0],n+s[0].length):-1}function mCe(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function A8t(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 E8t(t,e,n){var s=bd.exec(e.slice(n,n+1));return s?(t.q=s[0]*3-3,n+s[0].length):-1}function I8t(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.m=s[0]-1,n+s[0].length):-1}function gCe(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.d=+s[0],n+s[0].length):-1}function P8t(t,e,n){var s=bd.exec(e.slice(n,n+3));return s?(t.m=0,t.d=+s[0],n+s[0].length):-1}function xCe(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.H=+s[0],n+s[0].length):-1}function L8t(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.M=+s[0],n+s[0].length):-1}function O8t(t,e,n){var s=bd.exec(e.slice(n,n+2));return s?(t.S=+s[0],n+s[0].length):-1}function D8t(t,e,n){var s=bd.exec(e.slice(n,n+3));return s?(t.L=+s[0],n+s[0].length):-1}function R8t(t,e,n){var s=bd.exec(e.slice(n,n+6));return s?(t.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function F8t(t,e,n){var s=w8t.exec(e.slice(n,n+1));return s?n+s[0].length:-1}function z8t(t,e,n){var s=bd.exec(e.slice(n));return s?(t.Q=+s[0],n+s[0].length):-1}function B8t(t,e,n){var s=bd.exec(e.slice(n));return s?(t.s=+s[0],n+s[0].length):-1}function yCe(t,e){return ao(t.getDate(),e,2)}function $8t(t,e){return ao(t.getHours(),e,2)}function U8t(t,e){return ao(t.getHours()%12||12,e,2)}function q8t(t,e){return ao(1+HI.count(hy(t),t),e,3)}function v9e(t,e){return ao(t.getMilliseconds(),e,3)}function V8t(t,e){return v9e(t,e)+"000"}function H8t(t,e){return ao(t.getMonth()+1,e,2)}function W8t(t,e){return ao(t.getMinutes(),e,2)}function G8t(t,e){return ao(t.getSeconds(),e,2)}function K8t(t){var e=t.getDay();return e===0?7:e}function Z8t(t,e){return ao(gae.count(hy(t)-1,t),e,2)}function _9e(t){var e=t.getDay();return e>=4||e===0?MC(t):MC.ceil(t)}function Y8t(t,e){return t=_9e(t),ao(MC.count(hy(t),t)+(hy(t).getDay()===4),e,2)}function X8t(t){return t.getDay()}function Q8t(t,e){return ao(Ere.count(hy(t)-1,t),e,2)}function J8t(t,e){return ao(t.getFullYear()%100,e,2)}function eDt(t,e){return t=_9e(t),ao(t.getFullYear()%100,e,2)}function tDt(t,e){return ao(t.getFullYear()%1e4,e,4)}function rDt(t,e){var n=t.getDay();return t=n>=4||n===0?MC(t):MC.ceil(t),ao(t.getFullYear()%1e4,e,4)}function nDt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ao(e/60|0,"0",2)+ao(e%60,"0",2)}function vCe(t,e){return ao(t.getUTCDate(),e,2)}function sDt(t,e){return ao(t.getUTCHours(),e,2)}function aDt(t,e){return ao(t.getUTCHours()%12||12,e,2)}function iDt(t,e){return ao(1+mae.count(fy(t),t),e,3)}function b9e(t,e){return ao(t.getUTCMilliseconds(),e,3)}function oDt(t,e){return b9e(t,e)+"000"}function lDt(t,e){return ao(t.getUTCMonth()+1,e,2)}function cDt(t,e){return ao(t.getUTCMinutes(),e,2)}function dDt(t,e){return ao(t.getUTCSeconds(),e,2)}function uDt(t){var e=t.getUTCDay();return e===0?7:e}function hDt(t,e){return ao(xae.count(fy(t)-1,t),e,2)}function w9e(t){var e=t.getUTCDay();return e>=4||e===0?TC(t):TC.ceil(t)}function fDt(t,e){return t=w9e(t),ao(TC.count(fy(t),t)+(fy(t).getUTCDay()===4),e,2)}function pDt(t){return t.getUTCDay()}function mDt(t,e){return ao(Ire.count(fy(t)-1,t),e,2)}function gDt(t,e){return ao(t.getUTCFullYear()%100,e,2)}function xDt(t,e){return t=w9e(t),ao(t.getUTCFullYear()%100,e,2)}function yDt(t,e){return ao(t.getUTCFullYear()%1e4,e,4)}function vDt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?TC(t):TC.ceil(t),ao(t.getUTCFullYear()%1e4,e,4)}function _Dt(){return"+0000"}function _Ce(){return"%"}function bCe(t){return+t}function wCe(t){return Math.floor(+t/1e3)}var m4,j9e,k9e;bDt({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 bDt(t){return m4=b8t(t),j9e=m4.format,m4.parse,k9e=m4.utcFormat,m4.utcParse,m4}function wDt(t){return new Date(t)}function jDt(t){return t instanceof Date?+t:+new Date(+t)}function h0e(t,e,n,s,a,o,l,i,h,p){var x=Qye(),y=x.invert,_=x.domain,j=p(".%L"),C=p(":%S"),N=p("%I:%M"),A=p("%I %p"),E=p("%a %d"),T=p("%b %d"),P=p("%B"),z=p("%Y");function F(q){return(h(q)e(a/(t.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,o)=>hOt(t,o/s))},n.copy=function(){return M9e(e).domain(t)},by.apply(n,arguments)}function vae(){var t=0,e=.5,n=1,s=1,a,o,l,i,h,p=Fu,x,y=!1,_;function j(N){return isNaN(N=+N)?_:(N=.5+((N=+x(N))-o)*(s*Ne}var I9e=ADt,EDt=_ae,IDt=I9e,PDt=j3;function LDt(t){return t&&t.length?EDt(t,PDt,IDt):void 0}var ODt=LDt;const bae=Hi(ODt);function DDt(t,e){return tt.e^o.s<0?1:-1;for(s=o.d.length,a=t.d.length,e=0,n=st.d[e]^o.s<0?1:-1;return s===a?0:s>a^o.s<0?1:-1};bs.decimalPlaces=bs.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*ul;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};bs.dividedBy=bs.div=function(t){return ey(this,new this.constructor(t))};bs.dividedToIntegerBy=bs.idiv=function(t){var e=this,n=e.constructor;return zo(ey(e,new n(t),0,1),n.precision)};bs.equals=bs.eq=function(t){return!this.cmp(t)};bs.exponent=function(){return Pc(this)};bs.greaterThan=bs.gt=function(t){return this.cmp(t)>0};bs.greaterThanOrEqualTo=bs.gte=function(t){return this.cmp(t)>=0};bs.isInteger=bs.isint=function(){return this.e>this.d.length-2};bs.isNegative=bs.isneg=function(){return this.s<0};bs.isPositive=bs.ispos=function(){return this.s>0};bs.isZero=function(){return this.s===0};bs.lessThan=bs.lt=function(t){return this.cmp(t)<0};bs.lessThanOrEqualTo=bs.lte=function(t){return this.cmp(t)<1};bs.logarithm=bs.log=function(t){var e,n=this,s=n.constructor,a=s.precision,o=a+5;if(t===void 0)t=new s(10);else if(t=new s(t),t.s<1||t.eq(Yh))throw Error(op+"NaN");if(n.s<1)throw Error(op+(n.s?"NaN":"-Infinity"));return n.eq(Yh)?new s(0):(Sl=!1,e=ey(EE(n,o),EE(t,o),o),Sl=!0,zo(e,a))};bs.minus=bs.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?R9e(e,t):O9e(e,(t.s=-t.s,t))};bs.modulo=bs.mod=function(t){var e,n=this,s=n.constructor,a=s.precision;if(t=new s(t),!t.s)throw Error(op+"NaN");return n.s?(Sl=!1,e=ey(n,t,0,1).times(t),Sl=!0,n.minus(e)):zo(new s(n),a)};bs.naturalExponential=bs.exp=function(){return D9e(this)};bs.naturalLogarithm=bs.ln=function(){return EE(this)};bs.negated=bs.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};bs.plus=bs.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?O9e(e,t):R9e(e,(t.s=-t.s,t))};bs.precision=bs.sd=function(t){var e,n,s,a=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Ej+t);if(e=Pc(a)+1,s=a.d.length-1,n=s*ul+1,s=a.d[s],s){for(;s%10==0;s/=10)n--;for(s=a.d[0];s>=10;s/=10)n++}return t&&e>n?e:n};bs.squareRoot=bs.sqrt=function(){var t,e,n,s,a,o,l,i=this,h=i.constructor;if(i.s<1){if(!i.s)return new h(0);throw Error(op+"NaN")}for(t=Pc(i),Sl=!1,a=Math.sqrt(+i),a==0||a==1/0?(e=fg(i.d),(e.length+t)%2==0&&(e+="0"),a=Math.sqrt(e),t=C3((t+1)/2)-(t<0||t%2),a==1/0?e="5e"+t:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),s=new h(e)):s=new h(a.toString()),n=h.precision,a=l=n+3;;)if(o=s,s=o.plus(ey(i,o,l+2)).times(.5),fg(o.d).slice(0,l)===(e=fg(s.d)).slice(0,l)){if(e=e.slice(l-3,l+1),a==l&&e=="4999"){if(zo(o,n+1,0),o.times(o).eq(i)){s=o;break}}else if(e!="9999")break;l+=4}return Sl=!0,zo(s,n)};bs.times=bs.mul=function(t){var e,n,s,a,o,l,i,h,p,x=this,y=x.constructor,_=x.d,j=(t=new y(t)).d;if(!x.s||!t.s)return new y(0);for(t.s*=x.s,n=x.e+t.e,h=_.length,p=j.length,h=0;){for(e=0,a=h+s;a>s;)i=o[a]+j[s]*_[a-s-1]+e,o[a--]=i%od|0,e=i/od|0;o[a]=(o[a]+e)%od|0}for(;!o[--l];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Sl?zo(t,y.precision):t};bs.toDecimalPlaces=bs.todp=function(t,e){var n=this,s=n.constructor;return n=new s(n),t===void 0?n:(Fg(t,0,S3),e===void 0?e=s.rounding:Fg(e,0,8),zo(n,t+Pc(n)+1,e))};bs.toExponential=function(t,e){var n,s=this,a=s.constructor;return t===void 0?n=ek(s,!0):(Fg(t,0,S3),e===void 0?e=a.rounding:Fg(e,0,8),s=zo(new a(s),t+1,e),n=ek(s,!0,t+1)),n};bs.toFixed=function(t,e){var n,s,a=this,o=a.constructor;return t===void 0?ek(a):(Fg(t,0,S3),e===void 0?e=o.rounding:Fg(e,0,8),s=zo(new o(a),t+Pc(a)+1,e),n=ek(s.abs(),!1,t+Pc(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};bs.toInteger=bs.toint=function(){var t=this,e=t.constructor;return zo(new e(t),Pc(t)+1,e.rounding)};bs.toNumber=function(){return+this};bs.toPower=bs.pow=function(t){var e,n,s,a,o,l,i=this,h=i.constructor,p=12,x=+(t=new h(t));if(!t.s)return new h(Yh);if(i=new h(i),!i.s){if(t.s<1)throw Error(op+"Infinity");return i}if(i.eq(Yh))return i;if(s=h.precision,t.eq(Yh))return zo(i,s);if(e=t.e,n=t.d.length-1,l=e>=n,o=i.s,l){if((n=x<0?-x:x)<=L9e){for(a=new h(Yh),e=Math.ceil(s/ul+4),Sl=!1;n%2&&(a=a.times(i),NCe(a.d,e)),n=C3(n/2),n!==0;)i=i.times(i),NCe(i.d,e);return Sl=!0,t.s<0?new h(Yh).div(a):zo(a,s)}}else if(o<0)throw Error(op+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,i.s=1,Sl=!1,a=t.times(EE(i,s+p)),Sl=!0,a=D9e(a),a.s=o,a};bs.toPrecision=function(t,e){var n,s,a=this,o=a.constructor;return t===void 0?(n=Pc(a),s=ek(a,n<=o.toExpNeg||n>=o.toExpPos)):(Fg(t,1,S3),e===void 0?e=o.rounding:Fg(e,0,8),a=zo(new o(a),t,e),n=Pc(a),s=ek(a,t<=n||n<=o.toExpNeg,t)),s};bs.toSignificantDigits=bs.tosd=function(t,e){var n=this,s=n.constructor;return t===void 0?(t=s.precision,e=s.rounding):(Fg(t,1,S3),e===void 0?e=s.rounding:Fg(e,0,8)),zo(new s(n),t,e)};bs.toString=bs.valueOf=bs.val=bs.toJSON=bs[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Pc(t),n=t.constructor;return ek(t,e<=n.toExpNeg||e>=n.toExpPos)};function O9e(t,e){var n,s,a,o,l,i,h,p,x=t.constructor,y=x.precision;if(!t.s||!e.s)return e.s||(e=new x(t)),Sl?zo(e,y):e;if(h=t.d,p=e.d,l=t.e,a=e.e,h=h.slice(),o=l-a,o){for(o<0?(s=h,o=-o,i=p.length):(s=p,a=l,i=h.length),l=Math.ceil(y/ul),i=l>i?l+1:i+1,o>i&&(o=i,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(i=h.length,o=p.length,i-o<0&&(o=i,s=p,p=h,h=s),n=0;o;)n=(h[--o]=h[o]+p[o]+n)/od|0,h[o]%=od;for(n&&(h.unshift(n),++a),i=h.length;h[--i]==0;)h.pop();return e.d=h,e.e=a,Sl?zo(e,y):e}function Fg(t,e,n){if(t!==~~t||tn)throw Error(Ej+t)}function fg(t){var e,n,s,a=t.length-1,o="",l=t[0];if(a>0){for(o+=l,e=1;el?1:-1;else for(i=h=0;ia[i]?1:-1;break}return h}function n(s,a,o){for(var l=0;o--;)s[o]-=l,l=s[o]1;)s.shift()}return function(s,a,o,l){var i,h,p,x,y,_,j,C,N,A,E,T,P,z,F,q,V,K,G=s.constructor,te=s.s==a.s?1:-1,ie=s.d,oe=a.d;if(!s.s)return new G(s);if(!a.s)throw Error(op+"Division by zero");for(h=s.e-a.e,V=oe.length,F=ie.length,j=new G(te),C=j.d=[],p=0;oe[p]==(ie[p]||0);)++p;if(oe[p]>(ie[p]||0)&&--h,o==null?T=o=G.precision:l?T=o+(Pc(s)-Pc(a))+1:T=o,T<0)return new G(0);if(T=T/ul+2|0,p=0,V==1)for(x=0,oe=oe[0],T++;(p1&&(oe=t(oe,x),ie=t(ie,x),V=oe.length,F=ie.length),z=V,N=ie.slice(0,V),A=N.length;A=od/2&&++q;do x=0,i=e(oe,N,V,A),i<0?(E=N[0],V!=A&&(E=E*od+(N[1]||0)),x=E/q|0,x>1?(x>=od&&(x=od-1),y=t(oe,x),_=y.length,A=N.length,i=e(y,N,_,A),i==1&&(x--,n(y,V<_?K:oe,_))):(x==0&&(i=x=1),y=oe.slice()),_=y.length,_16)throw Error(m0e+Pc(t));if(!t.s)return new x(Yh);for(Sl=!1,i=y,l=new x(.03125);t.abs().gte(.1);)t=t.times(l),p+=5;for(s=Math.log(Ew(2,p))/Math.LN10*2+5|0,i+=s,n=a=o=new x(Yh),x.precision=i;;){if(a=zo(a.times(t),i),n=n.times(++h),l=o.plus(ey(a,n,i)),fg(l.d).slice(0,i)===fg(o.d).slice(0,i)){for(;p--;)o=zo(o.times(o),i);return x.precision=y,e==null?(Sl=!0,zo(o,y)):o}o=l}}function Pc(t){for(var e=t.e*ul,n=t.d[0];n>=10;n/=10)e++;return e}function tde(t,e,n){if(e>t.LN10.sd())throw Sl=!0,n&&(t.precision=n),Error(op+"LN10 precision limit exceeded");return zo(new t(t.LN10),e)}function A0(t){for(var e="";t--;)e+="0";return e}function EE(t,e){var n,s,a,o,l,i,h,p,x,y=1,_=10,j=t,C=j.d,N=j.constructor,A=N.precision;if(j.s<1)throw Error(op+(j.s?"NaN":"-Infinity"));if(j.eq(Yh))return new N(0);if(e==null?(Sl=!1,p=A):p=e,j.eq(10))return e==null&&(Sl=!0),tde(N,p);if(p+=_,N.precision=p,n=fg(C),s=n.charAt(0),o=Pc(j),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)j=j.times(t),n=fg(j.d),s=n.charAt(0),y++;o=Pc(j),s>1?(j=new N("0."+n),o++):j=new N(s+"."+n.slice(1))}else return h=tde(N,p+2,A).times(o+""),j=EE(new N(s+"."+n.slice(1)),p-_).plus(h),N.precision=A,e==null?(Sl=!0,zo(j,A)):j;for(i=l=j=ey(j.minus(Yh),j.plus(Yh),p),x=zo(j.times(j),p),a=3;;){if(l=zo(l.times(x),p),h=i.plus(ey(l,new N(a),p)),fg(h.d).slice(0,p)===fg(i.d).slice(0,p))return i=i.times(2),o!==0&&(i=i.plus(tde(N,p+2,A).times(o+""))),i=ey(i,new N(y),p),N.precision=A,e==null?(Sl=!0,zo(i,A)):i;i=h,a+=2}}function kCe(t,e){var n,s,a;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(a=e.length;e.charCodeAt(a-1)===48;)--a;if(e=e.slice(s,a),e){if(a-=s,n=n-s-1,t.e=C3(n/ul),t.d=[],s=(n+1)%ul,n<0&&(s+=ul),sPre||t.e<-Pre))throw Error(m0e+n)}else t.s=0,t.e=0,t.d=[0];return t}function zo(t,e,n){var s,a,o,l,i,h,p,x,y=t.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=e-l,s<0)s+=ul,a=e,p=y[x=0];else{if(x=Math.ceil((s+1)/ul),o=y.length,x>=o)return t;for(p=o=y[x],l=1;o>=10;o/=10)l++;s%=ul,a=s-ul+l}if(n!==void 0&&(o=Ew(10,l-a-1),i=p/o%10|0,h=e<0||y[x+1]!==void 0||p%o,h=n<4?(i||h)&&(n==0||n==(t.s<0?3:2)):i>5||i==5&&(n==4||h||n==6&&(s>0?a>0?p/Ew(10,l-a):0:y[x-1])%10&1||n==(t.s<0?8:7))),e<1||!y[0])return h?(o=Pc(t),y.length=1,e=e-o-1,y[0]=Ew(10,(ul-e%ul)%ul),t.e=C3(-e/ul)||0):(y.length=1,y[0]=t.e=t.s=0),t;if(s==0?(y.length=x,o=1,x--):(y.length=x+1,o=Ew(10,ul-s),y[x]=a>0?(p/Ew(10,l-a)%Ew(10,a)|0)*o:0),h)for(;;)if(x==0){(y[0]+=o)==od&&(y[0]=1,++t.e);break}else{if(y[x]+=o,y[x]!=od)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(Sl&&(t.e>Pre||t.e<-Pre))throw Error(m0e+Pc(t));return t}function R9e(t,e){var n,s,a,o,l,i,h,p,x,y,_=t.constructor,j=_.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new _(t),Sl?zo(e,j):e;if(h=t.d,y=e.d,s=e.e,p=t.e,h=h.slice(),l=p-s,l){for(x=l<0,x?(n=h,l=-l,i=y.length):(n=y,s=p,i=h.length),a=Math.max(Math.ceil(j/ul),i)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=h.length,i=y.length,x=a0;--a)h[i++]=0;for(a=y.length;a>l;){if(h[--a]0?o=o.charAt(0)+"."+o.slice(1)+A0(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+A0(-a-1)+o,n&&(s=n-l)>0&&(o+=A0(s))):a>=l?(o+=A0(a+1-l),n&&(s=n-a-1)>0&&(o=o+"."+A0(s))):((s=a+1)0&&(a+1===l&&(o+="."),o+=A0(s))),t.s<0?"-"+o:o}function NCe(t,e){if(t.length>e)return t.length=e,!0}function F9e(t){var e,n,s;function a(o){var l=this;if(!(l instanceof a))return new a(o);if(l.constructor=a,o instanceof a){l.s=o.s,l.e=o.e,l.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Ej+o);if(o>0)l.s=1;else if(o<0)o=-o,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(o===~~o&&o<1e7){l.e=0,l.d=[o];return}return kCe(l,o.toString())}else if(typeof o!="string")throw Error(Ej+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,nRt.test(o))kCe(l,o);else throw Error(Ej+o)}if(a.prototype=bs,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=F9e,a.config=a.set=sRt,t===void 0&&(t={}),t)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=a[e+1]&&s<=a[e+2])this[n]=s;else throw Error(Ej+n+": "+s);if((s=t[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Ej+n+": "+s);return this}var g0e=F9e(rRt);Yh=new g0e(1);const Lo=g0e;function aRt(t){return cRt(t)||lRt(t)||oRt(t)||iRt()}function iRt(){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 oRt(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 lRt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function cRt(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=e?n.apply(void 0,a):t(e-l,SCe(function(){for(var i=arguments.length,h=new Array(i),p=0;pt.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],s=!0,a=!1,o=void 0;try{for(var l=t[Symbol.iterator](),i;!(s=(i=l.next()).done)&&(n.push(i.value),!(e&&n.length===e));s=!0);}catch(h){a=!0,o=h}finally{try{!s&&l.return!=null&&l.return()}finally{if(a)throw o}}return n}}function kRt(t){if(Array.isArray(t))return t}function q9e(t){var e=IE(t,2),n=e[0],s=e[1],a=n,o=s;return n>s&&(a=s,o=n),[a,o]}function V9e(t,e,n){if(t.lte(0))return new Lo(0);var s=Nae.getDigitCount(t.toNumber()),a=new Lo(10).pow(s),o=t.div(a),l=s!==1?.05:.1,i=new Lo(Math.ceil(o.div(l).toNumber())).add(n).mul(l),h=i.mul(a);return e?h:new Lo(Math.ceil(h))}function NRt(t,e,n){var s=1,a=new Lo(t);if(!a.isint()&&n){var o=Math.abs(t);o<1?(s=new Lo(10).pow(Nae.getDigitCount(t)-1),a=new Lo(Math.floor(a.div(s).toNumber())).mul(s)):o>1&&(a=new Lo(Math.floor(t)))}else t===0?a=new Lo(Math.floor((e-1)/2)):n||(a=new Lo(Math.floor(t)));var l=Math.floor((e-1)/2),i=fRt(hRt(function(h){return a.add(new Lo(h-l).mul(s)).toNumber()}),Ufe);return i(0,e)}function H9e(t,e,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Lo(0),tickMin:new Lo(0),tickMax:new Lo(0)};var o=V9e(new Lo(e).sub(t).div(n-1),s,a),l;t<=0&&e>=0?l=new Lo(0):(l=new Lo(t).add(e).div(2),l=l.sub(new Lo(l).mod(o)));var i=Math.ceil(l.sub(t).div(o).toNumber()),h=Math.ceil(new Lo(e).sub(l).div(o).toNumber()),p=i+h+1;return p>n?H9e(t,e,n,s,a+1):(p0?h+(n-p):h,i=e>0?i:i+(n-p)),{step:o,tickMin:l.sub(new Lo(i).mul(o)),tickMax:l.add(new Lo(h).mul(o))})}function SRt(t){var e=IE(t,2),n=e[0],s=e[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(a,2),i=q9e([n,s]),h=IE(i,2),p=h[0],x=h[1];if(p===-1/0||x===1/0){var y=x===1/0?[p].concat(Vfe(Ufe(0,a-1).map(function(){return 1/0}))):[].concat(Vfe(Ufe(0,a-1).map(function(){return-1/0})),[x]);return n>s?qfe(y):y}if(p===x)return NRt(p,a,o);var _=H9e(p,x,l,o),j=_.step,C=_.tickMin,N=_.tickMax,A=Nae.rangeStep(C,N.add(new Lo(.1).mul(j)),j);return n>s?qfe(A):A}function CRt(t,e){var n=IE(t,2),s=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=q9e([s,a]),i=IE(l,2),h=i[0],p=i[1];if(h===-1/0||p===1/0)return[s,a];if(h===p)return[h];var x=Math.max(e,2),y=V9e(new Lo(p).sub(h).div(x-1),o,0),_=[].concat(Vfe(Nae.rangeStep(new Lo(h),new Lo(p).sub(new Lo(.99).mul(y)),y)),[p]);return s>a?qfe(_):_}var MRt=$9e(SRt),TRt=$9e(CRt),ARt="Invariant failed";function tk(t,e){throw new Error(ARt)}var ERt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function AC(t){"@babel/helpers - typeof";return AC=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},AC(t)}function Lre(){return Lre=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 FRt(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 zRt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BRt(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]:[],a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(i<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var h=o.range,p=0;p0?a[p-1].coordinate:a[i-1].coordinate,y=a[p].coordinate,_=p>=i-1?a[0].coordinate:a[p+1].coordinate,j=void 0;if(Du(y-x)!==Du(_-y)){var C=[];if(Du(_-y)===Du(h[1]-h[0])){j=_;var N=y+h[1]-h[0];C[0]=Math.min(N,(N+x)/2),C[1]=Math.max(N,(N+x)/2)}else{j=x;var A=_+h[1]-h[0];C[0]=Math.min(y,(A+y)/2),C[1]=Math.max(y,(A+y)/2)}var E=[Math.min(y,(j+y)/2),Math.max(y,(j+y)/2)];if(e>E[0]&&e<=E[1]||e>=C[0]&&e<=C[1]){l=a[p].index;break}}else{var T=Math.min(x,_),P=Math.max(x,_);if(e>(T+y)/2&&e<=(P+y)/2){l=a[p].index;break}}}else for(var z=0;z0&&z(s[z].coordinate+s[z-1].coordinate)/2&&e<=(s[z].coordinate+s[z+1].coordinate)/2||z===i-1&&e>(s[z].coordinate+s[z-1].coordinate)/2){l=s[z].index;break}return l},x0e=function(e){var n,s=e,a=s.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Zl(Zl({},e.type.defaultProps),e.props):e.props,l=o.stroke,i=o.fill,h;switch(a){case"Line":h=l;break;case"Area":case"Radar":h=l&&l!=="none"?l:i;break;default:h=i;break}return h},nFt=function(e){var n=e.barSize,s=e.totalSize,a=e.stackGroups,o=a===void 0?{}:a;if(!o)return{};for(var l={},i=Object.keys(o),h=0,p=i.length;h=0});if(E&&E.length){var T=E[0].type.defaultProps,P=T!==void 0?Zl(Zl({},T),E[0].props):E[0].props,z=P.barSize,F=P[A];l[F]||(l[F]=[]);var q=_i(z)?n:z;l[F].push({item:E[0],stackList:E.slice(1),barSize:_i(q)?void 0:Ru(q,s,0)})}}return l},sFt=function(e){var n=e.barGap,s=e.barCategoryGap,a=e.bandSize,o=e.sizeList,l=o===void 0?[]:o,i=e.maxBarSize,h=l.length;if(h<1)return null;var p=Ru(n,a,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var _=!1,j=a/h,C=l.reduce(function(z,F){return z+F.barSize||0},0);C+=(h-1)*p,C>=a&&(C-=(h-1)*p,p=0),C>=a&&j>0&&(_=!0,j*=.9,C=h*j);var N=(a-C)/2>>0,A={offset:N-p,size:0};x=l.reduce(function(z,F){var q={item:F.item,position:{offset:A.offset+A.size+p,size:_?j:F.barSize}},V=[].concat(TCe(z),[q]);return A=V[V.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){V.push({item:K,position:A})}),V},y)}else{var E=Ru(s,a,0,!0);a-2*E-(h-1)*p<=0&&(p=0);var T=(a-2*E-(h-1)*p)/h;T>1&&(T>>=0);var P=i===+i?Math.min(T,i):T;x=l.reduce(function(z,F,q){var V=[].concat(TCe(z),[{item:F.item,position:{offset:E+(T+p)*q+(T-P)/2,size:P}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){V.push({item:K,position:V[V.length-1].position})}),V},y)}return x},aFt=function(e,n,s,a){var o=s.children,l=s.width,i=s.margin,h=l-(i.left||0)-(i.right||0),p=Z9e({children:o,legendWidth:h});if(p){var x=a||{},y=x.width,_=x.height,j=p.align,C=p.verticalAlign,N=p.layout;if((N==="vertical"||N==="horizontal"&&C==="middle")&&j!=="center"&&Dn(e[j]))return Zl(Zl({},e),{},RS({},j,e[j]+(y||0)));if((N==="horizontal"||N==="vertical"&&j==="center")&&C!=="middle"&&Dn(e[C]))return Zl(Zl({},e),{},RS({},C,e[C]+(_||0)))}return e},iFt=function(e,n,s){return _i(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},Y9e=function(e,n,s,a,o){var l=n.props.children,i=sp(l,Sae).filter(function(p){return iFt(a,o,p.props.direction)});if(i&&i.length){var h=i.map(function(p){return p.props.dataKey});return e.reduce(function(p,x){var y=ru(x,s);if(_i(y))return p;var _=Array.isArray(y)?[wae(y),bae(y)]:[y,y],j=h.reduce(function(C,N){var A=ru(x,N,0),E=_[0]-Math.abs(Array.isArray(A)?A[0]:A),T=_[1]+Math.abs(Array.isArray(A)?A[1]:A);return[Math.min(E,C[0]),Math.max(T,C[1])]},[1/0,-1/0]);return[Math.min(j[0],p[0]),Math.max(j[1],p[1])]},[1/0,-1/0])}return null},oFt=function(e,n,s,a,o){var l=n.map(function(i){return Y9e(e,i,s,o,a)}).filter(function(i){return!_i(i)});return l&&l.length?l.reduce(function(i,h){return[Math.min(i[0],h[0]),Math.max(i[1],h[1])]},[1/0,-1/0]):null},X9e=function(e,n,s,a,o){var l=n.map(function(h){var p=h.props.dataKey;return s==="number"&&p&&Y9e(e,h,p,a)||kA(e,p,s,o)});if(s==="number")return l.reduce(function(h,p){return[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);var i={};return l.reduce(function(h,p){for(var x=0,y=p.length;x=2?Du(i[0]-i[1])*2*p:p,n&&(e.ticks||e.niceTicks)){var x=(e.ticks||e.niceTicks).map(function(y){var _=o?o.indexOf(y):y;return{coordinate:a(_)+p,value:y,offset:p}});return x.filter(function(y){return!zI(y.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(y,_){return{coordinate:a(y)+p,value:y,index:_,offset:p}}):a.ticks&&!s?a.ticks(e.tickCount).map(function(y){return{coordinate:a(y)+p,value:y,offset:p}}):a.domain().map(function(y,_){return{coordinate:a(y)+p,value:o?o[y]:y,index:_,offset:p}})},rde=new WeakMap,KL=function(e,n){if(typeof n!="function")return e;rde.has(e)||rde.set(e,new WeakMap);var s=rde.get(e);if(s.has(n))return s.get(n);var a=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,a),a},eBe=function(e,n,s){var a=e.scale,o=e.type,l=e.layout,i=e.axisType;if(a==="auto")return l==="radial"&&i==="radiusAxis"?{scale:SE(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:Tre(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:jA(),realScaleType:"point"}:o==="category"?{scale:SE(),realScaleType:"band"}:{scale:Tre(),realScaleType:"linear"};if(Xj(a)){var h="scale".concat(iae(a));return{scale:(jCe[h]||jA)(),realScaleType:jCe[h]?h:"point"}}return Ua(a)?{scale:a}:{scale:jA(),realScaleType:"point"}},ECe=1e-4,tBe=function(e){var n=e.domain();if(!(!n||n.length<=2)){var s=n.length,a=e.range(),o=Math.min(a[0],a[1])-ECe,l=Math.max(a[0],a[1])+ECe,i=e(n[0]),h=e(n[s-1]);(il||hl)&&e.domain([n[0],n[s-1]])}},lFt=function(e,n){if(!e)return null;for(var s=0,a=e.length;sa)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(e[i][s][0]=o,e[i][s][1]=o+h,o=e[i][s][1]):(e[i][s][0]=l,e[i][s][1]=l+h,l=e[i][s][1])}},uFt=function(e){var n=e.length;if(!(n<=0))for(var s=0,a=e[0].length;s=0?(e[l][s][0]=o,e[l][s][1]=o+i,o=e[l][s][1]):(e[l][s][0]=0,e[l][s][1]=0)}},hFt={sign:dFt,expand:E3t,none:wC,silhouette:I3t,wiggle:P3t,positive:uFt},fFt=function(e,n,s){var a=n.map(function(i){return i.props.dataKey}),o=hFt[s],l=A3t().keys(a).value(function(i,h){return+ru(i,h,0)}).order(xfe).offset(o);return l(e)},pFt=function(e,n,s,a,o,l){if(!e)return null;var i=l?n.reverse():n,h={},p=i.reduce(function(y,_){var j,C=(j=_.type)!==null&&j!==void 0&&j.defaultProps?Zl(Zl({},_.type.defaultProps),_.props):_.props,N=C.stackId,A=C.hide;if(A)return y;var E=C[s],T=y[E]||{hasStack:!1,stackGroups:{}};if(Gc(N)){var P=T.stackGroups[N]||{numericAxisId:s,cateAxisId:a,items:[]};P.items.push(_),T.hasStack=!0,T.stackGroups[N]=P}else T.stackGroups[BI("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[_]};return Zl(Zl({},y),{},RS({},E,T))},h),x={};return Object.keys(p).reduce(function(y,_){var j=p[_];if(j.hasStack){var C={};j.stackGroups=Object.keys(j.stackGroups).reduce(function(N,A){var E=j.stackGroups[A];return Zl(Zl({},N),{},RS({},A,{numericAxisId:s,cateAxisId:a,items:E.items,stackedData:fFt(e,E.items,o)}))},C)}return Zl(Zl({},y),{},RS({},_,j))},x)},rBe=function(e,n){var s=n.realScaleType,a=n.type,o=n.tickCount,l=n.originalDomain,i=n.allowDecimals,h=s||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var p=e.domain();if(!p.length)return null;var x=MRt(p,o,i);return e.domain([wae(x),bae(x)]),{niceTicks:x}}if(o&&a==="number"){var y=e.domain(),_=TRt(y,o,i);return{niceTicks:_}}return null},ICe=function(e){var n=e.axis,s=e.ticks,a=e.offset,o=e.bandSize,l=e.entry,i=e.index;if(n.type==="category")return s[i]?s[i].coordinate+a:null;var h=ru(l,n.dataKey,n.domain[i]);return _i(h)?null:n.scale(h)-o/2+a},mFt=function(e){var n=e.numericAxis,s=n.scale.domain();if(n.type==="number"){var a=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return a<=0&&o>=0?0:o<0?o:a}return s[0]},gFt=function(e,n){var s,a=(s=e.type)!==null&&s!==void 0&&s.defaultProps?Zl(Zl({},e.type.defaultProps),e.props):e.props,o=a.stackId;if(Gc(o)){var l=n[o];if(l){var i=l.items.indexOf(e);return i>=0?l.stackedData[i]:null}}return null},xFt=function(e){return e.reduce(function(n,s){return[wae(s.concat([n[0]]).filter(Dn)),bae(s.concat([n[1]]).filter(Dn))]},[1/0,-1/0])},nBe=function(e,n,s){return Object.keys(e).reduce(function(a,o){var l=e[o],i=l.stackedData,h=i.reduce(function(p,x){var y=xFt(x.slice(n,s+1));return[Math.min(p[0],y[0]),Math.max(p[1],y[1])]},[1/0,-1/0]);return[Math.min(h[0],a[0]),Math.max(h[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},PCe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,LCe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kfe=function(e,n,s){if(Ua(e))return e(n,s);if(!Array.isArray(e))return n;var a=[];if(Dn(e[0]))a[0]=s?e[0]:Math.min(e[0],n[0]);else if(PCe.test(e[0])){var o=+PCe.exec(e[0])[1];a[0]=n[0]-o}else Ua(e[0])?a[0]=e[0](n[0]):a[0]=n[0];if(Dn(e[1]))a[1]=s?e[1]:Math.max(e[1],n[1]);else if(LCe.test(e[1])){var l=+LCe.exec(e[1])[1];a[1]=n[1]+l}else Ua(e[1])?a[1]=e[1](n[1]):a[1]=n[1];return a},Dre=function(e,n,s){if(e&&e.scale&&e.scale.bandwidth){var a=e.scale.bandwidth();if(!s||a>0)return a}if(e&&n&&n.length>=2){for(var o=Hye(n,function(y){return y.coordinate}),l=1/0,i=1,h=o.length;it.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},SFt=function(e,n,s,a,o){var l=e.width,i=e.height,h=e.startAngle,p=e.endAngle,x=Ru(e.cx,l,l/2),y=Ru(e.cy,i,i/2),_=iBe(l,i,s),j=Ru(e.innerRadius,_,0),C=Ru(e.outerRadius,_,_*.8),N=Object.keys(n);return N.reduce(function(A,E){var T=n[E],P=T.domain,z=T.reversed,F;if(_i(T.range))a==="angleAxis"?F=[h,p]:a==="radiusAxis"&&(F=[j,C]),z&&(F=[F[1],F[0]]);else{F=T.range;var q=F,V=_Ft(q,2);h=V[0],p=V[1]}var K=eBe(T,o),G=K.realScaleType,te=K.scale;te.domain(P).range(F),tBe(te);var ie=rBe(te,Nx(Nx({},T),{},{realScaleType:G})),oe=Nx(Nx(Nx({},T),ie),{},{range:F,radius:C,realScaleType:G,scale:te,cx:x,cy:y,innerRadius:j,outerRadius:C,startAngle:h,endAngle:p});return Nx(Nx({},A),{},aBe({},E,oe))},{})},CFt=function(e,n){var s=e.x,a=e.y,o=n.x,l=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(a-l,2))},MFt=function(e,n){var s=e.x,a=e.y,o=n.cx,l=n.cy,i=CFt({x:s,y:a},{x:o,y:l});if(i<=0)return{radius:i};var h=(s-o)/i,p=Math.acos(h);return a>l&&(p=2*Math.PI-p),{radius:i,angle:NFt(p),angleInRadian:p}},TFt=function(e){var n=e.startAngle,s=e.endAngle,a=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(a,o);return{startAngle:n-l*360,endAngle:s-l*360}},AFt=function(e,n){var s=n.startAngle,a=n.endAngle,o=Math.floor(s/360),l=Math.floor(a/360),i=Math.min(o,l);return e+i*360},FCe=function(e,n){var s=e.x,a=e.y,o=MFt({x:s,y:a},n),l=o.radius,i=o.angle,h=n.innerRadius,p=n.outerRadius;if(lp)return!1;if(l===0)return!0;var x=TFt(n),y=x.startAngle,_=x.endAngle,j=i,C;if(y<=_){for(;j>_;)j-=360;for(;j=y&&j<=_}else{for(;j>y;)j-=360;for(;j<_;)j+=360;C=j>=_&&j<=y}return C?Nx(Nx({},n),{},{radius:l,angle:AFt(j,n)}):null},oBe=function(e){return!I.isValidElement(e)&&!Ua(e)&&typeof e!="boolean"?e.className:""};function DE(t){"@babel/helpers - typeof";return DE=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},DE(t)}var EFt=["offset"];function IFt(t){return DFt(t)||OFt(t)||LFt(t)||PFt()}function PFt(){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 LFt(t,e){if(t){if(typeof t=="string")return Zfe(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 Zfe(t,e)}}function OFt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function DFt(t){if(Array.isArray(t))return Zfe(t)}function Zfe(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 FFt(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 zCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function zc(t){for(var e=1;e=0?1:-1,P,z;a==="insideStart"?(P=j+T*l,z=N):a==="insideEnd"?(P=C-T*l,z=!N):a==="end"&&(P=C+T*l,z=N),z=E<=0?z:!z;var F=Jo(p,x,A,P),q=Jo(p,x,A,P+(z?1:-1)*359),V="M".concat(F.x,",").concat(F.y,` A`).concat(A,",").concat(A,",0,1,").concat(z?0:1,`, `).concat(q.x,",").concat(q.y),K=_i(e.id)?BI("recharts-radial-line-"):e.id;return st.createElement("text",RE({},s,{dominantBaseline:"central",className:si("recharts-radial-bar-label",i)}),st.createElement("defs",null,st.createElement("path",{id:K,d:V})),st.createElement("textPath",{xlinkHref:"#".concat(K)},n))},HFt=function(e){var n=e.viewBox,s=e.offset,a=e.position,o=n,l=o.cx,i=o.cy,h=o.innerRadius,p=o.outerRadius,x=o.startAngle,y=o.endAngle,_=(x+y)/2;if(a==="outside"){var j=Jo(l,i,p+s,_),C=j.x,N=j.y;return{x:C,y:N,textAnchor:C>=l?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"end"};var A=(h+p)/2,E=Jo(l,i,A,_),T=E.x,P=E.y;return{x:T,y:P,textAnchor:"middle",verticalAnchor:"middle"}},WFt=function(e){var n=e.viewBox,s=e.parentViewBox,a=e.offset,o=e.position,l=n,i=l.x,h=l.y,p=l.width,x=l.height,y=x>=0?1:-1,_=y*a,j=y>0?"end":"start",C=y>0?"start":"end",N=p>=0?1:-1,A=N*a,E=N>0?"end":"start",T=N>0?"start":"end";if(o==="top"){var P={x:i+p/2,y:h-y*a,textAnchor:"middle",verticalAnchor:j};return zc(zc({},P),s?{height:Math.max(h-s.y,0),width:p}:{})}if(o==="bottom"){var z={x:i+p/2,y:h+x+_,textAnchor:"middle",verticalAnchor:C};return zc(zc({},z),s?{height:Math.max(s.y+s.height-(h+x),0),width:p}:{})}if(o==="left"){var F={x:i-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"};return zc(zc({},F),s?{width:Math.max(F.x-s.x,0),height:x}:{})}if(o==="right"){var q={x:i+p+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"};return zc(zc({},q),s?{width:Math.max(s.x+s.width-q.x,0),height:x}:{})}var V=s?{width:p,height:x}:{};return o==="insideLeft"?zc({x:i+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"},V):o==="insideRight"?zc({x:i+p-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"},V):o==="insideTop"?zc({x:i+p/2,y:h+_,textAnchor:"middle",verticalAnchor:C},V):o==="insideBottom"?zc({x:i+p/2,y:h+x-_,textAnchor:"middle",verticalAnchor:j},V):o==="insideTopLeft"?zc({x:i+A,y:h+_,textAnchor:T,verticalAnchor:C},V):o==="insideTopRight"?zc({x:i+p-A,y:h+_,textAnchor:E,verticalAnchor:C},V):o==="insideBottomLeft"?zc({x:i+A,y:h+x-_,textAnchor:T,verticalAnchor:j},V):o==="insideBottomRight"?zc({x:i+p-A,y:h+x-_,textAnchor:E,verticalAnchor:j},V):x3(o)&&(Dn(o.x)||Gw(o.x))&&(Dn(o.y)||Gw(o.y))?zc({x:i+Ru(o.x,p),y:h+Ru(o.y,x),textAnchor:"end",verticalAnchor:"end"},V):zc({x:i+p/2,y:h+x/2,textAnchor:"middle",verticalAnchor:"middle"},V)},GFt=function(e){return"cx"in e&&Dn(e.cx)};function dd(t){var e=t.offset,n=e===void 0?5:e,s=RFt(t,EFt),a=zc({offset:n},s),o=a.viewBox,l=a.position,i=a.value,h=a.children,p=a.content,x=a.className,y=x===void 0?"":x,_=a.textBreakAll;if(!o||_i(i)&&_i(h)&&!I.isValidElement(p)&&!Ua(p))return null;if(I.isValidElement(p))return I.cloneElement(p,a);var j;if(Ua(p)){if(j=I.createElement(p,a),I.isValidElement(j))return j}else j=UFt(a);var C=GFt(o),N=Ia(a,!0);if(C&&(l==="insideStart"||l==="insideEnd"||l==="end"))return VFt(a,j,N);var A=C?HFt(a):WFt(a);return st.createElement(Jj,RE({className:si("recharts-label",y)},N,A,{breakAll:_}),j)}dd.displayName="Label";var lBe=function(e){var n=e.cx,s=e.cy,a=e.angle,o=e.startAngle,l=e.endAngle,i=e.r,h=e.radius,p=e.innerRadius,x=e.outerRadius,y=e.x,_=e.y,j=e.top,C=e.left,N=e.width,A=e.height,E=e.clockWise,T=e.labelViewBox;if(T)return T;if(Dn(N)&&Dn(A)){if(Dn(y)&&Dn(_))return{x:y,y:_,width:N,height:A};if(Dn(j)&&Dn(C))return{x:j,y:C,width:N,height:A}}return Dn(y)&&Dn(_)?{x:y,y:_,width:0,height:0}:Dn(n)&&Dn(s)?{cx:n,cy:s,startAngle:o||a||0,endAngle:l||a||0,innerRadius:p||0,outerRadius:x||h||i||0,clockWise:E}:e.viewBox?e.viewBox:{}},KFt=function(e,n){return e?e===!0?st.createElement(dd,{key:"label-implicit",viewBox:n}):Gc(e)?st.createElement(dd,{key:"label-implicit",viewBox:n,value:e}):I.isValidElement(e)?e.type===dd?I.cloneElement(e,{key:"label-implicit",viewBox:n}):st.createElement(dd,{key:"label-implicit",content:e,viewBox:n}):Ua(e)?st.createElement(dd,{key:"label-implicit",content:e,viewBox:n}):x3(e)?st.createElement(dd,RE({viewBox:n},e,{key:"label-implicit"})):null:null},ZFt=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 a=e.children,o=lBe(e),l=sp(a,dd).map(function(h,p){return I.cloneElement(h,{viewBox:n||o,key:"label-".concat(p)})});if(!s)return l;var i=KFt(e.label,n||o);return[i].concat(IFt(l))};dd.parseViewBox=lBe;dd.renderCallByParent=ZFt;function YFt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var XFt=YFt;const QFt=Hi(XFt);function FE(t){"@babel/helpers - typeof";return FE=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},FE(t)}var JFt=["valueAccessor"],ezt=["data","dataKey","clockWise","id","textBreakAll"];function tzt(t){return azt(t)||szt(t)||nzt(t)||rzt()}function rzt(){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 nzt(t,e){if(t){if(typeof t=="string")return Yfe(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 Yfe(t,e)}}function szt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function azt(t){if(Array.isArray(t))return Yfe(t)}function Yfe(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 czt(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 dzt=function(e){return Array.isArray(e.value)?QFt(e.value):e.value};function D1(t){var e=t.valueAccessor,n=e===void 0?dzt:e,s=UCe(t,JFt),a=s.data,o=s.dataKey,l=s.clockWise,i=s.id,h=s.textBreakAll,p=UCe(s,ezt);return!a||!a.length?null:st.createElement(No,{className:"recharts-label-list"},a.map(function(x,y){var _=_i(o)?n(x,y):ru(x&&x.payload,o),j=_i(i)?{}:{id:"".concat(i,"-").concat(y)};return st.createElement(dd,Fre({},Ia(x,!0),p,j,{parentViewBox:x.parentViewBox,value:_,textBreakAll:h,viewBox:dd.parseViewBox(_i(l)?x:$Ce($Ce({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}D1.displayName="LabelList";function uzt(t,e){return t?t===!0?st.createElement(D1,{key:"labelList-implicit",data:e}):st.isValidElement(t)||Ua(t)?st.createElement(D1,{key:"labelList-implicit",data:e,content:t}):x3(t)?st.createElement(D1,Fre({data:e},t,{key:"labelList-implicit"})):null:null}function hzt(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,a=sp(s,D1).map(function(l,i){return I.cloneElement(l,{data:e,key:"labelList-".concat(i)})});if(!n)return a;var o=uzt(t.label,e);return[o].concat(tzt(a))}D1.renderCallByParent=hzt;function zE(t){"@babel/helpers - typeof";return zE=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},zE(t)}function Xfe(){return Xfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(l>p),`, `).concat(y.x,",").concat(y.y,` `);if(a>0){var j=Jo(n,s,a,l),C=Jo(n,s,a,p);_+="L ".concat(C.x,",").concat(C.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(h)>180),",").concat(+(l<=p),`, `).concat(j.x,",").concat(j.y," Z")}else _+="L ".concat(n,",").concat(s," Z");return _},xzt=function(e){var n=e.cx,s=e.cy,a=e.innerRadius,o=e.outerRadius,l=e.cornerRadius,i=e.forceCornerRadius,h=e.cornerIsExternal,p=e.startAngle,x=e.endAngle,y=Du(x-p),_=ZL({cx:n,cy:s,radius:o,angle:p,sign:y,cornerRadius:l,cornerIsExternal:h}),j=_.circleTangency,C=_.lineTangency,N=_.theta,A=ZL({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:h}),E=A.circleTangency,T=A.lineTangency,P=A.theta,z=h?Math.abs(p-x):Math.abs(p-x)-N-P;if(z<0)return i?"M ".concat(C.x,",").concat(C.y,` a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 `):cBe({cx:n,cy:s,innerRadius:a,outerRadius:o,startAngle:p,endAngle:x});var F="M ".concat(C.x,",").concat(C.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(j.x,",").concat(j.y,` A`).concat(o,",").concat(o,",0,").concat(+(z>180),",").concat(+(y<0),",").concat(E.x,",").concat(E.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(a>0){var q=ZL({cx:n,cy:s,radius:a,angle:p,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),V=q.circleTangency,K=q.lineTangency,G=q.theta,te=ZL({cx:n,cy:s,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),ie=te.circleTangency,oe=te.lineTangency,ye=te.theta,ae=h?Math.abs(p-x):Math.abs(p-x)-G-ye;if(ae<0&&l===0)return"".concat(F,"L").concat(n,",").concat(s,"Z");F+="L".concat(oe.x,",").concat(oe.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ie.x,",").concat(ie.y,` A`).concat(a,",").concat(a,",0,").concat(+(ae>180),",").concat(+(y>0),",").concat(V.x,",").concat(V.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(K.x,",").concat(K.y,"Z")}else F+="L".concat(n,",").concat(s,"Z");return F},yzt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},dBe=function(e){var n=VCe(VCe({},yzt),e),s=n.cx,a=n.cy,o=n.innerRadius,l=n.outerRadius,i=n.cornerRadius,h=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,_=n.className;if(l0&&Math.abs(x-y)<360?A=xzt({cx:s,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(N,C/2),forceCornerRadius:h,cornerIsExternal:p,startAngle:x,endAngle:y}):A=cBe({cx:s,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),st.createElement("path",Xfe({},Ia(n,!0),{className:j,d:A,role:"img"}))};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 Qfe(){return Qfe=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 Rzt(t,e){return pk(t.getTime(),e.getTime())}function Fzt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function zzt(t,e){return t===e}function QCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var a=new Array(s),o=t.entries(),l,i,h=0;(l=o.next())&&!l.done;){for(var p=e.entries(),x=!1,y=0;(i=p.next())&&!i.done;){if(a[y]){y++;continue}var _=l.value,j=i.value;if(n.equals(_[0],j[0],h,y,t,e,n)&&n.equals(_[1],j[1],_[0],j[0],t,e,n)){x=a[y]=!0;break}y++}if(!x)return!1;h++}return!0}var Bzt=pk;function $zt(t,e,n){var s=XCe(t),a=s.length;if(XCe(e).length!==a)return!1;for(;a-- >0;)if(!pBe(t,e,n,s[a]))return!1;return!0}function QM(t,e,n){var s=ZCe(t),a=s.length;if(ZCe(e).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=s[a],!pBe(t,e,n,o)||(l=YCe(t,o),i=YCe(e,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function Uzt(t,e){return pk(t.valueOf(),e.valueOf())}function qzt(t,e){return t.source===e.source&&t.flags===e.flags}function JCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var a=new Array(s),o=t.values(),l,i;(l=o.next())&&!l.done;){for(var h=e.values(),p=!1,x=0;(i=h.next())&&!i.done;){if(!a[x]&&n.equals(l.value,i.value,l.value,i.value,t,e,n)){p=a[x]=!0;break}x++}if(!p)return!1}return!0}function Vzt(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 Hzt(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 pBe(t,e,n,s){return(s===Ozt||s===Lzt||s===Pzt)&&(t.$$typeof||e.$$typeof)?!0:Izt(e,s)&&n.equals(t[s],e[s],s,s,t,e,n)}var Wzt="[object Arguments]",Gzt="[object Boolean]",Kzt="[object Date]",Zzt="[object Error]",Yzt="[object Map]",Xzt="[object Number]",Qzt="[object Object]",Jzt="[object RegExp]",e7t="[object Set]",t7t="[object String]",r7t="[object URL]",n7t=Array.isArray,e3e=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,t3e=Object.assign,s7t=Object.prototype.toString.call.bind(Object.prototype.toString);function a7t(t){var e=t.areArraysEqual,n=t.areDatesEqual,s=t.areErrorsEqual,a=t.areFunctionsEqual,o=t.areMapsEqual,l=t.areNumbersEqual,i=t.areObjectsEqual,h=t.arePrimitiveWrappersEqual,p=t.areRegExpsEqual,x=t.areSetsEqual,y=t.areTypedArraysEqual,_=t.areUrlsEqual;return function(C,N,A){if(C===N)return!0;if(C==null||N==null)return!1;var E=typeof C;if(E!==typeof N)return!1;if(E!=="object")return E==="number"?l(C,N,A):E==="function"?a(C,N,A):!1;var T=C.constructor;if(T!==N.constructor)return!1;if(T===Object)return i(C,N,A);if(n7t(C))return e(C,N,A);if(e3e!=null&&e3e(C))return y(C,N,A);if(T===Date)return n(C,N,A);if(T===RegExp)return p(C,N,A);if(T===Map)return o(C,N,A);if(T===Set)return x(C,N,A);var P=s7t(C);return P===Kzt?n(C,N,A):P===Jzt?p(C,N,A):P===Yzt?o(C,N,A):P===e7t?x(C,N,A):P===Qzt?typeof C.then!="function"&&typeof N.then!="function"&&i(C,N,A):P===r7t?_(C,N,A):P===Zzt?s(C,N,A):P===Wzt?i(C,N,A):P===Gzt||P===Xzt||P===t7t?h(C,N,A):!1}}function i7t(t){var e=t.circular,n=t.createCustomConfig,s=t.strict,a={areArraysEqual:s?QM:Dzt,areDatesEqual:Rzt,areErrorsEqual:Fzt,areFunctionsEqual:zzt,areMapsEqual:s?KCe(QCe,QM):QCe,areNumbersEqual:Bzt,areObjectsEqual:s?QM:$zt,arePrimitiveWrappersEqual:Uzt,areRegExpsEqual:qzt,areSetsEqual:s?KCe(JCe,QM):JCe,areTypedArraysEqual:s?QM:Vzt,areUrlsEqual:Hzt};if(n&&(a=t3e({},a,n(a))),e){var o=XL(a.areArraysEqual),l=XL(a.areMapsEqual),i=XL(a.areObjectsEqual),h=XL(a.areSetsEqual);a=t3e({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:h})}return a}function o7t(t){return function(e,n,s,a,o,l,i){return t(e,n,i)}}function l7t(t){var e=t.circular,n=t.comparator,s=t.createState,a=t.equals,o=t.strict;if(s)return function(h,p){var x=s(),y=x.cache,_=y===void 0?e?new WeakMap:void 0:y,j=x.meta;return n(h,p,{cache:_,equals:a,meta:j,strict:o})};if(e)return function(h,p){return n(h,p,{cache:new WeakMap,equals:a,meta:void 0,strict:o})};var l={cache:void 0,equals:a,meta:void 0,strict:o};return function(h,p){return n(h,p,l)}}var c7t=gv();gv({strict:!0});gv({circular:!0});gv({circular:!0,strict:!0});gv({createInternalComparator:function(){return pk}});gv({strict:!0,createInternalComparator:function(){return pk}});gv({circular:!0,createInternalComparator:function(){return pk}});gv({circular:!0,createInternalComparator:function(){return pk},strict:!0});function gv(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,s=t.createInternalComparator,a=t.createState,o=t.strict,l=o===void 0?!1:o,i=i7t(t),h=a7t(i),p=s?s(h):o7t(h);return l7t({circular:n,comparator:h,createState:a,equals:p,strict:l})}function d7t(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function r3e(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function a(o){n<0&&(n=o),o-n>e?(t(o),n=-1):d7t(a)};requestAnimationFrame(s)}function epe(t){"@babel/helpers - typeof";return epe=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},epe(t)}function u7t(t){return m7t(t)||p7t(t)||f7t(t)||h7t()}function h7t(){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 f7t(t,e){if(t){if(typeof t=="string")return n3e(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 n3e(t,e)}}function n3e(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:E<0?0:E},N=function(E){for(var T=E>1?1:E,P=T,z=0;z<8;++z){var F=y(P)-T,q=j(P);if(Math.abs(F-T)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,s=n===void 0?100:n,a=e.damping,o=a===void 0?8:a,l=e.dt,i=l===void 0?17:l,h=function(x,y,_){var j=-(x-y)*s,C=_*o,N=_+(j-C)*i/1e3,A=_*i/1e3+x;return Math.abs(A-y)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 W7t(t,e){if(t==null)return{};var n={},s=Object.keys(t),a,o;for(o=0;o=0)&&(n[a]=t[a]);return n}function nde(t){return Y7t(t)||Z7t(t)||K7t(t)||G7t()}function G7t(){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 K7t(t,e){if(t){if(typeof t=="string")return ape(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 ape(t,e)}}function Z7t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Y7t(t){if(Array.isArray(t))return ape(t)}function ape(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 $re(t){return $re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$re(t)}var py=function(t){t9t(n,t);var e=r9t(n);function n(s,a){var o;X7t(this,n),o=e.call(this,s,a);var l=o.props,i=l.isActive,h=l.attributeName,p=l.from,x=l.to,y=l.steps,_=l.children,j=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(lpe(o)),o.changeStyle=o.changeStyle.bind(lpe(o)),!i||j<=0)return o.state={style:{}},typeof _=="function"&&(o.state={style:x}),ope(o);if(y&&y.length)o.state={style:y[0].style};else if(p){if(typeof _=="function")return o.state={style:p},ope(o);o.state={style:h?mT({},h,p):p}}else o.state={style:{}};return o}return J7t(n,[{key:"componentDidMount",value:function(){var a=this.props,o=a.isActive,l=a.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var o=this.props,l=o.isActive,i=o.canBegin,h=o.attributeName,p=o.shouldReAnimate,x=o.to,y=o.from,_=this.state.style;if(i){if(!l){var j={style:h?mT({},h,x):x};this.state&&_&&(h&&_[h]!==x||!h&&_!==x)&&this.setState(j);return}if(!(c7t(a.to,x)&&a.canBegin&&a.isActive)){var C=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var N=C||p?y:a.to;if(this.state&&_){var A={style:h?mT({},h,N):N};(h&&_[h]!==N||!h&&_!==N)&&this.setState(A)}this.runAnimation(qp(qp({},this.props),{},{from:N,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var o=this,l=a.from,i=a.to,h=a.duration,p=a.easing,x=a.begin,y=a.onAnimationEnd,_=a.onAnimationStart,j=q7t(l,i,I7t(p),h,this.changeStyle),C=function(){o.stopJSAnimation=j()};this.manager.start([_,x,C,h,y])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,i=a.begin,h=a.onAnimationStart,p=l[0],x=p.style,y=p.duration,_=y===void 0?0:y,j=function(N,A,E){if(E===0)return N;var T=A.duration,P=A.easing,z=P===void 0?"ease":P,F=A.style,q=A.properties,V=A.onAnimationEnd,K=E>0?l[E-1]:A,G=q||Object.keys(F);if(typeof z=="function"||z==="spring")return[].concat(nde(N),[o.runJSAnimation.bind(o,{from:K.style,to:F,duration:T,easing:z}),T]);var te=i3e(G,T,z),ie=qp(qp(qp({},K.style),F),{},{transition:te});return[].concat(nde(N),[ie,T,V]).filter(_7t)};return this.manager.start([h].concat(nde(l.reduce(j,[x,Math.max(_,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=g7t());var o=a.begin,l=a.duration,i=a.attributeName,h=a.to,p=a.easing,x=a.onAnimationStart,y=a.onAnimationEnd,_=a.steps,j=a.children,C=this.manager;if(this.unSubscribe=C.subscribe(this.handleStyleChange),typeof p=="function"||typeof j=="function"||p==="spring"){this.runJSAnimation(a);return}if(_.length>1){this.runStepAnimation(a);return}var N=i?mT({},i,h):h,A=i3e(Object.keys(N),l,p);C.start([x,o,qp(qp({},N),{},{transition:A}),l,y])}},{key:"render",value:function(){var a=this.props,o=a.children;a.begin;var l=a.duration;a.attributeName,a.easing;var i=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var h=H7t(a,V7t),p=I.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!i||p===0||l<=0)return o;var y=function(j){var C=j.props,N=C.style,A=N===void 0?{}:N,E=C.className,T=I.cloneElement(j,qp(qp({},h),{},{style:qp(qp({},A),x),className:E}));return T};return p===1?y(I.Children.only(o)):st.createElement("div",null,I.Children.map(o,function(_){return y(_)}))}}]),n}(I.PureComponent);py.displayName="Animate";py.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};py.propTypes={from:mo.oneOfType([mo.object,mo.string]),to:mo.oneOfType([mo.object,mo.string]),attributeName:mo.string,duration:mo.number,begin:mo.number,easing:mo.oneOfType([mo.string,mo.func]),steps:mo.arrayOf(mo.shape({duration:mo.number.isRequired,style:mo.object.isRequired,easing:mo.oneOfType([mo.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),mo.func]),properties:mo.arrayOf("string"),onAnimationEnd:mo.func})),children:mo.oneOfType([mo.node,mo.func]),isActive:mo.bool,canBegin:mo.bool,onAnimationEnd:mo.func,shouldReAnimate:mo.bool,onAnimationStart:mo.func,onAnimationReStart:mo.func};function qE(t){"@babel/helpers - typeof";return qE=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},qE(t)}function Ure(){return Ure=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,h=s>=0?1:-1,p=a>=0&&s>=0||a<0&&s<0?1:0,x;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],_=0,j=4;_l?l:o[_];x="M".concat(e,",").concat(n+i*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(p,",").concat(e+h*y[0],",").concat(n)),x+="L ".concat(e+s-h*y[1],",").concat(n),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(p,`, `).concat(e+s,",").concat(n+i*y[1])),x+="L ".concat(e+s,",").concat(n+a-i*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(p,`, `).concat(e+s-h*y[2],",").concat(n+a)),x+="L ".concat(e+h*y[3],",").concat(n+a),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(p,`, `).concat(e,",").concat(n+a-i*y[3])),x+="Z"}else if(l>0&&o===+o&&o>0){var C=Math.min(l,o);x="M ".concat(e,",").concat(n+i*C,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e+h*C,",").concat(n,` L `).concat(e+s-h*C,",").concat(n,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e+s,",").concat(n+i*C,` L `).concat(e+s,",").concat(n+a-i*C,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e+s-h*C,",").concat(n+a,` L `).concat(e+h*C,",").concat(n+a,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e,",").concat(n+a-i*C," Z")}else x="M ".concat(e,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return x},h9t=function(e,n){if(!e||!n)return!1;var s=e.x,a=e.y,o=n.x,l=n.y,i=n.width,h=n.height;if(Math.abs(i)>0&&Math.abs(h)>0){var p=Math.min(o,o+i),x=Math.max(o,o+i),y=Math.min(l,l+h),_=Math.max(l,l+h);return s>=p&&s<=x&&a>=y&&a<=_}return!1},f9t={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},y0e=function(e){var n=p3e(p3e({},f9t),e),s=I.useRef(),a=I.useState(-1),o=s9t(a,2),l=o[0],i=o[1];I.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var z=s.current.getTotalLength();z&&i(z)}catch{}},[]);var h=n.x,p=n.y,x=n.width,y=n.height,_=n.radius,j=n.className,C=n.animationEasing,N=n.animationDuration,A=n.animationBegin,E=n.isAnimationActive,T=n.isUpdateAnimationActive;if(h!==+h||p!==+p||x!==+x||y!==+y||x===0||y===0)return null;var P=si("recharts-rectangle",j);return T?st.createElement(py,{canBegin:l>0,from:{width:x,height:y,x:h,y:p},to:{width:x,height:y,x:h,y:p},duration:N,animationEasing:C,isActive:T},function(z){var F=z.width,q=z.height,V=z.x,K=z.y;return st.createElement(py,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:N,isActive:E,easing:C},st.createElement("path",Ure({},Ia(n,!0),{className:P,d:m3e(V,K,F,q,_),ref:s})))}):st.createElement("path",Ure({},Ia(n,!0),{className:P,d:m3e(h,p,x,y,_)}))},p9t=["points","className","baseLinePoints","connectNulls"];function B4(){return B4=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 g9t(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 g3e(t){return _9t(t)||v9t(t)||y9t(t)||x9t()}function x9t(){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 y9t(t,e){if(t){if(typeof t=="string")return cpe(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 cpe(t,e)}}function v9t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _9t(t){if(Array.isArray(t))return cpe(t)}function cpe(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){x3e(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),x3e(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=b9t(e);n&&(s=[s.reduce(function(o,l){return[].concat(g3e(o),g3e(l))},[])]);var a=s.map(function(o){return o.reduce(function(l,i,h){return"".concat(l).concat(h===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},w9t=function(e,n,s){var a=SA(e,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(SA(n.reverse(),s).slice(1))},j9t=function(e){var n=e.points,s=e.className,a=e.baseLinePoints,o=e.connectNulls,l=m9t(e,p9t);if(!n||!n.length)return null;var i=si("recharts-polygon",s);if(a&&a.length){var h=l.stroke&&l.stroke!=="none",p=w9t(n,a,o);return st.createElement("g",{className:i},st.createElement("path",B4({},Ia(l,!0),{fill:p.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:p})),h?st.createElement("path",B4({},Ia(l,!0),{fill:"none",d:SA(n,o)})):null,h?st.createElement("path",B4({},Ia(l,!0),{fill:"none",d:SA(a,o)})):null)}var x=SA(n,o);return st.createElement("path",B4({},Ia(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function dpe(){return dpe=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 A9t(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 E9t=function(e,n,s,a,o,l){return"M".concat(e,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(s)},I9t=function(e){var n=e.x,s=n===void 0?0:n,a=e.y,o=a===void 0?0:a,l=e.top,i=l===void 0?0:l,h=e.left,p=h===void 0?0:h,x=e.width,y=x===void 0?0:x,_=e.height,j=_===void 0?0:_,C=e.className,N=T9t(e,k9t),A=N9t({x:s,y:o,top:i,left:p,width:y,height:j},N);return!Dn(s)||!Dn(o)||!Dn(y)||!Dn(j)||!Dn(i)||!Dn(p)?null:st.createElement("path",upe({},Ia(A,!0),{className:si("recharts-cross",C),d:E9t(s,o,y,j,i,p)}))},P9t=_ae,L9t=I9e,O9t=Vg;function D9t(t,e){return t&&t.length?P9t(t,O9t(e),L9t):void 0}var R9t=D9t;const F9t=Hi(R9t);var z9t=_ae,B9t=Vg,$9t=P9e;function U9t(t,e){return t&&t.length?z9t(t,B9t(e),$9t):void 0}var q9t=U9t;const V9t=Hi(q9t);var H9t=["cx","cy","angle","ticks","axisLine"],W9t=["ticks","tick","angle","tickFormatter","stroke"];function IC(t){"@babel/helpers - typeof";return IC=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},IC(t)}function CA(){return CA=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 G9t(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 K9t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b3e(t,e){for(var n=0;nk3e?l=a==="outer"?"start":"end":o<-k3e?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,o=s.cy,l=s.radius,i=s.axisLine,h=s.axisLineType,p=u_(u_({},Ia(this.props,!1)),{},{fill:"none"},Ia(i,!1));if(h==="circle")return st.createElement(v0e,Dw({className:"recharts-polar-angle-axis-line"},p,{cx:a,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(_){return Jo(a,o,l,_.coordinate)});return st.createElement(j9t,Dw({className:"recharts-polar-angle-axis-line"},p,{points:y}))}},{key:"renderTicks",value:function(){var s=this,a=this.props,o=a.ticks,l=a.tick,i=a.tickLine,h=a.tickFormatter,p=a.stroke,x=Ia(this.props,!1),y=Ia(l,!1),_=u_(u_({},x),{},{fill:"none"},Ia(i,!1)),j=o.map(function(C,N){var A=s.getTickLineCoord(C),E=s.getTickTextAnchor(C),T=u_(u_(u_({textAnchor:E},x),{},{stroke:"none",fill:p},y),{},{index:N,payload:C,x:A.x2,y:A.y2});return st.createElement(No,Dw({className:si("recharts-polar-angle-axis-tick",oBe(l)),key:"tick-".concat(C.coordinate)},Qj(s.props,C,N)),i&&st.createElement("line",Dw({className:"recharts-polar-angle-axis-tick-line"},_,A)),l&&e.renderTickItem(l,T,h?h(C.value,N):C.value))});return st.createElement(No,{className:"recharts-polar-angle-axis-ticks"},j)}},{key:"render",value:function(){var s=this.props,a=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!a||!a.length?null:st.createElement(No,{className:si("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,o){var l;return st.isValidElement(s)?l=st.cloneElement(s,a):Ua(s)?l=s(a):l=st.createElement(Jj,Dw({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(I.PureComponent);Tae(Aae,"displayName","PolarAngleAxis");Tae(Aae,"axisType","angleAxis");Tae(Aae,"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 cBt=M7e,dBt=cBt(Object.getPrototypeOf,Object),uBt=dBt,hBt=vy,fBt=uBt,pBt=_y,mBt="[object Object]",gBt=Function.prototype,xBt=Object.prototype,NBe=gBt.toString,yBt=xBt.hasOwnProperty,vBt=NBe.call(Object);function _Bt(t){if(!pBt(t)||hBt(t)!=mBt)return!1;var e=fBt(t);if(e===null)return!0;var n=yBt.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&NBe.call(n)==vBt}var bBt=_Bt;const wBt=Hi(bBt);var jBt=vy,kBt=_y,NBt="[object Boolean]";function SBt(t){return t===!0||t===!1||kBt(t)&&jBt(t)==NBt}var CBt=SBt;const MBt=Hi(CBt);function HE(t){"@babel/helpers - typeof";return HE=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},HE(t)}function Hre(){return Hre=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:_,x:h,y:p},to:{upperWidth:x,lowerWidth:y,height:_,x:h,y:p},duration:N,animationEasing:C,isActive:E},function(P){var z=P.upperWidth,F=P.lowerWidth,q=P.height,V=P.x,K=P.y;return st.createElement(py,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:N,easing:C},st.createElement("path",Hre({},Ia(n,!0),{className:T,d:M3e(V,K,z,F,q),ref:s})))}):st.createElement("g",null,st.createElement("path",Hre({},Ia(n,!0),{className:T,d:M3e(h,p,x,y,_)})))},zBt=["option","shapeType","propTransformer","activeClassName","isActive"];function WE(t){"@babel/helpers - typeof";return WE=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},WE(t)}function BBt(t,e){if(t==null)return{};var n=$Bt(t,e),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function $Bt(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 T3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Wre(t){for(var e=1;e0?lf(P,"paddingAngle",0):0;if(F){var V=T0(F.endAngle-F.startAngle,P.endAngle-P.startAngle),K=Zo(Zo({},P),{},{startAngle:T+q,endAngle:T+V(N)+q});A.push(K),T=K.endAngle}else{var G=P.endAngle,te=P.startAngle,ie=T0(0,G-te),oe=ie(N),ye=Zo(Zo({},P),{},{startAngle:T+q,endAngle:T+oe+q});A.push(ye),T=ye.endAngle}}),st.createElement(No,null,s.renderSectorsStatically(A))})}},{key:"attachKeyboardHandlers",value:function(s){var a=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"ArrowRight":{var i=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[i].focus(),a.setState({sectorToFocus:i});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,a=s.sectors,o=s.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!jae(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,a=this.props,o=a.hide,l=a.sectors,i=a.className,h=a.label,p=a.cx,x=a.cy,y=a.innerRadius,_=a.outerRadius,j=a.isAnimationActive,C=this.state.isAnimationFinished;if(o||!l||!l.length||!Dn(p)||!Dn(x)||!Dn(y)||!Dn(_))return null;var N=si("recharts-pie",i);return st.createElement(No,{tabIndex:this.props.rootTabIndex,className:N,ref:function(E){s.pieRef=E}},this.renderSectors(),h&&this.renderLabels(l),dd.renderCallByParent(this.props,null,!1),(!j||C)&&D1.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return a.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:s.sectors!==a.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,a){return s>a?"start":s=360?T:T-1)*h,z=A-T*j-P,F=a.reduce(function(K,G){var te=ru(G,E,0);return K+(Dn(te)?te:0)},0),q;if(F>0){var V;q=a.map(function(K,G){var te=ru(K,E,0),ie=ru(K,x,G),oe=(Dn(te)?te:0)/F,ye;G?ye=V.endAngle+Du(N)*h*(te!==0?1:0):ye=l;var ae=ye+Du(N)*((te!==0?j:0)+oe*z),pe=(ye+ae)/2,se=(C.innerRadius+C.outerRadius)/2,he=[{name:ie,value:te,payload:K,dataKey:E,type:_}],ue=Jo(C.cx,C.cy,se,pe);return V=Zo(Zo(Zo({percent:oe,cornerRadius:o,name:ie,tooltipPayload:he,midAngle:pe,middleRadius:se,tooltipPosition:ue},K),C),{},{value:ru(K,E),startAngle:ye,endAngle:ae,payload:K,paddingAngle:Du(N)*h}),V})}return Zo(Zo({},C),{},{sectors:q,data:a})});var l$t=Math.ceil,c$t=Math.max;function d$t(t,e,n,s){for(var a=-1,o=c$t(l$t((e-t)/(n||1)),0),l=Array(o);o--;)l[s?o:++a]=t,t+=n;return l}var u$t=d$t,h$t=G7e,P3e=1/0,f$t=17976931348623157e292;function p$t(t){if(!t)return t===0?t:0;if(t=h$t(t),t===P3e||t===-P3e){var e=t<0?-1:1;return e*f$t}return t===t?t:0}var TBe=p$t,m$t=u$t,g$t=hae,sde=TBe;function x$t(t){return function(e,n,s){return s&&typeof s!="number"&&g$t(e,n,s)&&(n=s=void 0),e=sde(e),n===void 0?(n=e,e=0):n=sde(n),s=s===void 0?e0&&s.handleDrag(a.changedTouches[0])}),Bh(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=s.props,o=a.endIndex,l=a.onDragEnd,i=a.startIndex;l==null||l({endIndex:o,startIndex:i})}),s.detachDragEndListener()}),Bh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Bh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Bh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Bh(s,"handleSlideDragStart",function(a){var o=F3e(a)?a.changedTouches[0]:a;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 E$t(e,t),C$t(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,o=s.endX,l=this.state.scaleValues,i=this.props,h=i.gap,p=i.data,x=p.length-1,y=Math.min(a,o),_=Math.max(a,o),j=e.getIndexInRange(l,y),C=e.getIndexInRange(l,_);return{startIndex:j-j%h,endIndex:C===x?x:C-C%h}}},{key:"getTextOfTick",value:function(s){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,h=ru(o[s],i,s);return Ua(l)?l(h,s):h}},{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 a=this.state,o=a.slideMoveStartX,l=a.startX,i=a.endX,h=this.props,p=h.x,x=h.width,y=h.travellerWidth,_=h.startIndex,j=h.endIndex,C=h.onChange,N=s.pageX-o;N>0?N=Math.min(N,p+x-y-i,p+x-y-l):N<0&&(N=Math.max(N,p-l,p-i));var A=this.getIndex({startX:l+N,endX:i+N});(A.startIndex!==_||A.endIndex!==j)&&C&&C(A),this.setState({startX:l+N,endX:i+N,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var o=F3e(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,o=a.brushMoveStartX,l=a.movingTravellerId,i=a.endX,h=a.startX,p=this.state[l],x=this.props,y=x.x,_=x.width,j=x.travellerWidth,C=x.onChange,N=x.gap,A=x.data,E={startX:this.state.startX,endX:this.state.endX},T=s.pageX-o;T>0?T=Math.min(T,y+_-j-p):T<0&&(T=Math.max(T,y-p)),E[l]=p+T;var P=this.getIndex(E),z=P.startIndex,F=P.endIndex,q=function(){var K=A.length-1;return l==="startX"&&(i>h?z%N===0:F%N===0)||ih?F%N===0:z%N===0)||i>h&&F===K};this.setState(Bh(Bh({},l,p+T),"brushMoveStartX",s.pageX),function(){C&&q()&&C(P)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var o=this,l=this.state,i=l.scaleValues,h=l.startX,p=l.endX,x=this.state[a],y=i.indexOf(x);if(y!==-1){var _=y+s;if(!(_===-1||_>=i.length)){var j=i[_];a==="startX"&&j>=p||a==="endX"&&j<=h||this.setState(Bh({},a,j),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,h=s.fill,p=s.stroke;return st.createElement("rect",{stroke:p,fill:h,x:a,y:o,width:l,height:i})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,h=s.data,p=s.children,x=s.padding,y=I.Children.only(p);return y?st.cloneElement(y,{x:a,y:o,width:l,height:i,margin:x,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(s,a){var o,l,i=this,h=this.props,p=h.y,x=h.travellerWidth,y=h.height,_=h.traveller,j=h.ariaLabel,C=h.data,N=h.startIndex,A=h.endIndex,E=Math.max(s,this.props.x),T=ade(ade({},Ia(this.props,!1)),{},{x:E,y:p,width:x,height:y}),P=j||"Min value: ".concat((o=C[N])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=C[A])===null||l===void 0?void 0:l.name);return st.createElement(No,{tabIndex:0,role:"slider","aria-label":P,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),i.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,a))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(_,T))}},{key:"renderSlide",value:function(s,a){var o=this.props,l=o.y,i=o.height,h=o.stroke,p=o.travellerWidth,x=Math.min(s,a)+p,y=Math.max(Math.abs(a-s)-p,0);return st.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:h,fillOpacity:.2,x,y:l,width:y,height:i})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,o=s.endIndex,l=s.y,i=s.height,h=s.travellerWidth,p=s.stroke,x=this.state,y=x.startX,_=x.endX,j=5,C={pointerEvents:"none",fill:p};return st.createElement(No,{className:"recharts-brush-texts"},st.createElement(Jj,Zre({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,_)-j,y:l+i/2},C),this.getTextOfTick(a)),st.createElement(Jj,Zre({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,_)+h+j,y:l+i/2},C),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,a=s.data,o=s.className,l=s.children,i=s.x,h=s.y,p=s.width,x=s.height,y=s.alwaysShowText,_=this.state,j=_.startX,C=_.endX,N=_.isTextActive,A=_.isSlideMoving,E=_.isTravellerMoving,T=_.isTravellerFocused;if(!a||!a.length||!Dn(i)||!Dn(h)||!Dn(p)||!Dn(x)||p<=0||x<=0)return null;var P=si("recharts-brush",o),z=st.Children.count(l)===1,F=N$t("userSelect","none");return st.createElement(No,{className:P,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),z&&this.renderPanorama(),this.renderSlide(j,C),this.renderTravellerLayer(j,"startX"),this.renderTravellerLayer(C,"endX"),(N||A||E||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,o=s.y,l=s.width,i=s.height,h=s.stroke,p=Math.floor(o+i/2)-1;return st.createElement(st.Fragment,null,st.createElement("rect",{x:a,y:o,width:l,height:i,fill:h,stroke:"none"}),st.createElement("line",{x1:a+1,y1:p,x2:a+l-1,y2:p,fill:"none",stroke:"#fff"}),st.createElement("line",{x1:a+1,y1:p+2,x2:a+l-1,y2:p+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,a){var o;return st.isValidElement(s)?o=st.cloneElement(s,a):Ua(s)?o=s(a):o=e.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(s,a){var o=s.data,l=s.width,i=s.x,h=s.travellerWidth,p=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==a.prevData||p!==a.prevUpdateId)return ade({prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:i,prevWidth:l},o&&o.length?P$t({data:o,width:l,x:i,travellerWidth:h,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||i!==a.prevX||h!==a.prevTravellerWidth)){a.scale.range([i,i+l-h]);var _=a.scale.domain().map(function(j){return a.scale(j)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:i,prevWidth:l,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:_}}return null}},{key:"getIndexInRange",value:function(s,a){for(var o=s.length,l=0,i=o-1;i-l>1;){var h=Math.floor((l+i)/2);s[h]>a?i=h:l=h}return a>=s[i]?i:l}}])}(I.PureComponent);Bh(DC,"displayName","Brush");Bh(DC,"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 L$t=Vye;function O$t(t,e){var n;return L$t(t,function(s,a,o){return n=e(s,a,o),!n}),!!n}var D$t=O$t,R$t=_7e,F$t=Vg,z$t=D$t,B$t=Sh,$$t=hae;function U$t(t,e,n){var s=B$t(t)?R$t:z$t;return n&&$$t(t,e,n)&&(e=void 0),s(t,F$t(e))}var q$t=U$t;const V$t=Hi(q$t);var Ig=function(e,n){var s=e.alwaysShow,a=e.ifOverflow;return s&&(a="extendDomain"),a===n},z3e=U7e;function H$t(t,e,n){e=="__proto__"&&z3e?z3e(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var W$t=H$t,G$t=W$t,K$t=B7e,Z$t=Vg;function Y$t(t,e){var n={};return e=Z$t(e),K$t(t,function(s,a,o){G$t(n,a,e(s,a,o))}),n}var X$t=Y$t;const Q$t=Hi(X$t);function J$t(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 gUt(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 xUt(t,e){var n=t.x,s=t.y,a=mUt(t,uUt),o="".concat(n),l=parseInt(o,10),i="".concat(s),h=parseInt(i,10),p="".concat(e.height||a.height),x=parseInt(p,10),y="".concat(e.width||a.width),_=parseInt(y,10);return JM(JM(JM(JM(JM({},e),a),l?{x:l}:{}),h?{y:h}:{}),{},{height:x,width:_,name:e.name,radius:e.radius})}function $3e(t){return st.createElement(SBe,gpe({shapeType:"rectangle",propTransformer:xUt,activeClassName:"recharts-active-bar"},t))}var yUt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,a){if(typeof e=="number")return e;var o=Dn(s)||VSt(s);return o?e(s,a):(o||tk(),n)}},vUt=["value","background"],LBe;function RC(t){"@babel/helpers - typeof";return RC=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},RC(t)}function _Ut(t,e){if(t==null)return{};var n=bUt(t,e),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function bUt(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 Xre(){return Xre=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(pe)0&&Math.abs(ae)0&&(ye=Math.min((Le||0)-(ae[ke-1]||0),ye))}),Number.isFinite(ye)){var pe=ye/oe,se=N.layout==="vertical"?s.height:s.width;if(N.padding==="gap"&&(V=pe*se/2),N.padding==="no-gap"){var he=Ru(e.barCategoryGap,pe*se),ue=pe*se/2;V=ue-he-(ue-he)/se*he}}}a==="xAxis"?K=[s.left+(P.left||0)+(V||0),s.left+s.width-(P.right||0)-(V||0)]:a==="yAxis"?K=h==="horizontal"?[s.top+s.height-(P.bottom||0),s.top+(P.top||0)]:[s.top+(P.top||0)+(V||0),s.top+s.height-(P.bottom||0)-(V||0)]:K=N.range,F&&(K=[K[1],K[0]]);var _e=eBe(N,o,_),Ae=_e.scale,Ce=_e.realScaleType;Ae.domain(E).range(K),tBe(Ae);var Se=rBe(Ae,tm(tm({},N),{},{realScaleType:Ce}));a==="xAxis"?(ie=A==="top"&&!z||A==="bottom"&&z,G=s.left,te=y[q]-ie*N.height):a==="yAxis"&&(ie=A==="left"&&!z||A==="right"&&z,G=y[q]-ie*N.width,te=s.top);var ge=tm(tm(tm({},N),Se),{},{realScaleType:Ce,x:G,y:te,scale:Ae,width:a==="xAxis"?s.width:N.width,height:a==="yAxis"?s.height:N.height});return ge.bandSize=Dre(ge,Se),!N.hide&&a==="xAxis"?y[q]+=(ie?-1:1)*ge.height:N.hide||(y[q]+=(ie?-1:1)*ge.width),tm(tm({},j),{},Pae({},C,ge))},{})},FBe=function(e,n){var s=e.x,a=e.y,o=n.x,l=n.y;return{x:Math.min(s,o),y:Math.min(a,l),width:Math.abs(o-s),height:Math.abs(l-a)}},PUt=function(e){var n=e.x1,s=e.y1,a=e.x2,o=e.y2;return FBe({x:n,y:s},{x:a,y:o})},zBe=function(){function t(e){TUt(this,t),this.scale=e}return AUt(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]:{},a=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(n)+i}default:return this.scale(n)}if(a){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),a=s[0],o=s[s.length-1];return a<=o?n>=a&&n<=o:n>=o&&n<=a}}],[{key:"create",value:function(n){return new t(n)}}])}();Pae(zBe,"EPS",1e-4);var _0e=function(e){var n=Object.keys(e).reduce(function(s,a){return tm(tm({},s),{},Pae({},a,zBe.create(e[a])))},{});return tm(tm({},n),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return Q$t(a,function(h,p){return n[p].apply(h,{bandAware:l,position:i})})},isInRange:function(a){return PBe(a,function(o,l){return n[l].isInRange(o)})}})};function LUt(t){return(t%180+180)%180}var OUt=function(e){var n=e.width,s=e.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=LUt(a),l=o*Math.PI/180,i=Math.atan(s/n),h=l>i&&l-1?a[o?e[l]:l]:void 0}}var BUt=zUt,$Ut=TBe;function UUt(t){var e=$Ut(t),n=e%1;return e===e?n?e-n:e:0}var qUt=UUt,VUt=L7e,HUt=Vg,WUt=qUt,GUt=Math.max;function KUt(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var a=n==null?0:WUt(n);return a<0&&(a=GUt(s+a,0)),VUt(t,HUt(e),a)}var ZUt=KUt,YUt=BUt,XUt=ZUt,QUt=YUt(XUt),JUt=QUt;const eqt=Hi(JUt);var tqt=Y4t(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("")}),b0e=I.createContext(void 0),w0e=I.createContext(void 0),BBe=I.createContext(void 0),$Be=I.createContext({}),UBe=I.createContext(void 0),qBe=I.createContext(0),VBe=I.createContext(0),W3e=function(e){var n=e.state,s=n.xAxisMap,a=n.yAxisMap,o=n.offset,l=e.clipPathId,i=e.children,h=e.width,p=e.height,x=tqt(o);return st.createElement(b0e.Provider,{value:s},st.createElement(w0e.Provider,{value:a},st.createElement($Be.Provider,{value:o},st.createElement(BBe.Provider,{value:x},st.createElement(UBe.Provider,{value:l},st.createElement(qBe.Provider,{value:p},st.createElement(VBe.Provider,{value:h},i)))))))},rqt=function(){return I.useContext(UBe)},HBe=function(e){var n=I.useContext(b0e);n==null&&tk();var s=n[e];return s==null&&tk(),s},nqt=function(){var e=I.useContext(b0e);return D0(e)},sqt=function(){var e=I.useContext(w0e),n=eqt(e,function(s){return PBe(s.domain,Number.isFinite)});return n||D0(e)},WBe=function(e){var n=I.useContext(w0e);n==null&&tk();var s=n[e];return s==null&&tk(),s},aqt=function(){var e=I.useContext(BBe);return e},iqt=function(){return I.useContext($Be)},j0e=function(){return I.useContext(VBe)},k0e=function(){return I.useContext(qBe)};function FC(t){"@babel/helpers - typeof";return FC=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},FC(t)}function oqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lqt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);nt*a)return!1;var o=n();return t*(e-t*o/2-s)>=0&&t*(e+t*o/2-a)<=0}function qqt(t,e){return JBe(t,e+1)}function Vqt(t,e,n,s,a){for(var o=(s||[]).slice(),l=e.start,i=e.end,h=0,p=1,x=l,y=function(){var C=s==null?void 0:s[h];if(C===void 0)return{v:JBe(s,p)};var N=h,A,E=function(){return A===void 0&&(A=n(C,N)),A},T=C.coordinate,P=h===0||rne(t,T,E,x,i);P||(h=0,x=l,p+=1),P&&(x=T+t*(E()/2+a),h+=p)},_;p<=o.length;)if(_=y(),_)return _.v;return[]}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 e5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Jd(t){for(var e=1;e0?j.coordinate-A*t:j.coordinate})}else o[_]=j=Jd(Jd({},j),{},{tickCoord:j.coordinate});var E=rne(t,j.tickCoord,N,i,h);E&&(h=j.tickCoord-t*(N()/2+a),o[_]=Jd(Jd({},j),{},{isShow:!0}))},x=l-1;x>=0;x--)p(x);return o}function Zqt(t,e,n,s,a,o){var l=(s||[]).slice(),i=l.length,h=e.start,p=e.end;if(o){var x=s[i-1],y=n(x,i-1),_=t*(x.coordinate+t*y/2-p);l[i-1]=x=Jd(Jd({},x),{},{tickCoord:_>0?x.coordinate-_*t:x.coordinate});var j=rne(t,x.tickCoord,function(){return y},h,p);j&&(p=x.tickCoord-t*(y/2+a),l[i-1]=Jd(Jd({},x),{},{isShow:!0}))}for(var C=o?i-1:i,N=function(T){var P=l[T],z,F=function(){return z===void 0&&(z=n(P,T)),z};if(T===0){var q=t*(P.coordinate-t*F()/2-h);l[T]=P=Jd(Jd({},P),{},{tickCoord:q<0?P.coordinate-q*t:P.coordinate})}else l[T]=P=Jd(Jd({},P),{},{tickCoord:P.coordinate});var V=rne(t,P.tickCoord,F,h,p);V&&(h=P.tickCoord+t*(F()/2+a),l[T]=Jd(Jd({},P),{},{isShow:!0}))},A=0;A=2?Du(a[1].coordinate-a[0].coordinate):1,E=Uqt(o,A,j);return h==="equidistantPreserveStart"?Vqt(A,E,N,a,l):(h==="preserveStart"||h==="preserveStartEnd"?_=Zqt(A,E,N,a,l,h==="preserveStartEnd"):_=Kqt(A,E,N,a,l),_.filter(function(T){return T.isShow}))}var Yqt=["viewBox"],Xqt=["viewBox"],Qqt=["ticks"];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 U4(){return U4=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 Jqt(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 eVt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r5e(t,e){for(var n=0;n0?h(this.props):h(j)),l<=0||i<=0||!C||!C.length?null:st.createElement(No,{className:si("recharts-cartesian-axis",p),ref:function(A){s.layerReference=A}},o&&this.renderAxisLine(),this.renderTicks(C,this.state.fontSize,this.state.letterSpacing),dd.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,o){var l,i=si(a.className,"recharts-cartesian-axis-tick-value");return st.isValidElement(s)?l=st.cloneElement(s,Fc(Fc({},a),{},{className:i})):Ua(s)?l=s(Fc(Fc({},a),{},{className:i})):l=st.createElement(Jj,U4({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(I.Component);M0e(M3,"displayName","CartesianAxis");M0e(M3,"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 oVt=["x1","y1","x2","y2","key"],lVt=["offset"];function rk(t){"@babel/helpers - typeof";return rk=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},rk(t)}function n5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function tu(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function hVt(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 fVt=function(e){var n=e.fill;if(!n||n==="none")return null;var s=e.fillOpacity,a=e.x,o=e.y,l=e.width,i=e.height,h=e.ry;return st.createElement("rect",{x:a,y:o,ry:h,width:l,height:i,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function r$e(t,e){var n;if(st.isValidElement(t))n=st.cloneElement(t,e);else if(Ua(t))n=t(e);else{var s=e.x1,a=e.y1,o=e.x2,l=e.y2,i=e.key,h=s5e(e,oVt),p=Ia(h,!1);p.offset;var x=s5e(p,lVt);n=st.createElement("line",Yw({},x,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:i}))}return n}function pVt(t){var e=t.x,n=t.width,s=t.horizontal,a=s===void 0?!0:s,o=t.horizontalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,h){var p=tu(tu({},t),{},{x1:e,y1:i,x2:e+n,y2:i,key:"line-".concat(h),index:h});return r$e(a,p)});return st.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function mVt(t){var e=t.y,n=t.height,s=t.vertical,a=s===void 0?!0:s,o=t.verticalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,h){var p=tu(tu({},t),{},{x1:i,y1:e,x2:i,y2:e+n,key:"line-".concat(h),index:h});return r$e(a,p)});return st.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function gVt(t){var e=t.horizontalFill,n=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,i=t.horizontalPoints,h=t.horizontal,p=h===void 0?!0:h;if(!p||!e||!e.length)return null;var x=i.map(function(_){return Math.round(_+a-a)}).sort(function(_,j){return _-j});a!==x[0]&&x.unshift(0);var y=x.map(function(_,j){var C=!x[j+1],N=C?a+l-_:x[j+1]-_;if(N<=0)return null;var A=j%e.length;return st.createElement("rect",{key:"react-".concat(j),y:_,x:s,height:N,width:o,stroke:"none",fill:e[A],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return st.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function xVt(t){var e=t.vertical,n=e===void 0?!0:e,s=t.verticalFill,a=t.fillOpacity,o=t.x,l=t.y,i=t.width,h=t.height,p=t.verticalPoints;if(!n||!s||!s.length)return null;var x=p.map(function(_){return Math.round(_+o-o)}).sort(function(_,j){return _-j});o!==x[0]&&x.unshift(0);var y=x.map(function(_,j){var C=!x[j+1],N=C?o+i-_:x[j+1]-_;if(N<=0)return null;var A=j%s.length;return st.createElement("rect",{key:"react-".concat(j),x:_,y:l,width:N,height:h,stroke:"none",fill:s[A],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return st.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var yVt=function(e,n){var s=e.xAxis,a=e.width,o=e.height,l=e.offset;return J9e(C0e(tu(tu(tu({},M3.defaultProps),s),{},{ticks:zx(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},vVt=function(e,n){var s=e.yAxis,a=e.width,o=e.height,l=e.offset;return J9e(C0e(tu(tu(tu({},M3.defaultProps),s),{},{ticks:zx(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,n)},g4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function n$e(t){var e,n,s,a,o,l,i=j0e(),h=k0e(),p=iqt(),x=tu(tu({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:g4.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:g4.fill,horizontal:(s=t.horizontal)!==null&&s!==void 0?s:g4.horizontal,horizontalFill:(a=t.horizontalFill)!==null&&a!==void 0?a:g4.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:g4.vertical,verticalFill:(l=t.verticalFill)!==null&&l!==void 0?l:g4.verticalFill,x:Dn(t.x)?t.x:p.left,y:Dn(t.y)?t.y:p.top,width:Dn(t.width)?t.width:p.width,height:Dn(t.height)?t.height:p.height}),y=x.x,_=x.y,j=x.width,C=x.height,N=x.syncWithTicks,A=x.horizontalValues,E=x.verticalValues,T=nqt(),P=sqt();if(!Dn(j)||j<=0||!Dn(C)||C<=0||!Dn(y)||y!==+y||!Dn(_)||_!==+_)return null;var z=x.verticalCoordinatesGenerator||yVt,F=x.horizontalCoordinatesGenerator||vVt,q=x.horizontalPoints,V=x.verticalPoints;if((!q||!q.length)&&Ua(F)){var K=A&&A.length,G=F({yAxis:P?tu(tu({},P),{},{ticks:K?A:P.ticks}):void 0,width:i,height:h,offset:p},K?!0:N);_m(Array.isArray(G),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(rk(G),"]")),Array.isArray(G)&&(q=G)}if((!V||!V.length)&&Ua(z)){var te=E&&E.length,ie=z({xAxis:T?tu(tu({},T),{},{ticks:te?E:T.ticks}):void 0,width:i,height:h,offset:p},te?!0:N);_m(Array.isArray(ie),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(rk(ie),"]")),Array.isArray(ie)&&(V=ie)}return st.createElement("g",{className:"recharts-cartesian-grid"},st.createElement(fVt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),st.createElement(pVt,Yw({},x,{offset:p,horizontalPoints:q,xAxis:T,yAxis:P})),st.createElement(mVt,Yw({},x,{offset:p,verticalPoints:V,xAxis:T,yAxis:P})),st.createElement(gVt,Yw({},x,{horizontalPoints:q})),st.createElement(xVt,Yw({},x,{verticalPoints:V})))}n$e.displayName="CartesianGrid";function UC(t){"@babel/helpers - typeof";return UC=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},UC(t)}function _Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bVt(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 oHt(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 lHt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cHt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n0?l:e&&e.length&&Dn(a)&&Dn(o)?e.slice(a,o+1):[]};function x$e(t){return t==="number"?[0,"auto"]:void 0}var Ppe=function(e,n,s,a){var o=e.graphicalItems,l=e.tooltipAxis,i=Bae(n,e);return s<0||!o||!o.length||s>=i.length?null:o.reduce(function(h,p){var x,y=(x=p.props.data)!==null&&x!==void 0?x:n;y&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=s&&(y=y.slice(e.dataStartIndex,e.dataEndIndex+1));var _;if(l.dataKey&&!l.allowDuplicatedCategory){var j=y===void 0?i:y;_=ife(j,l.dataKey,a)}else _=y&&y[s]||i[s];return _?[].concat(HC(h),[sBe(p,_)]):h},[])},d5e=function(e,n,s,a){var o=a||{x:e.chartX,y:e.chartY},l=bHt(o,s),i=e.orderedTooltipTicks,h=e.tooltipAxis,p=e.tooltipTicks,x=rFt(l,i,p,h);if(x>=0&&p){var y=p[x]&&p[x].value,_=Ppe(e,n,x,y),j=wHt(s,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:_,activeCoordinate:j}}return null},jHt=function(e,n){var s=n.axes,a=n.graphicalItems,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=e.layout,y=e.children,_=e.stackOffset,j=Q9e(x,o);return s.reduce(function(C,N){var A,E=N.type.defaultProps!==void 0?Zr(Zr({},N.type.defaultProps),N.props):N.props,T=E.type,P=E.dataKey,z=E.allowDataOverflow,F=E.allowDuplicatedCategory,q=E.scale,V=E.ticks,K=E.includeHidden,G=E[l];if(C[G])return C;var te=Bae(e.data,{graphicalItems:a.filter(function(Se){var ge,Le=l in Se.props?Se.props[l]:(ge=Se.type.defaultProps)===null||ge===void 0?void 0:ge[l];return Le===G}),dataStartIndex:h,dataEndIndex:p}),ie=te.length,oe,ye,ae;ZVt(E.domain,z,T)&&(oe=Kfe(E.domain,null,z),j&&(T==="number"||q!=="auto")&&(ae=kA(te,P,"category")));var pe=x$e(T);if(!oe||oe.length===0){var se,he=(se=E.domain)!==null&&se!==void 0?se:pe;if(P){if(oe=kA(te,P,T),T==="category"&&j){var ue=WSt(oe);F&&ue?(ye=oe,oe=Kre(0,ie)):F||(oe=OCe(he,oe,N).reduce(function(Se,ge){return Se.indexOf(ge)>=0?Se:[].concat(HC(Se),[ge])},[]))}else if(T==="category")F?oe=oe.filter(function(Se){return Se!==""&&!_i(Se)}):oe=OCe(he,oe,N).reduce(function(Se,ge){return Se.indexOf(ge)>=0||ge===""||_i(ge)?Se:[].concat(HC(Se),[ge])},[]);else if(T==="number"){var _e=oFt(te,a.filter(function(Se){var ge,Le,ke=l in Se.props?Se.props[l]:(ge=Se.type.defaultProps)===null||ge===void 0?void 0:ge[l],Be="hide"in Se.props?Se.props.hide:(Le=Se.type.defaultProps)===null||Le===void 0?void 0:Le.hide;return ke===G&&(K||!Be)}),P,o,x);_e&&(oe=_e)}j&&(T==="number"||q!=="auto")&&(ae=kA(te,P,"category"))}else j?oe=Kre(0,ie):i&&i[G]&&i[G].hasStack&&T==="number"?oe=_==="expand"?[0,1]:nBe(i[G].stackGroups,h,p):oe=X9e(te,a.filter(function(Se){var ge=l in Se.props?Se.props[l]:Se.type.defaultProps[l],Le="hide"in Se.props?Se.props.hide:Se.type.defaultProps.hide;return ge===G&&(K||!Le)}),T,x,!0);if(T==="number")oe=Ape(y,oe,G,o,V),he&&(oe=Kfe(he,oe,z));else if(T==="category"&&he){var Ae=he,Ce=oe.every(function(Se){return Ae.indexOf(Se)>=0});Ce&&(oe=Ae)}}return Zr(Zr({},C),{},ba({},G,Zr(Zr({},E),{},{axisType:o,domain:oe,categoricalDomain:ae,duplicateDomain:ye,originalDomain:(A=E.domain)!==null&&A!==void 0?A:pe,isCategorical:j,layout:x})))},{})},kHt=function(e,n){var s=n.graphicalItems,a=n.Axis,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=e.layout,y=e.children,_=Bae(e.data,{graphicalItems:s,dataStartIndex:h,dataEndIndex:p}),j=_.length,C=Q9e(x,o),N=-1;return s.reduce(function(A,E){var T=E.type.defaultProps!==void 0?Zr(Zr({},E.type.defaultProps),E.props):E.props,P=T[l],z=x$e("number");if(!A[P]){N++;var F;return C?F=Kre(0,j):i&&i[P]&&i[P].hasStack?(F=nBe(i[P].stackGroups,h,p),F=Ape(y,F,P,o)):(F=Kfe(z,X9e(_,s.filter(function(q){var V,K,G=l in q.props?q.props[l]:(V=q.type.defaultProps)===null||V===void 0?void 0:V[l],te="hide"in q.props?q.props.hide:(K=q.type.defaultProps)===null||K===void 0?void 0:K.hide;return G===P&&!te}),"number",x),a.defaultProps.allowDataOverflow),F=Ape(y,F,P,o)),Zr(Zr({},A),{},ba({},P,Zr(Zr({axisType:o},a.defaultProps),{},{hide:!0,orientation:lf(vHt,"".concat(o,".").concat(N%2),null),domain:F,originalDomain:z,isCategorical:C,layout:x})))}return A},{})},NHt=function(e,n){var s=n.axisType,a=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,i=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=e.children,y="".concat(a,"Id"),_=sp(x,o),j={};return _&&_.length?j=jHt(e,{axes:_,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:h,dataEndIndex:p}):l&&l.length&&(j=kHt(e,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:h,dataEndIndex:p})),j},SHt=function(e){var n=D0(e),s=zx(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:Hye(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Dre(n,s)}},u5e=function(e){var n=e.children,s=e.defaultShowTooltip,a=qh(n,DC),o=0,l=0;return e.data&&e.data.length!==0&&(l=e.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(o=a.props.startIndex),a.props.endIndex>=0&&(l=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!s}},CHt=function(e){return!e||!e.length?!1:e.some(function(n){var s=Jx(n&&n.type);return s&&s.indexOf("Bar")>=0})},h5e=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"}},MHt=function(e,n){var s=e.props,a=e.graphicalItems,o=e.xAxisMap,l=o===void 0?{}:o,i=e.yAxisMap,h=i===void 0?{}:i,p=s.width,x=s.height,y=s.children,_=s.margin||{},j=qh(y,DC),C=qh(y,OS),N=Object.keys(h).reduce(function(F,q){var V=h[q],K=V.orientation;return!V.mirror&&!V.hide?Zr(Zr({},F),{},ba({},K,F[K]+V.width)):F},{left:_.left||0,right:_.right||0}),A=Object.keys(l).reduce(function(F,q){var V=l[q],K=V.orientation;return!V.mirror&&!V.hide?Zr(Zr({},F),{},ba({},K,lf(F,"".concat(K))+V.height)):F},{top:_.top||0,bottom:_.bottom||0}),E=Zr(Zr({},A),N),T=E.bottom;j&&(E.bottom+=j.props.height||DC.defaultProps.height),C&&n&&(E=aFt(E,a,s,n));var P=p-E.left-E.right,z=x-E.top-E.bottom;return Zr(Zr({brushBottom:T},E),{},{width:Math.max(P,0),height:Math.max(z,0)})},THt=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},y$e=function(e){var n=e.chartName,s=e.GraphicalChild,a=e.defaultTooltipEventType,o=a===void 0?"axis":a,l=e.validateTooltipEventTypes,i=l===void 0?["axis"]:l,h=e.axisComponents,p=e.legendContent,x=e.formatAxisMap,y=e.defaultProps,_=function(E,T){var P=T.graphicalItems,z=T.stackGroups,F=T.offset,q=T.updateId,V=T.dataStartIndex,K=T.dataEndIndex,G=E.barSize,te=E.layout,ie=E.barGap,oe=E.barCategoryGap,ye=E.maxBarSize,ae=h5e(te),pe=ae.numericAxisName,se=ae.cateAxisName,he=CHt(P),ue=[];return P.forEach(function(_e,Ae){var Ce=Bae(E.data,{graphicalItems:[_e],dataStartIndex:V,dataEndIndex:K}),Se=_e.type.defaultProps!==void 0?Zr(Zr({},_e.type.defaultProps),_e.props):_e.props,ge=Se.dataKey,Le=Se.maxBarSize,ke=Se["".concat(pe,"Id")],Be=Se["".concat(se,"Id")],Ee={},Ue=h.reduce(function(Oe,Qe){var nt=T["".concat(Qe.axisType,"Map")],gt=Se["".concat(Qe.axisType,"Id")];nt&&nt[gt]||Qe.axisType==="zAxis"||tk();var mt=nt[gt];return Zr(Zr({},Oe),{},ba(ba({},Qe.axisType,mt),"".concat(Qe.axisType,"Ticks"),zx(mt)))},Ee),Fe=Ue[se],be=Ue["".concat(se,"Ticks")],tt=z&&z[ke]&&z[ke].hasStack&&gFt(_e,z[ke].stackGroups),Te=Jx(_e.type).indexOf("Bar")>=0,Ke=Dre(Fe,be),me=[],yt=he&&nFt({barSize:G,stackGroups:z,totalSize:THt(Ue,se)});if(Te){var rt,at,Me=_i(Le)?ye:Le,ft=(rt=(at=Dre(Fe,be,!0))!==null&&at!==void 0?at:Me)!==null&&rt!==void 0?rt:0;me=sFt({barGap:ie,barCategoryGap:oe,bandSize:ft!==Ke?ft:Ke,sizeList:yt[Be],maxBarSize:Me}),ft!==Ke&&(me=me.map(function(Oe){return Zr(Zr({},Oe),{},{position:Zr(Zr({},Oe.position),{},{offset:Oe.position.offset-ft/2})})}))}var qe=_e&&_e.type&&_e.type.getComposedData;qe&&ue.push({props:Zr(Zr({},qe(Zr(Zr({},Ue),{},{displayedData:Ce,props:E,dataKey:ge,item:_e,bandSize:Ke,barPosition:me,offset:F,stackedData:tt,layout:te,dataStartIndex:V,dataEndIndex:K}))),{},ba(ba(ba({key:_e.key||"item-".concat(Ae)},pe,Ue[pe]),se,Ue[se]),"animationId",q)),childIndex:sCt(_e,E.children),item:_e})}),ue},j=function(E,T){var P=E.props,z=E.dataStartIndex,F=E.dataEndIndex,q=E.updateId;if(!T4e({props:P}))return null;var V=P.children,K=P.layout,G=P.stackOffset,te=P.data,ie=P.reverseStackOrder,oe=h5e(K),ye=oe.numericAxisName,ae=oe.cateAxisName,pe=sp(V,s),se=pFt(te,pe,"".concat(ye,"Id"),"".concat(ae,"Id"),G,ie),he=h.reduce(function(Se,ge){var Le="".concat(ge.axisType,"Map");return Zr(Zr({},Se),{},ba({},Le,NHt(P,Zr(Zr({},ge),{},{graphicalItems:pe,stackGroups:ge.axisType===ye&&se,dataStartIndex:z,dataEndIndex:F}))))},{}),ue=MHt(Zr(Zr({},he),{},{props:P,graphicalItems:pe}),T==null?void 0:T.legendBBox);Object.keys(he).forEach(function(Se){he[Se]=x(P,he[Se],ue,Se.replace("Map",""),n)});var _e=he["".concat(ae,"Map")],Ae=SHt(_e),Ce=_(P,Zr(Zr({},he),{},{dataStartIndex:z,dataEndIndex:F,updateId:q,graphicalItems:pe,stackGroups:se,offset:ue}));return Zr(Zr({formattedGraphicalItems:Ce,graphicalItems:pe,offset:ue,stackGroups:se},Ae),he)},C=function(A){function E(T){var P,z,F;return lHt(this,E),F=uHt(this,E,[T]),ba(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ba(F,"accessibilityManager",new KVt),ba(F,"handleLegendBBoxUpdate",function(q){if(q){var V=F.state,K=V.dataStartIndex,G=V.dataEndIndex,te=V.updateId;F.setState(Zr({legendBBox:q},j({props:F.props,dataStartIndex:K,dataEndIndex:G,updateId:te},Zr(Zr({},F.state),{},{legendBBox:q}))))}}),ba(F,"handleReceiveSyncEvent",function(q,V,K){if(F.props.syncId===q){if(K===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(V)}}),ba(F,"handleBrushChange",function(q){var V=q.startIndex,K=q.endIndex;if(V!==F.state.dataStartIndex||K!==F.state.dataEndIndex){var G=F.state.updateId;F.setState(function(){return Zr({dataStartIndex:V,dataEndIndex:K},j({props:F.props,dataStartIndex:V,dataEndIndex:K,updateId:G},F.state))}),F.triggerSyncEvent({dataStartIndex:V,dataEndIndex:K})}}),ba(F,"handleMouseEnter",function(q){var V=F.getMouseInfo(q);if(V){var K=Zr(Zr({},V),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var G=F.props.onMouseEnter;Ua(G)&&G(K,q)}}),ba(F,"triggeredAfterMouseMove",function(q){var V=F.getMouseInfo(q),K=V?Zr(Zr({},V),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(K),F.triggerSyncEvent(K);var G=F.props.onMouseMove;Ua(G)&&G(K,q)}),ba(F,"handleItemMouseEnter",function(q){F.setState(function(){return{isTooltipActive:!0,activeItem:q,activePayload:q.tooltipPayload,activeCoordinate:q.tooltipPosition||{x:q.cx,y:q.cy}}})}),ba(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),ba(F,"handleMouseMove",function(q){q.persist(),F.throttleTriggeredAfterMouseMove(q)}),ba(F,"handleMouseLeave",function(q){F.throttleTriggeredAfterMouseMove.cancel();var V={isTooltipActive:!1};F.setState(V),F.triggerSyncEvent(V);var K=F.props.onMouseLeave;Ua(K)&&K(V,q)}),ba(F,"handleOuterEvent",function(q){var V=nCt(q),K=lf(F.props,"".concat(V));if(V&&Ua(K)){var G,te;/.*touch.*/i.test(V)?te=F.getMouseInfo(q.changedTouches[0]):te=F.getMouseInfo(q),K((G=te)!==null&&G!==void 0?G:{},q)}}),ba(F,"handleClick",function(q){var V=F.getMouseInfo(q);if(V){var K=Zr(Zr({},V),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var G=F.props.onClick;Ua(G)&&G(K,q)}}),ba(F,"handleMouseDown",function(q){var V=F.props.onMouseDown;if(Ua(V)){var K=F.getMouseInfo(q);V(K,q)}}),ba(F,"handleMouseUp",function(q){var V=F.props.onMouseUp;if(Ua(V)){var K=F.getMouseInfo(q);V(K,q)}}),ba(F,"handleTouchMove",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(q.changedTouches[0])}),ba(F,"handleTouchStart",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseDown(q.changedTouches[0])}),ba(F,"handleTouchEnd",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseUp(q.changedTouches[0])}),ba(F,"handleDoubleClick",function(q){var V=F.props.onDoubleClick;if(Ua(V)){var K=F.getMouseInfo(q);V(K,q)}}),ba(F,"handleContextMenu",function(q){var V=F.props.onContextMenu;if(Ua(V)){var K=F.getMouseInfo(q);V(K,q)}}),ba(F,"triggerSyncEvent",function(q){F.props.syncId!==void 0&&ode.emit(lde,F.props.syncId,q,F.eventEmitterSymbol)}),ba(F,"applySyncEvent",function(q){var V=F.props,K=V.layout,G=V.syncMethod,te=F.state.updateId,ie=q.dataStartIndex,oe=q.dataEndIndex;if(q.dataStartIndex!==void 0||q.dataEndIndex!==void 0)F.setState(Zr({dataStartIndex:ie,dataEndIndex:oe},j({props:F.props,dataStartIndex:ie,dataEndIndex:oe,updateId:te},F.state)));else if(q.activeTooltipIndex!==void 0){var ye=q.chartX,ae=q.chartY,pe=q.activeTooltipIndex,se=F.state,he=se.offset,ue=se.tooltipTicks;if(!he)return;if(typeof G=="function")pe=G(ue,q);else if(G==="value"){pe=-1;for(var _e=0;_e=0){var tt,Te;if(ye.dataKey&&!ye.allowDuplicatedCategory){var Ke=typeof ye.dataKey=="function"?be:"payload.".concat(ye.dataKey.toString());tt=ife(_e,Ke,pe),Te=Ae&&Ce&&ife(Ce,Ke,pe)}else tt=_e==null?void 0:_e[ae],Te=Ae&&Ce&&Ce[ae];if(Be||ke){var me=q.props.activeIndex!==void 0?q.props.activeIndex:ae;return[I.cloneElement(q,Zr(Zr(Zr({},G.props),Ue),{},{activeIndex:me})),null,null]}if(!_i(tt))return[Fe].concat(HC(F.renderActivePoints({item:G,activePoint:tt,basePoint:Te,childIndex:ae,isRange:Ae})))}else{var yt,rt=(yt=F.getItemByXY(F.state.activeCoordinate))!==null&&yt!==void 0?yt:{graphicalItem:Fe},at=rt.graphicalItem,Me=at.item,ft=Me===void 0?q:Me,qe=at.childIndex,Oe=Zr(Zr(Zr({},G.props),Ue),{},{activeIndex:qe});return[I.cloneElement(ft,Oe),null,null]}return Ae?[Fe,null,null]:[Fe,null]}),ba(F,"renderCustomized",function(q,V,K){return I.cloneElement(q,Zr(Zr({key:"recharts-customized-".concat(K)},F.props),F.state))}),ba(F,"renderMap",{CartesianGrid:{handler:JL,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:JL},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:JL},YAxis:{handler:JL},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((P=T.id)!==null&&P!==void 0?P:BI("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=K7e(F.triggeredAfterMouseMove,(z=T.throttleDelay)!==null&&z!==void 0?z:1e3/60),F.state={},F}return pHt(E,A),dHt(E,[{key:"componentDidMount",value:function(){var P,z;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(P=this.props.margin.left)!==null&&P!==void 0?P:0,top:(z=this.props.margin.top)!==null&&z!==void 0?z:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var P=this.props,z=P.children,F=P.data,q=P.height,V=P.layout,K=qh(z,em);if(K){var G=K.props.defaultIndex;if(!(typeof G!="number"||G<0||G>this.state.tooltipTicks.length-1)){var te=this.state.tooltipTicks[G]&&this.state.tooltipTicks[G].value,ie=Ppe(this.state,F,G,te),oe=this.state.tooltipTicks[G].coordinate,ye=(this.state.offset.top+q)/2,ae=V==="horizontal",pe=ae?{x:oe,y:ye}:{y:oe,x:ye},se=this.state.formattedGraphicalItems.find(function(ue){var _e=ue.item;return _e.type.name==="Scatter"});se&&(pe=Zr(Zr({},pe),se.props.points[G].tooltipPosition),ie=se.props.points[G].tooltipPayload);var he={activeTooltipIndex:G,isTooltipActive:!0,activeLabel:te,activePayload:ie,activeCoordinate:pe};this.setState(he),this.renderCursor(K),this.accessibilityManager.setIndex(G)}}}},{key:"getSnapshotBeforeUpdate",value:function(P,z){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==z.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==P.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==P.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(P){lfe([qh(P.children,em)],[qh(this.props.children,em)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var P=qh(this.props.children,em);if(P&&typeof P.props.shared=="boolean"){var z=P.props.shared?"axis":"item";return i.indexOf(z)>=0?z:o}return o}},{key:"getMouseInfo",value:function(P){if(!this.container)return null;var z=this.container,F=z.getBoundingClientRect(),q=ALt(F),V={chartX:Math.round(P.pageX-q.left),chartY:Math.round(P.pageY-q.top)},K=F.width/z.offsetWidth||1,G=this.inRange(V.chartX,V.chartY,K);if(!G)return null;var te=this.state,ie=te.xAxisMap,oe=te.yAxisMap,ye=this.getTooltipEventType(),ae=d5e(this.state,this.props.data,this.props.layout,G);if(ye!=="axis"&&ie&&oe){var pe=D0(ie).scale,se=D0(oe).scale,he=pe&&pe.invert?pe.invert(V.chartX):null,ue=se&&se.invert?se.invert(V.chartY):null;return Zr(Zr({},V),{},{xValue:he,yValue:ue},ae)}return ae?Zr(Zr({},V),ae):null}},{key:"inRange",value:function(P,z){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=this.props.layout,V=P/F,K=z/F;if(q==="horizontal"||q==="vertical"){var G=this.state.offset,te=V>=G.left&&V<=G.left+G.width&&K>=G.top&&K<=G.top+G.height;return te?{x:V,y:K}:null}var ie=this.state,oe=ie.angleAxisMap,ye=ie.radiusAxisMap;if(oe&&ye){var ae=D0(oe);return FCe({x:V,y:K},ae)}return null}},{key:"parseEventsOfWrapper",value:function(){var P=this.props.children,z=this.getTooltipEventType(),F=qh(P,em),q={};F&&z==="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 V=cre(this.props,this.handleOuterEvent);return Zr(Zr({},V),q)}},{key:"addListener",value:function(){ode.on(lde,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ode.removeListener(lde,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(P,z,F){for(var q=this.state.formattedGraphicalItems,V=0,K=q.length;V");return t}const b$e=I.forwardRef(({id:t,className:e,children:n,config:s,...a},o)=>{const l=I.useId(),i=`chart-${t||l.replace(/:/g,"")}`;return r.jsx(v$e.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":i,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),...a,children:[r.jsx(PHt,{id:i,config:s}),r.jsx(Efe,{children:n})]})})});b$e.displayName="Chart";const PHt=({id:t,config:e})=>{const n=Object.entries(e).filter(([s,a])=>a.theme||a.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(IHt).map(([s,a])=>` ${a} [data-chart=${t}] { ${n.map(([o,l])=>{var h;const i=((h=l.theme)==null?void 0:h[s])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},w$e=I.forwardRef(({active:t,payload:e,className:n,indicator:s="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:i,labelClassName:h,formatter:p,color:x,nameKey:y,labelKey:_},j)=>{const{config:C}=_$e(),N=I.useMemo(()=>{var F;if(a||!(e!=null&&e.length))return null;const[E]=e,T=`${_||E.dataKey||E.name||"value"}`,P=Lpe(C,E,T),z=!_&&typeof l=="string"?((F=C[l])==null?void 0:F.label)||l:P==null?void 0:P.label;return i?r.jsx("div",{className:zt("font-medium",h),children:i(z,e)}):z?r.jsx("div",{className:zt("font-medium",h),children:z}):null},[l,i,e,a,h,C,_]);if(!t||!(e!=null&&e.length))return null;const A=e.length===1&&s!=="dot";return r.jsxs("div",{ref:j,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:[A?null:N,r.jsx("div",{className:"grid gap-1.5",children:e.map((E,T)=>{const P=`${y||E.name||E.dataKey||"value"}`,z=Lpe(C,E,P),F=x||E.payload.fill||E.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:p&&(E==null?void 0:E.value)!==void 0&&E.name?p(E.value,E.name,E,T,E.payload):r.jsxs(r.Fragment,{children:[z!=null&&z.icon?r.jsx(z.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":A&&s==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),r.jsxs("div",{className:zt("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[A?N:null,r.jsx("span",{className:"text-muted-foreground",children:(z==null?void 0:z.label)||E.name})]}),E.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:E.value.toLocaleString()})]})]})},E.dataKey)})})]})});w$e.displayName="ChartTooltip";const LHt=I.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:s="bottom",nameKey:a},o)=>{const{config:l}=_$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(i=>{const h=`${a||i.dataKey||"value"}`,p=Lpe(l,i,h);return r.jsxs("div",{className:zt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[p!=null&&p.icon&&!e?r.jsx(p.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:i.color}}),p==null?void 0:p.label]},i.value)})}):null});LHt.displayName="ChartLegend";function Lpe(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 a=n;return n in e&&typeof e[n]=="string"?a=e[n]:s&&n in s&&typeof s[n]=="string"&&(a=s[n]),a in t?t[a]:t[n]}const eO=["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 j$e({stats:t,year:e}){const n=t.transactionsByMonth.some(a=>a.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(Gt,{children:r.jsx(Zt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(Je,{className:"overflow-hidden",children:r.jsx(b$e,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Efe,{width:"100%",height:"100%",children:r.jsxs(AHt,{data:t.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(n$e,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Fae,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(zae,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(em,{content:r.jsx(w$e,{})}),r.jsx(mk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(Je,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Efe,{width:"100%",height:"100%",children:r.jsxs(EHt,{children:[r.jsx(wy,{data:t.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:a,percent:o})=>o>.05?`${a} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:t.leadSourceBreakdown.map((a,o)=>r.jsx(fae,{fill:eO[o%eO.length]},`cell-${o}`))}),r.jsx(em,{formatter:(a,o)=>[`${a} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:t.leadSourceBreakdown.slice(0,6).map((a,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:eO[o%eO.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function OHt(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 a=oxe(e,s,new Date);if(xhe(a))return xn(a,"yyyy-MM-dd")}catch{}try{const s=new Date(e);if(xhe(s))return xn(s,"yyyy-MM-dd")}catch{}return null}const DHt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function RHt({open:t,onOpenChange:e}){const[n,s]=I.useState([]),[a,o]=I.useState(!1),[l,i]=I.useState(0),{data:h}=vse(),{data:p}=Mm(),x=_se(),y=()=>{const E=DHt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),P=`${E} ${T}`,z=new Blob([P],{type:"text/csv"}),F=URL.createObjectURL(z),q=document.createElement("a");q.href=F,q.download="transaction-import-template.csv",q.click(),URL.revokeObjectURL(F)},_=E=>{const T=E.split(` `).filter(z=>z.trim());if(T.length<2)return[];const P=T[0].split(",").map(z=>z.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((z,F)=>{var he,ue,_e,Ae;const q=[];let V="",K=!1;for(const Ce of z)Ce==='"'?K=!K:Ce===","&&!K?(q.push(V.trim()),V=""):V+=Ce;q.push(V.trim());const G=Ce=>{var ge;const Se=P.indexOf(Ce);return Se>=0?(ge=q[Se])==null?void 0:ge.replace(/^["']|["']$/g,"").trim():""},te=(he=G("transaction_type"))==null?void 0:he.toLowerCase(),ie=(ue=G("sale_price"))==null?void 0:ue.replace(/[$,]/g,""),oe=(_e=G("commission_amount"))==null?void 0:_e.replace(/[$,]/g,""),ye=(Ae=G("is_win"))==null?void 0:Ae.toLowerCase(),ae=G("close_date"),pe=OHt(ae);let se;return G("property_address")?["buyer","seller"].includes(te)?pe?(!ie||isNaN(Number(ie)))&&(se="Invalid sale price"):se=`Invalid date format: "${ae}" - use MM/DD/YYYY or YYYY-MM-DD`:se='Transaction type must be "buyer" or "seller"':se="Missing property address",{property_address:G("property_address"),city:G("city"),state:G("state"),zip:G("zip"),transaction_type:te==="seller"?"seller":"buyer",close_date:pe||"",sale_price:Number(ie)||0,commission_amount:oe?Number(oe):null,lead_source_name:G("lead_source"),client_type_name:G("client_type"),is_win:["yes","true","1"].includes(ye),notes:G("notes"),error:se}})},j=E=>{var z;const T=(z=E.target.files)==null?void 0:z[0];if(!T)return;const P=new FileReader;P.onload=F=>{var K;const q=(K=F.target)==null?void 0:K.result,V=_(q);s(V)},P.readAsText(T)},C=async()=>{const E=n.filter(z=>!z.error);if(E.length===0){ze.error("No valid transactions to import");return}o(!0),i(0);let T=0,P=0;for(let z=0;zK.name.toLowerCase()===F.lead_source_name.toLowerCase()),V=p==null?void 0:p.find(K=>K.name.toLowerCase()===F.client_type_name.toLowerCase());await x.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:(V==null?void 0:V.id)||null,contact_id:null,notes:F.notes||null,is_win:F.is_win}),T++}catch(q){P++,console.error("Failed to import transaction:",q)}i(Math.round((z+1)/E.length*100))}o(!1),T>0&&ze.success(`Imported ${T} transaction${T>1?"s":""}`),P>0&&ze.error(`Failed to import ${P} transaction${P>1?"s":""}`),s([]),e(!1)},N=n.filter(E=>!E.error).length,A=n.filter(E=>E.error).length;return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Import Transactions"}),r.jsx(Qn,{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(ee,{variant:"outline",onClick:y,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(dt,{id:"csv-file",type:"file",accept:".csv",onChange:j})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ot,{variant:"outline",children:[n.length," rows found"]}),N>0&&r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Ai,{className:"h-3 w-3 mr-1"}),N," valid"]}),A>0&&r.jsxs(Ot,{variant:"destructive",children:[r.jsx(fl,{className:"h-3 w-3 mr-1"}),A," errors"]})]}),r.jsx(tl,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((E,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${E.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:E.property_address||"(no address)"}),r.jsx(Ot,{variant:E.transaction_type==="buyer"?"default":"secondary",children:E.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[E.close_date," • $",E.sale_price.toLocaleString()]}),E.error&&r.jsx(Ixe,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(Pxe,{className:"text-xs",children:E.error})})]},T)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),a&&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:`${l}%`}})}),r.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",l,"%"]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{onClick:C,disabled:N===0||a,children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Import ",N," Transaction",N!==1?"s":""]})]})]})]})})}const FHt=u3({transactions_goal:lA().min(0).optional(),volume_goal:lA().min(0).optional(),gci_goal:lA().min(0).optional()});function zHt({open:t,onOpenChange:e,year:n,existingGoals:s}){const a=opt(),{data:o}=bse(),l=(o==null?void 0:o.show_commission)??!0,i=ose({resolver:lse(FHt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});I.useEffect(()=>{s?i.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}):i.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,i,t]);const h=async p=>{await a.mutateAsync({year:n,transactions_goal:p.transactions_goal??null,volume_goal:p.volume_goal??null,gci_goal:l?p.gci_goal??null:null}),e(!1)};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[n," Goals"]}),r.jsx(Qn,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(cse,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(h),className:"space-y-4",children:[r.jsx(Al,{control:i.control,name:"transactions_goal",render:({field:p})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Transactions Goal"}),r.jsx(kl,{children:r.jsx(dt,{type:"number",placeholder:"e.g., 24",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(see,{children:"Total number of deals you want to close"}),r.jsx(Lu,{})]})}),r.jsx(Al,{control:i.control,name:"volume_goal",render:({field:p})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"Volume Goal ($)"}),r.jsx(kl,{children:r.jsx(dt,{type:"number",placeholder:"e.g., 5000000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(see,{children:"Total sales volume you want to achieve"}),r.jsx(Lu,{})]})}),l&&r.jsx(Al,{control:i.control,name:"gci_goal",render:({field:p})=>r.jsxs(wl,{children:[r.jsx(jl,{children:"GCI Goal ($)"}),r.jsx(kl,{children:r.jsx(dt,{type:"number",placeholder:"e.g., 150000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(see,{children:"Gross commission income target"}),r.jsx(Lu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}function k$e({transactions:t,isLoading:e}){const n=I.useRef(null),s=I.useRef(null),a=I.useRef([]),o=I.useRef(null),{isAdmin:l}=Xr(),[i,h]=I.useState(""),[p,x]=I.useState(!0),[y,_]=I.useState(0),[j,C]=I.useState(!1),N=t.filter(E=>E.latitude!=null&&E.longitude!=null),A=t.filter(E=>E.latitude==null||E.longitude==null);return I.useEffect(()=>{(async()=>{x(!0);try{const{data:T}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();T!=null&&T.value&&h(T.value)}catch(T){console.error("Error fetching mapbox token:",T)}x(!1)})()},[]),I.useEffect(()=>{if(!i||A.length===0||j)return;(async()=>{var P;C(!0);let T=0;for(const z of A){const F=[z.property_address,z.city,z.state,z.zip].filter(Boolean).join(", ");if(F)try{const V=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(F)}.json?access_token=${i}&limit=1`)).json();if((P=V.features)!=null&&P[0]){const[K,G]=V.features[0].center;await J.from("scorecard_transactions").update({latitude:G,longitude:K}).eq("id",z.id),z.latitude=G,z.longitude=K,T++}}catch(q){console.error("Geocode error:",q)}}_(T),C(!1)})()},[i,t]),I.useEffect(()=>{if(!n.current||!i||s.current)return;Xl.accessToken=i;const E=t.filter(z=>z.latitude!=null&&z.longitude!=null);let T=[-98.5795,39.8283],P=4;if(E.length>0){const z=E.reduce((q,V)=>q+V.longitude,0)/E.length,F=E.reduce((q,V)=>q+V.latitude,0)/E.length;T=[z,F],P=E.length===1?12:10}return s.current=new Xl.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:P,center:T}),s.current.addControl(new Xl.NavigationControl,"top-right"),()=>{var z;(z=s.current)==null||z.remove(),s.current=null}},[i]),I.useEffect(()=>{var T;if(!s.current||!i)return;a.current.forEach(P=>P.remove()),a.current=[],(T=o.current)==null||T.remove();const E=t.filter(P=>P.latitude!=null&&P.longitude!=null);if(E.forEach(P=>{var G;const z=P.transaction_type==="buyer",F=z?"#3B82F6":"#10B981",q=document.createElement("div");q.className="cursor-pointer",q.innerHTML=`
${z?'':''}
`;const V=new Xl.Popup({offset:25,closeButton:!0}).setHTML(`
${P.property_address}
${P.city?`
${P.city}${P.state?", "+P.state:""} ${P.zip||""}
`:""}
${z?"Buyer":"Seller"} $${Number(P.sale_price).toLocaleString()}
Closed: ${new Date(P.close_date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} ${(G=P.lead_source)!=null&&G.name?" · "+P.lead_source.name:""}
${P.contact?`
Client: ${P.contact.first_name} ${P.contact.last_name||""}
`:""}
`),K=new Xl.Marker(q).setLngLat([P.longitude,P.latitude]).setPopup(V).addTo(s.current);a.current.push(K)}),E.length>1){const P=new Xl.LngLatBounds;E.forEach(z=>P.extend([z.longitude,z.latitude])),s.current.fitBounds(P,{padding:60,maxZoom:13})}else E.length===1&&s.current.flyTo({center:[E[0].longitude,E[0].latitude],zoom:12})},[t,i,j]),p||e?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center h-[50vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):i?t.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(Mo,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Transactions Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add transactions to see them plotted on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center 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 border-2 border-white shadow",style:{background:"#3B82F6"}}),r.jsx("span",{children:"Buyer"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{background:"#10B981"}}),r.jsx("span",{children:"Seller"})]}),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[N.length," of ",t.length," mapped",j&&" · Geocoding..."]})]}),r.jsx("div",{ref:n,className:"w-full h-[55vh] rounded-lg shadow-lg border"})]}):r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(fl,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Set up your Mapbox token in the Popby Map to enable maps across the platform.":"The map feature has not been configured yet. Please contact your administrator."})]})]})})}const N$e=new Date().getFullYear(),BHt=Array.from({length:10},(t,e)=>N$e-e);function $Ht(){var F;const[t,e]=I.useState(N$e),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(!1),[h,p]=I.useState(!1),{data:x,isLoading:y}=vxe(t),{yearStats:_,lifetimeStats:j,showCommission:C}=A8e(t),{data:N,isLoading:A}=T8e(t),{data:E}=bse(),T=lpt(),P=()=>{if(!x||x.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"],V=x.map(oe=>{var ye,ae;return[oe.property_address,oe.city||"",oe.state||"",oe.zip||"",oe.transaction_type,oe.close_date,oe.sale_price,...C?[oe.commission_amount||""]:[],((ye=oe.lead_source)==null?void 0:ye.name)||"",((ae=oe.client_type)==null?void 0:ae.name)||"",oe.contact?`${oe.contact.first_name} ${oe.contact.last_name||""}`.trim():"",oe.is_win?"Yes":"No",oe.notes||""]}),K=[q,...V].map(oe=>oe.map(ye=>`"${String(ye).replace(/"/g,'""')}"`).join(",")).join(` `),G=new Blob([K],{type:"text/csv"}),te=URL.createObjectURL(G),ie=document.createElement("a");ie.href=te,ie.download=`transactions-${t}.csv`,ie.click(),URL.revokeObjectURL(te)},z=!x||x.length===0;return r.jsxs(Lr,{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(gn,{value:String(t),onValueChange:q=>e(Number(q)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:BHt.map(q=>r.jsx(qt,{value:String(q),children:q},q))})]}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(!h),children:r.jsx(md,{className:"h-4 w-4"})})]})]}),h&&r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsx(Zt,{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(He,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Ps,{checked:(E==null?void 0:E.show_commission)??!0,onCheckedChange:q=>T.mutate({show_commission:q})})]})})]}),z&&!y?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(dc,{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(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(uo,{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(ee,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(no,{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(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(ee,{variant:"outline",onClick:()=>i(!0),children:[r.jsx(Kx,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(ee,{variant:"outline",onClick:P,disabled:z,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(no,{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(da,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:_.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.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(Bn,{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:[_.buyerCount,"/",_.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(fd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Pd(_.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Pd(j.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(ep,{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:Pd(_.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(Ol,{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=_.topLeadSource)==null?void 0:F.name)||"-"}),_.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[_.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(fd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Pd(_.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Pd(j.totalCommission,!0)," lifetime"]})]})})]}),N&&r.jsx(Pze,{goals:N,stats:_,year:t,showCommission:C}),r.jsxs(Ii,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"transactions",children:"Transactions"}),r.jsx(nn,{value:"charts",children:"Charts"}),r.jsxs(nn,{value:"map",children:[r.jsx(Mo,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Sn,{value:"transactions",children:r.jsx(Ize,{transactions:x||[],showCommission:C,isLoading:y})}),r.jsx(Sn,{value:"charts",children:r.jsx(j$e,{stats:_,year:t})}),r.jsx(Sn,{value:"map",children:r.jsx(k$e,{transactions:x||[],isLoading:y})})]})]})]}),r.jsx(Eze,{open:n,onOpenChange:s}),r.jsx(RHt,{open:a,onOpenChange:o}),r.jsx(zHt,{open:l,onOpenChange:i,year:t,existingGoals:N})]})}function S$e({open:t,onOpenChange:e,listingId:n,listingSlug:s,listingTitle:a}){const{user:o}=Xr(),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(!1);I.useEffect(()=>{(async()=>{if(!(!t||!o)){p(!0);try{const{data:A,error:E}=await J.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(E)throw E;if(A&&A.share_token)i(A);else if(A&&!A.share_token){const{data:T,error:P}=await J.from("listing_shares").update({share_type:"referral_link"}).eq("id",A.id).select("id, share_token, click_count, lead_count").single();if(P)throw P;i(T)}else{const{data:T,error:P}=await J.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(P)throw P;i(T)}}catch(A){console.error("Error creating share link:",A),ze.error("Failed to generate share link")}finally{p(!1)}}})()},[t,o,n]);const _=l!=null&&l.share_token?`https://listings.relevelup.com/${s||n}?ref=${l.share_token}`:"",j=async()=>{try{await navigator.clipboard.writeText(_),y(!0),ze.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{ze.error("Failed to copy link")}},C=N=>{const A=encodeURIComponent(_),E=encodeURIComponent(`Check out this listing: ${a}`);switch(N){case"email":window.open(`mailto:?subject=${E}&body=${A}`);break;case"text":window.open(`sms:?body=${E}%20${A}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${A}`,"_blank");break}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Ms,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Qn,{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(He,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:h?"Generating...":_,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:j,disabled:h||!_,variant:x?"default":"outline",children:x?r.jsx(Ai,{className:"h-4 w-4"}):r.jsx(Qo,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>C("email"),disabled:h,children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>C("text"),disabled:h,children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>C("facebook"),disabled:h,children:[r.jsx(zd,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),l&&(l.click_count>0||l.lead_count>0)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx(He,{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(el,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Clicks"})]}),r.jsx("p",{className:"text-2xl font-bold",children:l.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(Bn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Leads"})]}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:l.lead_count})]})]})]})]})]})})}const UHt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},qHt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},VHt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function tO({listing:t,onClick:e,onEdit:n,onDelete:s,showActions:a}){var N,A;const{user:o}=Xr(),{data:l}=j8e(t.id),i=w8e(),[h,p]=I.useState(!1),x=E=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(E),y=((N=t.photos)==null?void 0:N.find(E=>E.is_primary))||((A=t.photos)==null?void 0:A[0]),_=(o==null?void 0:o.id)===t.agent_id,j=async E=>{E.stopPropagation();try{const T=await i.mutateAsync(t.id);ze.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{ze.error("Failed to save listing")}},C=E=>{if(E.stopPropagation(),o)p(!0);else{const T=`https://listings.relevelup.com/${t.slug||t.id}`;navigator.clipboard.writeText(T),ze.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:[y?r.jsx("img",{src:y.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(kg,{className:"h-12 w-12"})}),r.jsx(Ot,{className:`absolute top-2 left-2 ${UHt[t.status]} text-white border-0`,children:qHt[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(vs,{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(ee,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:j,children:r.jsx(ci,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:C,title:_?"Copy link":"Share & earn leads",children:_?r.jsx(pc,{className:"h-4 w-4"}):r.jsx(Ms,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(S$e,{open:h,onOpenChange:p,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:x(t.price)}),t.open_to_referrals&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:[r.jsx(Bn,{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(Mo,{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(h1,{className:"h-4 w-4"}),t.bedrooms," bd"]}),t.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(u1,{className:"h-4 w-4"}),t.bathrooms," ba"]}),t.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(kg,{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(Ot,{variant:"secondary",className:"text-xs",children:VHt[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(el,{className:"h-3 w-3"}),t.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pc,{className:"h-3 w-3"}),t.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ci,{className:"h-3 w-3"}),t.save_count]})]}),a&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:E=>{E.stopPropagation(),n()},children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(ee,{variant:"destructive",size:"sm",onClick:E=>{E.stopPropagation(),s()},children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})]})}const HHt=[{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"}],WHt=[{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 GHt({filters:t,onFiltersChange:e,onClose:n}){const s=()=>{e({sortBy:"newest"})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Zt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(_s,{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(He,{children:"Status"}),r.jsxs(gn,{value:t.status||"all",onValueChange:a=>e({...t,status:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"All statuses"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),HHt.map(a=>r.jsx(qt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Property Type"}),r.jsxs(gn,{value:t.propertyType||"all",onValueChange:a=>e({...t,propertyType:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"All types"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),WHt.map(a=>r.jsx(qt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Min Price"}),r.jsx(dt,{type:"number",placeholder:"No minimum",value:t.minPrice||"",onChange:a=>e({...t,minPrice:a.target.value?Number(a.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Max Price"}),r.jsx(dt,{type:"number",placeholder:"No maximum",value:t.maxPrice||"",onChange:a=>e({...t,maxPrice:a.target.value?Number(a.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(He,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Ps,{checked:t.openToReferrals||!1,onCheckedChange:a=>e({...t,openToReferrals:a||void 0})})]})]})]})}function KHt({leaderboard:t}){const e=s=>{switch(s){case 0:return r.jsx(Zi,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(Wx,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Ol,{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,a)=>!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,l)=>r.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${l===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(l)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Ot,{variant:l===0?"default":"secondary",children:[o.count," ",a]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{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(pc,{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(da,{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(Wx,{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(Zi,{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(Gt,{children:r.jsx(Zt,{children:"Community Leaderboard"})}),r.jsx(Je,{children:r.jsxs(Ii,{defaultValue:"sharers",children:[r.jsxs(wi,{className:"w-full",children:[r.jsxs(nn,{value:"sharers",className:"flex-1",children:[r.jsx(pc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(nn,{value:"listers",className:"flex-1",children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(Sn,{value:"sharers",className:"mt-4",children:n(t==null?void 0:t.topSharers,"shares")}),r.jsx(Sn,{value:"listers",className:"mt-4",children:n(t==null?void 0:t.topListers,"listings")})]})})]})]})}const f5e={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},p5e={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function ZHt(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function YHt({listings:t,isLoading:e}){const n=Zn(),s=I.useRef(null),a=I.useRef(null),o=I.useRef([]),{isAdmin:l}=Xr(),[i,h]=I.useState(""),[p,x]=I.useState(!0),[y,_]=I.useState(!1),j=t.filter(N=>N.latitude!=null&&N.longitude!=null),C=t.filter(N=>(N.latitude==null||N.longitude==null)&&(N.property_address||N.city));return I.useEffect(()=>{(async()=>{x(!0);try{const{data:A}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();A!=null&&A.value&&h(A.value)}catch(A){console.error("Error fetching mapbox token:",A)}x(!1)})()},[]),I.useEffect(()=>{if(!i||C.length===0||y)return;(async()=>{var A;_(!0);for(const E of C){const T=[E.property_address,E.city,E.state].filter(Boolean).join(", ");if(T)try{const z=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(T)}.json?access_token=${i}&limit=1`)).json();if((A=z.features)!=null&&A[0]){const[F,q]=z.features[0].center;await J.from("listings").update({latitude:q,longitude:F}).eq("id",E.id),E.latitude=q,E.longitude=F}}catch(P){console.error("Geocode error:",P)}}_(!1)})()},[i,t]),I.useEffect(()=>{if(!s.current||!i||a.current)return;Xl.accessToken=i;const N=t.filter(T=>T.latitude!=null&&T.longitude!=null);let A=[-98.5795,39.8283],E=4;if(N.length>0){const T=N.reduce((z,F)=>z+F.longitude,0)/N.length,P=N.reduce((z,F)=>z+F.latitude,0)/N.length;A=[T,P],E=N.length===1?12:10}return a.current=new Xl.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:E,center:A}),a.current.addControl(new Xl.NavigationControl,"top-right"),()=>{var T;(T=a.current)==null||T.remove(),a.current=null}},[i]),I.useEffect(()=>{if(!a.current||!i)return;o.current.forEach(A=>A.remove()),o.current=[];const N=t.filter(A=>A.latitude!=null&&A.longitude!=null);if(N.forEach(A=>{var q,V,K;const E=f5e[A.status]||"#10B981",T=((q=A.photos)==null?void 0:q.find(G=>G.is_primary))||((V=A.photos)==null?void 0:V[0]),P=document.createElement("div");P.className="cursor-pointer",P.innerHTML=`
`;const z=new Xl.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${T!=null&&T.photo_url?``:""}
${ZHt(A.price)}
${A.property_address||""}
${A.city}, ${A.state}
${p5e[A.status]||A.status} ${A.bedrooms?`${A.bedrooms} bed`:""} ${A.bathrooms?`${A.bathrooms} bath`:""}
${(K=A.agent)!=null&&K.name?`
Listed by ${A.agent.name}
`:""}
Click to view details →
`),F=new Xl.Marker(P).setLngLat([A.longitude,A.latitude]).setPopup(z).addTo(a.current);o.current.push(F)}),N.length>1){const A=new Xl.LngLatBounds;N.forEach(E=>A.extend([E.longitude,E.latitude])),a.current.fitBounds(A,{padding:60,maxZoom:13})}else N.length===1&&a.current.flyTo({center:[N[0].longitude,N[0].latitude],zoom:12})},[t,i,y]),I.useEffect(()=>(window.__navigateToListing__=N=>{n(`/mission-control/listings/${N}`)},()=>{delete window.__navigateToListing__}),[n]),p||e?r.jsx(Ye,{children:r.jsx(Je,{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"})})}):i?t.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(Mo,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Listings Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add listings to see them on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[Object.entries(f5e).map(([N,A])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:A}}),r.jsx("span",{className:"text-xs",children:p5e[N]})]},N)),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[j.length," of ",t.length," mapped",y&&" · Geocoding..."]})]}),r.jsx("div",{ref:s,className:"w-full h-[60vh] rounded-lg shadow-lg border"})]}):r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(fl,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Set up your Mapbox token in Settings to enable maps.":"The map feature has not been configured yet. Please contact your administrator."})]})]})})}function XHt(){var G,te,ie,oe,ye,ae,pe,se;const t=Zn(),{brokerageId:e}=Xr(),{data:n,isLoading:s}=x8e(),[a,o]=I.useState("feed"),[l,i]=I.useState(!1),[h,p]=I.useState(""),[x,y]=I.useState({sortBy:"newest"}),{data:_,isLoading:j}=y8e({...x,city:h||x.city}),{data:C,isLoading:N}=Vft(),{data:A,isLoading:E}=v8e(),{data:T,isLoading:P}=Kft(),{data:z,isLoading:F}=Xft(),{data:q}=Yft(),V=b8e(),K=async he=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await V.mutateAsync(he),ze.success("Listing deleted successfully")}catch{ze.error("Failed to delete listing")}};return s?r.jsx(Lr,{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"})})}):n?r.jsx(Lr,{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(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{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(da,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(_==null?void 0:_.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(ci,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(C==null?void 0:C.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(dj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(A==null?void 0:A.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(Bn,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((G=T==null?void 0:T.sent)==null?void 0:G.length)||0)+(((te=T==null?void 0:T.received)==null?void 0:te.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(Ii,{value:a,onValueChange:o,children:[r.jsxs(wi,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(nn,{value:"feed",children:"Community Feed"}),e&&r.jsx(nn,{value:"brokerage",children:"Brokerage"}),r.jsx(nn,{value:"my-listings",children:"My Listings"}),r.jsx(nn,{value:"saved",children:"Saved"}),r.jsx(nn,{value:"referrals",children:"Referrals"}),r.jsx(nn,{value:"map",children:"Map"}),r.jsx(nn,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(Sn,{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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by city or neighborhood...",value:h,onChange:he=>p(he.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:x.sortBy,onValueChange:he=>y({...x,sortBy:he}),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Sort by"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"newest",children:"Newest First"}),r.jsx(qt,{value:"updated",children:"Recently Updated"}),r.jsx(qt,{value:"price_asc",children:"Price: Low to High"}),r.jsx(qt,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(ee,{variant:"outline",onClick:()=>i(!l),children:[r.jsx(v1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(GHt,{filters:x,onFiltersChange:y,onClose:()=>i(!1)}),j?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"}),r.jsx(Ir,{className:"h-4 w-1/4"})]})]},ue))}):(_==null?void 0:_.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(da,{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(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{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:_==null?void 0:_.map(he=>r.jsx(tO,{listing:he,onClick:()=>t(`/mission-control/listings/${he.id}`)},he.id))})]}),r.jsx(Sn,{value:"my-listings",className:"space-y-4",children:E?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"})]})]},ue))}):(A==null?void 0:A.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(dj,{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(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{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:A==null?void 0:A.map(he=>r.jsx(tO,{listing:he,showActions:!0,onClick:()=>t(`/mission-control/listings/${he.id}`),onEdit:()=>t(`/mission-control/listings/${he.id}/edit`),onDelete:()=>K(he.id)},he.id))})}),r.jsx(Sn,{value:"saved",className:"space-y-4",children:N?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"})]})]},ue))}):(C==null?void 0:C.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(ci,{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:C==null?void 0:C.map(he=>r.jsx(tO,{listing:he.listing,onClick:()=>t(`/mission-control/listings/${he.listing.id}`)},he.id))})}),r.jsx(Sn,{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(pc,{className:"h-4 w-4"}),"Referrals Sent (",((ie=T==null?void 0:T.sent)==null?void 0:ie.length)||0,")"]}),((oe=T==null?void 0:T.sent)==null?void 0:oe.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:(ye=T==null?void 0:T.sent)==null?void 0:ye.map(he=>{var ue,_e;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:he.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((ue=he.listing)==null?void 0:ue.property_address)||((_e=he.listing)==null?void 0:_e.city)})]}),r.jsx(Ot,{variant:he.status==="closed"?"default":"secondary",children:he.status.replace("_"," ")})]})})},he.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Referrals Received (",((ae=T==null?void 0:T.received)==null?void 0:ae.length)||0,")"]}),((pe=T==null?void 0:T.received)==null?void 0:pe.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:(se=T==null?void 0:T.received)==null?void 0:se.map(he=>{var ue;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:he.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(ue=he.sender)==null?void 0:ue.name]})]}),r.jsx(Ot,{variant:he.status==="closed"?"default":"secondary",children:he.status.replace("_"," ")})]}),r.jsx(ee,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>t(`/mission-control/listings/${he.listing_id}`),children:"View Listing"})]})},he.id)})})]})]})}),e&&r.jsx(Sn,{value:"brokerage",className:"space-y-4",children:F?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"})]})]},ue))}):(z==null?void 0:z.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(dj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No brokerage listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No agents in your brokerage have added listings yet."}),r.jsxs(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add a Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z==null?void 0:z.map(he=>r.jsx(tO,{listing:he,onClick:()=>t(`/mission-control/listings/${he.id}`)},he.id))})}),r.jsx(Sn,{value:"map",children:r.jsx(YHt,{listings:_||[],isLoading:j})}),r.jsx(Sn,{value:"leaderboard",children:r.jsx(KHt,{leaderboard:q})})]})]})}):r.jsx(Lr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(da,{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 T0e(){const t=Lc();return Yt({queryKey:["deal-pipeline-stages",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("deal_pipeline_stages").select("*").eq("owner_user_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function C$e(){const t=Lc(),e=Vr();return cr({mutationFn:async()=>{if(!t)throw new Error("Not authenticated");const{error:n}=await J.rpc("initialize_deal_pipeline_stages",{p_user_id:t});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function M$e(){const t=Lc();return Yt({queryKey:["deal-pipeline-deals",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status, created_at) `).eq("owner_user_id",t).order("updated_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function T$e(){const t=Lc(),e=Vr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:a}=await J.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,listing_date:n.listing_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:t}).select().single();if(a)throw a;return await J.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 A$e(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("deal_pipeline").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function QHt(){const t=Vr();return cr({mutationFn:async({dealId:e,stageId:n,stageName:s})=>{const{data:a,error:o}=await J.from("deal_pipeline").update({stage_id:n}).eq("id",e).select().single();if(o)throw o;return await J.from("deal_activities").insert({deal_id:e,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),a},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-activities"]})}})}function JHt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.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 eWt(t){return Yt({queryKey:["deal-activities",t],queryFn:async()=>{const{data:e,error:n}=await J.from("deal_activities").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function tWt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.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 rWt(t){return Yt({queryKey:["deal-checklist",t],queryFn:async()=>{const{data:e,error:n}=await J.from("deal_checklist_items").select("*").eq("deal_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function nWt(){const t=Vr();return cr({mutationFn:async({id:e,is_completed:n,deal_id:s})=>{const{data:a,error:o}=await J.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 a},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function sWt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.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 aWt(){const t=Lc();return Yt({queryKey:["deal-pipeline-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",t);if(n)throw n;const s=(e==null?void 0:e.filter(o=>{var l,i;return!((l=o.deal_pipeline_stages)!=null&&l.is_won_stage)&&!((i=o.deal_pipeline_stages)!=null&&i.is_lost_stage)}))||[],a=(e==null?void 0:e.filter(o=>{var l;return(l=o.deal_pipeline_stages)==null?void 0:l.is_won_stage}))||[];return{totalDeals:(e==null?void 0:e.length)||0,activeDeals:s.length,wonDeals:a.length,pipelineValue:s.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:s.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:a.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!t})}function iWt(t){const e=Lc();return Yt({queryKey:["deal-by-listing",t,e],queryFn:async()=>{if(!e||!t)return null;const{data:n,error:s}=await J.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",e).eq("listing_id",t).maybeSingle();if(s)throw s;return n},enabled:!!e&&!!t})}function oWt(){const t=Vr();return cr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:a}=await J.from("deal_pipeline").update({listing_id:n}).eq("id",e).select().single();if(a)throw a;return await J.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 lWt(){const t=Vr();return cr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:a}=await J.from("deal_pipeline").update({listing_id:null}).eq("id",e).select().single();if(a)throw a;return{data:s,listingId:n}},onSuccess:e=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",e.listingId]})}})}function cWt({listing:t}){const e=Zn(),[n,s]=I.useState(""),[a,o]=I.useState(!1),{data:l,isLoading:i}=iWt(t.id),{data:h,isLoading:p}=T0e(),{data:x,isLoading:y}=M$e(),_=C$e(),j=oWt(),C=lWt(),N=T$e(),A=(x==null?void 0:x.filter(F=>!F.listing_id))||[],E=F=>{if(!(h!=null&&h.length))return null;switch(F){case"coming_soon":case"active":case"price_improvement":return h.find(q=>q.name==="Active");case"under_contract":return h.find(q=>q.name==="Under Contract");case"sold":return h.find(q=>q.is_won_stage);default:return h.find(q=>q.name==="Active")}},T=async()=>{o(!0);try{h!=null&&h.length||await _.mutateAsync();const F=E(t.status);await N.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}),ze.success("Deal created and linked to listing!")}catch(F){console.error("Failed to create deal:",F),ze.error("Failed to create deal")}finally{o(!1)}},P=async()=>{if(!n){ze.error("Please select a deal");return}try{await j.mutateAsync({dealId:n,listingId:t.id}),ze.success("Listing linked to deal!"),s("")}catch{ze.error("Failed to link listing")}},z=async()=>{if(l)try{await C.mutateAsync({dealId:l.id,listingId:t.id}),ze.success("Listing unlinked from deal")}catch{ze.error("Failed to unlink listing")}};return i||p?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(Hx,{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(en,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(Ye,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{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:l.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&r.jsx(Ot,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${l.deal_pipeline_stages.color}20`,color:l.deal_pipeline_stages.color},children:l.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(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>e("/mission-control/pipeline"),children:["View Pipeline",r.jsx(hl,{className:"h-3 w-3 ml-1"})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:z,disabled:C.isPending,children:C.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(tA,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(Hx,{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(ee,{onClick:T,disabled:a||N.isPending,className:"w-full",size:"sm",children:[a||N.isPending?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),A.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(gn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"flex-1 text-sm",children:r.jsx(yn,{placeholder:"Link to existing deal..."})}),r.jsx(pn,{children:A.map(F=>r.jsx(qt,{value:F.id,children:F.deal_name},F.id))})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:P,disabled:!n||j.isPending,children:j.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(rf,{className:"h-4 w-4"})})]})]})]})]})}const dWt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},uWt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},m5e={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function hWt(){var ye,ae,pe,se,he,ue,_e,Ae,Ce;const{listingId:t}=Yc(),e=Zn(),{user:n}=Xr(),{data:s,isLoading:a}=_8e(t||""),{data:o}=j8e(t||""),{data:l}=Wft(t||""),i=w8e(),h=Hft(),p=Gft(),x=b8e(),y=Zft(),[_,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,P]=I.useState(null),[z,F]=I.useState({buyerName:"",buyerType:"",notes:""}),q=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),V=Se=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(Se),K=async Se=>{const ge=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,Le=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;p.mutate({listingId:s.id,shareType:Se});try{switch(Se){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ge)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(ge),ze.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${Le} ${ge}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(Le)}&body=${encodeURIComponent(`Check out this listing: ${ge}`)}`);break}}catch(ke){console.error("Share error:",ke),ze.error("Failed to share")}},G=async()=>{try{await x.mutateAsync(s.id),ze.success("Listing deleted"),e("/mission-control/listings")}catch{ze.error("Failed to delete listing")}},te=async()=>{if(!z.buyerName.trim()){ze.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:z.buyerName,buyerType:z.buyerType||void 0,notes:z.notes||void 0}),ze.success("Referral sent successfully!"),N(!1),F({buyerName:"",buyerType:"",notes:""})}catch{ze.error("Failed to send referral")}},ie=Se=>{var Fe,be;const ge=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,Le=V((s==null?void 0:s.price)||0),ke=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Be=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Ee=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Ue=[ke,Be,Ee].filter(Boolean).join(" | ");switch(Se){case"just_listed":return`🏡 JUST LISTED! ${ge} ${Le} ${Ue} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Fe=s==null?void 0:s.city)==null?void 0:Fe.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${ge} Now ${Le}! ${Ue} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${m5e[(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! ${Ue} DM me for details! 📩 #ComingSoon #RealEstate #${(be=s==null?void 0:s.city)==null?void 0:be.replace(/\s/g,"")}`;default:return""}};if(a)return r.jsx(Lr,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-10 w-32"}),r.jsx(Ir,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Ir,{className:"h-48"}),r.jsx(Ir,{className:"h-48"}),r.jsx(Ir,{className:"h-48"})]})]})});if(!s)return r.jsx(Lr,{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(ee,{onClick:()=>e("/mission-control/listings"),children:"Back to Listings"})]})})});const oe=((ye=s.photos)==null?void 0:ye.find(Se=>Se.is_primary))||((ae=s.photos)==null?void 0:ae[0]);return r.jsxs(Lr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/mission-control/listings"),children:[r.jsx(so,{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:()=>oe&&P(oe.photo_url),children:oe?r.jsx("img",{src:oe.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:(pe=s.photos)==null?void 0:pe.slice(1,5).map((Se,ge)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>P(Se.photo_url),children:r.jsx("img",{src:Se.photo_url,alt:`Photo ${ge+2}`,className:"w-full h-full object-cover"})},Se.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(Ot,{className:`${dWt[s.status]} text-white border-0`,children:uWt[s.status]}),s.is_featured&&r.jsxs(Ot,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(vs,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Ot,{variant:"outline",children:[r.jsx(Bn,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:V(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(Mo,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>i.mutate(s.id),children:r.jsx(ci,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>h.mutate(s.id),children:l?r.jsx(cj,{className:"h-4 w-4"}):r.jsx(yg,{className:"h-4 w-4"})}),!q&&r.jsxs(ee,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>E(!0),children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(pc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(Gu,{children:[r.jsxs(di,{onClick:()=>K("copy"),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(di,{onClick:()=>K("facebook"),children:[r.jsx(zd,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(di,{onClick:()=>K("text"),children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(di,{onClick:()=>K("email"),children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),q&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",onClick:()=>e(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:()=>j(!0),children:r.jsx(Vn,{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(h1,{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(u1,{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(kg,{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(Os,{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(Ot,{variant:"secondary",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),m5e[s.property_type]]}),s.lot_size&&r.jsxs(Ot,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Ot,{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(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{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(el,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pc,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ci,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Share Content"})}),r.jsx(Je,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(Se=>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:[Se.replace("_"," ")," Caption"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ie(Se)),ze.success("Caption copied!")},children:r.jsx(Qo,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ie(Se)})]},Se))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{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:((he=(se=s.agent)==null?void 0:se.name)==null?void 0:he.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((ue=s.agent)==null?void 0:ue.name)||"Unknown"}),((Ae=(_e=s.agent)==null?void 0:_e.brokerage)==null?void 0:Ae.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!q&&r.jsx("div",{className:"space-y-2",children:((Ce=s.agent)==null?void 0:Ce.email)&&r.jsx(ee,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),q&&r.jsx(cWt,{listing:s}),!q&&s.open_to_referrals&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bn,{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(ee,{className:"w-full",onClick:()=>N(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Fr,{open:!!T,onOpenChange:()=>P(null),children:r.jsx(Rr,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Fr,{open:_,onOpenChange:j,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Delete Listing"}),r.jsx(Qn,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:G,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Fr,{open:C,onOpenChange:N,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Send Buyer Referral"}),r.jsx(Qn,{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(He,{children:"Buyer Name *"}),r.jsx(dt,{value:z.buyerName,onChange:Se=>F({...z,buyerName:Se.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Buyer Type"}),r.jsxs(gn,{value:z.buyerType,onValueChange:Se=>F({...z,buyerType:Se}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"first_time",children:"First-Time Buyer"}),r.jsx(qt,{value:"investor",children:"Investor"}),r.jsx(qt,{value:"relocating",children:"Relocating"}),r.jsx(qt,{value:"upgrade",children:"Upgrading"}),r.jsx(qt,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes"}),r.jsx(ps,{value:z.notes,onChange:Se=>F({...z,notes:Se.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(ee,{onClick:te,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(S$e,{open:A,onOpenChange:E,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 fWt({selectedVideoId:t,onVideoSelect:e,listingId:n}){const s=Zn(),{user:a}=Xr(),[o,l]=I.useState(!1),[i,h]=I.useState([]),[p,x]=I.useState(!1),[y,_]=I.useState(null),[j,C]=I.useState({});I.useEffect(()=>{t&&a?N():_(null)},[t,a]);const N=async()=>{if(!t)return;const{data:G,error:te}=await J.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();!te&&G&&(_(G),A(G))},A=async G=>{try{const{data:te,error:ie}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:G.bunny_video_id,isAgentVideo:!0}});!ie&&(te!=null&&te.thumbnailUrl)&&C(oe=>({...oe,[G.id]:{thumbnailUrl:te.thumbnailUrl}}))}catch(te){console.warn("Failed to get signed URL",te)}},E=async()=>{if(a){x(!0);try{const{data:G,error:te}=await J.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",a.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(te)throw te;h(G||[]),G!=null&&G.length&&T(G)}catch(G){console.error("Error fetching videos:",G),ze.error("Failed to load videos")}finally{x(!1)}}},T=async G=>{const te=await Promise.allSettled(G.map(async oe=>{const{data:ye,error:ae}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:oe.bunny_video_id,isAgentVideo:!0}});if(ae)throw ae;return{id:oe.id,thumbnailUrl:ye==null?void 0:ye.thumbnailUrl}})),ie={};for(const oe of te)oe.status==="fulfilled"&&oe.value.thumbnailUrl&&(ie[oe.value.id]={thumbnailUrl:oe.value.thumbnailUrl});C(oe=>({...oe,...ie}))},P=()=>{l(!0),E()},z=G=>{e(G.id),_(G),l(!1),ze.success("Video selected")},F=()=>{e(null),_(null)},q=()=>{const G=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(G)}`)},V=G=>{if(!G)return"0:00";const te=Math.floor(G/60),ie=G%60;return`${te}:${ie.toString().padStart(2,"0")}`},K=G=>{var te;return((te=j[G.id])==null?void 0:te.thumbnailUrl)||G.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?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(y)?r.jsx("img",{src:K(y),alt:y.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(Pa,{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(fc,{className:"h-6 w-6 text-white fill-white"})}),y.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:V(y.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:y.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(ee,{type:"button",variant:"outline",size:"sm",onClick:P,children:"Change"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:F,className:"text-destructive hover:text-destructive",children:r.jsx(_s,{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(Pa,{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(ee,{type:"button",variant:"outline",onClick:P,className:"gap-2",children:[r.jsx(oS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(ee,{type:"button",variant:"outline",onClick:q,className:"gap-2",children:[r.jsx(vg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(qr,{children:r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(oS,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:p?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pa,{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(ee,{onClick:q,className:"gap-2",children:[r.jsx(vg,{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:i.map(G=>r.jsxs("button",{type:"button",onClick:()=>z(G),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${t===G.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(G)?r.jsx("img",{src:K(G),alt:G.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(Pa,{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(fc,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),G.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:V(G.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:G.title||"Untitled Video"})})]},G.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:q,className:"gap-2",children:[r.jsx(vg,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(ee,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const pWt=[{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"}],mWt=[{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 g5e(){var pe;const{listingId:t}=Yc(),[e]=qd(),n=e.get("brokerage"),s=Zn(),{user:a}=Xr(),o=!!t&&t!=="new",l=!!n&&!o,{data:i,isLoading:h}=_8e(o?t:""),p=zft(),x=Bft(),y=$ft(),_=Uft(),j=qft(),{data:C=[]}=Yt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:se,error:he}=await J.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(he)throw he;return se||[]},enabled:l}),[N,A]=I.useState(""),[E,T]=I.useState(!1),[P,z]=I.useState([]),[F,q]=I.useState([]),[V,K]=I.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});I.useEffect(()=>{var se,he,ue,_e,Ae;i&&o&&K({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((se=i.price)==null?void 0:se.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((he=i.bedrooms)==null?void 0:he.toString())||"",bathrooms:((ue=i.bathrooms)==null?void 0:ue.toString())||"",square_footage:((_e=i.square_footage)==null?void 0:_e.toString())||"",lot_size:i.lot_size||"",year_built:((Ae=i.year_built)==null?void 0:Ae.toString())||"",has_hoa:i.has_hoa,description:i.description||"",agent_notes:i.agent_notes||"",agent_notes_public:i.agent_notes_public,mls_link:i.mls_link||"",video_link:i.video_link||"",video_id:i.video_id||null,allow_sharing:i.allow_sharing,open_to_referrals:i.open_to_referrals,open_to_social_promotion:i.open_to_social_promotion,share_with_brokerage:i.share_with_brokerage??!1,is_public:i.is_public})},[i,o]);const G=se=>{if(!se)return;const he=Array.from(se);z(_e=>[..._e,...he]);const ue=he.map(_e=>URL.createObjectURL(_e));q(_e=>[..._e,...ue])},te=se=>{URL.revokeObjectURL(F[se]),z(he=>he.filter((ue,_e)=>_e!==se)),q(he=>he.filter((ue,_e)=>_e!==se))},ie=async se=>{var he;if(!(!se||!i)){T(!0);try{for(const ue of Array.from(se)){const _e=ue.name.split(".").pop(),Ae=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${_e}`,{error:Ce}=await J.storage.from("listing-photos").upload(Ae,ue);if(Ce)throw Ce;const{data:{publicUrl:Se}}=J.storage.from("listing-photos").getPublicUrl(Ae);await _.mutateAsync({listingId:i.id,photoUrl:Se,isPrimary:!((he=i.photos)!=null&&he.length)})}ze.success("Photos uploaded!")}catch(ue){console.error("Upload error:",ue),ze.error("Failed to upload photos")}finally{T(!1)}}},oe=async se=>{for(let he=0;he{if(i)try{await j.mutateAsync({photoId:se,listingId:i.id}),ze.success("Photo removed")}catch{ze.error("Failed to remove photo")}},ae=async se=>{if(se.preventDefault(),!V.city.trim()||!V.state.trim()||!V.price){ze.error("Please fill in required fields (City, State, Price)");return}if(l&&!N){ze.error("Please select an agent to assign this listing to");return}try{const he={property_address:V.property_address||null,city:V.city,state:V.state,neighborhood:V.neighborhood||null,price:Number(V.price),property_type:V.property_type,status:V.status,bedrooms:V.bedrooms?Number(V.bedrooms):null,bathrooms:V.bathrooms?Number(V.bathrooms):null,square_footage:V.square_footage?Number(V.square_footage):null,lot_size:V.lot_size||null,year_built:V.year_built?Number(V.year_built):null,has_hoa:V.has_hoa,description:V.description||null,agent_notes:V.agent_notes||null,agent_notes_public:V.agent_notes_public,mls_link:V.mls_link||null,video_link:V.video_link||null,video_id:V.video_id||null,allow_sharing:V.allow_sharing,open_to_referrals:V.open_to_referrals,open_to_social_promotion:V.open_to_social_promotion,share_with_brokerage:V.share_with_brokerage,is_public:V.is_public};if(o)await y.mutateAsync({id:t,...he}),ze.success("Listing updated!"),s(`/mission-control/listings/${t}`);else{T(!0);let ue;if(l&&N?ue=await x.mutateAsync({agentId:N,...he}):ue=await p.mutateAsync(he),P.length>0)try{await oe(ue.id),F.forEach(_e=>URL.revokeObjectURL(_e)),z([]),q([])}catch(_e){console.error("Photo upload error:",_e),ze.error("Listing created but some photos failed to upload")}T(!1),ze.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${ue.id}`)}}catch(he){console.error("Save error:",he),ze.error("Failed to save listing"),T(!1)}};return o&&h?r.jsx(Lr,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-10 w-32"}),r.jsx(Ir,{className:"h-[600px] w-full"})]})}):r.jsx(Lr,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:ae,className:"space-y-6",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),l?"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:[l&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Assign to Agent *"})}),r.jsxs(Je,{children:[r.jsxs(gn,{value:N,onValueChange:A,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select an agent..."})}),r.jsx(pn,{children:C.map(se=>r.jsx(qt,{value:se.id,children:se.name||se.email},se.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(Gt,{children:r.jsx(Zt,{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(He,{children:"Property Address"}),r.jsx(dt,{value:V.property_address,onChange:se=>K({...V,property_address:se.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"City *"}),r.jsx(dt,{value:V.city,onChange:se=>K({...V,city:se.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"State *"}),r.jsx(dt,{value:V.state,onChange:se=>K({...V,state:se.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Neighborhood"}),r.jsx(dt,{value:V.neighborhood,onChange:se=>K({...V,neighborhood:se.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Price *"}),r.jsx(dt,{type:"number",value:V.price,onChange:se=>K({...V,price:se.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Property Type"}),r.jsxs(gn,{value:V.property_type,onValueChange:se=>K({...V,property_type:se}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:mWt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Status"}),r.jsxs(gn,{value:V.status,onValueChange:se=>K({...V,status:se}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:pWt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{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(He,{children:"Bedrooms"}),r.jsx(dt,{type:"number",value:V.bedrooms,onChange:se=>K({...V,bedrooms:se.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Bathrooms"}),r.jsx(dt,{type:"number",step:"0.5",value:V.bathrooms,onChange:se=>K({...V,bathrooms:se.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Sq Ft"}),r.jsx(dt,{type:"number",value:V.square_footage,onChange:se=>K({...V,square_footage:se.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Lot Size"}),r.jsx(dt,{value:V.lot_size,onChange:se=>K({...V,lot_size:se.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Year Built"}),r.jsx(dt,{type:"number",value:V.year_built,onChange:se=>K({...V,year_built:se.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Ps,{checked:V.has_hoa,onCheckedChange:se=>K({...V,has_hoa:se})}),r.jsx(He,{children:"Has HOA"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Description & Links"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(ps,{value:V.description,onChange:se=>K({...V,description:se.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Agent Notes"}),r.jsx(ps,{value:V.agent_notes,onChange:se=>K({...V,agent_notes:se.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{checked:V.agent_notes_public,onCheckedChange:se=>K({...V,agent_notes_public:se})}),r.jsx(He,{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(He,{children:"MLS Link"}),r.jsx(dt,{value:V.mls_link,onChange:se=>K({...V,mls_link:se.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Video Link"}),r.jsx(dt,{value:V.video_link,onChange:se=>K({...V,video_link:se.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Pa,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(Je,{children:r.jsx(fWt,{selectedVideoId:V.video_id,onVideoSelect:se=>K({...V,video_id:se}),listingId:o?t:void 0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Photos"})}),r.jsxs(Je,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((pe=i==null?void 0:i.photos)==null?void 0:pe.map(se=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:se.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>ye(se.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(_s,{className:"h-3 w-3"})}),se.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"})]},se.id))),!o&&F.map((se,he)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:se,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>te(he),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(_s,{className:"h-3 w-3"})}),he===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"})]},he)),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:[E?r.jsx(en,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{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:se=>o?ie(se.target.files):G(se.target.files),disabled:E})]})]}),!o&&P.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[P.length," photo",P.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{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(He,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Ps,{checked:V.allow_sharing,onCheckedChange:se=>K({...V,allow_sharing:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Ps,{checked:V.open_to_referrals,onCheckedChange:se=>K({...V,open_to_referrals:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Ps,{checked:V.open_to_social_promotion,onCheckedChange:se=>K({...V,open_to_social_promotion:se})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Ps,{checked:V.share_with_brokerage,onCheckedChange:se=>K({...V,share_with_brokerage:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Ps,{checked:V.is_public,onCheckedChange:se=>K({...V,is_public:se})})]})]})]}),r.jsx(ee,{type:"submit",className:"w-full",size:"lg",disabled:p.isPending||y.isPending,children:p.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function gWt({maxDurationSeconds:t=30,onRecordingComplete:e,onError:n,onRecordingStateChange:s,className:a,teleprompterContent:o}){const l=I.useRef(null),i=I.useRef(null),h=I.useRef(null),p=I.useRef([]),x=I.useRef(null),y=I.useRef(null),_=I.useRef(null),j=I.useRef(null),C=m3(),[N,A]=I.useState(!0),[E,T]=I.useState(!0),[P,z]=I.useState(null),[F,q]=I.useState(!1),[V,K]=I.useState(!1),[G,te]=I.useState(null),[ie,oe]=I.useState(null),[ye,ae]=I.useState(0),[pe,se]=I.useState("user"),[he,ue]=I.useState(0),[_e,Ae]=I.useState(!1),[Ce,Se]=I.useState(!0),[ge,Le]=I.useState(null),[ke,Be]=I.useState(!1),Ee=I.useCallback(Oe=>{A(Oe)},[]),Ue=I.useRef(N),Fe=I.useCallback(async()=>{var Qe;T(!0),Le(null);const Oe=C&&N;console.log("[VideoRecorder] initCamera start",{isMobile:C,usePortraitMode:N,shouldBePortrait:Oe,facingMode:pe});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");h.current&&(console.log("[VideoRecorder] stopping existing stream"),h.current.getTracks().forEach(wt=>wt.stop()));const nt=C&&Oe?{facingMode:{ideal:pe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:pe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",nt);const gt=await navigator.mediaDevices.getUserMedia({video:nt,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),gt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");h.current=gt,z(!0);const Mt=gt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Mt.width,"x",Mt.height),l.current){const wt=l.current;wt.srcObject=gt,wt.muted=!0,wt.playsInline=!0,wt.autoplay=!0,wt.setAttribute("muted",""),wt.setAttribute("playsinline",""),wt.setAttribute("autoplay","");try{(Qe=wt.load)==null||Qe.call(wt)}catch(Cr){console.warn("[VideoRecorder] videoEl.load failed",Cr)}const Qt=async()=>{try{return await wt.play(),console.log("[VideoRecorder] preview play ok"),Be(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:wt.readyState,videoWidth:wt.videoWidth,videoHeight:wt.videoHeight})},300),!0}catch(Cr){return console.warn("[VideoRecorder] preview play blocked",Cr),Be(!0),!1}};await new Promise(Cr=>{let cn=!1;const jn=()=>{cn||(cn=!0,Cr())},Qr=()=>{Qt().finally(jn)};wt.onloadedmetadata=Qr,wt.onloadeddata=Qr,setTimeout(jn,1500)})}try{y.current=new AudioContext;const wt=y.current.createMediaStreamSource(gt);_.current=y.current.createAnalyser(),_.current.fftSize=256,wt.connect(_.current);const Qt=()=>{if(_.current){const Cr=new Uint8Array(_.current.frequencyBinCount);_.current.getByteFrequencyData(Cr);const cn=Cr.reduce((jn,Qr)=>jn+Qr)/Cr.length;ue(Math.min(100,cn/128*100))}j.current=requestAnimationFrame(Qt)};Qt()}catch(wt){console.warn("Audio context not available:",wt)}}catch(nt){console.error("Camera initialization error:",nt),z(!1);let gt="Failed to access camera or microphone.";nt.name==="NotAllowedError"?gt="Camera permission denied. Please allow camera access in your browser settings.":nt.name==="NotFoundError"?gt="No camera found. Please connect a camera and try again.":nt.name==="NotReadableError"?gt="Camera is in use by another application. Please close other apps using the camera.":nt.message&&(gt=nt.message),Le(gt),n==null||n(gt)}finally{T(!1)}},[pe,n,C,N]);I.useEffect(()=>{Ue.current!==N&&P&&!F&&!ie&&(Ue.current=N,Fe())},[N,P,F,ie,Fe]),I.useEffect(()=>(Fe(),()=>{h.current&&h.current.getTracks().forEach(Oe=>Oe.stop()),x.current&&clearInterval(x.current),j.current&&cancelAnimationFrame(j.current),y.current&&y.current.close(),ie&&URL.revokeObjectURL(ie)}),[Fe,ie]),I.useEffect(()=>{if(E||P!==!0||ie)return;const Oe=h.current,Qe=l.current;!Oe||!Qe||(Qe.srcObject!==Oe&&(Qe.srcObject=Oe,Qe.muted=!0,Qe.playsInline=!0,Qe.autoplay=!0,Qe.setAttribute("muted",""),Qe.setAttribute("playsinline",""),Qe.setAttribute("autoplay","")),Qe.play().then(()=>Be(!1)).catch(nt=>{Be(!0),console.warn("Live preview play blocked on mount:",nt)}))},[P,E,ie]),I.useEffect(()=>{s==null||s(F)},[F,s]);const be=I.useCallback(async()=>{if(ie)return;const Oe=l.current;if(Oe)try{await Oe.play(),Be(!1)}catch(Qe){Be(!0),console.warn("Live preview still blocked (needs user gesture):",Qe)}},[ie]),tt=I.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),x.current&&(clearInterval(x.current),x.current=null),q(!1),K(!1)},[]),Te=I.useCallback(()=>{if(!h.current)return;be(),p.current=[],ae(0);const Qe=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(gt=>MediaRecorder.isTypeSupported(gt)),nt=new MediaRecorder(h.current,Qe?{mimeType:Qe,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});nt.ondataavailable=gt=>{gt.data.size>0&&p.current.push(gt.data)},nt.onstop=()=>{var wt;const gt=nt.mimeType||Qe||((wt=p.current[0])==null?void 0:wt.type)||"video/webm",mt=new Blob(p.current,{type:gt});te(mt);const Mt=URL.createObjectURL(mt);oe(Mt)},i.current=nt,nt.start(100),q(!0),x.current=setInterval(()=>{ae(gt=>gt>=t-1?(tt(),t):gt+1)},1e3)},[be,t,tt]),Ke=I.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),K(!0),x.current&&clearInterval(x.current))},[]),me=I.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),K(!1),x.current=setInterval(()=>{ae(Oe=>Oe>=t-1?(tt(),t):Oe+1)},1e3))},[t,tt]),yt=I.useCallback(()=>{ie&&URL.revokeObjectURL(ie),te(null),oe(null),ae(0),Ae(!1),Se(!0),l.current&&h.current&&(l.current.srcObject=h.current,l.current.muted=!0,be())},[be,ie]),rt=I.useCallback(()=>{se(Oe=>Oe==="user"?"environment":"user")},[]),at=I.useCallback(()=>{G&&e(G,ye)},[G,ye,e]),Me=I.useCallback(()=>{l.current&&ie&&(_e?l.current.pause():(Se(!1),l.current.muted=!1,l.current.play()),Ae(!_e))},[ie,_e]);I.useEffect(()=>{if(!ie)return;const Oe=l.current;if(!Oe)return;Se(!1),Oe.pause(),Oe.removeAttribute("src"),Oe.srcObject=null,Oe.load(),Oe.src=ie,Oe.currentTime=0,Oe.playsInline=!0,Oe.muted=!1,Oe.onended=()=>Ae(!1);const Qe=()=>{const nt=Oe.error,gt=nt?`Recorded video failed to play (code ${nt.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",nt),n==null||n(gt)};return Oe.addEventListener("error",Qe),Oe.load(),()=>{Oe.removeEventListener("error",Qe)}},[n,ie]);const ft=Oe=>{const Qe=Math.floor(Oe/60),nt=Oe%60;return`${Qe}:${nt.toString().padStart(2,"0")}`},qe=C&&N?"aspect-[9/16]":"aspect-video";return E?r.jsx("div",{className:zt("flex items-center justify-center bg-black rounded-lg",qe,a),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(en,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):P===!1?r.jsx("div",{className:zt("flex items-center justify-center bg-black rounded-lg",qe,a),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(fl,{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:ge||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{onClick:()=>Fe(),variant:"secondary",className:"w-full",children:[r.jsx(Gl,{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",a),children:[C&&!F&&!ie&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(vj,{className:zt("h-4 w-4",N?"text-muted-foreground":"text-primary")}),r.jsx(He,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Ps,{id:"orientation-toggle",checked:N,onCheckedChange:Ee}),r.jsx(He,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(jg,{className:zt("h-4 w-4",N?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:zt("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{be()},children:[r.jsx("video",{ref:l,src:ie??void 0,className:zt("w-full bg-black",N&&!ie?"object-contain":"object-cover",qe,pe==="user"&&!ie&&"scale-x-[-1]"),playsInline:!0,controls:!!ie,muted:ie?Ce:!0,autoPlay:!ie},ie??"live"),!ie&&ke&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(ee,{type:"button",variant:"secondary",onClick:()=>void be(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!ie&&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",V?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[ft(ye)," / ",ft(t)]})]}),F&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Zc,{value:ye/t*100,className:"h-1 rounded-none"})}),!ie&&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($T,{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:`${he}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ie?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:yt,children:[r.jsx(Gl,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(ee,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Me,children:_e?r.jsx(Jf,{className:"h-5 w-5"}):r.jsx(fc,{className:"h-5 w-5"})}),r.jsxs(ee,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:at,children:[r.jsx(Ai,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(ee,{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(mS,{className:"h-5 w-5"})}),F?r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:V?me:Ke,children:V?r.jsx(fc,{className:"h-5 w-5"}):r.jsx(Jf,{className:"h-5 w-5"})}),r.jsx(ee,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:tt,children:r.jsx(kg,{className:"h-6 w-6 fill-current"})})]}):r.jsx(ee,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Te,children:r.jsx(Pa,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function xWt({text:t,isVisible:e,onToggleVisibility:n,isRecording:s=!1,className:a}){const o=I.useRef(null),l=I.useRef(null),i=I.useRef(0),h=I.useRef(0),[p,x]=I.useState(!1),[y,_]=I.useState(30),[j,C]=I.useState(24),[N,A]=I.useState(1.6),[E,T]=I.useState(.85),[P,z]=I.useState("top"),[F,q]=I.useState(!1),V=I.useCallback(ie=>{if(!o.current)return;i.current===0&&(i.current=ie);const oe=ie-i.current;i.current=ie,h.current+=y*oe/1e3;const ye=Math.floor(h.current);ye>0&&(o.current.scrollTop+=ye,h.current-=ye);const{scrollTop:ae,scrollHeight:pe,clientHeight:se}=o.current;if(ae+se>=pe){x(!1);return}l.current=requestAnimationFrame(V)},[y]);I.useEffect(()=>(p?(i.current=0,h.current=0,l.current=requestAnimationFrame(V)):l.current&&cancelAnimationFrame(l.current),()=>{l.current&&cancelAnimationFrame(l.current)}),[p,V]),I.useEffect(()=>{s&&e?(o.current&&(o.current.scrollTop=0),setTimeout(()=>{x(!0)},100)):s||x(!1)},[s,e]);const K=I.useCallback(()=>{o.current&&(o.current.scrollTop=0),x(!1)},[]),G=I.useCallback(()=>{x(ie=>!ie)},[]);if(!e)return r.jsx("div",{className:zt("absolute top-4 right-4 pointer-events-auto z-10",a),children:r.jsxs(ee,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const te={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",a),children:[r.jsx("div",{className:zt("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",te[P]),style:{opacity:E},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:`${j}px`,lineHeight:N,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(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsx(ee,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(md,{className:"h-4 w-4"})})}),r.jsx(Bd,{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(He,{className:"text-xs",children:"Scroll Speed"}),r.jsx(um,{value:[y],onValueChange:([ie])=>_(ie),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Font Size"}),r.jsx(um,{value:[j],onValueChange:([ie])=>C(ie),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Line Spacing"}),r.jsx(um,{value:[N*10],onValueChange:([ie])=>A(ie/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Opacity"}),r.jsx(um,{value:[E*100],onValueChange:([ie])=>T(ie/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:P==="top"?"default":"outline",size:"sm",onClick:()=>z("top"),children:r.jsx(f1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:P==="center"?"default":"outline",size:"sm",onClick:()=>z("center"),children:r.jsx(j1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:P==="bottom"?"default":"outline",size:"sm",onClick:()=>z("bottom"),children:r.jsx(Fd,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Ps,{checked:F,onCheckedChange:q})]})]})})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:G,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:p?r.jsx(Jf,{className:"h-4 w-4"}):r.jsx(fc,{className:"h-4 w-4"})}),r.jsx(ee,{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(mS,{className:"h-4 w-4"})}),r.jsxs(ee,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(g1,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function yWt({onSelectScript:t,onCreateNew:e,selectedScriptId:n,className:s}){const{toast:a}=pi(),[o,l]=I.useState(""),[i,h]=I.useState(null),[p,x]=I.useState("levelup"),{data:y,isLoading:_}=Gjt(),{data:j,isLoading:C}=Kjt(),{data:N,isLoading:A}=Zjt(),E=Yjt(),T=I.useMemo(()=>j?j.filter(V=>{const K=!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())||V.tags.some(te=>te.toLowerCase().includes(o.toLowerCase())),G=!i||V.category_id===i;return K&&G}):[],[j,o,i]),P=I.useMemo(()=>N?N.filter(V=>!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())):[],[N,o]),z=V=>{t({title:V.title,text:V.script_text})},F=async V=>{try{await E.mutateAsync(V),a({title:"Script saved to My Scripts"})}catch{a({title:"Failed to save script",variant:"destructive"})}},q=_||C||A;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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search scripts...",value:o,onChange:V=>l(V.target.value),className:"pl-9"})]})}),r.jsxs(Ii,{value:p,onValueChange:V=>x(V),className:"flex-1 flex flex-col",children:[r.jsxs(wi,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(nn,{value:"levelup",children:[r.jsx(La,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(nn,{value:"my-scripts",children:[r.jsx(pm,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(Sn,{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(Ot,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>h(null),children:"All"}),y==null?void 0:y.map(V=>r.jsx(Ot,{variant:i===V.id?"default":"outline",className:"cursor-pointer",onClick:()=>h(V.id),children:V.name},V.id))]}),r.jsx(tl,{className:"flex-1 max-h-[50vh]",children:q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(La,{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:T.map(V=>r.jsxs(Ye,{className:zt("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>z(V),children:[r.jsx(Gt,{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(Zt,{className:"text-sm font-medium truncate",children:V.title}),V.category&&r.jsx(Ot,{variant:"secondary",className:"mt-1 text-xs",children:V.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:K=>{K.stopPropagation(),F(V)},children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(Vi,{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:V.script_text})})]},V.id))})})]}),r.jsxs(Sn,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[e&&r.jsxs(ee,{variant:"outline",className:"mb-4",onClick:e,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(tl,{className:"flex-1 max-h-[50vh]",children:A?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):P.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(pm,{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:P.map(V=>r.jsxs(Ye,{className:zt("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>z(V),children:[r.jsx(Gt,{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(Zt,{className:"text-sm font-medium truncate",children:V.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:V.is_custom?r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Vi,{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:V.script_text})})]},V.id))})})]})]})]})}function vWt({selectedTemplate:t,onSelect:e,contactName:n,saving:s=!1}){const[a,o]=I.useState(()=>{const i=TS(t);return new Set([i.category])}),l=i=>{o(h=>{const p=new Set(h);return p.has(i)?p.delete(i):p.add(i),p})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(He,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(en,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:rft.map(i=>{const h=nft(i.id),p=a.has(i.id),x=h.some(y=>y.id===t);return r.jsxs(SS,{open:p,onOpenChange:()=>l(i.id),children:[r.jsxs(CS,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:i.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.length,")"]}),x&&!p&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Fd,{className:zt("h-4 w-4 text-muted-foreground transition-transform",p&&"rotate-180")})]}),r.jsx(MS,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:h.map(y=>{const _=t===y.id;return r.jsxs("button",{type:"button",onClick:()=>e(y.id),disabled:s,className:zt("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",_?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[_&&r.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx(Ai,{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 shrink-0",children:y.icon}),r.jsx("span",{className:"text-sm font-medium truncate",children:y.name})]})]},y.id)})})})]},i.id)})}),n&&t!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',TS(t).headerText(n),'"']})]})}function E$e({open:t,onOpenChange:e,video:n,contactName:s,onTemplateUpdated:a}){const[o,l]=I.useState(n.page_template||"default"),[i,h]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState(n.page_template||"default"),[j,C]=I.useState([]),[N,A]=I.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[E,T]=I.useState(!1),[P,z]=I.useState(!1),F=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";I.useEffect(()=>{t&&j.length===0&&q()},[t]);const q=async()=>{z(!0);try{const{data:pe,error:se}=await J.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;const he=(pe||[]).map(ue=>({id:ue.id,name:[ue.first_name,ue.last_name].filter(Boolean).join(" ")||"Unnamed",email:ue.email||null}));C(he)}catch(pe){console.error("Failed to fetch contacts:",pe)}finally{z(!1)}},V=async pe=>{A(pe),T(!1),h(!0);try{const{error:se}=await J.from("agent_videos").update({contact_id:(pe==null?void 0:pe.id)||null,recipient_name:(pe==null?void 0:pe.name)||null}).eq("id",n.id);if(se)throw se;ze.success(pe?`Assigned to ${pe.name}`:"Contact removed"),a==null||a()}catch(se){console.error("Failed to update contact:",se),ze.error("Failed to update contact")}finally{h(!1)}},K=async pe=>{l(pe),h(!0);try{const{error:se}=await J.from("agent_videos").update({page_template:pe}).eq("id",n.id);if(se)throw se;_(pe),ze.success("Template saved!"),a==null||a()}catch(se){console.error("Failed to save template:",se),ze.error("Failed to save template"),l(y)}finally{h(!1)}},G=(N==null?void 0:N.name)||null,te=()=>{const pe=n.title||"Video Message",se=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},ie=async()=>{if(!n.thumbnail_url){ze.error("Video thumbnail not available yet");return}const pe=te(),se=`Watch: ${n.title||"Video Message"} ${F}`;try{const he=new Blob([pe],{type:"text/html"}),ue=new Blob([se],{type:"text/plain"}),_e=new ClipboardItem({"text/html":he,"text/plain":ue});await navigator.clipboard.write([_e]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(se+` `+pe),ze.success("Copied! Paste into your email.")}},oe=async()=>{await navigator.clipboard.writeText(F),x(!0),ze.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},ye=()=>{const se=TS(o).headerText(G),he=o==="default"?`Check out this video: ${F}`:`${se} Check out this special video: ${F}`;window.open(`sms:?body=${encodeURIComponent(he)}`,"_self")},ae=()=>{const pe=TS(o),se=pe.headerText(G),he=o==="default"?n.title||"Video Message":se,ue=`${pe.subText} Watch the video: ${F}`,_e=N!=null&&N.email?encodeURIComponent(N.email):"";window.open(`mailto:${_e}?subject=${encodeURIComponent(he)}&body=${encodeURIComponent(ue)}`,"_self")};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Qn,{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(He,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(hu,{open:E,onOpenChange:T,children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":E,className:"flex-1 justify-between",disabled:i,children:[N?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Ic,{className:"h-4 w-4 text-muted-foreground"}),N.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(p1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Bd,{className:"w-[300px] p-0",align:"start",children:r.jsxs(W1,{children:[r.jsx(G1,{placeholder:"Search contacts..."}),r.jsxs(K1,{children:[r.jsx(Z1,{children:P?"Loading...":"No contacts found."}),r.jsx(Y1,{children:j.map(pe=>r.jsxs(X1,{value:pe.name,onSelect:()=>V(pe),children:[r.jsx(Ai,{className:zt("mr-2 h-4 w-4",(N==null?void 0:N.id)===pe.id?"opacity-100":"opacity-0")}),pe.name]},pe.id))})]})]})})]}),N&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>V(null),disabled:i,className:"shrink-0",children:r.jsx(_s,{className:"h-4 w-4"})})]}),N&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',TS(o).headerText(N.name),'"']})]}),r.jsx(vWt,{selectedTemplate:o,onSelect:K,contactName:G,saving:i}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:F,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:oe,variant:p?"default":"outline",className:"shrink-0 gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Ai,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Qo,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Share for Email"}),r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:ie,children:[r.jsx(Pl,{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(He,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ye,children:[r.jsx(Oo,{className:"h-4 w-4"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ae,children:[r.jsx(ua,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(ea,{children:r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Done"})})]})})}function _Wt(){var at;const t=Zn(),[e]=qd(),{toast:n}=pi(),s=e.get("contact_id"),a=e.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:h}=ekt(),{data:p}=dp(),x=Aze(),y=skt(),[_,j]=I.useState("record"),[C,N]=I.useState(""),[A,E]=I.useState(!1),[T,P]=I.useState(!1),[z,F]=I.useState(!1),[q,V]=I.useState(null),[K,G]=I.useState(0),[te,ie]=I.useState(0),[oe,ye]=I.useState(null),[ae,pe]=I.useState(null),[se,he]=I.useState(s||""),[ue,_e]=I.useState(""),[Ae,Ce]=I.useState(""),[Se,ge]=I.useState(null),[Le,ke]=I.useState(null),[Be,Ee]=I.useState(null),[Ue,Fe]=I.useState(!1),be=I.useCallback(async(Me,ft)=>{V(Me),j("uploading");try{const{videoId:qe,uploadUrl:Oe}=await tkt(ue||"Quick Video Touch");ye(qe);const{apiKey:Qe}=await rkt(qe),nt=new XMLHttpRequest;nt.upload.onprogress=mt=>{mt.lengthComputable&&G(mt.loaded/mt.total*100)},await new Promise((mt,Mt)=>{nt.onload=()=>{nt.status>=200&&nt.status<300?mt():Mt(new Error(`Upload failed: ${nt.status}`))},nt.onerror=()=>Mt(new Error("Upload failed")),nt.open("PUT",Oe),nt.setRequestHeader("AccessKey",Qe),nt.send(Me)}),j("processing");let gt=0;for(;gt<4;){await new Promise(Mt=>setTimeout(Mt,2e3));const mt=await nkt(qe);if(gt=mt.status,ie(mt.encodeProgress||0),gt===4)pe({playbackUrl:mt.directPlayUrl,thumbnailUrl:mt.thumbnailUrl,previewUrl:mt.previewUrl||null,duration:mt.length||ft,fileSizeMb:(mt.storageSize||Me.size)/(1024*1024)});else if(gt===5||gt===6)throw new Error("Video processing failed")}j("details")}catch(qe){console.error("Upload error:",qe),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),j("record")}},[ue,n]),tt=async()=>{if(!(!oe||!ae))try{const Me=se&&se!=="none"?se:null,ft=await x.mutateAsync({bunny_video_id:oe,contact_id:Me,playback_url:ae.playbackUrl,thumbnail_url:ae.thumbnailUrl,preview_url:ae.previewUrl,duration_seconds:ae.duration,file_size_mb:ae.fileSizeMb,title:ue||"Quick Video Touch",notes:Ae,task_id:a||null,status:"ready"});ge(ft.id),ke(ft.share_token||null),Me&&await y.mutateAsync({contactId:Me,videoId:ft.id,notes:Ae}),n({title:"Video saved successfully!"}),j("share")}catch(Me){console.error("Save video error:",Me),n({title:"Failed to save video",description:(Me==null?void 0:Me.message)||"Please try again.",variant:"destructive"})}},Te=(Me,ft)=>{navigator.clipboard.writeText(ft),Ee(Me),setTimeout(()=>Ee(null),2e3),n({title:"Copied to clipboard!"})},Ke=()=>Le?`https://video.relevelup.com/${Le}`:(ae==null?void 0:ae.playbackUrl)||"",me=()=>{const Me=p==null?void 0:p.find(nt=>nt.id===se),ft=Me?`${Me.first_name}`:"",qe=(Me==null?void 0:Me.phone)||"",Oe=(Me==null?void 0:Me.email)||"",Qe=Ke();return{text:`Hey${ft?` ${ft}`:""}! I recorded a quick video for you: ${Qe}`,link:Qe,contactPhone:qe,contactEmail:Oe}},yt=()=>{const{text:Me,contactPhone:ft}=me(),qe=ft?`sms:${ft}?body=${encodeURIComponent(Me)}`:`sms:?body=${encodeURIComponent(Me)}`;window.open(qe,"_self")},rt=()=>{const{link:Me,contactEmail:ft}=me(),qe="Check out this video",Oe=`I recorded a quick video for you: ${Me}`,Qe=ft?`mailto:${ft}?subject=${encodeURIComponent(qe)}&body=${encodeURIComponent(Oe)}`:`mailto:?subject=${encodeURIComponent(qe)}&body=${encodeURIComponent(Oe)}`;window.open(Qe,"_self")};return o?r.jsx(Lr,{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(ee,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:r.jsx(so,{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"})]})]}),h&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",i.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),_==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(gWt,{maxDurationSeconds:30,onRecordingComplete:be,onRecordingStateChange:F,className:"w-full",teleprompterContent:A&&C&&r.jsx(xWt,{text:C,isVisible:A,onToggleVisibility:()=>E(!1),isRecording:z})}),!A&&C&&r.jsxs(ee,{variant:"outline",className:"mt-4",onClick:()=>E(!0),children:[r.jsx(La,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ye,{className:"lg:col-span-1",children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{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:Me=>N(Me.target.value),rows:6}),r.jsxs(Jne,{open:T,onOpenChange:P,children:[r.jsx(Rge,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"w-full",children:[r.jsx(La,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(SI,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(ese,{className:"p-4 border-b",children:r.jsx(tse,{children:"Select a Script"})}),r.jsx(yWt,{onSelectScript:Me=>{N(Me.text),P(!1),E(!0)},className:"h-[calc(100vh-80px)]"})]})]}),C&&r.jsx(ee,{className:"w-full",onClick:()=>E(!0),children:"Use Script"})]})]})]}),_==="uploading"&&r.jsx(Ye,{className:"max-w-md mx-auto",children:r.jsxs(Je,{className:"pt-6 text-center",children:[r.jsx(uo,{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),"%"]})]})}),_==="processing"&&r.jsx(Ye,{className:"max-w-md mx-auto",children:r.jsxs(Je,{className:"pt-6 text-center",children:[r.jsx(en,{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:te,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[te.toFixed(0),"%"]})]})}),_==="details"&&r.jsxs(Ye,{className:"max-w-lg mx-auto",children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Video Details"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Title"}),r.jsx(dt,{value:ue,onChange:Me=>_e(Me.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Attach to Contact (Optional)"}),r.jsxs(gn,{value:se,onValueChange:he,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"No contact - use anywhere"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Co,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),p==null?void 0:p.map(Me=>r.jsx(qt,{value:Me.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ic,{className:"h-4 w-4"}),Me.first_name," ",Me.last_name]})},Me.id))]})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Notes"}),r.jsx(ps,{value:Ae,onChange:Me=>Ce(Me.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(ee,{className:"w-full",onClick:tt,disabled:x.isPending,children:[x.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),_==="share"&&r.jsxs(Ye,{className:"max-w-lg mx-auto",children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ai,{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(ee,{variant:"outline",className:"justify-start",onClick:yt,children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:rt,children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Te("link",me().link),children:[r.jsx(Co,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Be==="link"&&r.jsx(Ai,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Fe(!0),children:[r.jsx(pd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>t("/mission-control/video-library"),children:"View Library"}),r.jsx(ee,{onClick:()=>{j("record"),V(null),ye(null),pe(null)},children:"Record Another"})]})]})]}),Se&&Le&&r.jsx(E$e,{open:Ue,onOpenChange:Fe,video:{id:Se,share_token:Le,title:ue||null,contact_id:se||null,thumbnail_url:(ae==null?void 0:ae.thumbnailUrl)||null},contactName:((at=p==null?void 0:p.find(Me=>Me.id===se))==null?void 0:at.first_name)||null})]})}):r.jsx(Lr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Hh,{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(ee,{onClick:()=>t("/mission-control/video-library"),children:"Open Video Library"})]})})}function bWt({open:t,onOpenChange:e}){const{data:n}=dp(),{data:s}=bye(),a=Aze(),o=I.useRef(null),[l,i]=I.useState(null),[h,p]=I.useState(""),[x,y]=I.useState(""),[_,j]=I.useState(""),[C,N]=I.useState(!1),[A,E]=I.useState(0),[T,P]=I.useState("idle"),z=(s==null?void 0:s.total_storage_mb)||0,q=((s==null?void 0:s.max_storage_mb)||1024)-z,V=ie=>{var ae;const oe=(ae=ie.target.files)==null?void 0:ae[0];if(!oe)return;if(!oe.type.startsWith("video/")){ze.error("Please select a video file");return}const ye=oe.size/(1024*1024);if(ye>500){ze.error("Video file must be less than 500MB");return}if(ye>q){ze.error(`Not enough storage. You have ${q.toFixed(1)} MB remaining.`);return}i(oe),h||p(oe.name.replace(/\.[^/.]+$/,""))},K=async()=>{if(!l){ze.error("Please select a video file");return}N(!0),E(0),P("creating");try{const{data:ie,error:oe}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:h||l.name,isAgentVideo:!0}});if(oe)throw new Error(oe.message);const{videoId:ye,libraryId:ae}=ie;P("uploading");const{data:pe,error:se}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ye,isAgentVideo:!0}});if(se)throw new Error(se.message);await new Promise((_e,Ae)=>{const Ce=new XMLHttpRequest;Ce.upload.addEventListener("progress",Se=>{if(Se.lengthComputable){const ge=Math.round(Se.loaded/Se.total*100);E(ge)}}),Ce.addEventListener("load",()=>{Ce.status>=200&&Ce.status<300?_e():Ae(new Error(`Upload failed with status ${Ce.status}`))}),Ce.addEventListener("error",()=>Ae(new Error("Upload failed"))),Ce.open("PUT",pe.uploadUrl),Ce.setRequestHeader("AccessKey",pe.apiKey),Ce.send(l)}),P("processing");const he=l.size/(1024*1024),ue=`https://iframe.mediadelivery.net/embed/${ae}/${ye}`;await a.mutateAsync({bunny_video_id:ye,playback_url:ue,file_size_mb:he,title:h||l.name,notes:x||void 0,contact_id:_||void 0,status:"processing",touch_type:"video_upload"}),ze.success("Video uploaded successfully! Processing may take a few minutes."),G()}catch(ie){console.error("Upload error:",ie),ze.error(ie instanceof Error?ie.message:"Failed to upload video")}finally{N(!1),P("idle")}},G=()=>{C||(i(null),p(""),y(""),j(""),E(0),P("idle"),e(!1))},te=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${A}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Fr,{open:t,onOpenChange:G,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Upload Video"}),r.jsx(Qn,{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(He,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Pa,{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:l.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(l.size/(1024*1024)).toFixed(1)," MB"]})]}),!C&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ie=>{ie.stopPropagation(),i(null)},children:r.jsx(_s,{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 ie;return(ie=o.current)==null?void 0:ie.click()},children:[r.jsx(uo,{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:V,disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",value:h,onChange:ie=>p(ie.target.value),placeholder:"Enter video title",disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Associate with Contact (optional)"}),r.jsxs(gn,{value:_||"__none__",onValueChange:ie=>j(ie==="__none__"?"":ie),disabled:C,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a contact"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ie=>r.jsxs(qt,{value:ie.id,children:[ie.first_name," ",ie.last_name||""]},ie.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(ps,{id:"notes",value:x,onChange:ie=>y(ie.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(en,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:te()})]}),r.jsx(Zc,{value:T==="uploading"?A:T==="processing"?100:10})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:G,disabled:C,children:"Cancel"}),r.jsx(ee,{onClick:K,disabled:!l||C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function wWt({previewSrc:t,thumbnailSrc:e,alt:n,isHovered:s}){const[a,o]=I.useState(!1),[l,i]=I.useState(!1),h=s&&t&&!a,p=e&&!l;return!p&&!h?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Pa,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[p&&r.jsx("img",{src:e,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${h?"opacity-0":"opacity-100"}`,onError:()=>i(!0)}),h&&r.jsx("img",{src:t,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function jWt({video:t,previewSrc:e,thumbnailSrc:n,onOpen:s,onDelete:a,onNavigateToContact:o,onGetEmbedCode:l,onCopyEmailHtml:i,onShareWithTemplate:h,getContactName:p,getShareUrl:x,copyToClipboard:y,formatDuration:_}){const[j,C]=I.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(wWt,{previewSrc:e,thumbnailSrc:n,alt:t.title||"Video preview",isHovered:j}),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(fc,{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:_(t.duration_seconds)}),t.status!=="ready"&&r.jsx(Ot,{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(Ic,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:p(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(Ya,{className:"h-3 w-3"}),r.jsx("span",{children:xn(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(el,{className:"h-3 w-3"}),r.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]})]}),r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:N=>N.stopPropagation(),children:r.jsx(Mx,{className:"h-4 w-4"})})}),r.jsxs(Gu,{align:"end",className:"bg-popover",children:[r.jsxs(di,{onClick:N=>{N.stopPropagation(),s()},children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(Bj,{}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),h()},children:[r.jsx(pd,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),y(x(t),"Share link")},children:[r.jsx(Co,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),l()},children:[r.jsx(hj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),i()},children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsx(Bj,{}),t.contact_id&&r.jsxs(di,{onClick:N=>{N.stopPropagation(),o()},children:[r.jsx(Ic,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),a()},className:"text-destructive",children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function kWt(){const t=Zn(),{data:e,isLoading:n}=Xjt(),{data:s}=bye(),{data:a}=dp(),o=Jjt(),[l,i]=I.useState(""),[h,p]=I.useState(null),[x,y]=I.useState(!1),[_,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,P]=I.useState(!1),[z,F]=I.useState({}),q=ge=>{if(!ge)return"Unassigned";const Le=a==null?void 0:a.find(ke=>ke.id===ge);return Le?`${Le.first_name} ${Le.last_name||""}`.trim():"Unknown"},V=ge=>{if(!ge)return"0:00";const Le=Math.floor(ge/60),ke=ge%60;return`${Le}:${ke.toString().padStart(2,"0")}`},K=e==null?void 0:e.filter(ge=>{if(!l)return!0;const Le=q(ge.contact_id).toLowerCase(),ke=(ge.title||"").toLowerCase(),Be=(ge.notes||"").toLowerCase();return Le.includes(l.toLowerCase())||ke.includes(l.toLowerCase())||Be.includes(l.toLowerCase())});I.useEffect(()=>{(async()=>{if(!(e!=null&&e.length))return;const Le=e.filter(Be=>(Be==null?void 0:Be.bunny_video_id)&&!z[Be.id]);if(!Le.length)return;const ke=await Promise.allSettled(Le.map(async Be=>{const{data:Ee,error:Ue}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Be.bunny_video_id,isAgentVideo:!0}});if(Ue)throw Ue;return{id:Be.id,previewUrl:Ee==null?void 0:Ee.previewUrl,thumbnailUrl:Ee==null?void 0:Ee.thumbnailUrl}}));F(Be=>{const Ee={...Be};for(const Ue of ke)Ue.status==="fulfilled"&&(Ee[Ue.value.id]={previewUrl:Ue.value.previewUrl,thumbnailUrl:Ue.value.thumbnailUrl});return Ee})})().catch(Le=>console.warn("Failed to load signed Bunny asset URLs",Le))},[e,z]);const G=(s==null?void 0:s.total_storage_mb)||0,te=(s==null?void 0:s.max_storage_mb)||1024,ie=G/te*100,oe=ie>=80,ye=ie>=100,ae=async(ge,Le)=>{await navigator.clipboard.writeText(ge),ze.success(`${Le} copied to clipboard`)},pe=ge=>ge.share_token?`https://video.relevelup.com/${ge.share_token}`:ge.playback_url||"",se=ge=>{const Le=pe(ge),ke=a==null?void 0:a.find(tt=>tt.id===ge.contact_id),Be=q(ge.contact_id),Ee=Be!=="Unassigned"?Be.split(" ")[0]:"",Ue=(ke==null?void 0:ke.phone)||"",Fe=`Hey${Ee?` ${Ee}`:""}! I recorded a quick video message for you. Check it out: ${Le}`,be=Ue?`sms:${Ue}?body=${encodeURIComponent(Fe)}`:`sms:?body=${encodeURIComponent(Fe)}`;window.open(be,"_self")},he=ge=>{const Le=a==null?void 0:a.find(be=>be.id===ge.contact_id),ke=(Le==null?void 0:Le.email)||"",Be=pe(ge),Ee="Check out this video",Ue=`I recorded a quick video for you: ${Be}`,Fe=ke?`mailto:${ke}?subject=${encodeURIComponent(Ee)}&body=${encodeURIComponent(Ue)}`:`mailto:?subject=${encodeURIComponent(Ee)}&body=${encodeURIComponent(Ue)}`;window.open(Fe,"_self")},ue=ge=>{var Ee;const Le=pe(ge),ke=ge.title||"Video Message",Be=ge.share_token?`https://video.relevelup.com/thumb/${ge.share_token}`:((Ee=z[ge.id])==null?void 0:Ee.thumbnailUrl)||ge.thumbnail_url||"";return``},_e=async ge=>{if(!ge.thumbnail_url&&!ge.share_token){ze.error("Video thumbnail not available yet");return}const Le=ue(ge),ke=pe(ge),Be=`Watch: ${ge.title||"Video Message"} ${ke}`;try{const Ee=new Blob([Le],{type:"text/html"}),Ue=new Blob([Be],{type:"text/plain"}),Fe=new ClipboardItem({"text/html":Ee,"text/plain":Ue});await navigator.clipboard.write([Fe]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(Be+` `+Le),ze.success("Copied! Paste into your email.")}},Ae=async ge=>{try{ze.loading("Preparing download...",{id:"download"});const{data:Le,error:ke}=await J.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:ge.bunny_video_id,isAgentVideo:!0}});if(ke||!(Le!=null&&Le.downloadUrl))throw new Error((ke==null?void 0:ke.message)||"Failed to get download URL");const Ee=`${((ge.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,Ue=await fetch(Le.downloadUrl);if(!Ue.ok)throw new Error("Failed to fetch video file");const Fe=await Ue.blob(),be=URL.createObjectURL(Fe),tt=document.createElement("a");tt.href=be,tt.download=Ee,tt.rel="noreferrer",document.body.appendChild(tt),tt.click(),tt.remove(),URL.revokeObjectURL(be),ze.success("Download started",{id:"download"})}catch(Le){console.error("Download error:",Le),ze.error("Could not force download (your browser may block it).",{id:"download"})}},Ce=ge=>{p(ge),y(!0)},Se=async()=>{if(h)try{await o.mutateAsync({id:h.id,bunnyVideoId:h.bunny_video_id,hardDelete:!0}),j(!1),p(null),ze.success("Video deleted successfully")}catch{ze.error("Failed to delete video")}};return r.jsx(Lr,{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(ee,{variant:"outline",onClick:()=>N(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(ee,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ye,{className:oe?"border-amber-500":ye?"border-destructive":"",children:r.jsxs(Je,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(PT,{className:`h-5 w-5 ${ye?"text-destructive":oe?"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:[G.toFixed(1)," MB / ",te>=1024?`${(te/1024).toFixed(0)} GB`:`${te} MB`]})]}),r.jsx(Zc,{value:Math.min(ie,100),className:`h-2 ${ye?"[&>div]:bg-destructive":oe?"[&>div]:bg-amber-500":""}`})]}),oe&&!ye&&r.jsxs(Ot,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(fl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),ye&&r.jsxs(Ot,{variant:"destructive",children:[r.jsx(fl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),ye&&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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search videos by contact, title, or notes...",value:l,onChange:ge=>i(ge.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(Pa,{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(ee,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(bn,{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(ge=>{var Le,ke;return r.jsx(jWt,{video:ge,previewSrc:(Le=z[ge.id])==null?void 0:Le.previewUrl,thumbnailSrc:(ke=z[ge.id])==null?void 0:ke.thumbnailUrl,onOpen:()=>Ce(ge),onDelete:()=>{p(ge),j(!0)},onNavigateToContact:()=>t(`/mission-control/contacts/${ge.contact_id}`),onGetEmbedCode:()=>{p(ge),E(!0)},onCopyEmailHtml:()=>_e(ge),onShareWithTemplate:()=>{p(ge),P(!0)},getContactName:q,getShareUrl:pe,copyToClipboard:ae,formatDuration:V},ge.id)})}),r.jsx(Fr,{open:x,onOpenChange:y,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:(h==null?void 0:h.title)||"Video Preview"}),r.jsx(Qn,{children:(h==null?void 0:h.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ic,{className:"h-3 w-3"}),q(h.contact_id)]})})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:h.playback_url?(()=>{let ge=h.playback_url;return ge.includes("iframe.mediadelivery.net/play/")&&(ge=ge.replace("/play/","/embed/"),ge+=(ge.includes("?")?"&":"?")+"autoplay=false&responsive=true"),ge.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:ge,title:h.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:h.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:h.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>ze.error("Video preview failed to load")},h.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Pa,{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(ee,{variant:"outline",onClick:()=>se(h),children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>he(h),children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ae(pe(h),"Share link"),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(ee,{variant:"outline",onClick:()=>_e(h),children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(ee,{variant:"outline",onClick:()=>Ae(h),children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>{y(!1),P(!0)},children:[r.jsx(pd,{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(ee,{variant:"destructive",onClick:()=>{y(!1),j(!0)},children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Fr,{open:_,onOpenChange:j,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Delete Video"}),r.jsx(Qn,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Se,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(bWt,{open:C,onOpenChange:N}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{className:"sm:max-w-lg",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Embed Video"}),r.jsx(Qn,{children:"Copy this code to embed the video on your website."})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{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(ee,{className:"flex-1",onClick:()=>{const ge=``;ae(ge,"Embed code")},children:[r.jsx(Qo,{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."})]})]})}),h&&r.jsx(E$e,{open:T,onOpenChange:P,video:h,contactName:q(h.contact_id)})]})})}function I$e({stages:t,currentStageId:e,onStageSelect:n,disabled:s}){const[a,o]=I.useState(!1),l=t.find(h=>h.id===e),i=h=>{h.id!==e&&n(h.id,h.name),o(!1)};return r.jsxs(jh,{open:a,onOpenChange:o,children:[r.jsx(kh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:h=>h.stopPropagation(),children:[l&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:l.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(l==null?void 0:l.name)||"Move"}),r.jsx(Vi,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(Gu,{align:"end",className:"w-48 z-50 bg-popover",onClick:h=>h.stopPropagation(),children:t.map(h=>{const p=h.icon&&vAe[h.icon]||Bu,x=h.id===e;return r.jsxs(di,{onClick:()=>i(h),className:zt("flex items-center gap-2 cursor-pointer",x&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${h.color}20`},children:r.jsx(p,{className:"h-3 w-3",style:{color:h.color}})}),r.jsx("span",{className:"flex-1",children:h.name}),x&&r.jsx(Ai,{className:"h-4 w-4 text-primary"})]},h.id)})})]})}const NWt={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"}},SWt={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 P$e({deal:t,onClick:e,isDragging:n,stages:s,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var E,T;const i=m3(),h=NWt[t.deal_type],p=SWt[t.priority],x=I.useMemo(()=>t.target_close_date?dy(new Date(t.target_close_date),new Date):null,[t.target_close_date]),y=x!==null&&x<0,_=x!==null&&x<=7&&x>=0,j=I.useMemo(()=>{var F;if(t.deal_type!=="seller"&&t.deal_type!=="dual")return null;const P=((F=t.listing)==null?void 0:F.created_at)||t.listing_date;if(!P)return null;const z=t.contract_date?new Date(t.contract_date):new Date;return dy(z,new Date(P))},[t]),C=l&&!t.scorecard_transaction_id,N=!!t.scorecard_transaction_id,A=P=>P?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(P):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",C&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),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(Ot,{variant:"outline",className:zt("text-[10px] px-1.5 py-0 shrink-0",h.color),children:h.label})]}),t.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ks,{className:"h-5 w-5",children:r.jsxs(Zs,{className:"text-[10px] bg-primary/10 text-primary",children:[(E=t.contact.first_name)==null?void 0:E[0],(T=t.contact.last_name)==null?void 0:T[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"})]}),C&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[r.jsx(Zi,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),N&&l&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[r.jsx(Xi,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),j!==null&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(AT,{className:"h-3 w-3 text-muted-foreground shrink-0"}),r.jsxs("span",{className:zt("font-medium",j>90?"text-red-600":j>60?"text-amber-600":"text-muted-foreground"),children:[j," DOM"]}),t.contract_date&&r.jsx("span",{className:"text-muted-foreground",children:"(final)"})]}),!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(da,{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(fd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:A(t.expected_price)}),t.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",A(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]",p.color),children:[r.jsx("div",{className:zt("w-1.5 h-1.5 rounded-full",p.dot)}),r.jsx("span",{className:"capitalize",children:t.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.probability,"%"]})]}),o&&i&&s&&a?r.jsx(I$e,{stages:s,currentStageId:t.stage_id||"",onStageSelect:(P,z)=>a(t.id,P,z)}):t.target_close_date?r.jsxs("div",{className:zt("flex items-center gap-1 text-[10px]",y&&"text-red-600",_&&!y&&"text-amber-600",!y&&!_&&"text-muted-foreground"),children:[y?r.jsx(fl,{className:"h-3 w-3"}):r.jsx(Os,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:_?`${x}d left`:xn(new Date(t.target_close_date),"MMM d")})]}):null]})]})})}function CWt({stage:t,deals:e,onDealClick:n,onAddDeal:s,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:h=!1}){const p=I.useRef(null),x=e.reduce((C,N)=>C+(N.expected_price||0),0),y=e.reduce((C,N)=>C+(N.expected_commission||0),0),_=C=>C>=1e6?`$${(C/1e6).toFixed(1)}M`:C>=1e3?`$${(C/1e3).toFixed(0)}K`:`$${C.toFixed(0)}`,j=t.icon&&vAe[t.icon]||Bu;return r.jsxs("div",{ref:p,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",i&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:C=>o(C,t.id),onDrop:C=>l(C,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(j,{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(Ot,{variant:"secondary",className:"text-xs font-medium px-2",children:e.length})]}),x>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:_(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[_(y)," GCI"]})]})]}),r.jsx(tl,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[e.map(C=>r.jsx("div",{draggable:!0,onDragStart:N=>{N.dataTransfer.effectAllowed="move",a(C.id,t.id)},children:r.jsx(P$e,{deal:C,onClick:()=>n(C),isWonStage:h})},C.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(ee,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(t.id),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function MWt({stats:t,isLoading:e}){const n=a=>a>=1e6?`$${(a/1e6).toFixed(1)}M`:a>=1e3?`$${(a/1e3).toFixed(0)}K`:`$${a.toLocaleString()}`,s=[{label:"Active Deals",value:(t==null?void 0:t.activeDeals)||0,icon:Kx,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((t==null?void 0:t.pipelineValue)||0),icon:dc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((t==null?void 0:t.expectedCommission)||0),icon:fd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(t==null?void 0:t.wonDeals)||0,icon:Zi,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(a=>r.jsx(Ye,{className:"animate-pulse",children:r.jsx(Je,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},a))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(a=>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",a.bgColor),children:r.jsx(a.icon,{className:zt("h-5 w-5",a.color)})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:a.label}),r.jsx("p",{className:"text-xl font-bold",children:a.value})]})]})})},a.label))})}const TWt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],AWt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function EWt({open:t,onOpenChange:e,deal:n,defaultStageId:s}){const{data:a}=T0e(),{data:o}=dp(),{data:l}=v8e(),i=T$e(),h=A$e(),[p,x]=I.useState(""),[y,_]=I.useState(!1),j=(l==null?void 0:l.filter(z=>((n==null?void 0:n.listing_id)===z.id,!0)))||[],[C,N]=I.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,listing_date:void 0,priority:"medium",probability:"50",notes:""});I.useEffect(()=>{var z,F,q;t&&(n?(N({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:((z=n.expected_price)==null?void 0:z.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,listing_date:n.listing_date?new Date(n.listing_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(N({deal_name:"",deal_type:"buyer",stage_id:s||((q=a==null?void 0:a[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,listing_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[t,n,s,a]);const A=o==null?void 0:o.filter(z=>{var q,V,K;const F=p.toLowerCase();return((q=z.first_name)==null?void 0:q.toLowerCase().includes(F))||((V=z.last_name)==null?void 0:V.toLowerCase().includes(F))||((K=z.email)==null?void 0:K.toLowerCase().includes(F))}).slice(0,5),E=()=>{const z=parseFloat(C.expected_price)||0,F=parseFloat(C.commission_percentage)||0;return z*(F/100)},T=async z=>{var F,q,V;if(z.preventDefault(),!C.deal_name.trim()){ze.error("Please enter a deal name");return}try{const K={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:E()||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,listing_date:((V=C.listing_date)==null?void 0:V.toISOString().split("T")[0])||null,priority:C.priority,probability:parseInt(C.probability)||50,notes:C.notes||null};n?(await h.mutateAsync({id:n.id,...K}),ze.success("Deal updated successfully")):(await i.mutateAsync(K),ze.success("Deal created successfully")),e(!1)}catch{ze.error("Failed to save deal")}},P=i.isPending||h.isPending;return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(Qn,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:T,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(He,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(dt,{id:"deal_name",value:C.deal_name,onChange:z=>N(F=>({...F,deal_name:z.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Deal Type"}),r.jsxs(gn,{value:C.deal_type,onValueChange:z=>N(F=>({...F,deal_type:z})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:TWt.map(z=>r.jsx(qt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Stage"}),r.jsxs(gn,{value:C.stage_id,onValueChange:z=>N(F=>({...F,stage_id:z})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select stage"})}),r.jsx(pn,{children:a==null?void 0:a.map(z=>r.jsx(qt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:z.color}}),z.name]})},z.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:p,onChange:z=>{x(z.target.value),_(!0),z.target.value||N(F=>({...F,contact_id:""}))},onFocus:()=>_(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&p&&A&&A.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:A.map(z=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{N(F=>({...F,contact_id:z.id})),x(`${z.first_name} ${z.last_name}`),_(!1)},children:[r.jsx(Ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[z.first_name," ",z.last_name]}),z.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:z.email})]},z.id))})]})]}),j.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(rf,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(gn,{value:C.listing_id,onValueChange:z=>{const F=j.find(q=>q.id===z);N(F?q=>{var V;return{...q,listing_id:z,deal_type:"seller",property_address:F.property_address||q.property_address,city:F.city||q.city,state:F.state||q.state,expected_price:((V=F.price)==null?void 0:V.toString())||q.expected_price}}:q=>({...q,listing_id:z}))},children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"",children:"None"}),j.map(z=>r.jsx(qt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:z.property_address||`${z.city}, ${z.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(z.price/1e3).toFixed(0),"K"]})]})},z.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(He,{htmlFor:"property_address",children:"Address"}),r.jsx(dt,{id:"property_address",value:C.property_address,onChange:z=>N(F=>({...F,property_address:z.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:C.city,onChange:z=>N(F=>({...F,city:z.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:C.state,onChange:z=>N(F=>({...F,state:z.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(dt,{id:"zip_code",value:C.zip_code,onChange:z=>N(F=>({...F,zip_code:z.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(He,{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(dt,{id:"expected_price",type:"number",value:C.expected_price,onChange:z=>N(F=>({...F,expected_price:z.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{id:"commission_percentage",type:"number",step:"0.1",value:C.commission_percentage,onChange:z=>N(F=>({...F,commission_percentage:z.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(He,{children:"Expected GCI"}),r.jsx(dt,{value:E()?`$${E().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(He,{children:"Target Close Date"}),r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!C.target_close_date&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),C.target_close_date?xn(C.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:C.target_close_date,onSelect:z=>N(F=>({...F,target_close_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Contract Date"}),r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!C.contract_date&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),C.contract_date?xn(C.contract_date,"PPP"):"Pick a date"]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:C.contract_date,onSelect:z=>N(F=>({...F,contract_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),(C.deal_type==="seller"||C.deal_type==="dual")&&!C.listing_id&&r.jsxs("div",{className:"space-y-2 col-span-2",children:[r.jsx(He,{children:"Listing Date (for Days on Market)"}),r.jsxs(hu,{children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!C.listing_date&&"text-muted-foreground"),children:[r.jsx(Os,{className:"mr-2 h-4 w-4"}),C.listing_date?xn(C.listing_date,"PPP"):"Pick a date"]})}),r.jsx(Bd,{className:"w-auto p-0",align:"start",children:r.jsx(Yx,{mode:"single",selected:C.listing_date,onSelect:z=>N(F=>({...F,listing_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to calculate Days on Market. Auto-filled for linked listings."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Priority"}),r.jsxs(gn,{value:C.priority,onValueChange:z=>N(F=>({...F,priority:z})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:AWt.map(z=>r.jsx(qt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{type:"number",min:"0",max:"100",value:C.probability,onChange:z=>N(F=>({...F,probability:z.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(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:C.notes,onChange:z=>N(F=>({...F,notes:z.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(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:P,children:[P&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const IWt={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"}},PWt={note:Oo,call:bi,email:ua,meeting:Os,stage_change:Ls,task_completed:Xi,document:da,system:Ya};function LWt({deal:t,open:e,onOpenChange:n,onEdit:s,onAddToScorecard:a,isWonStage:o}){var ye,ae;const{data:l,isLoading:i}=eWt((t==null?void 0:t.id)||""),{data:h,isLoading:p}=rWt((t==null?void 0:t.id)||""),x=tWt(),y=sWt(),_=nWt(),j=JHt(),[C,N]=I.useState(""),[A,E]=I.useState(""),[T,P]=I.useState(!1);if(!t)return null;const z=IWt[t.deal_type],F=(()=>{var he;if(t.deal_type!=="seller"&&t.deal_type!=="dual")return null;const pe=((he=t.listing)==null?void 0:he.created_at)||t.listing_date;if(!pe)return null;const se=t.contract_date?new Date(t.contract_date):new Date;return dy(se,new Date(pe))})(),q=pe=>pe?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(pe):"-",V=async()=>{if(C.trim())try{await x.mutateAsync({deal_id:t.id,activity_type:"note",title:"Note added",description:C}),N(""),ze.success("Note added")}catch{ze.error("Failed to add note")}},K=async()=>{if(A.trim())try{await y.mutateAsync({deal_id:t.id,title:A,sort_order:((h==null?void 0:h.length)||0)+1}),E(""),ze.success("Task added")}catch{ze.error("Failed to add task")}},G=async(pe,se)=>{try{await _.mutateAsync({id:pe,is_completed:se,deal_id:t.id})}catch{ze.error("Failed to update task")}},te=async()=>{try{await j.mutateAsync(t.id),ze.success("Deal deleted"),n(!1)}catch{ze.error("Failed to delete deal")}},ie=(h==null?void 0:h.filter(pe=>pe.is_completed).length)||0,oe=(h==null?void 0:h.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(Jne,{open:e,onOpenChange:n,children:r.jsxs(SI,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(ese,{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(Ot,{variant:"outline",className:zt("text-xs",z.color),children:z.label}),r.jsxs(Ot,{variant:"secondary",className:"text-xs capitalize",children:[t.priority," priority"]})]}),r.jsx(tse,{className:"text-xl",children:t.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>s(t),children:r.jsx(ic,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>P(!0),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})}),r.jsx(tl,{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(Ks,{className:"h-10 w-10",children:r.jsxs(Zs,{className:"bg-primary/10 text-primary",children:[(ye=t.contact.first_name)==null?void 0:ye[0],(ae=t.contact.last_name)==null?void 0:ae[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(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${t.contact.phone}`,children:r.jsx(bi,{className:"h-4 w-4"})})}),t.contact.email&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${t.contact.email}`,children:r.jsx(ua,{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(da,{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:q(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:q(t.expected_commission)})]}),o&&!t.scorecard_transaction_id&&a&&r.jsxs(ee,{onClick:()=>a(t),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(Zi,{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(Xi,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),F!==null&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 col-span-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Days on Market"}),r.jsxs("p",{className:zt("text-lg font-bold",F>90?"text-red-600":F>60?"text-amber-600":"text-foreground"),children:[F," ",t.contract_date?"(final)":"days"]})]}),t.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Os,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",xn(new Date(t.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(fd,{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(Ii,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(wi,{className:"w-full grid grid-cols-2",children:[r.jsxs(nn,{value:"tasks",className:"gap-1",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Tasks ",oe>0&&`(${ie}/${oe})`]}),r.jsxs(nn,{value:"activity",className:"gap-1",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(Sn,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add a new task...",value:A,onChange:pe=>E(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&K()}),r.jsx(ee,{onClick:K,disabled:!A.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[h==null?void 0:h.map(pe=>r.jsxs("div",{className:zt("flex items-center gap-3 p-3 rounded-lg border transition-colors",pe.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(Dl,{checked:pe.is_completed,onCheckedChange:se=>G(pe.id,!!se)}),r.jsx("span",{className:zt("flex-1 text-sm",pe.is_completed&&"line-through text-muted-foreground"),children:pe.title}),pe.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(pe.due_date),"MMM d")})]},pe.id)),(h==null?void 0:h.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(Sn,{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:pe=>N(pe.target.value),rows:2}),r.jsxs(ee,{onClick:V,disabled:!C.trim(),size:"sm",className:"w-full",children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(pe=>{const se=PWt[pe.activity_type]||Ya;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(se,{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:pe.title}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:pe.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:uu(new Date(pe.created_at),{addSuffix:!0})})]})]},pe.id)}),(l==null?void 0:l.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),r.jsx(Ou,{open:T,onOpenChange:P,children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Delete Deal?"}),r.jsxs(ou,{children:['This will permanently delete "',t.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function OWt({open:t,onOpenChange:e,deal:n,onComplete:s}){const a=_se(),o=A$e(),{data:l}=vse(),{data:i}=Mm(),[h,p]=I.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:xn(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});I.useEffect(()=>{if(n&&t){const _=n.deal_type==="seller"?"seller":"buyer",j=n.expected_price||0,C=n.commission_percentage||3,N=n.expected_commission||j*C/100;p({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:_,close_date:n.actual_close_date||n.target_close_date||xn(new Date,"yyyy-MM-dd"),sale_price:j,commission_amount:N,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,t]);const x=async _=>{if(_.preventDefault(),!!n)try{const j=await a.mutateAsync({property_address:h.property_address,city:h.city||null,state:h.state||null,zip:h.zip||null,transaction_type:h.transaction_type,close_date:h.close_date,sale_price:h.sale_price,commission_amount:h.commission_amount||null,lead_source_id:h.lead_source_id||null,client_type_id:h.client_type_id||null,contact_id:n.contact_id||null,notes:h.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:j.id,actual_close_date:h.close_date}),ze.success("Deal added to Scorecard! 🎉"),e(!1),s==null||s()}catch(j){console.error("Error syncing to scorecard:",j),ze.error("Failed to add to scorecard")}},y=_=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(_);return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{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(Zi,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx($r,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Qn,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),r.jsxs("form",{onSubmit:x,className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(dt,{id:"property_address",value:h.property_address,onChange:_=>p(j=>({...j,property_address:_.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(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:h.city,onChange:_=>p(j=>({...j,city:_.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:h.state,onChange:_=>p(j=>({...j,state:_.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zip",children:"Zip"}),r.jsx(dt,{id:"zip",value:h.zip,onChange:_=>p(j=>({...j,zip:_.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(He,{children:"Transaction Type *"}),r.jsxs(gn,{value:h.transaction_type,onValueChange:_=>p(j=>({...j,transaction_type:_})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(dt,{id:"close_date",type:"date",value:h.close_date,onChange:_=>p(j=>({...j,close_date:_.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(He,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(dt,{id:"sale_price",type:"number",value:h.sale_price||"",onChange:_=>p(j=>({...j,sale_price:Number(_.target.value)})),placeholder:"450000",required:!0,min:0}),h.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(fS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(dt,{id:"commission_amount",type:"number",value:h.commission_amount||"",onChange:_=>p(j=>({...j,commission_amount:Number(_.target.value)})),placeholder:"13500",min:0}),h.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Lead Source"}),r.jsxs(gn,{value:h.lead_source_id,onValueChange:_=>p(j=>({...j,lead_source_id:_})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select source"})}),r.jsx(pn,{children:l==null?void 0:l.map(_=>r.jsx(qt,{value:_.id,children:_.name},_.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Client Type"}),r.jsxs(gn,{value:h.client_type_id,onValueChange:_=>p(j=>({...j,client_type_id:_})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select type"})}),r.jsx(pn,{children:i==null?void 0:i.map(_=>r.jsx(qt,{value:_.id,children:_.name},_.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:h.notes,onChange:_=>p(j=>({...j,notes:_.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(ea,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Skip for now"}),r.jsx(ee,{type:"submit",disabled:a.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:a.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(hl,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const DWt={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"}},x5e={urgent:0,high:1,medium:2,low:3};function RWt({deals:t,stages:e,onDealClick:n,onStageChange:s}){const[a,o]=I.useState("target_close_date"),[l,i]=I.useState("asc"),h=j=>{a===j?i(C=>C==="asc"?"desc":"asc"):(o(j),i("asc"))},p=I.useMemo(()=>[...t].sort((j,C)=>{var A,E;let N=0;switch(a){case"deal_name":N=j.deal_name.localeCompare(C.deal_name);break;case"stage":{const T=((A=e.find(z=>z.id===j.stage_id))==null?void 0:A.sort_order)||0,P=((E=e.find(z=>z.id===C.stage_id))==null?void 0:E.sort_order)||0;N=T-P;break}case"expected_price":N=(j.expected_price||0)-(C.expected_price||0);break;case"expected_commission":N=(j.expected_commission||0)-(C.expected_commission||0);break;case"target_close_date":{const T=j.target_close_date?new Date(j.target_close_date).getTime():1/0,P=C.target_close_date?new Date(C.target_close_date).getTime():1/0;N=T-P;break}case"priority":N=x5e[j.priority]-x5e[C.priority];break}return l==="asc"?N:-N}),[t,e,a,l]),x=j=>j?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(j):"—",y=j=>j?e.find(C=>C.id===j):null,_=({field:j,children:C})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>h(j),children:[C,a===j?l==="asc"?r.jsx(Zf,{className:"ml-2 h-4 w-4"}):r.jsx($x,{className:"ml-2 h-4 w-4"}):r.jsx(xg,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[250px]",children:r.jsx(_,{field:"deal_name",children:"Deal Name"})}),r.jsx(It,{className:"w-[150px]",children:r.jsx(_,{field:"stage",children:"Stage"})}),r.jsx(It,{className:"w-[100px]",children:"Type"}),r.jsx(It,{className:"w-[120px]",children:r.jsx(_,{field:"expected_price",children:"Price"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(_,{field:"expected_commission",children:"GCI"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(_,{field:"target_close_date",children:"Close Date"})}),r.jsx(It,{className:"w-[100px]",children:r.jsx(_,{field:"priority",children:"Priority"})})]})}),r.jsx(Vs,{children:p.map(j=>{y(j.stage_id);const C=DWt[j.deal_type],N=j.target_close_date?dy(new Date(j.target_close_date),new Date):null,A=N!==null&&N<0,E=N!==null&&N<=7&&N>=0;return r.jsxs(Ar,{className:zt("cursor-pointer hover:bg-muted/50 transition-colors",A&&"bg-red-50/50"),onClick:()=>n(j),children:[r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:j.deal_name}),j.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[j.contact.first_name," ",j.contact.last_name]})]})}),r.jsx(Nt,{onClick:T=>T.stopPropagation(),children:r.jsx(I$e,{stages:e,currentStageId:j.stage_id||"",onStageSelect:(T,P)=>s(j.id,T,P)})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",className:zt("text-xs",C.color),children:C.label})}),r.jsx(Nt,{children:r.jsx("span",{className:"font-medium",children:x(j.expected_price)})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-emerald-600",children:x(j.expected_commission)})}),r.jsx(Nt,{children:j.target_close_date?r.jsxs("div",{className:zt("flex items-center gap-1 text-sm",A&&"text-red-600",E&&!A&&"text-amber-600"),children:[A&&r.jsx(fl,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:xn(new Date(j.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",className:zt("text-xs capitalize",j.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",j.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",j.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",j.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:j.priority})})]},j.id)})})]})})}function FWt(){var Se;const t=m3(),{data:e,isLoading:n}=T0e(),{data:s,isLoading:a,refetch:o}=M$e(),{data:l,isLoading:i}=aWt(),h=C$e(),p=QHt(),[x,y]=I.useState("board"),[_,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(null),[T,P]=I.useState(null),[z,F]=I.useState(null),[q,V]=I.useState(null),[K,G]=I.useState(!1),[te,ie]=I.useState(null);I.useEffect(()=>{!n&&e&&e.length===0&&h.mutate()},[n,e]);const oe=ge=>{E(ge),N(!0)},ye=ge=>{P(ge||null),E(null),j(!0)},ae=ge=>{E(ge),N(!1),j(!0)},pe=(ge,Le)=>{F(ge)},se=(ge,Le)=>{ge.preventDefault(),ge.dataTransfer.dropEffect="move",V(Le)},he=async(ge,Le)=>{if(ge.preventDefault(),V(null),!z)return;const ke=s==null?void 0:s.find(Ee=>Ee.id===z),Be=e==null?void 0:e.find(Ee=>Ee.id===Le);if(!ke||!Be||ke.stage_id===Le){F(null);return}try{if(await p.mutateAsync({dealId:z,stageId:Le,stageName:Be.name}),ze.success(`Moved to ${Be.name}`),Be.is_won_stage&&!ke.scorecard_transaction_id){const Ee={...ke,stage_id:Le};ie(Ee),G(!0)}}catch{ze.error("Failed to move deal")}F(null)},ue=I.useCallback(async(ge,Le,ke)=>{const Be=s==null?void 0:s.find(Ue=>Ue.id===ge),Ee=e==null?void 0:e.find(Ue=>Ue.id===Le);if(!(!Be||!Ee||Be.stage_id===Le))try{if(await p.mutateAsync({dealId:ge,stageId:Le,stageName:ke}),ze.success(`Moved to ${ke}`),Ee.is_won_stage&&!Be.scorecard_transaction_id){const Ue={...Be,stage_id:Le};ie(Ue),G(!0)}}catch{ze.error("Failed to move deal")}},[s,e,p]),_e=ge=>(s==null?void 0:s.filter(Le=>Le.stage_id===ge))||[],Ae=n||a,Ce=t?"list":x;return r.jsxs(Lr,{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(ee,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Gl,{className:"h-4 w-4"})}),!t&&r.jsx(gI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:r.jsxs(ee,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[r.jsx(Yf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(vm,{children:"Kanban board view"})]}),r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:r.jsxs(ee,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(Xf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(vm,{children:"Grouped list view"})]}),r.jsxs(Mg,{children:[r.jsx(Tg,{asChild:!0,children:r.jsxs(ee,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(gS,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(vm,{children:"Sortable table view"})]})]})}),r.jsxs(ee,{onClick:()=>ye(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(MWt,{stats:l||null,isLoading:i})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ae?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(ge=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Ir,{className:"h-full rounded-xl"})},ge))}):Ce==="board"?r.jsxs(tl,{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(ge=>r.jsx(CWt,{stage:ge,deals:_e(ge.id),onDealClick:oe,onAddDeal:ye,onDragStart:pe,onDragOver:se,onDrop:he,isDragOver:q===ge.id,isWonStage:ge.is_won_stage},ge.id))}),r.jsx(Uge,{orientation:"horizontal"})]}):Ce==="table"?r.jsx(tl,{className:"h-full",children:r.jsx(RWt,{deals:s||[],stages:e||[],onDealClick:oe,onStageChange:ue})}):r.jsx(tl,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[e==null?void 0:e.map(ge=>{const Le=_e(ge.id);return Le.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:ge.color}}),r.jsx("h3",{className:"font-semibold",children:ge.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",Le.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Le.map(ke=>r.jsx(P$e,{deal:ke,onClick:()=>oe(ke),stages:e,onStageChange:ue,showStagePicker:!0,isWonStage:ge.is_won_stage},ke.id))})]},ge.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(Yf,{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(ee,{onClick:()=>ye(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(EWt,{open:_,onOpenChange:j,deal:A,defaultStageId:T}),r.jsx(LWt,{deal:A,open:C,onOpenChange:N,onEdit:ae,isWonStage:A?(Se=e==null?void 0:e.find(ge=>ge.id===A.stage_id))==null?void 0:Se.is_won_stage:!1,onAddToScorecard:ge=>{ie(ge),G(!0),N(!1)}}),r.jsx(OWt,{open:K,onOpenChange:G,deal:te,onComplete:()=>{o(),ie(null)}})]})}const Ope=[{value:"video_intro",label:"Video Intro",icon:Pa,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:BT,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:Ng,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:rf,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:pc,description:"Links to your social profiles"}],zWt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],BWt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function L$e({cardId:t}){const{data:e,isLoading:n}=Uit(t),s=qit(),a=Vit(),o=Hit(),[l,i]=I.useState(!1),[h,p]=I.useState(""),[x,y]=I.useState(null);if(n)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ir,{className:"h-16 w-full"}),r.jsx(Ir,{className:"h-16 w-full"})]});const _=()=>{h&&s.mutate({card_id:t,block_type:h,sort_order:(e==null?void 0:e.length)||0,config:BWt[h]||{}},{onSuccess:()=>{i(!1),p("")}})},j=T=>{a.mutate({id:T.id,is_visible:!T.is_visible})},C=(T,P)=>{if(!e)return;const z=e.findIndex(V=>V.id===T.id),F=P==="up"?z-1:z+1;if(F<0||F>=e.length)return;const q=e[F];a.mutate({id:T.id,sort_order:q.sort_order}),a.mutate({id:q.id,sort_order:T.sort_order})},N=T=>{confirm("Remove this block from this card?")&&o.mutate(T.id)},A=(T,P)=>{a.mutate({id:T.id,config:P},{onSuccess:()=>y(null)})},E=T=>Ope.find(P=>P.value===T);return r.jsxs("div",{className:"space-y-3",children:[!e||e.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"No blocks yet. Add a block to customize this card."}),r.jsxs(ee,{size:"sm",onClick:()=>i(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[e.map((T,P)=>{const z=E(T.block_type),F=(z==null?void 0:z.icon)||Ng;return r.jsx(Ye,{className:T.is_visible?"":"opacity-50",children:r.jsx(Je,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(b1,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(F,{className:"h-4 w-4 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-xs",children:(z==null?void 0:z.label)||T.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$Wt(T)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>C(T,"up"),disabled:P===0,children:r.jsx(Zf,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>C(T,"down"),disabled:P===e.length-1,children:r.jsx($x,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(T),children:T.is_visible?r.jsx(el,{className:"h-3 w-3"}):r.jsx(g1,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(T),children:"Edit"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>N(T),children:r.jsx(Vn,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:Ope.map(T=>{const P=T.icon;return r.jsxs("button",{onClick:()=>p(T.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${h===T.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[r.jsx(P,{className:"h-5 w-5 text-primary flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:T.description})]})]},T.value)})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:_,disabled:!h||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(UWt,{block:x,onSave:T=>A(x,T),onClose:()=>y(null)})]})}function $Wt(t){var n;const e=t.config;switch(t.block_type){case"video_intro":return e.video_url?"Video configured":"No video set";case"testimonials":{const s=((n=e.testimonials)==null?void 0:n.length)||0;return`${s} testimonial${s!==1?"s":""}`}case"specialties":{const s=e.tags||[];return s.length?s.slice(0,3).join(", ")+(s.length>3?"...":""):"No tags"}case"custom_links":{const s=e.links||[];return`${s.length} link${s.length!==1?"s":""}`}case"social_media":{const s=e.platforms||[];return s.length?s.map(a=>a.platform).join(", "):"No platforms"}default:return""}}function UWt({block:t,onSave:e,onClose:n}){const[s,a]=I.useState(t.config),o=Ope.find(l=>l.value===t.block_type);return r.jsx(Fr,{open:!0,onOpenChange:n,children:r.jsxs(Rr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Edit ",o==null?void 0:o.label]})}),t.block_type==="video_intro"&&r.jsx(qWt,{config:s,onChange:a,cardId:t.card_id}),t.block_type==="testimonials"&&r.jsx(VWt,{config:s,onChange:a}),t.block_type==="specialties"&&r.jsx(HWt,{config:s,onChange:a}),t.block_type==="custom_links"&&r.jsx(WWt,{config:s,onChange:a}),t.block_type==="social_media"&&r.jsx(GWt,{config:s,onChange:a}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(ee,{onClick:()=>e(s),children:"Save"})]})]})})}function qWt({config:t,onChange:e,cardId:n}){var j,C;const[s,a]=I.useState(""),[o,l]=I.useState((j=t.video_url)!=null&&j.includes("youtube")||(C=t.video_url)!=null&&C.includes("youtu.be")?"youtube":"library"),{data:i}=Yt({queryKey:["card-owner",n],queryFn:async()=>{const{data:N}=await J.from("agent_cards").select("user_id").eq("id",n).single();return N==null?void 0:N.user_id},enabled:!!n}),{data:h,isLoading:p}=Yt({queryKey:["agent-videos-library",i],queryFn:async()=>{const{data:N,error:A}=await J.from("agent_videos").select("id, title, bunny_video_id, thumbnail_url, playback_url, created_at").eq("owner_user_id",i).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(A)throw A;return N||[]},enabled:!!i}),x=(h==null?void 0:h.filter(N=>!s||(N.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=t.bunny_video_id,_=N=>{var P;const A=(P=N.playback_url)==null?void 0:P.match(/\/(?:play|embed)\/(\d+)\//),T=`https://iframe.mediadelivery.net/embed/${A?A[1]:"570924"}/${N.bunny_video_id}?autoplay=false&responsive=true`;e({...t,video_url:T,bunny_video_id:N.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(Ii,{value:o,onValueChange:l,children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(nn,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(nn,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(Sn,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search videos...",value:s,onChange:N=>a(N.target.value),className:"pl-9"})]}),r.jsx(tl,{className:"h-[240px]",children:p?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ir,{className:"h-14 w-full"}),r.jsx(Ir,{className:"h-14 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(h==null?void 0:h.length)===0?"No videos in library yet":"No matching videos"}):r.jsx("div",{className:"space-y-1.5 pr-3",children:x.map(N=>r.jsxs("button",{onClick:()=>_(N),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===N.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[N.thumbnail_url?r.jsx("img",{src:N.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:A=>{var E;A.currentTarget.style.display="none",(E=A.currentTarget.nextElementSibling)==null||E.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${N.thumbnail_url?"hidden":""}`,children:r.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate flex-1",children:N.title||"Untitled Video"}),y===N.bunny_video_id&&r.jsx(Ai,{className:"h-4 w-4 text-primary flex-shrink-0"})]},N.id))})})]}),r.jsx(Sn,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx(He,{children:"YouTube URL"}),r.jsx(dt,{placeholder:"https://www.youtube.com/watch?v=...",value:t.video_source==="youtube"&&t.video_url||"",onChange:N=>e({...t,video_url:N.target.value,bunny_video_id:null,video_source:"youtube"})}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Paste a YouTube video link"})]})})]})})}function VWt({config:t,onChange:e}){const n=t.testimonials||[],s=(l,i,h)=>{const p=[...n];p[l]={...p[l],[i]:h},e({...t,testimonials:p})},a=()=>e({...t,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>e({...t,testimonials:n.filter((i,h)=>h!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,i)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"text-xs font-medium",children:["Testimonial ",i+1]}),n.length>1&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:r.jsx(Vn,{className:"h-3 w-3"})})]}),r.jsx(dt,{placeholder:"Client name",value:l.name,onChange:h=>s(i,"name",h.target.value)}),r.jsx(dt,{placeholder:"Role/title (optional)",value:l.role||"",onChange:h=>s(i,"role",h.target.value)}),r.jsx("textarea",{className:"w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Their testimonial quote...",value:l.quote,onChange:h=>s(i,"quote",h.target.value)})]})},i)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function HWt({config:t,onChange:e}){const n=t.tags||[],[s,a]=I.useState(""),o=i=>{e({...t,tags:n.includes(i)?n.filter(h=>h!==i):[...n,i]})},l=()=>{s.trim()&&!n.includes(s.trim())&&(e({...t,tags:[...n,s.trim()]}),a(""))};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:zWt.map(i=>r.jsx("button",{onClick:()=>o(i),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${n.includes(i)?"bg-primary text-primary-foreground border-primary":"bg-muted border-border hover:bg-muted/80"}`,children:i},i))})]}),r.jsxs("div",{children:[r.jsx(He,{className:"text-sm mb-2 block",children:"Custom Tag"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add your own...",value:s,onChange:i=>a(i.target.value),onKeyDown:i=>i.key==="Enter"&&(i.preventDefault(),l())}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsxs(He,{className:"text-xs text-muted-foreground mb-1 block",children:["Selected (",n.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(i=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:[i,r.jsx("button",{onClick:()=>o(i),className:"hover:text-destructive",children:"×"})]},i))})]})]})}function WWt({config:t,onChange:e}){const n=t.links||[],s=(l,i,h)=>{const p=[...n];p[l]={...p[l],[i]:h},e({...t,links:p})},a=()=>e({...t,links:[...n,{label:"",url:""}]}),o=l=>e({...t,links:n.filter((i,h)=>h!==l)});return r.jsxs("div",{className:"space-y-3",children:[n.map((l,i)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(dt,{placeholder:"Button label",value:l.label,onChange:h=>s(i,"label",h.target.value)}),r.jsx(dt,{placeholder:"https://...",value:l.url,onChange:h=>s(i,"url",h.target.value)})]}),n.length>1&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:r.jsx(Vn,{className:"h-3 w-3"})})]},i)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const y5e=[{value:"instagram",label:"Instagram"},{value:"facebook",label:"Facebook"},{value:"linkedin",label:"LinkedIn"},{value:"twitter",label:"X (Twitter)"},{value:"youtube",label:"YouTube"},{value:"tiktok",label:"TikTok"},{value:"zillow",label:"Zillow"},{value:"realtor",label:"Realtor.com"}];function GWt({config:t,onChange:e}){const n=t.platforms||[],s=h=>{n.find(p=>p.platform===h)||e({...t,platforms:[...n,{platform:h,url:""}]})},a=(h,p)=>{const x=[...n];x[h]={...x[h],url:p},e({...t,platforms:x})},o=h=>{e({...t,platforms:n.filter((p,x)=>x!==h)})},l=y5e.filter(h=>!n.find(p=>p.platform===h.value)),i=h=>{const p=ihe[h],x=y5e.find(y=>y.value===h);return{label:(x==null?void 0:x.label)||h,color:(p==null?void 0:p.color)||"#666",iconPath:p==null?void 0:p.icon}};return r.jsxs("div",{className:"space-y-4",children:[n.length>0&&r.jsx("div",{className:"space-y-3",children:n.map((h,p)=>{const x=i(h.platform);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-9 w-9 rounded-lg flex items-center justify-center flex-shrink-0 border",style:{borderColor:x.color+"30",backgroundColor:x.color+"10"},children:x.iconPath&&r.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:x.color,children:r.jsx("path",{d:x.iconPath})})}),r.jsx("div",{className:"flex-1",children:r.jsx(dt,{placeholder:`Your ${x.label} profile URL`,value:h.url,onChange:y=>a(p,y.target.value)})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(p),children:r.jsx(Vn,{className:"h-3.5 w-3.5"})})]},p)})}),l.length>0&&r.jsxs("div",{children:[r.jsx(He,{className:"text-xs text-muted-foreground mb-2 block",children:"Add a platform"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(h=>{const p=ihe[h.value];return r.jsxs("button",{onClick:()=>s(h.value),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-full border border-border bg-muted hover:bg-muted/80 transition-colors",children:[(p==null?void 0:p.icon)&&r.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:p.color,children:r.jsx("path",{d:p.icon})}),h.label]},h.value)})})]}),n.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Tap a platform above to add your social media profile."})]})}var KWt=Object.defineProperty,one=Object.getOwnPropertySymbols,O$e=Object.prototype.hasOwnProperty,D$e=Object.prototype.propertyIsEnumerable,v5e=(t,e,n)=>e in t?KWt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dpe=(t,e)=>{for(var n in e||(e={}))O$e.call(e,n)&&v5e(t,n,e[n]);if(one)for(var n of one(e))D$e.call(e,n)&&v5e(t,n,e[n]);return t},Rpe=(t,e)=>{var n={};for(var s in t)O$e.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&one)for(var s of one(t))e.indexOf(s)<0&&D$e.call(t,s)&&(n[s]=t[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var nk;(t=>{const e=class Mi{constructor(h,p,x,y){if(this.version=h,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],hMi.MAX_VERSION)throw new RangeError("Version value out of range");if(y<-1||y>7)throw new RangeError("Mask value out of range");this.size=h*4+17;let _=[];for(let C=0;C7)throw new RangeError("Invalid value");let C,N;for(C=x;;C++){const P=Mi.getNumDataCodewords(C,p)*8,z=l.getTotalBits(h,C);if(z<=P){N=z;break}if(C>=y)throw new RangeError("Data too long")}for(const P of[Mi.Ecc.MEDIUM,Mi.Ecc.QUARTILE,Mi.Ecc.HIGH])j&&N<=Mi.getNumDataCodewords(C,P)*8&&(p=P);let A=[];for(const P of h){n(P.mode.modeBits,4,A),n(P.numChars,P.mode.numCharCountBits(C),A);for(const z of P.getData())A.push(z)}a(A.length==N);const E=Mi.getNumDataCodewords(C,p)*8;a(A.length<=E),n(0,Math.min(4,E-A.length),A),n(0,(8-A.length%8)%8,A),a(A.length%8==0);for(let P=236;A.lengthT[z>>>3]|=P<<7-(z&7)),new Mi(C,p,T,_)}getModule(h,p){return 0<=h&&h>>9)*1335;const y=(p<<10|x)^21522;a(y>>>15==0);for(let _=0;_<=5;_++)this.setFunctionModule(8,_,s(y,_));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(let _=9;_<15;_++)this.setFunctionModule(14-_,8,s(y,_));for(let _=0;_<8;_++)this.setFunctionModule(this.size-1-_,8,s(y,_));for(let _=8;_<15;_++)this.setFunctionModule(8,this.size-15+_,s(y,_));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let h=this.version;for(let x=0;x<12;x++)h=h<<1^(h>>>11)*7973;const p=this.version<<12|h;a(p>>>18==0);for(let x=0;x<18;x++){const y=s(p,x),_=this.size-11+x%3,j=Math.floor(x/3);this.setFunctionModule(_,j,y),this.setFunctionModule(j,_,y)}}drawFinderPattern(h,p){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const _=Math.max(Math.abs(y),Math.abs(x)),j=h+y,C=p+x;0<=j&&j{(P!=N-_||F>=C)&&T.push(z[P])});return a(T.length==j),T}drawCodewords(h){if(h.length!=Math.floor(Mi.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(let y=0;y>>3],7-(p&7)),p++)}}a(p==h.length*8)}applyMask(h){if(h<0||h>7)throw new RangeError("Mask value out of range");for(let p=0;p5&&h++):(this.finderPenaltyAddHistory(C,N),j||(h+=this.finderPenaltyCountPatterns(N)*Mi.PENALTY_N3),j=this.modules[_][A],C=1);h+=this.finderPenaltyTerminateAndCount(j,C,N)*Mi.PENALTY_N3}for(let _=0;_5&&h++):(this.finderPenaltyAddHistory(C,N),j||(h+=this.finderPenaltyCountPatterns(N)*Mi.PENALTY_N3),j=this.modules[A][_],C=1);h+=this.finderPenaltyTerminateAndCount(j,C,N)*Mi.PENALTY_N3}for(let _=0;_j+(C?1:0),p);const x=this.size*this.size,y=Math.ceil(Math.abs(p*20-x*10)/x)-1;return a(0<=y&&y<=9),h+=y*Mi.PENALTY_N4,a(0<=h&&h<=2568888),h}getAlignmentPatternPositions(){if(this.version==1)return[];{const h=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(h*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthMi.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*h+128)*h+64;if(h>=2){const x=Math.floor(h/7)+2;p-=(25*x-10)*x-55,h>=7&&(p-=36)}return a(208<=p&&p<=29648),p}static getNumDataCodewords(h,p){return Math.floor(Mi.getNumRawDataModules(h)/8)-Mi.ECC_CODEWORDS_PER_BLOCK[p.ordinal][h]*Mi.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][h]}static reedSolomonComputeDivisor(h){if(h<1||h>255)throw new RangeError("Degree out of range");let p=[];for(let y=0;y0);for(const y of h){const _=y^x.shift();x.push(0),p.forEach((j,C)=>x[C]^=Mi.reedSolomonMultiply(j,_))}return x}static reedSolomonMultiply(h,p){if(h>>>8||p>>>8)throw new RangeError("Byte out of range");let x=0;for(let y=7;y>=0;y--)x=x<<1^(x>>>7)*285,x^=(p>>>y&1)*h;return a(x>>>8==0),x}finderPenaltyCountPatterns(h){const p=h[1];a(p<=this.size*3);const x=p>0&&h[2]==p&&h[3]==p*3&&h[4]==p&&h[5]==p;return(x&&h[0]>=p*4&&h[6]>=p?1:0)+(x&&h[6]>=p*4&&h[0]>=p?1:0)}finderPenaltyTerminateAndCount(h,p,x){return h&&(this.finderPenaltyAddHistory(p,x),p=0),p+=this.size,this.finderPenaltyAddHistory(p,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(h,p){p[0]==0&&(h+=this.size),p.pop(),p.unshift(h)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=e;function n(i,h,p){if(h<0||h>31||i>>>h)throw new RangeError("Value out of range");for(let x=h-1;x>=0;x--)p.push(i>>>x&1)}function s(i,h){return(i>>>h&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class Vl{constructor(h,p,x){if(this.mode=h,this.numChars=p,this.bitData=x,p<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(h){let p=[];for(const x of h)n(x,8,p);return new Vl(Vl.Mode.BYTE,h.length,p)}static makeNumeric(h){if(!Vl.isNumeric(h))throw new RangeError("String contains non-numeric characters");let p=[];for(let x=0;x=1<<_)return 1/0;x+=4+_+y.bitData.length}return x}static toUtf8ByteArray(h){h=encodeURI(h);let p=[];for(let x=0;x{(e=>{const n=class{constructor(a,o){this.ordinal=a,this.formatBits=o}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),e.Ecc=n})(t.QrCode||(t.QrCode={}))})(nk||(nk={}));(t=>{(e=>{const n=class{constructor(a,o){this.modeBits=a,this.numBitsCharCount=o}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),e.Mode=n})(t.QrSegment||(t.QrSegment={}))})(nk||(nk={}));var V4=nk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var ZWt={L:V4.QrCode.Ecc.LOW,M:V4.QrCode.Ecc.MEDIUM,Q:V4.QrCode.Ecc.QUARTILE,H:V4.QrCode.Ecc.HIGH},R$e=128,F$e="L",z$e="#FFFFFF",B$e="#000000",$$e=!1,U$e=1,YWt=4,XWt=0,QWt=.1;function q$e(t,e=0){const n=[];return t.forEach(function(s,a){let o=null;s.forEach(function(l,i){if(!l&&o!==null){n.push(`M${o+e} ${a+e}h${i-o}v1H${o+e}z`),o=null;return}if(i===s.length-1){if(!l)return;o===null?n.push(`M${i+e},${a+e} h1v1H${i+e}z`):n.push(`M${o+e},${a+e} h${i+1-o}v1H${o+e}z`);return}l&&o===null&&(o=i)})}),n.join("")}function V$e(t,e){return t.slice().map((n,s)=>s=e.y+e.h?n:n.map((a,o)=>o=e.x+e.w?a:!1))}function JWt(t,e,n,s){if(s==null)return null;const a=t.length+n*2,o=Math.floor(e*QWt),l=a/e,i=(s.width||o)*l,h=(s.height||o)*l,p=s.x==null?t.length/2-i/2:s.x*l,x=s.y==null?t.length/2-h/2:s.y*l,y=s.opacity==null?1:s.opacity;let _=null;if(s.excavate){let C=Math.floor(p),N=Math.floor(x),A=Math.ceil(i+p-C),E=Math.ceil(h+x-N);_={x:C,y:N,w:A,h:E}}const j=s.crossOrigin;return{x:p,y:x,h,w:i,excavation:_,opacity:y,crossOrigin:j}}function eGt(t,e){return e!=null?Math.max(Math.floor(e),0):t?YWt:XWt}function H$e({value:t,level:e,minVersion:n,includeMargin:s,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let h=st.useMemo(()=>{const C=(Array.isArray(t)?t:[t]).reduce((N,A)=>(N.push(...V4.QrSegment.makeSegments(A)),N),[]);return V4.QrCode.encodeSegments(C,ZWt[e],n,void 0,void 0,i)},[t,e,n,i]);const{cells:p,margin:x,numCells:y,calculatedImageSettings:_}=st.useMemo(()=>{let j=h.getModules();const C=eGt(s,a),N=j.length+C*2,A=JWt(j,l,C,o);return{cells:j,margin:C,numCells:N,calculatedImageSettings:A}},[h,l,o,s,a]);return{qrcode:h,margin:x,cells:p,numCells:y,calculatedImageSettings:_}}var tGt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),rGt=st.forwardRef(function(e,n){const s=e,{value:a,size:o=R$e,level:l=F$e,bgColor:i=z$e,fgColor:h=B$e,includeMargin:p=$$e,minVersion:x=U$e,boostLevel:y,marginSize:_,imageSettings:j}=s,N=Rpe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:A}=N,E=Rpe(N,["style"]),T=j==null?void 0:j.src,P=st.useRef(null),z=st.useRef(null),F=st.useCallback(ae=>{P.current=ae,typeof n=="function"?n(ae):n&&(n.current=ae)},[n]),[q,V]=st.useState(!1),{margin:K,cells:G,numCells:te,calculatedImageSettings:ie}=H$e({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:_,imageSettings:j,size:o});st.useEffect(()=>{if(P.current!=null){const ae=P.current,pe=ae.getContext("2d");if(!pe)return;let se=G;const he=z.current,ue=ie!=null&&he!==null&&he.complete&&he.naturalHeight!==0&&he.naturalWidth!==0;ue&&ie.excavation!=null&&(se=V$e(G,ie.excavation));const _e=window.devicePixelRatio||1;ae.height=ae.width=o*_e;const Ae=o/te*_e;pe.scale(Ae,Ae),pe.fillStyle=i,pe.fillRect(0,0,te,te),pe.fillStyle=h,tGt?pe.fill(new Path2D(q$e(se,K))):G.forEach(function(Ce,Se){Ce.forEach(function(ge,Le){ge&&pe.fillRect(Le+K,Se+K,1,1)})}),ie&&(pe.globalAlpha=ie.opacity),ue&&pe.drawImage(he,ie.x+K,ie.y+K,ie.w,ie.h)}}),st.useEffect(()=>{V(!1)},[T]);const oe=Dpe({height:o,width:o},A);let ye=null;return T!=null&&(ye=st.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{V(!0)},ref:z,crossOrigin:ie==null?void 0:ie.crossOrigin})),st.createElement(st.Fragment,null,st.createElement("canvas",Dpe({style:oe,height:o,width:o,ref:F,role:"img"},E)),ye)});rGt.displayName="QRCodeCanvas";var W$e=st.forwardRef(function(e,n){const s=e,{value:a,size:o=R$e,level:l=F$e,bgColor:i=z$e,fgColor:h=B$e,includeMargin:p=$$e,minVersion:x=U$e,boostLevel:y,title:_,marginSize:j,imageSettings:C}=s,N=Rpe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:A,cells:E,numCells:T,calculatedImageSettings:P}=H$e({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:j,imageSettings:C,size:o});let z=E,F=null;C!=null&&P!=null&&(P.excavation!=null&&(z=V$e(E,P.excavation)),F=st.createElement("image",{href:C.src,height:P.h,width:P.w,x:P.x+A,y:P.y+A,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const q=q$e(z,A);return st.createElement("svg",Dpe({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},N),!!_&&st.createElement("title",null,_),st.createElement("path",{fill:i,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),st.createElement("path",{fill:h,d:q,shapeRendering:"crispEdges"}),F)});W$e.displayName="QRCodeSVG";function nGt({slug:t,agentName:e}){const n=I.useRef(null),s=`https://cards.relevelup.com/${t}`,a=I.useCallback(()=>{var y;const o=(y=n.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),i=1024;l.width=i,l.height=i;const h=l.getContext("2d");if(!h)return;const p=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{h.fillStyle="#ffffff",h.fillRect(0,0,i,i),h.drawImage(x,0,0,i,i);const _=document.createElement("a");_.download=`${t}-qr-code.png`,_.href=l.toDataURL("image/png"),_.click(),ze.success("QR code downloaded!")},x.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(p)))},[t]);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-sm font-medium",children:"QR Code"}),r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{ref:n,className:"bg-white p-3 rounded-lg border shadow-sm shrink-0",children:r.jsx(W$e,{value:s,size:120,level:"H",bgColor:"#ffffff",fgColor:"#000000"})}),r.jsxs("div",{className:"space-y-2 min-w-0",children:[r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Download this QR code to use on business cards, flyers, signs, or any print materials. Scanning it opens your digital card instantly."}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[r.jsx(no,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function dde(t){return{is_published:t.is_published,theme:t.theme,title:t.title||"",positioning_statement:t.positioning_statement||"",bio:t.bio||"",review_snippet:t.review_snippet||"",review_source_url:t.review_source_url||"",booking_url:t.booking_url||"",custom_cta_label:t.custom_cta_label||"",show_photo:t.show_photo,show_bio:t.show_bio,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||"",brokerage_logo_url:t.brokerage_logo_url||"",brokerage_logo_size:t.brokerage_logo_size||56,team_name:t.team_name||"",team_logo_url:t.team_logo_url||"",team_logo_size:t.team_logo_size||56,bold_theme_colors:t.bold_theme_colors||null}}function sGt(){const{user:t}=Xr(),{data:e,isLoading:n}=zit(t==null?void 0:t.id),s=m3(),[a,o]=I.useState(null),l=I.useMemo(()=>a||(e?dde(e):null),[a,e]);if(n)return r.jsx(Lr,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Ir,{className:"h-8 w-48"}),r.jsx(Ir,{className:"h-32 w-full"}),r.jsx(Ir,{className:"h-32 w-full"})]})});if(!e)return r.jsx(Lr,{children:r.jsx(iGt,{userId:t==null?void 0:t.id})});const i=l||dde(e),h=p=>{o(x=>{const y=x||dde(e);return typeof p=="function"?p(y):p})};return r.jsx(Lr,{children:r.jsxs("div",{className:"flex gap-6",children:[r.jsxs("div",{className:`${s?"w-full":"flex-1 min-w-0"} max-w-2xl mx-auto p-4 space-y-6 animate-fade-in`,children:[r.jsx(oGt,{card:e}),r.jsx(uGt,{card:e,form:i,setForm:h})]}),!s&&r.jsx("div",{className:"w-[400px] shrink-0 sticky top-4 self-start",children:r.jsxs("div",{className:"rounded-xl border bg-muted/30 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b bg-card",children:[r.jsx(vj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-medium",children:"Live Preview"})]}),r.jsx("div",{className:"h-[calc(100vh-140px)] overflow-y-auto",children:r.jsx(aGt,{card:e,form:i})})]})})]})})}function aGt({card:t,form:e}){const{data:n}=Yt({queryKey:["card-preview-profile",t.user_id],queryFn:async()=>{const{data:a}=await J.from("profiles").select("name, email, phone, avatar_url, brokerage_id").eq("id",t.user_id).single();let o=(a==null?void 0:a.avatar_url)||null;if(!o){const{data:l}=await J.storage.from("avatars").list(`${t.user_id}`);if(l&&l.length>0){const{data:i}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${l[0].name}`);o=`${i.publicUrl}?t=${Date.now()}`}}return{...a,avatar_url:o}}}),s=I.useMemo(()=>({...t,is_published:e.is_published,theme:e.theme,title:e.title||null,positioning_statement:e.positioning_statement||null,bio:e.bio||null,review_snippet:e.review_snippet||null,review_source_url:e.review_source_url||null,booking_url:e.booking_url||null,custom_cta_label:e.custom_cta_label||null,custom_cta_url:t.custom_cta_url,show_photo:e.show_photo,show_bio:e.show_bio,show_video:t.show_video,show_credentials:e.show_credentials,show_social_links:e.show_social_links,show_save_contact:e.show_save_contact,show_leave_review:e.show_leave_review,show_refer_friend:e.show_refer_friend,brokerage_display_name:e.brokerage_display_name||null,brokerage_logo_url:e.brokerage_logo_url||null,brokerage_logo_size:e.brokerage_logo_size,team_name:e.team_name||null,team_logo_url:e.team_logo_url||null,team_logo_size:e.team_logo_size,bold_theme_colors:e.bold_theme_colors||null,social_links:t.social_links||[],profile:{name:(n==null?void 0:n.name)||null,email:(n==null?void 0:n.email)||null,phone:(n==null?void 0:n.phone)||null,brokerage_id:(n==null?void 0:n.brokerage_id)||null},brokerage_name:e.brokerage_display_name||null,avatar_url:(n==null?void 0:n.avatar_url)||null}),[t,e,n]);return r.jsx("div",{className:"transform scale-[0.85] origin-top",children:r.jsx(Oge,{card:s})})}function iGt({userId:t}){var h;const[e,n]=I.useState(""),s=vLe(),{data:a}=Yt({queryKey:["my-profile-for-card",t],queryFn:async()=>{if(!t)return null;const{data:p}=await J.from("profiles").select("name").eq("id",t).single();return p},enabled:!!t}),o=((h=a==null?void 0:a.name)==null?void 0:h.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!t)return;const p=(e.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!p){ze.error("Please enter a URL slug for your card");return}s.mutate({user_id:t,slug:p,is_published:!0},{onSuccess:()=>ze.success("Your digital card has been created!")})},i=[{icon:Vx,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Sg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:nf,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:pd,title:"Fully Customizable",desc:"Themes, colors, and content blocks"}];return r.jsxs("div",{className:"max-w-2xl mx-auto p-4 animate-fade-in",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/90 via-primary to-primary/80 p-8 md:p-12 mb-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_20%,rgba(255,255,255,0.15),transparent_50%)]"}),r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_80%_80%,rgba(0,0,0,0.1),transparent_50%)]"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm text-sm font-medium mb-4",children:[r.jsx(Ms,{className:"h-3.5 w-3.5"}),"New Feature"]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3 tracking-tight",children:"Your Digital Business Card"}),r.jsx("p",{className:"text-primary-foreground/80 text-lg max-w-md leading-relaxed",children:"Ditch the paper. Share a beautiful, interactive card that captures leads and makes a lasting impression."})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:i.map(p=>r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border bg-card hover:shadow-md transition-shadow",children:[r.jsx("div",{className:"mt-0.5 p-2 rounded-lg bg-primary/10 shrink-0",children:r.jsx(p.icon,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:p.title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p.desc})]})]},p.title))}),r.jsxs(Ye,{className:"shadow-lg border-2",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx(Zt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(Tn,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(Je,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm font-medium",children:"Your Card URL"}),r.jsxs("div",{className:"flex items-center gap-0 mt-1.5",children:[r.jsx("span",{className:"inline-flex items-center px-3 h-10 rounded-l-md border border-r-0 bg-muted text-sm text-muted-foreground whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(dt,{value:e||o,onChange:p=>n(p.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(ee,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function oGt({card:t}){const n=`https://cards.relevelup.com/${t.slug}`,s=()=>{navigator.clipboard.writeText(n),ze.success("Card link copied!")};return r.jsx("div",{className:"rounded-xl border bg-card p-5",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:"My Digital Card"}),r.jsx(Ot,{variant:t.is_published?"default":"secondary",className:"text-[10px] uppercase tracking-wider",children:t.is_published?"Live":"Draft"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Vx,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",t.slug]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(Qo,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(ee,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function lGt({userId:t}){const e=Vr(),n=I.useRef(null),[s,a]=I.useState(!1),[o,l]=I.useState(""),{data:i,isLoading:h}=Yt({queryKey:["card-editor-profile",t],queryFn:async()=>{const{data:ie}=await J.from("profiles").select("name, email, phone, avatar_url").eq("id",t).single();let oe=(ie==null?void 0:ie.avatar_url)||null;if(!oe){const{data:ye}=await J.storage.from("avatars").list(`${t}`);if(ye&&ye.length>0){const{data:ae}=J.storage.from("avatars").getPublicUrl(`${t}/${ye[0].name}`);oe=`${ae.publicUrl}?t=${Date.now()}`,await J.from("profiles").update({avatar_url:oe}).eq("id",t)}}return{...ie,avatar_url:oe}}}),[p,x]=I.useState(null),[y,_]=I.useState(null),[j,C]=I.useState(null),[N,A]=I.useState(!1),E=p??(i==null?void 0:i.name)??"",T=y??(i==null?void 0:i.phone)??"",P=j??(i==null?void 0:i.email)??"",z=i==null?void 0:i.avatar_url,F=((i==null?void 0:i.name)||"A").split(" ").map(ie=>ie[0]).join("").toUpperCase().slice(0,2),q=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),V=cr({mutationFn:async ie=>{const{error:oe}=await J.from("profiles").update(ie).eq("id",t);if(oe)throw oe},onSuccess:()=>{e.invalidateQueries({queryKey:["card-editor-profile",t]}),e.invalidateQueries({queryKey:["card-preview-profile",t]}),e.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Profile updated!")},onError:()=>ze.error("Failed to update profile")}),K=()=>{const ie={};if(p!==null&&p!==(i==null?void 0:i.name)&&(ie.name=p),y!==null&&y!==(i==null?void 0:i.phone)&&(ie.phone=y||null),j!==null&&j!==(i==null?void 0:i.email)&&(ie.email=j),Object.keys(ie).length===0){ze.info("No changes to save");return}V.mutate(ie)},G=ie=>{var ae;const oe=(ae=ie.target.files)==null?void 0:ae[0];if(!oe)return;if(!oe.type.startsWith("image/")){ze.error("Please select an image file");return}const ye=new FileReader;ye.onloadend=()=>{l(ye.result),a(!0)},ye.readAsDataURL(oe),ie.target.value=""},te=async ie=>{A(!0);try{const{data:oe}=await J.storage.from("avatars").list(`${t}`);oe&&oe.length>0&&await J.storage.from("avatars").remove(oe.map(he=>`${t}/${he.name}`));const ye=`${t}/avatar.jpg`,{error:ae}=await J.storage.from("avatars").upload(ye,ie,{upsert:!0,contentType:"image/jpeg"});if(ae)throw ae;const{data:pe}=J.storage.from("avatars").getPublicUrl(ye),se=pe.publicUrl+"?t="+Date.now();await J.from("profiles").update({avatar_url:se}).eq("id",t),e.invalidateQueries({queryKey:["card-editor-profile",t]}),e.invalidateQueries({queryKey:["card-preview-profile",t]}),e.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Photo updated!")}catch{ze.error("Failed to upload photo")}finally{A(!1)}};return h?r.jsx(Ir,{className:"h-32 w-full rounded-xl"}):r.jsxs(r.Fragment,{children:[r.jsx(Ye,{className:q?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(Je,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(He,{className:"text-sm font-semibold",children:"Profile Info"}),q&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(fl,{className:"h-3 w-3"}),"Missing info — complete below so your card looks great"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-3",children:"This info shows on your digital card and updates your profile everywhere."}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"relative group cursor-pointer",onClick:()=>{var ie;return(ie=n.current)==null?void 0:ie.click()},children:[r.jsxs(Ks,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Ei,{src:z||void 0,alt:E}),r.jsx(Zs,{className:"text-lg font-semibold bg-primary/10 text-primary",children:F})]}),r.jsx("div",{className:"absolute inset-0 bg-black/40 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(vg,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:G})]}),r.jsxs("div",{className:"flex-1 space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium",children:N?"Uploading...":z?"Tap to change photo":"Add a profile photo"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This photo appears on your card, profile, and community posts"})]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(dt,{value:E,onChange:ie=>x(ie.target.value),placeholder:"Your full name",className:"h-10"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(dt,{value:T,onChange:ie=>_(ie.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(dt,{value:P,onChange:ie=>C(ie.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:K,disabled:V.isPending,className:"w-full",children:V.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(wxe,{open:s,onClose:()=>a(!1),imageSrc:o,onCropComplete:te,aspectRatio:1})]})}function cGt({form:t,setForm:e,userId:n}){const[s,a]=I.useState(null),[o,l]=I.useState(t.brokerage_logo_url?"logo":"name"),[i,h]=I.useState(t.team_logo_url?"logo":"name"),p=j=>{l(j),e(j==="name"?C=>({...C,brokerage_logo_url:""}):C=>({...C,brokerage_display_name:""}))},x=j=>{h(j),e(j==="name"?C=>({...C,team_logo_url:""}):C=>({...C,team_name:""}))},y=async(j,C)=>{var A;const N=(A=j.target.files)==null?void 0:A[0];if(N){if(!N.type.startsWith("image/")){ze.error("Please select an image file");return}a(C);try{const E=N.name.split(".").pop()||"png",P=`${n}/${C==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${E}`,{error:z}=await J.storage.from("card-logos").upload(P,N,{upsert:!0});if(z)throw z;const{data:F}=J.storage.from("card-logos").getPublicUrl(P),q=F.publicUrl+"?t="+Date.now();e(C==="brokerage_logo_url"?V=>({...V,[C]:q,brokerage_display_name:""}):V=>({...V,[C]:q,team_name:""})),ze.success("Logo uploaded!")}catch{ze.error("Failed to upload logo")}finally{a(null),j.target.value=""}}},_=j=>{e(C=>({...C,[j]:""}))};return r.jsx(Ye,{children:r.jsxs(Je,{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm font-semibold",children:"Brokerage & Team Branding"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Choose either a name or a logo for each — not both."})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("name"),children:"Use Name"}),r.jsx(ee,{type:"button",variant:o==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("logo"),children:"Use Logo"})]}),o==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),r.jsx(dt,{value:t.brokerage_display_name,onChange:j=>e(C=>({...C,brokerage_display_name:j.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[t.brokerage_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:t.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${t.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>_("brokerage_logo_url"),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}):null,r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(vg,{className:"h-3.5 w-3.5"}),s==="brokerage_logo_url"?"Uploading...":t.brokerage_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:j=>y(j,"brokerage_logo_url"),disabled:s!==null})]})]}),t.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.brokerage_logo_size||56,"px"]})]}),r.jsx(um,{value:[t.brokerage_logo_size||56],onValueChange:([j])=>e(C=>({...C,brokerage_logo_size:j})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:i==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("name"),children:"Use Name"}),r.jsx(ee,{type:"button",variant:i==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("logo"),children:"Use Logo"})]}),i==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),r.jsx(dt,{value:t.team_name,onChange:j=>e(C=>({...C,team_name:j.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Team Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[t.team_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:t.team_logo_url,alt:"Team logo",style:{height:`${t.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>_("team_logo_url"),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}):null,r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(vg,{className:"h-3.5 w-3.5"}),s==="team_logo_url"?"Uploading...":t.team_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:j=>y(j,"team_logo_url"),disabled:s!==null})]})]}),t.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.team_logo_size||56,"px"]})]}),r.jsx(um,{value:[t.team_logo_size||56],onValueChange:([j])=>e(C=>({...C,team_logo_size:j})),min:24,max:120,step:4})]})]})]})]})})}function dGt({form:t,setForm:e}){const n={accent:"#ff5722",dark:"#1a1a2e",button:"#ff5722"},s=t.bold_theme_colors||n,a=(i,h)=>{e(p=>({...p,bold_theme_colors:{...n,...p.bold_theme_colors,[i]:h}}))},o=()=>{e(i=>({...i,bold_theme_colors:null}))},l=[{key:"accent",label:"Accent Color",desc:"Page background, icons, highlights"},{key:"dark",label:"Dark Color",desc:"Header background, action buttons, social icons"},{key:"button",label:"CTA Button Color",desc:"Main call-to-action button"}];return r.jsxs("div",{className:"space-y-3 p-4 rounded-xl border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(He,{className:"text-sm font-semibold flex items-center gap-1.5",children:[r.jsx(pd,{className:"h-4 w-4"})," Brand Colors"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Customize colors to match your brand"})]}),r.jsx(ee,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:o,children:"Reset to Default"})]}),r.jsx("div",{className:"grid gap-3",children:l.map(({key:i,label:h,desc:p})=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("label",{className:"relative shrink-0",children:[r.jsx("input",{type:"color",value:s[i],onChange:x=>a(i,x.target.value),className:"sr-only"}),r.jsx("div",{className:"h-10 w-10 rounded-lg border-2 border-border cursor-pointer shadow-sm hover:scale-105 transition-transform",style:{backgroundColor:s[i]}})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:h}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p})]}),r.jsx(dt,{value:s[i],onChange:x=>{const y=x.target.value;/^#[0-9a-fA-F]{0,6}$/.test(y)&&a(i,y)},className:"w-24 h-8 text-xs font-mono",placeholder:"#ff5722"})]},i))}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Preview:"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.accent}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.dark}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.button}})]})]})]})}function uGt({card:t,form:e,setForm:n}){var _;const s=_Le(),a=Vr(),{data:o}=bLe(t.id),[l,i]=I.useState(t.slug),[h,p]=I.useState(!1),x=async()=>{const j=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!j){ze.error("Please enter a valid URL");return}if(j===t.slug){ze.info("No changes to save");return}p(!0);try{const{data:C}=await J.from("agent_cards").select("id").eq("slug",j).neq("id",t.id).maybeSingle();if(C){ze.error("This URL is already taken. Try another one.");return}const{error:N}=await J.from("agent_cards").update({slug:j}).eq("id",t.id);if(N)throw N;i(j),a.invalidateQueries({queryKey:["agent-card"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{p(!1)}},y=()=>{s.mutate({id:t.id,...e,is_published:!0,title:e.title||null,positioning_statement:e.positioning_statement||null,bio:e.bio||null,review_snippet:e.review_snippet||null,review_source_url:e.review_source_url||null,booking_url:e.booking_url||null,custom_cta_label:e.custom_cta_label||null,brokerage_display_name:e.brokerage_display_name||null,brokerage_logo_url:e.brokerage_logo_url||null,brokerage_logo_size:e.brokerage_logo_size,team_name:e.team_name||null,team_logo_url:e.team_logo_url||null,team_logo_size:e.team_logo_size,bold_theme_colors:e.bold_theme_colors||null},{onSuccess:()=>ze.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ii,{defaultValue:"content",children:[r.jsxs(wi,{className:"w-full h-11 p-1",children:[r.jsxs(nn,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(gm,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(nn,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(el,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(nn,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Sg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(nn,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(VT,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(nn,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(_j,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(Sn,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(lGt,{userId:t.user_id}),r.jsx(cGt,{form:e,setForm:n,userId:t.user_id}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm font-semibold",children:"Card Status"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Toggle your card on or off"})]}),r.jsx(Ps,{checked:e.is_published,onCheckedChange:j=>n(C=>({...C,is_published:j}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(dt,{value:l,onChange:j=>i(j.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:x,disabled:h||l===t.slug,className:"shrink-0",children:h?"Saving...":"Update"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is your unique card URL. Only letters, numbers, and dashes allowed."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(gn,{value:e.theme,onValueChange:j=>n(C=>({...C,theme:j})),children:[r.jsx(fn,{className:"h-11",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"standard",children:"✨ Standard — Modern & Clean"}),r.jsx(qt,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),r.jsx(qt,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),r.jsx(qt,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),e.theme==="bold"&&r.jsx(dGt,{form:e,setForm:n}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(dt,{value:e.title,onChange:j=>n(C=>({...C,title:j.target.value})),placeholder:"e.g. Luxury Real Estate Specialist",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown below your name on the card"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(dt,{value:e.positioning_statement,onChange:j=>n(C=>({...C,positioning_statement:j.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Bio"}),r.jsx(ps,{value:e.bio,onChange:j=>n(C=>({...C,bio:j.target.value})),placeholder:"A short intro about you and what makes you different...",rows:3})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(dt,{value:e.review_snippet,onChange:j=>n(C=>({...C,review_snippet:j.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(dt,{value:e.review_source_url,onChange:j=>n(C=>({...C,review_source_url:j.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(dt,{value:e.booking_url,onChange:j=>n(C=>({...C,booking_url:j.target.value})),placeholder:"https://calendly.com/your-link",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to show a built-in lead form instead"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(dt,{value:e.custom_cta_label,onChange:j=>n(C=>({...C,custom_cta_label:j.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(Sn,{value:"sections",className:"mt-4",children:r.jsx(Ye,{children:r.jsx(Je,{className:"p-5 divide-y",children:[{key:"show_photo",label:"Photo",desc:"Uses the photo from your Profile Info above"},{key:"show_bio",label:"Bio Section",desc:"Display your bio on the card"},{key:"show_credentials",label:"Credentials",desc:"Show star rating and reviews"},{key:"show_social_links",label:"Social Links",desc:"Display your social media links"},{key:"show_save_contact",label:"Save Contact",desc:"Let visitors save you as a contact"},{key:"show_leave_review",label:"Leave Review",desc:"Link to your review page"},{key:"show_refer_friend",label:"Refer a Friend",desc:"Enable referral submissions"}].map(({key:j,label:C,desc:N})=>r.jsxs("div",{className:"flex items-center justify-between py-4 first:pt-0 last:pb-0",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(He,{className:"text-sm font-medium",children:C}),r.jsx("p",{className:"text-xs text-muted-foreground",children:N})]}),r.jsx(Ps,{checked:e[j],onCheckedChange:A=>n(E=>({...E,[j]:A}))})]},j))})})}),r.jsx(Sn,{value:"blocks",className:"mt-4",children:r.jsx(L$e,{cardId:t.id})}),r.jsx(Sn,{value:"analytics",className:"mt-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Views",value:(o==null?void 0:o.views)??0,icon:el,color:"text-blue-600 bg-blue-100 dark:text-blue-400 dark:bg-blue-900/30"},{label:"Clicks",value:(o==null?void 0:o.clicks)??0,icon:_j,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((_=o==null?void 0:o.leads)==null?void 0:_.length)??0,icon:sf,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(j=>r.jsx(Ye,{className:"overflow-hidden",children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:`p-1.5 rounded-md ${j.color}`,children:r.jsx(j.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:j.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:j.value})]})},j.label))}),o&&o.leads.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsx(Zt,{className:"text-base",children:"Recent Leads"})}),r.jsx(Je,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(j=>r.jsxs("div",{className:"flex items-center justify-between text-sm p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:j.name}),j.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:j.phone})]}),j.intent&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:j.intent})]},j.id))})]}),(!o||o.leads.length===0)&&r.jsx(Ye,{children:r.jsxs(Je,{className:"p-8 text-center",children:[r.jsx(_j,{className:"h-10 w-10 text-muted-foreground/40 mx-auto mb-3"}),r.jsx("p",{className:"font-medium text-muted-foreground",children:"No analytics data yet"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Share your card link to start tracking"})]})})]})}),r.jsx(Sn,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(Ye,{children:r.jsx(Je,{className:"p-6",children:r.jsx(nGt,{slug:t.slug})})})})]}),r.jsx(ee,{onClick:y,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:s.isPending?"Saving...":"Save Changes"})]})}const G$e=new Date().getFullYear(),hGt=Array.from({length:5},(t,e)=>G$e-e);function fGt(){const[t,e]=I.useState(G$e),n=Zn(),{data:s,isLoading:a}=cpt();return a?r.jsx(Lr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Ir,{className:"h-24"},o))}),r.jsx(Ir,{className:"h-96"})]})}):r.jsx(Lr,{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(gn,{value:String(t),onValueChange:o=>e(Number(o)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:hGt.map(o=>r.jsx(qt,{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(Bn,{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(dc,{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(Gt,{children:[r.jsx(Zt,{children:"Agents with Scorecards"}),r.jsx(Tn,{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(dc,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Email"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:s.map(o=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:o.name}),r.jsx(Nt,{className:"text-muted-foreground",children:o.email}),r.jsx(Nt,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const K$e=new Date().getFullYear(),pGt=Array.from({length:10},(t,e)=>K$e-e);function mGt(){var _;const{userId:t}=Yc(),e=Zn(),[n,s]=I.useState(K$e),{data:a,isLoading:o}=Yt({queryKey:["agent-profile",t],queryFn:async()=>{const{data:j,error:C}=await J.from("profiles").select("id, name, email").eq("id",t).single();if(C)throw C;return j},enabled:!!t}),{data:l,isLoading:i}=vxe(n,t),{yearStats:h,lifetimeStats:p,showCommission:x}=A8e(n,t),{data:y}=T8e(n,t);return o?r.jsx(Lr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(j=>r.jsx(Ir,{className:"h-24"},j))})]})}):r.jsx(Lr,{title:`${a==null?void 0:a.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(ee,{variant:"ghost",size:"icon",onClick:()=>e("/admin/scorecard"),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a==null?void 0:a.name}),r.jsx("p",{className:"text-muted-foreground",children:a==null?void 0:a.email})]})]}),r.jsxs(gn,{value:String(n),onValueChange:j=>s(Number(j)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:pGt.map(j=>r.jsx(qt,{value:String(j),children:j},j))})]})]}),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(da,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:h.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.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(Bn,{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:[h.buyerCount,"/",h.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(fd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Pd(h.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(ep,{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:Pd(h.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(Ol,{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:((_=h.topLeadSource)==null?void 0:_.name)||"-"})]})})]}),y&&r.jsx(Pze,{goals:y,stats:h,year:n,showCommission:x}),r.jsxs(Ii,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"transactions",children:"Transactions"}),r.jsx(nn,{value:"charts",children:"Charts"}),r.jsxs(nn,{value:"map",children:[r.jsx(Mo,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Sn,{value:"transactions",children:r.jsx(Ize,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(Sn,{value:"charts",children:r.jsx(j$e,{stats:h,year:n})}),r.jsx(Sn,{value:"map",children:r.jsx(k$e,{transactions:l||[],isLoading:i})})]})]})})}function gGt(){const t=Vr(),[e,n]=I.useState(""),[s,a]=I.useState("all");MLe();const{data:o,refetch:l}=Yt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:T}=await J.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(T==null?void 0:T.enabled)??!1}}),{data:i,isLoading:h}=Yt({queryKey:["admin-listings"],queryFn:async()=>{const{data:T,error:P}=await J.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(P)throw P;return T}}),{data:p}=Yt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:T}=await J.from("listings").select("id, is_approved, status"),{data:P}=await J.from("listing_shares").select("id"),{data:z}=await J.from("listing_views").select("id");return{total:(T==null?void 0:T.length)||0,pending:(T==null?void 0:T.filter(F=>!F.is_approved).length)||0,active:(T==null?void 0:T.filter(F=>F.status==="active").length)||0,totalShares:(P==null?void 0:P.length)||0,totalViews:(z==null?void 0:z.length)||0}}}),x=cr({mutationFn:async({id:T,approved:P})=>{const{error:z}=await J.from("listings").update({is_approved:P}).eq("id",T);if(z)throw z},onSuccess:(T,{approved:P})=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success(P?"Listing approved":"Listing unapproved")}}),y=cr({mutationFn:async({id:T,featured:P})=>{const{error:z}=await J.from("listings").update({is_featured:P}).eq("id",T);if(z)throw z},onSuccess:(T,{featured:P})=>{t.invalidateQueries({queryKey:["admin-listings"]}),ze.success(P?"Listing featured":"Listing unfeatured")}}),_=cr({mutationFn:async T=>{const{error:P}=await J.from("listings").delete().eq("id",T);if(P)throw P},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success("Listing deleted")}}),j=cr({mutationFn:async T=>{const{error:P}=await J.from("feature_flags").update({enabled:T}).eq("key","listing_exchange_enabled");if(P)throw P},onSuccess:()=>{l(),ze.success("Feature flag updated")}}),C=o??!1,N=i==null?void 0:i.filter(T=>{var F,q,V,K;const P=((F=T.city)==null?void 0:F.toLowerCase().includes(e.toLowerCase()))||((V=(q=T.agent)==null?void 0:q.name)==null?void 0:V.toLowerCase().includes(e.toLowerCase()))||((K=T.property_address)==null?void 0:K.toLowerCase().includes(e.toLowerCase())),z=s==="all"||s==="pending"&&!T.is_approved||s==="approved"&&T.is_approved;return P&&z}),A=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),E=T=>{const P={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 P[T]||P.active};return r.jsx(Lr,{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(Ps,{checked:C,onCheckedChange:T=>j.mutate(T)})]})]}),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(ai,{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:(p==null?void 0:p.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(ep,{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:(p==null?void 0:p.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(Bn,{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:(p==null?void 0:p.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(el,{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:(p==null?void 0:p.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(pc,{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:(p==null?void 0:p.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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by city, address, or agent...",value:e,onChange:T=>n(T.target.value),className:"pl-9"})]}),r.jsx(Ii,{value:s,onValueChange:T=>a(T),children:r.jsxs(wi,{children:[r.jsx(nn,{value:"all",children:"All"}),r.jsx(nn,{value:"pending",children:"Pending"}),r.jsx(nn,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{children:["Listings (",(N==null?void 0:N.length)||0,")"]})}),r.jsx(Je,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Price"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-center",children:"Approved"}),r.jsx(It,{className:"text-center",children:"Featured"}),r.jsx(It,{children:"Views"}),r.jsx(It,{children:"Shares"}),r.jsx(It,{children:"Date"}),r.jsx(It,{})]})}),r.jsx(Vs,{children:h?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(N==null?void 0:N.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):N==null?void 0:N.map(T=>{var P,z,F,q,V;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(z=(P=T.photos)==null?void 0:P[0])!=null&&z.photo_url?r.jsx("img",{src:T.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(ai,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.property_address||`${T.city}, ${T.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(F=T.property_type)==null?void 0:F.replace("_"," ")})]})]})}),r.jsx(Nt,{children:r.jsx("p",{className:"text-sm",children:((q=T.agent)==null?void 0:q.name)||"Unknown"})}),r.jsx(Nt,{className:"font-medium",children:A(T.price)}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",className:E(T.status),children:(V=T.status)==null?void 0:V.replace("_"," ")})}),r.jsx(Nt,{className:"text-center",children:r.jsx(Ps,{checked:T.is_approved??!1,onCheckedChange:K=>x.mutate({id:T.id,approved:K})})}),r.jsx(Nt,{className:"text-center",children:r.jsx(Ps,{checked:T.is_featured??!1,onCheckedChange:K=>y.mutate({id:T.id,featured:K})})}),r.jsx(Nt,{children:T.view_count||0}),r.jsx(Nt,{children:T.share_count||0}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:xn(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsxs(jh,{children:[r.jsx(kh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(nm,{className:"h-4 w-4"})})}),r.jsxs(Gu,{align:"end",children:[r.jsxs(di,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(di,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(di,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&_.mutate(T.id)},children:[r.jsx(_s,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const xGt=()=>{var y,_;const[t,e]=I.useState(""),[n,s]=I.useState(null),{data:a,isLoading:o}=Yt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:j,error:C}=await J.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(C)throw C;const N=(j==null?void 0:j.map(T=>T.user_id))||[],{data:A}=await J.from("profiles").select("id, name, email").in("id",N);return j==null?void 0:j.map(T=>({...T,profiles:(A==null?void 0:A.find(P=>P.id===T.user_id))||null}))}}),l=a==null?void 0:a.filter(j=>{var N,A,E,T,P;const C=t.toLowerCase();return((A=(N=j.profiles)==null?void 0:N.name)==null?void 0:A.toLowerCase().includes(C))||((T=(E=j.profiles)==null?void 0:E.email)==null?void 0:T.toLowerCase().includes(C))||((P=j.review_text)==null?void 0:P.toLowerCase().includes(C))}),i=a!=null&&a.length?(a.reduce((j,C)=>j+C.rating,0)/a.length).toFixed(1):"0.0",h=a==null?void 0:a.reduce((j,C)=>(j[C.rating]=(j[C.rating]||0)+1,j),{}),p=(a==null?void 0:a.filter(j=>j.posted_to_google).length)||0,x=j=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(C=>r.jsx(vs,{className:zt("h-4 w-4",j>=C?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},C))});return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{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(Gt,{className:"pb-2",children:[r.jsx(Tn,{children:"Total Reviews"}),r.jsx(Zt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Tn,{children:"Average Rating"}),r.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(vs,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Tn,{children:"5-Star Reviews"}),r.jsx(Zt,{className:"text-3xl",children:(h==null?void 0:h[5])||0})]})}),r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Tn,{children:"Posted to Google"}),r.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[p,r.jsx(Ls,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or review...",value:t,onChange:j=>e(j.target.value),className:"pl-9"})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Member"}),r.jsx(It,{children:"Rating"}),r.jsx(It,{className:"hidden md:table-cell",children:"Review"}),r.jsx(It,{children:"Google"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Vs,{children:o?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(j=>{var C,N;return r.jsxs(Ar,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(j),children:[r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((C=j.profiles)==null?void 0:C.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(N=j.profiles)==null?void 0:N.email})]})}),r.jsx(Nt,{children:x(j.rating)}),r.jsx(Nt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:j.review_text||"-"})}),r.jsx(Nt,{children:j.posted_to_google?r.jsx(Ot,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Ot,{variant:"outline",children:"No"})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:xn(new Date(j.created_at),"MMM d, yyyy")})]},j.id)})})]})})}),r.jsx(Fr,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{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:((y=n.profiles)==null?void 0:y.name)||"Unknown Member"}),((_=n.profiles)==null?void 0:_.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(ua,{className:"h-3 w-3"}),n.profiles.email]})]}),r.jsxs("div",{className:"text-right",children:[x(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(Os,{className:"h-4 w-4"}),xn(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Ot,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Ot,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},yGt=[{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"}],vGt=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 _Gt(){const t=Vr(),{user:e}=Xr(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(!1),{data:h,isLoading:p}=Yt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:K,error:G}=await J.from("weekly_digest_settings").select("*").single();if(G)throw G;return K}}),{data:x,isLoading:y}=Yt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:K,error:G}=await J.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(G)throw G;return K}}),{data:_}=Yt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:K,error:G}=await J.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(G)throw G;return K||0}}),{data:j,refetch:C}=Yt({queryKey:["digest-queue-status"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[G,te,ie,oe]=await Promise.all([J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",K.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",K.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",K.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",K.toISOString())]);return{pending:G.count||0,processing:te.count||0,sent:ie.count||0,failed:oe.count||0,total:(G.count||0)+(te.count||0)+(ie.count||0)+(oe.count||0)}},refetchInterval:5e3});I.useEffect(()=>{if(j&&(j.pending>0||j.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)}},[j,C,t]);const{data:N=0}=Yt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const{count:G,error:te}=await J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString());if(te)throw te;return G||0}}),A=cr({mutationFn:async K=>{const{error:G}=await J.from("weekly_digest_settings").update(K).eq("id",h==null?void 0:h.id);if(G)throw G},onSuccess:()=>{t.invalidateQueries({queryKey:["weekly-digest-settings"]}),ze.success("Settings updated")},onError:K=>{ze.error("Failed to update settings: "+K.message)}}),E=async()=>{s(!0);try{const{data:K,error:G}=await J.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(G)throw G;K.queued?ze.success(`${K.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):K.sent!==void 0&&ze.success(`Digest sent! ${K.sent} emails delivered, ${K.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(K){ze.error("Failed to send digest: "+K.message)}finally{s(!1)}},T=async()=>{var K,G,te,ie,oe,ye;if(!(e!=null&&e.email)){ze.error("No email found for your account");return}o(!0);try{const{data:ae,error:pe}=await J.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:e.email}});if(pe)throw pe;const se=ae==null?void 0:ae.resendId,he=ae==null?void 0:ae.resendDetails,ue=he==null?void 0:he.status,_e=((K=he==null?void 0:he.body)==null?void 0:K.status)||((te=(G=he==null?void 0:he.body)==null?void 0:G.data)==null?void 0:te.status),Ae=((oe=(ie=he==null?void 0:he.body)==null?void 0:ie.error)==null?void 0:oe.message)||((ye=he==null?void 0:he.body)==null?void 0:ye.message);ze.success(se?`Preview accepted by email provider (id: ${se})${ue?`, status check: ${ue}`:""}${_e?`, provider: ${_e}`:""}${Ae?` (${Ae})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(ae){ze.error("Failed to send preview: "+ae.message)}finally{o(!1)}},P=async()=>{i(!0);try{const{data:K,error:G}=await J.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(G)throw G;K.queued===0||K.sent===0&&K.failed===0&&!K.queued?ze.info("No failed emails to retry"):K.queued?ze.success(`${K.queued} emails queued for retry!`):ze.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){ze.error("Failed to retry: "+K.message)}finally{i(!1)}},z=j!=null&&j.total?Math.round((j.sent+j.failed)/j.total*100):0,F=((j==null?void 0:j.pending)||0)>0||((j==null?void 0:j.processing)||0)>0,{data:q}=Yt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var ye,ae;const K=new Date;K.setUTCHours(0,0,0,0);const[G,te,ie,oe]=await Promise.all([J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",K.toISOString()),J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString()),J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",K.toISOString()),J.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:G.count||0,totalFailed:te.count||0,agentOsEngaged:ie.count||0,lastSent:((ae=(ye=oe.data)==null?void 0:ye[0])==null?void 0:ae.sent_at)||null}},refetchInterval:F?5e3:!1}),V={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 p?r.jsx(Lr,{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(Lr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(Ii,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(wi,{children:[r.jsxs(nn,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(md,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(nn,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(dc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Sn,{value:"settings",className:"space-y-6",children:[F&&j&&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(en,{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:[j.sent.toLocaleString()," sent, ",j.pending.toLocaleString()," pending",j.failed>0&&`, ${j.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[z,"%"]})]}),r.jsx(Zc,{value:z,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(j.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(Bn,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:_}),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(Xi,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.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(Vc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.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(Ya,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.lastSent?xn(new Date(V.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(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(Tn,{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(He,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Ps,{checked:h==null?void 0:h.is_enabled,onCheckedChange:K=>A.mutate({is_enabled:K})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Cron Frequency"}),r.jsxs(gn,{value:(h==null?void 0:h.cron_frequency)||"daily",onValueChange:K=>A.mutate({cron_frequency:K}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(qt,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.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(He,{children:"Day of Week"}),r.jsxs(gn,{value:String(h==null?void 0:h.send_day),onValueChange:K=>A.mutate({send_day:parseInt(K)}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:yGt.map(K=>r.jsx(qt,{value:K.value,children:K.label},K.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Time (UTC)"}),r.jsxs(gn,{value:String(h==null?void 0:h.send_hour),onValueChange:K=>A.mutate({send_hour:parseInt(K)}),disabled:(h==null?void 0:h.cron_frequency)==="daily",children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:vGt.map(K=>r.jsx(qt,{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(ee,{onClick:T,disabled:a,variant:"outline",className:"flex-1",children:[r.jsx(el,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),r.jsxs(ee,{onClick:E,disabled:n,className:"flex-1",children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),N>0&&r.jsxs(ee,{onClick:P,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Gl,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${N} Failed`]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(Tn,{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(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"New Resources"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_new_resources,onCheckedChange:K=>A.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(Bn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Community Highlights"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_community_posts,onCheckedChange:K=>A.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(dc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Agent OS Stats"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_agent_os_stats,onCheckedChange:K=>A.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(Os,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Upcoming Events"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_upcoming_events,onCheckedChange:K=>A.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(Kx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Goals Progress"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_goals_progress,onCheckedChange:K=>A.mutate({include_goals_progress:K})})]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Custom Introduction"}),r.jsx(Tn,{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:(h==null?void 0:h.custom_intro_text)||"",onChange:K=>A.mutate({custom_intro_text:K.target.value||null}),rows:3})})]})]}),r.jsx(Sn,{value:"stats",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ua,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(Tn,{children:"Recent digest emails sent to members"})]}),r.jsx(Je,{children:y?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))}):x&&x.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Sent At"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Agent OS"})]})}),r.jsx(Vs,{children:x.map(K=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:K.email_sent_to}),r.jsx(Nt,{children:xn(new Date(K.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(Nt,{children:r.jsx(Ot,{variant:K.delivery_status==="sent"?"default":"destructive",children:K.delivery_status})}),r.jsx(Nt,{children:K.resources_count}),r.jsx(Nt,{children:K.has_agent_os_activity?r.jsx(Ot,{variant:"secondary",children:"Active"}):r.jsx(Ot,{variant:"outline",children:"Not Started"})})]},K.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ua,{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 bGt={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 wGt(){var Se,ge,Le;const t=Vr(),[e,n]=I.useState(""),[s,a]=I.useState(null),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState(""),[y,_]=I.useState(""),[j,C]=I.useState(!0),[N,A]=I.useState(!1),[E,T]=I.useState(""),[P,z]=I.useState(null),{data:F,isLoading:q}=Yt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:ke,error:Be}=await J.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Be)throw Be;const Ee=(ke==null?void 0:ke.map(be=>be.user_id))||[],{data:Ue}=await J.from("profiles").select("id, name, email").in("id",Ee),Fe=new Map((Ue==null?void 0:Ue.map(be=>[be.id,{name:be.name,email:be.email}]))||[]);return ke==null?void 0:ke.map(be=>({...be,profile:Fe.get(be.user_id)||null}))}}),{data:V}=Yt({queryKey:["all-profiles-for-points",F],queryFn:async()=>{const{data:ke,error:Be}=await J.from("profiles").select("id, name, email").order("name");if(Be)throw Be;return ke}}),G=((V==null?void 0:V.filter(ke=>!(F!=null&&F.some(Be=>Be.user_id===ke.id))))||[]).filter(ke=>{var Ee,Ue;if(!E)return!0;const Be=E.toLowerCase();return((Ee=ke.name)==null?void 0:Ee.toLowerCase().includes(Be))||((Ue=ke.email)==null?void 0:Ue.toLowerCase().includes(Be))}),{data:te,isLoading:ie}=Yt({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:ke,error:Be}=await J.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Be)throw Be;return ke},enabled:!!(s!=null&&s.user_id)&&i}),{data:oe}=Yt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:ke,error:Be}=await J.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Be)throw Be;return ke},enabled:!!(s!=null&&s.user_id)}),ye=cr({mutationFn:async({userId:ke,points:Be,reason:Ee})=>{const{error:Ue}=await J.from("agent_points").insert({user_id:ke,points:Be,reason:Ee});if(Ue)throw Ue;const{data:Fe}=await J.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",ke).maybeSingle(),be=((Fe==null?void 0:Fe.total_points)||0)+Be,tt=((Fe==null?void 0:Fe.spendable_points)||0)+Be,{error:Te}=await J.from("agent_attendance_stats").upsert({user_id:ke,total_points:Math.max(0,be),spendable_points:Math.max(0,tt),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"]}),l(!1),x(""),_(""),ze.success(j?"Points awarded successfully!":"Points deducted successfully!")},onError:ke=>{console.error("Error modifying points:",ke),ze.error("Failed to modify points")}}),ae=()=>{if(!s||!p||!y){ze.error("Please fill in all fields");return}const ke=parseInt(p);if(isNaN(ke)||ke<=0){ze.error("Please enter a valid positive number");return}ye.mutate({userId:s.user_id,points:j?ke:-ke,reason:y})},pe=()=>{if(!P||!p||!y){ze.error("Please fill in all fields");return}const ke=parseInt(p);if(isNaN(ke)||ke<=0){ze.error("Please enter a valid positive number");return}ye.mutate({userId:P.id,points:ke,reason:y},{onSuccess:()=>{A(!1),z(null),T("")}})},se=(ke,Be)=>{a(ke),C(Be),l(!0)},he=ke=>{a(ke),h(!0)},ue=F==null?void 0:F.filter(ke=>{var Fe,be,tt,Te;const Be=((be=(Fe=ke.profile)==null?void 0:Fe.name)==null?void 0:be.toLowerCase())||"",Ee=((Te=(tt=ke.profile)==null?void 0:tt.email)==null?void 0:Te.toLowerCase())||"",Ue=e.toLowerCase();return Be.includes(Ue)||Ee.includes(Ue)}),_e=(F==null?void 0:F.reduce((ke,Be)=>ke+Be.total_points,0))||0,Ae=(F==null?void 0:F.length)||0,Ce=Ae>0?Math.round(_e/Ae):0;return q?r.jsx(Lr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(ke=>r.jsx(Ir,{className:"h-24"},ke))}),r.jsx(Ir,{className:"h-96"})]})}):r.jsx(Lr,{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(Bn,{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:Ae}),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(Zi,{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:_e.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(ep,{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:Ce}),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(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:e,onChange:ke=>n(ke.target.value),className:"pl-10"})]}),r.jsxs(ee,{onClick:()=>A(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Agent Leaderboard"}),r.jsx(Tn,{children:"All agents with their points, events, and streaks"})]}),r.jsx(Je,{children:!ue||ue.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Zi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"Total Points"}),r.jsx(It,{className:"text-center",children:"Spendable"}),r.jsx(It,{className:"text-center",children:"Events"}),r.jsx(It,{className:"text-center",children:"Streak"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ue.map((ke,Be)=>{var Ee,Ue,Fe,be;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:Be<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Be===0?"bg-yellow-100 text-yellow-700":Be===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Be+1}):r.jsx("span",{className:"text-muted-foreground",children:Be+1})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{children:((Ue=(Ee=ke.profile)==null?void 0:Ee.name)==null?void 0:Ue.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Fe=ke.profile)==null?void 0:Fe.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(be=ke.profile)==null?void 0:be.email})]})]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),ke.total_points]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Ki,{className:"h-3 w-3 mr-1"}),ke.spendable_points||0]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Os,{className:"h-3 w-3 text-muted-foreground"}),ke.total_events_attended]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(ef,{className:"h-3 w-3 text-orange-500"}),ke.current_streak]})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>se(ke,!0),title:"Award points",children:r.jsx(bn,{className:"h-4 w-4 text-green-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>se(ke,!1),title:"Deduct points",children:r.jsx(j1,{className:"h-4 w-4 text-red-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>he(ke),title:"View history",children:r.jsx(sS,{className:"h-4 w-4"})})]})})]},ke.user_id)})})]})})]}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:j?"Award Points":"Deduct Points"}),r.jsxs(Qn,{children:[j?"Award":"Deduct"," points ",j?"to":"from"," ",((Se=s==null?void 0:s.profile)==null?void 0:Se.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"points",children:"Points Amount"}),r.jsx(dt,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:ke=>x(ke.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"reason",children:"Reason"}),r.jsx(ps,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:ke=>_(ke.target.value)})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:ae,disabled:ye.isPending,className:j?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:ye.isPending?"Saving...":j?"Award Points":"Deduct Points"})]})]})}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:["Point History: ",(ge=s==null?void 0:s.profile)==null?void 0:ge.name]}),r.jsx(Qn,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(Ii,{defaultValue:"history",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsx(nn,{value:"history",children:"Point History"}),r.jsx(nn,{value:"badges",children:"Badges"})]}),r.jsx(Sn,{value:"history",className:"mt-4",children:ie?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(ke=>r.jsx(Ir,{className:"h-12"},ke))}):!te||te.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(sS,{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:te.map(ke=>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:ke.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:xn(new Date(ke.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Ot,{variant:ke.points>=0?"default":"destructive",className:ke.points>=0?"bg-green-100 text-green-800":"",children:[ke.points>=0?"+":"",ke.points]})]},ke.id))})}),r.jsx(Sn,{value:"badges",className:"mt-4",children:!oe||oe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ol,{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:oe.map(ke=>r.jsxs("div",{className:`p-3 rounded-lg ${bGt[ke.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ol,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:ke.badge_name})]}),ke.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:ke.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",xn(new Date(ke.earned_at),"MMM d, yyyy")]})]},ke.id))})})]})]})}),r.jsx(Fr,{open:N,onOpenChange:ke=>{A(ke),ke||(z(null),T(""),x(""),_(""))},children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Award Points to New Agent"}),r.jsx(Qn,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:P?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Ks,{className:"h-10 w-10",children:r.jsx(Zs,{children:((Le=P.name)==null?void 0:Le.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:P.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:P.email})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>z(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(dt,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:ke=>x(ke.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"new-reason",children:"Reason"}),r.jsx(ps,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:ke=>_(ke.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:E,onChange:ke=>T(ke.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:G.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(Bn,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:E?"No matching agents found":"All agents already have points"})]}):G.slice(0,20).map(ke=>{var Be;return r.jsxs("button",{onClick:()=>z(ke),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(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{children:((Be=ke.name)==null?void 0:Be.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:ke.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:ke.email})]})]},ke.id)})})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),P&&r.jsxs(ee,{onClick:pe,disabled:ye.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function jGt(){const{data:t,isLoading:e}=Fit(),[n,s]=I.useState(null),[a,o]=I.useState(!1),[l,i]=I.useState(""),[h,p]=I.useState("all"),[x,y]=I.useState("newest"),[_,j]=I.useState("table"),C=I.useMemo(()=>(t==null?void 0:t.map(P=>P.user_id))||[],[t]),N=I.useMemo(()=>(t==null?void 0:t.map(P=>P.id))||[],[t]),{data:A}=Yt({queryKey:["card-profiles-lookup",C],queryFn:async()=>{if(C.length===0)return{};const{data:P}=await J.from("profiles").select("id, name, email").in("id",C),z={};return P==null||P.forEach(F=>{z[F.id]={name:F.name||"",email:F.email||""}}),z},enabled:C.length>0}),{data:E}=Yt({queryKey:["card-stats-all",N],queryFn:async()=>{if(N.length===0)return{};const P={};N.forEach(q=>{P[q]={views:0,leads:0}});const{data:z}=await J.from("agent_card_interactions").select("card_id").in("card_id",N).eq("interaction_type","card_view");z==null||z.forEach(q=>{P[q.card_id]&&P[q.card_id].views++});const{data:F}=await J.from("agent_card_leads").select("card_id").in("card_id",N);return F==null||F.forEach(q=>{P[q.card_id]&&P[q.card_id].leads++}),P},enabled:N.length>0}),T=I.useMemo(()=>{if(!t)return[];let P=[...t];if(h==="live"?P=P.filter(z=>z.is_published):h==="draft"&&(P=P.filter(z=>!z.is_published)),l.trim()){const z=l.toLowerCase();P=P.filter(F=>{var V,K;const q=A==null?void 0:A[F.user_id];return F.slug.toLowerCase().includes(z)||((V=q==null?void 0:q.name)==null?void 0:V.toLowerCase().includes(z))||((K=q==null?void 0:q.email)==null?void 0:K.toLowerCase().includes(z))})}return x==="newest"?P.sort((z,F)=>new Date(F.created_at).getTime()-new Date(z.created_at).getTime()):x==="oldest"?P.sort((z,F)=>new Date(z.created_at).getTime()-new Date(F.created_at).getTime()):x==="name"?P.sort((z,F)=>{var q,V;return(((q=A==null?void 0:A[z.user_id])==null?void 0:q.name)||"").localeCompare(((V=A==null?void 0:A[F.user_id])==null?void 0:V.name)||"")}):x==="slug"?P.sort((z,F)=>z.slug.localeCompare(F.slug)):x==="views_desc"?P.sort((z,F)=>{var q,V;return(((q=E==null?void 0:E[F.id])==null?void 0:q.views)||0)-(((V=E==null?void 0:E[z.id])==null?void 0:V.views)||0)}):x==="views_asc"?P.sort((z,F)=>{var q,V;return(((q=E==null?void 0:E[z.id])==null?void 0:q.views)||0)-(((V=E==null?void 0:E[F.id])==null?void 0:V.views)||0)}):x==="leads_desc"?P.sort((z,F)=>{var q,V;return(((q=E==null?void 0:E[F.id])==null?void 0:q.leads)||0)-(((V=E==null?void 0:E[z.id])==null?void 0:V.leads)||0)}):x==="leads_asc"&&P.sort((z,F)=>{var q,V;return(((q=E==null?void 0:E[z.id])==null?void 0:q.leads)||0)-(((V=E==null?void 0:E[F.id])==null?void 0:V.leads)||0)}),P},[t,h,l,x,A]);return r.jsxs(Lr,{title:"Digital Agent Cards",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:"Digital Agent Cards"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage agent digital business cards"})]}),r.jsxs(ee,{onClick:()=>o(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or slug...",value:l,onChange:P=>i(P.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:h,onValueChange:p,children:[r.jsx(fn,{className:"w-full sm:w-36",children:r.jsx(yn,{placeholder:"Status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"live",children:"Live"}),r.jsx(qt,{value:"draft",children:"Draft"})]})]}),r.jsxs(gn,{value:x,onValueChange:y,children:[r.jsx(fn,{className:"w-full sm:w-44",children:r.jsx(yn,{placeholder:"Sort by"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"newest",children:"Newest First"}),r.jsx(qt,{value:"oldest",children:"Oldest First"}),r.jsx(qt,{value:"name",children:"Name A–Z"}),r.jsx(qt,{value:"slug",children:"Slug A–Z"}),r.jsx(qt,{value:"views_desc",children:"Most Views"}),r.jsx(qt,{value:"views_asc",children:"Fewest Views"}),r.jsx(qt,{value:"leads_desc",children:"Most Leads"}),r.jsx(qt,{value:"leads_asc",children:"Fewest Leads"})]})]}),r.jsxs("div",{className:"flex border rounded-md",children:[r.jsx(ee,{variant:_==="table"?"default":"ghost",size:"sm",onClick:()=>j("table"),className:"rounded-r-none",children:r.jsx(gS,{className:"h-4 w-4"})}),r.jsx(ee,{variant:_==="grid"?"default":"ghost",size:"sm",onClick:()=>j("grid"),className:"rounded-l-none",children:r.jsx(Yf,{className:"h-4 w-4"})})]})]}),!e&&t&&t.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",T.length," of ",t.length," cards"]}),e?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(P=>r.jsx(Ir,{className:"h-48"},P))}):T.length>0?_==="table"?r.jsx(kGt,{cards:T,cardProfiles:A,cardStats:E,onEdit:s,sortBy:x,setSortBy:y}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:T.map(P=>r.jsx(NGt,{card:P,onEdit:()=>s(P),stats:E==null?void 0:E[P.id]},P.id))}):t&&t.length>0?r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(wa,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No matching cards"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Try adjusting your search or filters"})]})}):r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Bn,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No cards yet"}),r.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Create your first digital agent card"}),r.jsxs(ee,{onClick:()=>o(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(SGt,{open:a,onOpenChange:o}),n&&r.jsx(CGt,{card:n,open:!!n,onOpenChange:P=>!P&&s(null)})]})}function kGt({cards:t,cardProfiles:e,cardStats:n,onEdit:s,sortBy:a,setSortBy:o}){const l=h=>{a===`${h}_desc`?o(`${h}_asc`):o(`${h}_desc`)},i=({field:h})=>a===`${h}_desc`?r.jsx($x,{className:"h-3 w-3"}):a===`${h}_asc`?r.jsx(Zf,{className:"h-3 w-3"}):r.jsx(xg,{className:"h-3 w-3 opacity-40"});return r.jsx(Ye,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b bg-muted/50",children:[r.jsx("th",{className:"text-left p-3 font-medium",children:r.jsxs("button",{onClick:()=>{o(a==="name"?"newest":"name")},className:"flex items-center gap-1 hover:text-foreground text-muted-foreground",children:["Agent ",a==="name"&&r.jsx(Zf,{className:"h-3 w-3"})]})}),r.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground hidden md:table-cell",children:"Slug"}),r.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Status"}),r.jsx("th",{className:"text-right p-3 font-medium",children:r.jsxs("button",{onClick:()=>l("views"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Views ",r.jsx(i,{field:"views"})]})}),r.jsx("th",{className:"text-right p-3 font-medium",children:r.jsxs("button",{onClick:()=>l("leads"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Leads ",r.jsx(i,{field:"leads"})]})}),r.jsx("th",{className:"text-right p-3 font-medium text-muted-foreground",children:"Actions"})]})}),r.jsx("tbody",{children:t.map(h=>{const p=e==null?void 0:e[h.user_id],x=n==null?void 0:n[h.id],y=`https://cards.relevelup.com/${h.slug}`;return r.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/30 transition-colors",children:[r.jsx("td",{className:"p-3",children:r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:(p==null?void 0:p.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(p==null?void 0:p.email)||""})]})}),r.jsx("td",{className:"p-3 hidden md:table-cell",children:r.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["/",h.slug]})}),r.jsx("td",{className:"p-3 text-center",children:r.jsx(Ot,{variant:h.is_published?"default":"secondary",className:"text-xs",children:h.is_published?"Live":"Draft"})}),r.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(x==null?void 0:x.views)??0}),r.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(x==null?void 0:x.leads)??0}),r.jsx("td",{className:"p-3",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>s(h),className:"h-8 w-8 p-0",children:r.jsx(fi,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(y),ze.success("Link copied!")},children:r.jsx(Qo,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",asChild:!0,children:r.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Ls,{className:"h-3.5 w-3.5"})})})]})})]},h.id)})})]})})})}function NGt({card:t,onEdit:e,stats:n}){const[s,a]=I.useState(null);I.useEffect(()=>{(async()=>{const{data:h}=await J.from("profiles").select("name").eq("id",t.user_id).single();let p=null;try{const{data:x}=await J.storage.from("avatars").list(`${t.user_id}`);if(x&&x.length>0){const{data:y}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${x[0].name}`);p=y.publicUrl}}catch{}a({name:(h==null?void 0:h.name)||"Unknown",avatar_url:p})})()},[t.user_id]);const o=`https://cards.relevelup.com/${t.slug}`,l=()=>{navigator.clipboard.writeText(o),ze.success("Link copied!")};return r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:(s==null?void 0:s.avatar_url)||void 0}),r.jsx(Zs,{children:((s==null?void 0:s.name)||"U")[0]})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold truncate",children:(s==null?void 0:s.name)||"Loading..."}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["/card/",t.slug]})]}),r.jsx(Ot,{variant:t.is_published?"default":"secondary",children:t.is_published?"Live":"Draft"})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(el,{className:"h-3.5 w-3.5"}),(n==null?void 0:n.views)??0," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bn,{className:"h-3.5 w-3.5"}),(n==null?void 0:n.leads)??0," leads"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:e,className:"flex-1",children:[r.jsx(fi,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:r.jsx(Qo,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Ls,{className:"h-3 w-3"})})})]})]})})}function SGt({open:t,onOpenChange:e}){const[n,s]=I.useState(""),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState(!1),x=vLe(),y=l.trim(),{data:_}=Yt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let T=J.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(T=T.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:P}=await T;return P||[]},enabled:t}),[j,C]=I.useState(null),N=(_==null?void 0:_.find(T=>T.id===n))||j,A=()=>{if(!n||!a.trim()){ze.error("Select an agent and enter a slug");return}x.mutate({user_id:n,slug:a.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{e(!1),s(""),o(""),i("")}})},E=T=>{var z;s(T),p(!1);const P=_==null?void 0:_.find(F=>F.id===T);P&&(C(P),o(((z=P.name)==null?void 0:z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create Agent Card"}),r.jsx(Qn,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Agent"}),r.jsxs(hu,{open:h,onOpenChange:p,children:[r.jsx(fu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":h,className:"w-full justify-between font-normal",children:[N?`${N.name} (${N.email})`:"Search for an agent...",r.jsx(p1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Bd,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs(W1,{shouldFilter:!1,children:[r.jsx(G1,{placeholder:"Search by name or email...",value:l,onValueChange:i}),r.jsxs(K1,{children:[r.jsx(Z1,{children:"No agents found."}),r.jsx(Y1,{children:(_||[]).map(T=>r.jsxs(X1,{value:T.id,onSelect:E,children:[r.jsx(Ai,{className:zt("mr-2 h-4 w-4",n===T.id?"opacity-100":"opacity-0")}),T.name," (",T.email,")"]},T.id))})]})]})})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"URL Slug"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"/card/"}),r.jsx(dt,{value:a,onChange:T=>o(T.target.value),placeholder:"john-doe"})]})]}),r.jsx(ee,{onClick:A,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function CGt({card:t,open:e,onOpenChange:n}){const s=_Le(),{data:a}=bLe(t.id),o=Vr(),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(!1),[_,j]=I.useState(""),[C,N]=I.useState(t.slug),[A,E]=I.useState(!1),[T,P]=I.useState({is_published:t.is_published,theme:t.theme,title:t.title||"",positioning_statement:t.positioning_statement||"",bio:t.bio||"",review_snippet:t.review_snippet||"",review_source_url:t.review_source_url||"",booking_url:t.booking_url||"",custom_cta_label:t.custom_cta_label||"",custom_cta_url:t.custom_cta_url||"",show_photo:t.show_photo,show_bio:t.show_bio,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||"",brokerage_logo_url:t.brokerage_logo_url||"",brokerage_logo_size:t.brokerage_logo_size||56,team_name:t.team_name||"",team_logo_url:t.team_logo_url||"",team_logo_size:t.team_logo_size||56});I.useEffect(()=>{e&&(async()=>{try{const{data:te}=await J.storage.from("avatars").list(`${t.user_id}`);if(te&&te.length>0){const{data:ie}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${te[0].name}`);i(`${ie.publicUrl}?t=${Date.now()}`)}}catch{}})()},[t.user_id,e]);const z=G=>{var oe;const te=(oe=G.target.files)==null?void 0:oe[0];if(!te)return;if(!te.type.startsWith("image/")){ze.error("Please select an image file");return}if(te.size>5*1024*1024){ze.error("Image must be under 5MB");return}const ie=new FileReader;ie.onloadend=()=>{j(ie.result),y(!0)},ie.readAsDataURL(te),G.target.value=""},F=async G=>{p(!0);try{const{data:te}=await J.storage.from("avatars").list(`${t.user_id}`);te&&te.length>0&&await J.storage.from("avatars").remove(te.map(pe=>`${t.user_id}/${pe.name}`));const ie=`${t.user_id}/avatar.jpg`,{error:oe}=await J.storage.from("avatars").upload(ie,G,{upsert:!0,contentType:"image/jpeg"});if(oe)throw oe;const{data:ye}=J.storage.from("avatars").getPublicUrl(ie),ae=`${ye.publicUrl}?t=${Date.now()}`;i(ae),await J.from("profiles").update({avatar_url:ae}).eq("id",t.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),ze.success("Photo updated!")}catch(te){ze.error(te.message||"Upload failed")}finally{p(!1)}},q=async()=>{const G=C.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!G){ze.error("Please enter a valid URL");return}if(G===t.slug){ze.info("No changes to save");return}E(!0);try{const{data:te}=await J.from("agent_cards").select("id").eq("slug",G).neq("id",t.id).maybeSingle();if(te){ze.error("This URL is already taken. Try another one.");return}const{error:ie}=await J.from("agent_cards").update({slug:G}).eq("id",t.id);if(ie)throw ie;N(G),o.invalidateQueries({queryKey:["agent-cards-admin"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{E(!1)}},V=async(G,te)=>{var oe;const ie=(oe=G.target.files)==null?void 0:oe[0];if(ie){if(!ie.type.startsWith("image/")){ze.error("Please select an image file");return}try{const ye=ie.name.split(".").pop()||"png",ae=te==="brokerage_logo_url"?"brokerage-logo":"team-logo",pe=`${t.user_id}/${ae}.${ye}`,{error:se}=await J.storage.from("card-logos").upload(pe,ie,{upsert:!0});if(se)throw se;const{data:he}=J.storage.from("card-logos").getPublicUrl(pe),ue=he.publicUrl+"?t="+Date.now();P(te==="brokerage_logo_url"?_e=>({..._e,[te]:ue,brokerage_display_name:""}):_e=>({..._e,[te]:ue,team_name:""})),ze.success("Logo uploaded!")}catch{ze.error("Failed to upload logo")}finally{G.target.value=""}}},K=()=>{s.mutate({id:t.id,...T,title:T.title||null,positioning_statement:T.positioning_statement||null,bio:T.bio||null,review_snippet:T.review_snippet||null,review_source_url:T.review_source_url||null,booking_url:T.booking_url||null,custom_cta_label:T.custom_cta_label||null,custom_cta_url:T.custom_cta_url||null,brokerage_display_name:T.brokerage_display_name||null,brokerage_logo_url:T.brokerage_logo_url||null,brokerage_logo_size:T.brokerage_logo_size,team_name:T.team_name||null,team_logo_url:T.team_logo_url||null,team_logo_size:T.team_logo_size},{onSuccess:()=>n(!1)})};return r.jsxs(r.Fragment,{children:[r.jsx(Fr,{open:e,onOpenChange:n,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Agent Card"}),r.jsxs(Qn,{children:["/card/",t.slug]})]}),r.jsxs(Ii,{defaultValue:"content",children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(nn,{value:"content",className:"flex-1",children:"Content"}),r.jsx(nn,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(nn,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(nn,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(Sn,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Published"}),r.jsx(Ps,{checked:T.is_published,onCheckedChange:G=>P(te=>({...te,is_published:G}))})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(Ks,{className:"h-16 w-16",children:[r.jsx(Ei,{src:l||void 0}),r.jsx(Zs,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:z,disabled:h}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,disabled:h,children:r.jsx("span",{children:h?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(dt,{value:C,onChange:G=>N(G.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:q,disabled:A||C===t.slug,className:"shrink-0",children:A?"Saving...":"Update"})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Theme"}),r.jsxs(gn,{value:T.theme,onValueChange:G=>P(te=>({...te,theme:G})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"standard",children:"✨ Standard (Modern Clean)"}),r.jsx(qt,{value:"luxury",children:"🌙 Luxury (Dark & Gold)"}),r.jsx(qt,{value:"bold",children:"🔥 Bold (Vibrant & Punchy)"}),r.jsx(qt,{value:"classic",children:"📋 Classic (Professional)"})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Title / Tagline"}),r.jsx(dt,{value:T.title,onChange:G=>P(te=>({...te,title:G.target.value})),placeholder:"e.g. Luxury Real Estate Specialist"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shown below the agent's name on the card"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Positioning Statement"}),r.jsx(dt,{value:T.positioning_statement,onChange:G=>P(te=>({...te,positioning_statement:G.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Bio"}),r.jsx(ps,{value:T.bio,onChange:G=>P(te=>({...te,bio:G.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Review Snippet"}),r.jsx(dt,{value:T.review_snippet,onChange:G=>P(te=>({...te,review_snippet:G.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Review Source URL"}),r.jsx(dt,{value:T.review_source_url,onChange:G=>P(te=>({...te,review_source_url:G.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(dt,{value:T.booking_url,onChange:G=>P(te=>({...te,booking_url:G.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Custom CTA Label (optional)"}),r.jsx(dt,{value:T.custom_cta_label,onChange:G=>P(te=>({...te,custom_cta_label:G.target.value})),placeholder:"Book a Call"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Custom CTA URL (optional)"}),r.jsx(dt,{value:T.custom_cta_url,onChange:G=>P(te=>({...te,custom_cta_url:G.target.value})),placeholder:"https://example.com/landing"})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(dt,{value:T.brokerage_display_name,onChange:G=>P(te=>({...te,brokerage_display_name:G.target.value,brokerage_logo_url:""})),placeholder:"Brokerage name (or upload logo below)",disabled:!!T.brokerage_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[T.brokerage_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:T.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${T.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>P(G=>({...G,brokerage_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(uo,{className:"h-3.5 w-3.5"}),T.brokerage_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G=>V(G,"brokerage_logo_url")})]})]}),T.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.brokerage_logo_size||56,"px"]})]}),r.jsx(um,{value:[T.brokerage_logo_size||56],onValueChange:([G])=>P(te=>({...te,brokerage_logo_size:G})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(dt,{value:T.team_name,onChange:G=>P(te=>({...te,team_name:G.target.value,team_logo_url:""})),placeholder:"Team name (or upload logo below)",disabled:!!T.team_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[T.team_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:T.team_logo_url,alt:"Team logo",style:{height:`${T.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>P(G=>({...G,team_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(uo,{className:"h-3.5 w-3.5"}),T.team_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G=>V(G,"team_logo_url")})]})]}),T.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.team_logo_size||56,"px"]})]}),r.jsx(um,{value:[T.team_logo_size||56],onValueChange:([G])=>P(te=>({...te,team_logo_size:G})),min:24,max:120,step:4})]})]})]})]}),r.jsx(Sn,{value:"sections",className:"space-y-4 mt-4",children:[{key:"show_photo",label:"Show Photo",hint:"Photo is pulled from the agent's profile."},{key:"show_bio",label:"Show Bio"},{key:"show_credentials",label:"Show Credentials"},{key:"show_social_links",label:"Show Social Links"},{key:"show_save_contact",label:"Save Contact Button"},{key:"show_leave_review",label:"Leave Review Button"},{key:"show_refer_friend",label:"Refer a Friend Button"}].map(({key:G,label:te,hint:ie})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(He,{children:te}),ie&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ie," ",G==="show_photo"&&r.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),r.jsx(Ps,{checked:T[G],onCheckedChange:oe=>P(ye=>({...ye,[G]:oe}))})]},G))}),r.jsx(Sn,{value:"blocks",className:"mt-4",children:r.jsx(L$e,{cardId:t.id})}),r.jsx(Sn,{value:"analytics",className:"mt-4",children:a?r.jsxs("div",{className:"space-y-4",children:[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-2xl font-bold",children:a.views}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.clicks}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.leads.length}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),a.leads.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Recent Leads"}),r.jsx("div",{className:"space-y-2",children:a.leads.slice(0,5).map(G=>r.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[r.jsx("span",{className:"font-medium",children:G.name}),G.phone&&r.jsxs("span",{className:"text-muted-foreground",children:[" · ",G.phone]}),G.intent&&r.jsx(Ot,{variant:"secondary",className:"ml-2 text-xs",children:G.intent})]},G.id))})]})]}):r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),r.jsx(ee,{onClick:K,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})}),r.jsx(wxe,{open:x,onClose:()=>y(!1),imageSrc:_,onCropComplete:F,aspectRatio:1})]})}const FS={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"},A0e={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 E0e(t=!0){return Yt({queryKey:["marketplace-categories",t],queryFn:async()=>{let e=J.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 MGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("marketplace_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category created successfully")},onError:e=>{ze.error("Failed to create category: "+e.message)}})}function TGt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("marketplace_categories").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category updated successfully")},onError:e=>{ze.error("Failed to update category: "+e.message)}})}function AGt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("marketplace_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category deleted successfully")},onError:e=>{ze.error("Failed to delete category: "+e.message)}})}function Z$e(t,e=!0){return Yt({queryKey:["marketplace-products",t,e],queryFn:async()=>{let n=J.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:a}=await n;if(a)throw a;return s}})}function EGt(t){return Yt({queryKey:["marketplace-product",t],queryFn:async()=>{const{data:e,error:n}=await J.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 IGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("marketplace_products").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product created successfully")},onError:e=>{ze.error("Failed to create product: "+e.message)}})}function PGt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("marketplace_products").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.id]}),ze.success("Product updated successfully")},onError:e=>{ze.error("Failed to update product: "+e.message)}})}function LGt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("marketplace_products").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product deleted successfully")},onError:e=>{ze.error("Failed to delete product: "+e.message)}})}function OGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.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 DGt(){const t=Vr();return cr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await J.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]}),ze.success("Image deleted successfully")},onError:e=>{ze.error("Failed to delete image: "+e.message)}})}function RGt(){const t=Vr();return cr({mutationFn:async({imageId:e,productId:n})=>{const{error:s}=await J.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:a}=await J.from("marketplace_product_images").update({is_primary:!0}).eq("id",e);if(a)throw a;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),ze.success("Primary image updated")},onError:e=>{ze.error("Failed to set primary image: "+e.message)}})}function FGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.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]}),ze.success("Variant added successfully")}})}function zGt(){const t=Vr();return cr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await J.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]}),ze.success("Variant deleted successfully")}})}function BGt(){const t=Vr();return cr({mutationFn:async({productId:e,videoUrl:n})=>{await J.from("marketplace_product_videos").delete().eq("product_id",e);const{data:s,error:a}=await J.from("marketplace_product_videos").insert({product_id:e,video_url:n}).select().single();if(a)throw a;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.productId]}),ze.success("Video updated successfully")}})}function $Gt(t){const{isAdmin:e}=Xr();return Yt({queryKey:["marketplace-orders",t,e],queryFn:async()=>{let n=J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:a}=await n;if(a)throw a;if(e&&s){const o=[...new Set(s.map(h=>h.user_id))],{data:l}=await J.from("profiles").select("id, name, email").in("id",o),i=new Map((l==null?void 0:l.map(h=>[h.id,h]))||[]);return s.map(h=>({...h,user:i.get(h.user_id)}))}return s}})}function UGt(){const{user:t}=Xr();return Yt({queryKey:["my-marketplace-orders",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.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 qGt(t){return Yt({queryKey:["marketplace-order",t],queryFn:async()=>{const{data:e,error:n}=await J.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 VGt(){const t=Vr(),{user:e}=Xr();return cr({mutationFn:async({orderId:n,status:s,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const h={status:s};o!==void 0&&(h.tracking_number=o),l!==void 0&&(h.tracking_url=l);const{error:p}=await J.from("marketplace_orders").update(h).eq("id",n);if(p)throw p;const{error:x}=await J.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:a,created_by:e==null?void 0:e.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==i)try{await J.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:l}})}catch(_){console.error("Failed to send notification email:",_)}},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Order status updated")},onError:n=>{ze.error("Failed to update order: "+n.message)}})}function HGt(){const t=Vr();return cr({mutationFn:async({itemId:e,proofUrl:n,proofNotes:s,orderId:a})=>{const{error:o}=await J.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",e);if(o)throw o;await J.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",a);try{await J.functions.invoke("marketplace-order-notify",{body:{orderId:a,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return a},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof uploaded & customer notified")}})}function WGt(){const t=Vr();return cr({mutationFn:async({itemId:e,orderId:n})=>{const{error:s}=await J.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"]}),ze.success("Proof approved")}})}function GGt(){const t=Vr();return cr({mutationFn:async({itemId:e,orderId:n,reason:s})=>{const{error:a}=await J.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",e);if(a)throw a;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof rejected - please upload a new proof")}})}function KGt(){const{data:t,isLoading:e}=E0e(!1),n=MGt(),s=TGt(),a=AGt(),[o,l]=I.useState(!1),[i,h]=I.useState(null),[p,x]=I.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),h(null)},_=N=>{h(N),x({name:N.name,description:N.description||"",image_url:N.image_url||"",sort_order:N.sort_order,is_active:N.is_active}),l(!0)},j=async N=>{N.preventDefault(),i?await s.mutateAsync({id:i.id,...p}):await n.mutateAsync(p),l(!1),y()},C=async N=>{confirm("Are you sure you want to delete this category?")&&await a.mutateAsync(N)};return e?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(N=>r.jsx(Ir,{className:"h-12 w-full"},N))})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Categories"}),r.jsxs(Fr,{open:o,onOpenChange:N=>{l(N),N||y()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:i?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:p.name,onChange:N=>x({...p,name:N.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:p.description,onChange:N=>x({...p,description:N.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"image_url",children:"Image URL"}),r.jsx(dt,{id:"image_url",value:p.image_url,onChange:N=>x({...p,image_url:N.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(dt,{id:"sort_order",type:"number",value:p.sort_order,onChange:N=>x({...p,sort_order:parseInt(N.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_active",checked:p.is_active,onCheckedChange:N=>x({...p,is_active:N})}),r.jsx(He,{htmlFor:"is_active",children:"Active"})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),r.jsx(Je,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Sort Order"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:N.name}),r.jsx(Nt,{className:"max-w-xs truncate",children:N.description}),r.jsx(Nt,{children:N.sort_order}),r.jsx(Nt,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${N.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:N.is_active?"Active":"Inactive"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(N),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>C(N.id),disabled:a.isPending,children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},N.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function ZGt(){var Ce,Se;const{data:t,isLoading:e}=Z$e(void 0,!1),{data:n}=E0e(!1),s=IGt(),a=PGt(),o=LGt(),l=OGt(),i=DGt(),h=RGt(),p=FGt(),x=zGt(),y=BGt(),[_,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,P]=I.useState(null),[z,F]=I.useState(null),[q,V]=I.useState(!1),[K,G]=I.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}),[te,ie]=I.useState({name:"",price_adjustment:0}),[oe,ye]=I.useState(""),ae=()=>{G({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),P(null)},pe=ge=>{P(ge),G({name:ge.name,description:ge.description||"",base_price:Number(ge.base_price),shipping_fee:Number(ge.shipping_fee),category_id:ge.category_id||"",allow_artwork_upload:ge.allow_artwork_upload,requires_proof_approval:ge.requires_proof_approval,is_active:ge.is_active,sort_order:ge.sort_order}),j(!0)},se=async ge=>{ge.preventDefault();const Le={...K,category_id:K.category_id||null};T?await a.mutateAsync({id:T.id,...Le}):await s.mutateAsync(Le),j(!1),ae()},he=async ge=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ge)},ue=async ge=>{if(!z||!ge.target.files||ge.target.files.length===0)return;V(!0);const Le=ge.target.files[0],ke=Le.name.split(".").pop(),Be=`products/${z.id}/${Date.now()}.${ke}`;try{const{error:Ee}=await J.storage.from("marketplace").upload(Be,Le);if(Ee)throw Ee;const{data:{publicUrl:Ue}}=J.storage.from("marketplace").getPublicUrl(Be);await l.mutateAsync({product_id:z.id,image_url:Ue,is_primary:!z.images||z.images.length===0}),ze.success("Image uploaded successfully")}catch(Ee){ze.error("Failed to upload image: "+Ee.message)}finally{V(!1)}},_e=async ge=>{ge.preventDefault(),z&&(await p.mutateAsync({product_id:z.id,name:te.name,price_adjustment:te.price_adjustment}),ie({name:"",price_adjustment:0}))},Ae=async()=>{!z||!oe||(await y.mutateAsync({productId:z.id,videoUrl:oe}),ye(""))};return e?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Ir,{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(ge=>r.jsx(Ir,{className:"h-64 w-full"},ge))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Products"}),r.jsxs(Fr,{open:_,onOpenChange:ge=>{j(ge),ge||ae()},children:[r.jsx(Bo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:se,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(He,{htmlFor:"name",children:"Product Name"}),r.jsx(dt,{id:"name",value:K.name,onChange:ge=>G({...K,name:ge.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"category",children:"Category"}),r.jsxs(gn,{value:K.category_id,onValueChange:ge=>G({...K,category_id:ge}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:n==null?void 0:n.map(ge=>r.jsx(qt,{value:ge.id,children:ge.name},ge.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:K.description,onChange:ge=>G({...K,description:ge.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(He,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(dt,{id:"base_price",type:"number",step:"0.01",min:"0",value:K.base_price,onChange:ge=>G({...K,base_price:parseFloat(ge.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(dt,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:K.shipping_fee,onChange:ge=>G({...K,shipping_fee:parseFloat(ge.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(dt,{id:"sort_order",type:"number",value:K.sort_order,onChange:ge=>G({...K,sort_order:parseInt(ge.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"allow_artwork_upload",checked:K.allow_artwork_upload,onCheckedChange:ge=>G({...K,allow_artwork_upload:ge})}),r.jsx(He,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"requires_proof_approval",checked:K.requires_proof_approval,onCheckedChange:ge=>G({...K,requires_proof_approval:ge})}),r.jsx(He,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_active",checked:K.is_active,onCheckedChange:ge=>G({...K,is_active:ge})}),r.jsx(He,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:s.isPending||a.isPending,children:T?"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(ge=>{var Le,ke;return r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[ge.images&&ge.images.length>0?r.jsx("img",{src:((Le=ge.images.find(Be=>Be.is_primary))==null?void 0:Le.image_url)||ge.images[0].image_url,alt:ge.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"}),!ge.is_active&&r.jsx(Ot,{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:ge.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((ke=ge.category)==null?void 0:ke.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(ge.base_price).toFixed(2)]}),Number(ge.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(ge.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[ge.allow_artwork_upload&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ge.requires_proof_approval&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Proof Required"}),ge.variants&&ge.variants.length>0&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:[ge.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>pe(ge),children:[r.jsx(fi,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{F(ge),N(!0)},children:[r.jsx(aS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{F(ge),E(!0)},children:[r.jsx(Ng,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>he(ge.id),children:r.jsx(Vn,{className:"h-3 w-3 text-destructive"})})]})]})]},ge.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(Fr,{open:C,onOpenChange:N,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Manage Images - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(Ce=z==null?void 0:z.images)==null?void 0:Ce.map(ge=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:ge.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),ge.is_primary&&r.jsx(Ot,{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:[!ge.is_primary&&r.jsx(ee,{variant:"secondary",size:"icon",onClick:async()=>{var Le;await h.mutateAsync({imageId:ge.id,productId:z.id}),F({...z,images:(Le=z.images)==null?void 0:Le.map(ke=>({...ke,is_primary:ke.id===ge.id}))})},disabled:h.isPending,title:"Set as primary",children:r.jsx(vs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:async()=>{var ke;await i.mutateAsync({id:ge.id,productId:z.id});const Le=t==null?void 0:t.find(Be=>Be.id===z.id);Le&&F({...Le,images:(ke=Le.images)==null?void 0:ke.filter(Be=>Be.id!==ge.id)})},disabled:i.isPending,children:r.jsx(Vn,{className:"h-4 w-4"})})]})]},ge.id))}),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:"image-upload",disabled:q}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(aS,{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(He,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(dt,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:oe,onChange:ge=>ye(ge.target.value)}),r.jsxs(ee,{onClick:Ae,disabled:!oe,children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(z==null?void 0:z.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",z.video.video_url]})]})]})]})}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:["Manage Variants - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:_e,className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Variant name (e.g., 500 count)",value:te.name,onChange:ge=>ie({...te,name:ge.target.value}),required:!0}),r.jsx(dt,{type:"number",step:"0.01",placeholder:"Price adj.",value:te.price_adjustment,onChange:ge=>ie({...te,price_adjustment:parseFloat(ge.target.value)||0}),className:"w-32"}),r.jsx(ee,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(Se=z==null?void 0:z.variants)==null?void 0:Se.map(ge=>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:ge.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(ge.price_adjustment)>=0?"+":"","$",Number(ge.price_adjustment).toFixed(2)]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:ge.id,productId:z.id}),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]},ge.id)),(!(z!=null&&z.variants)||z.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 YGt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function XGt(){var N,A,E;const{data:t,isLoading:e}=$Gt(),n=VGt(),s=HGt(),[a,o]=I.useState(null),[l,i]=I.useState(!1),[h,p]=I.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=I.useState(!1),_=T=>{o(T),p({status:T.status,notes:"",trackingNumber:T.tracking_number||"",trackingUrl:T.tracking_url||""}),i(!0)},j=async()=>{a&&(await n.mutateAsync({orderId:a.id,status:h.status,notes:h.notes,trackingNumber:h.trackingNumber,trackingUrl:h.trackingUrl,previousStatus:a.status}),i(!1))},C=async(T,P)=>{if(!a||!T.target.files||T.target.files.length===0)return;y(!0);const z=T.target.files[0],F=z.name.split(".").pop(),q=`proofs/${a.id}/${P}/${Date.now()}.${F}`;try{const{error:V}=await J.storage.from("marketplace").upload(q,z);if(V)throw V;const{data:{publicUrl:K}}=J.storage.from("marketplace").getPublicUrl(q);await s.mutateAsync({itemId:P,proofUrl:K,orderId:a.id}),ze.success("Proof uploaded successfully")}catch(V){ze.error("Failed to upload proof: "+V.message)}finally{y(!1)}};return e?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Ir,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Orders"})}),r.jsx(Je,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Order #"}),r.jsx(It,{children:"Customer"}),r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Total"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(T=>{var P,z;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono",children:T.order_number}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((P=T.user)==null?void 0:P.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(z=T.user)==null?void 0:z.email})]})}),r.jsx(Nt,{children:xn(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(Nt,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(Nt,{children:r.jsx(Ot,{className:A0e[T.status],children:FS[T.status]})}),r.jsx(Nt,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>_(T),children:[r.jsx(el,{className:"h-4 w-4 mr-1"}),"View"]})})]},T.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Order ",a==null?void 0:a.order_number]})}),a&&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:(N=a.user)==null?void 0:N.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(A=a.user)==null?void 0:A.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:a.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.shipping_address,r.jsx("br",{}),a.shipping_city,", ",a.shipping_state," ",a.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:(E=a.items)==null?void 0:E.map(T=>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:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(T.unit_price).toFixed(2)," x ",T.quantity]})]}),T.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:T.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(Ot,{variant:T.proof_status==="approved"?"default":"secondary",children:T.proof_status||"No proof yet"})]}),T.proof_url?r.jsx("a",{href:T.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:P=>C(P,T.id),className:"hidden",id:`proof-${T.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${T.id}`,children:r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(uo,{className:"h-4 w-4 mr-1"}),x?"Uploading...":"Upload Proof"]})})})]})]})})]},T.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(a.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(a.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(a.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(He,{children:"Status"}),r.jsxs(gn,{value:h.status,onValueChange:T=>p({...h,status:T}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:YGt.map(T=>r.jsx(qt,{value:T,children:FS[T]},T))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Tracking Number"}),r.jsx(dt,{value:h.trackingNumber,onChange:T=>p({...h,trackingNumber:T.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Tracking URL"}),r.jsx(dt,{value:h.trackingUrl,onChange:T=>p({...h,trackingUrl:T.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes (optional)"}),r.jsx(ps,{value:h.notes,onChange:T=>p({...h,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(ee,{onClick:j,disabled:n.isPending,className:"w-full",children:[r.jsx(zl,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),a.status_history&&a.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:a.status_history.map(T=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Ot,{variant:"outline",children:FS[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:xn(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function QGt(){const[t,e]=I.useState("products"),n=Zn();return r.jsx(Lr,{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(ee,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(Ii,{value:t,onValueChange:e,children:[r.jsxs(wi,{className:"grid w-full grid-cols-3",children:[r.jsxs(nn,{value:"products",className:"flex items-center gap-2",children:[r.jsx(zl,{className:"h-4 w-4"}),"Products"]}),r.jsxs(nn,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(qx,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(nn,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(ph,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Sn,{value:"products",children:r.jsx(ZGt,{})}),r.jsx(Sn,{value:"categories",children:r.jsx(KGt,{})}),r.jsx(Sn,{value:"orders",children:r.jsx(XGt,{})})]})]})})}function Y$e(){return Yt({queryKey:["reward-categories"],queryFn:async()=>{const{data:t,error:e}=await J.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(e)throw e;return t}})}function JGt(t){return Yt({queryKey:["reward-items",t],queryFn:async()=>{let e=J.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 eKt(t){return Yt({queryKey:["active-reward-items",t],queryFn:async()=>{let e=J.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 tKt(t){return Yt({queryKey:["user-purchases",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.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 rKt(){return Yt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:t,error:e}=await J.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(l=>l.user_id))],{data:s,error:a}=await J.from("profiles").select("id, name, email").in("id",n);if(a)throw a;const o=new Map((s==null?void 0:s.map(l=>[l.id,l]))||[]);return t.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function nKt(t){return Yt({queryKey:["spendable-points",t],queryFn:async()=>{if(!t)return 0;const{data:e,error:n}=await J.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 sKt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.rpc("purchase_reward_item",{p_item_id:e});if(s)throw s;const a=n;if(!a.success)throw new Error(a.error||"Purchase failed");return a},onSuccess:()=>{t.invalidateQueries({queryKey:["user-purchases"]}),t.invalidateQueries({queryKey:["spendable-points"]}),t.invalidateQueries({queryKey:["active-reward-items"]}),t.invalidateQueries({queryKey:["reward-items"]})}})}function aKt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("reward_store_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function iKt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("reward_store_categories").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function oKt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("reward_store_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function lKt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.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 cKt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("reward_store_items").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function dKt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.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 uKt(t){const e=t.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return e?{bucket:e[1],path:e[2]}:null}async function ude(t,e){const n=uKt(t);if(n)try{const{data:s,error:a}=await J.storage.from(n.bucket).download(n.path);if(a){console.error("Error downloading file:",a),ze.error("Failed to download file");return}const o=URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=e||n.path.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("Download error:",s),ze.error("Failed to download file")}else try{const a=await(await fetch(t)).blob(),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=e||t.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("External download error:",s),ze.error("Failed to download file")}}function X$e(){return Yt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:t,error:e}=await J.from("point_reward_settings").select("*").order("action_name");if(e)throw e;return t}})}function hKt(){const t=Vr();return cr({mutationFn:async({id:e,points:n,is_active:s})=>{const a={points:n};s!==void 0&&(a.is_active=s);const{data:o,error:l}=await J.from("point_reward_settings").update(a).eq("id",e).select().single();if(l)throw l;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["point-reward-settings"]})}})}function fKt(){const{user:t}=Xr(),[e,n]=I.useState("items"),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(""),[j,C]=I.useState(null),[N,A]=I.useState(!1),[E,T]=I.useState(null),[P,z]=I.useState(""),[F,q]=I.useState(""),[V,K]=I.useState(null),[G,te]=I.useState(""),[ie,oe]=I.useState("file"),[ye,ae]=I.useState(""),[pe,se]=I.useState(""),[he,ue]=I.useState(""),[_e,Ae]=I.useState(!0),[Ce,Se]=I.useState(null),[ge,Le]=I.useState(!1),[ke,Be]=I.useState(!1),Ee=I.useRef(null),Ue=I.useRef(null),{data:Fe,isLoading:be}=Y$e(),{data:tt,isLoading:Te}=JGt(),{data:Ke,isLoading:me}=rKt(),{data:yt,isLoading:rt}=X$e(),at=aKt(),Me=iKt(),ft=oKt(),qe=lKt(),Oe=cKt(),Qe=dKt(),nt=hKt(),[gt,mt]=I.useState({}),Mt=hr=>{hr?(l(hr),h(hr.name),x(hr.description||""),_(hr.icon||"")):(l(null),h(""),x(""),_("")),a(!0)},wt=async()=>{if(!i.trim()){ze.error("Please enter a category name");return}try{o?(await Me.mutateAsync({id:o.id,name:i,description:p||null,icon:y||null}),ze.success("Category updated successfully")):(await at.mutateAsync({name:i,description:p||null,icon:y||null,sort_order:((Fe==null?void 0:Fe.length)||0)+1}),ze.success("Category created successfully")),a(!1)}catch(hr){console.error("Error saving category:",hr),ze.error("Failed to save category")}},Qt=async()=>{if(j)try{await ft.mutateAsync(j),ze.success("Category deleted successfully"),C(null)}catch(hr){console.error("Error deleting category:",hr),ze.error("Failed to delete category")}},Cr=hr=>{var xs;hr?(T(hr),z(hr.name),q(hr.description||""),K(hr.category_id),te(hr.points_cost.toString()),oe(hr.item_type),ae(hr.file_url||""),se(hr.preview_image_url||""),ue(((xs=hr.max_quantity)==null?void 0:xs.toString())||""),Ae(hr.is_active)):(T(null),z(""),q(""),K(null),te(""),oe("file"),ae(""),se(""),ue(""),Ae(!0)),A(!0)},cn=async(hr,xs)=>{xs==="file"?Le(!0):Be(!0);try{const ka=hr.name.split(".").pop(),xa=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ka}`,zi=`${xs==="file"?"items":"previews"}/${xa}`,{error:Bi}=await J.storage.from("reward-store").upload(zi,hr);if(Bi)throw Bi;const{data:{publicUrl:nl}}=J.storage.from("reward-store").getPublicUrl(zi);xs==="file"?ae(nl):se(nl),ze.success("File uploaded successfully")}catch(ka){console.error("Error uploading file:",ka),ze.error("Failed to upload file")}finally{xs==="file"?Le(!1):Be(!1)}},jn=async()=>{if(!P.trim()){ze.error("Please enter an item name");return}if(!G||parseInt(G)<0){ze.error("Please enter a valid points cost");return}try{const hr={name:P,description:F||null,category_id:V,points_cost:parseInt(G),item_type:ie,file_url:ye||null,preview_image_url:pe||null,max_quantity:he?parseInt(he):null,current_quantity:he?parseInt(he):null,is_active:_e,created_by:t==null?void 0:t.id};E?(await Oe.mutateAsync({id:E.id,...hr,current_quantity:E.max_quantity!==(he?parseInt(he):null)?he?parseInt(he):null:E.current_quantity}),ze.success("Item updated successfully")):(await qe.mutateAsync(hr),ze.success("Item created successfully")),A(!1)}catch(hr){console.error("Error saving item:",hr),ze.error("Failed to save item")}},Qr=async()=>{if(Ce)try{await Qe.mutateAsync(Ce),ze.success("Item deleted successfully"),Se(null)}catch(hr){console.error("Error deleting item:",hr),ze.error("Failed to delete item")}},Pn=async(hr,xs)=>{const ka=gt[hr];if(ka===void 0||ka===xs.toString())return;const xa=parseInt(ka);if(isNaN(xa)||xa<0){ze.error("Please enter a valid positive number");return}try{await nt.mutateAsync({id:hr,points:xa}),ze.success("Points updated successfully"),mt(zi=>{const Bi={...zi};return delete Bi[hr],Bi})}catch(zi){console.error("Error updating points:",zi),ze.error("Failed to update points")}};return be||Te||me||rt?r.jsx(Lr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx(Ir,{className:"h-96"})]})}):r.jsxs(Lr,{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(zl,{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:(tt==null?void 0:tt.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(tt==null?void 0:tt.filter(hr=>hr.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(qx,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Fe==null?void 0:Fe.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(vs,{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:[tt&&tt.length>0?Math.round(tt.reduce((hr,xs)=>hr+xs.points_cost,0)/tt.length):0," pts"]})]})})]}),r.jsxs(Ii,{value:e,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsx(nn,{value:"items",children:"Items"}),r.jsx(nn,{value:"categories",children:"Categories"}),r.jsx(nn,{value:"purchases",children:"Purchases"}),r.jsx(nn,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Sn,{value:"items",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Store Items"}),r.jsx(Tn,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(ee,{onClick:()=>Cr(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(Je,{children:!tt||tt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ki,{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(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Item"}),r.jsx(It,{children:"Category"}),r.jsx(It,{className:"text-center",children:"Cost"}),r.jsx(It,{className:"text-center",children:"Type"}),r.jsx(It,{className:"text-center",children:"Quantity"}),r.jsx(It,{className:"text-center",children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:tt.map(hr=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[hr.preview_image_url?r.jsx("img",{src:hr.preview_image_url,alt:hr.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(Ki,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:hr.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:hr.description||"No description"})]})]})}),r.jsx(Nt,{children:hr.category?r.jsx(Ot,{variant:"outline",children:hr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),hr.points_cost]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[hr.item_type==="file"?r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Co,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:hr.item_type})]})}),r.jsx(Nt,{className:"text-center",children:hr.max_quantity!==null?r.jsxs("span",{className:hr.current_quantity===0?"text-red-500":"",children:[hr.current_quantity,"/",hr.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(Nt,{className:"text-center",children:r.jsx(Ot,{variant:hr.is_active?"default":"secondary",children:hr.is_active?"Active":"Inactive"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Cr(hr),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Se(hr.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},hr.id))})]})})]})}),r.jsx(Sn,{value:"categories",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Categories"}),r.jsx(Tn,{children:"Organize your store items into categories"})]}),r.jsxs(ee,{onClick:()=>Mt(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Je,{children:!Fe||Fe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(qx,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center",children:"Items"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:Fe.map(hr=>r.jsxs(Ar,{children:[r.jsxs(Nt,{className:"font-medium",children:[hr.icon&&r.jsx("span",{className:"mr-2",children:hr.icon}),hr.name]}),r.jsx(Nt,{className:"text-muted-foreground",children:hr.description||"—"}),r.jsx(Nt,{className:"text-center",children:(tt==null?void 0:tt.filter(xs=>xs.category_id===hr.id).length)||0}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Mt(hr),children:r.jsx(fi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>C(hr.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},hr.id))})]})})]})}),r.jsx(Sn,{value:"purchases",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ph,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(Tn,{children:"View all reward redemptions by agents"})]}),r.jsx(Je,{children:!Ke||Ke.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ph,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Item"}),r.jsx(It,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Vs,{children:Ke.map(hr=>{var xs,ka,xa,zi;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-muted-foreground",children:xn(new Date(hr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(Nt,{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(Ic,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((xs=hr.user)==null?void 0:xs.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((ka=hr.user)==null?void 0:ka.email)||"—"})]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(xa=hr.item)!=null&&xa.preview_image_url?r.jsx("img",{src:hr.item.preview_image_url,alt:hr.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(Ki,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((zi=hr.item)==null?void 0:zi.name)||"Deleted item"})]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),hr.points_spent]})})]},hr.id)})})]})})]})})]})]}),r.jsx(Fr,{open:s,onOpenChange:a,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:o?"Edit Category":"Add Category"}),r.jsx(Qn,{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(He,{htmlFor:"categoryName",children:"Name"}),r.jsx(dt,{id:"categoryName",value:i,onChange:hr=>h(hr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(ps,{id:"categoryDescription",value:p,onChange:hr=>x(hr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(dt,{id:"categoryIcon",value:y,onChange:hr=>_(hr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{onClick:wt,disabled:at.isPending||Me.isPending,children:at.isPending||Me.isPending?"Saving...":"Save"})]})]})}),r.jsx(Fr,{open:N,onOpenChange:A,children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:E?"Edit Item":"Add Item"}),r.jsx(Qn,{children:E?"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(He,{htmlFor:"itemName",children:"Name *"}),r.jsx(dt,{id:"itemName",value:P,onChange:hr=>z(hr.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemDescription",children:"Description"}),r.jsx(ps,{id:"itemDescription",value:F,onChange:hr=>q(hr.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(He,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(gn,{value:V||"none",onValueChange:hr=>K(hr==="none"?null:hr),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No category"}),Fe==null?void 0:Fe.map(hr=>r.jsxs(qt,{value:hr.id,children:[hr.icon&&`${hr.icon} `,hr.name]},hr.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(dt,{id:"itemPointsCost",type:"number",min:"0",value:G,onChange:hr=>te(hr.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(He,{htmlFor:"itemType",children:"Type"}),r.jsxs(gn,{value:ie,onValueChange:oe,children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"file",children:"File Download"}),r.jsx(qt,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(dt,{id:"itemMaxQuantity",type:"number",min:"1",value:he,onChange:hr=>ue(hr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:ye,onChange:hr=>ae(hr.target.value),placeholder:ie==="file"?"Upload a file or paste URL":"Paste external link"}),ie==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var hr;return(hr=Ee.current)==null?void 0:hr.click()},disabled:ge,children:r.jsx(uo,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ee,type:"file",className:"hidden",onChange:hr=>{var ka;const xs=(ka=hr.target.files)==null?void 0:ka[0];xs&&cn(xs,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:pe,onChange:hr=>se(hr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var hr;return(hr=Ue.current)==null?void 0:hr.click()},disabled:ke,children:r.jsx(Pl,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ue,type:"file",accept:"image/*",className:"hidden",onChange:hr=>{var ka;const xs=(ka=hr.target.files)==null?void 0:ka[0];xs&&cn(xs,"preview")}})]}),pe&&r.jsx("img",{src:pe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"itemIsActive",checked:_e,onCheckedChange:Ae}),r.jsx(He,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(ee,{onClick:jn,disabled:qe.isPending||Oe.isPending,children:qe.isPending||Oe.isPending?"Saving...":"Save"})]})]})}),r.jsx(Ou,{open:!!j,onOpenChange:()=>C(null),children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Delete Category"}),r.jsx(ou,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:Qt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(Ou,{open:!!Ce,onOpenChange:()=>Se(null),children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Delete Item"}),r.jsx(ou,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:Qr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e==="point-settings"&&r.jsxs(Ye,{className:"mt-4",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(md,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Point Reward Settings"}),r.jsx(Tn,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(Je,{children:!yt||yt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(md,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center w-32",children:"Points"}),r.jsx(It,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Vs,{children:yt.map(hr=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx("p",{className:"font-medium",children:hr.action_name})}),r.jsx(Nt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:hr.description})}),r.jsx(Nt,{className:"text-center",children:r.jsx(dt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:gt[hr.id]??hr.points.toString(),onChange:xs=>mt(ka=>({...ka,[hr.id]:xs.target.value}))})}),r.jsx(Nt,{className:"text-right",children:r.jsx(ee,{size:"sm",variant:"outline",disabled:gt[hr.id]===void 0||gt[hr.id]===hr.points.toString()||nt.isPending,onClick:()=>Pn(hr.id,hr.points),children:r.jsx(bg,{className:"h-4 w-4"})})})]},hr.id))})]})})]})]})}function pKt(){const t=Vr(),[e,n]=I.useState(!1),{data:s,isLoading:a}=Yt({queryKey:["social-accounts"],queryFn:async()=>{const{data:p,error:x}=await J.from("social_accounts").select("*").order("created_at",{ascending:!1});if(x)throw x;return p}}),o=cr({mutationFn:async p=>{const{error:x}=await J.from("social_accounts").delete().eq("id",p);if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),l=async()=>{n(!0);try{const{data:p,error:x}=await J.functions.invoke("meta-oauth",{body:{action:"get_auth_url"}});if(x)throw x;if(p!=null&&p.authUrl)window.location.href=p.authUrl;else throw new Error("Failed to get authorization URL")}catch(p){console.error("Meta OAuth error:",p),ze.error("Failed to start connection. Make sure Meta App credentials are configured."),n(!1)}},i=(s==null?void 0:s.filter(p=>p.platform==="facebook"))||[],h=(s==null?void 0:s.filter(p=>p.platform==="instagram"))||[];return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Ku,{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(Gt,{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(zd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Facebook"}),r.jsx(Tn,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[i.length>0?r.jsx("div",{className:"space-y-3",children:i.map(p=>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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:p.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(zd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:p.page_name||p.platform_username||"Facebook Page"}),r.jsx(Ot,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Disconnect Facebook?"}),r.jsx(ou,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Facebook accounts connected"}),r.jsxs(ee,{onClick:l,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{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(du,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Instagram"}),r.jsx(Tn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[h.length>0?r.jsx("div",{className:"space-y-3",children:h.map(p=>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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:p.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(du,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",p.platform_username||"Instagram Account"]}),r.jsx(Ot,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Disconnect Instagram?"}),r.jsx(ou,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Instagram accounts connected"}),r.jsxs(ee,{onClick:l,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{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(Gt,{children:[r.jsx(Zt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(Tn,{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(ee,{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(Ls,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const mKt={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 eT(t,e=18,n=10){return t.length<=e+n+3?t:`${t.slice(0,e)}…${t.slice(-n)}`}function gKt(){var ie,oe,ye,ae,pe;const t=Vr(),[e,n]=I.useState("Test Push"),[s,a]=I.useState("Testing web push notification"),[o,l]=I.useState("/community"),[i,h]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[j,C]=I.useState(null),[N,A]=I.useState(null),{data:E,isLoading:T}=Yt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:se,error:he}=await J.from("push_notification_settings").select("*").order("setting_key");if(he)throw he;return se}}),{data:P,isLoading:z}=Yt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:se,error:he}=await J.from("push_subscriptions").select("*",{count:"exact",head:!0});if(he)throw he;return{totalSubscriptions:se||0}}}),F=cr({mutationFn:async({settingKey:se,isEnabled:he})=>{const{error:ue}=await J.from("push_notification_settings").update({is_enabled:he}).eq("setting_key",se);if(ue)throw ue},onSuccess:()=>{t.invalidateQueries({queryKey:["push-notification-settings"]}),ze.success("Notification setting updated")},onError:se=>{ze.error("Failed to update setting: "+se.message)}}),q=I.useMemo(()=>{var se,he;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((se=y.serviceWorker)==null?void 0:se.activeState)??"unknown"} · sub=${(he=y.subscription)!=null&&he.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);I.useEffect(()=>{let se=!0;const he=async()=>{var Ce,Se,ge,Le,ke,Be,Ee;const _e="serviceWorker"in navigator&&"PushManager"in window,Ae={isSupported:_e,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((Ce=navigator.serviceWorker)!=null&&Ce.controller)};if(!_e){se&&_(Ae);return}try{const{data:Ue,error:Fe}=await J.functions.invoke("get-vapid-public-key",{body:{}});if(Fe)throw Fe;Ae.vapidPublicKey=Ue==null?void 0:Ue.vapidPublicKey;const tt=(await navigator.serviceWorker.getRegistrations()).find(Te=>{var me,yt,rt;return(((me=Te.active)==null?void 0:me.scriptURL)||((yt=Te.waiting)==null?void 0:yt.scriptURL)||((rt=Te.installing)==null?void 0:rt.scriptURL)||"").includes("/sw.js")});if(tt){Ae.pushWorkerScriptUrl=((Se=tt.active)==null?void 0:Se.scriptURL)||((ge=tt.waiting)==null?void 0:ge.scriptURL)||((Le=tt.installing)==null?void 0:Le.scriptURL),Ae.serviceWorker={scope:tt.scope,activeState:(ke=tt.active)==null?void 0:ke.state};const Te=await tt.pushManager.getSubscription();if(Te){const Ke=Te.toJSON();Ae.subscription={endpoint:Ke.endpoint,p256dh:(Be=Ke.keys)==null?void 0:Be.p256dh,auth:(Ee=Ke.keys)==null?void 0:Ee.auth}}}}catch(Ue){Ae.error=(Ue==null?void 0:Ue.message)||String(Ue)}se&&_(Ae)};he();const ue=window.setInterval(he,4e3);return()=>{se=!1,window.clearInterval(ue)}},[]);const V=async()=>{if(typeof Notification>"u"){ze.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){ze.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),ze.success("Triggered a local notification (not push).")}catch(se){ze.error(`Local notification failed: ${(se==null?void 0:se.message)||String(se)}`)}},K=async()=>{h(!0),C(null);try{const{data:se,error:he}=await J.functions.invoke("send-push-notification",{body:{title:e,body:s,url:o}});if(he)throw he;C({sent:se==null?void 0:se.sent,failed:se==null?void 0:se.failed,expiredCleaned:se==null?void 0:se.expiredCleaned,vapidPublicKey:se==null?void 0:se.vapidPublicKey}),(se==null?void 0:se.sent)>0?ze.success(`Test notification sent to ${se.sent} subscriber(s)`):(se==null?void 0:se.failed)>0?ze.warning(`Notification failed for ${se.failed} subscriber(s). ${se.expired||0} expired subscriptions cleaned up.`):ze.info("No active subscriptions to send to")}catch(se){console.error("Error sending test notification:",se),C({error:(se==null?void 0:se.message)||String(se)}),ze.error("Failed to send test notification: "+(se.message||"Unknown error"))}finally{h(!1)}},G=async()=>{x(!0),A(null);try{const{data:se,error:he}=await J.functions.invoke("generate-vapid-keys",{body:{}});if(he)throw he;const ue=se==null?void 0:se.publicKey,_e=se==null?void 0:se.privateKey;if(!ue||!_e)throw new Error("generate-vapid-keys did not return keys");A({publicKey:ue,privateKey:_e}),ze.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(se){console.error("Error generating VAPID keys:",se),ze.error("Failed to generate VAPID keys: "+((se==null?void 0:se.message)||"Unknown error"))}finally{x(!1)}},te=cr({mutationFn:async()=>{const{error:se}=await J.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(se)throw se},onSuccess:()=>{ze.success("All subscriptions cleared. Users will need to re-enable notifications."),t.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:se=>{ze.error("Failed to clear subscriptions: "+se.message)}});return r.jsx(Lr,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ku,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(Tn,{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:z?"...":(P==null?void 0:P.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(md,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(Tn,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(Je,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:E==null?void 0:E.map(se=>{const he=mKt[se.setting_key]||{label:se.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:he.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:he.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:se.description})]})]}),r.jsx(Ps,{checked:se.is_enabled,onCheckedChange:ue=>F.mutate({settingKey:se.setting_key,isEnabled:ue}),disabled:F.isPending})]},se.id)})})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(yg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(Tn,{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}),y.error&&r.jsx("div",{className:"mt-2 text-destructive",children:y.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:y.vapidPublicKey?eT(y.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: ",(ie=y.serviceWorker)!=null&&ie.scope?eT(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((oe=y.serviceWorker)==null?void 0:oe.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: ",(ye=y.subscription)!=null&&ye.endpoint?eT(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ae=y.subscription)!=null&&ae.p256dh?eT(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(pe=y.subscription)!=null&&pe.auth?eT(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(ee,{variant:"outline",onClick:V,children:"Local notification test"}),r.jsx(ee,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(dt,{id:"test-title",value:e,onChange:se=>n(se.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(ps,{id:"test-body",value:s,onChange:se=>a(se.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(dt,{id:"test-url",value:o,onChange:se=>l(se.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(ee,{onClick:K,disabled:i||!e||!s,className:"w-full sm:w-auto",children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Test Notification"]}),j&&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"}),j.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",j.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",j.sent??0," sent, ",j.failed??0," failed, ",j.expiredCleaned??0," expired cleaned"]}),j.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:j.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(Tn,{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(ee,{variant:"destructive",onClick:()=>te.mutate(),disabled:te.isPending,children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),te.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(ee,{variant:"outline",onClick:G,disabled:p,children:p?"Generating…":"Generate VAPID keys"})}),N&&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:N.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:N.privateKey})]})]})]})]})]})]})})}function xKt(){const[t]=qd(),e=Zn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Processing connection...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),h=t.get("error"),p=t.get("error_description"),x=t.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Failed to connect: "+(p||h));return}if(!i){s("error"),o("No authorization code received"),ze.error("Failed to connect: No authorization code");return}try{const{data:y,error:_}=await J.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x}});if(_)throw _;if(y!=null&&y.success)s("success"),o(y.message||"Accounts connected successfully!"),ze.success(y.message||"Social accounts connected!");else throw new Error((y==null?void 0:y.error)||"Failed to connect accounts")}catch(y){console.error("Callback error:",y),s("error"),o(y.message||"Failed to complete connection"),ze.error(y.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(Gt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(en,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(Yi,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(Vc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Zt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Tn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>e("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function yKt(){const t=Zn(),e=Vr(),{isAdmin:n}=Xr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState(null),{data:p,isLoading:x}=Yt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:F},error:q}=await J.auth.getUser();if(q)throw q;if(!F)return[];const{data:V,error:K}=await J.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(K)throw K;return V}}),y=cr({mutationFn:async F=>{const{data:{user:q},error:V}=await J.auth.getUser();if(V)throw V;if(!q)throw new Error("Not authenticated");const{error:K}=await J.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"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),_=async()=>{a(!0);try{const{data:F,error:q}=await J.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),ze.error("Failed to start connection. Please try again."),a(!1)}},j=async()=>{a(!0);try{const{data:F,error:q}=await J.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),ze.error("Failed to start LinkedIn connection. Please try again."),a(!1)}},C=async()=>{a(!0);try{const{data:F,error:q}=await J.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),ze.error("Failed to start Google connection. Please try again."),a(!1)}},N=(p==null?void 0:p.filter(F=>F.platform==="facebook"))||[],A=(p==null?void 0:p.filter(F=>F.platform==="instagram"))||[],E=(p==null?void 0:p.filter(F=>F.platform==="linkedin"))||[],T=(p==null?void 0:p.filter(F=>F.platform==="google_business"))||[],P=((p==null?void 0:p.length)||0)>0,z=async(F,q)=>{l(F),h(null);try{const{data:V,error:K}=await J.functions.invoke("meta-api-test",{body:{testType:"all",accountId:F}});if(K)throw K;h(V.results||[]),ze.success(V.summary||"API tests completed")}catch(V){console.error("Meta API test error:",V),ze.error("Failed to run API tests")}finally{l(null)}};return r.jsx(Lr,{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(Ot,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ms,{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(ee,{variant:"ghost",onClick:()=>t("/social-swag-2"),className:"gap-2",children:[r.jsx(so,{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(Ya,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Ot,{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:[P&&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(Yi,{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(Gt,{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(zd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Facebook"}),r.jsx(Tn,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):N.length>0?r.jsx("div",{className:"space-y-3",children:N.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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(zd,{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(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Disconnect Facebook?"}),r.jsx(ou,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>y.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(ee,{onClick:_,disabled:s,className:"w-full gap-2",variant:N.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),N.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{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(du,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Instagram"}),r.jsx(Tn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(du,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",F.platform_username||"Instagram Account"]}),r.jsx(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Disconnect Instagram?"}),r.jsx(ou,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>y.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(ee,{onClick:_,disabled:s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),A.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(Gt,{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(xm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"LinkedIn"}),r.jsx(Tn,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):E.length>0?r.jsx("div",{className:"space-y-3",children:E.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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(xm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.platform_username||"LinkedIn Account"}),r.jsx(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Disconnect LinkedIn?"}),r.jsx(ou,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>y.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(ee,{onClick:j,disabled:s,className:"w-full gap-2",variant:E.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),E.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(Ot,{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(Ot,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Gt,{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(Mo,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Google Business"}),r.jsx(Tn,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{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(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(Mo,{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(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ou,{children:[r.jsx(Q0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Disconnect Google Business?"}),r.jsx(ou,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:()=>y.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(ee,{onClick:n?C:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),T.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&&(N.length>0||A.length>0)&&r.jsxs(Ye,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Gt,{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(mj,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(Tn,{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:[N.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(zd,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:F.page_name||"Facebook Page"})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(mj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${F.id}`)),A.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(du,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",F.platform_username||"Instagram"]})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(mj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${F.id}`))]}),i&&i.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:i.map((F,q)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[F.status==="success"?r.jsx(Xi,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):F.status==="pending"?r.jsx(en,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(Vc,{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(Gt,{children:r.jsx(Zt,{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 vKt(){const[t]=qd(),e=Zn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Processing your connection...");return I.useEffect(()=>{(async()=>{var y;const i=t.get("code"),h=t.get("error"),p=t.get("error_description"),x=t.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!i){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:_,error:j}=await J.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/social-connections/callback"}});if(j)throw j;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||0} account(s)!`),ze.success("Social accounts connected successfully!");else throw new Error((_==null?void 0:_.error)||"Unknown error")}catch(_){console.error("OAuth callback error:",_),s("error"),o(_ instanceof Error?_.message:"Failed to connect accounts"),ze.error("Failed to connect: "+(_ instanceof Error?_.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(Gt,{className:"text-center",children:[n==="loading"&&r.jsx(en,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Yi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Vc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Zt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Tn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function _Kt(){const[t]=qd(),e=Zn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your Google Business Profile...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),h=t.get("error"),p=t.get("error_description"),x=t.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!i){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:y,error:_}=await J.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:i,state:x}});if(_)throw _;if(y!=null&&y.success)s("success"),o(y.message||"Successfully connected Google Business Profile!"),ze.success("Google Business Profile connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Google OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Google Business Profile"),ze.error("Failed to connect: "+(y instanceof Error?y.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(Gt,{className:"text-center",children:[n==="loading"&&r.jsx(en,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Yi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Vc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Zt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Tn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function bKt(){const[t]=qd(),e=Zn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your LinkedIn account...");return I.useEffect(()=>{(async()=>{var y;const i=t.get("code"),h=t.get("state"),p=t.get("error"),x=t.get("error_description");if(p){console.error("LinkedIn OAuth error:",p,x),s("error"),o(x||"Failed to connect LinkedIn account"),ze.error(x||"Failed to connect LinkedIn");return}if(!i){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:_,error:j}=await J.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:i,state:h,callbackPath:"/social-connections/linkedin-callback"}});if(j)throw j;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||1} LinkedIn account`),ze.success("LinkedIn connected successfully!");else throw new Error((_==null?void 0:_.error)||"Failed to connect LinkedIn account")}catch(_){console.error("LinkedIn callback error:",_),s("error"),o(_ instanceof Error?_.message:"Failed to connect LinkedIn account"),ze.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(Gt,{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(en,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(Yi,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(Vc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Zt,{className:"flex items-center justify-center gap-2",children:[r.jsx(xm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Tn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>e("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function wKt(){const t=Zn(),[e,n]=I.useState(null),{data:s,isLoading:a}=Z$e(e||void 0,!0),{data:o,isLoading:l}=E0e(!0),{cartItems:i}=xse(),h=i.reduce((x,y)=>x+y.quantity,0),p=x=>{t(`/marketplace/${x.id}`)};return a||l?r.jsx(Lr,{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(x=>r.jsx(Ir,{className:"h-10 w-24 flex-shrink-0"},x))}),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(x=>r.jsx(Ir,{className:"h-72 w-full"},x))})]})}):r.jsx(Lr,{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(ee,{variant:"outline",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(ph,{className:"h-4 w-4 mr-2"}),"Cart",h>0&&r.jsx(Ot,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:h})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(ee,{variant:e===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(ee,{variant:e===x.id?"default":"outline",size:"sm",onClick:()=>n(x.id),children:x.name},x.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(x=>{var y;return r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>p(x),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[x.images&&x.images.length>0?r.jsx("img",{src:((y=x.images.find(_=>_.is_primary))==null?void 0:y.image_url)||x.images[0].image_url,alt:x.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(zl,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Ot,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(Je,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{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 Q$e=I.forwardRef(({...t},e)=>r.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));Q$e.displayName="Breadcrumb";const J$e=I.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}));J$e.displayName="BreadcrumbList";const fee=I.forwardRef(({className:t,...e},n)=>r.jsx("li",{ref:n,className:zt("inline-flex items-center gap-1.5",t),...e}));fee.displayName="BreadcrumbItem";const Fpe=I.forwardRef(({asChild:t,className:e,...n},s)=>{const a=t?Dme:"a";return r.jsx(a,{ref:s,className:zt("transition-colors hover:text-foreground",e),...n})});Fpe.displayName="BreadcrumbLink";const eUe=I.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}));eUe.displayName="BreadcrumbPage";const zpe=({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(Vi,{})});zpe.displayName="BreadcrumbSeparator";function jKt(){var ye,ae;const{productId:t}=Yc(),e=Zn(),{data:n,isLoading:s}=EGt(t||""),{addToCart:a,cartItems:o}=xse(),[l,i]=I.useState(null),[h,p]=I.useState(1),[x,y]=I.useState(0),[_,j]=I.useState(null),[C,N]=I.useState(!1),[A,E]=I.useState(!1),T=(ye=n==null?void 0:n.variants)==null?void 0:ye.find(pe=>pe.id===l),P=((ae=n==null?void 0:n.variants)==null?void 0:ae.filter(pe=>pe.is_active))||[],z=Number((n==null?void 0:n.base_price)||0),F=T?Number(T.price_adjustment):0,q=z+F,V=Number((n==null?void 0:n.shipping_fee)||0),K=o.reduce((pe,se)=>pe+se.quantity,0),G=async pe=>{if(!pe.target.files||pe.target.files.length===0)return;N(!0);const se=pe.target.files[0],he=se.name.split(".").pop(),ue=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${he}`;try{const{error:_e}=await J.storage.from("marketplace").upload(ue,se);if(_e)throw _e;const{data:{publicUrl:Ae}}=J.storage.from("marketplace").getPublicUrl(ue);j(Ae),ze.success("Artwork uploaded successfully")}catch(_e){ze.error("Failed to upload artwork: "+_e.message)}finally{N(!1)}},te=()=>{if(n){if(P.length>0&&!l){ze.error("Please select an option");return}a(n,T||void 0,h,_||void 0),E(!0),ze.success("Added to cart!"),setTimeout(()=>E(!1),2e3)}},ie=()=>{n!=null&&n.images&&y(pe=>(pe+1)%n.images.length)},oe=()=>{n!=null&&n.images&&y(pe=>(pe-1+n.images.length)%n.images.length)};return s?r.jsx(Lr,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Ir,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ir,{className:"h-8 w-3/4"}),r.jsx(Ir,{className:"h-6 w-1/4"}),r.jsx(Ir,{className:"h-24 w-full"}),r.jsx(Ir,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Lr,{title:n.name,children:[r.jsx(Q$e,{className:"mb-6",children:r.jsxs(J$e,{children:[r.jsx(fee,{children:r.jsx(Fpe,{asChild:!0,children:r.jsx(co,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(zpe,{}),r.jsx(fee,{children:r.jsx(Fpe,{asChild:!0,children:r.jsx(co,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(zpe,{}),r.jsx(fee,{children:r.jsx(eUe,{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[x].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(ee,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:oe,children:r.jsx(Ac,{className:"h-6 w-6"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ie,children:r.jsx(Vi,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(zl,{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((pe,se)=>r.jsx("button",{onClick:()=>y(se),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${se===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:pe.image_url,alt:"",className:"w-full h-full object-cover"})},pe.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(Ot,{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)]}),V>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",V.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})}),P.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:P.map(pe=>r.jsxs(ee,{variant:l===pe.id?"default":"outline",onClick:()=>i(pe.id),children:[pe.name,Number(pe.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(pe.price_adjustment)>0?"+":"","$",Number(pe.price_adjustment).toFixed(2),")"]})]},pe.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Upload Your Artwork (Optional)"}),_?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:_,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(ee,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>j(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:G,className:"hidden",id:"artwork-upload",disabled:C}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(uo,{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(He,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(pe=>Math.max(1,pe-1)),children:"-"}),r.jsx(dt,{type:"number",value:h,onChange:pe=>p(Math.max(1,parseInt(pe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(pe=>pe+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(ee,{size:"lg",className:"flex-1",onClick:te,disabled:A,children:A?r.jsxs(r.Fragment,{children:[r.jsx(Ai,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(ph,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(ee,{variant:"outline",size:"lg",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(ph,{className:"h-5 w-5"}),K>0&&r.jsx(Ot,{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(Lr,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{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(ee,{onClick:()=>e("/marketplace"),children:"Back to Marketplace"})]})})}function kKt(){const t=Zn(),{cartItems:e,removeFromCart:n,updateQuantity:s,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:h}=xse(),[p,x]=I.useState(!1),[y,_]=I.useState(""),j=async()=>{if(e.length===0){ze.error("Your cart is empty");return}x(!0);try{const{data:C,error:N}=await J.functions.invoke("marketplace-checkout",{body:{items:e.map(A=>{var E;return{product_id:A.product.id,variant_id:((E=A.variant)==null?void 0:E.id)||null,quantity:A.quantity,artwork_url:A.artworkUrl||null}}),notes:y.trim()||null}});if(N)throw N;if(C!=null&&C.url)h(),window.open(C.url,"_blank");else throw new Error("No checkout URL received")}catch(C){ze.error("Checkout failed: "+C.message)}finally{x(!1)}};return e.length===0?r.jsx(Lr,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(wg,{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(ee,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Lr,{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 N,A;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:((N=C.product.images.find(E=>E.is_primary))==null?void 0:N.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(wg,{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:["$",a(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(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return n(C.product.id,(E=C.variant)==null?void 0:E.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(C.product.id,(E=C.variant)==null?void 0:E.id,C.quantity-1)},disabled:C.quantity<=1,children:r.jsx(j1,{className:"h-3 w-3"})}),r.jsx(dt,{type:"number",value:C.quantity,onChange:E=>{var T;return s(C.product.id,(T=C.variant)==null?void 0:T.id,parseInt(E.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(C.product.id,(E=C.variant)==null?void 0:E.id,C.quantity+1)},children:r.jsx(bn,{className:"h-3 w-3"})})]})]})]})})},`${C.product.id}-${((A=C.variant)==null?void 0:A.id)||"base"}`)}),r.jsx(ee,{variant:"ghost",className:"text-destructive",onClick:h,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ye,{className:"sticky top-4",children:[r.jsx(Gt,{children:r.jsx(Zt,{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,N)=>C+N.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:["$",l().toFixed(2)]})]}),r.jsx(cu,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",i().toFixed(2)]})]}),r.jsx(cu,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(ps,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:C=>_(C.target.value),rows:3,className:"resize-none"})]}),r.jsx(ee,{className:"w-full",size:"lg",onClick:j,disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(hl,{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 NKt(){const t=Zn(),{data:e,isLoading:n}=UGt();return n?r.jsx(Lr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Ir,{className:"h-32 w-full"},s))})}):!e||e.length===0?r.jsx(Lr,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{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(ee,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Lr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:e.map(s=>{var a,o,l;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:xn(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Ot,{className:A0e[s.status],children:FS[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:[(a=s.items)==null?void 0:a.slice(0,3).map((i,h)=>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-h},children:[i.quantity,"×"]},i.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:`${(l=s.items)==null?void 0:l.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(ee,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Ls,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Vi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const _5e=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function SKt({currentStatus:t,statusHistory:e}){const n=_5e.indexOf(t);return r.jsx("div",{className:"space-y-3",children:_5e.map((s,a)=>{const o=e==null?void 0:e.find(p=>p.status===s),l=an;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 ${l?"bg-green-500 text-white":i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:l?r.jsx(Xi,{className:"h-4 w-4"}):i?r.jsx(Ya,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:a+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${h?"text-muted-foreground":""}`,children:FS[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[xn(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function CKt(){var E;const{orderId:t}=Yc(),e=Zn(),{data:n,isLoading:s,refetch:a}=qGt(t||""),o=WGt(),l=GGt(),[i,h]=I.useState(!1),[p,x]=I.useState(null),[y,_]=I.useState(""),[j,C]=I.useState(null),N=async T=>{C(T);try{await o.mutateAsync({orderId:t,itemId:T}),ze.success("Proof approved!"),a()}catch{ze.error("Failed to approve proof")}finally{C(null)}},A=async()=>{if(p){C(p);try{await l.mutateAsync({orderId:t,itemId:p,reason:y}),ze.success("Revision requested"),h(!1),_(""),x(null),a()}catch{ze.error("Failed to request revision")}finally{C(null)}}};return s?r.jsx(Lr,{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(Ir,{className:"h-64 w-full"}),r.jsx(Ir,{className:"h-48 w-full"})]}),r.jsx(Ir,{className:"h-96 w-full"})]})}):n?r.jsxs(Lr,{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(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Order Status"}),r.jsx(Ot,{className:A0e[n.status],children:FS[n.status]})]}),r.jsx(Je,{children:r.jsx(SKt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Items"})}),r.jsx(Je,{className:"space-y-4",children:(E=n.items)==null?void 0:E.map(T=>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:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",T.quantity," × $",Number(T.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(T.unit_price)*T.quantity).toFixed(2)]})]}),T.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:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(x1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Ls,{className:"h-3 w-3"})]})]}),T.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:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(x1,{className:"h-4 w-4"}),"View Proof",r.jsx(Ls,{className:"h-3 w-3"})]}),T.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(ee,{size:"sm",onClick:()=>N(T.id),disabled:j===T.id,children:[j===T.id?r.jsx(en,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(gd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>{x(T.id),h(!0)},disabled:j===T.id,children:[r.jsx(QT,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(Ot,{className:"bg-green-100 text-green-800",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),T.proof_status==="rejected"&&T.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Ot,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.proof_notes})]})]})]},T.id))})]}),n.shipping_name&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(eA,{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(ee,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Ls,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ye,{className:"sticky top-4",children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Order Summary"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",xn(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(cu,{}),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(cu,{}),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(cu,{}),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(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Request Changes"}),r.jsx(Qn,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(ps,{placeholder:"Describe the changes needed...",value:y,onChange:T=>_(T.target.value),rows:4}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(ee,{onClick:A,disabled:!y.trim()||j!==null,children:[j?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Lr,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{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(ee,{onClick:()=>e("/marketplace/orders"),children:"View All Orders"})]})})}function MKt(){const t=Zn(),[e]=qd();return e.get("session_id"),I.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Lr,{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(Xi,{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(zl,{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(ee,{className:"flex-1",onClick:()=>t("/marketplace/orders"),children:["View My Orders",r.jsx(hl,{className:"h-4 w-4 ml-2"})]}),r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>t("/marketplace"),children:"Continue Shopping"})]})]})})})})}function TKt(){const{user:t}=Xr(),[e,n]=I.useState("store"),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(!1),[p,x]=I.useState(5),[y,_]=I.useState(""),[j,C]=I.useState(!1),[N,A]=I.useState(!1),[E,T]=I.useState(""),[P,z]=I.useState(null),[F,q]=I.useState(!1),{hasSubmittedReview:V,submitReview:K,markPostedToGoogle:G}=e8e(),{data:te}=X$e(),{data:ie,isLoading:oe}=Y$e(),{data:ye,isLoading:ae}=eKt(s),{data:pe,isLoading:se}=tKt(t==null?void 0:t.id),{data:he=0}=nKt(t==null?void 0:t.id),ue=sKt(),_e=new Set((pe==null?void 0:pe.map(Be=>Be.item_id))||[]),Ae=async()=>{if(o)try{await ue.mutateAsync(o.id),ze.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Be){ze.error(Be.message||"Failed to purchase item")}},Ce=async()=>{if(!y.trim()){ze.error("Please write a review");return}C(!0);const Be=await K(p,y);C(!1),Be.success?(ze.success("Thank you for your review! You earned 25 points!"),T(y),A(!0),_(""),x(5)):ze.error(Be.error||"Failed to submit review")},Se=()=>{navigator.clipboard.writeText(E),ze.success("Review copied to clipboard!")},ge=()=>{G(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},Le=()=>{A(!1),h(!1),T("")};return oe||ae||se?r.jsx(Lr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{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(Be=>r.jsx(Ir,{className:"h-64"},Be))})]})}):r.jsxs(Lr,{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(vs,{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:he.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(Zi,{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(ef,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(SS,{open:F,onOpenChange:q,children:r.jsxs(Ye,{className:"border-primary/20",children:[r.jsx(CS,{asChild:!0,children:r.jsx(Gt,{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(Zi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-base",children:"How to Earn Points"}),r.jsx(Tn,{children:"See all the ways you can earn spendable points"})]})]}),F?r.jsx(f1,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Fd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(MS,{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:[te==null?void 0:te.filter(Be=>Be.is_active).map(Be=>{const Ee=Ue=>{switch(Ue){case"event_attendance":return r.jsx(Os,{className:"h-5 w-5"});case"leave_review":return r.jsx(vs,{className:"h-5 w-5"});case"add_listing":return r.jsx(da,{className:"h-5 w-5"});case"first_contact":return r.jsx(Bn,{className:"h-5 w-5"});case"first_video":return r.jsx(Pa,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Oo,{className:"h-5 w-5"});default:return r.jsx(Ki,{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:Ee(Be.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Be.action_name}),Be.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Be.description})]}),r.jsxs(Ot,{variant:"secondary",className:"font-bold shrink-0",children:["+",Be.points]})]},Be.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(ef,{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(Ot,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!V&&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(Oo,{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(ee,{onClick:()=>h(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(Ii,{value:e,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsxs(nn,{value:"store",className:"flex items-center gap-2",children:[r.jsx(wg,{className:"h-4 w-4"}),"Store"]}),r.jsxs(nn,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(zl,{className:"h-4 w-4"}),"My Rewards",pe&&pe.length>0&&r.jsx(Ot,{variant:"secondary",className:"ml-1",children:pe.length})]})]}),r.jsxs(Sn,{value:"store",className:"mt-6",children:[ie&&ie.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(ee,{variant:s===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),ie.map(Be=>r.jsxs(ee,{variant:s===Be.id?"default":"outline",size:"sm",onClick:()=>a(Be.id),children:[Be.icon&&`${Be.icon} `,Be.name]},Be.id))]}),!ye||ye.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(Ki,{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:ye.map(Be=>{const Ee=_e.has(Be.id),Ue=Be.max_quantity!==null&&Be.current_quantity===0,Fe=he>=Be.points_cost;return r.jsxs(Ye,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ee?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>z(Be),children:[Be.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Be.preview_image_url,alt:Be.name,className:"w-full h-full object-cover"}),Ee&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Ue&&!Ee&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ot,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Ki,{className:"h-12 w-12 text-muted-foreground/50"}),Ee&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Zt,{className:"text-lg",children:Be.name}),r.jsxs(Ot,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),Be.points_cost]})]}),Be.category&&r.jsxs(Ot,{variant:"outline",className:"w-fit",children:[Be.category.icon&&`${Be.category.icon} `,Be.category.name]})]}),r.jsxs(Je,{children:[r.jsx(Tn,{className:"mb-4 line-clamp-2",children:Be.description||"No description available"}),Be.max_quantity!==null&&!Ee&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Be.current_quantity," of ",Be.max_quantity," remaining"]}),Ee?r.jsx(ee,{className:"w-full",onClick:be=>{be.stopPropagation(),Be.file_url&&ude(Be.file_url,Be.name)},disabled:!Be.file_url,children:Be.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(ee,{className:"w-full",onClick:be=>{be.stopPropagation(),l(Be)},disabled:Ue||!Fe,children:Ue?"Sold Out":Fe?r.jsxs(r.Fragment,{children:[r.jsx(wg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Be.points_cost-he} more pts`})]})]},Be.id)})})]}),r.jsx(Sn,{value:"my-rewards",className:"mt-6",children:!pe||pe.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(zl,{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:pe.map(Be=>{var Ee,Ue,Fe,be,tt;return r.jsxs(Ye,{className:"overflow-hidden",children:[(Ee=Be.item)!=null&&Ee.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Be.item.preview_image_url,alt:((Ue=Be.item)==null?void 0:Ue.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(Ki,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Zt,{className:"text-lg",children:((Fe=Be.item)==null?void 0:Fe.name)||"Unknown Item"}),r.jsxs(Tn,{className:"text-xs",children:["Purchased for ",Be.points_spent," points • ",new Date(Be.purchased_at).toLocaleDateString()]})]}),r.jsx(Je,{children:r.jsx(ee,{className:"w-full",onClick:()=>{var Te,Ke;(Te=Be.item)!=null&&Te.file_url&&ude(Be.item.file_url,(Ke=Be.item)==null?void 0:Ke.name)},disabled:!((be=Be.item)!=null&&be.file_url),children:((tt=Be.item)==null?void 0:tt.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Be.id)})})})]})]}),r.jsx(Ou,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(nu,{children:[r.jsxs(su,{children:[r.jsx(iu,{children:"Confirm Purchase"}),r.jsxs(ou,{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:[he," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[he-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(au,{children:[r.jsx(lu,{children:"Cancel"}),r.jsx(Dd,{onClick:Ae,disabled:ue.isPending,children:ue.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Fr,{open:i,onOpenChange:Be=>{!Be&&N?Le():h(Be)},children:r.jsx(Rr,{children:N?r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(Qn,{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:['"',E,'"']})]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:Se,children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(ea,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(ee,{variant:"outline",onClick:Le,children:"Maybe Later"}),r.jsxs(ee,{onClick:ge,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Leave a Review"}),r.jsx(Qn,{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(Be=>r.jsx("button",{type:"button",onClick:()=>x(Be),className:"focus:outline-none",children:r.jsx(vs,{className:`h-8 w-8 transition-colors ${p>=Be?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Be))})]}),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:y,onChange:Be=>_(Be.target.value),rows:4})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ce,disabled:j,className:"bg-yellow-600 hover:bg-yellow-700",children:j?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Fr,{open:!!P,onOpenChange:()=>z(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[P==null?void 0:P.name,r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),P==null?void 0:P.points_cost]})]}),(P==null?void 0:P.category)&&r.jsxs(Ot,{variant:"outline",className:"w-fit",children:[P.category.icon&&`${P.category.icon} `,P.category.name]})]}),(P==null?void 0:P.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:P.preview_image_url,alt:P.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(P==null?void 0:P.description)||"No description available"}),(P==null?void 0:P.max_quantity)!==null&&!_e.has((P==null?void 0:P.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[P==null?void 0:P.current_quantity," of ",P==null?void 0:P.max_quantity," remaining"]})]}),r.jsx(ea,{children:P&&_e.has(P.id)?r.jsx(ee,{className:"w-full",onClick:()=>{P.file_url&&ude(P.file_url,P.name)},disabled:!P.file_url,children:P.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Access"]})}):P&&r.jsx(ee,{className:"w-full",onClick:()=>{z(null),l(P)},disabled:P.max_quantity!==null&&P.current_quantity===0||he{const t=Nm();return I.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"})]})})},EKt=new kQe,IKt=()=>{const t=window.location.hostname;return t==="listings.relevelup.com"||t.startsWith("listings.")},PKt=()=>{const t=window.location.hostname;return t==="cards.relevelup.com"||t.startsWith("cards.")},LKt=()=>r.jsx(TQe,{client:EKt,children:r.jsx(REe,{children:r.jsxs(gI,{children:[r.jsx(VZe,{}),r.jsx(wYe,{}),r.jsx(UJe,{children:r.jsx(Zrt,{children:r.jsx(Yrt,{children:r.jsxs(Qrt,{children:[r.jsx(Xrt,{}),r.jsx(Aat,{}),r.jsx(Wat,{}),PKt()?r.jsx(uot,{}):IKt()?r.jsx(Pit,{}):r.jsxs(LJe,{children:[r.jsx(an,{path:"/",element:r.jsx(wot,{})}),r.jsx(an,{path:"/privacy-policy",element:r.jsx(jot,{})}),r.jsx(an,{path:"/terms-of-service",element:r.jsx(kot,{})}),r.jsx(an,{path:"/data-deletion",element:r.jsx(Not,{})}),r.jsx(an,{path:"/public/listings",element:r.jsx(mLe,{})}),r.jsx(an,{path:"/public/listing/:slugOrId",element:r.jsx(cft,{})}),r.jsx(an,{path:"/card/:slug",element:r.jsx(dft,{})}),r.jsx(an,{path:"/auth",element:r.jsx(elt,{})}),r.jsx(an,{path:"/subscription-success",element:r.jsx(tlt,{})}),r.jsx(an,{path:"/subscription",element:r.jsx(Mn,{children:r.jsx(xht,{})})}),r.jsx(an,{path:"/share/video",element:r.jsx(aft,{}),children:r.jsx(an,{path:":shareToken",element:r.jsx(sft,{})})}),r.jsx(an,{path:"/og/video/:token",element:r.jsx(ift,{})}),r.jsx(an,{path:"/setup-brokerage",element:r.jsx(Mn,{children:r.jsx(yht,{})})}),r.jsx(an,{path:"/claim-account",element:r.jsx(hke,{})}),r.jsx(an,{path:"/claim",element:r.jsx(hke,{})}),r.jsx(an,{path:"/join",element:r.jsx(vht,{})}),r.jsx(an,{path:"/trial",element:r.jsx(Aht,{})}),r.jsx(an,{path:"/trial/success",element:r.jsx(Eht,{})}),r.jsx(an,{path:"/dashboard",element:r.jsx(Mn,{children:r.jsx(mpt,{})})}),r.jsx(an,{path:"/profile",element:r.jsx(Mn,{children:r.jsx(dmt,{})})}),r.jsx(an,{path:"/apps",element:r.jsx(Mn,{children:r.jsx(jmt,{})})}),r.jsx(an,{path:"/admin",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(lyt,{})})}),r.jsx(an,{path:"/admin/apps",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(uyt,{})})}),r.jsx(an,{path:"/admin/members",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(pyt,{})})}),r.jsx(an,{path:"/admin/invite-codes",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(myt,{})})}),r.jsx(an,{path:"/admin/events",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(cwt,{})})}),r.jsx(an,{path:"/events",element:r.jsx(Mn,{children:r.jsx(_mt,{})})}),r.jsx(an,{path:"/events/:eventId",element:r.jsx(Mn,{children:r.jsx(wmt,{})})}),r.jsx(an,{path:"/templates",element:r.jsx(Mn,{children:r.jsx(kmt,{})})}),r.jsx(an,{path:"/templates/:templateId",element:r.jsx(Mn,{children:r.jsx(Mmt,{})})}),r.jsx(an,{path:"/admin/templates",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(dwt,{})})}),r.jsx(an,{path:"/academy",element:r.jsx(Mn,{children:r.jsx(Tmt,{})})}),r.jsx(an,{path:"/academy/:videoId",element:r.jsx(Mn,{children:r.jsx(Emt,{})})}),r.jsx(an,{path:"/admin/academy",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(hwt,{})})}),r.jsx(an,{path:"/toolbox",element:r.jsx(Mn,{children:r.jsx(Imt,{})})}),r.jsx(an,{path:"/toolbox/:kitId",element:r.jsx(Mn,{children:r.jsx(Pmt,{})})}),r.jsx(an,{path:"/admin/toolbox",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(fwt,{})})}),r.jsx(an,{path:"/social-swag",element:r.jsx(Mn,{children:r.jsx(Lmt,{})})}),r.jsx(an,{path:"/social-swag-2",element:r.jsx(Mn,{children:r.jsx(Ixt,{})})}),r.jsx(an,{path:"/social-swag/:swagId",element:r.jsx(Mn,{children:r.jsx(Pxt,{})})}),r.jsx(an,{path:"/social-connections",element:r.jsx(Mn,{children:r.jsx(yKt,{})})}),r.jsx(an,{path:"/social-connections/callback",element:r.jsx(Mn,{children:r.jsx(vKt,{})})}),r.jsx(an,{path:"/social-connections/linkedin-callback",element:r.jsx(Mn,{children:r.jsx(bKt,{})})}),r.jsx(an,{path:"/social-connections/google-callback",element:r.jsx(Mn,{children:r.jsx(_Kt,{})})}),r.jsx(an,{path:"/admin/social-swag",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(pwt,{})})}),r.jsx(an,{path:"/admin/social-swag-2",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(mwt,{})})}),r.jsx(an,{path:"/community",element:r.jsx(Mn,{children:r.jsx(Qxt,{})})}),r.jsx(an,{path:"/support",element:r.jsx(Mn,{children:r.jsx(Jxt,{})})}),r.jsx(an,{path:"/admin/community",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(gwt,{})})}),r.jsx(an,{path:"/admin/support-tickets",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(kwt,{})})}),r.jsx(an,{path:"/admin/email-templates",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(Cwt,{})})}),r.jsx(an,{path:"/admin/analytics",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(bwt,{})})}),r.jsx(an,{path:"/admin/brokerage-resources",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(wwt,{})})}),r.jsx(an,{path:"/admin/dashboard-management",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(jwt,{})})}),r.jsx(an,{path:"/brokerage/dashboard",element:r.jsx(Mn,{requireBrokerageManager:!0,children:r.jsx(Fwt,{})})}),r.jsx(an,{path:"/my-brokerage",element:r.jsx(Mn,{children:r.jsx(Vwt,{})})}),r.jsx(an,{path:"/brokerage-resources",element:r.jsx(Mn,{requireBrokerageManager:!0,children:r.jsx(ayt,{})})}),r.jsx(an,{path:"/brokerage-resources/:resourceId",element:r.jsx(Mn,{requireBrokerageManager:!0,children:r.jsx(iyt,{})})}),r.jsx(an,{path:"/newsletters",element:r.jsx(Mn,{children:r.jsx(Hwt,{})})}),r.jsx(an,{path:"/newsletters/:id",element:r.jsx(Mn,{children:r.jsx(Gwt,{})})}),r.jsx(an,{path:"/wishlist",element:r.jsx(Mn,{children:r.jsx(Ywt,{})})}),r.jsx(an,{path:"/wishlist/:itemId",element:r.jsx(Mn,{children:r.jsx(Xwt,{})})}),r.jsx(an,{path:"/admin/wishlist",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(Qwt,{})})}),r.jsx(an,{path:"/admin/levelup-brief",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(Jwt,{})})}),r.jsx(an,{path:"/admin/newsletters",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(Zwt,{})})}),r.jsx(an,{path:"/admin/additional-services",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(ejt,{})})}),r.jsx(an,{path:"/admin/discounts",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(tjt,{})})}),r.jsx(an,{path:"/admin/subscriptions",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(rjt,{})})}),r.jsx(an,{path:"/admin/referrals",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(njt,{})})}),r.jsx(an,{path:"/admin/onboarding-checklist",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(ajt,{})})}),r.jsx(an,{path:"/admin/marketplace",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(QGt,{})})}),r.jsx(an,{path:"/admin/agent-points",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(wGt,{})})}),r.jsx(an,{path:"/admin/reward-store",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(fKt,{})})}),r.jsx(an,{path:"/admin/integrations",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(pKt,{})})}),r.jsx(an,{path:"/admin/integrations/callback",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(xKt,{})})}),r.jsx(an,{path:"/reward-store",element:r.jsx(Mn,{children:r.jsx(TKt,{})})}),r.jsx(an,{path:"/additional-services",element:r.jsx(Mn,{children:r.jsx(gjt,{})})}),r.jsx(an,{path:"/additional-services/:serviceId",element:r.jsx(Mn,{children:r.jsx(xjt,{})})}),r.jsx(an,{path:"/ai-toolkit",element:r.jsx(Mn,{children:r.jsx(yjt,{})})}),r.jsx(an,{path:"/mission-control",element:r.jsx(Mn,{children:r.jsx(Cjt,{})})}),r.jsx(an,{path:"/mission-control/contacts",element:r.jsx(Mn,{children:r.jsx(Wjt,{})})}),r.jsx(an,{path:"/mission-control/contacts/:contactId",element:r.jsx(Mn,{children:r.jsx(okt,{})})}),r.jsx(an,{path:"/mission-control/plans",element:r.jsx(Mn,{children:r.jsx(lkt,{})})}),r.jsx(an,{path:"/mission-control/popbys",element:r.jsx(Mn,{children:r.jsx(ukt,{})})}),r.jsx(an,{path:"/mission-control/popbys/map",element:r.jsx(Mn,{children:r.jsx(hkt,{})})}),r.jsx(an,{path:"/admin/notification-settings",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(gKt,{})})}),r.jsx(an,{path:"/admin/agent-os",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(ojt,{})})}),r.jsx(an,{path:"/mission-control/listings",element:r.jsx(Mn,{children:r.jsx(XHt,{})})}),r.jsx(an,{path:"/mission-control/listings/new",element:r.jsx(Mn,{children:r.jsx(g5e,{})})}),r.jsx(an,{path:"/mission-control/listings/:listingId",element:r.jsx(Mn,{children:r.jsx(hWt,{})})}),r.jsx(an,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Mn,{children:r.jsx(g5e,{})})}),r.jsx(an,{path:"/admin/listing-exchange",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(gGt,{})})}),r.jsx(an,{path:"/mission-control/pipeline",element:r.jsx(Mn,{children:r.jsx(FWt,{})})}),r.jsx(an,{path:"/mission-control/my-card",element:r.jsx(Mn,{children:r.jsx(sGt,{})})}),r.jsx(an,{path:"/mission-control/scorecard",element:r.jsx(Mn,{children:r.jsx($Ht,{})})}),r.jsx(an,{path:"/admin/scorecard",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(fGt,{})})}),r.jsx(an,{path:"/admin/scorecard/:userId",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(mGt,{})})}),r.jsx(an,{path:"/admin/membership-reviews",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(xGt,{})})}),r.jsx(an,{path:"/admin/weekly-digest",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(_Gt,{})})}),r.jsx(an,{path:"/mission-control/video/record",element:r.jsx(Mn,{children:r.jsx(_Wt,{})})}),r.jsx(an,{path:"/mission-control/video-library",element:r.jsx(Mn,{children:r.jsx(kWt,{})})}),r.jsx(an,{path:"/marketplace",element:r.jsx(Mn,{children:r.jsx(wKt,{})})}),r.jsx(an,{path:"/marketplace/:productId",element:r.jsx(Mn,{children:r.jsx(jKt,{})})}),r.jsx(an,{path:"/marketplace/cart",element:r.jsx(Mn,{children:r.jsx(kKt,{})})}),r.jsx(an,{path:"/marketplace/orders",element:r.jsx(Mn,{children:r.jsx(NKt,{})})}),r.jsx(an,{path:"/marketplace/orders/:orderId",element:r.jsx(Mn,{children:r.jsx(CKt,{})})}),r.jsx(an,{path:"/marketplace/success",element:r.jsx(Mn,{children:r.jsx(MKt,{})})}),r.jsx(an,{path:"/admin/agent-cards",element:r.jsx(Mn,{requireAdmin:!0,children:r.jsx(jGt,{})})}),r.jsx(an,{path:"*",element:r.jsx(AKt,{})})]}),")"]})})})})]})})});VTe(document.getElementById("root")).render(r.jsx(LKt,{}));