var UWe=Object.defineProperty;var abe=t=>{throw TypeError(t)};var qWe=(t,e,n)=>e in t?UWe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Zn=(t,e,n)=>qWe(t,typeof e!="symbol"?e+"":e,n),ale=(t,e,n)=>e.has(t)||abe("Cannot "+n);var er=(t,e,n)=>(ale(t,e,"read from private field"),n?n.call(t):e.get(t)),da=(t,e,n)=>e.has(t)?abe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),fs=(t,e,n,s)=>(ale(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),di=(t,e,n)=>(ale(t,e,"access private method"),n);var J6=(t,e,n,s)=>({set _(a){fs(t,e,a,n)},get _(){return er(t,e,s)}});function VWe(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 $x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function wMe(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 jMe={exports:{}},Sne={},kMe={exports:{}},Li={};/** * @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 yI=Symbol.for("react.element"),HWe=Symbol.for("react.portal"),WWe=Symbol.for("react.fragment"),GWe=Symbol.for("react.strict_mode"),KWe=Symbol.for("react.profiler"),ZWe=Symbol.for("react.provider"),YWe=Symbol.for("react.context"),XWe=Symbol.for("react.forward_ref"),QWe=Symbol.for("react.suspense"),JWe=Symbol.for("react.memo"),eGe=Symbol.for("react.lazy"),ibe=Symbol.iterator;function tGe(t){return t===null||typeof t!="object"?null:(t=ibe&&t[ibe]||t["@@iterator"],typeof t=="function"?t:null)}var NMe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},SMe=Object.assign,CMe={};function r3(t,e,n){this.props=t,this.context=e,this.refs=CMe,this.updater=n||NMe}r3.prototype.isReactComponent={};r3.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")};r3.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function MMe(){}MMe.prototype=r3.prototype;function fme(t,e,n){this.props=t,this.context=e,this.refs=CMe,this.updater=n||NMe}var pme=fme.prototype=new MMe;pme.constructor=fme;SMe(pme,r3.prototype);pme.isPureReactComponent=!0;var obe=Array.isArray,TMe=Object.prototype.hasOwnProperty,mme={current:null},AMe={key:!0,ref:!0,__self:!0,__source:!0};function EMe(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)TMe.call(e,s)&&!AMe.hasOwnProperty(s)&&(a[s]=e[s]);var i=arguments.length-2;if(i===1)a.children=n;else if(1>>1,Ne=he[Se];if(0>>1;Sea(Te,Ce))Pea(Ue,Te)?(he[Se]=Ue,he[Pe]=Ce,Se=Pe):(he[Se]=Te,he[rt]=Ce,Se=rt);else if(Pea(Ue,Ce))he[Se]=Ue,he[Pe]=Ce,Se=Pe;else break e}}return ye}function a(he,ye){var Ce=he.sortIndex-ye.sortIndex;return Ce!==0?Ce:he.id-ye.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 u=[],p=[],x=1,y=null,_=3,w=!1,S=!1,N=!1,M=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(he){for(var ye=n(p);ye!==null;){if(ye.callback===null)s(p);else if(ye.startTime<=he)s(p),ye.sortIndex=ye.expirationTime,e(u,ye);else break;ye=n(p)}}function z(he){if(N=!1,P(he),!S)if(n(u)!==null)S=!0,se(R);else{var ye=n(p);ye!==null&&fe(z,ye.startTime-he)}}function R(he,ye){S=!1,N&&(N=!1,E(K),K=-1),w=!0;var Ce=_;try{for(P(ye),y=n(u);y!==null&&(!(y.expirationTime>ye)||he&&!ae());){var Se=y.callback;if(typeof Se=="function"){y.callback=null,_=y.priorityLevel;var Ne=Se(y.expirationTime<=ye);ye=t.unstable_now(),typeof Ne=="function"?y.callback=Ne:y===n(u)&&s(u),P(ye)}else s(u);y=n(u)}if(y!==null)var be=!0;else{var rt=n(p);rt!==null&&fe(z,rt.startTime-ye),be=!1}return be}finally{y=null,_=Ce,w=!1}}var U=!1,V=null,K=-1,W=5,J=-1;function ae(){return!(t.unstable_now()-Jhe||125Se?(he.sortIndex=Ce,e(p,he),n(u)===null&&he===n(p)&&(N?(E(K),K=-1):N=!0,fe(z,Ce-Se))):(he.sortIndex=Ne,e(u,he),S||w||(S=!0,se(R))),he},t.unstable_shouldYield=ae,t.unstable_wrapCallback=function(he){var ye=_;return function(){var Ce=_;_=ye;try{return he.apply(this,arguments)}finally{_=Ce}}}})(DMe);OMe.exports=DMe;var hGe=OMe.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 fGe=I,gf=hGe;function Tn(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"),Lde=Object.prototype.hasOwnProperty,pGe=/^[: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]*$/,cbe={},dbe={};function mGe(t){return Lde.call(dbe,t)?!0:Lde.call(cbe,t)?!1:pGe.test(t)?dbe[t]=!0:(cbe[t]=!0,!1)}function gGe(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 xGe(t,e,n,s){if(e===null||typeof e>"u"||gGe(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 Qu(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 eu={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){eu[t]=new Qu(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];eu[e]=new Qu(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){eu[t]=new Qu(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){eu[t]=new Qu(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){eu[t]=new Qu(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){eu[t]=new Qu(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){eu[t]=new Qu(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){eu[t]=new Qu(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){eu[t]=new Qu(t,5,!1,t.toLowerCase(),null,!1,!1)});var yme=/[\-:]([a-z])/g;function vme(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(yme,vme);eu[e]=new Qu(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(yme,vme);eu[e]=new Qu(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(yme,vme);eu[e]=new Qu(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){eu[t]=new Qu(t,1,!1,t.toLowerCase(),null,!1,!1)});eu.xlinkHref=new Qu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){eu[t]=new Qu(t,1,!1,t.toLowerCase(),null,!0,!0)});function _me(t,e,n,s){var a=eu.hasOwnProperty(e)?eu[e]:null;(a!==null?a.type!==0:s||!(2i||a[l]!==o[i]){var u=` `+a[l].replace(" at new "," at ");return t.displayName&&u.includes("")&&(u=u.replace("",t.displayName)),u}while(1<=l&&0<=i);break}}}finally{lle=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?fT(t):""}function yGe(t){switch(t.tag){case 5:return fT(t.type);case 16:return fT("Lazy");case 13:return fT("Suspense");case 19:return fT("SuspenseList");case 0:case 2:case 15:return t=cle(t.type,!1),t;case 11:return t=cle(t.type.render,!1),t;case 1:return t=cle(t.type,!0),t;default:return""}}function Fde(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 D4:return"Fragment";case O4:return"Portal";case Ode:return"Profiler";case bme:return"StrictMode";case Dde:return"Suspense";case Rde:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case zMe:return(t.displayName||"Context")+".Consumer";case FMe:return(t._context.displayName||"Context")+".Provider";case wme:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jme:return e=t.displayName||null,e!==null?e:Fde(t.type)||"Memo";case P0:e=t._payload,t=t._init;try{return Fde(t(e))}catch{}}return null}function vGe(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 Fde(e);case 8:return e===bme?"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 Q1(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function $Me(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function _Ge(t){var e=$Me(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 rL(t){t._valueTracker||(t._valueTracker=_Ge(t))}function UMe(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=$Me(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function Iee(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 zde(t,e){var n=e.checked;return ql({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function hbe(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=Q1(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 qMe(t,e){e=e.checked,e!=null&&_me(t,"checked",e,!1)}function Bde(t,e){qMe(t,e);var n=Q1(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,Q1(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function fbe(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"||Iee(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var pT=Array.isArray;function tS(t,e,n,s){if(t=t.options,e){e={};for(var a=0;a"+e.valueOf().toString()+"",e=nL.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function UA(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var MT={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},bGe=["Webkit","ms","Moz","O"];Object.keys(MT).forEach(function(t){bGe.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),MT[e]=MT[t]})});function GMe(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||MT.hasOwnProperty(t)&&MT[t]?(""+e).trim():e+"px"}function KMe(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=GMe(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,a):t[n]=a}}var wGe=ql({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 Vde(t,e){if(e){if(wGe[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Tn(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Tn(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Tn(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Tn(62))}}function Hde(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 Wde=null;function kme(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Gde=null,rS=null,nS=null;function gbe(t){if(t=bI(t)){if(typeof Gde!="function")throw Error(Tn(280));var e=t.stateNode;e&&(e=Ene(e),Gde(t.stateNode,t.type,e))}}function ZMe(t){rS?nS?nS.push(t):nS=[t]:rS=t}function YMe(){if(rS){var t=rS,e=nS;if(nS=rS=null,gbe(t),e)for(t=0;t>>=0,t===0?32:31-(PGe(t)/LGe|0)|0}var sL=64,aL=4194304;function mT(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 Dee(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=mT(i):(o&=l,o!==0&&(s=mT(o)))}else l=n&~a,l!==0?s=mT(l):o!==0&&(s=mT(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 vI(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-xm(e),t[e]=n}function FGe(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=AT),Nbe=" ",Sbe=!1;function gTe(t,e){switch(t){case"keyup":return hKe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xTe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var R4=!1;function pKe(t,e){switch(t){case"compositionend":return xTe(e);case"keypress":return e.which!==32?null:(Sbe=!0,Nbe);case"textInput":return t=e.data,t===Nbe&&Sbe?null:t;default:return null}}function mKe(t,e){if(R4)return t==="compositionend"||!Ime&&gTe(t,e)?(t=pTe(),jO=Tme=d1=null,R4=!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=Abe(n)}}function bTe(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?bTe(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function wTe(){for(var t=window,e=Iee();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Iee(t.document)}return e}function Pme(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 kKe(t){var e=wTe(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&bTe(n.ownerDocument.documentElement,n)){if(s!==null&&Pme(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,F4=null,Jde=null,IT=null,eue=!1;function Ibe(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;eue||F4==null||F4!==Iee(s)||(s=F4,"selectionStart"in s&&Pme(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}),IT&&KA(IT,s)||(IT=s,s=zee(Jde,"onSelect"),0$4||(t.current=iue[$4],iue[$4]=null,$4--)}function el(t,e){$4++,iue[$4]=t.current,t.current=e}var J1={},xu=cv(J1),wh=cv(!1),$j=J1;function lC(t,e){var n=t.type.contextTypes;if(!n)return J1;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 jh(t){return t=t.childContextTypes,t!=null}function $ee(){ml(wh),ml(xu)}function zbe(t,e,n){if(xu.current!==J1)throw Error(Tn(168));el(xu,e),el(wh,n)}function ETe(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(Tn(108,vGe(t)||"Unknown",a));return ql({},n,s)}function Uee(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||J1,$j=xu.current,el(xu,t),el(wh,wh.current),!0}function Bbe(t,e,n){var s=t.stateNode;if(!s)throw Error(Tn(169));n?(t=ETe(t,e,$j),s.__reactInternalMemoizedMergedChildContext=t,ml(wh),ml(xu),el(xu,t)):ml(wh),el(wh,n)}var Ox=null,Ine=!1,jle=!1;function ITe(t){Ox===null?Ox=[t]:Ox.push(t)}function DKe(t){Ine=!0,ITe(t)}function dv(){if(!jle&&Ox!==null){jle=!0;var t=0,e=Co;try{var n=Ox;for(Co=1;t>=l,a-=l,Ux=1<<32-xm(e)+a|n<K?(W=V,V=null):W=V.sibling;var J=_(E,V,P[K],z);if(J===null){V===null&&(V=W);break}t&&V&&J.alternate===null&&e(E,V),A=o(J,A,K),U===null?R=J:U.sibling=J,U=J,V=W}if(K===P.length)return n(E,V),Sl&&b_(E,K),R;if(V===null){for(;KK?(W=V,V=null):W=V.sibling;var ae=_(E,V,J.value,z);if(ae===null){V===null&&(V=W);break}t&&V&&ae.alternate===null&&e(E,V),A=o(ae,A,K),U===null?R=ae:U.sibling=ae,U=ae,V=W}if(J.done)return n(E,V),Sl&&b_(E,K),R;if(V===null){for(;!J.done;K++,J=P.next())J=y(E,J.value,z),J!==null&&(A=o(J,A,K),U===null?R=J:U.sibling=J,U=J);return Sl&&b_(E,K),R}for(V=s(E,V);!J.done;K++,J=P.next())J=w(V,E,K,J.value,z),J!==null&&(t&&J.alternate!==null&&V.delete(J.key===null?K:J.key),A=o(J,A,K),U===null?R=J:U.sibling=J,U=J);return t&&V.forEach(function(oe){return e(E,oe)}),Sl&&b_(E,K),R}function M(E,A,P,z){if(typeof P=="object"&&P!==null&&P.type===D4&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case tL:e:{for(var R=P.key,U=A;U!==null;){if(U.key===R){if(R=P.type,R===D4){if(U.tag===7){n(E,U.sibling),A=a(U,P.props.children),A.return=E,E=A;break e}}else if(U.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===P0&&qbe(R)===U.type){n(E,U.sibling),A=a(U,P.props),A.ref=RM(E,U,P),A.return=E,E=A;break e}n(E,U);break}else e(E,U);U=U.sibling}P.type===D4?(A=gj(P.props.children,E.mode,z,P.key),A.return=E,E=A):(z=EO(P.type,P.key,P.props,null,E.mode,z),z.ref=RM(E,A,P),z.return=E,E=z)}return l(E);case O4:e:{for(U=P.key;A!==null;){if(A.key===U)if(A.tag===4&&A.stateNode.containerInfo===P.containerInfo&&A.stateNode.implementation===P.implementation){n(E,A.sibling),A=a(A,P.children||[]),A.return=E,E=A;break e}else{n(E,A);break}else e(E,A);A=A.sibling}A=Ele(P,E.mode,z),A.return=E,E=A}return l(E);case P0:return U=P._init,M(E,A,U(P._payload),z)}if(pT(P))return S(E,A,P,z);if(IM(P))return N(E,A,P,z);hL(E,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,A!==null&&A.tag===6?(n(E,A.sibling),A=a(A,P),A.return=E,E=A):(n(E,A),A=Ale(P,E.mode,z),A.return=E,E=A),l(E)):n(E,A)}return M}var dC=DTe(!0),RTe=DTe(!1),Hee=cv(null),Wee=null,V4=null,Rme=null;function Fme(){Rme=V4=Wee=null}function zme(t){var e=Hee.current;ml(Hee),t._currentValue=e}function cue(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 aS(t,e){Wee=t,Rme=V4=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(vh=!0),t.firstContext=null)}function dp(t){var e=t._currentValue;if(Rme!==t)if(t={context:t,memoizedValue:e,next:null},V4===null){if(Wee===null)throw Error(Tn(308));V4=t,Wee.dependencies={lanes:0,firstContext:t}}else V4=V4.next=t;return e}var Ww=null;function Bme(t){Ww===null?Ww=[t]:Ww.push(t)}function FTe(t,e,n,s){var a=e.interleaved;return a===null?(n.next=n,Bme(e)):(n.next=a.next,a.next=n),e.interleaved=n,py(t,s)}function py(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 L0=!1;function $me(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function zTe(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 Yx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function j1(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,py(t,n)}return a=s.interleaved,a===null?(e.next=e,Bme(s)):(e.next=a.next,a.next=e),s.interleaved=e,py(t,n)}function NO(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,Sme(t,n)}}function Vbe(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 Gee(t,e,n,s){var a=t.updateQueue;L0=!1;var o=a.firstBaseUpdate,l=a.lastBaseUpdate,i=a.shared.pending;if(i!==null){a.shared.pending=null;var u=i,p=u.next;u.next=null,l===null?o=p:l.next=p,l=u;var x=t.alternate;x!==null&&(x=x.updateQueue,i=x.lastBaseUpdate,i!==l&&(i===null?x.firstBaseUpdate=p:i.next=p,x.lastBaseUpdate=u))}if(o!==null){var y=a.baseState;l=0,x=p=u=null,i=o;do{var _=i.lane,w=i.eventTime;if((s&_)===_){x!==null&&(x=x.next={eventTime:w,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var S=t,N=i;switch(_=e,w=n,N.tag){case 1:if(S=N.payload,typeof S=="function"){y=S.call(w,y,_);break e}y=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=N.payload,_=typeof S=="function"?S.call(w,y,_):S,_==null)break e;y=ql({},y,_);break e;case 2:L0=!0}}i.callback!==null&&i.lane!==0&&(t.flags|=64,_=a.effects,_===null?a.effects=[i]:_.push(i))}else w={eventTime:w,lane:_,tag:i.tag,payload:i.payload,callback:i.callback,next:null},x===null?(p=x=w,u=y):x=x.next=w,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&&(u=y),a.baseState=u,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);Vj|=l,t.lanes=l,t.memoizedState=y}}function Hbe(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var s=Nle.transition;Nle.transition={};try{t(!1),e()}finally{Co=n,Nle.transition=s}}function rAe(){return up().memoizedState}function BKe(t,e,n){var s=N1(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},nAe(t))sAe(e,n);else if(n=FTe(t,e,n,s),n!==null){var a=Wu();ym(n,t,s,a),aAe(n,e,s)}}function $Ke(t,e,n){var s=N1(t),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(nAe(t))sAe(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,Cm(i,l)){var u=e.interleaved;u===null?(a.next=a,Bme(e)):(a.next=u.next,u.next=a),e.interleaved=a;return}}catch{}finally{}n=FTe(t,e,a,s),n!==null&&(a=Wu(),ym(n,t,s,a),aAe(n,e,s))}}function nAe(t){var e=t.alternate;return t===zl||e!==null&&e===zl}function sAe(t,e){PT=Zee=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function aAe(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Sme(t,n)}}var Yee={readContext:dp,useCallback:iu,useContext:iu,useEffect:iu,useImperativeHandle:iu,useInsertionEffect:iu,useLayoutEffect:iu,useMemo:iu,useReducer:iu,useRef:iu,useState:iu,useDebugValue:iu,useDeferredValue:iu,useTransition:iu,useMutableSource:iu,useSyncExternalStore:iu,useId:iu,unstable_isNewReconciler:!1},UKe={readContext:dp,useCallback:function(t,e){return ag().memoizedState=[t,e===void 0?null:e],t},useContext:dp,useEffect:Gbe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,CO(4194308,4,XTe.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=ag();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=ag();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=BKe.bind(null,zl,t),[s.memoizedState,t]},useRef:function(t){var e=ag();return t={current:t},e.memoizedState=t},useState:Wbe,useDebugValue:Zme,useDeferredValue:function(t){return ag().memoizedState=t},useTransition:function(){var t=Wbe(!1),e=t[0];return t=zKe.bind(null,t[1]),ag().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=zl,a=ag();if(Sl){if(n===void 0)throw Error(Tn(407));n=n()}else{if(n=e(),bd===null)throw Error(Tn(349));qj&30||qTe(s,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,Gbe(HTe.bind(null,s,o,t),[t]),s.flags|=2048,rE(9,VTe.bind(null,s,o,n,e),void 0,null),n},useId:function(){var t=ag(),e=bd.identifierPrefix;if(Sl){var n=qx,s=Ux;n=(s&~(1<<32-xm(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=eE++,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[fg]=e,t[XA]=s,mAe(t,e,!1,!1),e.stateNode=t;e:{switch(l=Hde(n,s),n){case"dialog":dl("cancel",t),dl("close",t),a=s;break;case"iframe":case"object":case"embed":dl("load",t),a=s;break;case"video":case"audio":for(a=0;afC&&(e.flags|=128,s=!0,FM(o,!1),e.lanes=4194304)}else{if(!s)if(t=Kee(l),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),FM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Sl)return ou(e),null}else 2*mc()-o.renderingStartTime>fC&&n!==1073741824&&(e.flags|=128,s=!0,FM(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=mc(),e.sibling=null,n=Pl.current,el(Pl,s?n&1|2:n&1),e):(ou(e),null);case 22:case 23:return tge(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?Kh&1073741824&&(ou(e),e.subtreeFlags&6&&(e.flags|=8192)):ou(e),null;case 24:return null;case 25:return null}throw Error(Tn(156,e.tag))}function YKe(t,e){switch(Ome(e),e.tag){case 1:return jh(e.type)&&$ee(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return uC(),ml(wh),ml(xu),Vme(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return qme(e),null;case 13:if(ml(Pl),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Tn(340));cC()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ml(Pl),null;case 4:return uC(),null;case 10:return zme(e.type._context),null;case 22:case 23:return tge(),null;case 24:return null;default:return null}}var pL=!1,uu=!1,XKe=typeof WeakSet=="function"?WeakSet:Set,vs=null;function H4(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Yl(t,e,s)}else n.current=null}function yue(t,e,n){try{n()}catch(s){Yl(t,e,s)}}var swe=!1;function QKe(t,e){if(tue=Ree,t=wTe(),Pme(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,u=-1,p=0,x=0,y=t,_=null;t:for(;;){for(var w;y!==n||a!==0&&y.nodeType!==3||(i=l+a),y!==o||s!==0&&y.nodeType!==3||(u=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(w=y.firstChild)!==null;)_=y,y=w;for(;;){if(y===t)break t;if(_===n&&++p===a&&(i=l),_===o&&++x===s&&(u=l),(w=y.nextSibling)!==null)break;y=_,_=y.parentNode}y=w}n=i===-1||u===-1?null:{start:i,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(rue={focusedElem:t,selectionRange:n},Ree=!1,vs=e;vs!==null;)if(e=vs,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,vs=t;else for(;vs!==null;){e=vs;try{var S=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var N=S.memoizedProps,M=S.memoizedState,E=e.stateNode,A=E.getSnapshotBeforeUpdate(e.elementType===e.type?N:Jp(e.type,N),M);E.__reactInternalSnapshotBeforeUpdate=A}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(Tn(163))}}catch(z){Yl(e,e.return,z)}if(t=e.sibling,t!==null){t.return=e.return,vs=t;break}vs=e.return}return S=swe,swe=!1,S}function LT(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&&yue(e,n,o)}a=a.next}while(a!==s)}}function One(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 vue(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 yAe(t){var e=t.alternate;e!==null&&(t.alternate=null,yAe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[fg],delete e[XA],delete e[aue],delete e[LKe],delete e[OKe])),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 vAe(t){return t.tag===5||t.tag===3||t.tag===4}function awe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||vAe(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 _ue(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=Bee));else if(s!==4&&(t=t.child,t!==null))for(_ue(t,e,n),t=t.sibling;t!==null;)_ue(t,e,n),t=t.sibling}function bue(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(bue(t,e,n),t=t.sibling;t!==null;)bue(t,e,n),t=t.sibling}var zd=null,nm=!1;function j0(t,e,n){for(n=n.child;n!==null;)_Ae(t,e,n),n=n.sibling}function _Ae(t,e,n){if(_g&&typeof _g.onCommitFiberUnmount=="function")try{_g.onCommitFiberUnmount(Cne,n)}catch{}switch(n.tag){case 5:uu||H4(n,e);case 6:var s=zd,a=nm;zd=null,j0(t,e,n),zd=s,nm=a,zd!==null&&(nm?(t=zd,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zd.removeChild(n.stateNode));break;case 18:zd!==null&&(nm?(t=zd,n=n.stateNode,t.nodeType===8?wle(t.parentNode,n):t.nodeType===1&&wle(t,n),WA(t)):wle(zd,n.stateNode));break;case 4:s=zd,a=nm,zd=n.stateNode.containerInfo,nm=!0,j0(t,e,n),zd=s,nm=a;break;case 0:case 11:case 14:case 15:if(!uu&&(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)&&yue(n,e,l),a=a.next}while(a!==s)}j0(t,e,n);break;case 1:if(!uu&&(H4(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){Yl(n,e,i)}j0(t,e,n);break;case 21:j0(t,e,n);break;case 22:n.mode&1?(uu=(s=uu)||n.memoizedState!==null,j0(t,e,n),uu=s):j0(t,e,n);break;default:j0(t,e,n)}}function iwe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new XKe),e.forEach(function(s){var a=oZe.bind(null,t,s);n.has(s)||(n.add(s),s.then(a,a))})}}function Wp(t,e){var n=e.deletions;if(n!==null)for(var s=0;sa&&(a=l),s&=~o}if(s=a,s=mc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*eZe(s/1960))-s,10t?16:t,u1===null)var s=!1;else{if(t=u1,u1=null,Jee=0,Qi&6)throw Error(Tn(331));var a=Qi;for(Qi|=4,vs=t.current;vs!==null;){var o=vs,l=o.child;if(vs.flags&16){var i=o.deletions;if(i!==null){for(var u=0;umc()-Jme?mj(t,0):Qme|=n),kh(t,e)}function MAe(t,e){e===0&&(t.mode&1?(e=aL,aL<<=1,!(aL&130023424)&&(aL=4194304)):e=1);var n=Wu();t=py(t,e),t!==null&&(vI(t,e,n),kh(t,n))}function iZe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),MAe(t,n)}function oZe(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(Tn(314))}s!==null&&s.delete(e),MAe(t,n)}var TAe;TAe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||wh.current)vh=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return vh=!1,KKe(t,e,n);vh=!!(t.flags&131072)}else vh=!1,Sl&&e.flags&1048576&&PTe(e,Vee,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;MO(t,e),t=e.pendingProps;var a=lC(e,xu.current);aS(e,n),a=Wme(null,e,s,t,a,n);var o=Gme();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,jh(s)?(o=!0,Uee(e)):o=!1,e.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,$me(e),a.updater=Lne,e.stateNode=a,a._reactInternals=e,uue(e,s,t,n),e=pue(null,e,s,!0,o,n)):(e.tag=0,Sl&&o&&Lme(e),Fu(null,e,a,n),e=e.child),e;case 16:s=e.elementType;e:{switch(MO(t,e),t=e.pendingProps,a=s._init,s=a(s._payload),e.type=s,a=e.tag=cZe(s),t=Jp(s,t),a){case 0:e=fue(null,e,s,t,n);break e;case 1:e=twe(null,e,s,t,n);break e;case 11:e=Jbe(null,e,s,t,n);break e;case 14:e=ewe(null,e,s,Jp(s.type,t),n);break e}throw Error(Tn(306,s,""))}return e;case 0:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Jp(s,a),fue(t,e,s,a,n);case 1:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Jp(s,a),twe(t,e,s,a,n);case 3:e:{if(hAe(e),t===null)throw Error(Tn(387));s=e.pendingProps,o=e.memoizedState,a=o.element,zTe(t,e),Gee(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=hC(Error(Tn(423)),e),e=rwe(t,e,s,n,a);break e}else if(s!==a){a=hC(Error(Tn(424)),e),e=rwe(t,e,s,n,a);break e}else for(sf=w1(e.stateNode.containerInfo.firstChild),af=e,Sl=!0,om=null,n=RTe(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(cC(),s===a){e=my(t,e,n);break e}Fu(t,e,s,n)}e=e.child}return e;case 5:return BTe(e),t===null&&lue(e),s=e.type,a=e.pendingProps,o=t!==null?t.memoizedProps:null,l=a.children,nue(s,a)?l=null:o!==null&&nue(s,o)&&(e.flags|=32),uAe(t,e),Fu(t,e,l,n),e.child;case 6:return t===null&&lue(e),null;case 13:return fAe(t,e,n);case 4:return Ume(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=dC(e,null,s,n):Fu(t,e,s,n),e.child;case 11:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Jp(s,a),Jbe(t,e,s,a,n);case 7:return Fu(t,e,e.pendingProps,n),e.child;case 8:return Fu(t,e,e.pendingProps.children,n),e.child;case 12:return Fu(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(s=e.type._context,a=e.pendingProps,o=e.memoizedProps,l=a.value,el(Hee,s._currentValue),s._currentValue=l,o!==null)if(Cm(o.value,l)){if(o.children===a.children&&!wh.current){e=my(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 u=i.firstContext;u!==null;){if(u.context===s){if(o.tag===1){u=Yx(-1,n&-n),u.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?u.next=u:(u.next=x.next,x.next=u),p.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),cue(o.return,n,e),i.lanes|=n;break}u=u.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(Tn(341));l.lanes|=n,i=l.alternate,i!==null&&(i.lanes|=n),cue(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}Fu(t,e,a.children,n),e=e.child}return e;case 9:return a=e.type,s=e.pendingProps.children,aS(e,n),a=dp(a),s=s(a),e.flags|=1,Fu(t,e,s,n),e.child;case 14:return s=e.type,a=Jp(s,e.pendingProps),a=Jp(s.type,a),ewe(t,e,s,a,n);case 15:return cAe(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Jp(s,a),MO(t,e),e.tag=1,jh(s)?(t=!0,Uee(e)):t=!1,aS(e,n),iAe(e,s,a),uue(e,s,a,n),pue(null,e,s,!0,t,n);case 19:return pAe(t,e,n);case 22:return dAe(t,e,n)}throw Error(Tn(156,e.tag))};function AAe(t,e){return nTe(t,e)}function lZe(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 Xf(t,e,n,s){return new lZe(t,e,n,s)}function nge(t){return t=t.prototype,!(!t||!t.isReactComponent)}function cZe(t){if(typeof t=="function")return nge(t)?1:0;if(t!=null){if(t=t.$$typeof,t===wme)return 11;if(t===jme)return 14}return 2}function S1(t,e){var n=t.alternate;return n===null?(n=Xf(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 EO(t,e,n,s,a,o){var l=2;if(s=t,typeof t=="function")nge(t)&&(l=1);else if(typeof t=="string")l=5;else e:switch(t){case D4:return gj(n.children,a,o,e);case bme:l=8,a|=8;break;case Ode:return t=Xf(12,n,e,a|2),t.elementType=Ode,t.lanes=o,t;case Dde:return t=Xf(13,n,e,a),t.elementType=Dde,t.lanes=o,t;case Rde:return t=Xf(19,n,e,a),t.elementType=Rde,t.lanes=o,t;case BMe:return Rne(n,a,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case FMe:l=10;break e;case zMe:l=9;break e;case wme:l=11;break e;case jme:l=14;break e;case P0:l=16,s=null;break e}throw Error(Tn(130,t==null?t:typeof t,""))}return e=Xf(l,n,e,a),e.elementType=t,e.type=s,e.lanes=o,e}function gj(t,e,n,s){return t=Xf(7,t,s,e),t.lanes=n,t}function Rne(t,e,n,s){return t=Xf(22,t,s,e),t.elementType=BMe,t.lanes=n,t.stateNode={isHidden:!1},t}function Ale(t,e,n){return t=Xf(6,t,null,e),t.lanes=n,t}function Ele(t,e,n){return e=Xf(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function dZe(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=ule(0),this.expirationTimes=ule(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ule(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function sge(t,e,n,s,a,o,l,i,u){return t=new dZe(t,e,n,i,u),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Xf(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$me(o),t}function uZe(t,e,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LAe)}catch(t){console.error(t)}}LAe(),LMe.exports=_f;var Iy=LMe.exports;const lge=Wi(Iy);var OAe,pwe=Iy;OAe=pwe.createRoot,pwe.hydrateRoot;const gZe=1,xZe=1e6;let Ile=0;function yZe(){return Ile=(Ile+1)%Number.MAX_SAFE_INTEGER,Ile.toString()}const Ple=new Map,mwe=t=>{if(Ple.has(t))return;const e=setTimeout(()=>{Ple.delete(t),RT({type:"REMOVE_TOAST",toastId:t})},xZe);Ple.set(t,e)},vZe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,gZe)};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?mwe(n):t.toasts.forEach(s=>{mwe(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)}}},IO=[];let PO={toasts:[]};function RT(t){PO=vZe(PO,t),IO.forEach(e=>{e(PO)})}function ga({...t}){const e=yZe(),n=a=>RT({type:"UPDATE_TOAST",toast:{...a,id:e}}),s=()=>RT({type:"DISMISS_TOAST",toastId:e});return RT({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:a=>{a||s()}}}),{id:e,dismiss:s,update:n}}function mi(){const[t,e]=I.useState(PO);return I.useEffect(()=>(IO.push(e),()=>{const n=IO.indexOf(e);n>-1&&IO.splice(n,1)}),[t]),{...t,toast:ga,dismiss:n=>RT({type:"DISMISS_TOAST",toastId:n})}}function cn(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 gwe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function gy(...t){return e=>{let n=!1;const s=t.map(a=>{const o=gwe(a,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{const{children:l,...i}=o,u=I.useMemo(()=>i,Object.values(i));return r.jsx(n.Provider,{value:u,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 lc(t,e=[]){let n=[];function s(o,l){const i=I.createContext(l),u=n.length;n=[...n,l];const p=y=>{var E;const{scope:_,children:w,...S}=y,N=((E=_==null?void 0:_[t])==null?void 0:E[u])||i,M=I.useMemo(()=>S,Object.values(S));return r.jsx(N.Provider,{value:M,children:w})};p.displayName=o+"Provider";function x(y,_){var N;const w=((N=_==null?void 0:_[t])==null?void 0:N[u])||i,S=I.useContext(w);if(S)return S;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 u=(i==null?void 0:i[t])||o;return I.useMemo(()=>({[`__scope${t}`]:{...i,[t]:u}}),[i,u])}};return a.scopeName=t,[s,bZe(a,...e)]}function bZe(...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:u,scopeName:p})=>{const y=u(o)[`__scope${p}`];return{...i,...y}},{});return I.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}function ev(t){const e=wZe(t),n=I.forwardRef((s,a)=>{const{children:o,...l}=s,i=I.Children.toArray(o),u=i.find(jZe);if(u){const p=u.props.children,x=i.map(y=>y===u?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 cge=ev("Slot");function wZe(t){const e=I.forwardRef((n,s)=>{const{children:a,...o}=n;if(I.isValidElement(a)){const l=NZe(a),i=kZe(o,a.props);return a.type!==I.Fragment&&(i.ref=s?gy(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 DAe=Symbol("radix.slottable");function RAe(t){const e=({children:n})=>r.jsx(r.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=DAe,e}function jZe(t){return I.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===DAe}function kZe(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 u=o(...i);return a(...i),u}:a&&(n[s]=a):s==="style"?n[s]={...a,...o}:s==="className"&&(n[s]=[a,o].filter(Boolean).join(" "))}return{...t,...n}}function NZe(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 jI(t){const e=t+"CollectionProvider",[n,s]=lc(e),[a,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=N=>{const{scope:M,children:E}=N,A=it.useRef(null),P=it.useRef(new Map).current;return r.jsx(a,{scope:M,itemMap:P,collectionRef:A,children:E})};l.displayName=e;const i=t+"CollectionSlot",u=ev(i),p=it.forwardRef((N,M)=>{const{scope:E,children:A}=N,P=o(i,E),z=ra(M,P.collectionRef);return r.jsx(u,{ref:z,children:A})});p.displayName=i;const x=t+"CollectionItemSlot",y="data-radix-collection-item",_=ev(x),w=it.forwardRef((N,M)=>{const{scope:E,children:A,...P}=N,z=it.useRef(null),R=ra(M,z),U=o(x,E);return it.useEffect(()=>(U.itemMap.set(z,{ref:z,...P}),()=>void U.itemMap.delete(z))),r.jsx(_,{[y]:"",ref:R,children:A})});w.displayName=x;function S(N){const M=o(t+"CollectionConsumer",N);return it.useCallback(()=>{const A=M.collectionRef.current;if(!A)return[];const P=Array.from(A.querySelectorAll(`[${y}]`));return Array.from(M.itemMap.values()).sort((U,V)=>P.indexOf(U.ref.current)-P.indexOf(V.ref.current))},[M.collectionRef,M.itemMap])}return[{Provider:l,Slot:p,ItemSlot:w},S,s]}var SZe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=SZe.reduce((t,e)=>{const n=ev(`Primitive.${e}`),s=I.forwardRef((a,o)=>{const{asChild:l,...i}=a,u=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...i,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function dge(t,e){t&&Iy.flushSync(()=>t.dispatchEvent(e))}function nc(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 CZe(t,e=globalThis==null?void 0:globalThis.document){const n=nc(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 MZe="DismissableLayer",Sue="dismissableLayer.update",TZe="dismissableLayer.pointerDownOutside",AZe="dismissableLayer.focusOutside",xwe,FAe=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),uv=I.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...u}=t,p=I.useContext(FAe),[x,y]=I.useState(null),_=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=I.useState({}),S=ra(e,V=>y(V)),N=Array.from(p.layers),[M]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=N.indexOf(M),A=x?N.indexOf(x):-1,P=p.layersWithOutsidePointerEventsDisabled.size>0,z=A>=E,R=IZe(V=>{const K=V.target,W=[...p.branches].some(J=>J.contains(K));!z||W||(a==null||a(V),l==null||l(V),V.defaultPrevented||i==null||i())},_),U=PZe(V=>{const K=V.target;[...p.branches].some(J=>J.contains(K))||(o==null||o(V),l==null||l(V),V.defaultPrevented||i==null||i())},_);return CZe(V=>{A===p.layers.size-1&&(s==null||s(V),!V.defaultPrevented&&i&&(V.preventDefault(),i()))},_),I.useEffect(()=>{if(x)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(xwe=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),ywe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=xwe)}},[x,_,n,p]),I.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),ywe())},[x,p]),I.useEffect(()=>{const V=()=>w({});return document.addEventListener(Sue,V),()=>document.removeEventListener(Sue,V)},[]),r.jsx(Rn.div,{...u,ref:S,style:{pointerEvents:P?z?"auto":"none":void 0,...t.style},onFocusCapture:cn(t.onFocusCapture,U.onFocusCapture),onBlurCapture:cn(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:cn(t.onPointerDownCapture,R.onPointerDownCapture)})});uv.displayName=MZe;var EZe="DismissableLayerBranch",zAe=I.forwardRef((t,e)=>{const n=I.useContext(FAe),s=I.useRef(null),a=ra(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})});zAe.displayName=EZe;function IZe(t,e=globalThis==null?void 0:globalThis.document){const n=nc(t),s=I.useRef(!1),a=I.useRef(()=>{});return I.useEffect(()=>{const o=i=>{if(i.target&&!s.current){let u=function(){BAe(TZe,n,p,{discrete:!0})};const p={originalEvent:i};i.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}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 PZe(t,e=globalThis==null?void 0:globalThis.document){const n=nc(t),s=I.useRef(!1);return I.useEffect(()=>{const a=o=>{o.target&&!s.current&&BAe(AZe,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 ywe(){const t=new CustomEvent(Sue);document.dispatchEvent(t)}function BAe(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?dge(a,o):a.dispatchEvent(o)}var LZe=uv,OZe=zAe,ic=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},DZe="Portal",a3=I.forwardRef((t,e)=>{var i;const{container:n,...s}=t,[a,o]=I.useState(!1);ic(()=>o(!0),[]);const l=n||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?lge.createPortal(r.jsx(Rn.div,{...s,ref:e}),l):null});a3.displayName=DZe;function RZe(t,e){return I.useReducer((n,s)=>e[n][s]??n,t)}var jc=t=>{const{present:e,children:n}=t,s=FZe(e),a=typeof n=="function"?n({present:s.isPresent}):I.Children.only(n),o=ra(s.ref,zZe(a));return typeof n=="function"||s.isPresent?I.cloneElement(a,{ref:o}):null};jc.displayName="Presence";function FZe(t){const[e,n]=I.useState(),s=I.useRef(null),a=I.useRef(t),o=I.useRef("none"),l=t?"mounted":"unmounted",[i,u]=RZe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const p=xL(s.current);o.current=i==="mounted"?p:"none"},[i]),ic(()=>{const p=s.current,x=a.current;if(x!==t){const _=o.current,w=xL(p);t?u("MOUNT"):w==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(x&&_!==w?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),ic(()=>{if(e){let p;const x=e.ownerDocument.defaultView??window,y=w=>{const N=xL(s.current).includes(w.animationName);if(w.target===e&&N&&(u("ANIMATION_END"),!a.current)){const M=e.style.animationFillMode;e.style.animationFillMode="forwards",p=x.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=M)})}},_=w=>{w.target===e&&(o.current=xL(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 u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:I.useCallback(p=>{s.current=p?getComputedStyle(p):null,n(p)},[])}}function xL(t){return(t==null?void 0:t.animationName)||"none"}function zZe(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 BZe=xme[" useInsertionEffect ".trim().toString()]||ic;function Ku({prop:t,defaultProp:e,onChange:n=()=>{},caller:s}){const[a,o,l]=$Ze({defaultProp:e,onChange:n}),i=t!==void 0,u=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 _=UZe(x)?x(t):x;_!==t&&((y=l.current)==null||y.call(l,_))}else o(x)},[i,t,o,l]);return[u,p]}function $Ze({defaultProp:t,onChange:e}){const[n,s]=I.useState(t),a=I.useRef(n),o=I.useRef(e);return BZe(()=>{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 UZe(t){return typeof t=="function"}var $Ae=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"}),qZe="VisuallyHidden",Une=I.forwardRef((t,e)=>r.jsx(Rn.span,{...t,ref:e,style:{...$Ae,...t.style}}));Une.displayName=qZe;var VZe=Une,uge="ToastProvider",[hge,HZe,WZe]=jI("Toast"),[UAe]=lc("Toast",[WZe]),[GZe,qne]=UAe(uge),qAe=t=>{const{__scopeToast:e,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=t,[i,u]=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 \`${uge}\`. Expected non-empty \`string\`.`),r.jsx(hge.Provider,{scope:e,children:r.jsx(GZe,{scope:e,label:n,duration:s,swipeDirection:a,swipeThreshold:o,toastCount:p,viewport:i,onViewportChange:u,onToastAdd:I.useCallback(()=>x(w=>w+1),[]),onToastRemove:I.useCallback(()=>x(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:_,children:l})})};qAe.displayName=uge;var VAe="ToastViewport",KZe=["F8"],Cue="toast.viewportPause",Mue="toast.viewportResume",HAe=I.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:s=KZe,label:a="Notifications ({hotkey})",...o}=t,l=qne(VAe,n),i=HZe(n),u=I.useRef(null),p=I.useRef(null),x=I.useRef(null),y=I.useRef(null),_=ra(e,y,l.onViewportChange),w=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),S=l.toastCount>0;I.useEffect(()=>{const M=E=>{var P;s.length!==0&&s.every(z=>E[z]||E.code===z)&&((P=y.current)==null||P.focus())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[s]),I.useEffect(()=>{const M=u.current,E=y.current;if(S&&M&&E){const A=()=>{if(!l.isClosePausedRef.current){const U=new CustomEvent(Cue);E.dispatchEvent(U),l.isClosePausedRef.current=!0}},P=()=>{if(l.isClosePausedRef.current){const U=new CustomEvent(Mue);E.dispatchEvent(U),l.isClosePausedRef.current=!1}},z=U=>{!M.contains(U.relatedTarget)&&P()},R=()=>{M.contains(document.activeElement)||P()};return M.addEventListener("focusin",A),M.addEventListener("focusout",z),M.addEventListener("pointermove",A),M.addEventListener("pointerleave",R),window.addEventListener("blur",A),window.addEventListener("focus",P),()=>{M.removeEventListener("focusin",A),M.removeEventListener("focusout",z),M.removeEventListener("pointermove",A),M.removeEventListener("pointerleave",R),window.removeEventListener("blur",A),window.removeEventListener("focus",P)}}},[S,l.isClosePausedRef]);const N=I.useCallback(({tabbingDirection:M})=>{const A=i().map(P=>{const z=P.ref.current,R=[z,...oYe(z)];return M==="forwards"?R:R.reverse()});return(M==="forwards"?A.reverse():A).flat()},[i]);return I.useEffect(()=>{const M=y.current;if(M){const E=A=>{var R,U,V;const P=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!P){const K=document.activeElement,W=A.shiftKey;if(A.target===M&&W){(R=p.current)==null||R.focus();return}const oe=N({tabbingDirection:W?"backwards":"forwards"}),xe=oe.findIndex(ie=>ie===K);Lle(oe.slice(xe+1))?A.preventDefault():W?(U=p.current)==null||U.focus():(V=x.current)==null||V.focus()}};return M.addEventListener("keydown",E),()=>M.removeEventListener("keydown",E)}},[i,N]),r.jsxs(OZe,{ref:u,role:"region","aria-label":a.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&r.jsx(Tue,{ref:p,onFocusFromOutsideViewport:()=>{const M=N({tabbingDirection:"forwards"});Lle(M)}}),r.jsx(hge.Slot,{scope:n,children:r.jsx(Rn.ol,{tabIndex:-1,...o,ref:_})}),S&&r.jsx(Tue,{ref:x,onFocusFromOutsideViewport:()=>{const M=N({tabbingDirection:"backwards"});Lle(M)}})]})});HAe.displayName=VAe;var WAe="ToastFocusProxy",Tue=I.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=t,o=qne(WAe,n);return r.jsx(Une,{"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()}})});Tue.displayName=WAe;var kI="Toast",ZZe="toast.swipeStart",YZe="toast.swipeMove",XZe="toast.swipeCancel",QZe="toast.swipeEnd",GAe=I.forwardRef((t,e)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:o,...l}=t,[i,u]=Ku({prop:s,defaultProp:a??!0,onChange:o,caller:kI});return r.jsx(jc,{present:n||i,children:r.jsx(tYe,{open:i,...l,ref:e,onClose:()=>u(!1),onPause:nc(t.onPause),onResume:nc(t.onResume),onSwipeStart:cn(t.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:cn(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:cn(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:cn(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`),u(!1)})})})});GAe.displayName=kI;var[JZe,eYe]=UAe(kI,{onClose(){}}),tYe=I.forwardRef((t,e)=>{const{__scopeToast:n,type:s="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:u,onResume:p,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:_,onSwipeEnd:w,...S}=t,N=qne(kI,n),[M,E]=I.useState(null),A=ra(e,ie=>E(ie)),P=I.useRef(null),z=I.useRef(null),R=a||N.duration,U=I.useRef(0),V=I.useRef(R),K=I.useRef(0),{onToastAdd:W,onToastRemove:J}=N,ae=nc(()=>{var pe;(M==null?void 0:M.contains(document.activeElement))&&((pe=N.viewport)==null||pe.focus()),l()}),oe=I.useCallback(ie=>{!ie||ie===1/0||(window.clearTimeout(K.current),U.current=new Date().getTime(),K.current=window.setTimeout(ae,ie))},[ae]);I.useEffect(()=>{const ie=N.viewport;if(ie){const pe=()=>{oe(V.current),p==null||p()},se=()=>{const fe=new Date().getTime()-U.current;V.current=V.current-fe,window.clearTimeout(K.current),u==null||u()};return ie.addEventListener(Cue,se),ie.addEventListener(Mue,pe),()=>{ie.removeEventListener(Cue,se),ie.removeEventListener(Mue,pe)}}},[N.viewport,R,u,p,oe]),I.useEffect(()=>{o&&!N.isClosePausedRef.current&&oe(R)},[o,R,N.isClosePausedRef,oe]),I.useEffect(()=>(W(),()=>J()),[W,J]);const xe=I.useMemo(()=>M?eEe(M):null,[M]);return N.viewport?r.jsxs(r.Fragment,{children:[xe&&r.jsx(rYe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:xe}),r.jsx(JZe,{scope:n,onClose:ae,children:Iy.createPortal(r.jsx(hge.ItemSlot,{scope:n,children:r.jsx(LZe,{asChild:!0,onEscapeKeyDown:cn(i,()=>{N.isFocusedToastEscapeKeyDownRef.current||ae(),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,...S,ref:A,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:cn(t.onKeyDown,ie=>{ie.key==="Escape"&&(i==null||i(ie.nativeEvent),ie.nativeEvent.defaultPrevented||(N.isFocusedToastEscapeKeyDownRef.current=!0,ae()))}),onPointerDown:cn(t.onPointerDown,ie=>{ie.button===0&&(P.current={x:ie.clientX,y:ie.clientY})}),onPointerMove:cn(t.onPointerMove,ie=>{if(!P.current)return;const pe=ie.clientX-P.current.x,se=ie.clientY-P.current.y,fe=!!z.current,he=["left","right"].includes(N.swipeDirection),ye=["left","up"].includes(N.swipeDirection)?Math.min:Math.max,Ce=he?ye(0,pe):0,Se=he?0:ye(0,se),Ne=ie.pointerType==="touch"?10:2,be={x:Ce,y:Se},rt={originalEvent:ie,delta:be};fe?(z.current=be,yL(YZe,y,rt,{discrete:!1})):vwe(be,N.swipeDirection,Ne)?(z.current=be,yL(ZZe,x,rt,{discrete:!1}),ie.target.setPointerCapture(ie.pointerId)):(Math.abs(pe)>Ne||Math.abs(se)>Ne)&&(P.current=null)}),onPointerUp:cn(t.onPointerUp,ie=>{const pe=z.current,se=ie.target;if(se.hasPointerCapture(ie.pointerId)&&se.releasePointerCapture(ie.pointerId),z.current=null,P.current=null,pe){const fe=ie.currentTarget,he={originalEvent:ie,delta:pe};vwe(pe,N.swipeDirection,N.swipeThreshold)?yL(QZe,w,he,{discrete:!0}):yL(XZe,_,he,{discrete:!0}),fe.addEventListener("click",ye=>ye.preventDefault(),{once:!0})}})})})}),N.viewport)})]}):null}),rYe=t=>{const{__scopeToast:e,children:n,...s}=t,a=qne(kI,e),[o,l]=I.useState(!1),[i,u]=I.useState(!1);return aYe(()=>l(!0)),I.useEffect(()=>{const p=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(p)},[]),i?null:r.jsx(a3,{asChild:!0,children:r.jsx(Une,{...s,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},nYe="ToastTitle",KAe=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});KAe.displayName=nYe;var sYe="ToastDescription",ZAe=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});ZAe.displayName=sYe;var YAe="ToastAction",XAe=I.forwardRef((t,e)=>{const{altText:n,...s}=t;return n.trim()?r.jsx(JAe,{altText:n,asChild:!0,children:r.jsx(fge,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${YAe}\`. Expected non-empty \`string\`.`),null)});XAe.displayName=YAe;var QAe="ToastClose",fge=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t,a=eYe(QAe,n);return r.jsx(JAe,{asChild:!0,children:r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:cn(t.onClick,a.onClose)})})});fge.displayName=QAe;var JAe=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 eEe(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),iYe(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(...eEe(s))}}),e}function yL(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?dge(a,o):a.dispatchEvent(o)}var vwe=(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 aYe(t=()=>{}){const e=nc(t);ic(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[e])}function iYe(t){return t.nodeType===t.ELEMENT_NODE}function oYe(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 Lle(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var lYe=qAe,tEe=HAe,rEe=GAe,nEe=KAe,sEe=ZAe,aEe=XAe,iEe=fge;function oEe(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,bwe=oi,i3=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return bwe(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 _=_we(x)||_we(y);return a[p][_]}),i=n&&Object.entries(n).reduce((p,x)=>{let[y,_]=x;return _===void 0||(p[y]=_),p},{}),u=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((p,x)=>{let{class:y,className:_,...w}=x;return Object.entries(w).every(S=>{let[N,M]=S;return Array.isArray(M)?M.includes({...o,...i}[N]):{...o,...i}[N]===M})?[...p,y,_]:p},[]);return bwe(t,l,u,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 cYe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lEe=(...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 dYe={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 cEe=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:l,...i},u)=>I.createElement("svg",{ref:u,...dYe,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:lEe("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 q=(t,e)=>{const n=I.forwardRef(({className:s,...a},o)=>I.createElement(cEe,{ref:o,iconNode:e,className:lEe(`lucide-${cYe(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 LO=q("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 OO=q("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 DO=q("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 RO=q("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 wg=q("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 FO=q("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 zO=q("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 j_=q("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 k_=q("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 BO=q("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 N_=q("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 $O=q("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 UO=q("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 qO=q("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 VO=q("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 HO=q("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 oS=q("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 WO=q("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 GO=q("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 KO=q("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 ZO=q("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 YO=q("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 XO=q("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 QO=q("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 JO=q("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 e8=q("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 t8=q("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 r8=q("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 lS=q("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 cS=q("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 n8=q("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 s8=q("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 a8=q("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 i8=q("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 o8=q("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 l8=q("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 c8=q("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 d8=q("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 u8=q("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 h8=q("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 f8=q("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 p8=q("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 m8=q("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 g8=q("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 x8=q("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 y8=q("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 v8=q("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 _8=q("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 b8=q("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 w8=q("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 j8=q("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 FT=q("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 k8=q("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 N8=q("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 S8=q("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=q("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 M8=q("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 T8=q("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 A8=q("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 E8=q("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 I8=q("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 P8=q("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 L8=q("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 O8=q("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 D8=q("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 R8=q("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 F8=q("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 S_=q("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 z8=q("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 B8=q("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 $8=q("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 U8=q("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 q8=q("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 V8=q("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 H8=q("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 C_=q("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 M_=q("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 Xx=q("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 W8=q("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 G8=q("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 K8=q("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 io=q("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 Z8=q("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 Y8=q("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 X8=q("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 Jo=q("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 Q8=q("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 J8=q("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 T_=q("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 jg=q("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 eD=q("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 tD=q("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 rD=q("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 A_=q("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 nD=q("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 sD=q("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 aD=q("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 E_=q("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 ep=q("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 iD=q("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 oD=q("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 lD=q("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 cD=q("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 dD=q("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 uD=q("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 Rl=q("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 hD=q("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 I_=q("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 fD=q("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 pD=q("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 mD=q("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 gD=q("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 P_=q("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 xD=q("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 yD=q("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 vD=q("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 _D=q("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 bD=q("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 wD=q("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 jD=q("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 kD=q("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 ND=q("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 SD=q("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=q("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 MD=q("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 TD=q("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 AD=q("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 ED=q("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 ID=q("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 PD=q("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 LD=q("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 OD=q("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 DD=q("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 RD=q("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 C1=q("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 FD=q("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 zD=q("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 BD=q("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 $D=q("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 UD=q("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 qD=q("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 VD=q("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 HD=q("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 WD=q("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 GD=q("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 KD=q("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 M1=q("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 ZD=q("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 YD=q("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 XD=q("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 QD=q("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 JD=q("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 eR=q("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 xj=q("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 tR=q("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 rR=q("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 kg=q("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 L_=q("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 O_=q("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 nR=q("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 sR=q("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 aR=q("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 iR=q("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 oR=q("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 lR=q("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 cR=q("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 dR=q("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 uR=q("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 hR=q("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 fR=q("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 pR=q("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 mR=q("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 gR=q("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 xR=q("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 yR=q("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 dS=q("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 vR=q("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 _R=q("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 bR=q("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 wR=q("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 jR=q("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 kR=q("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 NR=q("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 D_=q("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 SR=q("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=q("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 MR=q("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 TR=q("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 AR=q("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 ER=q("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 IR=q("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 PR=q("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 LR=q("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 OR=q("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 zT=q("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 DR=q("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 RR=q("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 FR=q("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 zR=q("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 BR=q("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 $R=q("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 UR=q("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 qR=q("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 VR=q("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 HR=q("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 BT=q("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 WR=q("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 vm=q("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 GR=q("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 KR=q("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 ZR=q("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 uS=q("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 YR=q("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 XR=q("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 R_=q("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 QR=q("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 JR=q("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 eF=q("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 $T=q("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 tF=q("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 rF=q("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 nF=q("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 sF=q("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 Nh=q("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 aF=q("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 iF=q("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 oF=q("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 lF=q("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 cF=q("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 li=q("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 yj=q("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 dF=q("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 uF=q("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 hF=q("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 fF=q("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 pF=q("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 of=q("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 mF=q("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 gF=q("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 xF=q("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 yF=q("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 vF=q("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 _F=q("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 UT=q("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 bF=q("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 _m=q("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 wF=q("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 jF=q("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 kF=q("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 NF=q("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 SF=q("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=q("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 vj=q("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 MF=q("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 TF=q("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 AF=q("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 EF=q("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 IF=q("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 Ds=q("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 PF=q("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 Ng=q("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 LF=q("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 OF=q("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 DF=q("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=q("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 FF=q("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 F_=q("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 zF=q("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 BF=q("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 $F=q("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 UF=q("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 qF=q("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 VF=q("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 HF=q("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 WF=q("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 GF=q("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 KF=q("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 ZF=q("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 YF=q("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 XF=q("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 z_=q("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 B_=q("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 QF=q("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 JF=q("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 ez=q("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 $_=q("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 U_=q("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 q_=q("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 tz=q("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 V_=q("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 rz=q("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 gc=q("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 nz=q("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 H_=q("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 sz=q("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 az=q("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 W_=q("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 G_=q("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 iz=q("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 K_=q("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 Z_=q("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 Y_=q("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 oz=q("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 lz=q("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 _i=q("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 cz=q("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 dz=q("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 Qd=q("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 uz=q("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 hz=q("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 vc=q("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 Bi=q("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 T1=q("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 fz=q("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 pz=q("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 mz=q("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 gz=q("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 xz=q("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 yz=q("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 vz=q("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 Qx=q("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 _z=q("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 bz=q("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 wz=q("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 jz=q("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 kz=q("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 pl=q("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 X_=q("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_=q("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 J_=q("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 e2=q("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 t2=q("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 r2=q("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 n2=q("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 s2=q("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 Ii=q("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=q("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 a2=q("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 i2=q("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 o2=q("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 l2=q("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 Nz=q("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 c2=q("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 Sz=q("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=q("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 Mz=q("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 Tz=q("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 Az=q("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 Ez=q("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 Iz=q("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 d2=q("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 Dx=q("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 u2=q("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 Pz=q("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 h2=q("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 f2=q("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 p2=q("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 m2=q("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 Gf=q("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 g2=q("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 x2=q("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 y2=q("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 Lz=q("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 v2=q("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 _2=q("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 b2=q("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lc=q("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 Gu=q("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 Oz=q("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 Dz=q("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=q("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 qT=q("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 Fz=q("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 VT=q("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 zz=q("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 Bz=q("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 w2=q("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 j2=q("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 $z=q("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 Uz=q("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 qz=q("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 Vz=q("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 Hz=q("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 Wz=q("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 Gz=q("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 Kz=q("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 Zz=q("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 Yz=q("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 Xz=q("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 Qz=q("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 Jz=q("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 e7=q("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 t7=q("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 r7=q("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 n7=q("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 s7=q("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 a7=q("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 Wa=q("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 i7=q("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 o7=q("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 k2=q("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 l7=q("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 c7=q("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 d7=q("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 u7=q("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 h7=q("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 f7=q("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 p7=q("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 m7=q("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 g7=q("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 x7=q("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 y7=q("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 v7=q("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 N2=q("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 _7=q("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 b7=q("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 Vx=q("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 w7=q("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 S2=q("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 _j=q("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 j7=q("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 k7=q("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 bj=q("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 N7=q("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 S7=q("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 C2=q("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 M2=q("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=q("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 M7=q("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 T7=q("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 A7=q("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 E7=q("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 I7=q("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 P7=q("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 L7=q("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 O7=q("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 T2=q("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 D7=q("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 R7=q("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 F7=q("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 z7=q("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 B7=q("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 $7=q("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 U7=q("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 q7=q("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 V7=q("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 H7=q("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 tl=q("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 W7=q("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 G7=q("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 K7=q("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 Z7=q("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 Y7=q("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 X7=q("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 Q7=q("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 J7=q("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 eB=q("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 tB=q("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 rB=q("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 nB=q("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 bm=q("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 sB=q("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 aB=q("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 iB=q("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 oB=q("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 A1=q("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 lB=q("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 cB=q("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 dB=q("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 uB=q("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 hB=q("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 fB=q("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 pB=q("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 mB=q("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 gB=q("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 xB=q("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 yB=q("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 vB=q("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 A2=q("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 _B=q("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 bB=q("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 wB=q("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 jB=q("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 kB=q("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 NB=q("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 SB=q("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 CB=q("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 MB=q("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 TB=q("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 AB=q("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 EB=q("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 IB=q("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 PB=q("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 LB=q("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 OB=q("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 DB=q("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 RB=q("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 FB=q("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 wd=q("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 zB=q("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 BB=q("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 wj=q("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 $B=q("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 ao=q("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 UB=q("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 qB=q("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 VB=q("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 HB=q("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 WB=q("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 GB=q("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 KB=q("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 ZB=q("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 YB=q("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 XB=q("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 QB=q("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 JB=q("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 E2=q("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 e9=q("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 t9=q("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 r9=q("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 hS=q("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 Rx=q("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 lm=q("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 n9=q("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 s9=q("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 a9=q("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 i9=q("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 o9=q("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 l9=q("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 c9=q("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 Os=q("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 d9=q("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 E1=q("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 $o=q("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 Jd=q("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 u9=q("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 h9=q("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 f9=q("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 p9=q("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 m9=q("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 g9=q("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 x9=q("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 y9=q("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 v9=q("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 _9=q("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 I2=q("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 b9=q("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 w9=q("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 j9=q("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 P2=q("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 L2=q("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 O2=q("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 D2=q("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 k9=q("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 N9=q("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 S9=q("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 C9=q("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 M9=q("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 R2=q("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 T9=q("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 A9=q("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=q("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 I9=q("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 I1=q("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 P9=q("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 L9=q("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 O9=q("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 D9=q("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 R9=q("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 F9=q("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 z9=q("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 B9=q("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 $9=q("FileMinus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=q("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 q9=q("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 F2=q("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 z2=q("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 V9=q("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 H9=q("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 W9=q("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=q("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 K9=q("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 Z9=q("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 Y9=q("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 P1=q("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 X9=q("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 Q9=q("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 J9=q("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 ka=q("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 e$=q("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 t$=q("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 r$=q("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 n$=q("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 s$=q("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 a$=q("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 i$=q("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 o$=q("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 l$=q("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 c$=q("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 d$=q("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 u$=q("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 h$=q("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 $d=q("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 f$=q("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 L1=q("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 p$=q("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 m$=q("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 g$=q("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 x$=q("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 y$=q("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 v$=q("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 _$=q("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 b$=q("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 Jx=q("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 w$=q("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 lf=q("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 j$=q("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 k$=q("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 N$=q("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 jj=q("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 S$=q("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$=q("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 M$=q("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 T$=q("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 A$=q("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 fm=q("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 E$=q("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 I$=q("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 P$=q("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 L$=q("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 O$=q("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 D$=q("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 R$=q("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 F$=q("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 z$=q("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 B2=q("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 B$=q("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 $$=q("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 U$=q("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 q$=q("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 V$=q("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 H$=q("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 W$=q("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 G$=q("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 K$=q("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 Z$=q("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 Y$=q("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 Sg=q("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 X$=q("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 $2=q("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 Q$=q("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=q("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 eU=q("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 tU=q("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 rU=q("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 nU=q("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 sU=q("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 aU=q("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 iU=q("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 oU=q("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 lU=q("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 cU=q("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 dU=q("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 uU=q("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 hU=q("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 fU=q("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 pU=q("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 mU=q("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 gU=q("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 xU=q("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 yU=q("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 vU=q("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 _U=q("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 bU=q("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 wU=q("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 jU=q("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 kU=q("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 NU=q("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 SU=q("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 kj=q("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 Zi=q("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=q("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 MU=q("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 U2=q("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 TU=q("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 AU=q("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 EU=q("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 IU=q("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 PU=q("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 LU=q("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 OU=q("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 DU=q("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 RU=q("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 FU=q("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 zU=q("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 BU=q("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 $U=q("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 UU=q("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 qU=q("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 VU=q("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 HU=q("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 ey=q("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 WU=q("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 GU=q("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 O1=q("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 KU=q("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 ZU=q("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 q2=q("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 YU=q("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 V2=q("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 Gh=q("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 XU=q("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 D1=q("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 QU=q("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 JU=q("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 eq=q("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 tq=q("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 rq=q("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 nq=q("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 sq=q("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 H2=q("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 aq=q("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 iq=q("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 oq=q("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 lq=q("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 cq=q("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 dq=q("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 HT=q("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 uq=q("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 fS=q("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 hq=q("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 fq=q("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 WT=q("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 GT=q("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 pq=q("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 mq=q("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 gq=q("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 xq=q("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 yq=q("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 vq=q("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 _q=q("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 bq=q("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 wq=q("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 jq=q("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 kq=q("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 Nq=q("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 fi=q("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 Sq=q("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=q("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 Mq=q("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 pS=q("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 Tq=q("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 Aq=q("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 Eq=q("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 Iq=q("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 Pq=q("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 Lq=q("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 Oq=q("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 ua=q("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 W2=q("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 G2=q("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 Dq=q("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 Rq=q("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 Fq=q("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 zq=q("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 Bq=q("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 mS=q("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 $q=q("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 Uq=q("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 Ol=q("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 qq=q("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 Vq=q("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 Hq=q("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 K2=q("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 Z2=q("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 Wq=q("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 Gq=q("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 Kq=q("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 Zq=q("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 mu=q("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 gS=q("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 Yq=q("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 Xq=q("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 Qq=q("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 Jq=q("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 ty=q("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 Nj=q("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 eV=q("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 cf=q("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 tV=q("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 rV=q("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 nV=q("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 sV=q("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 aV=q("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 iV=q("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 oV=q("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 lV=q("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 cV=q("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 dV=q("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 uV=q("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 hV=q("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 fV=q("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 Y2=q("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 pV=q("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 mV=q("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 gV=q("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 xV=q("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 yV=q("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 vV=q("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 _V=q("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 Sj=q("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 tp=q("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 bV=q("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 wV=q("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 jV=q("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 Cj=q("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 kV=q("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 NV=q("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 SV=q("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 CV=q("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 MV=q("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 xS=q("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 yS=q("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=q("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 AV=q("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 R1=q("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 EV=q("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 df=q("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 Mo=q("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 wm=q("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 IV=q("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 PV=q("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 LV=q("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=q("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 DV=q("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 RV=q("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 FV=q("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vS=q("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 zV=q("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 BV=q("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 $V=q("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 UV=q("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 qV=q("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 VV=q("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 HV=q("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 rp=q("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 Yr=q("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 WV=q("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 GV=q("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 KV=q("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 ZV=q("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 KT=q("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 X2=q("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 YV=q("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=q("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 np=q("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 _S=q("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 bS=q("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 XV=q("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 QV=q("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 JV=q("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 eH=q("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 tH=q("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 rH=q("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 nH=q("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 sH=q("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 aH=q("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 iH=q("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 oH=q("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 ZT=q("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 ws=q("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 lH=q("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 cH=q("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 dH=q("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 uH=q("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 hH=q("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 fH=q("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 pH=q("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 mH=q("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 gH=q("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 xH=q("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 yH=q("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 vH=q("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 To=q("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 _H=q("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 bH=q("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 wH=q("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 jH=q("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 kH=q("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 ry=q("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 NH=q("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 jm=q("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 SH=q("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 CH=q("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 YT=q("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 MH=q("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 TH=q("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 AH=q("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 wS=q("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 EH=q("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 IH=q("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 PH=q("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 XT=q("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 LH=q("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=q("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 DH=q("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 Bl=q("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 RH=q("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 FH=q("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 zH=q("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 BH=q("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 $H=q("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 UH=q("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 qH=q("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 VH=q("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 HH=q("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 QT=q("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 WH=q("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 GH=q("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 KH=q("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 ZH=q("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 YH=q("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 Do=q("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 XH=q("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 QH=q("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 J2=q("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 JT=q("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 JH=q("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 eW=q("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 tW=q("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 rW=q("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 nW=q("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 sW=q("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 aW=q("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 iW=q("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 F1=q("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 oW=q("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 lW=q("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 cW=q("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 dW=q("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 uW=q("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 hW=q("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 fW=q("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 pW=q("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 mW=q("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 gW=q("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 xW=q("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 yW=q("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 Mj=q("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 vW=q("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 _W=q("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 bW=q("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 wW=q("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 jW=q("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 kW=q("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 NW=q("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 Tj=q("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 SW=q("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 CW=q("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 eb=q("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 MW=q("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 TW=q("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 AW=q("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 EW=q("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 IW=q("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 PW=q("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=q("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 OW=q("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=q("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 RW=q("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 FW=q("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 zW=q("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 BW=q("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 $W=q("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 UW=q("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 qW=q("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 VW=q("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 HW=q("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 WW=q("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 GW=q("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 eA=q("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 KW=q("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 ny=q("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 ZW=q("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 YW=q("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 XW=q("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 QW=q("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 JW=q("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 eG=q("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 tG=q("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 rG=q("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 nG=q("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 tb=q("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 sG=q("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 rb=q("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 nb=q("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 aG=q("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 iG=q("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 oG=q("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 lG=q("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 cG=q("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 dG=q("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 uG=q("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 hG=q("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 fG=q("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 pG=q("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 mG=q("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 gG=q("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 $l=q("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 xG=q("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 yG=q("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 sb=q("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 vG=q("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 Rc=q("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 _G=q("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 ab=q("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 bG=q("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 wG=q("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 ib=q("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 ob=q("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 lb=q("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 cb=q("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 jG=q("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 db=q("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 kG=q("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 NG=q("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 SG=q("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 ub=q("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 CG=q("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 MG=q("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 TG=q("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 AG=q("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 O0=q("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 EG=q("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 IG=q("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 PG=q("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 Fc=q("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 sp=q("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=q("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 OG=q("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 D0=q("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=q("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 Aj=q("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 R0=q("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 RG=q("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 FG=q("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 zG=q("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 ni=q("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 BG=q("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 jS=q("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 $G=q("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 UG=q("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 qG=q("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 VG=q("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 HG=q("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 WG=q("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 GG=q("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 KG=q("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 ji=q("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 ZG=q("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 YG=q("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 XG=q("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 QG=q("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 JG=q("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 eK=q("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 tK=q("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 rK=q("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 nK=q("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 sK=q("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 aK=q("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 tA=q("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 z1=q("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 iK=q("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 oK=q("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 lK=q("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 cK=q("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 dK=q("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 Ul=q("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 uK=q("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 hb=q("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 rA=q("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 _n=q("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 hK=q("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 fK=q("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 pK=q("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 mK=q("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 gK=q("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 xK=q("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 yK=q("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 vK=q("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 _K=q("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 bK=q("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 wK=q("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 jK=q("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 kK=q("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 NK=q("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 SK=q("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 CK=q("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 MK=q("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 nA=q("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 sA=q("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 TK=q("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 AK=q("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 EK=q("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 IK=q("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 PK=q("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 LK=q("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 Ej=q("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 OK=q("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 DK=q("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 RK=q("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 FK=q("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 zK=q("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 BK=q("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 $K=q("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 UK=q("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 qK=q("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 VK=q("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 HK=q("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 WK=q("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 GK=q("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 KK=q("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 fb=q("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 ZK=q("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 YK=q("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 XK=q("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 QK=q("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 JK=q("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 kS=q("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 eZ=q("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 tZ=q("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 rZ=q("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 Ll=q("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 nZ=q("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 sZ=q("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 aZ=q("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 iZ=q("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 oZ=q("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 aA=q("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 lZ=q("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 cZ=q("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 dZ=q("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 iA=q("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 uZ=q("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 hZ=q("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cg=q("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 fZ=q("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 pZ=q("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 pb=q("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 mZ=q("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 NS=q("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 gZ=q("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 oA=q("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 xZ=q("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 yZ=q("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 vZ=q("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 mb=q("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 gb=q("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 _Z=q("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 bZ=q("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 wZ=q("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 jZ=q("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 kZ=q("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=q("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=q("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 CZ=q("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 MZ=q("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 TZ=q("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 AZ=q("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 km=q("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 xb=q("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 EZ=q("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 IZ=q("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 PZ=q("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 LZ=q("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 OZ=q("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 DZ=q("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 RZ=q("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 FZ=q("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 zZ=q("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 BZ=q("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 $Z=q("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 UZ=q("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 qZ=q("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 VZ=q("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 HZ=q("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 WZ=q("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 GZ=q("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 KZ=q("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 ZZ=q("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 YZ=q("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 XZ=q("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 ya=q("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 QZ=q("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 yb=q("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 JZ=q("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 eo=q("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 eY=q("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 tY=q("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 rY=q("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 nY=q("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 sY=q("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 aY=q("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 iY=q("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 jd=q("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 oY=q("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 _c=q("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 lA=q("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 lY=q("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 cY=q("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 dY=q("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 uY=q("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 cA=q("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 hY=q("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 fY=q("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 pY=q("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 mY=q("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 gY=q("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 xY=q("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 vb=q("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 uf=q("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 yY=q("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 vY=q("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 _Y=q("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 Mg=q("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 bY=q("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 _h=q("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 wY=q("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 jY=q("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 kY=q("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=q("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=q("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 CY=q("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 MY=q("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 TY=q("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 AY=q("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 EY=q("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 IY=q("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 PY=q("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 LY=q("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 OY=q("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 DY=q("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 RY=q("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 FY=q("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 zY=q("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 BY=q("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 $Y=q("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 UY=q("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 dA=q("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 _b=q("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 qY=q("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 VY=q("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 Tg=q("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 HY=q("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 WY=q("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 GY=q("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 h1=q("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 KY=q("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 ZY=q("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 YY=q("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 XY=q("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 QY=q("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 As=q("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 JY=q("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 eX=q("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 tX=q("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 rX=q("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 nX=q("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 sX=q("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 aX=q("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 iX=q("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 bb=q("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 wb=q("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 jb=q("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 kb=q("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 Nb=q("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 Sb=q("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 Cb=q("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 Mb=q("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 Tb=q("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 Ab=q("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 Eb=q("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 Ib=q("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 Pb=q("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 Lb=q("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 Ob=q("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 sg=q("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 F0=q("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 Db=q("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 Rb=q("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 Fb=q("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 zb=q("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 Bb=q("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 $b=q("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 oX=q("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 lX=q("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 Ub=q("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 qb=q("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 Vb=q("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 Hb=q("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 Wb=q("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 Gb=q("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 Kb=q("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 Zb=q("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 Yb=q("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 Xb=q("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 Qb=q("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 Jb=q("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 ew=q("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 tw=q("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 rw=q("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 hc=q("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 nw=q("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 sw=q("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 aw=q("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 iw=q("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 ow=q("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 lw=q("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 cX=q("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 cw=q("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 dw=q("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 uw=q("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 hw=q("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 fw=q("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 dX=q("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 uX=q("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 pw=q("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 mw=q("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 gw=q("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 xw=q("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 Ag=q("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 hX=q("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 fX=q("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 pX=q("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 mX=q("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 gX=q("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 _s=q("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 xX=q("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 yX=q("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 vX=q("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 _X=q("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 bX=q("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 wX=q("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 jX=q("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 kX=q("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 NX=q("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 SX=q("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 CX=q("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 MX=q("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 TX=q("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 AX=q("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 B1=q("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 EX=q("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 IX=q("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 PX=q("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 LX=q("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 OX=q("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 DX=q("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 RX=q("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 FX=q("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 zX=q("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 SS=q("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 BX=q("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=q("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 UX=q("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 qX=q("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 VX=q("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 HX=q("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 WX=q("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 GX=q("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 KX=q("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 ZX=q("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 Eg=q("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 YX=q("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 XX=q("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 QX=q("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 JX=q("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 eQ=q("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 tQ=q("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 rQ=q("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 sy=q("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 nQ=q("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 sQ=q("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 aQ=q("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 iQ=q("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 yw=q("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 oQ=q("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 lQ=q("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 cQ=q("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 dQ=q("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 uQ=q("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 hQ=q("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 vw=q("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 fQ=q("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 pQ=q("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 mQ=q("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 gQ=q("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 xQ=q("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 uA=q("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 kd=q("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 yQ=q("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 vQ=q("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 _Q=q("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 bQ=q("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 wQ=q("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 jQ=q("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 hA=q("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 kQ=q("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 NQ=q("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 SQ=q("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 CQ=q("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 MQ=q("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 TQ=q("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 AQ=q("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 EQ=q("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 IQ=q("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 PQ=q("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 LQ=q("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 OQ=q("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 DQ=q("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 RQ=q("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 FQ=q("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 zQ=q("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 BQ=q("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=q("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 UQ=q("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 _w=q("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 $n=q("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 qQ=q("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 VQ=q("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 bw=q("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 $1=q("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 HQ=q("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 WQ=q("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 Ij=q("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 GQ=q("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 ap=q("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 Xh=q("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 KQ=q("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 ZQ=q("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 Yi=q("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 fA=q("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 YQ=q("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 XQ=q("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 ww=q("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 QQ=q("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 JQ=q("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 eJ=q("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 tJ=q("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 rJ=q("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 nJ=q("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 sJ=q("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 aJ=q("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 iJ=q("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 oJ=q("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 CS=q("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 lJ=q("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 cJ=q("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 dJ=q("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 jw=q("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 uJ=q("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 pA=q("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 hJ=q("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 ho=q("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 fJ=q("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 Pj=q("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 mA=q("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 pJ=q("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 mJ=q("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 hf=q("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 kw=q("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 Nw=q("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 Sw=q("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 gJ=q("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 Cw=q("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 xJ=q("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 Mw=q("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 Tw=q("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 yJ=q("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 vJ=q("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 ac=q("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 Aw=q("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=q("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 Ew=q("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 Iw=q("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 _J=q("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 gA=q("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 bJ=q("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 wJ=q("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 jJ=q("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 kJ=q("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 NJ=q("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 SJ=q("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 Da=q("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 CJ=q("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 MJ=q("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 TJ=q("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 AJ=q("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 EJ=q("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 IJ=q("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 PJ=q("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 LJ=q("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 OJ=q("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 DJ=q("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 RJ=q("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 Pw=q("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 FJ=q("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 zJ=q("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 Lw=q("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 BJ=q("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 $J=q("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 UJ=q("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 qJ=q("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 VJ=q("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 HJ=q("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 WJ=q("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 GJ=q("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 KJ=q("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 ZJ=q("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 YJ=q("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 XJ=q("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 QJ=q("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 JJ=q("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 eee=q("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 tee=q("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 ree=q("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 nee=q("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 see=q("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 aee=q("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 iee=q("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 oee=q("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 lee=q("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 cee=q("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 dee=q("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 ay=q("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 gs=q("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 uee=q("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 hee=q("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 Ig=q("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 MS=q("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 TS=q("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 uYe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:LO,AArrowUp:OO,ALargeSmall:DO,Accessibility:RO,Activity:wg,AirVent:FO,Airplay:zO,AlarmClock:$O,AlarmClockCheck:j_,AlarmClockMinus:k_,AlarmClockOff:BO,AlarmClockPlus:N_,AlarmSmoke:UO,Album:qO,AlignCenter:oS,AlignCenterHorizontal:VO,AlignCenterVertical:HO,AlignEndHorizontal:WO,AlignEndVertical:GO,AlignHorizontalDistributeCenter:KO,AlignHorizontalDistributeEnd:ZO,AlignHorizontalDistributeStart:YO,AlignHorizontalJustifyCenter:XO,AlignHorizontalJustifyEnd:QO,AlignHorizontalJustifyStart:JO,AlignHorizontalSpaceAround:e8,AlignHorizontalSpaceBetween:t8,AlignJustify:r8,AlignLeft:lS,AlignRight:cS,AlignStartHorizontal:n8,AlignStartVertical:s8,AlignVerticalDistributeCenter:a8,AlignVerticalDistributeEnd:i8,AlignVerticalDistributeStart:o8,AlignVerticalJustifyCenter:l8,AlignVerticalJustifyEnd:c8,AlignVerticalJustifyStart:d8,AlignVerticalSpaceAround:u8,AlignVerticalSpaceBetween:h8,Ambulance:f8,Ampersand:p8,Ampersands:m8,Amphora:g8,Anchor:x8,Angry:y8,Annoyed:v8,Antenna:_8,Anvil:b8,Aperture:w8,AppWindow:FT,AppWindowMac:j8,Apple:k8,Archive:C8,ArchiveRestore:N8,ArchiveX:S8,Armchair:M8,ArrowBigDown:A8,ArrowBigDownDash:T8,ArrowBigLeft:I8,ArrowBigLeftDash:E8,ArrowBigRight:L8,ArrowBigRightDash:P8,ArrowBigUp:D8,ArrowBigUpDash:O8,ArrowDown:Xx,ArrowDown01:R8,ArrowDown10:F8,ArrowDownAZ:S_,ArrowDownFromLine:z8,ArrowDownLeft:B8,ArrowDownNarrowWide:$8,ArrowDownRight:U8,ArrowDownToDot:q8,ArrowDownToLine:V8,ArrowDownUp:H8,ArrowDownWideNarrow:C_,ArrowDownZA:M_,ArrowLeft:io,ArrowLeftFromLine:W8,ArrowLeftRight:G8,ArrowLeftToLine:K8,ArrowRight:Jo,ArrowRightFromLine:Z8,ArrowRightLeft:Y8,ArrowRightToLine:X8,ArrowUp:ep,ArrowUp01:Q8,ArrowUp10:J8,ArrowUpAZ:T_,ArrowUpDown:jg,ArrowUpFromDot:eD,ArrowUpFromLine:tD,ArrowUpLeft:rD,ArrowUpNarrowWide:A_,ArrowUpRight:nD,ArrowUpToLine:sD,ArrowUpWideNarrow:aD,ArrowUpZA:E_,ArrowsUpFromLine:iD,Asterisk:oD,AtSign:lD,Atom:cD,AudioLines:dD,AudioWaveform:uD,Award:Rl,Axe:hD,Axis3d:I_,Baby:fD,Backpack:pD,Badge:AD,BadgeAlert:mD,BadgeCent:gD,BadgeCheck:P_,BadgeDollarSign:xD,BadgeEuro:yD,BadgeHelp:vD,BadgeIndianRupee:_D,BadgeInfo:bD,BadgeJapaneseYen:wD,BadgeMinus:jD,BadgePercent:kD,BadgePlus:ND,BadgePoundSterling:SD,BadgeRussianRuble:CD,BadgeSwissFranc:MD,BadgeX:TD,BaggageClaim:ED,Ban:ID,Banana:PD,Bandage:LD,Banknote:OD,Barcode:DD,Baseline:RD,Bath:C1,Battery:qD,BatteryCharging:FD,BatteryFull:zD,BatteryLow:BD,BatteryMedium:$D,BatteryWarning:UD,Beaker:VD,Bean:WD,BeanOff:HD,Bed:M1,BedDouble:GD,BedSingle:KD,Beef:ZD,Beer:XD,BeerOff:YD,Bell:kg,BellDot:QD,BellElectric:JD,BellMinus:eR,BellOff:xj,BellPlus:tR,BellRing:rR,BetweenHorizontalEnd:L_,BetweenHorizontalStart:O_,BetweenVerticalEnd:nR,BetweenVerticalStart:sR,BicepsFlexed:aR,Bike:iR,Binary:oR,Binoculars:lR,Biohazard:cR,Bird:dR,Bitcoin:uR,Blend:hR,Blinds:fR,Blocks:pR,Bluetooth:yR,BluetoothConnected:mR,BluetoothOff:gR,BluetoothSearching:xR,Bold:dS,Bolt:vR,Bomb:_R,Bone:bR,Book:qR,BookA:wR,BookAudio:jR,BookCheck:kR,BookCopy:NR,BookDashed:D_,BookDown:SR,BookHeadphones:CR,BookHeart:MR,BookImage:TR,BookKey:AR,BookLock:ER,BookMarked:IR,BookMinus:PR,BookOpen:zT,BookOpenCheck:LR,BookOpenText:OR,BookPlus:DR,BookText:RR,BookType:FR,BookUp:BR,BookUp2:zR,BookUser:$R,BookX:UR,Bookmark:vm,BookmarkCheck:VR,BookmarkMinus:HR,BookmarkPlus:BT,BookmarkX:WR,BoomBox:GR,Bot:uS,BotMessageSquare:KR,BotOff:ZR,Box:YR,Boxes:XR,Braces:R_,Brackets:QR,Brain:$T,BrainCircuit:JR,BrainCog:eF,BrickWall:tF,Briefcase:Nh,BriefcaseBusiness:rF,BriefcaseConveyorBelt:nF,BriefcaseMedical:sF,BringToFront:aF,Brush:iF,Bug:cF,BugOff:oF,BugPlay:lF,Building:yj,Building2:li,Bus:uF,BusFront:dF,Cable:fF,CableCar:hF,Cake:of,CakeSlice:pF,Calculator:mF,Calendar:Ds,Calendar1:gF,CalendarArrowDown:xF,CalendarArrowUp:yF,CalendarCheck:_F,CalendarCheck2:vF,CalendarClock:UT,CalendarCog:bF,CalendarDays:_m,CalendarFold:wF,CalendarHeart:jF,CalendarMinus:NF,CalendarMinus2:kF,CalendarOff:SF,CalendarPlus:vj,CalendarPlus2:CF,CalendarRange:MF,CalendarSearch:TF,CalendarSync:AF,CalendarX:IF,CalendarX2:EF,Camera:Ng,CameraOff:PF,Candy:DF,CandyCane:LF,CandyOff:OF,Cannabis:RF,Captions:F_,CaptionsOff:FF,Car:$F,CarFront:zF,CarTaxiFront:BF,Caravan:UF,Carrot:qF,CaseLower:VF,CaseSensitive:HF,CaseUpper:WF,CassetteTape:GF,Cast:KF,Castle:ZF,Cat:YF,Cctv:XF,ChartArea:z_,ChartBar:$_,ChartBarBig:B_,ChartBarDecreasing:QF,ChartBarIncreasing:JF,ChartBarStacked:ez,ChartCandlestick:U_,ChartColumn:gc,ChartColumnBig:q_,ChartColumnDecreasing:tz,ChartColumnIncreasing:V_,ChartColumnStacked:rz,ChartGantt:nz,ChartLine:H_,ChartNetwork:sz,ChartNoAxesColumn:G_,ChartNoAxesColumnDecreasing:az,ChartNoAxesColumnIncreasing:W_,ChartNoAxesCombined:iz,ChartNoAxesGantt:K_,ChartPie:Z_,ChartScatter:Y_,ChartSpline:oz,Check:_i,CheckCheck:lz,ChefHat:cz,Cherry:dz,ChevronDown:Qd,ChevronFirst:uz,ChevronLast:hz,ChevronLeft:vc,ChevronRight:Bi,ChevronUp:T1,ChevronsDown:pz,ChevronsDownUp:fz,ChevronsLeft:xz,ChevronsLeftRight:gz,ChevronsLeftRightEllipsis:mz,ChevronsRight:vz,ChevronsRightLeft:yz,ChevronsUp:_z,ChevronsUpDown:Qx,Chrome:bz,Church:wz,Cigarette:kz,CigaretteOff:jz,Circle:Gu,CircleAlert:pl,CircleArrowDown:X_,CircleArrowLeft:Q_,CircleArrowOutDownLeft:J_,CircleArrowOutDownRight:e2,CircleArrowOutUpLeft:t2,CircleArrowOutUpRight:r2,CircleArrowRight:n2,CircleArrowUp:s2,CircleCheck:Xi,CircleCheckBig:Ii,CircleChevronDown:a2,CircleChevronLeft:i2,CircleChevronRight:o2,CircleChevronUp:l2,CircleDashed:Nz,CircleDivide:c2,CircleDollarSign:Sz,CircleDot:Mz,CircleDotDashed:Cz,CircleEllipsis:Tz,CircleEqual:Az,CircleFadingArrowUp:Ez,CircleFadingPlus:Iz,CircleGauge:d2,CircleHelp:Dx,CircleMinus:u2,CircleOff:Pz,CircleParking:f2,CircleParkingOff:h2,CirclePause:p2,CirclePercent:m2,CirclePlay:Gf,CirclePlus:g2,CirclePower:x2,CircleSlash:Lz,CircleSlash2:y2,CircleStop:v2,CircleUser:b2,CircleUserRound:_2,CircleX:Lc,CircuitBoard:Oz,Citrus:Dz,Clapperboard:Rz,Clipboard:Vz,ClipboardCheck:qT,ClipboardCopy:Fz,ClipboardList:VT,ClipboardMinus:zz,ClipboardPaste:Bz,ClipboardPen:j2,ClipboardPenLine:w2,ClipboardPlus:$z,ClipboardType:Uz,ClipboardX:qz,Clock:Wa,Clock1:Hz,Clock10:Wz,Clock11:Gz,Clock12:Kz,Clock2:Zz,Clock3:Yz,Clock4:Xz,Clock5:Qz,Clock6:Jz,Clock7:e7,Clock8:t7,Clock9:r7,ClockAlert:n7,ClockArrowDown:s7,ClockArrowUp:a7,Cloud:_7,CloudAlert:i7,CloudCog:o7,CloudDownload:k2,CloudDrizzle:l7,CloudFog:c7,CloudHail:d7,CloudLightning:u7,CloudMoon:f7,CloudMoonRain:h7,CloudOff:p7,CloudRain:g7,CloudRainWind:m7,CloudSnow:x7,CloudSun:v7,CloudSunRain:y7,CloudUpload:N2,Cloudy:b7,Clover:Vx,Club:w7,Code:_j,CodeXml:S2,Codepen:j7,Codesandbox:k7,Coffee:bj,Cog:N7,Coins:S7,Columns2:C2,Columns3:M2,Columns4:C7,Combine:M7,Command:T7,Compass:A7,Component:E7,Computer:I7,ConciergeBell:P7,Cone:L7,Construction:O7,Contact:D7,ContactRound:T2,Container:R7,Contrast:F7,Cookie:z7,CookingPot:B7,Copy:tl,CopyCheck:$7,CopyMinus:U7,CopyPlus:q7,CopySlash:V7,CopyX:H7,Copyleft:W7,Copyright:G7,CornerDownLeft:K7,CornerDownRight:Z7,CornerLeftDown:Y7,CornerLeftUp:X7,CornerRightDown:Q7,CornerRightUp:J7,CornerUpLeft:eB,CornerUpRight:tB,Cpu:rB,CreativeCommons:nB,CreditCard:bm,Croissant:sB,Crop:aB,Cross:iB,Crosshair:oB,Crown:A1,Cuboid:lB,CupSoda:cB,Currency:dB,Cylinder:uB,Dam:hB,Database:mB,DatabaseBackup:fB,DatabaseZap:pB,Delete:gB,Dessert:xB,Diameter:yB,Diamond:bB,DiamondMinus:vB,DiamondPercent:A2,DiamondPlus:_B,Dice1:wB,Dice2:jB,Dice3:kB,Dice4:NB,Dice5:SB,Dice6:CB,Dices:MB,Diff:TB,Disc:PB,Disc2:AB,Disc3:EB,DiscAlbum:IB,Divide:LB,Dna:DB,DnaOff:OB,Dock:RB,Dog:FB,DollarSign:wd,Donut:zB,DoorClosed:BB,DoorOpen:wj,Dot:$B,Download:ao,DraftingCompass:UB,Drama:qB,Dribbble:VB,Drill:HB,Droplet:WB,Droplets:GB,Drum:KB,Drumstick:ZB,Dumbbell:YB,Ear:QB,EarOff:XB,Earth:E2,EarthLock:JB,Eclipse:e9,Egg:hS,EggFried:t9,EggOff:r9,Ellipsis:lm,EllipsisVertical:Rx,Equal:a9,EqualApproximately:n9,EqualNot:s9,Eraser:i9,EthernetPort:o9,Euro:l9,Expand:c9,ExternalLink:Os,Eye:$o,EyeClosed:d9,EyeOff:E1,Facebook:Jd,Factory:u9,Fan:h9,FastForward:f9,Feather:p9,Fence:m9,FerrisWheel:g9,Figma:x9,File:u$,FileArchive:y9,FileAudio:_9,FileAudio2:v9,FileAxis3d:I2,FileBadge:w9,FileBadge2:b9,FileBox:j9,FileChartColumn:L2,FileChartColumnIncreasing:P2,FileChartLine:O2,FileChartPie:D2,FileCheck:N9,FileCheck2:k9,FileClock:S9,FileCode:M9,FileCode2:C9,FileCog:R2,FileDiff:T9,FileDigit:A9,FileDown:E9,FileHeart:I9,FileImage:I1,FileInput:P9,FileJson:O9,FileJson2:L9,FileKey:R9,FileKey2:D9,FileLock:z9,FileLock2:F9,FileMinus:$9,FileMinus2:B9,FileMusic:U9,FileOutput:q9,FilePen:z2,FilePenLine:F2,FilePlus:H9,FilePlus2:V9,FileQuestion:W9,FileScan:G9,FileSearch:Z9,FileSearch2:K9,FileSliders:Y9,FileSpreadsheet:P1,FileStack:X9,FileSymlink:Q9,FileTerminal:J9,FileText:ka,FileType:t$,FileType2:e$,FileUp:r$,FileUser:n$,FileVideo:a$,FileVideo2:s$,FileVolume:o$,FileVolume2:i$,FileWarning:l$,FileX:d$,FileX2:c$,Files:h$,Film:$d,Filter:L1,FilterX:f$,Fingerprint:p$,FireExtinguisher:m$,Fish:y$,FishOff:g$,FishSymbol:x$,Flag:Jx,FlagOff:v$,FlagTriangleLeft:_$,FlagTriangleRight:b$,Flame:lf,FlameKindling:w$,Flashlight:k$,FlashlightOff:j$,FlaskConical:jj,FlaskConicalOff:N$,FlaskRound:S$,FlipHorizontal:M$,FlipHorizontal2:C$,FlipVertical:A$,FlipVertical2:T$,Flower:E$,Flower2:fm,Focus:I$,FoldHorizontal:P$,FoldVertical:L$,Folder:oU,FolderArchive:O$,FolderCheck:D$,FolderClock:R$,FolderClosed:F$,FolderCode:z$,FolderCog:B2,FolderDot:B$,FolderDown:$$,FolderGit:q$,FolderGit2:U$,FolderHeart:V$,FolderInput:H$,FolderKanban:W$,FolderKey:G$,FolderLock:K$,FolderMinus:Z$,FolderOpen:Sg,FolderOpenDot:Y$,FolderOutput:X$,FolderPen:$2,FolderPlus:Q$,FolderRoot:J$,FolderSearch:tU,FolderSearch2:eU,FolderSymlink:rU,FolderSync:nU,FolderTree:sU,FolderUp:aU,FolderX:iU,Folders:lU,Footprints:cU,Forklift:dU,Forward:uU,Frame:hU,Framer:fU,Frown:pU,Fuel:mU,Fullscreen:gU,GalleryHorizontal:yU,GalleryHorizontalEnd:xU,GalleryThumbnails:vU,GalleryVertical:bU,GalleryVerticalEnd:_U,Gamepad:jU,Gamepad2:wU,Gauge:kU,Gavel:NU,Gem:SU,Ghost:kj,Gift:Zi,GitBranch:MU,GitBranchPlus:CU,GitCommitHorizontal:U2,GitCommitVertical:TU,GitCompare:EU,GitCompareArrows:AU,GitFork:IU,GitGraph:PU,GitMerge:LU,GitPullRequest:BU,GitPullRequestArrow:OU,GitPullRequestClosed:DU,GitPullRequestCreate:FU,GitPullRequestCreateArrow:RU,GitPullRequestDraft:zU,Github:$U,Gitlab:UU,GlassWater:qU,Glasses:VU,Globe:ey,GlobeLock:HU,Goal:WU,Grab:GU,GraduationCap:O1,Grape:KU,Grid2x2:V2,Grid2x2Check:ZU,Grid2x2Plus:q2,Grid2x2X:YU,Grid3x3:Gh,Grip:QU,GripHorizontal:XU,GripVertical:D1,Group:JU,Guitar:eq,Ham:tq,Hammer:rq,Hand:oq,HandCoins:nq,HandHeart:sq,HandHelping:H2,HandMetal:aq,HandPlatter:iq,Handshake:lq,HardDrive:HT,HardDriveDownload:cq,HardDriveUpload:dq,HardHat:uq,Hash:fS,Haze:hq,HdmiPort:fq,Heading:yq,Heading1:WT,Heading2:GT,Heading3:pq,Heading4:mq,Heading5:gq,Heading6:xq,HeadphoneOff:vq,Headphones:_q,Headset:bq,Heart:fi,HeartCrack:wq,HeartHandshake:jq,HeartOff:kq,HeartPulse:Nq,Heater:Sq,Hexagon:Cq,Highlighter:Mq,History:pS,Hop:Aq,HopOff:Tq,Hospital:Eq,Hotel:Iq,Hourglass:Pq,House:ua,HousePlug:Lq,HousePlus:Oq,IceCreamBowl:W2,IceCreamCone:G2,IdCard:Dq,Image:Ol,ImageDown:Rq,ImageMinus:Fq,ImageOff:zq,ImagePlay:Bq,ImagePlus:mS,ImageUp:$q,ImageUpscale:Uq,Images:qq,Import:Vq,Inbox:Hq,IndentDecrease:K2,IndentIncrease:Z2,IndianRupee:Wq,Infinity:Gq,Info:Kq,InspectionPanel:Zq,Instagram:mu,Italic:gS,IterationCcw:Yq,IterationCw:Xq,JapaneseYen:Qq,Joystick:Jq,Kanban:ty,Key:cf,KeyRound:Nj,KeySquare:eV,Keyboard:nV,KeyboardMusic:tV,KeyboardOff:rV,Lamp:cV,LampCeiling:sV,LampDesk:aV,LampFloor:iV,LampWallDown:oV,LampWallUp:lV,LandPlot:dV,Landmark:uV,Languages:hV,Laptop:pV,LaptopMinimal:Y2,LaptopMinimalCheck:fV,Lasso:gV,LassoSelect:mV,Laugh:xV,Layers:_V,Layers2:yV,Layers3:vV,LayoutDashboard:Sj,LayoutGrid:tp,LayoutList:bV,LayoutPanelLeft:wV,LayoutPanelTop:jV,LayoutTemplate:Cj,Leaf:kV,LeafyGreen:NV,Lectern:SV,LetterText:CV,Library:xS,LibraryBig:MV,LifeBuoy:yS,Ligature:TV,Lightbulb:R1,LightbulbOff:AV,Link:Mo,Link2:df,Link2Off:EV,Linkedin:wm,List:rp,ListCheck:IV,ListChecks:PV,ListCollapse:LV,ListEnd:OV,ListFilter:DV,ListMinus:RV,ListMusic:FV,ListOrdered:vS,ListPlus:zV,ListRestart:BV,ListStart:$V,ListTodo:UV,ListTree:qV,ListVideo:VV,ListX:HV,Loader:GV,LoaderCircle:Yr,LoaderPinwheel:WV,Locate:KT,LocateFixed:KV,LocateOff:ZV,Lock:np,LockKeyhole:YV,LockKeyholeOpen:X2,LockOpen:Q2,LogIn:_S,LogOut:bS,Logs:XV,Lollipop:QV,Luggage:JV,Magnet:eH,Mail:ws,MailCheck:tH,MailMinus:rH,MailOpen:nH,MailPlus:sH,MailQuestion:aH,MailSearch:iH,MailWarning:oH,MailX:ZT,Mailbox:lH,Mails:cH,Map:bH,MapPin:To,MapPinCheck:uH,MapPinCheckInside:dH,MapPinHouse:hH,MapPinMinus:pH,MapPinMinusInside:fH,MapPinOff:mH,MapPinPlus:xH,MapPinPlusInside:gH,MapPinX:vH,MapPinXInside:yH,MapPinned:_H,Martini:wH,Maximize:kH,Maximize2:jH,Medal:ry,Megaphone:jm,MegaphoneOff:NH,Meh:SH,MemoryStick:CH,Menu:YT,Merge:MH,MessageCircle:Bl,MessageCircleCode:TH,MessageCircleDashed:AH,MessageCircleHeart:wS,MessageCircleMore:EH,MessageCircleOff:IH,MessageCirclePlus:PH,MessageCircleQuestion:XT,MessageCircleReply:LH,MessageCircleWarning:OH,MessageCircleX:DH,MessageSquare:Do,MessageSquareCode:RH,MessageSquareDashed:FH,MessageSquareDiff:zH,MessageSquareDot:BH,MessageSquareHeart:$H,MessageSquareLock:UH,MessageSquareMore:qH,MessageSquareOff:VH,MessageSquarePlus:HH,MessageSquareQuote:QT,MessageSquareReply:WH,MessageSquareShare:GH,MessageSquareText:KH,MessageSquareWarning:ZH,MessageSquareX:YH,MessagesSquare:XH,Mic:JT,MicOff:QH,MicVocal:J2,Microchip:JH,Microscope:eW,Microwave:tW,Milestone:rW,Milk:sW,MilkOff:nW,Minimize:iW,Minimize2:aW,Minus:F1,Monitor:Mj,MonitorCheck:oW,MonitorCog:lW,MonitorDot:cW,MonitorDown:dW,MonitorOff:uW,MonitorPause:hW,MonitorPlay:fW,MonitorSmartphone:pW,MonitorSpeaker:mW,MonitorStop:gW,MonitorUp:xW,MonitorX:yW,Moon:_W,MoonStar:vW,Mountain:wW,MountainSnow:bW,Mouse:CW,MouseOff:jW,MousePointer:SW,MousePointer2:kW,MousePointerBan:NW,MousePointerClick:Tj,Move:BW,Move3d:eb,MoveDiagonal:TW,MoveDiagonal2:MW,MoveDown:IW,MoveDownLeft:AW,MoveDownRight:EW,MoveHorizontal:PW,MoveLeft:LW,MoveRight:OW,MoveUp:FW,MoveUpLeft:DW,MoveUpRight:RW,MoveVertical:zW,Music:VW,Music2:$W,Music3:UW,Music4:qW,Navigation:eA,Navigation2:WW,Navigation2Off:HW,NavigationOff:GW,Network:KW,Newspaper:ny,Nfc:ZW,Notebook:JW,NotebookPen:YW,NotebookTabs:XW,NotebookText:QW,NotepadText:tG,NotepadTextDashed:eG,Nut:nG,NutOff:rG,Octagon:aG,OctagonAlert:tb,OctagonMinus:sG,OctagonPause:rb,OctagonX:nb,Omega:iG,Option:oG,Orbit:lG,Origami:cG,Package:$l,Package2:dG,PackageCheck:uG,PackageMinus:hG,PackageOpen:fG,PackagePlus:pG,PackageSearch:mG,PackageX:gG,PaintBucket:xG,PaintRoller:yG,Paintbrush:vG,PaintbrushVertical:sb,Palette:Rc,PanelBottom:wG,PanelBottomClose:_G,PanelBottomDashed:ab,PanelBottomOpen:bG,PanelLeft:cb,PanelLeftClose:ib,PanelLeftDashed:ob,PanelLeftOpen:lb,PanelRight:NG,PanelRightClose:jG,PanelRightDashed:db,PanelRightOpen:kG,PanelTop:MG,PanelTopClose:SG,PanelTopDashed:ub,PanelTopOpen:CG,PanelsLeftBottom:TG,PanelsRightBottom:AG,PanelsTopLeft:O0,Paperclip:EG,Parentheses:IG,ParkingMeter:PG,PartyPopper:Fc,Pause:sp,PawPrint:LG,PcCase:OG,Pen:R0,PenLine:D0,PenOff:DG,PenTool:Aj,Pencil:ni,PencilLine:RG,PencilOff:FG,PencilRuler:zG,Pentagon:BG,Percent:jS,PersonStanding:$G,PhilippinePeso:UG,Phone:ji,PhoneCall:qG,PhoneForwarded:VG,PhoneIncoming:HG,PhoneMissed:WG,PhoneOff:GG,PhoneOutgoing:KG,Pi:ZG,Piano:YG,Pickaxe:XG,PictureInPicture:JG,PictureInPicture2:QG,PiggyBank:eK,Pilcrow:nK,PilcrowLeft:tK,PilcrowRight:rK,Pill:aK,PillBottle:sK,Pin:z1,PinOff:tA,Pipette:iK,Pizza:oK,Plane:dK,PlaneLanding:lK,PlaneTakeoff:cK,Play:Ul,Plug:rA,Plug2:uK,PlugZap:hb,Plus:_n,Pocket:fK,PocketKnife:hK,Podcast:pK,Pointer:gK,PointerOff:mK,Popcorn:xK,Popsicle:yK,PoundSterling:vK,Power:bK,PowerOff:_K,Presentation:wK,Printer:kK,PrinterCheck:jK,Projector:NK,Proportions:SK,Puzzle:CK,Pyramid:MK,QrCode:nA,Quote:sA,Rabbit:TK,Radar:AK,Radiation:EK,Radical:IK,Radio:Ej,RadioReceiver:PK,RadioTower:LK,Radius:OK,RailSymbol:DK,Rainbow:RK,Rat:FK,Ratio:zK,Receipt:KK,ReceiptCent:BK,ReceiptEuro:$K,ReceiptIndianRupee:UK,ReceiptJapaneseYen:qK,ReceiptPoundSterling:VK,ReceiptRussianRuble:HK,ReceiptSwissFranc:WK,ReceiptText:GK,RectangleEllipsis:fb,RectangleHorizontal:ZK,RectangleVertical:YK,Recycle:XK,Redo:kS,Redo2:QK,RedoDot:JK,RefreshCcw:tZ,RefreshCcwDot:eZ,RefreshCw:Ll,RefreshCwOff:rZ,Refrigerator:nZ,Regex:sZ,RemoveFormatting:aZ,Repeat:aA,Repeat1:iZ,Repeat2:oZ,Replace:cZ,ReplaceAll:lZ,Reply:iA,ReplyAll:dZ,Rewind:uZ,Ribbon:hZ,Rocket:Cg,RockingChair:fZ,RollerCoaster:pZ,Rotate3d:pb,RotateCcw:NS,RotateCcwSquare:mZ,RotateCw:oA,RotateCwSquare:gZ,Route:yZ,RouteOff:xZ,Router:vZ,Rows2:mb,Rows3:gb,Rows4:_Z,Rss:bZ,Ruler:wZ,RussianRuble:jZ,Sailboat:kZ,Salad:NZ,Sandwich:SZ,Satellite:MZ,SatelliteDish:CZ,Save:km,SaveAll:TZ,SaveOff:AZ,Scale:EZ,Scale3d:xb,Scaling:IZ,Scan:BZ,ScanBarcode:PZ,ScanEye:LZ,ScanFace:OZ,ScanLine:DZ,ScanQrCode:RZ,ScanSearch:FZ,ScanText:zZ,School:$Z,Scissors:qZ,ScissorsLineDashed:UZ,ScreenShare:HZ,ScreenShareOff:VZ,Scroll:GZ,ScrollText:WZ,Search:ya,SearchCheck:KZ,SearchCode:ZZ,SearchSlash:YZ,SearchX:XZ,Section:QZ,Send:eo,SendHorizontal:yb,SendToBack:JZ,SeparatorHorizontal:eY,SeparatorVertical:tY,Server:aY,ServerCog:rY,ServerCrash:nY,ServerOff:sY,Settings:jd,Settings2:iY,Shapes:oY,Share:lA,Share2:_c,Sheet:lY,Shell:cY,Shield:uf,ShieldAlert:dY,ShieldBan:uY,ShieldCheck:cA,ShieldEllipsis:hY,ShieldHalf:fY,ShieldMinus:pY,ShieldOff:mY,ShieldPlus:gY,ShieldQuestion:xY,ShieldX:vb,Ship:vY,ShipWheel:yY,Shirt:_Y,ShoppingBag:Mg,ShoppingBasket:bY,ShoppingCart:_h,Shovel:wY,ShowerHead:jY,Shrink:kY,Shrub:NY,Shuffle:SY,Sigma:CY,Signal:IY,SignalHigh:MY,SignalLow:TY,SignalMedium:AY,SignalZero:EY,Signature:PY,Signpost:OY,SignpostBig:LY,Siren:DY,SkipBack:RY,SkipForward:FY,Skull:zY,Slack:BY,Slash:$Y,Slice:UY,SlidersHorizontal:dA,SlidersVertical:_b,Smartphone:Tg,SmartphoneCharging:qY,SmartphoneNfc:VY,Smile:WY,SmilePlus:HY,Snail:GY,Snowflake:h1,Sofa:KY,Soup:ZY,Space:YY,Spade:XY,Sparkle:QY,Sparkles:As,Speaker:JY,Speech:eX,SpellCheck:rX,SpellCheck2:tX,Spline:nX,Split:sX,SprayCan:aX,Sprout:iX,Square:Ag,SquareActivity:bb,SquareArrowDown:kb,SquareArrowDownLeft:wb,SquareArrowDownRight:jb,SquareArrowLeft:Nb,SquareArrowOutDownLeft:Sb,SquareArrowOutDownRight:Cb,SquareArrowOutUpLeft:Mb,SquareArrowOutUpRight:Tb,SquareArrowRight:Ab,SquareArrowUp:Pb,SquareArrowUpLeft:Eb,SquareArrowUpRight:Ib,SquareAsterisk:Lb,SquareBottomDashedScissors:Ob,SquareChartGantt:sg,SquareCheck:Db,SquareCheckBig:F0,SquareChevronDown:Rb,SquareChevronLeft:Fb,SquareChevronRight:zb,SquareChevronUp:Bb,SquareCode:$b,SquareDashed:Vb,SquareDashedBottom:lX,SquareDashedBottomCode:oX,SquareDashedKanban:Ub,SquareDashedMousePointer:qb,SquareDivide:Hb,SquareDot:Wb,SquareEqual:Gb,SquareFunction:Kb,SquareKanban:Zb,SquareLibrary:Yb,SquareM:Xb,SquareMenu:Qb,SquareMinus:Jb,SquareMousePointer:ew,SquareParking:rw,SquareParkingOff:tw,SquarePen:hc,SquarePercent:nw,SquarePi:sw,SquarePilcrow:aw,SquarePlay:iw,SquarePlus:ow,SquarePower:lw,SquareRadical:cX,SquareScissors:cw,SquareSigma:dw,SquareSlash:uw,SquareSplitHorizontal:hw,SquareSplitVertical:fw,SquareSquare:dX,SquareStack:uX,SquareTerminal:pw,SquareUser:gw,SquareUserRound:mw,SquareX:xw,Squircle:hX,Squirrel:fX,Stamp:pX,Star:_s,StarHalf:mX,StarOff:gX,StepBack:xX,StepForward:yX,Stethoscope:vX,Sticker:_X,StickyNote:bX,Store:wX,StretchHorizontal:jX,StretchVertical:kX,Strikethrough:NX,Subscript:SX,Sun:B1,SunDim:CX,SunMedium:MX,SunMoon:TX,SunSnow:AX,Sunrise:EX,Sunset:IX,Superscript:PX,SwatchBook:LX,SwissFranc:OX,SwitchCamera:DX,Sword:RX,Swords:FX,Syringe:zX,Table:WX,Table2:SS,TableCellsMerge:BX,TableCellsSplit:$X,TableColumnsSplit:UX,TableOfContents:qX,TableProperties:VX,TableRowsSplit:HX,Tablet:KX,TabletSmartphone:GX,Tablets:ZX,Tag:Eg,Tags:YX,Tally1:XX,Tally2:QX,Tally3:JX,Tally4:eQ,Tally5:tQ,Tangent:rQ,Target:sy,Telescope:nQ,Tent:aQ,TentTree:sQ,Terminal:iQ,TestTube:oQ,TestTubeDiagonal:yw,TestTubes:lQ,Text:fQ,TextCursor:dQ,TextCursorInput:cQ,TextQuote:uQ,TextSearch:hQ,TextSelect:vw,Theater:pQ,Thermometer:xQ,ThermometerSnowflake:mQ,ThermometerSun:gQ,ThumbsDown:uA,ThumbsUp:kd,Ticket:hA,TicketCheck:yQ,TicketMinus:vQ,TicketPercent:_Q,TicketPlus:bQ,TicketSlash:wQ,TicketX:jQ,Tickets:NQ,TicketsPlane:kQ,Timer:MQ,TimerOff:SQ,TimerReset:CQ,ToggleLeft:TQ,ToggleRight:AQ,Toilet:EQ,Tornado:IQ,Torus:PQ,Touchpad:OQ,TouchpadOff:LQ,TowerControl:DQ,ToyBrick:RQ,Tractor:FQ,TrafficCone:zQ,TrainFront:$Q,TrainFrontTunnel:BQ,TrainTrack:UQ,TramFront:_w,Trash:qQ,Trash2:$n,TreeDeciduous:VQ,TreePalm:bw,TreePine:$1,Trees:HQ,Trello:WQ,TrendingDown:Ij,TrendingUp:ap,TrendingUpDown:GQ,Triangle:ZQ,TriangleAlert:Xh,TriangleRight:KQ,Trophy:Yi,Truck:fA,Turtle:YQ,Tv:QQ,TvMinimal:ww,TvMinimalPlay:XQ,Twitch:JQ,Twitter:eJ,Type:rJ,TypeOutline:tJ,Umbrella:sJ,UmbrellaOff:nJ,Underline:aJ,Undo:CS,Undo2:iJ,UndoDot:oJ,UnfoldHorizontal:lJ,UnfoldVertical:cJ,Ungroup:dJ,University:jw,Unlink:pA,Unlink2:uJ,Unplug:hJ,Upload:ho,Usb:fJ,User:ac,UserCheck:Pj,UserCog:mA,UserMinus:pJ,UserPen:mJ,UserPlus:hf,UserRound:Tw,UserRoundCheck:kw,UserRoundCog:Nw,UserRoundMinus:Sw,UserRoundPen:gJ,UserRoundPlus:Cw,UserRoundSearch:xJ,UserRoundX:Mw,UserSearch:yJ,UserX:vJ,Users:Bn,UsersRound:Aw,Utensils:Iw,UtensilsCrossed:Ew,UtilityPole:_J,Variable:gA,Vault:bJ,Vegan:wJ,VenetianMask:jJ,Vibrate:NJ,VibrateOff:kJ,Video:Da,VideoOff:SJ,Videotape:CJ,View:MJ,Voicemail:TJ,Volleyball:AJ,Volume:OJ,Volume1:EJ,Volume2:IJ,VolumeOff:PJ,VolumeX:LJ,Vote:DJ,Wallet:FJ,WalletCards:RJ,WalletMinimal:Pw,Wallpaper:zJ,Wand:BJ,WandSparkles:Lw,Warehouse:$J,WashingMachine:UJ,Watch:qJ,Waves:VJ,Waypoints:HJ,Webcam:WJ,Webhook:KJ,WebhookOff:GJ,Weight:ZJ,Wheat:XJ,WheatOff:YJ,WholeWord:QJ,Wifi:nee,WifiHigh:JJ,WifiLow:eee,WifiOff:tee,WifiZero:ree,Wind:aee,WindArrowDown:see,Wine:oee,WineOff:iee,Workflow:lee,Worm:cee,WrapText:dee,Wrench:ay,X:gs,Youtube:uee,Zap:Ig,ZapOff:hee,ZoomIn:MS,ZoomOut:TS},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 dEe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:LO,AArrowDownIcon:LO,AArrowUp:OO,AArrowUpIcon:OO,ALargeSmall:DO,ALargeSmallIcon:DO,Accessibility:RO,AccessibilityIcon:RO,Activity:wg,ActivityIcon:wg,ActivitySquare:bb,ActivitySquareIcon:bb,AirVent:FO,AirVentIcon:FO,Airplay:zO,AirplayIcon:zO,AlarmCheck:j_,AlarmCheckIcon:j_,AlarmClock:$O,AlarmClockCheck:j_,AlarmClockCheckIcon:j_,AlarmClockIcon:$O,AlarmClockMinus:k_,AlarmClockMinusIcon:k_,AlarmClockOff:BO,AlarmClockOffIcon:BO,AlarmClockPlus:N_,AlarmClockPlusIcon:N_,AlarmMinus:k_,AlarmMinusIcon:k_,AlarmPlus:N_,AlarmPlusIcon:N_,AlarmSmoke:UO,AlarmSmokeIcon:UO,Album:qO,AlbumIcon:qO,AlertCircle:pl,AlertCircleIcon:pl,AlertOctagon:tb,AlertOctagonIcon:tb,AlertTriangle:Xh,AlertTriangleIcon:Xh,AlignCenter:oS,AlignCenterHorizontal:VO,AlignCenterHorizontalIcon:VO,AlignCenterIcon:oS,AlignCenterVertical:HO,AlignCenterVerticalIcon:HO,AlignEndHorizontal:WO,AlignEndHorizontalIcon:WO,AlignEndVertical:GO,AlignEndVerticalIcon:GO,AlignHorizontalDistributeCenter:KO,AlignHorizontalDistributeCenterIcon:KO,AlignHorizontalDistributeEnd:ZO,AlignHorizontalDistributeEndIcon:ZO,AlignHorizontalDistributeStart:YO,AlignHorizontalDistributeStartIcon:YO,AlignHorizontalJustifyCenter:XO,AlignHorizontalJustifyCenterIcon:XO,AlignHorizontalJustifyEnd:QO,AlignHorizontalJustifyEndIcon:QO,AlignHorizontalJustifyStart:JO,AlignHorizontalJustifyStartIcon:JO,AlignHorizontalSpaceAround:e8,AlignHorizontalSpaceAroundIcon:e8,AlignHorizontalSpaceBetween:t8,AlignHorizontalSpaceBetweenIcon:t8,AlignJustify:r8,AlignJustifyIcon:r8,AlignLeft:lS,AlignLeftIcon:lS,AlignRight:cS,AlignRightIcon:cS,AlignStartHorizontal:n8,AlignStartHorizontalIcon:n8,AlignStartVertical:s8,AlignStartVerticalIcon:s8,AlignVerticalDistributeCenter:a8,AlignVerticalDistributeCenterIcon:a8,AlignVerticalDistributeEnd:i8,AlignVerticalDistributeEndIcon:i8,AlignVerticalDistributeStart:o8,AlignVerticalDistributeStartIcon:o8,AlignVerticalJustifyCenter:l8,AlignVerticalJustifyCenterIcon:l8,AlignVerticalJustifyEnd:c8,AlignVerticalJustifyEndIcon:c8,AlignVerticalJustifyStart:d8,AlignVerticalJustifyStartIcon:d8,AlignVerticalSpaceAround:u8,AlignVerticalSpaceAroundIcon:u8,AlignVerticalSpaceBetween:h8,AlignVerticalSpaceBetweenIcon:h8,Ambulance:f8,AmbulanceIcon:f8,Ampersand:p8,AmpersandIcon:p8,Ampersands:m8,AmpersandsIcon:m8,Amphora:g8,AmphoraIcon:g8,Anchor:x8,AnchorIcon:x8,Angry:y8,AngryIcon:y8,Annoyed:v8,AnnoyedIcon:v8,Antenna:_8,AntennaIcon:_8,Anvil:b8,AnvilIcon:b8,Aperture:w8,ApertureIcon:w8,AppWindow:FT,AppWindowIcon:FT,AppWindowMac:j8,AppWindowMacIcon:j8,Apple:k8,AppleIcon:k8,Archive:C8,ArchiveIcon:C8,ArchiveRestore:N8,ArchiveRestoreIcon:N8,ArchiveX:S8,ArchiveXIcon:S8,AreaChart:z_,AreaChartIcon:z_,Armchair:M8,ArmchairIcon:M8,ArrowBigDown:A8,ArrowBigDownDash:T8,ArrowBigDownDashIcon:T8,ArrowBigDownIcon:A8,ArrowBigLeft:I8,ArrowBigLeftDash:E8,ArrowBigLeftDashIcon:E8,ArrowBigLeftIcon:I8,ArrowBigRight:L8,ArrowBigRightDash:P8,ArrowBigRightDashIcon:P8,ArrowBigRightIcon:L8,ArrowBigUp:D8,ArrowBigUpDash:O8,ArrowBigUpDashIcon:O8,ArrowBigUpIcon:D8,ArrowDown:Xx,ArrowDown01:R8,ArrowDown01Icon:R8,ArrowDown10:F8,ArrowDown10Icon:F8,ArrowDownAZ:S_,ArrowDownAZIcon:S_,ArrowDownAz:S_,ArrowDownAzIcon:S_,ArrowDownCircle:X_,ArrowDownCircleIcon:X_,ArrowDownFromLine:z8,ArrowDownFromLineIcon:z8,ArrowDownIcon:Xx,ArrowDownLeft:B8,ArrowDownLeftFromCircle:J_,ArrowDownLeftFromCircleIcon:J_,ArrowDownLeftFromSquare:Sb,ArrowDownLeftFromSquareIcon:Sb,ArrowDownLeftIcon:B8,ArrowDownLeftSquare:wb,ArrowDownLeftSquareIcon:wb,ArrowDownNarrowWide:$8,ArrowDownNarrowWideIcon:$8,ArrowDownRight:U8,ArrowDownRightFromCircle:e2,ArrowDownRightFromCircleIcon:e2,ArrowDownRightFromSquare:Cb,ArrowDownRightFromSquareIcon:Cb,ArrowDownRightIcon:U8,ArrowDownRightSquare:jb,ArrowDownRightSquareIcon:jb,ArrowDownSquare:kb,ArrowDownSquareIcon:kb,ArrowDownToDot:q8,ArrowDownToDotIcon:q8,ArrowDownToLine:V8,ArrowDownToLineIcon:V8,ArrowDownUp:H8,ArrowDownUpIcon:H8,ArrowDownWideNarrow:C_,ArrowDownWideNarrowIcon:C_,ArrowDownZA:M_,ArrowDownZAIcon:M_,ArrowDownZa:M_,ArrowDownZaIcon:M_,ArrowLeft:io,ArrowLeftCircle:Q_,ArrowLeftCircleIcon:Q_,ArrowLeftFromLine:W8,ArrowLeftFromLineIcon:W8,ArrowLeftIcon:io,ArrowLeftRight:G8,ArrowLeftRightIcon:G8,ArrowLeftSquare:Nb,ArrowLeftSquareIcon:Nb,ArrowLeftToLine:K8,ArrowLeftToLineIcon:K8,ArrowRight:Jo,ArrowRightCircle:n2,ArrowRightCircleIcon:n2,ArrowRightFromLine:Z8,ArrowRightFromLineIcon:Z8,ArrowRightIcon:Jo,ArrowRightLeft:Y8,ArrowRightLeftIcon:Y8,ArrowRightSquare:Ab,ArrowRightSquareIcon:Ab,ArrowRightToLine:X8,ArrowRightToLineIcon:X8,ArrowUp:ep,ArrowUp01:Q8,ArrowUp01Icon:Q8,ArrowUp10:J8,ArrowUp10Icon:J8,ArrowUpAZ:T_,ArrowUpAZIcon:T_,ArrowUpAz:T_,ArrowUpAzIcon:T_,ArrowUpCircle:s2,ArrowUpCircleIcon:s2,ArrowUpDown:jg,ArrowUpDownIcon:jg,ArrowUpFromDot:eD,ArrowUpFromDotIcon:eD,ArrowUpFromLine:tD,ArrowUpFromLineIcon:tD,ArrowUpIcon:ep,ArrowUpLeft:rD,ArrowUpLeftFromCircle:t2,ArrowUpLeftFromCircleIcon:t2,ArrowUpLeftFromSquare:Mb,ArrowUpLeftFromSquareIcon:Mb,ArrowUpLeftIcon:rD,ArrowUpLeftSquare:Eb,ArrowUpLeftSquareIcon:Eb,ArrowUpNarrowWide:A_,ArrowUpNarrowWideIcon:A_,ArrowUpRight:nD,ArrowUpRightFromCircle:r2,ArrowUpRightFromCircleIcon:r2,ArrowUpRightFromSquare:Tb,ArrowUpRightFromSquareIcon:Tb,ArrowUpRightIcon:nD,ArrowUpRightSquare:Ib,ArrowUpRightSquareIcon:Ib,ArrowUpSquare:Pb,ArrowUpSquareIcon:Pb,ArrowUpToLine:sD,ArrowUpToLineIcon:sD,ArrowUpWideNarrow:aD,ArrowUpWideNarrowIcon:aD,ArrowUpZA:E_,ArrowUpZAIcon:E_,ArrowUpZa:E_,ArrowUpZaIcon:E_,ArrowsUpFromLine:iD,ArrowsUpFromLineIcon:iD,Asterisk:oD,AsteriskIcon:oD,AsteriskSquare:Lb,AsteriskSquareIcon:Lb,AtSign:lD,AtSignIcon:lD,Atom:cD,AtomIcon:cD,AudioLines:dD,AudioLinesIcon:dD,AudioWaveform:uD,AudioWaveformIcon:uD,Award:Rl,AwardIcon:Rl,Axe:hD,AxeIcon:hD,Axis3D:I_,Axis3DIcon:I_,Axis3d:I_,Axis3dIcon:I_,Baby:fD,BabyIcon:fD,Backpack:pD,BackpackIcon:pD,Badge:AD,BadgeAlert:mD,BadgeAlertIcon:mD,BadgeCent:gD,BadgeCentIcon:gD,BadgeCheck:P_,BadgeCheckIcon:P_,BadgeDollarSign:xD,BadgeDollarSignIcon:xD,BadgeEuro:yD,BadgeEuroIcon:yD,BadgeHelp:vD,BadgeHelpIcon:vD,BadgeIcon:AD,BadgeIndianRupee:_D,BadgeIndianRupeeIcon:_D,BadgeInfo:bD,BadgeInfoIcon:bD,BadgeJapaneseYen:wD,BadgeJapaneseYenIcon:wD,BadgeMinus:jD,BadgeMinusIcon:jD,BadgePercent:kD,BadgePercentIcon:kD,BadgePlus:ND,BadgePlusIcon:ND,BadgePoundSterling:SD,BadgePoundSterlingIcon:SD,BadgeRussianRuble:CD,BadgeRussianRubleIcon:CD,BadgeSwissFranc:MD,BadgeSwissFrancIcon:MD,BadgeX:TD,BadgeXIcon:TD,BaggageClaim:ED,BaggageClaimIcon:ED,Ban:ID,BanIcon:ID,Banana:PD,BananaIcon:PD,Bandage:LD,BandageIcon:LD,Banknote:OD,BanknoteIcon:OD,BarChart:W_,BarChart2:G_,BarChart2Icon:G_,BarChart3:gc,BarChart3Icon:gc,BarChart4:V_,BarChart4Icon:V_,BarChartBig:q_,BarChartBigIcon:q_,BarChartHorizontal:$_,BarChartHorizontalBig:B_,BarChartHorizontalBigIcon:B_,BarChartHorizontalIcon:$_,BarChartIcon:W_,Barcode:DD,BarcodeIcon:DD,Baseline:RD,BaselineIcon:RD,Bath:C1,BathIcon:C1,Battery:qD,BatteryCharging:FD,BatteryChargingIcon:FD,BatteryFull:zD,BatteryFullIcon:zD,BatteryIcon:qD,BatteryLow:BD,BatteryLowIcon:BD,BatteryMedium:$D,BatteryMediumIcon:$D,BatteryWarning:UD,BatteryWarningIcon:UD,Beaker:VD,BeakerIcon:VD,Bean:WD,BeanIcon:WD,BeanOff:HD,BeanOffIcon:HD,Bed:M1,BedDouble:GD,BedDoubleIcon:GD,BedIcon:M1,BedSingle:KD,BedSingleIcon:KD,Beef:ZD,BeefIcon:ZD,Beer:XD,BeerIcon:XD,BeerOff:YD,BeerOffIcon:YD,Bell:kg,BellDot:QD,BellDotIcon:QD,BellElectric:JD,BellElectricIcon:JD,BellIcon:kg,BellMinus:eR,BellMinusIcon:eR,BellOff:xj,BellOffIcon:xj,BellPlus:tR,BellPlusIcon:tR,BellRing:rR,BellRingIcon:rR,BetweenHorizonalEnd:L_,BetweenHorizonalEndIcon:L_,BetweenHorizonalStart:O_,BetweenHorizonalStartIcon:O_,BetweenHorizontalEnd:L_,BetweenHorizontalEndIcon:L_,BetweenHorizontalStart:O_,BetweenHorizontalStartIcon:O_,BetweenVerticalEnd:nR,BetweenVerticalEndIcon:nR,BetweenVerticalStart:sR,BetweenVerticalStartIcon:sR,BicepsFlexed:aR,BicepsFlexedIcon:aR,Bike:iR,BikeIcon:iR,Binary:oR,BinaryIcon:oR,Binoculars:lR,BinocularsIcon:lR,Biohazard:cR,BiohazardIcon:cR,Bird:dR,BirdIcon:dR,Bitcoin:uR,BitcoinIcon:uR,Blend:hR,BlendIcon:hR,Blinds:fR,BlindsIcon:fR,Blocks:pR,BlocksIcon:pR,Bluetooth:yR,BluetoothConnected:mR,BluetoothConnectedIcon:mR,BluetoothIcon:yR,BluetoothOff:gR,BluetoothOffIcon:gR,BluetoothSearching:xR,BluetoothSearchingIcon:xR,Bold:dS,BoldIcon:dS,Bolt:vR,BoltIcon:vR,Bomb:_R,BombIcon:_R,Bone:bR,BoneIcon:bR,Book:qR,BookA:wR,BookAIcon:wR,BookAudio:jR,BookAudioIcon:jR,BookCheck:kR,BookCheckIcon:kR,BookCopy:NR,BookCopyIcon:NR,BookDashed:D_,BookDashedIcon:D_,BookDown:SR,BookDownIcon:SR,BookHeadphones:CR,BookHeadphonesIcon:CR,BookHeart:MR,BookHeartIcon:MR,BookIcon:qR,BookImage:TR,BookImageIcon:TR,BookKey:AR,BookKeyIcon:AR,BookLock:ER,BookLockIcon:ER,BookMarked:IR,BookMarkedIcon:IR,BookMinus:PR,BookMinusIcon:PR,BookOpen:zT,BookOpenCheck:LR,BookOpenCheckIcon:LR,BookOpenIcon:zT,BookOpenText:OR,BookOpenTextIcon:OR,BookPlus:DR,BookPlusIcon:DR,BookTemplate:D_,BookTemplateIcon:D_,BookText:RR,BookTextIcon:RR,BookType:FR,BookTypeIcon:FR,BookUp:BR,BookUp2:zR,BookUp2Icon:zR,BookUpIcon:BR,BookUser:$R,BookUserIcon:$R,BookX:UR,BookXIcon:UR,Bookmark:vm,BookmarkCheck:VR,BookmarkCheckIcon:VR,BookmarkIcon:vm,BookmarkMinus:HR,BookmarkMinusIcon:HR,BookmarkPlus:BT,BookmarkPlusIcon:BT,BookmarkX:WR,BookmarkXIcon:WR,BoomBox:GR,BoomBoxIcon:GR,Bot:uS,BotIcon:uS,BotMessageSquare:KR,BotMessageSquareIcon:KR,BotOff:ZR,BotOffIcon:ZR,Box:YR,BoxIcon:YR,BoxSelect:Vb,BoxSelectIcon:Vb,Boxes:XR,BoxesIcon:XR,Braces:R_,BracesIcon:R_,Brackets:QR,BracketsIcon:QR,Brain:$T,BrainCircuit:JR,BrainCircuitIcon:JR,BrainCog:eF,BrainCogIcon:eF,BrainIcon:$T,BrickWall:tF,BrickWallIcon:tF,Briefcase:Nh,BriefcaseBusiness:rF,BriefcaseBusinessIcon:rF,BriefcaseConveyorBelt:nF,BriefcaseConveyorBeltIcon:nF,BriefcaseIcon:Nh,BriefcaseMedical:sF,BriefcaseMedicalIcon:sF,BringToFront:aF,BringToFrontIcon:aF,Brush:iF,BrushIcon:iF,Bug:cF,BugIcon:cF,BugOff:oF,BugOffIcon:oF,BugPlay:lF,BugPlayIcon:lF,Building:yj,Building2:li,Building2Icon:li,BuildingIcon:yj,Bus:uF,BusFront:dF,BusFrontIcon:dF,BusIcon:uF,Cable:fF,CableCar:hF,CableCarIcon:hF,CableIcon:fF,Cake:of,CakeIcon:of,CakeSlice:pF,CakeSliceIcon:pF,Calculator:mF,CalculatorIcon:mF,Calendar:Ds,Calendar1:gF,Calendar1Icon:gF,CalendarArrowDown:xF,CalendarArrowDownIcon:xF,CalendarArrowUp:yF,CalendarArrowUpIcon:yF,CalendarCheck:_F,CalendarCheck2:vF,CalendarCheck2Icon:vF,CalendarCheckIcon:_F,CalendarClock:UT,CalendarClockIcon:UT,CalendarCog:bF,CalendarCogIcon:bF,CalendarDays:_m,CalendarDaysIcon:_m,CalendarFold:wF,CalendarFoldIcon:wF,CalendarHeart:jF,CalendarHeartIcon:jF,CalendarIcon:Ds,CalendarMinus:NF,CalendarMinus2:kF,CalendarMinus2Icon:kF,CalendarMinusIcon:NF,CalendarOff:SF,CalendarOffIcon:SF,CalendarPlus:vj,CalendarPlus2:CF,CalendarPlus2Icon:CF,CalendarPlusIcon:vj,CalendarRange:MF,CalendarRangeIcon:MF,CalendarSearch:TF,CalendarSearchIcon:TF,CalendarSync:AF,CalendarSyncIcon:AF,CalendarX:IF,CalendarX2:EF,CalendarX2Icon:EF,CalendarXIcon:IF,Camera:Ng,CameraIcon:Ng,CameraOff:PF,CameraOffIcon:PF,CandlestickChart:U_,CandlestickChartIcon:U_,Candy:DF,CandyCane:LF,CandyCaneIcon:LF,CandyIcon:DF,CandyOff:OF,CandyOffIcon:OF,Cannabis:RF,CannabisIcon:RF,Captions:F_,CaptionsIcon:F_,CaptionsOff:FF,CaptionsOffIcon:FF,Car:$F,CarFront:zF,CarFrontIcon:zF,CarIcon:$F,CarTaxiFront:BF,CarTaxiFrontIcon:BF,Caravan:UF,CaravanIcon:UF,Carrot:qF,CarrotIcon:qF,CaseLower:VF,CaseLowerIcon:VF,CaseSensitive:HF,CaseSensitiveIcon:HF,CaseUpper:WF,CaseUpperIcon:WF,CassetteTape:GF,CassetteTapeIcon:GF,Cast:KF,CastIcon:KF,Castle:ZF,CastleIcon:ZF,Cat:YF,CatIcon:YF,Cctv:XF,CctvIcon:XF,ChartArea:z_,ChartAreaIcon:z_,ChartBar:$_,ChartBarBig:B_,ChartBarBigIcon:B_,ChartBarDecreasing:QF,ChartBarDecreasingIcon:QF,ChartBarIcon:$_,ChartBarIncreasing:JF,ChartBarIncreasingIcon:JF,ChartBarStacked:ez,ChartBarStackedIcon:ez,ChartCandlestick:U_,ChartCandlestickIcon:U_,ChartColumn:gc,ChartColumnBig:q_,ChartColumnBigIcon:q_,ChartColumnDecreasing:tz,ChartColumnDecreasingIcon:tz,ChartColumnIcon:gc,ChartColumnIncreasing:V_,ChartColumnIncreasingIcon:V_,ChartColumnStacked:rz,ChartColumnStackedIcon:rz,ChartGantt:nz,ChartGanttIcon:nz,ChartLine:H_,ChartLineIcon:H_,ChartNetwork:sz,ChartNetworkIcon:sz,ChartNoAxesColumn:G_,ChartNoAxesColumnDecreasing:az,ChartNoAxesColumnDecreasingIcon:az,ChartNoAxesColumnIcon:G_,ChartNoAxesColumnIncreasing:W_,ChartNoAxesColumnIncreasingIcon:W_,ChartNoAxesCombined:iz,ChartNoAxesCombinedIcon:iz,ChartNoAxesGantt:K_,ChartNoAxesGanttIcon:K_,ChartPie:Z_,ChartPieIcon:Z_,ChartScatter:Y_,ChartScatterIcon:Y_,ChartSpline:oz,ChartSplineIcon:oz,Check:_i,CheckCheck:lz,CheckCheckIcon:lz,CheckCircle:Ii,CheckCircle2:Xi,CheckCircle2Icon:Xi,CheckCircleIcon:Ii,CheckIcon:_i,CheckSquare:F0,CheckSquare2:Db,CheckSquare2Icon:Db,CheckSquareIcon:F0,ChefHat:cz,ChefHatIcon:cz,Cherry:dz,CherryIcon:dz,ChevronDown:Qd,ChevronDownCircle:a2,ChevronDownCircleIcon:a2,ChevronDownIcon:Qd,ChevronDownSquare:Rb,ChevronDownSquareIcon:Rb,ChevronFirst:uz,ChevronFirstIcon:uz,ChevronLast:hz,ChevronLastIcon:hz,ChevronLeft:vc,ChevronLeftCircle:i2,ChevronLeftCircleIcon:i2,ChevronLeftIcon:vc,ChevronLeftSquare:Fb,ChevronLeftSquareIcon:Fb,ChevronRight:Bi,ChevronRightCircle:o2,ChevronRightCircleIcon:o2,ChevronRightIcon:Bi,ChevronRightSquare:zb,ChevronRightSquareIcon:zb,ChevronUp:T1,ChevronUpCircle:l2,ChevronUpCircleIcon:l2,ChevronUpIcon:T1,ChevronUpSquare:Bb,ChevronUpSquareIcon:Bb,ChevronsDown:pz,ChevronsDownIcon:pz,ChevronsDownUp:fz,ChevronsDownUpIcon:fz,ChevronsLeft:xz,ChevronsLeftIcon:xz,ChevronsLeftRight:gz,ChevronsLeftRightEllipsis:mz,ChevronsLeftRightEllipsisIcon:mz,ChevronsLeftRightIcon:gz,ChevronsRight:vz,ChevronsRightIcon:vz,ChevronsRightLeft:yz,ChevronsRightLeftIcon:yz,ChevronsUp:_z,ChevronsUpDown:Qx,ChevronsUpDownIcon:Qx,ChevronsUpIcon:_z,Chrome:bz,ChromeIcon:bz,Church:wz,ChurchIcon:wz,Cigarette:kz,CigaretteIcon:kz,CigaretteOff:jz,CigaretteOffIcon:jz,Circle:Gu,CircleAlert:pl,CircleAlertIcon:pl,CircleArrowDown:X_,CircleArrowDownIcon:X_,CircleArrowLeft:Q_,CircleArrowLeftIcon:Q_,CircleArrowOutDownLeft:J_,CircleArrowOutDownLeftIcon:J_,CircleArrowOutDownRight:e2,CircleArrowOutDownRightIcon:e2,CircleArrowOutUpLeft:t2,CircleArrowOutUpLeftIcon:t2,CircleArrowOutUpRight:r2,CircleArrowOutUpRightIcon:r2,CircleArrowRight:n2,CircleArrowRightIcon:n2,CircleArrowUp:s2,CircleArrowUpIcon:s2,CircleCheck:Xi,CircleCheckBig:Ii,CircleCheckBigIcon:Ii,CircleCheckIcon:Xi,CircleChevronDown:a2,CircleChevronDownIcon:a2,CircleChevronLeft:i2,CircleChevronLeftIcon:i2,CircleChevronRight:o2,CircleChevronRightIcon:o2,CircleChevronUp:l2,CircleChevronUpIcon:l2,CircleDashed:Nz,CircleDashedIcon:Nz,CircleDivide:c2,CircleDivideIcon:c2,CircleDollarSign:Sz,CircleDollarSignIcon:Sz,CircleDot:Mz,CircleDotDashed:Cz,CircleDotDashedIcon:Cz,CircleDotIcon:Mz,CircleEllipsis:Tz,CircleEllipsisIcon:Tz,CircleEqual:Az,CircleEqualIcon:Az,CircleFadingArrowUp:Ez,CircleFadingArrowUpIcon:Ez,CircleFadingPlus:Iz,CircleFadingPlusIcon:Iz,CircleGauge:d2,CircleGaugeIcon:d2,CircleHelp:Dx,CircleHelpIcon:Dx,CircleIcon:Gu,CircleMinus:u2,CircleMinusIcon:u2,CircleOff:Pz,CircleOffIcon:Pz,CircleParking:f2,CircleParkingIcon:f2,CircleParkingOff:h2,CircleParkingOffIcon:h2,CirclePause:p2,CirclePauseIcon:p2,CirclePercent:m2,CirclePercentIcon:m2,CirclePlay:Gf,CirclePlayIcon:Gf,CirclePlus:g2,CirclePlusIcon:g2,CirclePower:x2,CirclePowerIcon:x2,CircleSlash:Lz,CircleSlash2:y2,CircleSlash2Icon:y2,CircleSlashIcon:Lz,CircleSlashed:y2,CircleSlashedIcon:y2,CircleStop:v2,CircleStopIcon:v2,CircleUser:b2,CircleUserIcon:b2,CircleUserRound:_2,CircleUserRoundIcon:_2,CircleX:Lc,CircleXIcon:Lc,CircuitBoard:Oz,CircuitBoardIcon:Oz,Citrus:Dz,CitrusIcon:Dz,Clapperboard:Rz,ClapperboardIcon:Rz,Clipboard:Vz,ClipboardCheck:qT,ClipboardCheckIcon:qT,ClipboardCopy:Fz,ClipboardCopyIcon:Fz,ClipboardEdit:j2,ClipboardEditIcon:j2,ClipboardIcon:Vz,ClipboardList:VT,ClipboardListIcon:VT,ClipboardMinus:zz,ClipboardMinusIcon:zz,ClipboardPaste:Bz,ClipboardPasteIcon:Bz,ClipboardPen:j2,ClipboardPenIcon:j2,ClipboardPenLine:w2,ClipboardPenLineIcon:w2,ClipboardPlus:$z,ClipboardPlusIcon:$z,ClipboardSignature:w2,ClipboardSignatureIcon:w2,ClipboardType:Uz,ClipboardTypeIcon:Uz,ClipboardX:qz,ClipboardXIcon:qz,Clock:Wa,Clock1:Hz,Clock10:Wz,Clock10Icon:Wz,Clock11:Gz,Clock11Icon:Gz,Clock12:Kz,Clock12Icon:Kz,Clock1Icon:Hz,Clock2:Zz,Clock2Icon:Zz,Clock3:Yz,Clock3Icon:Yz,Clock4:Xz,Clock4Icon:Xz,Clock5:Qz,Clock5Icon:Qz,Clock6:Jz,Clock6Icon:Jz,Clock7:e7,Clock7Icon:e7,Clock8:t7,Clock8Icon:t7,Clock9:r7,Clock9Icon:r7,ClockAlert:n7,ClockAlertIcon:n7,ClockArrowDown:s7,ClockArrowDownIcon:s7,ClockArrowUp:a7,ClockArrowUpIcon:a7,ClockIcon:Wa,Cloud:_7,CloudAlert:i7,CloudAlertIcon:i7,CloudCog:o7,CloudCogIcon:o7,CloudDownload:k2,CloudDownloadIcon:k2,CloudDrizzle:l7,CloudDrizzleIcon:l7,CloudFog:c7,CloudFogIcon:c7,CloudHail:d7,CloudHailIcon:d7,CloudIcon:_7,CloudLightning:u7,CloudLightningIcon:u7,CloudMoon:f7,CloudMoonIcon:f7,CloudMoonRain:h7,CloudMoonRainIcon:h7,CloudOff:p7,CloudOffIcon:p7,CloudRain:g7,CloudRainIcon:g7,CloudRainWind:m7,CloudRainWindIcon:m7,CloudSnow:x7,CloudSnowIcon:x7,CloudSun:v7,CloudSunIcon:v7,CloudSunRain:y7,CloudSunRainIcon:y7,CloudUpload:N2,CloudUploadIcon:N2,Cloudy:b7,CloudyIcon:b7,Clover:Vx,CloverIcon:Vx,Club:w7,ClubIcon:w7,Code:_j,Code2:S2,Code2Icon:S2,CodeIcon:_j,CodeSquare:$b,CodeSquareIcon:$b,CodeXml:S2,CodeXmlIcon:S2,Codepen:j7,CodepenIcon:j7,Codesandbox:k7,CodesandboxIcon:k7,Coffee:bj,CoffeeIcon:bj,Cog:N7,CogIcon:N7,Coins:S7,CoinsIcon:S7,Columns:C2,Columns2:C2,Columns2Icon:C2,Columns3:M2,Columns3Icon:M2,Columns4:C7,Columns4Icon:C7,ColumnsIcon:C2,Combine:M7,CombineIcon:M7,Command:T7,CommandIcon:T7,Compass:A7,CompassIcon:A7,Component:E7,ComponentIcon:E7,Computer:I7,ComputerIcon:I7,ConciergeBell:P7,ConciergeBellIcon:P7,Cone:L7,ConeIcon:L7,Construction:O7,ConstructionIcon:O7,Contact:D7,Contact2:T2,Contact2Icon:T2,ContactIcon:D7,ContactRound:T2,ContactRoundIcon:T2,Container:R7,ContainerIcon:R7,Contrast:F7,ContrastIcon:F7,Cookie:z7,CookieIcon:z7,CookingPot:B7,CookingPotIcon:B7,Copy:tl,CopyCheck:$7,CopyCheckIcon:$7,CopyIcon:tl,CopyMinus:U7,CopyMinusIcon:U7,CopyPlus:q7,CopyPlusIcon:q7,CopySlash:V7,CopySlashIcon:V7,CopyX:H7,CopyXIcon:H7,Copyleft:W7,CopyleftIcon:W7,Copyright:G7,CopyrightIcon:G7,CornerDownLeft:K7,CornerDownLeftIcon:K7,CornerDownRight:Z7,CornerDownRightIcon:Z7,CornerLeftDown:Y7,CornerLeftDownIcon:Y7,CornerLeftUp:X7,CornerLeftUpIcon:X7,CornerRightDown:Q7,CornerRightDownIcon:Q7,CornerRightUp:J7,CornerRightUpIcon:J7,CornerUpLeft:eB,CornerUpLeftIcon:eB,CornerUpRight:tB,CornerUpRightIcon:tB,Cpu:rB,CpuIcon:rB,CreativeCommons:nB,CreativeCommonsIcon:nB,CreditCard:bm,CreditCardIcon:bm,Croissant:sB,CroissantIcon:sB,Crop:aB,CropIcon:aB,Cross:iB,CrossIcon:iB,Crosshair:oB,CrosshairIcon:oB,Crown:A1,CrownIcon:A1,Cuboid:lB,CuboidIcon:lB,CupSoda:cB,CupSodaIcon:cB,CurlyBraces:R_,CurlyBracesIcon:R_,Currency:dB,CurrencyIcon:dB,Cylinder:uB,CylinderIcon:uB,Dam:hB,DamIcon:hB,Database:mB,DatabaseBackup:fB,DatabaseBackupIcon:fB,DatabaseIcon:mB,DatabaseZap:pB,DatabaseZapIcon:pB,Delete:gB,DeleteIcon:gB,Dessert:xB,DessertIcon:xB,Diameter:yB,DiameterIcon:yB,Diamond:bB,DiamondIcon:bB,DiamondMinus:vB,DiamondMinusIcon:vB,DiamondPercent:A2,DiamondPercentIcon:A2,DiamondPlus:_B,DiamondPlusIcon:_B,Dice1:wB,Dice1Icon:wB,Dice2:jB,Dice2Icon:jB,Dice3:kB,Dice3Icon:kB,Dice4:NB,Dice4Icon:NB,Dice5:SB,Dice5Icon:SB,Dice6:CB,Dice6Icon:CB,Dices:MB,DicesIcon:MB,Diff:TB,DiffIcon:TB,Disc:PB,Disc2:AB,Disc2Icon:AB,Disc3:EB,Disc3Icon:EB,DiscAlbum:IB,DiscAlbumIcon:IB,DiscIcon:PB,Divide:LB,DivideCircle:c2,DivideCircleIcon:c2,DivideIcon:LB,DivideSquare:Hb,DivideSquareIcon:Hb,Dna:DB,DnaIcon:DB,DnaOff:OB,DnaOffIcon:OB,Dock:RB,DockIcon:RB,Dog:FB,DogIcon:FB,DollarSign:wd,DollarSignIcon:wd,Donut:zB,DonutIcon:zB,DoorClosed:BB,DoorClosedIcon:BB,DoorOpen:wj,DoorOpenIcon:wj,Dot:$B,DotIcon:$B,DotSquare:Wb,DotSquareIcon:Wb,Download:ao,DownloadCloud:k2,DownloadCloudIcon:k2,DownloadIcon:ao,DraftingCompass:UB,DraftingCompassIcon:UB,Drama:qB,DramaIcon:qB,Dribbble:VB,DribbbleIcon:VB,Drill:HB,DrillIcon:HB,Droplet:WB,DropletIcon:WB,Droplets:GB,DropletsIcon:GB,Drum:KB,DrumIcon:KB,Drumstick:ZB,DrumstickIcon:ZB,Dumbbell:YB,DumbbellIcon:YB,Ear:QB,EarIcon:QB,EarOff:XB,EarOffIcon:XB,Earth:E2,EarthIcon:E2,EarthLock:JB,EarthLockIcon:JB,Eclipse:e9,EclipseIcon:e9,Edit:hc,Edit2:R0,Edit2Icon:R0,Edit3:D0,Edit3Icon:D0,EditIcon:hc,Egg:hS,EggFried:t9,EggFriedIcon:t9,EggIcon:hS,EggOff:r9,EggOffIcon:r9,Ellipsis:lm,EllipsisIcon:lm,EllipsisVertical:Rx,EllipsisVerticalIcon:Rx,Equal:a9,EqualApproximately:n9,EqualApproximatelyIcon:n9,EqualIcon:a9,EqualNot:s9,EqualNotIcon:s9,EqualSquare:Gb,EqualSquareIcon:Gb,Eraser:i9,EraserIcon:i9,EthernetPort:o9,EthernetPortIcon:o9,Euro:l9,EuroIcon:l9,Expand:c9,ExpandIcon:c9,ExternalLink:Os,ExternalLinkIcon:Os,Eye:$o,EyeClosed:d9,EyeClosedIcon:d9,EyeIcon:$o,EyeOff:E1,EyeOffIcon:E1,Facebook:Jd,FacebookIcon:Jd,Factory:u9,FactoryIcon:u9,Fan:h9,FanIcon:h9,FastForward:f9,FastForwardIcon:f9,Feather:p9,FeatherIcon:p9,Fence:m9,FenceIcon:m9,FerrisWheel:g9,FerrisWheelIcon:g9,Figma:x9,FigmaIcon:x9,File:u$,FileArchive:y9,FileArchiveIcon:y9,FileAudio:_9,FileAudio2:v9,FileAudio2Icon:v9,FileAudioIcon:_9,FileAxis3D:I2,FileAxis3DIcon:I2,FileAxis3d:I2,FileAxis3dIcon:I2,FileBadge:w9,FileBadge2:b9,FileBadge2Icon:b9,FileBadgeIcon:w9,FileBarChart:P2,FileBarChart2:L2,FileBarChart2Icon:L2,FileBarChartIcon:P2,FileBox:j9,FileBoxIcon:j9,FileChartColumn:L2,FileChartColumnIcon:L2,FileChartColumnIncreasing:P2,FileChartColumnIncreasingIcon:P2,FileChartLine:O2,FileChartLineIcon:O2,FileChartPie:D2,FileChartPieIcon:D2,FileCheck:N9,FileCheck2:k9,FileCheck2Icon:k9,FileCheckIcon:N9,FileClock:S9,FileClockIcon:S9,FileCode:M9,FileCode2:C9,FileCode2Icon:C9,FileCodeIcon:M9,FileCog:R2,FileCog2:R2,FileCog2Icon:R2,FileCogIcon:R2,FileDiff:T9,FileDiffIcon:T9,FileDigit:A9,FileDigitIcon:A9,FileDown:E9,FileDownIcon:E9,FileEdit:z2,FileEditIcon:z2,FileHeart:I9,FileHeartIcon:I9,FileIcon:u$,FileImage:I1,FileImageIcon:I1,FileInput:P9,FileInputIcon:P9,FileJson:O9,FileJson2:L9,FileJson2Icon:L9,FileJsonIcon:O9,FileKey:R9,FileKey2:D9,FileKey2Icon:D9,FileKeyIcon:R9,FileLineChart:O2,FileLineChartIcon:O2,FileLock:z9,FileLock2:F9,FileLock2Icon:F9,FileLockIcon:z9,FileMinus:$9,FileMinus2:B9,FileMinus2Icon:B9,FileMinusIcon:$9,FileMusic:U9,FileMusicIcon:U9,FileOutput:q9,FileOutputIcon:q9,FilePen:z2,FilePenIcon:z2,FilePenLine:F2,FilePenLineIcon:F2,FilePieChart:D2,FilePieChartIcon:D2,FilePlus:H9,FilePlus2:V9,FilePlus2Icon:V9,FilePlusIcon:H9,FileQuestion:W9,FileQuestionIcon:W9,FileScan:G9,FileScanIcon:G9,FileSearch:Z9,FileSearch2:K9,FileSearch2Icon:K9,FileSearchIcon:Z9,FileSignature:F2,FileSignatureIcon:F2,FileSliders:Y9,FileSlidersIcon:Y9,FileSpreadsheet:P1,FileSpreadsheetIcon:P1,FileStack:X9,FileStackIcon:X9,FileSymlink:Q9,FileSymlinkIcon:Q9,FileTerminal:J9,FileTerminalIcon:J9,FileText:ka,FileTextIcon:ka,FileType:t$,FileType2:e$,FileType2Icon:e$,FileTypeIcon:t$,FileUp:r$,FileUpIcon:r$,FileUser:n$,FileUserIcon:n$,FileVideo:a$,FileVideo2:s$,FileVideo2Icon:s$,FileVideoIcon:a$,FileVolume:o$,FileVolume2:i$,FileVolume2Icon:i$,FileVolumeIcon:o$,FileWarning:l$,FileWarningIcon:l$,FileX:d$,FileX2:c$,FileX2Icon:c$,FileXIcon:d$,Files:h$,FilesIcon:h$,Film:$d,FilmIcon:$d,Filter:L1,FilterIcon:L1,FilterX:f$,FilterXIcon:f$,Fingerprint:p$,FingerprintIcon:p$,FireExtinguisher:m$,FireExtinguisherIcon:m$,Fish:y$,FishIcon:y$,FishOff:g$,FishOffIcon:g$,FishSymbol:x$,FishSymbolIcon:x$,Flag:Jx,FlagIcon:Jx,FlagOff:v$,FlagOffIcon:v$,FlagTriangleLeft:_$,FlagTriangleLeftIcon:_$,FlagTriangleRight:b$,FlagTriangleRightIcon:b$,Flame:lf,FlameIcon:lf,FlameKindling:w$,FlameKindlingIcon:w$,Flashlight:k$,FlashlightIcon:k$,FlashlightOff:j$,FlashlightOffIcon:j$,FlaskConical:jj,FlaskConicalIcon:jj,FlaskConicalOff:N$,FlaskConicalOffIcon:N$,FlaskRound:S$,FlaskRoundIcon:S$,FlipHorizontal:M$,FlipHorizontal2:C$,FlipHorizontal2Icon:C$,FlipHorizontalIcon:M$,FlipVertical:A$,FlipVertical2:T$,FlipVertical2Icon:T$,FlipVerticalIcon:A$,Flower:E$,Flower2:fm,Flower2Icon:fm,FlowerIcon:E$,Focus:I$,FocusIcon:I$,FoldHorizontal:P$,FoldHorizontalIcon:P$,FoldVertical:L$,FoldVerticalIcon:L$,Folder:oU,FolderArchive:O$,FolderArchiveIcon:O$,FolderCheck:D$,FolderCheckIcon:D$,FolderClock:R$,FolderClockIcon:R$,FolderClosed:F$,FolderClosedIcon:F$,FolderCode:z$,FolderCodeIcon:z$,FolderCog:B2,FolderCog2:B2,FolderCog2Icon:B2,FolderCogIcon:B2,FolderDot:B$,FolderDotIcon:B$,FolderDown:$$,FolderDownIcon:$$,FolderEdit:$2,FolderEditIcon:$2,FolderGit:q$,FolderGit2:U$,FolderGit2Icon:U$,FolderGitIcon:q$,FolderHeart:V$,FolderHeartIcon:V$,FolderIcon:oU,FolderInput:H$,FolderInputIcon:H$,FolderKanban:W$,FolderKanbanIcon:W$,FolderKey:G$,FolderKeyIcon:G$,FolderLock:K$,FolderLockIcon:K$,FolderMinus:Z$,FolderMinusIcon:Z$,FolderOpen:Sg,FolderOpenDot:Y$,FolderOpenDotIcon:Y$,FolderOpenIcon:Sg,FolderOutput:X$,FolderOutputIcon:X$,FolderPen:$2,FolderPenIcon:$2,FolderPlus:Q$,FolderPlusIcon:Q$,FolderRoot:J$,FolderRootIcon:J$,FolderSearch:tU,FolderSearch2:eU,FolderSearch2Icon:eU,FolderSearchIcon:tU,FolderSymlink:rU,FolderSymlinkIcon:rU,FolderSync:nU,FolderSyncIcon:nU,FolderTree:sU,FolderTreeIcon:sU,FolderUp:aU,FolderUpIcon:aU,FolderX:iU,FolderXIcon:iU,Folders:lU,FoldersIcon:lU,Footprints:cU,FootprintsIcon:cU,ForkKnife:Iw,ForkKnifeCrossed:Ew,ForkKnifeCrossedIcon:Ew,ForkKnifeIcon:Iw,Forklift:dU,ForkliftIcon:dU,FormInput:fb,FormInputIcon:fb,Forward:uU,ForwardIcon:uU,Frame:hU,FrameIcon:hU,Framer:fU,FramerIcon:fU,Frown:pU,FrownIcon:pU,Fuel:mU,FuelIcon:mU,Fullscreen:gU,FullscreenIcon:gU,FunctionSquare:Kb,FunctionSquareIcon:Kb,GalleryHorizontal:yU,GalleryHorizontalEnd:xU,GalleryHorizontalEndIcon:xU,GalleryHorizontalIcon:yU,GalleryThumbnails:vU,GalleryThumbnailsIcon:vU,GalleryVertical:bU,GalleryVerticalEnd:_U,GalleryVerticalEndIcon:_U,GalleryVerticalIcon:bU,Gamepad:jU,Gamepad2:wU,Gamepad2Icon:wU,GamepadIcon:jU,GanttChart:K_,GanttChartIcon:K_,GanttChartSquare:sg,GanttChartSquareIcon:sg,Gauge:kU,GaugeCircle:d2,GaugeCircleIcon:d2,GaugeIcon:kU,Gavel:NU,GavelIcon:NU,Gem:SU,GemIcon:SU,Ghost:kj,GhostIcon:kj,Gift:Zi,GiftIcon:Zi,GitBranch:MU,GitBranchIcon:MU,GitBranchPlus:CU,GitBranchPlusIcon:CU,GitCommit:U2,GitCommitHorizontal:U2,GitCommitHorizontalIcon:U2,GitCommitIcon:U2,GitCommitVertical:TU,GitCommitVerticalIcon:TU,GitCompare:EU,GitCompareArrows:AU,GitCompareArrowsIcon:AU,GitCompareIcon:EU,GitFork:IU,GitForkIcon:IU,GitGraph:PU,GitGraphIcon:PU,GitMerge:LU,GitMergeIcon:LU,GitPullRequest:BU,GitPullRequestArrow:OU,GitPullRequestArrowIcon:OU,GitPullRequestClosed:DU,GitPullRequestClosedIcon:DU,GitPullRequestCreate:FU,GitPullRequestCreateArrow:RU,GitPullRequestCreateArrowIcon:RU,GitPullRequestCreateIcon:FU,GitPullRequestDraft:zU,GitPullRequestDraftIcon:zU,GitPullRequestIcon:BU,Github:$U,GithubIcon:$U,Gitlab:UU,GitlabIcon:UU,GlassWater:qU,GlassWaterIcon:qU,Glasses:VU,GlassesIcon:VU,Globe:ey,Globe2:E2,Globe2Icon:E2,GlobeIcon:ey,GlobeLock:HU,GlobeLockIcon:HU,Goal:WU,GoalIcon:WU,Grab:GU,GrabIcon:GU,GraduationCap:O1,GraduationCapIcon:O1,Grape:KU,GrapeIcon:KU,Grid:Gh,Grid2X2:V2,Grid2X2Icon:V2,Grid2X2Plus:q2,Grid2X2PlusIcon:q2,Grid2x2:V2,Grid2x2Check:ZU,Grid2x2CheckIcon:ZU,Grid2x2Icon:V2,Grid2x2Plus:q2,Grid2x2PlusIcon:q2,Grid2x2X:YU,Grid2x2XIcon:YU,Grid3X3:Gh,Grid3X3Icon:Gh,Grid3x3:Gh,Grid3x3Icon:Gh,GridIcon:Gh,Grip:QU,GripHorizontal:XU,GripHorizontalIcon:XU,GripIcon:QU,GripVertical:D1,GripVerticalIcon:D1,Group:JU,GroupIcon:JU,Guitar:eq,GuitarIcon:eq,Ham:tq,HamIcon:tq,Hammer:rq,HammerIcon:rq,Hand:oq,HandCoins:nq,HandCoinsIcon:nq,HandHeart:sq,HandHeartIcon:sq,HandHelping:H2,HandHelpingIcon:H2,HandIcon:oq,HandMetal:aq,HandMetalIcon:aq,HandPlatter:iq,HandPlatterIcon:iq,Handshake:lq,HandshakeIcon:lq,HardDrive:HT,HardDriveDownload:cq,HardDriveDownloadIcon:cq,HardDriveIcon:HT,HardDriveUpload:dq,HardDriveUploadIcon:dq,HardHat:uq,HardHatIcon:uq,Hash:fS,HashIcon:fS,Haze:hq,HazeIcon:hq,HdmiPort:fq,HdmiPortIcon:fq,Heading:yq,Heading1:WT,Heading1Icon:WT,Heading2:GT,Heading2Icon:GT,Heading3:pq,Heading3Icon:pq,Heading4:mq,Heading4Icon:mq,Heading5:gq,Heading5Icon:gq,Heading6:xq,Heading6Icon:xq,HeadingIcon:yq,HeadphoneOff:vq,HeadphoneOffIcon:vq,Headphones:_q,HeadphonesIcon:_q,Headset:bq,HeadsetIcon:bq,Heart:fi,HeartCrack:wq,HeartCrackIcon:wq,HeartHandshake:jq,HeartHandshakeIcon:jq,HeartIcon:fi,HeartOff:kq,HeartOffIcon:kq,HeartPulse:Nq,HeartPulseIcon:Nq,Heater:Sq,HeaterIcon:Sq,HelpCircle:Dx,HelpCircleIcon:Dx,HelpingHand:H2,HelpingHandIcon:H2,Hexagon:Cq,HexagonIcon:Cq,Highlighter:Mq,HighlighterIcon:Mq,History:pS,HistoryIcon:pS,Home:ua,HomeIcon:ua,Hop:Aq,HopIcon:Aq,HopOff:Tq,HopOffIcon:Tq,Hospital:Eq,HospitalIcon:Eq,Hotel:Iq,HotelIcon:Iq,Hourglass:Pq,HourglassIcon:Pq,House:ua,HouseIcon:ua,HousePlug:Lq,HousePlugIcon:Lq,HousePlus:Oq,HousePlusIcon:Oq,IceCream:G2,IceCream2:W2,IceCream2Icon:W2,IceCreamBowl:W2,IceCreamBowlIcon:W2,IceCreamCone:G2,IceCreamConeIcon:G2,IceCreamIcon:G2,Icon:cEe,IdCard:Dq,IdCardIcon:Dq,Image:Ol,ImageDown:Rq,ImageDownIcon:Rq,ImageIcon:Ol,ImageMinus:Fq,ImageMinusIcon:Fq,ImageOff:zq,ImageOffIcon:zq,ImagePlay:Bq,ImagePlayIcon:Bq,ImagePlus:mS,ImagePlusIcon:mS,ImageUp:$q,ImageUpIcon:$q,ImageUpscale:Uq,ImageUpscaleIcon:Uq,Images:qq,ImagesIcon:qq,Import:Vq,ImportIcon:Vq,Inbox:Hq,InboxIcon:Hq,Indent:Z2,IndentDecrease:K2,IndentDecreaseIcon:K2,IndentIcon:Z2,IndentIncrease:Z2,IndentIncreaseIcon:Z2,IndianRupee:Wq,IndianRupeeIcon:Wq,Infinity:Gq,InfinityIcon:Gq,Info:Kq,InfoIcon:Kq,Inspect:ew,InspectIcon:ew,InspectionPanel:Zq,InspectionPanelIcon:Zq,Instagram:mu,InstagramIcon:mu,Italic:gS,ItalicIcon:gS,IterationCcw:Yq,IterationCcwIcon:Yq,IterationCw:Xq,IterationCwIcon:Xq,JapaneseYen:Qq,JapaneseYenIcon:Qq,Joystick:Jq,JoystickIcon:Jq,Kanban:ty,KanbanIcon:ty,KanbanSquare:Zb,KanbanSquareDashed:Ub,KanbanSquareDashedIcon:Ub,KanbanSquareIcon:Zb,Key:cf,KeyIcon:cf,KeyRound:Nj,KeyRoundIcon:Nj,KeySquare:eV,KeySquareIcon:eV,Keyboard:nV,KeyboardIcon:nV,KeyboardMusic:tV,KeyboardMusicIcon:tV,KeyboardOff:rV,KeyboardOffIcon:rV,Lamp:cV,LampCeiling:sV,LampCeilingIcon:sV,LampDesk:aV,LampDeskIcon:aV,LampFloor:iV,LampFloorIcon:iV,LampIcon:cV,LampWallDown:oV,LampWallDownIcon:oV,LampWallUp:lV,LampWallUpIcon:lV,LandPlot:dV,LandPlotIcon:dV,Landmark:uV,LandmarkIcon:uV,Languages:hV,LanguagesIcon:hV,Laptop:pV,Laptop2:Y2,Laptop2Icon:Y2,LaptopIcon:pV,LaptopMinimal:Y2,LaptopMinimalCheck:fV,LaptopMinimalCheckIcon:fV,LaptopMinimalIcon:Y2,Lasso:gV,LassoIcon:gV,LassoSelect:mV,LassoSelectIcon:mV,Laugh:xV,LaughIcon:xV,Layers:_V,Layers2:yV,Layers2Icon:yV,Layers3:vV,Layers3Icon:vV,LayersIcon:_V,Layout:O0,LayoutDashboard:Sj,LayoutDashboardIcon:Sj,LayoutGrid:tp,LayoutGridIcon:tp,LayoutIcon:O0,LayoutList:bV,LayoutListIcon:bV,LayoutPanelLeft:wV,LayoutPanelLeftIcon:wV,LayoutPanelTop:jV,LayoutPanelTopIcon:jV,LayoutTemplate:Cj,LayoutTemplateIcon:Cj,Leaf:kV,LeafIcon:kV,LeafyGreen:NV,LeafyGreenIcon:NV,Lectern:SV,LecternIcon:SV,LetterText:CV,LetterTextIcon:CV,Library:xS,LibraryBig:MV,LibraryBigIcon:MV,LibraryIcon:xS,LibrarySquare:Yb,LibrarySquareIcon:Yb,LifeBuoy:yS,LifeBuoyIcon:yS,Ligature:TV,LigatureIcon:TV,Lightbulb:R1,LightbulbIcon:R1,LightbulbOff:AV,LightbulbOffIcon:AV,LineChart:H_,LineChartIcon:H_,Link:Mo,Link2:df,Link2Icon:df,Link2Off:EV,Link2OffIcon:EV,LinkIcon:Mo,Linkedin:wm,LinkedinIcon:wm,List:rp,ListCheck:IV,ListCheckIcon:IV,ListChecks:PV,ListChecksIcon:PV,ListCollapse:LV,ListCollapseIcon:LV,ListEnd:OV,ListEndIcon:OV,ListFilter:DV,ListFilterIcon:DV,ListIcon:rp,ListMinus:RV,ListMinusIcon:RV,ListMusic:FV,ListMusicIcon:FV,ListOrdered:vS,ListOrderedIcon:vS,ListPlus:zV,ListPlusIcon:zV,ListRestart:BV,ListRestartIcon:BV,ListStart:$V,ListStartIcon:$V,ListTodo:UV,ListTodoIcon:UV,ListTree:qV,ListTreeIcon:qV,ListVideo:VV,ListVideoIcon:VV,ListX:HV,ListXIcon:HV,Loader:GV,Loader2:Yr,Loader2Icon:Yr,LoaderCircle:Yr,LoaderCircleIcon:Yr,LoaderIcon:GV,LoaderPinwheel:WV,LoaderPinwheelIcon:WV,Locate:KT,LocateFixed:KV,LocateFixedIcon:KV,LocateIcon:KT,LocateOff:ZV,LocateOffIcon:ZV,Lock:np,LockIcon:np,LockKeyhole:YV,LockKeyholeIcon:YV,LockKeyholeOpen:X2,LockKeyholeOpenIcon:X2,LockOpen:Q2,LockOpenIcon:Q2,LogIn:_S,LogInIcon:_S,LogOut:bS,LogOutIcon:bS,Logs:XV,LogsIcon:XV,Lollipop:QV,LollipopIcon:QV,LucideAArrowDown:LO,LucideAArrowUp:OO,LucideALargeSmall:DO,LucideAccessibility:RO,LucideActivity:wg,LucideActivitySquare:bb,LucideAirVent:FO,LucideAirplay:zO,LucideAlarmCheck:j_,LucideAlarmClock:$O,LucideAlarmClockCheck:j_,LucideAlarmClockMinus:k_,LucideAlarmClockOff:BO,LucideAlarmClockPlus:N_,LucideAlarmMinus:k_,LucideAlarmPlus:N_,LucideAlarmSmoke:UO,LucideAlbum:qO,LucideAlertCircle:pl,LucideAlertOctagon:tb,LucideAlertTriangle:Xh,LucideAlignCenter:oS,LucideAlignCenterHorizontal:VO,LucideAlignCenterVertical:HO,LucideAlignEndHorizontal:WO,LucideAlignEndVertical:GO,LucideAlignHorizontalDistributeCenter:KO,LucideAlignHorizontalDistributeEnd:ZO,LucideAlignHorizontalDistributeStart:YO,LucideAlignHorizontalJustifyCenter:XO,LucideAlignHorizontalJustifyEnd:QO,LucideAlignHorizontalJustifyStart:JO,LucideAlignHorizontalSpaceAround:e8,LucideAlignHorizontalSpaceBetween:t8,LucideAlignJustify:r8,LucideAlignLeft:lS,LucideAlignRight:cS,LucideAlignStartHorizontal:n8,LucideAlignStartVertical:s8,LucideAlignVerticalDistributeCenter:a8,LucideAlignVerticalDistributeEnd:i8,LucideAlignVerticalDistributeStart:o8,LucideAlignVerticalJustifyCenter:l8,LucideAlignVerticalJustifyEnd:c8,LucideAlignVerticalJustifyStart:d8,LucideAlignVerticalSpaceAround:u8,LucideAlignVerticalSpaceBetween:h8,LucideAmbulance:f8,LucideAmpersand:p8,LucideAmpersands:m8,LucideAmphora:g8,LucideAnchor:x8,LucideAngry:y8,LucideAnnoyed:v8,LucideAntenna:_8,LucideAnvil:b8,LucideAperture:w8,LucideAppWindow:FT,LucideAppWindowMac:j8,LucideApple:k8,LucideArchive:C8,LucideArchiveRestore:N8,LucideArchiveX:S8,LucideAreaChart:z_,LucideArmchair:M8,LucideArrowBigDown:A8,LucideArrowBigDownDash:T8,LucideArrowBigLeft:I8,LucideArrowBigLeftDash:E8,LucideArrowBigRight:L8,LucideArrowBigRightDash:P8,LucideArrowBigUp:D8,LucideArrowBigUpDash:O8,LucideArrowDown:Xx,LucideArrowDown01:R8,LucideArrowDown10:F8,LucideArrowDownAZ:S_,LucideArrowDownAz:S_,LucideArrowDownCircle:X_,LucideArrowDownFromLine:z8,LucideArrowDownLeft:B8,LucideArrowDownLeftFromCircle:J_,LucideArrowDownLeftFromSquare:Sb,LucideArrowDownLeftSquare:wb,LucideArrowDownNarrowWide:$8,LucideArrowDownRight:U8,LucideArrowDownRightFromCircle:e2,LucideArrowDownRightFromSquare:Cb,LucideArrowDownRightSquare:jb,LucideArrowDownSquare:kb,LucideArrowDownToDot:q8,LucideArrowDownToLine:V8,LucideArrowDownUp:H8,LucideArrowDownWideNarrow:C_,LucideArrowDownZA:M_,LucideArrowDownZa:M_,LucideArrowLeft:io,LucideArrowLeftCircle:Q_,LucideArrowLeftFromLine:W8,LucideArrowLeftRight:G8,LucideArrowLeftSquare:Nb,LucideArrowLeftToLine:K8,LucideArrowRight:Jo,LucideArrowRightCircle:n2,LucideArrowRightFromLine:Z8,LucideArrowRightLeft:Y8,LucideArrowRightSquare:Ab,LucideArrowRightToLine:X8,LucideArrowUp:ep,LucideArrowUp01:Q8,LucideArrowUp10:J8,LucideArrowUpAZ:T_,LucideArrowUpAz:T_,LucideArrowUpCircle:s2,LucideArrowUpDown:jg,LucideArrowUpFromDot:eD,LucideArrowUpFromLine:tD,LucideArrowUpLeft:rD,LucideArrowUpLeftFromCircle:t2,LucideArrowUpLeftFromSquare:Mb,LucideArrowUpLeftSquare:Eb,LucideArrowUpNarrowWide:A_,LucideArrowUpRight:nD,LucideArrowUpRightFromCircle:r2,LucideArrowUpRightFromSquare:Tb,LucideArrowUpRightSquare:Ib,LucideArrowUpSquare:Pb,LucideArrowUpToLine:sD,LucideArrowUpWideNarrow:aD,LucideArrowUpZA:E_,LucideArrowUpZa:E_,LucideArrowsUpFromLine:iD,LucideAsterisk:oD,LucideAsteriskSquare:Lb,LucideAtSign:lD,LucideAtom:cD,LucideAudioLines:dD,LucideAudioWaveform:uD,LucideAward:Rl,LucideAxe:hD,LucideAxis3D:I_,LucideAxis3d:I_,LucideBaby:fD,LucideBackpack:pD,LucideBadge:AD,LucideBadgeAlert:mD,LucideBadgeCent:gD,LucideBadgeCheck:P_,LucideBadgeDollarSign:xD,LucideBadgeEuro:yD,LucideBadgeHelp:vD,LucideBadgeIndianRupee:_D,LucideBadgeInfo:bD,LucideBadgeJapaneseYen:wD,LucideBadgeMinus:jD,LucideBadgePercent:kD,LucideBadgePlus:ND,LucideBadgePoundSterling:SD,LucideBadgeRussianRuble:CD,LucideBadgeSwissFranc:MD,LucideBadgeX:TD,LucideBaggageClaim:ED,LucideBan:ID,LucideBanana:PD,LucideBandage:LD,LucideBanknote:OD,LucideBarChart:W_,LucideBarChart2:G_,LucideBarChart3:gc,LucideBarChart4:V_,LucideBarChartBig:q_,LucideBarChartHorizontal:$_,LucideBarChartHorizontalBig:B_,LucideBarcode:DD,LucideBaseline:RD,LucideBath:C1,LucideBattery:qD,LucideBatteryCharging:FD,LucideBatteryFull:zD,LucideBatteryLow:BD,LucideBatteryMedium:$D,LucideBatteryWarning:UD,LucideBeaker:VD,LucideBean:WD,LucideBeanOff:HD,LucideBed:M1,LucideBedDouble:GD,LucideBedSingle:KD,LucideBeef:ZD,LucideBeer:XD,LucideBeerOff:YD,LucideBell:kg,LucideBellDot:QD,LucideBellElectric:JD,LucideBellMinus:eR,LucideBellOff:xj,LucideBellPlus:tR,LucideBellRing:rR,LucideBetweenHorizonalEnd:L_,LucideBetweenHorizonalStart:O_,LucideBetweenHorizontalEnd:L_,LucideBetweenHorizontalStart:O_,LucideBetweenVerticalEnd:nR,LucideBetweenVerticalStart:sR,LucideBicepsFlexed:aR,LucideBike:iR,LucideBinary:oR,LucideBinoculars:lR,LucideBiohazard:cR,LucideBird:dR,LucideBitcoin:uR,LucideBlend:hR,LucideBlinds:fR,LucideBlocks:pR,LucideBluetooth:yR,LucideBluetoothConnected:mR,LucideBluetoothOff:gR,LucideBluetoothSearching:xR,LucideBold:dS,LucideBolt:vR,LucideBomb:_R,LucideBone:bR,LucideBook:qR,LucideBookA:wR,LucideBookAudio:jR,LucideBookCheck:kR,LucideBookCopy:NR,LucideBookDashed:D_,LucideBookDown:SR,LucideBookHeadphones:CR,LucideBookHeart:MR,LucideBookImage:TR,LucideBookKey:AR,LucideBookLock:ER,LucideBookMarked:IR,LucideBookMinus:PR,LucideBookOpen:zT,LucideBookOpenCheck:LR,LucideBookOpenText:OR,LucideBookPlus:DR,LucideBookTemplate:D_,LucideBookText:RR,LucideBookType:FR,LucideBookUp:BR,LucideBookUp2:zR,LucideBookUser:$R,LucideBookX:UR,LucideBookmark:vm,LucideBookmarkCheck:VR,LucideBookmarkMinus:HR,LucideBookmarkPlus:BT,LucideBookmarkX:WR,LucideBoomBox:GR,LucideBot:uS,LucideBotMessageSquare:KR,LucideBotOff:ZR,LucideBox:YR,LucideBoxSelect:Vb,LucideBoxes:XR,LucideBraces:R_,LucideBrackets:QR,LucideBrain:$T,LucideBrainCircuit:JR,LucideBrainCog:eF,LucideBrickWall:tF,LucideBriefcase:Nh,LucideBriefcaseBusiness:rF,LucideBriefcaseConveyorBelt:nF,LucideBriefcaseMedical:sF,LucideBringToFront:aF,LucideBrush:iF,LucideBug:cF,LucideBugOff:oF,LucideBugPlay:lF,LucideBuilding:yj,LucideBuilding2:li,LucideBus:uF,LucideBusFront:dF,LucideCable:fF,LucideCableCar:hF,LucideCake:of,LucideCakeSlice:pF,LucideCalculator:mF,LucideCalendar:Ds,LucideCalendar1:gF,LucideCalendarArrowDown:xF,LucideCalendarArrowUp:yF,LucideCalendarCheck:_F,LucideCalendarCheck2:vF,LucideCalendarClock:UT,LucideCalendarCog:bF,LucideCalendarDays:_m,LucideCalendarFold:wF,LucideCalendarHeart:jF,LucideCalendarMinus:NF,LucideCalendarMinus2:kF,LucideCalendarOff:SF,LucideCalendarPlus:vj,LucideCalendarPlus2:CF,LucideCalendarRange:MF,LucideCalendarSearch:TF,LucideCalendarSync:AF,LucideCalendarX:IF,LucideCalendarX2:EF,LucideCamera:Ng,LucideCameraOff:PF,LucideCandlestickChart:U_,LucideCandy:DF,LucideCandyCane:LF,LucideCandyOff:OF,LucideCannabis:RF,LucideCaptions:F_,LucideCaptionsOff:FF,LucideCar:$F,LucideCarFront:zF,LucideCarTaxiFront:BF,LucideCaravan:UF,LucideCarrot:qF,LucideCaseLower:VF,LucideCaseSensitive:HF,LucideCaseUpper:WF,LucideCassetteTape:GF,LucideCast:KF,LucideCastle:ZF,LucideCat:YF,LucideCctv:XF,LucideChartArea:z_,LucideChartBar:$_,LucideChartBarBig:B_,LucideChartBarDecreasing:QF,LucideChartBarIncreasing:JF,LucideChartBarStacked:ez,LucideChartCandlestick:U_,LucideChartColumn:gc,LucideChartColumnBig:q_,LucideChartColumnDecreasing:tz,LucideChartColumnIncreasing:V_,LucideChartColumnStacked:rz,LucideChartGantt:nz,LucideChartLine:H_,LucideChartNetwork:sz,LucideChartNoAxesColumn:G_,LucideChartNoAxesColumnDecreasing:az,LucideChartNoAxesColumnIncreasing:W_,LucideChartNoAxesCombined:iz,LucideChartNoAxesGantt:K_,LucideChartPie:Z_,LucideChartScatter:Y_,LucideChartSpline:oz,LucideCheck:_i,LucideCheckCheck:lz,LucideCheckCircle:Ii,LucideCheckCircle2:Xi,LucideCheckSquare:F0,LucideCheckSquare2:Db,LucideChefHat:cz,LucideCherry:dz,LucideChevronDown:Qd,LucideChevronDownCircle:a2,LucideChevronDownSquare:Rb,LucideChevronFirst:uz,LucideChevronLast:hz,LucideChevronLeft:vc,LucideChevronLeftCircle:i2,LucideChevronLeftSquare:Fb,LucideChevronRight:Bi,LucideChevronRightCircle:o2,LucideChevronRightSquare:zb,LucideChevronUp:T1,LucideChevronUpCircle:l2,LucideChevronUpSquare:Bb,LucideChevronsDown:pz,LucideChevronsDownUp:fz,LucideChevronsLeft:xz,LucideChevronsLeftRight:gz,LucideChevronsLeftRightEllipsis:mz,LucideChevronsRight:vz,LucideChevronsRightLeft:yz,LucideChevronsUp:_z,LucideChevronsUpDown:Qx,LucideChrome:bz,LucideChurch:wz,LucideCigarette:kz,LucideCigaretteOff:jz,LucideCircle:Gu,LucideCircleAlert:pl,LucideCircleArrowDown:X_,LucideCircleArrowLeft:Q_,LucideCircleArrowOutDownLeft:J_,LucideCircleArrowOutDownRight:e2,LucideCircleArrowOutUpLeft:t2,LucideCircleArrowOutUpRight:r2,LucideCircleArrowRight:n2,LucideCircleArrowUp:s2,LucideCircleCheck:Xi,LucideCircleCheckBig:Ii,LucideCircleChevronDown:a2,LucideCircleChevronLeft:i2,LucideCircleChevronRight:o2,LucideCircleChevronUp:l2,LucideCircleDashed:Nz,LucideCircleDivide:c2,LucideCircleDollarSign:Sz,LucideCircleDot:Mz,LucideCircleDotDashed:Cz,LucideCircleEllipsis:Tz,LucideCircleEqual:Az,LucideCircleFadingArrowUp:Ez,LucideCircleFadingPlus:Iz,LucideCircleGauge:d2,LucideCircleHelp:Dx,LucideCircleMinus:u2,LucideCircleOff:Pz,LucideCircleParking:f2,LucideCircleParkingOff:h2,LucideCirclePause:p2,LucideCirclePercent:m2,LucideCirclePlay:Gf,LucideCirclePlus:g2,LucideCirclePower:x2,LucideCircleSlash:Lz,LucideCircleSlash2:y2,LucideCircleSlashed:y2,LucideCircleStop:v2,LucideCircleUser:b2,LucideCircleUserRound:_2,LucideCircleX:Lc,LucideCircuitBoard:Oz,LucideCitrus:Dz,LucideClapperboard:Rz,LucideClipboard:Vz,LucideClipboardCheck:qT,LucideClipboardCopy:Fz,LucideClipboardEdit:j2,LucideClipboardList:VT,LucideClipboardMinus:zz,LucideClipboardPaste:Bz,LucideClipboardPen:j2,LucideClipboardPenLine:w2,LucideClipboardPlus:$z,LucideClipboardSignature:w2,LucideClipboardType:Uz,LucideClipboardX:qz,LucideClock:Wa,LucideClock1:Hz,LucideClock10:Wz,LucideClock11:Gz,LucideClock12:Kz,LucideClock2:Zz,LucideClock3:Yz,LucideClock4:Xz,LucideClock5:Qz,LucideClock6:Jz,LucideClock7:e7,LucideClock8:t7,LucideClock9:r7,LucideClockAlert:n7,LucideClockArrowDown:s7,LucideClockArrowUp:a7,LucideCloud:_7,LucideCloudAlert:i7,LucideCloudCog:o7,LucideCloudDownload:k2,LucideCloudDrizzle:l7,LucideCloudFog:c7,LucideCloudHail:d7,LucideCloudLightning:u7,LucideCloudMoon:f7,LucideCloudMoonRain:h7,LucideCloudOff:p7,LucideCloudRain:g7,LucideCloudRainWind:m7,LucideCloudSnow:x7,LucideCloudSun:v7,LucideCloudSunRain:y7,LucideCloudUpload:N2,LucideCloudy:b7,LucideClover:Vx,LucideClub:w7,LucideCode:_j,LucideCode2:S2,LucideCodeSquare:$b,LucideCodeXml:S2,LucideCodepen:j7,LucideCodesandbox:k7,LucideCoffee:bj,LucideCog:N7,LucideCoins:S7,LucideColumns:C2,LucideColumns2:C2,LucideColumns3:M2,LucideColumns4:C7,LucideCombine:M7,LucideCommand:T7,LucideCompass:A7,LucideComponent:E7,LucideComputer:I7,LucideConciergeBell:P7,LucideCone:L7,LucideConstruction:O7,LucideContact:D7,LucideContact2:T2,LucideContactRound:T2,LucideContainer:R7,LucideContrast:F7,LucideCookie:z7,LucideCookingPot:B7,LucideCopy:tl,LucideCopyCheck:$7,LucideCopyMinus:U7,LucideCopyPlus:q7,LucideCopySlash:V7,LucideCopyX:H7,LucideCopyleft:W7,LucideCopyright:G7,LucideCornerDownLeft:K7,LucideCornerDownRight:Z7,LucideCornerLeftDown:Y7,LucideCornerLeftUp:X7,LucideCornerRightDown:Q7,LucideCornerRightUp:J7,LucideCornerUpLeft:eB,LucideCornerUpRight:tB,LucideCpu:rB,LucideCreativeCommons:nB,LucideCreditCard:bm,LucideCroissant:sB,LucideCrop:aB,LucideCross:iB,LucideCrosshair:oB,LucideCrown:A1,LucideCuboid:lB,LucideCupSoda:cB,LucideCurlyBraces:R_,LucideCurrency:dB,LucideCylinder:uB,LucideDam:hB,LucideDatabase:mB,LucideDatabaseBackup:fB,LucideDatabaseZap:pB,LucideDelete:gB,LucideDessert:xB,LucideDiameter:yB,LucideDiamond:bB,LucideDiamondMinus:vB,LucideDiamondPercent:A2,LucideDiamondPlus:_B,LucideDice1:wB,LucideDice2:jB,LucideDice3:kB,LucideDice4:NB,LucideDice5:SB,LucideDice6:CB,LucideDices:MB,LucideDiff:TB,LucideDisc:PB,LucideDisc2:AB,LucideDisc3:EB,LucideDiscAlbum:IB,LucideDivide:LB,LucideDivideCircle:c2,LucideDivideSquare:Hb,LucideDna:DB,LucideDnaOff:OB,LucideDock:RB,LucideDog:FB,LucideDollarSign:wd,LucideDonut:zB,LucideDoorClosed:BB,LucideDoorOpen:wj,LucideDot:$B,LucideDotSquare:Wb,LucideDownload:ao,LucideDownloadCloud:k2,LucideDraftingCompass:UB,LucideDrama:qB,LucideDribbble:VB,LucideDrill:HB,LucideDroplet:WB,LucideDroplets:GB,LucideDrum:KB,LucideDrumstick:ZB,LucideDumbbell:YB,LucideEar:QB,LucideEarOff:XB,LucideEarth:E2,LucideEarthLock:JB,LucideEclipse:e9,LucideEdit:hc,LucideEdit2:R0,LucideEdit3:D0,LucideEgg:hS,LucideEggFried:t9,LucideEggOff:r9,LucideEllipsis:lm,LucideEllipsisVertical:Rx,LucideEqual:a9,LucideEqualApproximately:n9,LucideEqualNot:s9,LucideEqualSquare:Gb,LucideEraser:i9,LucideEthernetPort:o9,LucideEuro:l9,LucideExpand:c9,LucideExternalLink:Os,LucideEye:$o,LucideEyeClosed:d9,LucideEyeOff:E1,LucideFacebook:Jd,LucideFactory:u9,LucideFan:h9,LucideFastForward:f9,LucideFeather:p9,LucideFence:m9,LucideFerrisWheel:g9,LucideFigma:x9,LucideFile:u$,LucideFileArchive:y9,LucideFileAudio:_9,LucideFileAudio2:v9,LucideFileAxis3D:I2,LucideFileAxis3d:I2,LucideFileBadge:w9,LucideFileBadge2:b9,LucideFileBarChart:P2,LucideFileBarChart2:L2,LucideFileBox:j9,LucideFileChartColumn:L2,LucideFileChartColumnIncreasing:P2,LucideFileChartLine:O2,LucideFileChartPie:D2,LucideFileCheck:N9,LucideFileCheck2:k9,LucideFileClock:S9,LucideFileCode:M9,LucideFileCode2:C9,LucideFileCog:R2,LucideFileCog2:R2,LucideFileDiff:T9,LucideFileDigit:A9,LucideFileDown:E9,LucideFileEdit:z2,LucideFileHeart:I9,LucideFileImage:I1,LucideFileInput:P9,LucideFileJson:O9,LucideFileJson2:L9,LucideFileKey:R9,LucideFileKey2:D9,LucideFileLineChart:O2,LucideFileLock:z9,LucideFileLock2:F9,LucideFileMinus:$9,LucideFileMinus2:B9,LucideFileMusic:U9,LucideFileOutput:q9,LucideFilePen:z2,LucideFilePenLine:F2,LucideFilePieChart:D2,LucideFilePlus:H9,LucideFilePlus2:V9,LucideFileQuestion:W9,LucideFileScan:G9,LucideFileSearch:Z9,LucideFileSearch2:K9,LucideFileSignature:F2,LucideFileSliders:Y9,LucideFileSpreadsheet:P1,LucideFileStack:X9,LucideFileSymlink:Q9,LucideFileTerminal:J9,LucideFileText:ka,LucideFileType:t$,LucideFileType2:e$,LucideFileUp:r$,LucideFileUser:n$,LucideFileVideo:a$,LucideFileVideo2:s$,LucideFileVolume:o$,LucideFileVolume2:i$,LucideFileWarning:l$,LucideFileX:d$,LucideFileX2:c$,LucideFiles:h$,LucideFilm:$d,LucideFilter:L1,LucideFilterX:f$,LucideFingerprint:p$,LucideFireExtinguisher:m$,LucideFish:y$,LucideFishOff:g$,LucideFishSymbol:x$,LucideFlag:Jx,LucideFlagOff:v$,LucideFlagTriangleLeft:_$,LucideFlagTriangleRight:b$,LucideFlame:lf,LucideFlameKindling:w$,LucideFlashlight:k$,LucideFlashlightOff:j$,LucideFlaskConical:jj,LucideFlaskConicalOff:N$,LucideFlaskRound:S$,LucideFlipHorizontal:M$,LucideFlipHorizontal2:C$,LucideFlipVertical:A$,LucideFlipVertical2:T$,LucideFlower:E$,LucideFlower2:fm,LucideFocus:I$,LucideFoldHorizontal:P$,LucideFoldVertical:L$,LucideFolder:oU,LucideFolderArchive:O$,LucideFolderCheck:D$,LucideFolderClock:R$,LucideFolderClosed:F$,LucideFolderCode:z$,LucideFolderCog:B2,LucideFolderCog2:B2,LucideFolderDot:B$,LucideFolderDown:$$,LucideFolderEdit:$2,LucideFolderGit:q$,LucideFolderGit2:U$,LucideFolderHeart:V$,LucideFolderInput:H$,LucideFolderKanban:W$,LucideFolderKey:G$,LucideFolderLock:K$,LucideFolderMinus:Z$,LucideFolderOpen:Sg,LucideFolderOpenDot:Y$,LucideFolderOutput:X$,LucideFolderPen:$2,LucideFolderPlus:Q$,LucideFolderRoot:J$,LucideFolderSearch:tU,LucideFolderSearch2:eU,LucideFolderSymlink:rU,LucideFolderSync:nU,LucideFolderTree:sU,LucideFolderUp:aU,LucideFolderX:iU,LucideFolders:lU,LucideFootprints:cU,LucideForkKnife:Iw,LucideForkKnifeCrossed:Ew,LucideForklift:dU,LucideFormInput:fb,LucideForward:uU,LucideFrame:hU,LucideFramer:fU,LucideFrown:pU,LucideFuel:mU,LucideFullscreen:gU,LucideFunctionSquare:Kb,LucideGalleryHorizontal:yU,LucideGalleryHorizontalEnd:xU,LucideGalleryThumbnails:vU,LucideGalleryVertical:bU,LucideGalleryVerticalEnd:_U,LucideGamepad:jU,LucideGamepad2:wU,LucideGanttChart:K_,LucideGanttChartSquare:sg,LucideGauge:kU,LucideGaugeCircle:d2,LucideGavel:NU,LucideGem:SU,LucideGhost:kj,LucideGift:Zi,LucideGitBranch:MU,LucideGitBranchPlus:CU,LucideGitCommit:U2,LucideGitCommitHorizontal:U2,LucideGitCommitVertical:TU,LucideGitCompare:EU,LucideGitCompareArrows:AU,LucideGitFork:IU,LucideGitGraph:PU,LucideGitMerge:LU,LucideGitPullRequest:BU,LucideGitPullRequestArrow:OU,LucideGitPullRequestClosed:DU,LucideGitPullRequestCreate:FU,LucideGitPullRequestCreateArrow:RU,LucideGitPullRequestDraft:zU,LucideGithub:$U,LucideGitlab:UU,LucideGlassWater:qU,LucideGlasses:VU,LucideGlobe:ey,LucideGlobe2:E2,LucideGlobeLock:HU,LucideGoal:WU,LucideGrab:GU,LucideGraduationCap:O1,LucideGrape:KU,LucideGrid:Gh,LucideGrid2X2:V2,LucideGrid2X2Plus:q2,LucideGrid2x2:V2,LucideGrid2x2Check:ZU,LucideGrid2x2Plus:q2,LucideGrid2x2X:YU,LucideGrid3X3:Gh,LucideGrid3x3:Gh,LucideGrip:QU,LucideGripHorizontal:XU,LucideGripVertical:D1,LucideGroup:JU,LucideGuitar:eq,LucideHam:tq,LucideHammer:rq,LucideHand:oq,LucideHandCoins:nq,LucideHandHeart:sq,LucideHandHelping:H2,LucideHandMetal:aq,LucideHandPlatter:iq,LucideHandshake:lq,LucideHardDrive:HT,LucideHardDriveDownload:cq,LucideHardDriveUpload:dq,LucideHardHat:uq,LucideHash:fS,LucideHaze:hq,LucideHdmiPort:fq,LucideHeading:yq,LucideHeading1:WT,LucideHeading2:GT,LucideHeading3:pq,LucideHeading4:mq,LucideHeading5:gq,LucideHeading6:xq,LucideHeadphoneOff:vq,LucideHeadphones:_q,LucideHeadset:bq,LucideHeart:fi,LucideHeartCrack:wq,LucideHeartHandshake:jq,LucideHeartOff:kq,LucideHeartPulse:Nq,LucideHeater:Sq,LucideHelpCircle:Dx,LucideHelpingHand:H2,LucideHexagon:Cq,LucideHighlighter:Mq,LucideHistory:pS,LucideHome:ua,LucideHop:Aq,LucideHopOff:Tq,LucideHospital:Eq,LucideHotel:Iq,LucideHourglass:Pq,LucideHouse:ua,LucideHousePlug:Lq,LucideHousePlus:Oq,LucideIceCream:G2,LucideIceCream2:W2,LucideIceCreamBowl:W2,LucideIceCreamCone:G2,LucideIdCard:Dq,LucideImage:Ol,LucideImageDown:Rq,LucideImageMinus:Fq,LucideImageOff:zq,LucideImagePlay:Bq,LucideImagePlus:mS,LucideImageUp:$q,LucideImageUpscale:Uq,LucideImages:qq,LucideImport:Vq,LucideInbox:Hq,LucideIndent:Z2,LucideIndentDecrease:K2,LucideIndentIncrease:Z2,LucideIndianRupee:Wq,LucideInfinity:Gq,LucideInfo:Kq,LucideInspect:ew,LucideInspectionPanel:Zq,LucideInstagram:mu,LucideItalic:gS,LucideIterationCcw:Yq,LucideIterationCw:Xq,LucideJapaneseYen:Qq,LucideJoystick:Jq,LucideKanban:ty,LucideKanbanSquare:Zb,LucideKanbanSquareDashed:Ub,LucideKey:cf,LucideKeyRound:Nj,LucideKeySquare:eV,LucideKeyboard:nV,LucideKeyboardMusic:tV,LucideKeyboardOff:rV,LucideLamp:cV,LucideLampCeiling:sV,LucideLampDesk:aV,LucideLampFloor:iV,LucideLampWallDown:oV,LucideLampWallUp:lV,LucideLandPlot:dV,LucideLandmark:uV,LucideLanguages:hV,LucideLaptop:pV,LucideLaptop2:Y2,LucideLaptopMinimal:Y2,LucideLaptopMinimalCheck:fV,LucideLasso:gV,LucideLassoSelect:mV,LucideLaugh:xV,LucideLayers:_V,LucideLayers2:yV,LucideLayers3:vV,LucideLayout:O0,LucideLayoutDashboard:Sj,LucideLayoutGrid:tp,LucideLayoutList:bV,LucideLayoutPanelLeft:wV,LucideLayoutPanelTop:jV,LucideLayoutTemplate:Cj,LucideLeaf:kV,LucideLeafyGreen:NV,LucideLectern:SV,LucideLetterText:CV,LucideLibrary:xS,LucideLibraryBig:MV,LucideLibrarySquare:Yb,LucideLifeBuoy:yS,LucideLigature:TV,LucideLightbulb:R1,LucideLightbulbOff:AV,LucideLineChart:H_,LucideLink:Mo,LucideLink2:df,LucideLink2Off:EV,LucideLinkedin:wm,LucideList:rp,LucideListCheck:IV,LucideListChecks:PV,LucideListCollapse:LV,LucideListEnd:OV,LucideListFilter:DV,LucideListMinus:RV,LucideListMusic:FV,LucideListOrdered:vS,LucideListPlus:zV,LucideListRestart:BV,LucideListStart:$V,LucideListTodo:UV,LucideListTree:qV,LucideListVideo:VV,LucideListX:HV,LucideLoader:GV,LucideLoader2:Yr,LucideLoaderCircle:Yr,LucideLoaderPinwheel:WV,LucideLocate:KT,LucideLocateFixed:KV,LucideLocateOff:ZV,LucideLock:np,LucideLockKeyhole:YV,LucideLockKeyholeOpen:X2,LucideLockOpen:Q2,LucideLogIn:_S,LucideLogOut:bS,LucideLogs:XV,LucideLollipop:QV,LucideLuggage:JV,LucideMSquare:Xb,LucideMagnet:eH,LucideMail:ws,LucideMailCheck:tH,LucideMailMinus:rH,LucideMailOpen:nH,LucideMailPlus:sH,LucideMailQuestion:aH,LucideMailSearch:iH,LucideMailWarning:oH,LucideMailX:ZT,LucideMailbox:lH,LucideMails:cH,LucideMap:bH,LucideMapPin:To,LucideMapPinCheck:uH,LucideMapPinCheckInside:dH,LucideMapPinHouse:hH,LucideMapPinMinus:pH,LucideMapPinMinusInside:fH,LucideMapPinOff:mH,LucideMapPinPlus:xH,LucideMapPinPlusInside:gH,LucideMapPinX:vH,LucideMapPinXInside:yH,LucideMapPinned:_H,LucideMartini:wH,LucideMaximize:kH,LucideMaximize2:jH,LucideMedal:ry,LucideMegaphone:jm,LucideMegaphoneOff:NH,LucideMeh:SH,LucideMemoryStick:CH,LucideMenu:YT,LucideMenuSquare:Qb,LucideMerge:MH,LucideMessageCircle:Bl,LucideMessageCircleCode:TH,LucideMessageCircleDashed:AH,LucideMessageCircleHeart:wS,LucideMessageCircleMore:EH,LucideMessageCircleOff:IH,LucideMessageCirclePlus:PH,LucideMessageCircleQuestion:XT,LucideMessageCircleReply:LH,LucideMessageCircleWarning:OH,LucideMessageCircleX:DH,LucideMessageSquare:Do,LucideMessageSquareCode:RH,LucideMessageSquareDashed:FH,LucideMessageSquareDiff:zH,LucideMessageSquareDot:BH,LucideMessageSquareHeart:$H,LucideMessageSquareLock:UH,LucideMessageSquareMore:qH,LucideMessageSquareOff:VH,LucideMessageSquarePlus:HH,LucideMessageSquareQuote:QT,LucideMessageSquareReply:WH,LucideMessageSquareShare:GH,LucideMessageSquareText:KH,LucideMessageSquareWarning:ZH,LucideMessageSquareX:YH,LucideMessagesSquare:XH,LucideMic:JT,LucideMic2:J2,LucideMicOff:QH,LucideMicVocal:J2,LucideMicrochip:JH,LucideMicroscope:eW,LucideMicrowave:tW,LucideMilestone:rW,LucideMilk:sW,LucideMilkOff:nW,LucideMinimize:iW,LucideMinimize2:aW,LucideMinus:F1,LucideMinusCircle:u2,LucideMinusSquare:Jb,LucideMonitor:Mj,LucideMonitorCheck:oW,LucideMonitorCog:lW,LucideMonitorDot:cW,LucideMonitorDown:dW,LucideMonitorOff:uW,LucideMonitorPause:hW,LucideMonitorPlay:fW,LucideMonitorSmartphone:pW,LucideMonitorSpeaker:mW,LucideMonitorStop:gW,LucideMonitorUp:xW,LucideMonitorX:yW,LucideMoon:_W,LucideMoonStar:vW,LucideMoreHorizontal:lm,LucideMoreVertical:Rx,LucideMountain:wW,LucideMountainSnow:bW,LucideMouse:CW,LucideMouseOff:jW,LucideMousePointer:SW,LucideMousePointer2:kW,LucideMousePointerBan:NW,LucideMousePointerClick:Tj,LucideMousePointerSquareDashed:qb,LucideMove:BW,LucideMove3D:eb,LucideMove3d:eb,LucideMoveDiagonal:TW,LucideMoveDiagonal2:MW,LucideMoveDown:IW,LucideMoveDownLeft:AW,LucideMoveDownRight:EW,LucideMoveHorizontal:PW,LucideMoveLeft:LW,LucideMoveRight:OW,LucideMoveUp:FW,LucideMoveUpLeft:DW,LucideMoveUpRight:RW,LucideMoveVertical:zW,LucideMusic:VW,LucideMusic2:$W,LucideMusic3:UW,LucideMusic4:qW,LucideNavigation:eA,LucideNavigation2:WW,LucideNavigation2Off:HW,LucideNavigationOff:GW,LucideNetwork:KW,LucideNewspaper:ny,LucideNfc:ZW,LucideNotebook:JW,LucideNotebookPen:YW,LucideNotebookTabs:XW,LucideNotebookText:QW,LucideNotepadText:tG,LucideNotepadTextDashed:eG,LucideNut:nG,LucideNutOff:rG,LucideOctagon:aG,LucideOctagonAlert:tb,LucideOctagonMinus:sG,LucideOctagonPause:rb,LucideOctagonX:nb,LucideOmega:iG,LucideOption:oG,LucideOrbit:lG,LucideOrigami:cG,LucideOutdent:K2,LucidePackage:$l,LucidePackage2:dG,LucidePackageCheck:uG,LucidePackageMinus:hG,LucidePackageOpen:fG,LucidePackagePlus:pG,LucidePackageSearch:mG,LucidePackageX:gG,LucidePaintBucket:xG,LucidePaintRoller:yG,LucidePaintbrush:vG,LucidePaintbrush2:sb,LucidePaintbrushVertical:sb,LucidePalette:Rc,LucidePalmtree:bw,LucidePanelBottom:wG,LucidePanelBottomClose:_G,LucidePanelBottomDashed:ab,LucidePanelBottomInactive:ab,LucidePanelBottomOpen:bG,LucidePanelLeft:cb,LucidePanelLeftClose:ib,LucidePanelLeftDashed:ob,LucidePanelLeftInactive:ob,LucidePanelLeftOpen:lb,LucidePanelRight:NG,LucidePanelRightClose:jG,LucidePanelRightDashed:db,LucidePanelRightInactive:db,LucidePanelRightOpen:kG,LucidePanelTop:MG,LucidePanelTopClose:SG,LucidePanelTopDashed:ub,LucidePanelTopInactive:ub,LucidePanelTopOpen:CG,LucidePanelsLeftBottom:TG,LucidePanelsLeftRight:M2,LucidePanelsRightBottom:AG,LucidePanelsTopBottom:gb,LucidePanelsTopLeft:O0,LucidePaperclip:EG,LucideParentheses:IG,LucideParkingCircle:f2,LucideParkingCircleOff:h2,LucideParkingMeter:PG,LucideParkingSquare:rw,LucideParkingSquareOff:tw,LucidePartyPopper:Fc,LucidePause:sp,LucidePauseCircle:p2,LucidePauseOctagon:rb,LucidePawPrint:LG,LucidePcCase:OG,LucidePen:R0,LucidePenBox:hc,LucidePenLine:D0,LucidePenOff:DG,LucidePenSquare:hc,LucidePenTool:Aj,LucidePencil:ni,LucidePencilLine:RG,LucidePencilOff:FG,LucidePencilRuler:zG,LucidePentagon:BG,LucidePercent:jS,LucidePercentCircle:m2,LucidePercentDiamond:A2,LucidePercentSquare:nw,LucidePersonStanding:$G,LucidePhilippinePeso:UG,LucidePhone:ji,LucidePhoneCall:qG,LucidePhoneForwarded:VG,LucidePhoneIncoming:HG,LucidePhoneMissed:WG,LucidePhoneOff:GG,LucidePhoneOutgoing:KG,LucidePi:ZG,LucidePiSquare:sw,LucidePiano:YG,LucidePickaxe:XG,LucidePictureInPicture:JG,LucidePictureInPicture2:QG,LucidePieChart:Z_,LucidePiggyBank:eK,LucidePilcrow:nK,LucidePilcrowLeft:tK,LucidePilcrowRight:rK,LucidePilcrowSquare:aw,LucidePill:aK,LucidePillBottle:sK,LucidePin:z1,LucidePinOff:tA,LucidePipette:iK,LucidePizza:oK,LucidePlane:dK,LucidePlaneLanding:lK,LucidePlaneTakeoff:cK,LucidePlay:Ul,LucidePlayCircle:Gf,LucidePlaySquare:iw,LucidePlug:rA,LucidePlug2:uK,LucidePlugZap:hb,LucidePlugZap2:hb,LucidePlus:_n,LucidePlusCircle:g2,LucidePlusSquare:ow,LucidePocket:fK,LucidePocketKnife:hK,LucidePodcast:pK,LucidePointer:gK,LucidePointerOff:mK,LucidePopcorn:xK,LucidePopsicle:yK,LucidePoundSterling:vK,LucidePower:bK,LucidePowerCircle:x2,LucidePowerOff:_K,LucidePowerSquare:lw,LucidePresentation:wK,LucidePrinter:kK,LucidePrinterCheck:jK,LucideProjector:NK,LucideProportions:SK,LucidePuzzle:CK,LucidePyramid:MK,LucideQrCode:nA,LucideQuote:sA,LucideRabbit:TK,LucideRadar:AK,LucideRadiation:EK,LucideRadical:IK,LucideRadio:Ej,LucideRadioReceiver:PK,LucideRadioTower:LK,LucideRadius:OK,LucideRailSymbol:DK,LucideRainbow:RK,LucideRat:FK,LucideRatio:zK,LucideReceipt:KK,LucideReceiptCent:BK,LucideReceiptEuro:$K,LucideReceiptIndianRupee:UK,LucideReceiptJapaneseYen:qK,LucideReceiptPoundSterling:VK,LucideReceiptRussianRuble:HK,LucideReceiptSwissFranc:WK,LucideReceiptText:GK,LucideRectangleEllipsis:fb,LucideRectangleHorizontal:ZK,LucideRectangleVertical:YK,LucideRecycle:XK,LucideRedo:kS,LucideRedo2:QK,LucideRedoDot:JK,LucideRefreshCcw:tZ,LucideRefreshCcwDot:eZ,LucideRefreshCw:Ll,LucideRefreshCwOff:rZ,LucideRefrigerator:nZ,LucideRegex:sZ,LucideRemoveFormatting:aZ,LucideRepeat:aA,LucideRepeat1:iZ,LucideRepeat2:oZ,LucideReplace:cZ,LucideReplaceAll:lZ,LucideReply:iA,LucideReplyAll:dZ,LucideRewind:uZ,LucideRibbon:hZ,LucideRocket:Cg,LucideRockingChair:fZ,LucideRollerCoaster:pZ,LucideRotate3D:pb,LucideRotate3d:pb,LucideRotateCcw:NS,LucideRotateCcwSquare:mZ,LucideRotateCw:oA,LucideRotateCwSquare:gZ,LucideRoute:yZ,LucideRouteOff:xZ,LucideRouter:vZ,LucideRows:mb,LucideRows2:mb,LucideRows3:gb,LucideRows4:_Z,LucideRss:bZ,LucideRuler:wZ,LucideRussianRuble:jZ,LucideSailboat:kZ,LucideSalad:NZ,LucideSandwich:SZ,LucideSatellite:MZ,LucideSatelliteDish:CZ,LucideSave:km,LucideSaveAll:TZ,LucideSaveOff:AZ,LucideScale:EZ,LucideScale3D:xb,LucideScale3d:xb,LucideScaling:IZ,LucideScan:BZ,LucideScanBarcode:PZ,LucideScanEye:LZ,LucideScanFace:OZ,LucideScanLine:DZ,LucideScanQrCode:RZ,LucideScanSearch:FZ,LucideScanText:zZ,LucideScatterChart:Y_,LucideSchool:$Z,LucideSchool2:jw,LucideScissors:qZ,LucideScissorsLineDashed:UZ,LucideScissorsSquare:cw,LucideScissorsSquareDashedBottom:Ob,LucideScreenShare:HZ,LucideScreenShareOff:VZ,LucideScroll:GZ,LucideScrollText:WZ,LucideSearch:ya,LucideSearchCheck:KZ,LucideSearchCode:ZZ,LucideSearchSlash:YZ,LucideSearchX:XZ,LucideSection:QZ,LucideSend:eo,LucideSendHorizonal:yb,LucideSendHorizontal:yb,LucideSendToBack:JZ,LucideSeparatorHorizontal:eY,LucideSeparatorVertical:tY,LucideServer:aY,LucideServerCog:rY,LucideServerCrash:nY,LucideServerOff:sY,LucideSettings:jd,LucideSettings2:iY,LucideShapes:oY,LucideShare:lA,LucideShare2:_c,LucideSheet:lY,LucideShell:cY,LucideShield:uf,LucideShieldAlert:dY,LucideShieldBan:uY,LucideShieldCheck:cA,LucideShieldClose:vb,LucideShieldEllipsis:hY,LucideShieldHalf:fY,LucideShieldMinus:pY,LucideShieldOff:mY,LucideShieldPlus:gY,LucideShieldQuestion:xY,LucideShieldX:vb,LucideShip:vY,LucideShipWheel:yY,LucideShirt:_Y,LucideShoppingBag:Mg,LucideShoppingBasket:bY,LucideShoppingCart:_h,LucideShovel:wY,LucideShowerHead:jY,LucideShrink:kY,LucideShrub:NY,LucideShuffle:SY,LucideSidebar:cb,LucideSidebarClose:ib,LucideSidebarOpen:lb,LucideSigma:CY,LucideSigmaSquare:dw,LucideSignal:IY,LucideSignalHigh:MY,LucideSignalLow:TY,LucideSignalMedium:AY,LucideSignalZero:EY,LucideSignature:PY,LucideSignpost:OY,LucideSignpostBig:LY,LucideSiren:DY,LucideSkipBack:RY,LucideSkipForward:FY,LucideSkull:zY,LucideSlack:BY,LucideSlash:$Y,LucideSlashSquare:uw,LucideSlice:UY,LucideSliders:_b,LucideSlidersHorizontal:dA,LucideSlidersVertical:_b,LucideSmartphone:Tg,LucideSmartphoneCharging:qY,LucideSmartphoneNfc:VY,LucideSmile:WY,LucideSmilePlus:HY,LucideSnail:GY,LucideSnowflake:h1,LucideSofa:KY,LucideSortAsc:A_,LucideSortDesc:C_,LucideSoup:ZY,LucideSpace:YY,LucideSpade:XY,LucideSparkle:QY,LucideSparkles:As,LucideSpeaker:JY,LucideSpeech:eX,LucideSpellCheck:rX,LucideSpellCheck2:tX,LucideSpline:nX,LucideSplit:sX,LucideSplitSquareHorizontal:hw,LucideSplitSquareVertical:fw,LucideSprayCan:aX,LucideSprout:iX,LucideSquare:Ag,LucideSquareActivity:bb,LucideSquareArrowDown:kb,LucideSquareArrowDownLeft:wb,LucideSquareArrowDownRight:jb,LucideSquareArrowLeft:Nb,LucideSquareArrowOutDownLeft:Sb,LucideSquareArrowOutDownRight:Cb,LucideSquareArrowOutUpLeft:Mb,LucideSquareArrowOutUpRight:Tb,LucideSquareArrowRight:Ab,LucideSquareArrowUp:Pb,LucideSquareArrowUpLeft:Eb,LucideSquareArrowUpRight:Ib,LucideSquareAsterisk:Lb,LucideSquareBottomDashedScissors:Ob,LucideSquareChartGantt:sg,LucideSquareCheck:Db,LucideSquareCheckBig:F0,LucideSquareChevronDown:Rb,LucideSquareChevronLeft:Fb,LucideSquareChevronRight:zb,LucideSquareChevronUp:Bb,LucideSquareCode:$b,LucideSquareDashed:Vb,LucideSquareDashedBottom:lX,LucideSquareDashedBottomCode:oX,LucideSquareDashedKanban:Ub,LucideSquareDashedMousePointer:qb,LucideSquareDivide:Hb,LucideSquareDot:Wb,LucideSquareEqual:Gb,LucideSquareFunction:Kb,LucideSquareGanttChart:sg,LucideSquareKanban:Zb,LucideSquareLibrary:Yb,LucideSquareM:Xb,LucideSquareMenu:Qb,LucideSquareMinus:Jb,LucideSquareMousePointer:ew,LucideSquareParking:rw,LucideSquareParkingOff:tw,LucideSquarePen:hc,LucideSquarePercent:nw,LucideSquarePi:sw,LucideSquarePilcrow:aw,LucideSquarePlay:iw,LucideSquarePlus:ow,LucideSquarePower:lw,LucideSquareRadical:cX,LucideSquareScissors:cw,LucideSquareSigma:dw,LucideSquareSlash:uw,LucideSquareSplitHorizontal:hw,LucideSquareSplitVertical:fw,LucideSquareSquare:dX,LucideSquareStack:uX,LucideSquareTerminal:pw,LucideSquareUser:gw,LucideSquareUserRound:mw,LucideSquareX:xw,LucideSquircle:hX,LucideSquirrel:fX,LucideStamp:pX,LucideStar:_s,LucideStarHalf:mX,LucideStarOff:gX,LucideStars:As,LucideStepBack:xX,LucideStepForward:yX,LucideStethoscope:vX,LucideSticker:_X,LucideStickyNote:bX,LucideStopCircle:v2,LucideStore:wX,LucideStretchHorizontal:jX,LucideStretchVertical:kX,LucideStrikethrough:NX,LucideSubscript:SX,LucideSubtitles:F_,LucideSun:B1,LucideSunDim:CX,LucideSunMedium:MX,LucideSunMoon:TX,LucideSunSnow:AX,LucideSunrise:EX,LucideSunset:IX,LucideSuperscript:PX,LucideSwatchBook:LX,LucideSwissFranc:OX,LucideSwitchCamera:DX,LucideSword:RX,LucideSwords:FX,LucideSyringe:zX,LucideTable:WX,LucideTable2:SS,LucideTableCellsMerge:BX,LucideTableCellsSplit:$X,LucideTableColumnsSplit:UX,LucideTableOfContents:qX,LucideTableProperties:VX,LucideTableRowsSplit:HX,LucideTablet:KX,LucideTabletSmartphone:GX,LucideTablets:ZX,LucideTag:Eg,LucideTags:YX,LucideTally1:XX,LucideTally2:QX,LucideTally3:JX,LucideTally4:eQ,LucideTally5:tQ,LucideTangent:rQ,LucideTarget:sy,LucideTelescope:nQ,LucideTent:aQ,LucideTentTree:sQ,LucideTerminal:iQ,LucideTerminalSquare:pw,LucideTestTube:oQ,LucideTestTube2:yw,LucideTestTubeDiagonal:yw,LucideTestTubes:lQ,LucideText:fQ,LucideTextCursor:dQ,LucideTextCursorInput:cQ,LucideTextQuote:uQ,LucideTextSearch:hQ,LucideTextSelect:vw,LucideTextSelection:vw,LucideTheater:pQ,LucideThermometer:xQ,LucideThermometerSnowflake:mQ,LucideThermometerSun:gQ,LucideThumbsDown:uA,LucideThumbsUp:kd,LucideTicket:hA,LucideTicketCheck:yQ,LucideTicketMinus:vQ,LucideTicketPercent:_Q,LucideTicketPlus:bQ,LucideTicketSlash:wQ,LucideTicketX:jQ,LucideTickets:NQ,LucideTicketsPlane:kQ,LucideTimer:MQ,LucideTimerOff:SQ,LucideTimerReset:CQ,LucideToggleLeft:TQ,LucideToggleRight:AQ,LucideToilet:EQ,LucideTornado:IQ,LucideTorus:PQ,LucideTouchpad:OQ,LucideTouchpadOff:LQ,LucideTowerControl:DQ,LucideToyBrick:RQ,LucideTractor:FQ,LucideTrafficCone:zQ,LucideTrain:_w,LucideTrainFront:$Q,LucideTrainFrontTunnel:BQ,LucideTrainTrack:UQ,LucideTramFront:_w,LucideTrash:qQ,LucideTrash2:$n,LucideTreeDeciduous:VQ,LucideTreePalm:bw,LucideTreePine:$1,LucideTrees:HQ,LucideTrello:WQ,LucideTrendingDown:Ij,LucideTrendingUp:ap,LucideTrendingUpDown:GQ,LucideTriangle:ZQ,LucideTriangleAlert:Xh,LucideTriangleRight:KQ,LucideTrophy:Yi,LucideTruck:fA,LucideTurtle:YQ,LucideTv:QQ,LucideTv2:ww,LucideTvMinimal:ww,LucideTvMinimalPlay:XQ,LucideTwitch:JQ,LucideTwitter:eJ,LucideType:rJ,LucideTypeOutline:tJ,LucideUmbrella:sJ,LucideUmbrellaOff:nJ,LucideUnderline:aJ,LucideUndo:CS,LucideUndo2:iJ,LucideUndoDot:oJ,LucideUnfoldHorizontal:lJ,LucideUnfoldVertical:cJ,LucideUngroup:dJ,LucideUniversity:jw,LucideUnlink:pA,LucideUnlink2:uJ,LucideUnlock:Q2,LucideUnlockKeyhole:X2,LucideUnplug:hJ,LucideUpload:ho,LucideUploadCloud:N2,LucideUsb:fJ,LucideUser:ac,LucideUser2:Tw,LucideUserCheck:Pj,LucideUserCheck2:kw,LucideUserCircle:b2,LucideUserCircle2:_2,LucideUserCog:mA,LucideUserCog2:Nw,LucideUserMinus:pJ,LucideUserMinus2:Sw,LucideUserPen:mJ,LucideUserPlus:hf,LucideUserPlus2:Cw,LucideUserRound:Tw,LucideUserRoundCheck:kw,LucideUserRoundCog:Nw,LucideUserRoundMinus:Sw,LucideUserRoundPen:gJ,LucideUserRoundPlus:Cw,LucideUserRoundSearch:xJ,LucideUserRoundX:Mw,LucideUserSearch:yJ,LucideUserSquare:gw,LucideUserSquare2:mw,LucideUserX:vJ,LucideUserX2:Mw,LucideUsers:Bn,LucideUsers2:Aw,LucideUsersRound:Aw,LucideUtensils:Iw,LucideUtensilsCrossed:Ew,LucideUtilityPole:_J,LucideVariable:gA,LucideVault:bJ,LucideVegan:wJ,LucideVenetianMask:jJ,LucideVerified:P_,LucideVibrate:NJ,LucideVibrateOff:kJ,LucideVideo:Da,LucideVideoOff:SJ,LucideVideotape:CJ,LucideView:MJ,LucideVoicemail:TJ,LucideVolleyball:AJ,LucideVolume:OJ,LucideVolume1:EJ,LucideVolume2:IJ,LucideVolumeOff:PJ,LucideVolumeX:LJ,LucideVote:DJ,LucideWallet:FJ,LucideWallet2:Pw,LucideWalletCards:RJ,LucideWalletMinimal:Pw,LucideWallpaper:zJ,LucideWand:BJ,LucideWand2:Lw,LucideWandSparkles:Lw,LucideWarehouse:$J,LucideWashingMachine:UJ,LucideWatch:qJ,LucideWaves:VJ,LucideWaypoints:HJ,LucideWebcam:WJ,LucideWebhook:KJ,LucideWebhookOff:GJ,LucideWeight:ZJ,LucideWheat:XJ,LucideWheatOff:YJ,LucideWholeWord:QJ,LucideWifi:nee,LucideWifiHigh:JJ,LucideWifiLow:eee,LucideWifiOff:tee,LucideWifiZero:ree,LucideWind:aee,LucideWindArrowDown:see,LucideWine:oee,LucideWineOff:iee,LucideWorkflow:lee,LucideWorm:cee,LucideWrapText:dee,LucideWrench:ay,LucideX:gs,LucideXCircle:Lc,LucideXOctagon:nb,LucideXSquare:xw,LucideYoutube:uee,LucideZap:Ig,LucideZapOff:hee,LucideZoomIn:MS,LucideZoomOut:TS,Luggage:JV,LuggageIcon:JV,MSquare:Xb,MSquareIcon:Xb,Magnet:eH,MagnetIcon:eH,Mail:ws,MailCheck:tH,MailCheckIcon:tH,MailIcon:ws,MailMinus:rH,MailMinusIcon:rH,MailOpen:nH,MailOpenIcon:nH,MailPlus:sH,MailPlusIcon:sH,MailQuestion:aH,MailQuestionIcon:aH,MailSearch:iH,MailSearchIcon:iH,MailWarning:oH,MailWarningIcon:oH,MailX:ZT,MailXIcon:ZT,Mailbox:lH,MailboxIcon:lH,Mails:cH,MailsIcon:cH,Map:bH,MapIcon:bH,MapPin:To,MapPinCheck:uH,MapPinCheckIcon:uH,MapPinCheckInside:dH,MapPinCheckInsideIcon:dH,MapPinHouse:hH,MapPinHouseIcon:hH,MapPinIcon:To,MapPinMinus:pH,MapPinMinusIcon:pH,MapPinMinusInside:fH,MapPinMinusInsideIcon:fH,MapPinOff:mH,MapPinOffIcon:mH,MapPinPlus:xH,MapPinPlusIcon:xH,MapPinPlusInside:gH,MapPinPlusInsideIcon:gH,MapPinX:vH,MapPinXIcon:vH,MapPinXInside:yH,MapPinXInsideIcon:yH,MapPinned:_H,MapPinnedIcon:_H,Martini:wH,MartiniIcon:wH,Maximize:kH,Maximize2:jH,Maximize2Icon:jH,MaximizeIcon:kH,Medal:ry,MedalIcon:ry,Megaphone:jm,MegaphoneIcon:jm,MegaphoneOff:NH,MegaphoneOffIcon:NH,Meh:SH,MehIcon:SH,MemoryStick:CH,MemoryStickIcon:CH,Menu:YT,MenuIcon:YT,MenuSquare:Qb,MenuSquareIcon:Qb,Merge:MH,MergeIcon:MH,MessageCircle:Bl,MessageCircleCode:TH,MessageCircleCodeIcon:TH,MessageCircleDashed:AH,MessageCircleDashedIcon:AH,MessageCircleHeart:wS,MessageCircleHeartIcon:wS,MessageCircleIcon:Bl,MessageCircleMore:EH,MessageCircleMoreIcon:EH,MessageCircleOff:IH,MessageCircleOffIcon:IH,MessageCirclePlus:PH,MessageCirclePlusIcon:PH,MessageCircleQuestion:XT,MessageCircleQuestionIcon:XT,MessageCircleReply:LH,MessageCircleReplyIcon:LH,MessageCircleWarning:OH,MessageCircleWarningIcon:OH,MessageCircleX:DH,MessageCircleXIcon:DH,MessageSquare:Do,MessageSquareCode:RH,MessageSquareCodeIcon:RH,MessageSquareDashed:FH,MessageSquareDashedIcon:FH,MessageSquareDiff:zH,MessageSquareDiffIcon:zH,MessageSquareDot:BH,MessageSquareDotIcon:BH,MessageSquareHeart:$H,MessageSquareHeartIcon:$H,MessageSquareIcon:Do,MessageSquareLock:UH,MessageSquareLockIcon:UH,MessageSquareMore:qH,MessageSquareMoreIcon:qH,MessageSquareOff:VH,MessageSquareOffIcon:VH,MessageSquarePlus:HH,MessageSquarePlusIcon:HH,MessageSquareQuote:QT,MessageSquareQuoteIcon:QT,MessageSquareReply:WH,MessageSquareReplyIcon:WH,MessageSquareShare:GH,MessageSquareShareIcon:GH,MessageSquareText:KH,MessageSquareTextIcon:KH,MessageSquareWarning:ZH,MessageSquareWarningIcon:ZH,MessageSquareX:YH,MessageSquareXIcon:YH,MessagesSquare:XH,MessagesSquareIcon:XH,Mic:JT,Mic2:J2,Mic2Icon:J2,MicIcon:JT,MicOff:QH,MicOffIcon:QH,MicVocal:J2,MicVocalIcon:J2,Microchip:JH,MicrochipIcon:JH,Microscope:eW,MicroscopeIcon:eW,Microwave:tW,MicrowaveIcon:tW,Milestone:rW,MilestoneIcon:rW,Milk:sW,MilkIcon:sW,MilkOff:nW,MilkOffIcon:nW,Minimize:iW,Minimize2:aW,Minimize2Icon:aW,MinimizeIcon:iW,Minus:F1,MinusCircle:u2,MinusCircleIcon:u2,MinusIcon:F1,MinusSquare:Jb,MinusSquareIcon:Jb,Monitor:Mj,MonitorCheck:oW,MonitorCheckIcon:oW,MonitorCog:lW,MonitorCogIcon:lW,MonitorDot:cW,MonitorDotIcon:cW,MonitorDown:dW,MonitorDownIcon:dW,MonitorIcon:Mj,MonitorOff:uW,MonitorOffIcon:uW,MonitorPause:hW,MonitorPauseIcon:hW,MonitorPlay:fW,MonitorPlayIcon:fW,MonitorSmartphone:pW,MonitorSmartphoneIcon:pW,MonitorSpeaker:mW,MonitorSpeakerIcon:mW,MonitorStop:gW,MonitorStopIcon:gW,MonitorUp:xW,MonitorUpIcon:xW,MonitorX:yW,MonitorXIcon:yW,Moon:_W,MoonIcon:_W,MoonStar:vW,MoonStarIcon:vW,MoreHorizontal:lm,MoreHorizontalIcon:lm,MoreVertical:Rx,MoreVerticalIcon:Rx,Mountain:wW,MountainIcon:wW,MountainSnow:bW,MountainSnowIcon:bW,Mouse:CW,MouseIcon:CW,MouseOff:jW,MouseOffIcon:jW,MousePointer:SW,MousePointer2:kW,MousePointer2Icon:kW,MousePointerBan:NW,MousePointerBanIcon:NW,MousePointerClick:Tj,MousePointerClickIcon:Tj,MousePointerIcon:SW,MousePointerSquareDashed:qb,MousePointerSquareDashedIcon:qb,Move:BW,Move3D:eb,Move3DIcon:eb,Move3d:eb,Move3dIcon:eb,MoveDiagonal:TW,MoveDiagonal2:MW,MoveDiagonal2Icon:MW,MoveDiagonalIcon:TW,MoveDown:IW,MoveDownIcon:IW,MoveDownLeft:AW,MoveDownLeftIcon:AW,MoveDownRight:EW,MoveDownRightIcon:EW,MoveHorizontal:PW,MoveHorizontalIcon:PW,MoveIcon:BW,MoveLeft:LW,MoveLeftIcon:LW,MoveRight:OW,MoveRightIcon:OW,MoveUp:FW,MoveUpIcon:FW,MoveUpLeft:DW,MoveUpLeftIcon:DW,MoveUpRight:RW,MoveUpRightIcon:RW,MoveVertical:zW,MoveVerticalIcon:zW,Music:VW,Music2:$W,Music2Icon:$W,Music3:UW,Music3Icon:UW,Music4:qW,Music4Icon:qW,MusicIcon:VW,Navigation:eA,Navigation2:WW,Navigation2Icon:WW,Navigation2Off:HW,Navigation2OffIcon:HW,NavigationIcon:eA,NavigationOff:GW,NavigationOffIcon:GW,Network:KW,NetworkIcon:KW,Newspaper:ny,NewspaperIcon:ny,Nfc:ZW,NfcIcon:ZW,Notebook:JW,NotebookIcon:JW,NotebookPen:YW,NotebookPenIcon:YW,NotebookTabs:XW,NotebookTabsIcon:XW,NotebookText:QW,NotebookTextIcon:QW,NotepadText:tG,NotepadTextDashed:eG,NotepadTextDashedIcon:eG,NotepadTextIcon:tG,Nut:nG,NutIcon:nG,NutOff:rG,NutOffIcon:rG,Octagon:aG,OctagonAlert:tb,OctagonAlertIcon:tb,OctagonIcon:aG,OctagonMinus:sG,OctagonMinusIcon:sG,OctagonPause:rb,OctagonPauseIcon:rb,OctagonX:nb,OctagonXIcon:nb,Omega:iG,OmegaIcon:iG,Option:oG,OptionIcon:oG,Orbit:lG,OrbitIcon:lG,Origami:cG,OrigamiIcon:cG,Outdent:K2,OutdentIcon:K2,Package:$l,Package2:dG,Package2Icon:dG,PackageCheck:uG,PackageCheckIcon:uG,PackageIcon:$l,PackageMinus:hG,PackageMinusIcon:hG,PackageOpen:fG,PackageOpenIcon:fG,PackagePlus:pG,PackagePlusIcon:pG,PackageSearch:mG,PackageSearchIcon:mG,PackageX:gG,PackageXIcon:gG,PaintBucket:xG,PaintBucketIcon:xG,PaintRoller:yG,PaintRollerIcon:yG,Paintbrush:vG,Paintbrush2:sb,Paintbrush2Icon:sb,PaintbrushIcon:vG,PaintbrushVertical:sb,PaintbrushVerticalIcon:sb,Palette:Rc,PaletteIcon:Rc,Palmtree:bw,PalmtreeIcon:bw,PanelBottom:wG,PanelBottomClose:_G,PanelBottomCloseIcon:_G,PanelBottomDashed:ab,PanelBottomDashedIcon:ab,PanelBottomIcon:wG,PanelBottomInactive:ab,PanelBottomInactiveIcon:ab,PanelBottomOpen:bG,PanelBottomOpenIcon:bG,PanelLeft:cb,PanelLeftClose:ib,PanelLeftCloseIcon:ib,PanelLeftDashed:ob,PanelLeftDashedIcon:ob,PanelLeftIcon:cb,PanelLeftInactive:ob,PanelLeftInactiveIcon:ob,PanelLeftOpen:lb,PanelLeftOpenIcon:lb,PanelRight:NG,PanelRightClose:jG,PanelRightCloseIcon:jG,PanelRightDashed:db,PanelRightDashedIcon:db,PanelRightIcon:NG,PanelRightInactive:db,PanelRightInactiveIcon:db,PanelRightOpen:kG,PanelRightOpenIcon:kG,PanelTop:MG,PanelTopClose:SG,PanelTopCloseIcon:SG,PanelTopDashed:ub,PanelTopDashedIcon:ub,PanelTopIcon:MG,PanelTopInactive:ub,PanelTopInactiveIcon:ub,PanelTopOpen:CG,PanelTopOpenIcon:CG,PanelsLeftBottom:TG,PanelsLeftBottomIcon:TG,PanelsLeftRight:M2,PanelsLeftRightIcon:M2,PanelsRightBottom:AG,PanelsRightBottomIcon:AG,PanelsTopBottom:gb,PanelsTopBottomIcon:gb,PanelsTopLeft:O0,PanelsTopLeftIcon:O0,Paperclip:EG,PaperclipIcon:EG,Parentheses:IG,ParenthesesIcon:IG,ParkingCircle:f2,ParkingCircleIcon:f2,ParkingCircleOff:h2,ParkingCircleOffIcon:h2,ParkingMeter:PG,ParkingMeterIcon:PG,ParkingSquare:rw,ParkingSquareIcon:rw,ParkingSquareOff:tw,ParkingSquareOffIcon:tw,PartyPopper:Fc,PartyPopperIcon:Fc,Pause:sp,PauseCircle:p2,PauseCircleIcon:p2,PauseIcon:sp,PauseOctagon:rb,PauseOctagonIcon:rb,PawPrint:LG,PawPrintIcon:LG,PcCase:OG,PcCaseIcon:OG,Pen:R0,PenBox:hc,PenBoxIcon:hc,PenIcon:R0,PenLine:D0,PenLineIcon:D0,PenOff:DG,PenOffIcon:DG,PenSquare:hc,PenSquareIcon:hc,PenTool:Aj,PenToolIcon:Aj,Pencil:ni,PencilIcon:ni,PencilLine:RG,PencilLineIcon:RG,PencilOff:FG,PencilOffIcon:FG,PencilRuler:zG,PencilRulerIcon:zG,Pentagon:BG,PentagonIcon:BG,Percent:jS,PercentCircle:m2,PercentCircleIcon:m2,PercentDiamond:A2,PercentDiamondIcon:A2,PercentIcon:jS,PercentSquare:nw,PercentSquareIcon:nw,PersonStanding:$G,PersonStandingIcon:$G,PhilippinePeso:UG,PhilippinePesoIcon:UG,Phone:ji,PhoneCall:qG,PhoneCallIcon:qG,PhoneForwarded:VG,PhoneForwardedIcon:VG,PhoneIcon:ji,PhoneIncoming:HG,PhoneIncomingIcon:HG,PhoneMissed:WG,PhoneMissedIcon:WG,PhoneOff:GG,PhoneOffIcon:GG,PhoneOutgoing:KG,PhoneOutgoingIcon:KG,Pi:ZG,PiIcon:ZG,PiSquare:sw,PiSquareIcon:sw,Piano:YG,PianoIcon:YG,Pickaxe:XG,PickaxeIcon:XG,PictureInPicture:JG,PictureInPicture2:QG,PictureInPicture2Icon:QG,PictureInPictureIcon:JG,PieChart:Z_,PieChartIcon:Z_,PiggyBank:eK,PiggyBankIcon:eK,Pilcrow:nK,PilcrowIcon:nK,PilcrowLeft:tK,PilcrowLeftIcon:tK,PilcrowRight:rK,PilcrowRightIcon:rK,PilcrowSquare:aw,PilcrowSquareIcon:aw,Pill:aK,PillBottle:sK,PillBottleIcon:sK,PillIcon:aK,Pin:z1,PinIcon:z1,PinOff:tA,PinOffIcon:tA,Pipette:iK,PipetteIcon:iK,Pizza:oK,PizzaIcon:oK,Plane:dK,PlaneIcon:dK,PlaneLanding:lK,PlaneLandingIcon:lK,PlaneTakeoff:cK,PlaneTakeoffIcon:cK,Play:Ul,PlayCircle:Gf,PlayCircleIcon:Gf,PlayIcon:Ul,PlaySquare:iw,PlaySquareIcon:iw,Plug:rA,Plug2:uK,Plug2Icon:uK,PlugIcon:rA,PlugZap:hb,PlugZap2:hb,PlugZap2Icon:hb,PlugZapIcon:hb,Plus:_n,PlusCircle:g2,PlusCircleIcon:g2,PlusIcon:_n,PlusSquare:ow,PlusSquareIcon:ow,Pocket:fK,PocketIcon:fK,PocketKnife:hK,PocketKnifeIcon:hK,Podcast:pK,PodcastIcon:pK,Pointer:gK,PointerIcon:gK,PointerOff:mK,PointerOffIcon:mK,Popcorn:xK,PopcornIcon:xK,Popsicle:yK,PopsicleIcon:yK,PoundSterling:vK,PoundSterlingIcon:vK,Power:bK,PowerCircle:x2,PowerCircleIcon:x2,PowerIcon:bK,PowerOff:_K,PowerOffIcon:_K,PowerSquare:lw,PowerSquareIcon:lw,Presentation:wK,PresentationIcon:wK,Printer:kK,PrinterCheck:jK,PrinterCheckIcon:jK,PrinterIcon:kK,Projector:NK,ProjectorIcon:NK,Proportions:SK,ProportionsIcon:SK,Puzzle:CK,PuzzleIcon:CK,Pyramid:MK,PyramidIcon:MK,QrCode:nA,QrCodeIcon:nA,Quote:sA,QuoteIcon:sA,Rabbit:TK,RabbitIcon:TK,Radar:AK,RadarIcon:AK,Radiation:EK,RadiationIcon:EK,Radical:IK,RadicalIcon:IK,Radio:Ej,RadioIcon:Ej,RadioReceiver:PK,RadioReceiverIcon:PK,RadioTower:LK,RadioTowerIcon:LK,Radius:OK,RadiusIcon:OK,RailSymbol:DK,RailSymbolIcon:DK,Rainbow:RK,RainbowIcon:RK,Rat:FK,RatIcon:FK,Ratio:zK,RatioIcon:zK,Receipt:KK,ReceiptCent:BK,ReceiptCentIcon:BK,ReceiptEuro:$K,ReceiptEuroIcon:$K,ReceiptIcon:KK,ReceiptIndianRupee:UK,ReceiptIndianRupeeIcon:UK,ReceiptJapaneseYen:qK,ReceiptJapaneseYenIcon:qK,ReceiptPoundSterling:VK,ReceiptPoundSterlingIcon:VK,ReceiptRussianRuble:HK,ReceiptRussianRubleIcon:HK,ReceiptSwissFranc:WK,ReceiptSwissFrancIcon:WK,ReceiptText:GK,ReceiptTextIcon:GK,RectangleEllipsis:fb,RectangleEllipsisIcon:fb,RectangleHorizontal:ZK,RectangleHorizontalIcon:ZK,RectangleVertical:YK,RectangleVerticalIcon:YK,Recycle:XK,RecycleIcon:XK,Redo:kS,Redo2:QK,Redo2Icon:QK,RedoDot:JK,RedoDotIcon:JK,RedoIcon:kS,RefreshCcw:tZ,RefreshCcwDot:eZ,RefreshCcwDotIcon:eZ,RefreshCcwIcon:tZ,RefreshCw:Ll,RefreshCwIcon:Ll,RefreshCwOff:rZ,RefreshCwOffIcon:rZ,Refrigerator:nZ,RefrigeratorIcon:nZ,Regex:sZ,RegexIcon:sZ,RemoveFormatting:aZ,RemoveFormattingIcon:aZ,Repeat:aA,Repeat1:iZ,Repeat1Icon:iZ,Repeat2:oZ,Repeat2Icon:oZ,RepeatIcon:aA,Replace:cZ,ReplaceAll:lZ,ReplaceAllIcon:lZ,ReplaceIcon:cZ,Reply:iA,ReplyAll:dZ,ReplyAllIcon:dZ,ReplyIcon:iA,Rewind:uZ,RewindIcon:uZ,Ribbon:hZ,RibbonIcon:hZ,Rocket:Cg,RocketIcon:Cg,RockingChair:fZ,RockingChairIcon:fZ,RollerCoaster:pZ,RollerCoasterIcon:pZ,Rotate3D:pb,Rotate3DIcon:pb,Rotate3d:pb,Rotate3dIcon:pb,RotateCcw:NS,RotateCcwIcon:NS,RotateCcwSquare:mZ,RotateCcwSquareIcon:mZ,RotateCw:oA,RotateCwIcon:oA,RotateCwSquare:gZ,RotateCwSquareIcon:gZ,Route:yZ,RouteIcon:yZ,RouteOff:xZ,RouteOffIcon:xZ,Router:vZ,RouterIcon:vZ,Rows:mb,Rows2:mb,Rows2Icon:mb,Rows3:gb,Rows3Icon:gb,Rows4:_Z,Rows4Icon:_Z,RowsIcon:mb,Rss:bZ,RssIcon:bZ,Ruler:wZ,RulerIcon:wZ,RussianRuble:jZ,RussianRubleIcon:jZ,Sailboat:kZ,SailboatIcon:kZ,Salad:NZ,SaladIcon:NZ,Sandwich:SZ,SandwichIcon:SZ,Satellite:MZ,SatelliteDish:CZ,SatelliteDishIcon:CZ,SatelliteIcon:MZ,Save:km,SaveAll:TZ,SaveAllIcon:TZ,SaveIcon:km,SaveOff:AZ,SaveOffIcon:AZ,Scale:EZ,Scale3D:xb,Scale3DIcon:xb,Scale3d:xb,Scale3dIcon:xb,ScaleIcon:EZ,Scaling:IZ,ScalingIcon:IZ,Scan:BZ,ScanBarcode:PZ,ScanBarcodeIcon:PZ,ScanEye:LZ,ScanEyeIcon:LZ,ScanFace:OZ,ScanFaceIcon:OZ,ScanIcon:BZ,ScanLine:DZ,ScanLineIcon:DZ,ScanQrCode:RZ,ScanQrCodeIcon:RZ,ScanSearch:FZ,ScanSearchIcon:FZ,ScanText:zZ,ScanTextIcon:zZ,ScatterChart:Y_,ScatterChartIcon:Y_,School:$Z,School2:jw,School2Icon:jw,SchoolIcon:$Z,Scissors:qZ,ScissorsIcon:qZ,ScissorsLineDashed:UZ,ScissorsLineDashedIcon:UZ,ScissorsSquare:cw,ScissorsSquareDashedBottom:Ob,ScissorsSquareDashedBottomIcon:Ob,ScissorsSquareIcon:cw,ScreenShare:HZ,ScreenShareIcon:HZ,ScreenShareOff:VZ,ScreenShareOffIcon:VZ,Scroll:GZ,ScrollIcon:GZ,ScrollText:WZ,ScrollTextIcon:WZ,Search:ya,SearchCheck:KZ,SearchCheckIcon:KZ,SearchCode:ZZ,SearchCodeIcon:ZZ,SearchIcon:ya,SearchSlash:YZ,SearchSlashIcon:YZ,SearchX:XZ,SearchXIcon:XZ,Section:QZ,SectionIcon:QZ,Send:eo,SendHorizonal:yb,SendHorizonalIcon:yb,SendHorizontal:yb,SendHorizontalIcon:yb,SendIcon:eo,SendToBack:JZ,SendToBackIcon:JZ,SeparatorHorizontal:eY,SeparatorHorizontalIcon:eY,SeparatorVertical:tY,SeparatorVerticalIcon:tY,Server:aY,ServerCog:rY,ServerCogIcon:rY,ServerCrash:nY,ServerCrashIcon:nY,ServerIcon:aY,ServerOff:sY,ServerOffIcon:sY,Settings:jd,Settings2:iY,Settings2Icon:iY,SettingsIcon:jd,Shapes:oY,ShapesIcon:oY,Share:lA,Share2:_c,Share2Icon:_c,ShareIcon:lA,Sheet:lY,SheetIcon:lY,Shell:cY,ShellIcon:cY,Shield:uf,ShieldAlert:dY,ShieldAlertIcon:dY,ShieldBan:uY,ShieldBanIcon:uY,ShieldCheck:cA,ShieldCheckIcon:cA,ShieldClose:vb,ShieldCloseIcon:vb,ShieldEllipsis:hY,ShieldEllipsisIcon:hY,ShieldHalf:fY,ShieldHalfIcon:fY,ShieldIcon:uf,ShieldMinus:pY,ShieldMinusIcon:pY,ShieldOff:mY,ShieldOffIcon:mY,ShieldPlus:gY,ShieldPlusIcon:gY,ShieldQuestion:xY,ShieldQuestionIcon:xY,ShieldX:vb,ShieldXIcon:vb,Ship:vY,ShipIcon:vY,ShipWheel:yY,ShipWheelIcon:yY,Shirt:_Y,ShirtIcon:_Y,ShoppingBag:Mg,ShoppingBagIcon:Mg,ShoppingBasket:bY,ShoppingBasketIcon:bY,ShoppingCart:_h,ShoppingCartIcon:_h,Shovel:wY,ShovelIcon:wY,ShowerHead:jY,ShowerHeadIcon:jY,Shrink:kY,ShrinkIcon:kY,Shrub:NY,ShrubIcon:NY,Shuffle:SY,ShuffleIcon:SY,Sidebar:cb,SidebarClose:ib,SidebarCloseIcon:ib,SidebarIcon:cb,SidebarOpen:lb,SidebarOpenIcon:lb,Sigma:CY,SigmaIcon:CY,SigmaSquare:dw,SigmaSquareIcon:dw,Signal:IY,SignalHigh:MY,SignalHighIcon:MY,SignalIcon:IY,SignalLow:TY,SignalLowIcon:TY,SignalMedium:AY,SignalMediumIcon:AY,SignalZero:EY,SignalZeroIcon:EY,Signature:PY,SignatureIcon:PY,Signpost:OY,SignpostBig:LY,SignpostBigIcon:LY,SignpostIcon:OY,Siren:DY,SirenIcon:DY,SkipBack:RY,SkipBackIcon:RY,SkipForward:FY,SkipForwardIcon:FY,Skull:zY,SkullIcon:zY,Slack:BY,SlackIcon:BY,Slash:$Y,SlashIcon:$Y,SlashSquare:uw,SlashSquareIcon:uw,Slice:UY,SliceIcon:UY,Sliders:_b,SlidersHorizontal:dA,SlidersHorizontalIcon:dA,SlidersIcon:_b,SlidersVertical:_b,SlidersVerticalIcon:_b,Smartphone:Tg,SmartphoneCharging:qY,SmartphoneChargingIcon:qY,SmartphoneIcon:Tg,SmartphoneNfc:VY,SmartphoneNfcIcon:VY,Smile:WY,SmileIcon:WY,SmilePlus:HY,SmilePlusIcon:HY,Snail:GY,SnailIcon:GY,Snowflake:h1,SnowflakeIcon:h1,Sofa:KY,SofaIcon:KY,SortAsc:A_,SortAscIcon:A_,SortDesc:C_,SortDescIcon:C_,Soup:ZY,SoupIcon:ZY,Space:YY,SpaceIcon:YY,Spade:XY,SpadeIcon:XY,Sparkle:QY,SparkleIcon:QY,Sparkles:As,SparklesIcon:As,Speaker:JY,SpeakerIcon:JY,Speech:eX,SpeechIcon:eX,SpellCheck:rX,SpellCheck2:tX,SpellCheck2Icon:tX,SpellCheckIcon:rX,Spline:nX,SplineIcon:nX,Split:sX,SplitIcon:sX,SplitSquareHorizontal:hw,SplitSquareHorizontalIcon:hw,SplitSquareVertical:fw,SplitSquareVerticalIcon:fw,SprayCan:aX,SprayCanIcon:aX,Sprout:iX,SproutIcon:iX,Square:Ag,SquareActivity:bb,SquareActivityIcon:bb,SquareArrowDown:kb,SquareArrowDownIcon:kb,SquareArrowDownLeft:wb,SquareArrowDownLeftIcon:wb,SquareArrowDownRight:jb,SquareArrowDownRightIcon:jb,SquareArrowLeft:Nb,SquareArrowLeftIcon:Nb,SquareArrowOutDownLeft:Sb,SquareArrowOutDownLeftIcon:Sb,SquareArrowOutDownRight:Cb,SquareArrowOutDownRightIcon:Cb,SquareArrowOutUpLeft:Mb,SquareArrowOutUpLeftIcon:Mb,SquareArrowOutUpRight:Tb,SquareArrowOutUpRightIcon:Tb,SquareArrowRight:Ab,SquareArrowRightIcon:Ab,SquareArrowUp:Pb,SquareArrowUpIcon:Pb,SquareArrowUpLeft:Eb,SquareArrowUpLeftIcon:Eb,SquareArrowUpRight:Ib,SquareArrowUpRightIcon:Ib,SquareAsterisk:Lb,SquareAsteriskIcon:Lb,SquareBottomDashedScissors:Ob,SquareBottomDashedScissorsIcon:Ob,SquareChartGantt:sg,SquareChartGanttIcon:sg,SquareCheck:Db,SquareCheckBig:F0,SquareCheckBigIcon:F0,SquareCheckIcon:Db,SquareChevronDown:Rb,SquareChevronDownIcon:Rb,SquareChevronLeft:Fb,SquareChevronLeftIcon:Fb,SquareChevronRight:zb,SquareChevronRightIcon:zb,SquareChevronUp:Bb,SquareChevronUpIcon:Bb,SquareCode:$b,SquareCodeIcon:$b,SquareDashed:Vb,SquareDashedBottom:lX,SquareDashedBottomCode:oX,SquareDashedBottomCodeIcon:oX,SquareDashedBottomIcon:lX,SquareDashedIcon:Vb,SquareDashedKanban:Ub,SquareDashedKanbanIcon:Ub,SquareDashedMousePointer:qb,SquareDashedMousePointerIcon:qb,SquareDivide:Hb,SquareDivideIcon:Hb,SquareDot:Wb,SquareDotIcon:Wb,SquareEqual:Gb,SquareEqualIcon:Gb,SquareFunction:Kb,SquareFunctionIcon:Kb,SquareGanttChart:sg,SquareGanttChartIcon:sg,SquareIcon:Ag,SquareKanban:Zb,SquareKanbanIcon:Zb,SquareLibrary:Yb,SquareLibraryIcon:Yb,SquareM:Xb,SquareMIcon:Xb,SquareMenu:Qb,SquareMenuIcon:Qb,SquareMinus:Jb,SquareMinusIcon:Jb,SquareMousePointer:ew,SquareMousePointerIcon:ew,SquareParking:rw,SquareParkingIcon:rw,SquareParkingOff:tw,SquareParkingOffIcon:tw,SquarePen:hc,SquarePenIcon:hc,SquarePercent:nw,SquarePercentIcon:nw,SquarePi:sw,SquarePiIcon:sw,SquarePilcrow:aw,SquarePilcrowIcon:aw,SquarePlay:iw,SquarePlayIcon:iw,SquarePlus:ow,SquarePlusIcon:ow,SquarePower:lw,SquarePowerIcon:lw,SquareRadical:cX,SquareRadicalIcon:cX,SquareScissors:cw,SquareScissorsIcon:cw,SquareSigma:dw,SquareSigmaIcon:dw,SquareSlash:uw,SquareSlashIcon:uw,SquareSplitHorizontal:hw,SquareSplitHorizontalIcon:hw,SquareSplitVertical:fw,SquareSplitVerticalIcon:fw,SquareSquare:dX,SquareSquareIcon:dX,SquareStack:uX,SquareStackIcon:uX,SquareTerminal:pw,SquareTerminalIcon:pw,SquareUser:gw,SquareUserIcon:gw,SquareUserRound:mw,SquareUserRoundIcon:mw,SquareX:xw,SquareXIcon:xw,Squircle:hX,SquircleIcon:hX,Squirrel:fX,SquirrelIcon:fX,Stamp:pX,StampIcon:pX,Star:_s,StarHalf:mX,StarHalfIcon:mX,StarIcon:_s,StarOff:gX,StarOffIcon:gX,Stars:As,StarsIcon:As,StepBack:xX,StepBackIcon:xX,StepForward:yX,StepForwardIcon:yX,Stethoscope:vX,StethoscopeIcon:vX,Sticker:_X,StickerIcon:_X,StickyNote:bX,StickyNoteIcon:bX,StopCircle:v2,StopCircleIcon:v2,Store:wX,StoreIcon:wX,StretchHorizontal:jX,StretchHorizontalIcon:jX,StretchVertical:kX,StretchVerticalIcon:kX,Strikethrough:NX,StrikethroughIcon:NX,Subscript:SX,SubscriptIcon:SX,Subtitles:F_,SubtitlesIcon:F_,Sun:B1,SunDim:CX,SunDimIcon:CX,SunIcon:B1,SunMedium:MX,SunMediumIcon:MX,SunMoon:TX,SunMoonIcon:TX,SunSnow:AX,SunSnowIcon:AX,Sunrise:EX,SunriseIcon:EX,Sunset:IX,SunsetIcon:IX,Superscript:PX,SuperscriptIcon:PX,SwatchBook:LX,SwatchBookIcon:LX,SwissFranc:OX,SwissFrancIcon:OX,SwitchCamera:DX,SwitchCameraIcon:DX,Sword:RX,SwordIcon:RX,Swords:FX,SwordsIcon:FX,Syringe:zX,SyringeIcon:zX,Table:WX,Table2:SS,Table2Icon:SS,TableCellsMerge:BX,TableCellsMergeIcon:BX,TableCellsSplit:$X,TableCellsSplitIcon:$X,TableColumnsSplit:UX,TableColumnsSplitIcon:UX,TableIcon:WX,TableOfContents:qX,TableOfContentsIcon:qX,TableProperties:VX,TablePropertiesIcon:VX,TableRowsSplit:HX,TableRowsSplitIcon:HX,Tablet:KX,TabletIcon:KX,TabletSmartphone:GX,TabletSmartphoneIcon:GX,Tablets:ZX,TabletsIcon:ZX,Tag:Eg,TagIcon:Eg,Tags:YX,TagsIcon:YX,Tally1:XX,Tally1Icon:XX,Tally2:QX,Tally2Icon:QX,Tally3:JX,Tally3Icon:JX,Tally4:eQ,Tally4Icon:eQ,Tally5:tQ,Tally5Icon:tQ,Tangent:rQ,TangentIcon:rQ,Target:sy,TargetIcon:sy,Telescope:nQ,TelescopeIcon:nQ,Tent:aQ,TentIcon:aQ,TentTree:sQ,TentTreeIcon:sQ,Terminal:iQ,TerminalIcon:iQ,TerminalSquare:pw,TerminalSquareIcon:pw,TestTube:oQ,TestTube2:yw,TestTube2Icon:yw,TestTubeDiagonal:yw,TestTubeDiagonalIcon:yw,TestTubeIcon:oQ,TestTubes:lQ,TestTubesIcon:lQ,Text:fQ,TextCursor:dQ,TextCursorIcon:dQ,TextCursorInput:cQ,TextCursorInputIcon:cQ,TextIcon:fQ,TextQuote:uQ,TextQuoteIcon:uQ,TextSearch:hQ,TextSearchIcon:hQ,TextSelect:vw,TextSelectIcon:vw,TextSelection:vw,TextSelectionIcon:vw,Theater:pQ,TheaterIcon:pQ,Thermometer:xQ,ThermometerIcon:xQ,ThermometerSnowflake:mQ,ThermometerSnowflakeIcon:mQ,ThermometerSun:gQ,ThermometerSunIcon:gQ,ThumbsDown:uA,ThumbsDownIcon:uA,ThumbsUp:kd,ThumbsUpIcon:kd,Ticket:hA,TicketCheck:yQ,TicketCheckIcon:yQ,TicketIcon:hA,TicketMinus:vQ,TicketMinusIcon:vQ,TicketPercent:_Q,TicketPercentIcon:_Q,TicketPlus:bQ,TicketPlusIcon:bQ,TicketSlash:wQ,TicketSlashIcon:wQ,TicketX:jQ,TicketXIcon:jQ,Tickets:NQ,TicketsIcon:NQ,TicketsPlane:kQ,TicketsPlaneIcon:kQ,Timer:MQ,TimerIcon:MQ,TimerOff:SQ,TimerOffIcon:SQ,TimerReset:CQ,TimerResetIcon:CQ,ToggleLeft:TQ,ToggleLeftIcon:TQ,ToggleRight:AQ,ToggleRightIcon:AQ,Toilet:EQ,ToiletIcon:EQ,Tornado:IQ,TornadoIcon:IQ,Torus:PQ,TorusIcon:PQ,Touchpad:OQ,TouchpadIcon:OQ,TouchpadOff:LQ,TouchpadOffIcon:LQ,TowerControl:DQ,TowerControlIcon:DQ,ToyBrick:RQ,ToyBrickIcon:RQ,Tractor:FQ,TractorIcon:FQ,TrafficCone:zQ,TrafficConeIcon:zQ,Train:_w,TrainFront:$Q,TrainFrontIcon:$Q,TrainFrontTunnel:BQ,TrainFrontTunnelIcon:BQ,TrainIcon:_w,TrainTrack:UQ,TrainTrackIcon:UQ,TramFront:_w,TramFrontIcon:_w,Trash:qQ,Trash2:$n,Trash2Icon:$n,TrashIcon:qQ,TreeDeciduous:VQ,TreeDeciduousIcon:VQ,TreePalm:bw,TreePalmIcon:bw,TreePine:$1,TreePineIcon:$1,Trees:HQ,TreesIcon:HQ,Trello:WQ,TrelloIcon:WQ,TrendingDown:Ij,TrendingDownIcon:Ij,TrendingUp:ap,TrendingUpDown:GQ,TrendingUpDownIcon:GQ,TrendingUpIcon:ap,Triangle:ZQ,TriangleAlert:Xh,TriangleAlertIcon:Xh,TriangleIcon:ZQ,TriangleRight:KQ,TriangleRightIcon:KQ,Trophy:Yi,TrophyIcon:Yi,Truck:fA,TruckIcon:fA,Turtle:YQ,TurtleIcon:YQ,Tv:QQ,Tv2:ww,Tv2Icon:ww,TvIcon:QQ,TvMinimal:ww,TvMinimalIcon:ww,TvMinimalPlay:XQ,TvMinimalPlayIcon:XQ,Twitch:JQ,TwitchIcon:JQ,Twitter:eJ,TwitterIcon:eJ,Type:rJ,TypeIcon:rJ,TypeOutline:tJ,TypeOutlineIcon:tJ,Umbrella:sJ,UmbrellaIcon:sJ,UmbrellaOff:nJ,UmbrellaOffIcon:nJ,Underline:aJ,UnderlineIcon:aJ,Undo:CS,Undo2:iJ,Undo2Icon:iJ,UndoDot:oJ,UndoDotIcon:oJ,UndoIcon:CS,UnfoldHorizontal:lJ,UnfoldHorizontalIcon:lJ,UnfoldVertical:cJ,UnfoldVerticalIcon:cJ,Ungroup:dJ,UngroupIcon:dJ,University:jw,UniversityIcon:jw,Unlink:pA,Unlink2:uJ,Unlink2Icon:uJ,UnlinkIcon:pA,Unlock:Q2,UnlockIcon:Q2,UnlockKeyhole:X2,UnlockKeyholeIcon:X2,Unplug:hJ,UnplugIcon:hJ,Upload:ho,UploadCloud:N2,UploadCloudIcon:N2,UploadIcon:ho,Usb:fJ,UsbIcon:fJ,User:ac,User2:Tw,User2Icon:Tw,UserCheck:Pj,UserCheck2:kw,UserCheck2Icon:kw,UserCheckIcon:Pj,UserCircle:b2,UserCircle2:_2,UserCircle2Icon:_2,UserCircleIcon:b2,UserCog:mA,UserCog2:Nw,UserCog2Icon:Nw,UserCogIcon:mA,UserIcon:ac,UserMinus:pJ,UserMinus2:Sw,UserMinus2Icon:Sw,UserMinusIcon:pJ,UserPen:mJ,UserPenIcon:mJ,UserPlus:hf,UserPlus2:Cw,UserPlus2Icon:Cw,UserPlusIcon:hf,UserRound:Tw,UserRoundCheck:kw,UserRoundCheckIcon:kw,UserRoundCog:Nw,UserRoundCogIcon:Nw,UserRoundIcon:Tw,UserRoundMinus:Sw,UserRoundMinusIcon:Sw,UserRoundPen:gJ,UserRoundPenIcon:gJ,UserRoundPlus:Cw,UserRoundPlusIcon:Cw,UserRoundSearch:xJ,UserRoundSearchIcon:xJ,UserRoundX:Mw,UserRoundXIcon:Mw,UserSearch:yJ,UserSearchIcon:yJ,UserSquare:gw,UserSquare2:mw,UserSquare2Icon:mw,UserSquareIcon:gw,UserX:vJ,UserX2:Mw,UserX2Icon:Mw,UserXIcon:vJ,Users:Bn,Users2:Aw,Users2Icon:Aw,UsersIcon:Bn,UsersRound:Aw,UsersRoundIcon:Aw,Utensils:Iw,UtensilsCrossed:Ew,UtensilsCrossedIcon:Ew,UtensilsIcon:Iw,UtilityPole:_J,UtilityPoleIcon:_J,Variable:gA,VariableIcon:gA,Vault:bJ,VaultIcon:bJ,Vegan:wJ,VeganIcon:wJ,VenetianMask:jJ,VenetianMaskIcon:jJ,Verified:P_,VerifiedIcon:P_,Vibrate:NJ,VibrateIcon:NJ,VibrateOff:kJ,VibrateOffIcon:kJ,Video:Da,VideoIcon:Da,VideoOff:SJ,VideoOffIcon:SJ,Videotape:CJ,VideotapeIcon:CJ,View:MJ,ViewIcon:MJ,Voicemail:TJ,VoicemailIcon:TJ,Volleyball:AJ,VolleyballIcon:AJ,Volume:OJ,Volume1:EJ,Volume1Icon:EJ,Volume2:IJ,Volume2Icon:IJ,VolumeIcon:OJ,VolumeOff:PJ,VolumeOffIcon:PJ,VolumeX:LJ,VolumeXIcon:LJ,Vote:DJ,VoteIcon:DJ,Wallet:FJ,Wallet2:Pw,Wallet2Icon:Pw,WalletCards:RJ,WalletCardsIcon:RJ,WalletIcon:FJ,WalletMinimal:Pw,WalletMinimalIcon:Pw,Wallpaper:zJ,WallpaperIcon:zJ,Wand:BJ,Wand2:Lw,Wand2Icon:Lw,WandIcon:BJ,WandSparkles:Lw,WandSparklesIcon:Lw,Warehouse:$J,WarehouseIcon:$J,WashingMachine:UJ,WashingMachineIcon:UJ,Watch:qJ,WatchIcon:qJ,Waves:VJ,WavesIcon:VJ,Waypoints:HJ,WaypointsIcon:HJ,Webcam:WJ,WebcamIcon:WJ,Webhook:KJ,WebhookIcon:KJ,WebhookOff:GJ,WebhookOffIcon:GJ,Weight:ZJ,WeightIcon:ZJ,Wheat:XJ,WheatIcon:XJ,WheatOff:YJ,WheatOffIcon:YJ,WholeWord:QJ,WholeWordIcon:QJ,Wifi:nee,WifiHigh:JJ,WifiHighIcon:JJ,WifiIcon:nee,WifiLow:eee,WifiLowIcon:eee,WifiOff:tee,WifiOffIcon:tee,WifiZero:ree,WifiZeroIcon:ree,Wind:aee,WindArrowDown:see,WindArrowDownIcon:see,WindIcon:aee,Wine:oee,WineIcon:oee,WineOff:iee,WineOffIcon:iee,Workflow:lee,WorkflowIcon:lee,Worm:cee,WormIcon:cee,WrapText:dee,WrapTextIcon:dee,Wrench:ay,WrenchIcon:ay,X:gs,XCircle:Lc,XCircleIcon:Lc,XIcon:gs,XOctagon:nb,XOctagonIcon:nb,XSquare:xw,XSquareIcon:xw,Youtube:uee,YoutubeIcon:uee,Zap:Ig,ZapIcon:Ig,ZapOff:hee,ZapOffIcon:hee,ZoomIn:MS,ZoomInIcon:MS,ZoomOut:TS,ZoomOutIcon:TS,createLucideIcon:q,icons:uYe},Symbol.toStringTag,{value:"Module"})),pge="-",hYe=t=>{const e=pYe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:l=>{const i=l.split(pge);return i[0]===""&&i.length!==1&&i.shift(),uEe(i,e)||fYe(l)},getConflictingClassGroupIds:(l,i)=>{const u=n[l]||[];return i&&s[l]?[...u,...s[l]]:u}}},uEe=(t,e)=>{var l;if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),a=s?uEe(t.slice(1),s):void 0;if(a)return a;if(e.validators.length===0)return;const o=t.join(pge);return(l=e.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},wwe=/^\[(.+)\]$/,fYe=t=>{if(wwe.test(t)){const e=wwe.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},pYe=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};return gYe(Object.entries(t.classGroups),n).forEach(([o,l])=>{Aue(l,s,o,e)}),s},Aue=(t,e,n,s)=>{t.forEach(a=>{if(typeof a=="string"){const o=a===""?e:jwe(e,a);o.classGroupId=n;return}if(typeof a=="function"){if(mYe(a)){Aue(a(s),e,n,s);return}e.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,l])=>{Aue(l,jwe(e,o),n,s)})})},jwe=(t,e)=>{let n=t;return e.split(pge).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},mYe=t=>t.isThemeGetter,gYe=(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,xYe=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)}}},hEe="!",yYe=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,a=e[0],o=e.length,l=i=>{const u=[];let p=0,x=0,y;for(let M=0;Mx?y-x:void 0;return{modifiers:u,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:N}};return n?i=>n({className:i,parseClassName:l}):l},vYe=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},_Ye=t=>({cache:xYe(t.cacheSize),parseClassName:yYe(t),...hYe(t)}),bYe=/\s+/,wYe=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=e,o=[],l=t.trim().split(bYe);let i="";for(let u=l.length-1;u>=0;u-=1){const p=l[u],{modifiers:x,hasImportantModifier:y,baseClassName:_,maybePostfixModifierPosition:w}=n(p);let S=!!w,N=s(S?_.substring(0,w):_);if(!N){if(!S){i=p+(i.length>0?" "+i:i);continue}if(N=s(_),!N){i=p+(i.length>0?" "+i:i);continue}S=!1}const M=vYe(x).join(":"),E=y?M+hEe:M,A=E+N;if(o.includes(A))continue;o.push(A);const P=a(N,S);for(let z=0;z0?" "+i:i)}return i};function jYe(){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=_Ye(p),s=n.cache.get,a=n.cache.set,o=i,i(u)}function i(u){const p=s(u);if(p)return p;const x=wYe(u,n);return a(u,x),x}return function(){return o(jYe.apply(null,arguments))}}const cl=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},pEe=/^\[(?:([a-z-]+):)?(.+)\]$/i,NYe=/^\d+\/\d+$/,SYe=new Set(["px","full","screen"]),CYe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MYe=/\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$/,TYe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,AYe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EYe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bx=t=>AS(t)||SYe.has(t)||NYe.test(t),k0=t=>o3(t,"length",zYe),AS=t=>!!t&&!Number.isNaN(Number(t)),Ole=t=>o3(t,"number",AS),BM=t=>!!t&&Number.isInteger(Number(t)),IYe=t=>t.endsWith("%")&&AS(t.slice(0,-1)),ii=t=>pEe.test(t),N0=t=>CYe.test(t),PYe=new Set(["length","size","percentage"]),LYe=t=>o3(t,PYe,mEe),OYe=t=>o3(t,"position",mEe),DYe=new Set(["image","url"]),RYe=t=>o3(t,DYe,$Ye),FYe=t=>o3(t,"",BYe),$M=()=>!0,o3=(t,e,n)=>{const s=pEe.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},zYe=t=>MYe.test(t)&&!TYe.test(t),mEe=()=>!1,BYe=t=>AYe.test(t),$Ye=t=>EYe.test(t),UYe=()=>{const t=cl("colors"),e=cl("spacing"),n=cl("blur"),s=cl("brightness"),a=cl("borderColor"),o=cl("borderRadius"),l=cl("borderSpacing"),i=cl("borderWidth"),u=cl("contrast"),p=cl("grayscale"),x=cl("hueRotate"),y=cl("invert"),_=cl("gap"),w=cl("gradientColorStops"),S=cl("gradientColorStopPositions"),N=cl("inset"),M=cl("margin"),E=cl("opacity"),A=cl("padding"),P=cl("saturate"),z=cl("scale"),R=cl("sepia"),U=cl("skew"),V=cl("space"),K=cl("translate"),W=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],ae=()=>["auto",ii,e],oe=()=>[ii,e],xe=()=>["",bx,k0],ie=()=>["auto",AS,ii],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>["start","end","center","between","around","evenly","stretch"],ye=()=>["","0",ii],Ce=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Se=()=>[AS,ii];return{cacheSize:500,separator:":",theme:{colors:[$M],spacing:[bx,k0],blur:["none","",N0,ii],brightness:Se(),borderColor:[t],borderRadius:["none","","full",N0,ii],borderSpacing:oe(),borderWidth:xe(),contrast:Se(),grayscale:ye(),hueRotate:Se(),invert:ye(),gap:oe(),gradientColorStops:[t],gradientColorStopPositions:[IYe,k0],inset:ae(),margin:ae(),opacity:Se(),padding:oe(),saturate:Se(),scale:Se(),sepia:ye(),skew:Se(),space:oe(),translate:oe()},classGroups:{aspect:[{aspect:["auto","square","video",ii]}],container:["container"],columns:[{columns:[N0]}],"break-after":[{"break-after":Ce()}],"break-before":[{"break-before":Ce()}],"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(),ii]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],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",BM,ii]}],basis:[{basis:ae()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ii]}],grow:[{grow:ye()}],shrink:[{shrink:ye()}],order:[{order:["first","last","none",BM,ii]}],"grid-cols":[{"grid-cols":[$M]}],"col-start-end":[{col:["auto",{span:["full",BM,ii]},ii]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[$M]}],"row-start-end":[{row:["auto",{span:[BM,ii]},ii]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ii]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ii]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...he()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...he(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...he(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[M]}],mx:[{mx:[M]}],my:[{my:[M]}],ms:[{ms:[M]}],me:[{me:[M]}],mt:[{mt:[M]}],mr:[{mr:[M]}],mb:[{mb:[M]}],ml:[{ml:[M]}],"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",ii,e]}],"min-w":[{"min-w":[ii,e,"min","max","fit"]}],"max-w":[{"max-w":[ii,e,"none","full","min","max","fit","prose",{screen:[N0]},N0]}],h:[{h:[ii,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ii,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ii,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ii,e,"auto","min","max","fit"]}],"font-size":[{text:["base",N0,k0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ole]}],"font-family":[{font:[$M]}],"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",ii]}],"line-clamp":[{"line-clamp":["none",AS,Ole]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bx,ii]}],"list-image":[{"list-image":["none",ii]}],"list-style-type":[{list:["none","disc","decimal",ii]}],"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",bx,k0]}],"underline-offset":[{"underline-offset":["auto",bx,ii]}],"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",ii]}],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",ii]}],"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(),OYe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LYe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},RYe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],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":[bx,ii]}],"outline-w":[{outline:[bx,k0]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[bx,k0]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",N0,FYe]}],"shadow-color":[{shadow:[$M]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",N0,ii]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[P]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"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":[R]}],"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",ii]}],duration:[{duration:Se()}],ease:[{ease:["linear","in","out","in-out",ii]}],delay:[{delay:Se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ii]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[BM,ii]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ii]}],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",ii]}],"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",ii]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[bx,k0,Ole]}],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"]}}},qYe=kYe(UYe);function zt(...t){return qYe(oi(t))}function Ud(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 kwe(t){const e=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(e)}function Vne(t){return t?t.replace(/<[^>]*>/g,""):""}const VYe=lYe,gEe=I.forwardRef(({className:t,...e},n)=>r.jsx(tEe,{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}));gEe.displayName=tEe.displayName;const HYe=i3("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"}}),xEe=I.forwardRef(({className:t,variant:e,...n},s)=>r.jsx(rEe,{ref:s,className:zt(HYe({variant:e}),t),...n}));xEe.displayName=rEe.displayName;const WYe=I.forwardRef(({className:t,...e},n)=>r.jsx(aEe,{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}));WYe.displayName=aEe.displayName;const yEe=I.forwardRef(({className:t,...e},n)=>r.jsx(iEe,{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(gs,{className:"h-4 w-4"})}));yEe.displayName=iEe.displayName;const vEe=I.forwardRef(({className:t,...e},n)=>r.jsx(nEe,{ref:n,className:zt("text-sm font-semibold",t),...e}));vEe.displayName=nEe.displayName;const _Ee=I.forwardRef(({className:t,...e},n)=>r.jsx(sEe,{ref:n,className:zt("text-sm opacity-90",t),...e}));_Ee.displayName=sEe.displayName;function GYe(){const{toasts:t}=mi();return r.jsxs(VYe,{children:[t.map(function({id:e,title:n,description:s,action:a,...o}){return r.jsxs(xEe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(vEe,{children:n}),s&&r.jsx(_Ee,{children:s})]}),a,r.jsx(yEe,{})]},e)}),r.jsx(gEe,{})]})}var Nwe=["light","dark"],KYe="(prefers-color-scheme: dark)",ZYe=I.createContext(void 0),YYe={setTheme:t=>{},themes:[]},XYe=()=>{var t;return(t=I.useContext(ZYe))!=null?t:YYe};I.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:s,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:u})=>{let p=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(S=>`'${S}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=a?Nwe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",_=(S,N=!1,M=!0)=>{let E=l?l[S]:S,A=N?S+"|| ''":`'${E}'`,P="";return a&&M&&!N&&Nwe.includes(S)&&(P+=`d.style.colorScheme = '${S}';`),n==="class"?N||E?P+=`c.add(${A})`:P+="null":E&&(P+=`d[s](n,${A})`),P},w=t?`!function(){${x}${_(t)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${p})){var t='${KYe}',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:u,dangerouslySetInnerHTML:{__html:w}})});var QYe=t=>{switch(t){case"success":return tXe;case"info":return nXe;case"warning":return rXe;case"error":return sXe;default:return null}},JYe=Array(12).fill(0),eXe=({visible:t,className:e})=>it.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},it.createElement("div",{className:"sonner-spinner"},JYe.map((n,s)=>it.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),tXe=it.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},it.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"})),rXe=it.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},it.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"})),nXe=it.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},it.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"})),sXe=it.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},it.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"})),aXe=it.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"},it.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),it.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),iXe=()=>{let[t,e]=it.useState(document.hidden);return it.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},Eue=1,oXe=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:Eue++,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 u=>{if(o=["resolve",u],it.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(cXe(u)&&!u.ok){a=!1;let p=typeof e.error=="function"?await e.error(`HTTP error! status: ${u.status}`):e.error,x=typeof e.description=="function"?await e.description(`HTTP error! status: ${u.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(u):e.success,x=typeof e.description=="function"?await e.description(u):e.description;this.create({id:n,type:"success",message:p,description:x})}}).catch(async u=>{if(o=["reject",u],e.error!==void 0){a=!1;let p=typeof e.error=="function"?await e.error(u):e.error,x=typeof e.description=="function"?await e.description(u):e.description;this.create({id:n,type:"error",message:p,description:x})}}).finally(()=>{var u;a&&(this.dismiss(n),n=void 0),(u=e.finally)==null||u.call(e)}),i=()=>new Promise((u,p)=>l.then(()=>o[0]==="reject"?p(o[1]):u(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)||Eue++;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}},mh=new oXe,lXe=(t,e)=>{let n=(e==null?void 0:e.id)||Eue++;return mh.addToast({title:t,...e,id:n}),n},cXe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",dXe=lXe,uXe=()=>mh.toasts,hXe=()=>mh.getActiveToasts(),Oe=Object.assign(dXe,{success:mh.success,info:mh.info,warning:mh.warning,error:mh.error,custom:mh.custom,message:mh.message,promise:mh.promise,dismiss:mh.dismiss,loading:mh.loading},{getHistory:uXe,getToasts:hXe});function fXe(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))}fXe(`: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 vL(t){return t.label!==void 0}var pXe=3,mXe="32px",gXe="16px",Swe=4e3,xXe=356,yXe=14,vXe=20,_Xe=200;function Gp(...t){return t.filter(Boolean).join(" ")}function bXe(t){let[e,n]=t.split("-"),s=[];return e&&s.push(e),n&&s.push(n),s}var wXe=t=>{var e,n,s,a,o,l,i,u,p,x,y;let{invert:_,toast:w,unstyled:S,interacting:N,setHeights:M,visibleToasts:E,heights:A,index:P,toasts:z,expanded:R,removeToast:U,defaultRichColors:V,closeButton:K,style:W,cancelButtonStyle:J,actionButtonStyle:ae,className:oe="",descriptionClassName:xe="",duration:ie,position:pe,gap:se,loadingIcon:fe,expandByDefault:he,classNames:ye,icons:Ce,closeButtonAriaLabel:Se="Close toast",pauseWhenPageIsHidden:Ne}=t,[be,rt]=it.useState(null),[Te,Pe]=it.useState(null),[Ue,Re]=it.useState(!1),[Be,Ye]=it.useState(!1),[ht,Me]=it.useState(!1),[Qe,le]=it.useState(!1),[Ve,Le]=it.useState(!1),[We,_e]=it.useState(0),[st,ze]=it.useState(0),Ee=it.useRef(w.duration||ie||Swe),Je=it.useRef(null),at=it.useRef(null),pt=P===0,gt=P+1<=E,Mt=w.type,wt=w.dismissible!==!1,Xt=w.className||"",Sr=w.descriptionClassName||"",an=it.useMemo(()=>A.findIndex(Cs=>Cs.toastId===w.id)||0,[A,w.id]),wn=it.useMemo(()=>{var Cs;return(Cs=w.closeButton)!=null?Cs:K},[w.closeButton,K]),Xr=it.useMemo(()=>w.duration||ie||Swe,[w.duration,ie]),Pn=it.useRef(0),Ns=it.useRef(0),hr=it.useRef(0),ys=it.useRef(null),[Ca,va]=pe.split("-"),$i=it.useMemo(()=>A.reduce((Cs,Ba,Ra)=>Ra>=an?Cs:Cs+Ba.height,0),[A,an]),Ui=iXe(),al=w.invert||_,yo=Mt==="loading";Ns.current=it.useMemo(()=>an*se+$i,[an,$i]),it.useEffect(()=>{Ee.current=Xr},[Xr]),it.useEffect(()=>{Re(!0)},[]),it.useEffect(()=>{let Cs=at.current;if(Cs){let Ba=Cs.getBoundingClientRect().height;return ze(Ba),M(Ra=>[{toastId:w.id,height:Ba,position:w.position},...Ra]),()=>M(Ra=>Ra.filter(Fo=>Fo.toastId!==w.id))}},[M,w.id]),it.useLayoutEffect(()=>{if(!Ue)return;let Cs=at.current,Ba=Cs.style.height;Cs.style.height="auto";let Ra=Cs.getBoundingClientRect().height;Cs.style.height=Ba,ze(Ra),M(Fo=>Fo.find(ir=>ir.toastId===w.id)?Fo.map(ir=>ir.toastId===w.id?{...ir,height:Ra}:ir):[{toastId:w.id,height:Ra,position:w.position},...Fo])},[Ue,w.title,w.description,M,w.id]);let Gs=it.useCallback(()=>{Ye(!0),_e(Ns.current),M(Cs=>Cs.filter(Ba=>Ba.toastId!==w.id)),setTimeout(()=>{U(w)},_Xe)},[w,U,M,Ns]);it.useEffect(()=>{if(w.promise&&Mt==="loading"||w.duration===1/0||w.type==="loading")return;let Cs;return R||N||Ne&&Ui?(()=>{if(hr.current{var Ba;(Ba=w.onAutoClose)==null||Ba.call(w,w),Gs()},Ee.current)),()=>clearTimeout(Cs)},[R,N,w,Mt,Ne,Ui,Gs]),it.useEffect(()=>{w.delete&&Gs()},[Gs,w.delete]);function Qa(){var Cs,Ba,Ra;return Ce!=null&&Ce.loading?it.createElement("div",{className:Gp(ye==null?void 0:ye.loader,(Cs=w==null?void 0:w.classNames)==null?void 0:Cs.loader,"sonner-loader"),"data-visible":Mt==="loading"},Ce.loading):fe?it.createElement("div",{className:Gp(ye==null?void 0:ye.loader,(Ba=w==null?void 0:w.classNames)==null?void 0:Ba.loader,"sonner-loader"),"data-visible":Mt==="loading"},fe):it.createElement(eXe,{className:Gp(ye==null?void 0:ye.loader,(Ra=w==null?void 0:w.classNames)==null?void 0:Ra.loader),visible:Mt==="loading"})}return it.createElement("li",{tabIndex:0,ref:at,className:Gp(oe,Xt,ye==null?void 0:ye.toast,(e=w==null?void 0:w.classNames)==null?void 0:e.toast,ye==null?void 0:ye.default,ye==null?void 0:ye[Mt],(n=w==null?void 0:w.classNames)==null?void 0:n[Mt]),"data-sonner-toast":"","data-rich-colors":(s=w.richColors)!=null?s:V,"data-styled":!(w.jsx||w.unstyled||S),"data-mounted":Ue,"data-promise":!!w.promise,"data-swiped":Ve,"data-removed":Be,"data-visible":gt,"data-y-position":Ca,"data-x-position":va,"data-index":P,"data-front":pt,"data-swiping":ht,"data-dismissible":wt,"data-type":Mt,"data-invert":al,"data-swipe-out":Qe,"data-swipe-direction":Te,"data-expanded":!!(R||he&&Ue),style:{"--index":P,"--toasts-before":P,"--z-index":z.length-P,"--offset":`${Be?We:Ns.current}px`,"--initial-height":he?"auto":`${st}px`,...W,...w.style},onDragEnd:()=>{Me(!1),rt(null),ys.current=null},onPointerDown:Cs=>{yo||!wt||(Je.current=new Date,_e(Ns.current),Cs.target.setPointerCapture(Cs.pointerId),Cs.target.tagName!=="BUTTON"&&(Me(!0),ys.current={x:Cs.clientX,y:Cs.clientY}))},onPointerUp:()=>{var Cs,Ba,Ra,Fo;if(Qe||!wt)return;ys.current=null;let ir=Number(((Cs=at.current)==null?void 0:Cs.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),po=Number(((Ba=at.current)==null?void 0:Ba.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),gl=new Date().getTime()-((Ra=Je.current)==null?void 0:Ra.getTime()),Eo=be==="x"?ir:po,is=Math.abs(Eo)/gl;if(Math.abs(Eo)>=vXe||is>.11){_e(Ns.current),(Fo=w.onDismiss)==null||Fo.call(w,w),Pe(be==="x"?ir>0?"right":"left":po>0?"down":"up"),Gs(),le(!0),Le(!1);return}Me(!1),rt(null)},onPointerMove:Cs=>{var Ba,Ra,Fo,ir;if(!ys.current||!wt||((Ba=window.getSelection())==null?void 0:Ba.toString().length)>0)return;let po=Cs.clientY-ys.current.y,gl=Cs.clientX-ys.current.x,Eo=(Ra=t.swipeDirections)!=null?Ra:bXe(pe);!be&&(Math.abs(gl)>1||Math.abs(po)>1)&&rt(Math.abs(gl)>Math.abs(po)?"x":"y");let is={x:0,y:0};be==="y"?(Eo.includes("top")||Eo.includes("bottom"))&&(Eo.includes("top")&&po<0||Eo.includes("bottom")&&po>0)&&(is.y=po):be==="x"&&(Eo.includes("left")||Eo.includes("right"))&&(Eo.includes("left")&&gl<0||Eo.includes("right")&&gl>0)&&(is.x=gl),(Math.abs(is.x)>0||Math.abs(is.y)>0)&&Le(!0),(Fo=at.current)==null||Fo.style.setProperty("--swipe-amount-x",`${is.x}px`),(ir=at.current)==null||ir.style.setProperty("--swipe-amount-y",`${is.y}px`)}},wn&&!w.jsx?it.createElement("button",{"aria-label":Se,"data-disabled":yo,"data-close-button":!0,onClick:yo||!wt?()=>{}:()=>{var Cs;Gs(),(Cs=w.onDismiss)==null||Cs.call(w,w)},className:Gp(ye==null?void 0:ye.closeButton,(a=w==null?void 0:w.classNames)==null?void 0:a.closeButton)},(o=Ce==null?void 0:Ce.close)!=null?o:aXe):null,w.jsx||I.isValidElement(w.title)?w.jsx?w.jsx:typeof w.title=="function"?w.title():w.title:it.createElement(it.Fragment,null,Mt||w.icon||w.promise?it.createElement("div",{"data-icon":"",className:Gp(ye==null?void 0:ye.icon,(l=w==null?void 0:w.classNames)==null?void 0:l.icon)},w.promise||w.type==="loading"&&!w.icon?w.icon||Qa():null,w.type!=="loading"?w.icon||(Ce==null?void 0:Ce[Mt])||QYe(Mt):null):null,it.createElement("div",{"data-content":"",className:Gp(ye==null?void 0:ye.content,(i=w==null?void 0:w.classNames)==null?void 0:i.content)},it.createElement("div",{"data-title":"",className:Gp(ye==null?void 0:ye.title,(u=w==null?void 0:w.classNames)==null?void 0:u.title)},typeof w.title=="function"?w.title():w.title),w.description?it.createElement("div",{"data-description":"",className:Gp(xe,Sr,ye==null?void 0:ye.description,(p=w==null?void 0:w.classNames)==null?void 0:p.description)},typeof w.description=="function"?w.description():w.description):null),I.isValidElement(w.cancel)?w.cancel:w.cancel&&vL(w.cancel)?it.createElement("button",{"data-button":!0,"data-cancel":!0,style:w.cancelButtonStyle||J,onClick:Cs=>{var Ba,Ra;vL(w.cancel)&&wt&&((Ra=(Ba=w.cancel).onClick)==null||Ra.call(Ba,Cs),Gs())},className:Gp(ye==null?void 0:ye.cancelButton,(x=w==null?void 0:w.classNames)==null?void 0:x.cancelButton)},w.cancel.label):null,I.isValidElement(w.action)?w.action:w.action&&vL(w.action)?it.createElement("button",{"data-button":!0,"data-action":!0,style:w.actionButtonStyle||ae,onClick:Cs=>{var Ba,Ra;vL(w.action)&&((Ra=(Ba=w.action).onClick)==null||Ra.call(Ba,Cs),!Cs.defaultPrevented&&Gs())},className:Gp(ye==null?void 0:ye.actionButton,(y=w==null?void 0:w.classNames)==null?void 0:y.actionButton)},w.action.label):null))};function Cwe(){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 jXe(t,e){let n={};return[t,e].forEach((s,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?gXe:mXe;function u(p){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?u(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]}):u(i)}),n}var kXe=I.forwardRef(function(t,e){let{invert:n,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:u,mobileOffset:p,theme:x="light",richColors:y,duration:_,style:w,visibleToasts:S=pXe,toastOptions:N,dir:M=Cwe(),gap:E=yXe,loadingIcon:A,icons:P,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:R}=t,[U,V]=it.useState([]),K=it.useMemo(()=>Array.from(new Set([s].concat(U.filter(Ne=>Ne.position).map(Ne=>Ne.position)))),[U,s]),[W,J]=it.useState([]),[ae,oe]=it.useState(!1),[xe,ie]=it.useState(!1),[pe,se]=it.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),fe=it.useRef(null),he=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),ye=it.useRef(null),Ce=it.useRef(!1),Se=it.useCallback(Ne=>{V(be=>{var rt;return(rt=be.find(Te=>Te.id===Ne.id))!=null&&rt.delete||mh.dismiss(Ne.id),be.filter(({id:Te})=>Te!==Ne.id)})},[]);return it.useEffect(()=>mh.subscribe(Ne=>{if(Ne.dismiss){V(be=>be.map(rt=>rt.id===Ne.id?{...rt,delete:!0}:rt));return}setTimeout(()=>{lge.flushSync(()=>{V(be=>{let rt=be.findIndex(Te=>Te.id===Ne.id);return rt!==-1?[...be.slice(0,rt),{...be[rt],...Ne},...be.slice(rt+1)]:[Ne,...be]})})})}),[]),it.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 Ne=window.matchMedia("(prefers-color-scheme: dark)");try{Ne.addEventListener("change",({matches:be})=>{se(be?"dark":"light")})}catch{Ne.addListener(({matches:rt})=>{try{se(rt?"dark":"light")}catch(Te){console.error(Te)}})}},[x]),it.useEffect(()=>{U.length<=1&&oe(!1)},[U]),it.useEffect(()=>{let Ne=be=>{var rt,Te;a.every(Pe=>be[Pe]||be.code===Pe)&&(oe(!0),(rt=fe.current)==null||rt.focus()),be.code==="Escape"&&(document.activeElement===fe.current||(Te=fe.current)!=null&&Te.contains(document.activeElement))&&oe(!1)};return document.addEventListener("keydown",Ne),()=>document.removeEventListener("keydown",Ne)},[a]),it.useEffect(()=>{if(fe.current)return()=>{ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null,Ce.current=!1)}},[fe.current]),it.createElement("section",{ref:e,"aria-label":`${z} ${he}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((Ne,be)=>{var rt;let[Te,Pe]=Ne.split("-");return U.length?it.createElement("ol",{key:Ne,dir:M==="auto"?Cwe():M,tabIndex:-1,ref:fe,className:i,"data-sonner-toaster":!0,"data-theme":pe,"data-y-position":Te,"data-lifted":ae&&U.length>1&&!o,"data-x-position":Pe,style:{"--front-toast-height":`${((rt=W[0])==null?void 0:rt.height)||0}px`,"--width":`${xXe}px`,"--gap":`${E}px`,...w,...jXe(u,p)},onBlur:Ue=>{Ce.current&&!Ue.currentTarget.contains(Ue.relatedTarget)&&(Ce.current=!1,ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null))},onFocus:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||Ce.current||(Ce.current=!0,ye.current=Ue.relatedTarget)},onMouseEnter:()=>oe(!0),onMouseMove:()=>oe(!0),onMouseLeave:()=>{xe||oe(!1)},onDragEnd:()=>oe(!1),onPointerDown:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||ie(!0)},onPointerUp:()=>ie(!1)},U.filter(Ue=>!Ue.position&&be===0||Ue.position===Ne).map((Ue,Re)=>{var Be,Ye;return it.createElement(wXe,{key:Ue.id,icons:P,index:Re,toast:Ue,defaultRichColors:y,duration:(Be=N==null?void 0:N.duration)!=null?Be:_,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:n,visibleToasts:S,closeButton:(Ye=N==null?void 0:N.closeButton)!=null?Ye:l,interacting:xe,position:Ne,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:Se,toasts:U.filter(ht=>ht.position==Ue.position),heights:W.filter(ht=>ht.position==Ue.position),setHeights:J,expandByDefault:o,gap:E,loadingIcon:A,expanded:ae,pauseWhenPageIsHidden:R,swipeDirections:t.swipeDirections})})):null}))});const NXe=({...t})=>{const{theme:e="system"}=XYe();return r.jsx(kXe,{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 SXe=xme[" useId ".trim().toString()]||(()=>{}),CXe=0;function Qc(t){const[e,n]=I.useState(SXe());return ic(()=>{n(s=>s??String(CXe++))},[t]),e?`radix-${e}`:""}const MXe=["top","right","bottom","left"],tv=Math.min,Qh=Math.max,rte=Math.round,_L=Math.floor,Pg=t=>({x:t,y:t}),TXe={left:"right",right:"left",bottom:"top",top:"bottom"},AXe={start:"end",end:"start"};function Iue(t,e,n){return Qh(t,tv(e,n))}function xy(t,e){return typeof t=="function"?t(e):t}function yy(t){return t.split("-")[0]}function l3(t){return t.split("-")[1]}function mge(t){return t==="x"?"y":"x"}function gge(t){return t==="y"?"height":"width"}const EXe=new Set(["top","bottom"]);function gg(t){return EXe.has(yy(t))?"y":"x"}function xge(t){return mge(gg(t))}function IXe(t,e,n){n===void 0&&(n=!1);const s=l3(t),a=xge(t),o=gge(a);let l=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=nte(l)),[l,nte(l)]}function PXe(t){const e=nte(t);return[Pue(t),e,Pue(e)]}function Pue(t){return t.replace(/start|end/g,e=>AXe[e])}const Mwe=["left","right"],Twe=["right","left"],LXe=["top","bottom"],OXe=["bottom","top"];function DXe(t,e,n){switch(t){case"top":case"bottom":return n?e?Twe:Mwe:e?Mwe:Twe;case"left":case"right":return e?LXe:OXe;default:return[]}}function RXe(t,e,n,s){const a=l3(t);let o=DXe(yy(t),n==="start",s);return a&&(o=o.map(l=>l+"-"+a),e&&(o=o.concat(o.map(Pue)))),o}function nte(t){return t.replace(/left|right|bottom|top/g,e=>TXe[e])}function FXe(t){return{top:0,right:0,bottom:0,left:0,...t}}function bEe(t){return typeof t!="number"?FXe(t):{top:t,right:t,bottom:t,left:t}}function ste(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 Awe(t,e,n){let{reference:s,floating:a}=t;const o=gg(e),l=xge(e),i=gge(l),u=yy(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 w;switch(u){case"top":w={x,y:s.y-a.height};break;case"bottom":w={x,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y};break;case"left":w={x:s.x-a.width,y};break;default:w={x:s.x,y:s.y}}switch(l3(e)){case"start":w[l]-=_*(n&&p?-1:1);break;case"end":w[l]+=_*(n&&p?-1:1);break}return w}const zXe=async(t,e,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:l}=n,i=o.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(e));let p=await l.getElementRects({reference:t,floating:e,strategy:a}),{x,y}=Awe(p,s,u),_=s,w={},S=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:u}=e,{element:p,padding:x=0}=xy(t,e)||{};if(p==null)return{};const y=bEe(x),_={x:n,y:s},w=xge(a),S=gge(w),N=await l.getDimensions(p),M=w==="y",E=M?"top":"left",A=M?"bottom":"right",P=M?"clientHeight":"clientWidth",z=o.reference[S]+o.reference[w]-_[w]-o.floating[S],R=_[w]-o.reference[w],U=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let V=U?U[P]:0;(!V||!await(l.isElement==null?void 0:l.isElement(U)))&&(V=i.floating[P]||o.floating[S]);const K=z/2-R/2,W=V/2-N[S]/2-1,J=tv(y[E],W),ae=tv(y[A],W),oe=J,xe=V-N[S]-ae,ie=V/2-N[S]/2+K,pe=Iue(oe,ie,xe),se=!u.arrow&&l3(a)!=null&&ie!==pe&&o.reference[S]/2-(ieie<=0)){var ae,oe;const ie=(((ae=o.flip)==null?void 0:ae.index)||0)+1,pe=V[ie];if(pe&&(!(y==="alignment"?A!==gg(pe):!1)||J.every(he=>he.overflows[0]>0&&gg(he.placement)===A)))return{data:{index:ie,overflows:J},reset:{placement:pe}};let se=(oe=J.filter(fe=>fe.overflows[0]<=0).sort((fe,he)=>fe.overflows[1]-he.overflows[1])[0])==null?void 0:oe.placement;if(!se)switch(w){case"bestFit":{var xe;const fe=(xe=J.filter(he=>{if(U){const ye=gg(he.placement);return ye===A||ye==="y"}return!0}).map(he=>[he.placement,he.overflows.filter(ye=>ye>0).reduce((ye,Ce)=>ye+Ce,0)]).sort((he,ye)=>he[1]-ye[1])[0])==null?void 0:xe[0];fe&&(se=fe);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 Iwe(t){return MXe.some(e=>t[e]>=0)}const UXe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:s="referenceHidden",...a}=xy(t,e);switch(s){case"referenceHidden":{const o=await sE(e,{...a,elementContext:"reference"}),l=Ewe(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Iwe(l)}}}case"escaped":{const o=await sE(e,{...a,altBoundary:!0}),l=Ewe(o,n.floating);return{data:{escapedOffsets:l,escaped:Iwe(l)}}}default:return{}}}}},wEe=new Set(["left","top"]);async function qXe(t,e){const{placement:n,platform:s,elements:a}=t,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),l=yy(n),i=l3(n),u=gg(n)==="y",p=wEe.has(l)?-1:1,x=o&&u?-1:1,y=xy(e,t);let{mainAxis:_,crossAxis:w,alignmentAxis:S}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return i&&typeof S=="number"&&(w=i==="end"?S*-1:S),u?{x:w*x,y:_*p}:{x:_*p,y:w*x}}const VXe=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,u=await qXe(e,t);return l===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:a+u.x,y:o+u.y,data:{...u,placement:l}}}}},HXe=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:M=>{let{x:E,y:A}=M;return{x:E,y:A}}},...u}=xy(t,e),p={x:n,y:s},x=await sE(e,u),y=gg(yy(a)),_=mge(y);let w=p[_],S=p[y];if(o){const M=_==="y"?"top":"left",E=_==="y"?"bottom":"right",A=w+x[M],P=w-x[E];w=Iue(A,w,P)}if(l){const M=y==="y"?"top":"left",E=y==="y"?"bottom":"right",A=S+x[M],P=S-x[E];S=Iue(A,S,P)}const N=i.fn({...e,[_]:w,[y]:S});return{...N,data:{x:N.x-n,y:N.y-s,enabled:{[_]:o,[y]:l}}}}}},WXe=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:u=!0,crossAxis:p=!0}=xy(t,e),x={x:n,y:s},y=gg(a),_=mge(y);let w=x[_],S=x[y];const N=xy(i,e),M=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(u){const P=_==="y"?"height":"width",z=o.reference[_]-o.floating[P]+M.mainAxis,R=o.reference[_]+o.reference[P]-M.mainAxis;wR&&(w=R)}if(p){var E,A;const P=_==="y"?"width":"height",z=wEe.has(yy(a)),R=o.reference[y]-o.floating[P]+(z&&((E=l.offset)==null?void 0:E[y])||0)+(z?0:M.crossAxis),U=o.reference[y]+o.reference[P]+(z?0:((A=l.offset)==null?void 0:A[y])||0)-(z?M.crossAxis:0);SU&&(S=U)}return{[_]:w,[y]:S}}}},GXe=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:u=()=>{},...p}=xy(t,e),x=await sE(e,p),y=yy(a),_=l3(a),w=gg(a)==="y",{width:S,height:N}=o.floating;let M,E;y==="top"||y==="bottom"?(M=y,E=_===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(E=y,M=_==="end"?"top":"bottom");const A=N-x.top-x.bottom,P=S-x.left-x.right,z=tv(N-x[M],A),R=tv(S-x[E],P),U=!e.middlewareData.shift;let V=z,K=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=P),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(V=A),U&&!_){const J=Qh(x.left,0),ae=Qh(x.right,0),oe=Qh(x.top,0),xe=Qh(x.bottom,0);w?K=S-2*(J!==0||ae!==0?J+ae:Qh(x.left,x.right)):V=N-2*(oe!==0||xe!==0?oe+xe:Qh(x.top,x.bottom))}await u({...e,availableWidth:K,availableHeight:V});const W=await l.getDimensions(i.floating);return S!==W.width||N!==W.height?{reset:{rects:!0}}:{}}}};function Hne(){return typeof window<"u"}function c3(t){return jEe(t)?(t.nodeName||"").toLowerCase():"#document"}function ff(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Hg(t){var e;return(e=(jEe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function jEe(t){return Hne()?t instanceof Node||t instanceof ff(t).Node:!1}function Mm(t){return Hne()?t instanceof Element||t instanceof ff(t).Element:!1}function zg(t){return Hne()?t instanceof HTMLElement||t instanceof ff(t).HTMLElement:!1}function Pwe(t){return!Hne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ff(t).ShadowRoot}const KXe=new Set(["inline","contents"]);function NI(t){const{overflow:e,overflowX:n,overflowY:s,display:a}=Tm(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!KXe.has(a)}const ZXe=new Set(["table","td","th"]);function YXe(t){return ZXe.has(c3(t))}const XXe=[":popover-open",":modal"];function Wne(t){return XXe.some(e=>{try{return t.matches(e)}catch{return!1}})}const QXe=["transform","translate","scale","rotate","perspective"],JXe=["transform","translate","scale","rotate","perspective","filter"],eQe=["paint","layout","strict","content"];function yge(t){const e=vge(),n=Mm(t)?Tm(t):t;return QXe.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)||JXe.some(s=>(n.willChange||"").includes(s))||eQe.some(s=>(n.contain||"").includes(s))}function tQe(t){let e=rv(t);for(;zg(e)&&!pC(e);){if(yge(e))return e;if(Wne(e))return null;e=rv(e)}return null}function vge(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const rQe=new Set(["html","body","#document"]);function pC(t){return rQe.has(c3(t))}function Tm(t){return ff(t).getComputedStyle(t)}function Gne(t){return Mm(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function rv(t){if(c3(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Pwe(t)&&t.host||Hg(t);return Pwe(e)?e.host:e}function kEe(t){const e=rv(t);return pC(e)?t.ownerDocument?t.ownerDocument.body:t.body:zg(e)&&NI(e)?e:kEe(e)}function aE(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=kEe(t),o=a===((s=t.ownerDocument)==null?void 0:s.body),l=ff(a);if(o){const i=Lue(l);return e.concat(l,l.visualViewport||[],NI(a)?a:[],i&&n?aE(i):[])}return e.concat(a,aE(a,[],n))}function Lue(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function NEe(t){const e=Tm(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const a=zg(t),o=a?t.offsetWidth:n,l=a?t.offsetHeight:s,i=rte(n)!==o||rte(s)!==l;return i&&(n=o,s=l),{width:n,height:s,$:i}}function _ge(t){return Mm(t)?t:t.contextElement}function ES(t){const e=_ge(t);if(!zg(e))return Pg(1);const n=e.getBoundingClientRect(),{width:s,height:a,$:o}=NEe(e);let l=(o?rte(n.width):n.width)/s,i=(o?rte(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const nQe=Pg(0);function SEe(t){const e=ff(t);return!vge()||!e.visualViewport?nQe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sQe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ff(t)?!1:e}function Wj(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),o=_ge(t);let l=Pg(1);e&&(s?Mm(s)&&(l=ES(s)):l=ES(t));const i=sQe(o,n,s)?SEe(o):Pg(0);let u=(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 _=ff(o),w=s&&Mm(s)?ff(s):s;let S=_,N=Lue(S);for(;N&&s&&w!==S;){const M=ES(N),E=N.getBoundingClientRect(),A=Tm(N),P=E.left+(N.clientLeft+parseFloat(A.paddingLeft))*M.x,z=E.top+(N.clientTop+parseFloat(A.paddingTop))*M.y;u*=M.x,p*=M.y,x*=M.x,y*=M.y,u+=P,p+=z,S=ff(N),N=Lue(S)}}return ste({width:x,height:y,x:u,y:p})}function bge(t,e){const n=Gne(t).scrollLeft;return e?e.left+n:Wj(Hg(t)).left+n}function CEe(t,e,n){n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=s.left+e.scrollLeft-(n?0:bge(t,s)),o=s.top+e.scrollTop;return{x:a,y:o}}function aQe(t){let{elements:e,rect:n,offsetParent:s,strategy:a}=t;const o=a==="fixed",l=Hg(s),i=e?Wne(e.floating):!1;if(s===l||i&&o)return n;let u={scrollLeft:0,scrollTop:0},p=Pg(1);const x=Pg(0),y=zg(s);if((y||!y&&!o)&&((c3(s)!=="body"||NI(l))&&(u=Gne(s)),zg(s))){const w=Wj(s);p=ES(s),x.x=w.x+s.clientLeft,x.y=w.y+s.clientTop}const _=l&&!y&&!o?CEe(l,u,!0):Pg(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-u.scrollLeft*p.x+x.x+_.x,y:n.y*p.y-u.scrollTop*p.y+x.y+_.y}}function iQe(t){return Array.from(t.getClientRects())}function oQe(t){const e=Hg(t),n=Gne(t),s=t.ownerDocument.body,a=Qh(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=Qh(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+bge(t);const i=-n.scrollTop;return Tm(s).direction==="rtl"&&(l+=Qh(e.clientWidth,s.clientWidth)-a),{width:a,height:o,x:l,y:i}}function lQe(t,e){const n=ff(t),s=Hg(t),a=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,i=0,u=0;if(a){o=a.width,l=a.height;const p=vge();(!p||p&&e==="fixed")&&(i=a.offsetLeft,u=a.offsetTop)}return{width:o,height:l,x:i,y:u}}const cQe=new Set(["absolute","fixed"]);function dQe(t,e){const n=Wj(t,!0,e==="fixed"),s=n.top+t.clientTop,a=n.left+t.clientLeft,o=zg(t)?ES(t):Pg(1),l=t.clientWidth*o.x,i=t.clientHeight*o.y,u=a*o.x,p=s*o.y;return{width:l,height:i,x:u,y:p}}function Lwe(t,e,n){let s;if(e==="viewport")s=lQe(t,n);else if(e==="document")s=oQe(Hg(t));else if(Mm(e))s=dQe(e,n);else{const a=SEe(t);s={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ste(s)}function MEe(t,e){const n=rv(t);return n===e||!Mm(n)||pC(n)?!1:Tm(n).position==="fixed"||MEe(n,e)}function uQe(t,e){const n=e.get(t);if(n)return n;let s=aE(t,[],!1).filter(i=>Mm(i)&&c3(i)!=="body"),a=null;const o=Tm(t).position==="fixed";let l=o?rv(t):t;for(;Mm(l)&&!pC(l);){const i=Tm(l),u=yge(l);!u&&i.position==="fixed"&&(a=null),(o?!u&&!a:!u&&i.position==="static"&&!!a&&cQe.has(a.position)||NI(l)&&!u&&MEe(t,l))?s=s.filter(x=>x!==l):a=i,l=rv(l)}return e.set(t,s),s}function hQe(t){let{element:e,boundary:n,rootBoundary:s,strategy:a}=t;const l=[...n==="clippingAncestors"?Wne(e)?[]:uQe(e,this._c):[].concat(n),s],i=l[0],u=l.reduce((p,x)=>{const y=Lwe(e,x,a);return p.top=Qh(y.top,p.top),p.right=tv(y.right,p.right),p.bottom=tv(y.bottom,p.bottom),p.left=Qh(y.left,p.left),p},Lwe(e,i,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function fQe(t){const{width:e,height:n}=NEe(t);return{width:e,height:n}}function pQe(t,e,n){const s=zg(e),a=Hg(e),o=n==="fixed",l=Wj(t,!0,o,e);let i={scrollLeft:0,scrollTop:0};const u=Pg(0);function p(){u.x=bge(a)}if(s||!s&&!o)if((c3(e)!=="body"||NI(a))&&(i=Gne(e)),s){const w=Wj(e,!0,o,e);u.x=w.x+e.clientLeft,u.y=w.y+e.clientTop}else a&&p();o&&!s&&a&&p();const x=a&&!s&&!o?CEe(a,i):Pg(0),y=l.left+i.scrollLeft-u.x-x.x,_=l.top+i.scrollTop-u.y-x.y;return{x:y,y:_,width:l.width,height:l.height}}function Dle(t){return Tm(t).position==="static"}function Owe(t,e){if(!zg(t)||Tm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Hg(t)===n&&(n=n.ownerDocument.body),n}function TEe(t,e){const n=ff(t);if(Wne(t))return n;if(!zg(t)){let a=rv(t);for(;a&&!pC(a);){if(Mm(a)&&!Dle(a))return a;a=rv(a)}return n}let s=Owe(t,e);for(;s&&YXe(s)&&Dle(s);)s=Owe(s,e);return s&&pC(s)&&Dle(s)&&!yge(s)?n:s||tQe(t)||n}const mQe=async function(t){const e=this.getOffsetParent||TEe,n=this.getDimensions,s=await n(t.floating);return{reference:pQe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function gQe(t){return Tm(t).direction==="rtl"}const xQe={convertOffsetParentRelativeRectToViewportRelativeRect:aQe,getDocumentElement:Hg,getClippingRect:hQe,getOffsetParent:TEe,getElementRects:mQe,getClientRects:iQe,getDimensions:fQe,getScale:ES,isElement:Mm,isRTL:gQe};function AEe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function yQe(t,e){let n=null,s;const a=Hg(t);function o(){var i;clearTimeout(s),(i=n)==null||i.disconnect(),n=null}function l(i,u){i===void 0&&(i=!1),u===void 0&&(u=1),o();const p=t.getBoundingClientRect(),{left:x,top:y,width:_,height:w}=p;if(i||e(),!_||!w)return;const S=_L(y),N=_L(a.clientWidth-(x+_)),M=_L(a.clientHeight-(y+w)),E=_L(x),P={rootMargin:-S+"px "+-N+"px "+-M+"px "+-E+"px",threshold:Qh(0,tv(1,u))||1};let z=!0;function R(U){const V=U[0].intersectionRatio;if(V!==u){if(!z)return l();V?l(!1,V):s=setTimeout(()=>{l(!1,1e-7)},1e3)}V===1&&!AEe(p,t.getBoundingClientRect())&&l(),z=!1}try{n=new IntersectionObserver(R,{...P,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,P)}n.observe(t)}return l(!0),o}function vQe(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:u=!1}=s,p=_ge(t),x=a||o?[...p?aE(p):[],...aE(e)]:[];x.forEach(E=>{a&&E.addEventListener("scroll",n,{passive:!0}),o&&E.addEventListener("resize",n)});const y=p&&i?yQe(p,n):null;let _=-1,w=null;l&&(w=new ResizeObserver(E=>{let[A]=E;A&&A.target===p&&w&&(w.unobserve(e),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var P;(P=w)==null||P.observe(e)})),n()}),p&&!u&&w.observe(p),w.observe(e));let S,N=u?Wj(t):null;u&&M();function M(){const E=Wj(t);N&&!AEe(N,E)&&n(),N=E,S=requestAnimationFrame(M)}return n(),()=>{var E;x.forEach(A=>{a&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),y==null||y(),(E=w)==null||E.disconnect(),w=null,u&&cancelAnimationFrame(S)}}const _Qe=VXe,bQe=HXe,wQe=$Xe,jQe=GXe,kQe=UXe,Dwe=BXe,NQe=WXe,SQe=(t,e,n)=>{const s=new Map,a={platform:xQe,...n},o={...a.platform,_c:s};return zXe(t,e,{...a,platform:o})};var CQe=typeof document<"u",MQe=function(){},fee=CQe?I.useLayoutEffect:MQe;function ate(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(!ate(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)&&!ate(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function EEe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Rwe(t,e){const n=EEe(t);return Math.round(e*n)/n}function Rle(t){const e=I.useRef(t);return fee(()=>{e.current=t}),e}function TQe(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:u,open:p}=t,[x,y]=I.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[_,w]=I.useState(s);ate(_,s)||w(s);const[S,N]=I.useState(null),[M,E]=I.useState(null),A=I.useCallback(he=>{he!==U.current&&(U.current=he,N(he))},[]),P=I.useCallback(he=>{he!==V.current&&(V.current=he,E(he))},[]),z=o||S,R=l||M,U=I.useRef(null),V=I.useRef(null),K=I.useRef(x),W=u!=null,J=Rle(u),ae=Rle(a),oe=Rle(p),xe=I.useCallback(()=>{if(!U.current||!V.current)return;const he={placement:e,strategy:n,middleware:_};ae.current&&(he.platform=ae.current),SQe(U.current,V.current,he).then(ye=>{const Ce={...ye,isPositioned:oe.current!==!1};ie.current&&!ate(K.current,Ce)&&(K.current=Ce,Iy.flushSync(()=>{y(Ce)}))})},[_,e,n,ae,oe]);fee(()=>{p===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,y(he=>({...he,isPositioned:!1})))},[p]);const ie=I.useRef(!1);fee(()=>(ie.current=!0,()=>{ie.current=!1}),[]),fee(()=>{if(z&&(U.current=z),R&&(V.current=R),z&&R){if(J.current)return J.current(z,R,xe);xe()}},[z,R,xe,J,W]);const pe=I.useMemo(()=>({reference:U,floating:V,setReference:A,setFloating:P}),[A,P]),se=I.useMemo(()=>({reference:z,floating:R}),[z,R]),fe=I.useMemo(()=>{const he={position:n,left:0,top:0};if(!se.floating)return he;const ye=Rwe(se.floating,x.x),Ce=Rwe(se.floating,x.y);return i?{...he,transform:"translate("+ye+"px, "+Ce+"px)",...EEe(se.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ye,top:Ce}},[n,i,se.floating,x.x,x.y]);return I.useMemo(()=>({...x,update:xe,refs:pe,elements:se,floatingStyles:fe}),[x,xe,pe,se,fe])}const AQe=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?Dwe({element:s.current,padding:a}).fn(n):{}:s?Dwe({element:s,padding:a}).fn(n):{}}}},EQe=(t,e)=>({..._Qe(t),options:[t,e]}),IQe=(t,e)=>({...bQe(t),options:[t,e]}),PQe=(t,e)=>({...NQe(t),options:[t,e]}),LQe=(t,e)=>({...wQe(t),options:[t,e]}),OQe=(t,e)=>({...jQe(t),options:[t,e]}),DQe=(t,e)=>({...kQe(t),options:[t,e]}),RQe=(t,e)=>({...AQe(t),options:[t,e]});var FQe="Arrow",IEe=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"})})});IEe.displayName=FQe;var zQe=IEe;function SI(t){const[e,n]=I.useState(void 0);return ic(()=>{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 u=o.borderBoxSize,p=Array.isArray(u)?u[0]:u;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 wge="Popper",[PEe,Wg]=lc(wge),[BQe,LEe]=PEe(wge),OEe=t=>{const{__scopePopper:e,children:n}=t,[s,a]=I.useState(null);return r.jsx(BQe,{scope:e,anchor:s,onAnchorChange:a,children:n})};OEe.displayName=wge;var DEe="PopperAnchor",REe=I.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:s,...a}=t,o=LEe(DEe,n),l=I.useRef(null),i=ra(e,l);return I.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Rn.div,{...a,ref:i})});REe.displayName=DEe;var jge="PopperContent",[$Qe,UQe]=PEe(jge),FEe=I.forwardRef((t,e)=>{var Ue,Re,Be,Ye,ht,Me;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:u=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:_=!1,updatePositionStrategy:w="optimized",onPlaced:S,...N}=t,M=LEe(jge,n),[E,A]=I.useState(null),P=ra(e,Qe=>A(Qe)),[z,R]=I.useState(null),U=SI(z),V=(U==null?void 0:U.width)??0,K=(U==null?void 0:U.height)??0,W=s+(o!=="center"?"-"+o:""),J=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ae=Array.isArray(p)?p:[p],oe=ae.length>0,xe={padding:J,boundary:ae.filter(VQe),altBoundary:oe},{refs:ie,floatingStyles:pe,placement:se,isPositioned:fe,middlewareData:he}=TQe({strategy:"fixed",placement:W,whileElementsMounted:(...Qe)=>vQe(...Qe,{animationFrame:w==="always"}),elements:{reference:M.anchor},middleware:[EQe({mainAxis:a+K,alignmentAxis:l}),u&&IQe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?PQe():void 0,...xe}),u&&LQe({...xe}),OQe({...xe,apply:({elements:Qe,rects:le,availableWidth:Ve,availableHeight:Le})=>{const{width:We,height:_e}=le.reference,st=Qe.floating.style;st.setProperty("--radix-popper-available-width",`${Ve}px`),st.setProperty("--radix-popper-available-height",`${Le}px`),st.setProperty("--radix-popper-anchor-width",`${We}px`),st.setProperty("--radix-popper-anchor-height",`${_e}px`)}}),z&&RQe({element:z,padding:i}),HQe({arrowWidth:V,arrowHeight:K}),_&&DQe({strategy:"referenceHidden",...xe})]}),[ye,Ce]=$Ee(se),Se=nc(S);ic(()=>{fe&&(Se==null||Se())},[fe,Se]);const Ne=(Ue=he.arrow)==null?void 0:Ue.x,be=(Re=he.arrow)==null?void 0:Re.y,rt=((Be=he.arrow)==null?void 0:Be.centerOffset)!==0,[Te,Pe]=I.useState();return ic(()=>{E&&Pe(window.getComputedStyle(E).zIndex)},[E]),r.jsx("div",{ref:ie.setFloating,"data-radix-popper-content-wrapper":"",style:{...pe,transform:fe?pe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Te,"--radix-popper-transform-origin":[(Ye=he.transformOrigin)==null?void 0:Ye.x,(ht=he.transformOrigin)==null?void 0:ht.y].join(" "),...((Me=he.hide)==null?void 0:Me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:r.jsx($Qe,{scope:n,placedSide:ye,onArrowChange:R,arrowX:Ne,arrowY:be,shouldHideArrow:rt,children:r.jsx(Rn.div,{"data-side":ye,"data-align":Ce,...N,ref:P,style:{...N.style,animation:fe?void 0:"none"}})})})});FEe.displayName=jge;var zEe="PopperArrow",qQe={top:"bottom",right:"left",bottom:"top",left:"right"},BEe=I.forwardRef(function(e,n){const{__scopePopper:s,...a}=e,o=UQe(zEe,s),l=qQe[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(zQe,{...a,ref:n,style:{...a.style,display:"block"}})})});BEe.displayName=zEe;function VQe(t){return t!==null}var HQe=t=>({name:"transformOrigin",options:t,fn(e){var M,E,A;const{placement:n,rects:s,middlewareData:a}=e,l=((M=a.arrow)==null?void 0:M.centerOffset)!==0,i=l?0:t.arrowWidth,u=l?0:t.arrowHeight,[p,x]=$Ee(n),y={start:"0%",center:"50%",end:"100%"}[x],_=(((E=a.arrow)==null?void 0:E.x)??0)+i/2,w=(((A=a.arrow)==null?void 0:A.y)??0)+u/2;let S="",N="";return p==="bottom"?(S=l?y:`${_}px`,N=`${-u}px`):p==="top"?(S=l?y:`${_}px`,N=`${s.floating.height+u}px`):p==="right"?(S=`${-u}px`,N=l?y:`${w}px`):p==="left"&&(S=`${s.floating.width+u}px`,N=l?y:`${w}px`),{data:{x:S,y:N}}}});function $Ee(t){const[e,n="center"]=t.split("-");return[e,n]}var CI=OEe,d3=REe,MI=FEe,TI=BEe,[Kne]=lc("Tooltip",[Wg]),Zne=Wg(),UEe="TooltipProvider",WQe=700,Oue="tooltip.open",[GQe,kge]=Kne(UEe),qEe=t=>{const{__scopeTooltip:e,delayDuration:n=WQe,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:o}=t,l=I.useRef(!0),i=I.useRef(!1),u=I.useRef(0);return I.useEffect(()=>{const p=u.current;return()=>window.clearTimeout(p)},[]),r.jsx(GQe,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(u.current),l.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:I.useCallback(p=>{i.current=p},[]),disableHoverableContent:a,children:o})};qEe.displayName=UEe;var iE="Tooltip",[KQe,Yne]=Kne(iE),VEe=t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=t,u=kge(iE,t.__scopeTooltip),p=Zne(e),[x,y]=I.useState(null),_=Qc(),w=I.useRef(0),S=l??u.disableHoverableContent,N=i??u.delayDuration,M=I.useRef(!1),[E,A]=Ku({prop:s,defaultProp:a??!1,onChange:V=>{V?(u.onOpen(),document.dispatchEvent(new CustomEvent(Oue))):u.onClose(),o==null||o(V)},caller:iE}),P=I.useMemo(()=>E?M.current?"delayed-open":"instant-open":"closed",[E]),z=I.useCallback(()=>{window.clearTimeout(w.current),w.current=0,M.current=!1,A(!0)},[A]),R=I.useCallback(()=>{window.clearTimeout(w.current),w.current=0,A(!1)},[A]),U=I.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{M.current=!0,A(!0),w.current=0},N)},[N,A]);return I.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),r.jsx(CI,{...p,children:r.jsx(KQe,{scope:e,contentId:_,open:E,stateAttribute:P,trigger:x,onTriggerChange:y,onTriggerEnter:I.useCallback(()=>{u.isOpenDelayedRef.current?U():z()},[u.isOpenDelayedRef,U,z]),onTriggerLeave:I.useCallback(()=>{S?R():(window.clearTimeout(w.current),w.current=0)},[R,S]),onOpen:z,onClose:R,disableHoverableContent:S,children:n})})};VEe.displayName=iE;var Due="TooltipTrigger",HEe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,a=Yne(Due,n),o=kge(Due,n),l=Zne(n),i=I.useRef(null),u=ra(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(d3,{asChild:!0,...l,children:r.jsx(Rn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:u,onPointerMove:cn(t.onPointerMove,_=>{_.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:cn(t.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:cn(t.onPointerDown,()=>{a.open&&a.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:cn(t.onFocus,()=>{p.current||a.onOpen()}),onBlur:cn(t.onBlur,a.onClose),onClick:cn(t.onClick,a.onClose)})})});HEe.displayName=Due;var ZQe="TooltipPortal",[ZYt,YQe]=Kne(ZQe,{forceMount:void 0}),mC="TooltipContent",WEe=I.forwardRef((t,e)=>{const n=YQe(mC,t.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...o}=t,l=Yne(mC,t.__scopeTooltip);return r.jsx(jc,{present:s||l.open,children:l.disableHoverableContent?r.jsx(GEe,{side:a,...o,ref:e}):r.jsx(XQe,{side:a,...o,ref:e})})}),XQe=I.forwardRef((t,e)=>{const n=Yne(mC,t.__scopeTooltip),s=kge(mC,t.__scopeTooltip),a=I.useRef(null),o=ra(e,a),[l,i]=I.useState(null),{trigger:u,onClose:p}=n,x=a.current,{onPointerInTransitChange:y}=s,_=I.useCallback(()=>{i(null),y(!1)},[y]),w=I.useCallback((S,N)=>{const M=S.currentTarget,E={x:S.clientX,y:S.clientY},A=rJe(E,M.getBoundingClientRect()),P=nJe(E,A),z=sJe(N.getBoundingClientRect()),R=iJe([...P,...z]);i(R),y(!0)},[y]);return I.useEffect(()=>()=>_(),[_]),I.useEffect(()=>{if(u&&x){const S=M=>w(M,x),N=M=>w(M,u);return u.addEventListener("pointerleave",S),x.addEventListener("pointerleave",N),()=>{u.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",N)}}},[u,x,w,_]),I.useEffect(()=>{if(l){const S=N=>{const M=N.target,E={x:N.clientX,y:N.clientY},A=(u==null?void 0:u.contains(M))||(x==null?void 0:x.contains(M)),P=!aJe(E,l);A?_():P&&(_(),p())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[u,x,l,p,_]),r.jsx(GEe,{...t,ref:o})}),[QQe,JQe]=Kne(iE,{isInside:!1}),eJe=RAe("TooltipContent"),GEe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=t,u=Yne(mC,n),p=Zne(n),{onClose:x}=u;return I.useEffect(()=>(document.addEventListener(Oue,x),()=>document.removeEventListener(Oue,x)),[x]),I.useEffect(()=>{if(u.trigger){const y=_=>{const w=_.target;w!=null&&w.contains(u.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[u.trigger,x]),r.jsx(uv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(MI,{"data-state":u.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(eJe,{children:s}),r.jsx(QQe,{scope:n,isInside:!0,children:r.jsx(VZe,{id:u.contentId,role:"tooltip",children:a||s})})]})})});WEe.displayName=mC;var KEe="TooltipArrow",tJe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,a=Zne(n);return JQe(KEe,n).isInside?null:r.jsx(TI,{...a,...s,ref:e})});tJe.displayName=KEe;function rJe(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 nJe(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 sJe(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 aJe(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 iJe(t){const e=t.slice();return e.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),oJe(e)}function oJe(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 lJe=qEe,cJe=VEe,dJe=HEe,ZEe=WEe;const AI=lJe,Lg=cJe,Og=dJe,Nm=I.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(ZEe,{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}));Nm.displayName=ZEe.displayName;var u3=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(){}},Gj=typeof window>"u"||"Deno"in globalThis;function zu(){}function uJe(t,e){return typeof t=="function"?t(e):t}function Rue(t){return typeof t=="number"&&t>=0&&t!==1/0}function YEe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function U1(t,e){return typeof t=="function"?t(e):t}function qf(t,e){return typeof t=="function"?t(e):t}function Fwe(t,e){const{type:n="all",exact:s,fetchStatus:a,predicate:o,queryKey:l,stale:i}=t;if(l){if(s){if(e.queryHash!==Nge(l,e.options))return!1}else if(!oE(e.queryKey,l))return!1}if(n!=="all"){const u=e.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof i=="boolean"&&e.isStale()!==i||a&&a!==e.state.fetchStatus||o&&!o(e))}function zwe(t,e){const{exact:n,status:s,predicate:a,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(Kj(e.options.mutationKey)!==Kj(o))return!1}else if(!oE(e.options.mutationKey,o))return!1}return!(s&&e.state.status!==s||a&&!a(e))}function Nge(t,e){return((e==null?void 0:e.queryKeyHashFn)||Kj)(t)}function Kj(t){return JSON.stringify(t,(e,n)=>Fue(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function oE(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>oE(t[n],e[n])):!1}function XEe(t,e){if(t===e)return t;const n=Bwe(t)&&Bwe(e);if(n||Fue(t)&&Fue(e)){const s=n?t:Object.keys(t),a=s.length,o=n?e:Object.keys(e),l=o.length,i=n?[]:{},u=new Set(s);let p=0;for(let x=0;x{setTimeout(e,t)})}function zue(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?XEe(t,e):e}function fJe(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function pJe(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}var Sge=Symbol();function QEe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Sge?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function JEe(t,e){return typeof t=="function"?t(...e):!!t}var aj,e1,ZS,hMe,mJe=(hMe=class extends u3{constructor(){super();da(this,aj);da(this,e1);da(this,ZS);fs(this,ZS,e=>{if(!Gj&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){er(this,e1)||this.setEventListener(er(this,ZS))}onUnsubscribe(){var e;this.hasListeners()||((e=er(this,e1))==null||e.call(this),fs(this,e1,void 0))}setEventListener(e){var n;fs(this,ZS,e),(n=er(this,e1))==null||n.call(this),fs(this,e1,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){er(this,aj)!==e&&(fs(this,aj,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof er(this,aj)=="boolean"?er(this,aj):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},aj=new WeakMap,e1=new WeakMap,ZS=new WeakMap,hMe),Cge=new mJe,YS,t1,XS,fMe,gJe=(fMe=class extends u3{constructor(){super();da(this,YS,!0);da(this,t1);da(this,XS);fs(this,XS,e=>{if(!Gj&&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,t1)||this.setEventListener(er(this,XS))}onUnsubscribe(){var e;this.hasListeners()||((e=er(this,t1))==null||e.call(this),fs(this,t1,void 0))}setEventListener(e){var n;fs(this,XS,e),(n=er(this,t1))==null||n.call(this),fs(this,t1,e(this.setOnline.bind(this)))}setOnline(e){er(this,YS)!==e&&(fs(this,YS,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return er(this,YS)}},YS=new WeakMap,t1=new WeakMap,XS=new WeakMap,fMe),ote=new gJe;function Bue(){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 xJe(t){return Math.min(1e3*2**t,3e4)}function eIe(t){return(t??"online")==="online"?ote.isOnline():!0}var tIe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Fle(t){return t instanceof tIe}function rIe(t){let e=!1,n=0,s=!1,a;const o=Bue(),l=N=>{var M;s||(_(new tIe(N)),(M=t.abort)==null||M.call(t))},i=()=>{e=!0},u=()=>{e=!1},p=()=>Cge.isFocused()&&(t.networkMode==="always"||ote.isOnline())&&t.canRun(),x=()=>eIe(t.networkMode)&&t.canRun(),y=N=>{var M;s||(s=!0,(M=t.onSuccess)==null||M.call(t,N),a==null||a(),o.resolve(N))},_=N=>{var M;s||(s=!0,(M=t.onError)==null||M.call(t,N),a==null||a(),o.reject(N))},w=()=>new Promise(N=>{var M;a=E=>{(s||p())&&N(E)},(M=t.onPause)==null||M.call(t)}).then(()=>{var N;a=void 0,s||(N=t.onContinue)==null||N.call(t)}),S=()=>{if(s)return;let N;const M=n===0?t.initialPromise:void 0;try{N=M??t.fn()}catch(E){N=Promise.reject(E)}Promise.resolve(N).then(y).catch(E=>{var U;if(s)return;const A=t.retry??(Gj?0:3),P=t.retryDelay??xJe,z=typeof P=="function"?P(n,E):P,R=A===!0||typeof A=="number"&&np()?void 0:w()).then(()=>{e?_(E):S()})})};return{promise:o,cancel:l,continue:()=>(a==null||a(),o),cancelRetry:i,continueRetry:u,canStart:x,start:()=>(x()?S():w().then(S),o)}}var yJe=t=>setTimeout(t,0);function vJe(){let t=[],e=0,n=i=>{i()},s=i=>{i()},a=yJe;const o=i=>{e?t.push(i):a(()=>{n(i)})},l=()=>{const i=t;t=[],i.length&&a(()=>{s(()=>{i.forEach(u=>{n(u)})})})};return{batch:i=>{let u;e++;try{u=i()}finally{e--,e||l()}return u},batchCalls:i=>(...u)=>{o(()=>{i(...u)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{a=i}}}var Zc=vJe(),ij,pMe,nIe=(pMe=class{constructor(){da(this,ij)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Rue(this.gcTime)&&fs(this,ij,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Gj?1/0:5*60*1e3))}clearGcTimeout(){er(this,ij)&&(clearTimeout(er(this,ij)),fs(this,ij,void 0))}},ij=new WeakMap,pMe),QS,oj,Uf,lj,lu,pI,cj,tm,Mx,mMe,_Je=(mMe=class extends nIe{constructor(e){super();da(this,tm);da(this,QS);da(this,oj);da(this,Uf);da(this,lj);da(this,lu);da(this,pI);da(this,cj);fs(this,cj,!1),fs(this,pI,e.defaultOptions),this.setOptions(e.options),this.observers=[],fs(this,lj,e.client),fs(this,Uf,er(this,lj).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,fs(this,QS,bJe(this.options)),this.state=e.state??er(this,QS),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=er(this,lu))==null?void 0:e.promise}setOptions(e){this.options={...er(this,pI),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&er(this,Uf).remove(this)}setData(e,n){const s=zue(this.state.data,e,this.options);return di(this,tm,Mx).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e,n){di(this,tm,Mx).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var s,a;const n=(s=er(this,lu))==null?void 0:s.promise;return(a=er(this,lu))==null||a.cancel(e),n?n.then(zu).catch(zu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(er(this,QS))}isActive(){return this.observers.some(e=>qf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Sge||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>U1(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:!YEe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=er(this,lu))==null||n.continue()}onOnline(){var n;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=er(this,lu))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),er(this,Uf).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,lu)&&(er(this,cj)?er(this,lu).cancel({revert:!0}):er(this,lu).cancelRetry()),this.scheduleGc()),er(this,Uf).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||di(this,tm,Mx).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,lu))return er(this,lu).continueRetry(),er(this,lu).promise}if(e&&this.setOptions(e),!this.options.queryFn){const _=this.observers.find(w=>w.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,a=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(fs(this,cj,!0),s.signal)})},o=()=>{const _=QEe(this.options,n),S=(()=>{const N={client:er(this,lj),queryKey:this.queryKey,meta:this.meta};return a(N),N})();return fs(this,cj,!1),this.options.persister?this.options.persister(_,S,this):_(S)},i=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:er(this,lj),state:this.state,fetchFn:o};return a(_),_})();(p=this.options.behavior)==null||p.onFetch(i,this),fs(this,oj,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&di(this,tm,Mx).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const u=_=>{var w,S,N,M;Fle(_)&&_.silent||di(this,tm,Mx).call(this,{type:"error",error:_}),Fle(_)||((S=(w=er(this,Uf).config).onError)==null||S.call(w,_,this),(M=(N=er(this,Uf).config).onSettled)==null||M.call(N,this.state.data,_,this)),this.scheduleGc()};return fs(this,lu,rIe({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onSuccess:_=>{var w,S,N,M;if(_===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(_)}catch(E){u(E);return}(S=(w=er(this,Uf).config).onSuccess)==null||S.call(w,_,this),(M=(N=er(this,Uf).config).onSettled)==null||M.call(N,_,this.state.error,this),this.scheduleGc()},onError:u,onFail:(_,w)=>{di(this,tm,Mx).call(this,{type:"failed",failureCount:_,error:w})},onPause:()=>{di(this,tm,Mx).call(this,{type:"pause"})},onContinue:()=>{di(this,tm,Mx).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),er(this,lu).start()}},QS=new WeakMap,oj=new WeakMap,Uf=new WeakMap,lj=new WeakMap,lu=new WeakMap,pI=new WeakMap,cj=new WeakMap,tm=new WeakSet,Mx=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,...sIe(s.data,this.options),fetchMeta:e.meta??null};case"success":return fs(this,oj,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 Fle(a)&&a.revert&&er(this,oj)?{...er(this,oj),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),Zc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),er(this,Uf).notify({query:this,type:"updated",action:e})})},mMe);function sIe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eIe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function bJe(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 dg,gMe,wJe=(gMe=class extends u3{constructor(e={}){super();da(this,dg);this.config=e,fs(this,dg,new Map)}build(e,n,s){const a=n.queryKey,o=n.queryHash??Nge(a,n);let l=this.get(o);return l||(l=new _Je({client:e,queryKey:a,queryHash:o,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(a)}),this.add(l)),l}add(e){er(this,dg).has(e.queryHash)||(er(this,dg).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=er(this,dg).get(e.queryHash);n&&(e.destroy(),n===e&&er(this,dg).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Zc.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return er(this,dg).get(e)}getAll(){return[...er(this,dg).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Fwe(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>Fwe(e,s)):n}notify(e){Zc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Zc.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Zc.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},dg=new WeakMap,gMe),ug,Du,dj,hg,T0,xMe,jJe=(xMe=class extends nIe{constructor(e){super();da(this,hg);da(this,ug);da(this,Du);da(this,dj);this.mutationId=e.mutationId,fs(this,Du,e.mutationCache),fs(this,ug,[]),this.state=e.state||aIe(),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,ug).includes(e)||(er(this,ug).push(e),this.clearGcTimeout(),er(this,Du).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){fs(this,ug,er(this,ug).filter(n=>n!==e)),this.scheduleGc(),er(this,Du).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){er(this,ug).length||(this.state.status==="pending"?this.scheduleGc():er(this,Du).remove(this))}continue(){var e;return((e=er(this,dj))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,l,i,u,p,x,y,_,w,S,N,M,E,A,P,z,R,U,V,K;const n=()=>{di(this,hg,T0).call(this,{type:"continue"})};fs(this,dj,rIe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(W,J)=>{di(this,hg,T0).call(this,{type:"failed",failureCount:W,error:J})},onPause:()=>{di(this,hg,T0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>er(this,Du).canRun(this)}));const s=this.state.status==="pending",a=!er(this,dj).canStart();try{if(s)n();else{di(this,hg,T0).call(this,{type:"pending",variables:e,isPaused:a}),await((l=(o=er(this,Du).config).onMutate)==null?void 0:l.call(o,e,this));const J=await((u=(i=this.options).onMutate)==null?void 0:u.call(i,e));J!==this.state.context&&di(this,hg,T0).call(this,{type:"pending",context:J,variables:e,isPaused:a})}const W=await er(this,dj).start();return await((x=(p=er(this,Du).config).onSuccess)==null?void 0:x.call(p,W,e,this.state.context,this)),await((_=(y=this.options).onSuccess)==null?void 0:_.call(y,W,e,this.state.context)),await((S=(w=er(this,Du).config).onSettled)==null?void 0:S.call(w,W,null,this.state.variables,this.state.context,this)),await((M=(N=this.options).onSettled)==null?void 0:M.call(N,W,null,e,this.state.context)),di(this,hg,T0).call(this,{type:"success",data:W}),W}catch(W){try{throw await((A=(E=er(this,Du).config).onError)==null?void 0:A.call(E,W,e,this.state.context,this)),await((z=(P=this.options).onError)==null?void 0:z.call(P,W,e,this.state.context)),await((U=(R=er(this,Du).config).onSettled)==null?void 0:U.call(R,void 0,W,this.state.variables,this.state.context,this)),await((K=(V=this.options).onSettled)==null?void 0:K.call(V,void 0,W,e,this.state.context)),W}finally{di(this,hg,T0).call(this,{type:"error",error:W})}}finally{er(this,Du).runNext(this)}}},ug=new WeakMap,Du=new WeakMap,dj=new WeakMap,hg=new WeakSet,T0=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),Zc.batch(()=>{er(this,ug).forEach(s=>{s.onMutationUpdate(e)}),er(this,Du).notify({mutation:this,type:"updated",action:e})})},xMe);function aIe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fx,rm,mI,yMe,kJe=(yMe=class extends u3{constructor(e={}){super();da(this,Fx);da(this,rm);da(this,mI);this.config=e,fs(this,Fx,new Set),fs(this,rm,new Map),fs(this,mI,0)}build(e,n,s){const a=new jJe({mutationCache:this,mutationId:++J6(this,mI)._,options:e.defaultMutationOptions(n),state:s});return this.add(a),a}add(e){er(this,Fx).add(e);const n=bL(e);if(typeof n=="string"){const s=er(this,rm).get(n);s?s.push(e):er(this,rm).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(er(this,Fx).delete(e)){const n=bL(e);if(typeof n=="string"){const s=er(this,rm).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,rm).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=bL(e);if(typeof n=="string"){const s=er(this,rm).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=bL(e);if(typeof n=="string"){const a=(s=er(this,rm).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(){Zc.batch(()=>{er(this,Fx).forEach(e=>{this.notify({type:"removed",mutation:e})}),er(this,Fx).clear(),er(this,rm).clear()})}getAll(){return Array.from(er(this,Fx))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>zwe(n,s))}findAll(e={}){return this.getAll().filter(n=>zwe(e,n))}notify(e){Zc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Zc.batch(()=>Promise.all(e.map(n=>n.continue().catch(zu))))}},Fx=new WeakMap,rm=new WeakMap,mI=new WeakMap,yMe);function bL(t){var e;return(e=t.options.scope)==null?void 0:e.id}function lte(t){return{onFetch:(e,n)=>{var x,y,_,w,S;const s=e.options,a=(_=(y=(x=e.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:_.direction,o=((w=e.state.data)==null?void 0:w.pages)||[],l=((S=e.state.data)==null?void 0:S.pageParams)||[];let i={pages:[],pageParams:[]},u=0;const p=async()=>{let N=!1;const M=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(e.signal.aborted?N=!0:e.signal.addEventListener("abort",()=>{N=!0}),e.signal)})},E=QEe(e.options,e.fetchOptions),A=async(P,z,R)=>{if(N)return Promise.reject();if(z==null&&P.pages.length)return Promise.resolve(P);const V=(()=>{const ae={client:e.client,queryKey:e.queryKey,pageParam:z,direction:R?"backward":"forward",meta:e.options.meta};return M(ae),ae})(),K=await E(V),{maxPages:W}=e.options,J=R?pJe:fJe;return{pages:J(P.pages,K,W),pageParams:J(P.pageParams,z,W)}};if(a&&o.length){const P=a==="backward",z=P?iIe:$ue,R={pages:o,pageParams:l},U=z(s,R);i=await A(R,U,P)}else{const P=t??o.length;do{const z=u===0?l[0]??s.initialPageParam:$ue(s,i);if(u>0&&z==null)break;i=await A(i,z),u++}while(u{var N,M;return(M=(N=e.options).persister)==null?void 0:M.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 iIe(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 NJe(t,e){return e?$ue(t,e)!=null:!1}function SJe(t,e){return!e||!t.getPreviousPageParam?!1:iIe(t,e)!=null}var Zl,r1,n1,JS,eC,s1,tC,rC,vMe,CJe=(vMe=class{constructor(t={}){da(this,Zl);da(this,r1);da(this,n1);da(this,JS);da(this,eC);da(this,s1);da(this,tC);da(this,rC);fs(this,Zl,t.queryCache||new wJe),fs(this,r1,t.mutationCache||new kJe),fs(this,n1,t.defaultOptions||{}),fs(this,JS,new Map),fs(this,eC,new Map),fs(this,s1,0)}mount(){J6(this,s1)._++,er(this,s1)===1&&(fs(this,tC,Cge.subscribe(async t=>{t&&(await this.resumePausedMutations(),er(this,Zl).onFocus())})),fs(this,rC,ote.subscribe(async t=>{t&&(await this.resumePausedMutations(),er(this,Zl).onOnline())})))}unmount(){var t,e;J6(this,s1)._--,er(this,s1)===0&&((t=er(this,tC))==null||t.call(this),fs(this,tC,void 0),(e=er(this,rC))==null||e.call(this),fs(this,rC,void 0))}isFetching(t){return er(this,Zl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return er(this,r1).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=er(this,Zl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=er(this,Zl).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(U1(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return er(this,Zl).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,Zl).get(s.queryHash),o=a==null?void 0:a.state.data,l=uJe(e,o);if(l!==void 0)return er(this,Zl).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return Zc.batch(()=>er(this,Zl).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,Zl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=er(this,Zl);Zc.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=er(this,Zl);return Zc.batch(()=>(n.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},s=Zc.batch(()=>er(this,Zl).findAll(t).map(a=>a.cancel(n)));return Promise.all(s).then(zu).catch(zu)}invalidateQueries(t,e={}){return Zc.batch(()=>(er(this,Zl).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=Zc.batch(()=>er(this,Zl).findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,n);return n.throwOnError||(o=o.catch(zu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(zu)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=er(this,Zl).build(this,e);return n.isStaleByTime(U1(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(zu).catch(zu)}fetchInfiniteQuery(t){return t.behavior=lte(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(zu).catch(zu)}ensureInfiniteQueryData(t){return t.behavior=lte(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ote.isOnline()?er(this,r1).resumePausedMutations():Promise.resolve()}getQueryCache(){return er(this,Zl)}getMutationCache(){return er(this,r1)}getDefaultOptions(){return er(this,n1)}setDefaultOptions(t){fs(this,n1,t)}setQueryDefaults(t,e){er(this,JS).set(Kj(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...er(this,JS).values()],n={};return e.forEach(s=>{oE(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){er(this,eC).set(Kj(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...er(this,eC).values()],n={};return e.forEach(s=>{oE(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...er(this,n1).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Nge(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===Sge&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...er(this,n1).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){er(this,Zl).clear(),er(this,r1).clear()}},Zl=new WeakMap,r1=new WeakMap,n1=new WeakMap,JS=new WeakMap,eC=new WeakMap,s1=new WeakMap,tC=new WeakMap,rC=new WeakMap,vMe),hh,Hi,gI,Ru,uj,nC,a1,i1,xI,sC,aC,hj,fj,o1,iC,xo,xT,Uue,que,Vue,Hue,Wue,Gue,Kue,lIe,_Me,oIe=(_Me=class extends u3{constructor(e,n){super();da(this,xo);da(this,hh);da(this,Hi);da(this,gI);da(this,Ru);da(this,uj);da(this,nC);da(this,a1);da(this,i1);da(this,xI);da(this,sC);da(this,aC);da(this,hj);da(this,fj);da(this,o1);da(this,iC,new Set);this.options=n,fs(this,hh,e),fs(this,i1,null),fs(this,a1,Bue()),this.options.experimental_prefetchInRender||er(this,a1).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,Hi).addObserver(this),Uwe(er(this,Hi),this.options)?di(this,xo,xT).call(this):this.updateResult(),di(this,xo,Hue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zue(er(this,Hi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zue(er(this,Hi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,di(this,xo,Wue).call(this),di(this,xo,Gue).call(this),er(this,Hi).removeObserver(this)}setOptions(e){const n=this.options,s=er(this,Hi);if(this.options=er(this,hh).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof qf(this.options.enabled,er(this,Hi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");di(this,xo,Kue).call(this),er(this,Hi).setOptions(this.options),n._defaulted&&!ite(this.options,n)&&er(this,hh).getQueryCache().notify({type:"observerOptionsUpdated",query:er(this,Hi),observer:this});const a=this.hasListeners();a&&qwe(er(this,Hi),s,this.options,n)&&di(this,xo,xT).call(this),this.updateResult(),a&&(er(this,Hi)!==s||qf(this.options.enabled,er(this,Hi))!==qf(n.enabled,er(this,Hi))||U1(this.options.staleTime,er(this,Hi))!==U1(n.staleTime,er(this,Hi)))&&di(this,xo,Uue).call(this);const o=di(this,xo,que).call(this);a&&(er(this,Hi)!==s||qf(this.options.enabled,er(this,Hi))!==qf(n.enabled,er(this,Hi))||o!==er(this,o1))&&di(this,xo,Vue).call(this,o)}getOptimisticResult(e){const n=er(this,hh).getQueryCache().build(er(this,hh),e),s=this.createResult(n,e);return TJe(this,s)&&(fs(this,Ru,s),fs(this,nC,this.options),fs(this,uj,er(this,Hi).state)),s}getCurrentResult(){return er(this,Ru)}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,iC).add(e)}getCurrentQuery(){return er(this,Hi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=er(this,hh).defaultQueryOptions(e),s=er(this,hh).getQueryCache().build(er(this,hh),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(e){return di(this,xo,xT).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),er(this,Ru)))}createResult(e,n){var W;const s=er(this,Hi),a=this.options,o=er(this,Ru),l=er(this,uj),i=er(this,nC),p=e!==s?e.state:er(this,gI),{state:x}=e;let y={...x},_=!1,w;if(n._optimisticResults){const J=this.hasListeners(),ae=!J&&Uwe(e,n),oe=J&&qwe(e,s,n,a);(ae||oe)&&(y={...y,...sIe(x.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:S,errorUpdatedAt:N,status:M}=y;w=y.data;let E=!1;if(n.placeholderData!==void 0&&w===void 0&&M==="pending"){let J;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(J=o.data,E=!0):J=typeof n.placeholderData=="function"?n.placeholderData((W=er(this,aC))==null?void 0:W.state.data,er(this,aC)):n.placeholderData,J!==void 0&&(M="success",w=zue(o==null?void 0:o.data,J,n),_=!0)}if(n.select&&w!==void 0&&!E)if(o&&w===(l==null?void 0:l.data)&&n.select===er(this,xI))w=er(this,sC);else try{fs(this,xI,n.select),w=n.select(w),w=zue(o==null?void 0:o.data,w,n),fs(this,sC,w),fs(this,i1,null)}catch(J){fs(this,i1,J)}er(this,i1)&&(S=er(this,i1),w=er(this,sC),N=Date.now(),M="error");const A=y.fetchStatus==="fetching",P=M==="pending",z=M==="error",R=P&&A,U=w!==void 0,K={status:M,fetchStatus:y.fetchStatus,isPending:P,isSuccess:M==="success",isError:z,isInitialLoading:R,isLoading:R,data:w,dataUpdatedAt:y.dataUpdatedAt,error:S,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:A,isRefetching:A&&!P,isLoadingError:z&&!U,isPaused:y.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:z&&U,isStale:Mge(e,n),refetch:this.refetch,promise:er(this,a1),isEnabled:qf(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const J=xe=>{K.status==="error"?xe.reject(K.error):K.data!==void 0&&xe.resolve(K.data)},ae=()=>{const xe=fs(this,a1,K.promise=Bue());J(xe)},oe=er(this,a1);switch(oe.status){case"pending":e.queryHash===s.queryHash&&J(oe);break;case"fulfilled":(K.status==="error"||K.data!==oe.value)&&ae();break;case"rejected":(K.status!=="error"||K.error!==oe.reason)&&ae();break}}return K}updateResult(){const e=er(this,Ru),n=this.createResult(er(this,Hi),this.options);if(fs(this,uj,er(this,Hi).state),fs(this,nC,this.options),er(this,uj).data!==void 0&&fs(this,aC,er(this,Hi)),ite(n,e))return;fs(this,Ru,n);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!er(this,iC).size)return!0;const l=new Set(o??er(this,iC));return this.options.throwOnError&&l.add("error"),Object.keys(er(this,Ru)).some(i=>{const u=i;return er(this,Ru)[u]!==e[u]&&l.has(u)})};di(this,xo,lIe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&di(this,xo,Hue).call(this)}},hh=new WeakMap,Hi=new WeakMap,gI=new WeakMap,Ru=new WeakMap,uj=new WeakMap,nC=new WeakMap,a1=new WeakMap,i1=new WeakMap,xI=new WeakMap,sC=new WeakMap,aC=new WeakMap,hj=new WeakMap,fj=new WeakMap,o1=new WeakMap,iC=new WeakMap,xo=new WeakSet,xT=function(e){di(this,xo,Kue).call(this);let n=er(this,Hi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(zu)),n},Uue=function(){di(this,xo,Wue).call(this);const e=U1(this.options.staleTime,er(this,Hi));if(Gj||er(this,Ru).isStale||!Rue(e))return;const s=YEe(er(this,Ru).dataUpdatedAt,e)+1;fs(this,hj,setTimeout(()=>{er(this,Ru).isStale||this.updateResult()},s))},que=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(er(this,Hi)):this.options.refetchInterval)??!1},Vue=function(e){di(this,xo,Gue).call(this),fs(this,o1,e),!(Gj||qf(this.options.enabled,er(this,Hi))===!1||!Rue(er(this,o1))||er(this,o1)===0)&&fs(this,fj,setInterval(()=>{(this.options.refetchIntervalInBackground||Cge.isFocused())&&di(this,xo,xT).call(this)},er(this,o1)))},Hue=function(){di(this,xo,Uue).call(this),di(this,xo,Vue).call(this,di(this,xo,que).call(this))},Wue=function(){er(this,hj)&&(clearTimeout(er(this,hj)),fs(this,hj,void 0))},Gue=function(){er(this,fj)&&(clearInterval(er(this,fj)),fs(this,fj,void 0))},Kue=function(){const e=er(this,hh).getQueryCache().build(er(this,hh),this.options);if(e===er(this,Hi))return;const n=er(this,Hi);fs(this,Hi,e),fs(this,gI,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},lIe=function(e){Zc.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(er(this,Ru))}),er(this,hh).getQueryCache().notify({query:er(this,Hi),type:"observerResultsUpdated"})})},_Me);function MJe(t,e){return qf(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Uwe(t,e){return MJe(t,e)||t.state.data!==void 0&&Zue(t,e,e.refetchOnMount)}function Zue(t,e,n){if(qf(e.enabled,t)!==!1&&U1(e.staleTime,t)!=="static"){const s=typeof n=="function"?n(t):n;return s==="always"||s!==!1&&Mge(t,e)}return!1}function qwe(t,e,n,s){return(t!==e||qf(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Mge(t,n)}function Mge(t,e){return qf(e.enabled,t)!==!1&&t.isStaleByTime(U1(e.staleTime,t))}function TJe(t,e){return!ite(t.getCurrentResult(),e)}var AJe=class extends oIe{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:lte()})}getOptimisticResult(t){return t.behavior=lte(),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 S,N;const{state:n}=t,s=super.createResult(t,e),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=s,u=(N=(S=n.fetchMeta)==null?void 0:S.fetchMore)==null?void 0:N.direction,p=l&&u==="forward",x=a&&u==="forward",y=l&&u==="backward",_=a&&u==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:NJe(e,n.data),hasPreviousPage:SJe(e,n.data),isFetchNextPageError:p,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:_,isRefetchError:i&&!p&&!y,isRefetching:o&&!x&&!_}}},l1,c1,fh,zx,uy,pee,Yue,bMe,EJe=(bMe=class extends u3{constructor(n,s){super();da(this,uy);da(this,l1);da(this,c1);da(this,fh);da(this,zx);fs(this,l1,n),this.setOptions(s),this.bindMethods(),di(this,uy,pee).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,l1).defaultMutationOptions(n),ite(this.options,s)||er(this,l1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:er(this,fh),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Kj(s.mutationKey)!==Kj(this.options.mutationKey)?this.reset():((a=er(this,fh))==null?void 0:a.state.status)==="pending"&&er(this,fh).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=er(this,fh))==null||n.removeObserver(this)}onMutationUpdate(n){di(this,uy,pee).call(this),di(this,uy,Yue).call(this,n)}getCurrentResult(){return er(this,c1)}reset(){var n;(n=er(this,fh))==null||n.removeObserver(this),fs(this,fh,void 0),di(this,uy,pee).call(this),di(this,uy,Yue).call(this)}mutate(n,s){var a;return fs(this,zx,s),(a=er(this,fh))==null||a.removeObserver(this),fs(this,fh,er(this,l1).getMutationCache().build(er(this,l1),this.options)),er(this,fh).addObserver(this),er(this,fh).execute(n)}},l1=new WeakMap,c1=new WeakMap,fh=new WeakMap,zx=new WeakMap,uy=new WeakSet,pee=function(){var s;const n=((s=er(this,fh))==null?void 0:s.state)??aIe();fs(this,c1,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Yue=function(n){Zc.batch(()=>{var s,a,o,l,i,u,p,x;if(er(this,zx)&&this.hasListeners()){const y=er(this,c1).variables,_=er(this,c1).context;(n==null?void 0:n.type)==="success"?((a=(s=er(this,zx)).onSuccess)==null||a.call(s,n.data,y,_),(l=(o=er(this,zx)).onSettled)==null||l.call(o,n.data,null,y,_)):(n==null?void 0:n.type)==="error"&&((u=(i=er(this,zx)).onError)==null||u.call(i,n.error,y,_),(x=(p=er(this,zx)).onSettled)==null||x.call(p,void 0,n.error,y,_))}this.listeners.forEach(y=>{y(er(this,c1))})})},bMe),cIe=I.createContext(void 0),qr=t=>{const e=I.useContext(cIe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},IJe=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),r.jsx(cIe.Provider,{value:t,children:e})),dIe=I.createContext(!1),PJe=()=>I.useContext(dIe);dIe.Provider;function LJe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var OJe=I.createContext(LJe()),DJe=()=>I.useContext(OJe),RJe=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},FJe=t=>{I.useEffect(()=>{t.clearReset()},[t])},zJe=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(a&&t.data===void 0||JEe(n,[t.error,s])),BJe=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))}},$Je=(t,e)=>t.isLoading&&t.isFetching&&!e,UJe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Vwe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function uIe(t,e,n){var y,_,w,S,N;const s=PJe(),a=DJe(),o=qr(),l=o.defaultQueryOptions(t);(_=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||_.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",BJe(l),RJe(l,a),FJe(a);const i=!o.getQueryCache().get(l.queryHash),[u]=I.useState(()=>new e(o,l)),p=u.getOptimisticResult(l),x=!s&&t.subscribed!==!1;if(I.useSyncExternalStore(I.useCallback(M=>{const E=x?u.subscribe(Zc.batchCalls(M)):zu;return u.updateResult(),E},[u,x]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),I.useEffect(()=>{u.setOptions(l)},[l,u]),UJe(l,p))throw Vwe(l,u,a);if(zJe({result:p,errorResetBoundary:a,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw p.error;if((S=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||S.call(w,l,p),l.experimental_prefetchInRender&&!Gj&&$Je(p,s)){const M=i?Vwe(l,u,a):(N=o.getQueryCache().get(l.queryHash))==null?void 0:N.promise;M==null||M.catch(zu).finally(()=>{u.updateResult()})}return l.notifyOnChangeProps?p:u.trackResult(p)}function Kt(t,e){return uIe(t,oIe)}function or(t,e){const n=qr(),[s]=I.useState(()=>new EJe(n,t));I.useEffect(()=>{s.setOptions(t)},[s,t]);const a=I.useSyncExternalStore(I.useCallback(l=>s.subscribe(Zc.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=I.useCallback((l,i)=>{s.mutate(l,i).catch(zu)},[s]);if(a.error&&JEe(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function qJe(t,e){return uIe(t,AJe)}/** * @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 lE(){return lE=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function hIe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function HJe(){return Math.random().toString(36).substr(2,8)}function Wwe(t,e){return{usr:t.state,key:t.key,idx:e}}function Xue(t,e,n,s){return n===void 0&&(n=null),lE({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?h3(e):e,{state:n,key:e&&e.key||s||HJe()})}function cte(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 h3(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 WJe(t,e,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:o=!1}=s,l=a.history,i=f1.Pop,u=null,p=x();p==null&&(p=0,l.replaceState(lE({},l.state,{idx:p}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=f1.Pop;let M=x(),E=M==null?null:M-p;p=M,u&&u({action:i,location:N.location,delta:E})}function _(M,E){i=f1.Push;let A=Xue(N.location,M,E);p=x()+1;let P=Wwe(A,p),z=N.createHref(A);try{l.pushState(P,"",z)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(z)}o&&u&&u({action:i,location:N.location,delta:1})}function w(M,E){i=f1.Replace;let A=Xue(N.location,M,E);p=x();let P=Wwe(A,p),z=N.createHref(A);l.replaceState(P,"",z),o&&u&&u({action:i,location:N.location,delta:0})}function S(M){let E=a.location.origin!=="null"?a.location.origin:a.location.href,A=typeof M=="string"?M:cte(M);return A=A.replace(/ $/,"%20"),bc(E,"No window.location.(origin|href) available to create URL for href: "+A),new URL(A,E)}let N={get action(){return i},get location(){return t(a,l)},listen(M){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Hwe,y),u=M,()=>{a.removeEventListener(Hwe,y),u=null}},createHref(M){return e(a,M)},createURL:S,encodeLocation(M){let E=S(M);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:_,replace:w,go(M){return l.go(M)}};return N}var Gwe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Gwe||(Gwe={}));function GJe(t,e,n){return n===void 0&&(n="/"),KJe(t,e,n)}function KJe(t,e,n,s){let a=typeof e=="string"?h3(e):e,o=Tge(a.pathname||"/",n);if(o==null)return null;let l=fIe(t);ZJe(l);let i=null;for(let u=0;i==null&&u{let u={relativePath:i===void 0?o.path||"":i,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};u.relativePath.startsWith("/")&&(bc(u.relativePath.startsWith(s),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(s.length));let p=q1([s,u.relativePath]),x=n.concat(u);o.children&&o.children.length>0&&(bc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),fIe(o.children,e,x,p)),!(o.path==null&&!o.index)&&e.push({path:p,score:ret(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 u of pIe(o.path))a(o,l,u)}),e}function pIe(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=pIe(s.join("/")),i=[];return i.push(...l.map(u=>u===""?o:[o,u].join("/"))),a&&i.push(...l),i.map(u=>t.startsWith("/")&&u===""?"/":u)}function ZJe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:net(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const YJe=/^:[\w-]+$/,XJe=3,QJe=2,JJe=1,eet=10,tet=-2,Kwe=t=>t==="*";function ret(t,e){let n=t.split("/"),s=n.length;return n.some(Kwe)&&(s+=tet),e&&(s+=QJe),n.filter(a=>!Kwe(a)).reduce((a,o)=>a+(YJe.test(o)?XJe:o===""?JJe:eet),s)}function net(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 set(t,e,n){let{routesMeta:s}=t,a={},o="/",l=[];for(let i=0;i{let{paramName:_,isOptional:w}=x;if(_==="*"){let N=i[y]||"";l=o.slice(0,o.length-N.length).replace(/(.)\/+$/,"$1")}const S=i[y];return w&&!S?p[_]=void 0:p[_]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:t}}function iet(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),hIe(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,u)=>(s.push({paramName:i,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),s]}function oet(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return hIe(!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 Tge(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 cet(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:a=""}=typeof t=="string"?h3(t):t;return{pathname:n?n.startsWith("/")?n:det(n,e):e,search:fet(s),hash:pet(a)}}function det(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 zle(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 uet(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Age(t,e){let n=uet(t);return e?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function Ege(t,e,n,s){s===void 0&&(s=!1);let a;typeof t=="string"?a=h3(t):(a=lE({},t),bc(!a.pathname||!a.pathname.includes("?"),zle("?","pathname","search",a)),bc(!a.pathname||!a.pathname.includes("#"),zle("#","pathname","hash",a)),bc(!a.search||!a.search.includes("#"),zle("#","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 u=cet(a,i),p=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(p||x)&&(u.pathname+="/"),u}const q1=t=>t.join("/").replace(/\/\/+/g,"/"),het=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),fet=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,pet=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function met(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const mIe=["post","put","patch","delete"];new Set(mIe);const get=["get",...mIe];new Set(get);/** * 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 cE(){return cE=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=Ege(p,JSON.parse(l),o,x.relative==="path");t==null&&e!=="/"&&(y.pathname=y.pathname==="/"?e:q1([e,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[e,s,l,o,t])}const _et=I.createContext(null);function bet(t){let e=I.useContext(Gg).outlet;return e&&I.createElement(_et.Provider,{value:t},e)}function td(){let{matches:t}=I.useContext(Gg),e=t[t.length-1];return e?e.params:{}}function yIe(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=I.useContext(hv),{matches:a}=I.useContext(Gg),{pathname:o}=Em(),l=JSON.stringify(Age(a,s.v7_relativeSplatPath));return I.useMemo(()=>Ege(t,JSON.parse(l),o,n==="path"),[t,l,o,n])}function wet(t,e){return jet(t,e)}function jet(t,e,n,s){f3()||bc(!1);let{navigator:a}=I.useContext(hv),{matches:o}=I.useContext(Gg),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let p=Em(),x;if(e){var y;let M=typeof e=="string"?h3(e):e;u==="/"||(y=M.pathname)!=null&&y.startsWith(u)||bc(!1),x=M}else x=p;let _=x.pathname||"/",w=_;if(u!=="/"){let M=u.replace(/^\//,"").split("/");w="/"+_.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=GJe(t,{pathname:w}),N=Tet(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},i,M.params),pathname:q1([u,a.encodeLocation?a.encodeLocation(M.pathname).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?u:q1([u,a.encodeLocation?a.encodeLocation(M.pathnameBase).pathname:M.pathnameBase])})),o,n,s);return e&&N?I.createElement(Xne.Provider,{value:{location:cE({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:f1.Pop}},N):N}function ket(){let t=Pet(),e=met(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 Net=I.createElement(ket,null);class Cet 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(Gg.Provider,{value:this.props.routeContext},I.createElement(gIe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Met(t){let{routeContext:e,match:n,children:s}=t,a=I.useContext(Ige);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),I.createElement(Gg.Provider,{value:e},s)}function Tet(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||bc(!1),l=l.slice(0,Math.min(l.length,x+1))}let u=!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 w,S=!1,N=null,M=null;n&&(w=i&&y.route.id?i[y.route.id]:void 0,N=y.route.errorElement||Net,u&&(p<0&&_===0?(Oet("route-fallback"),S=!0,M=null):p===_&&(S=!0,M=y.route.hydrateFallbackElement||null)));let E=e.concat(l.slice(0,_+1)),A=()=>{let P;return w?P=N:S?P=M:y.route.Component?P=I.createElement(y.route.Component,null):y.route.element?P=y.route.element:P=x,I.createElement(Met,{match:y,routeContext:{outlet:x,matches:E,isDataRoute:n!=null},children:P})};return n&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?I.createElement(Cet,{location:n.location,revalidation:n.revalidation,component:N,error:w,children:A(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):A()},null)}var vIe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(vIe||{}),_Ie=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}(_Ie||{});function Aet(t){let e=I.useContext(Ige);return e||bc(!1),e}function Eet(t){let e=I.useContext(xet);return e||bc(!1),e}function Iet(t){let e=I.useContext(Gg);return e||bc(!1),e}function bIe(t){let e=Iet(),n=e.matches[e.matches.length-1];return n.route.id||bc(!1),n.route.id}function Pet(){var t;let e=I.useContext(gIe),n=Eet(),s=bIe();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function Let(){let{router:t}=Aet(vIe.UseNavigateStable),e=bIe(_Ie.UseNavigateStable),n=I.useRef(!1);return xIe(()=>{n.current=!0}),I.useCallback(function(a,o){o===void 0&&(o={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,cE({fromRouteId:e},o)))},[t,e])}const Zwe={};function Oet(t,e,n){Zwe[t]||(Zwe[t]=!0)}function Det(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Ble(t){let{to:e,replace:n,state:s,relative:a}=t;f3()||bc(!1);let{future:o,static:l}=I.useContext(hv),{matches:i}=I.useContext(Gg),{pathname:u}=Em(),p=Gn(),x=Ege(e,Age(i,o.v7_relativeSplatPath),u,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 Ret(t){return bet(t.context)}function tn(t){bc(!1)}function Fet(t){let{basename:e="/",children:n=null,location:s,navigationType:a=f1.Pop,navigator:o,static:l=!1,future:i}=t;f3()&&bc(!1);let u=e.replace(/^\/*/,"/"),p=I.useMemo(()=>({basename:u,navigator:o,static:l,future:cE({v7_relativeSplatPath:!1},i)}),[u,i,o,l]);typeof s=="string"&&(s=h3(s));let{pathname:x="/",search:y="",hash:_="",state:w=null,key:S="default"}=s,N=I.useMemo(()=>{let M=Tge(x,u);return M==null?null:{location:{pathname:M,search:y,hash:_,state:w,key:S},navigationType:a}},[u,x,y,_,w,S,a]);return N==null?null:I.createElement(hv.Provider,{value:p},I.createElement(Xne.Provider,{children:n,value:N}))}function zet(t){let{children:e,location:n}=t;return wet(Que(e),n)}new Promise(()=>{});function Que(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,Que(s.props.children,o));return}s.type!==tn&&bc(!1),!s.props.index||!s.props.children||bc(!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=Que(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 Jue(){return Jue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function $et(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Uet(t,e){return t.button===0&&(!e||e==="_self")&&!$et(t)}function ehe(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 qet(t,e){let n=ehe(t);return e&&e.forEach((s,a)=>{n.has(a)||e.getAll(a).forEach(o=>{n.append(a,o)})}),n}const Vet=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Het="6";try{window.__reactRouterVersion=Het}catch{}const Wet="startTransition",Ywe=xme[Wet];function Get(t){let{basename:e,children:n,future:s,window:a}=t,o=I.useRef();o.current==null&&(o.current=VJe({window:a,v5Compat:!0}));let l=o.current,[i,u]=I.useState({action:l.action,location:l.location}),{v7_startTransition:p}=s||{},x=I.useCallback(y=>{p&&Ywe?Ywe(()=>u(y)):u(y)},[u,p]);return I.useLayoutEffect(()=>l.listen(x),[l,x]),I.useEffect(()=>Det(s),[s]),I.createElement(Fet,{basename:e,children:n,location:i.location,navigationType:i.action,navigator:l,future:s})}const Ket=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zet=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ji=I.forwardRef(function(e,n){let{onClick:s,relative:a,reloadDocument:o,replace:l,state:i,target:u,to:p,preventScrollReset:x,viewTransition:y}=e,_=Bet(e,Vet),{basename:w}=I.useContext(hv),S,N=!1;if(typeof p=="string"&&Zet.test(p)&&(S=p,Ket))try{let P=new URL(window.location.href),z=p.startsWith("//")?new URL(P.protocol+p):new URL(p),R=Tge(z.pathname,w);z.origin===P.origin&&R!=null?p=R+z.search+z.hash:N=!0}catch{}let M=yet(p,{relative:a}),E=Yet(p,{replace:l,state:i,target:u,preventScrollReset:x,relative:a,viewTransition:y});function A(P){s&&s(P),P.defaultPrevented||E(P)}return I.createElement("a",Jue({},_,{href:S||M,onClick:N||o?s:A,ref:n,target:u}))});var Xwe;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Xwe||(Xwe={}));var Qwe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Qwe||(Qwe={}));function Yet(t,e){let{target:n,replace:s,state:a,preventScrollReset:o,relative:l,viewTransition:i}=e===void 0?{}:e,u=Gn(),p=Em(),x=yIe(t,{relative:l});return I.useCallback(y=>{if(Uet(y,n)){y.preventDefault();let _=s!==void 0?s:cte(p)===cte(x);u(t,{replace:_,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[p,u,x,s,a,n,t,o,l,i])}function rd(t){let e=I.useRef(ehe(t)),n=I.useRef(!1),s=Em(),a=I.useMemo(()=>qet(s.search,n.current?null:e.current),[s.search]),o=Gn(),l=I.useCallback((i,u)=>{const p=ehe(typeof i=="function"?i(a):i);n.current=!0,o("?"+p,u)},[o,a]);return[a,l]}var Xet=typeof Element<"u",Qet=typeof Map=="function",Jet=typeof Set=="function",ett=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function mee(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(!mee(t[s],e[s]))return!1;return!0}var o;if(Qet&&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(!mee(s.value[1],e.get(s.value[0])))return!1;return!0}if(Jet&&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(ett&&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(Xet&&t instanceof Element)return!1;for(s=n;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&t.$$typeof)&&!mee(t[a[s]],e[a[s]]))return!1;return!0}return t!==t&&e!==e}var ttt=function(e,n){try{return mee(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 rtt=Wi(ttt);var ntt=function(t,e,n,s,a,o,l,i){if(!t){var u;if(e===void 0)u=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;u=new Error(e.replace(/%s/g,function(){return p[x++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}},stt=ntt;const Jwe=Wi(stt);var att=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 u=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))(wIe||{}),$le={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"]}},eje=Object.values(wIe),Pge={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},ott=Object.entries(Pge).reduce((t,[e,n])=>(t[n]=e,t),{}),pm="data-rh",IS={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},PS=(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},ltt=t=>{let e=PS(t,"title");const n=PS(t,IS.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const s=PS(t,IS.DEFAULT_TITLE);return e||s||void 0},ctt=t=>PS(t,IS.ON_CHANGE_CLIENT_STATE)||(()=>{}),Ule=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,s)=>({...n,...s}),{}),dtt=(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),UM=(t,e,n)=>{const s={};return n.filter(a=>Array.isArray(a[t])?!0:(typeof a[t]<"u"&&utt(`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(u=>{let p;const x=Object.keys(u);for(let _=0;_a.push(u));const i=Object.keys(l);for(let u=0;u{if(Array.isArray(t)&&t.length){for(let n=0;n({baseTag:dtt(["href"],t),bodyAttributes:Ule("bodyAttributes",t),defer:PS(t,IS.DEFER),encode:PS(t,IS.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Ule("htmlAttributes",t),linkTags:UM("link",["rel","href"],t),metaTags:UM("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:UM("noscript",["innerHTML"],t),onChangeClientState:ctt(t),scriptTags:UM("script",["src","innerHTML"],t),styleTags:UM("style",["cssText"],t),title:ltt(t),titleAttributes:Ule("titleAttributes",t),prioritizeSeoTags:htt(t,IS.PRIORITIZE_SEO_TAGS)}),jIe=t=>Array.isArray(t)?t.join(""):t,ptt=(t,e)=>{const n=Object.keys(t);for(let s=0;sArray.isArray(t)?t.reduce((n,s)=>(ptt(s,e)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:t,priority:[]},tje=(t,e)=>({...t,[e]:void 0}),mtt=["noscript","script","style"],the=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),kIe=t=>Object.keys(t).reduce((e,n)=>{const s=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${s}`:s},""),gtt=(t,e,n,s)=>{const a=kIe(n),o=jIe(e);return a?`<${t} ${pm}="true" ${a}>${the(o,s)}`:`<${t} ${pm}="true">${the(o,s)}`},xtt=(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}="${the(o[x],n)}"`;return p?`${p} ${y}`:y},""),i=o.innerHTML||o.cssText||"",u=mtt.indexOf(t)===-1;return`${s}<${t} ${pm}="true" ${l}${u?"/>":`>${i}`}`},""),NIe=(t,e={})=>Object.keys(t).reduce((n,s)=>{const a=Pge[s];return n[a||s]=t[s],n},e),ytt=(t,e,n)=>{const s={key:e,[pm]:!0},a=NIe(n,s);return[it.createElement("title",a,e)]},gee=(t,e)=>e.map((n,s)=>{const a={key:s,[pm]:!0};return Object.keys(n).forEach(o=>{const i=Pge[o]||o;if(i==="innerHTML"||i==="cssText"){const u=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:u}}else a[i]=n[o]}),it.createElement(t,a)}),$f=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>ytt(t,e.title,e.titleAttributes),toString:()=>gtt(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>NIe(e),toString:()=>kIe(e)};default:return{toComponent:()=>gee(t,e),toString:()=>xtt(t,e,n)}}},vtt=({metaTags:t,linkTags:e,scriptTags:n,encode:s})=>{const a=qle(t,$le.meta),o=qle(e,$le.link),l=qle(n,$le.script);return{priorityMethods:{toComponent:()=>[...gee("meta",a.priority),...gee("link",o.priority),...gee("script",l.priority)],toString:()=>`${$f("meta",a.priority,s)} ${$f("link",o.priority,s)} ${$f("script",l.priority,s)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},_tt=t=>{const{baseTag:e,bodyAttributes:n,encode:s=!0,htmlAttributes:a,noscriptTags:o,styleTags:l,title:i="",titleAttributes:u,prioritizeSeoTags:p}=t;let{linkTags:x,metaTags:y,scriptTags:_}=t,w={toComponent:()=>{},toString:()=>""};return p&&({priorityMethods:w,linkTags:x,metaTags:y,scriptTags:_}=vtt(t)),{priority:w,base:$f("base",e,s),bodyAttributes:$f("bodyAttributes",n,s),htmlAttributes:$f("htmlAttributes",a,s),link:$f("link",x,s),meta:$f("meta",y,s),noscript:$f("noscript",o,s),script:$f("script",_,s),style:$f("style",l,s),title:$f("title",{title:i,titleAttributes:u},s)}},rhe=_tt,wL=[],SIe=!!(typeof window<"u"&&window.document&&window.document.createElement),nhe=class{constructor(t,e){Zn(this,"instances",[]);Zn(this,"canUseDOM",SIe);Zn(this,"context");Zn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?wL:this.instances,add:t=>{(this.canUseDOM?wL:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?wL:this.instances).indexOf(t);(this.canUseDOM?wL:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=rhe({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},btt={},CIe=it.createContext(btt),pj,MIe=(pj=class extends I.Component{constructor(n){super(n);Zn(this,"helmetData");this.helmetData=new nhe(this.props.context||{},pj.canUseDOM)}render(){return it.createElement(CIe.Provider,{value:this.helmetData.value},this.props.children)}},Zn(pj,"canUseDOM",SIe),pj),i4=(t,e)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${t}[${pm}]`),a=[].slice.call(s),o=[];let l;return e&&e.length&&e.forEach(i=>{const u=document.createElement(t);for(const p in i)if(Object.prototype.hasOwnProperty.call(i,p))if(p==="innerHTML")u.innerHTML=i.innerHTML;else if(p==="cssText")u.styleSheet?u.styleSheet.cssText=i.cssText:u.appendChild(document.createTextNode(i.cssText));else{const x=p,y=typeof i[x]>"u"?"":i[x];u.setAttribute(p,y)}u.setAttribute(pm,"true"),a.some((p,x)=>(l=x,u.isEqualNode(p)))?a.splice(l,1):o.push(u)}),a.forEach(i=>{var u;return(u=i.parentNode)==null?void 0:u.removeChild(i)}),o.forEach(i=>n.appendChild(i)),{oldTags:a,newTags:o}},she=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const s=n.getAttribute(pm),a=s?s.split(","):[],o=[...a],l=Object.keys(e);for(const i of l){const u=e[i]||"";n.getAttribute(i)!==u&&n.setAttribute(i,u),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(pm):n.getAttribute(pm)!==l.join(",")&&n.setAttribute(pm,l.join(","))},wtt=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=jIe(t)),she("title",e)},rje=(t,e)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:u,scriptTags:p,styleTags:x,title:y,titleAttributes:_}=t;she("body",s),she("html",a),wtt(y,_);const w={baseTag:i4("base",n),linkTags:i4("link",o),metaTags:i4("meta",l),noscriptTags:i4("noscript",i),scriptTags:i4("script",p),styleTags:i4("style",x)},S={},N={};Object.keys(w).forEach(M=>{const{newTags:E,oldTags:A}=w[M];E.length&&(S[M]=E),A.length&&(N[M]=w[M].oldTags)}),e&&e(),u(t,S,N)},qM=null,jtt=t=>{qM&&cancelAnimationFrame(qM),t.defer?qM=requestAnimationFrame(()=>{rje(t,()=>{qM=null})}):(rje(t),qM=null)},ktt=jtt,nje=class extends I.Component{constructor(){super(...arguments);Zn(this,"rendered",!1)}shouldComponentUpdate(e){return!itt(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=ftt(e.get().map(o=>{const l={...o.props};return delete l.context,l}));MIe.canUseDOM?ktt(a):rhe&&(s=rhe(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}},Pde,Im=(Pde=class extends I.Component{shouldComponentUpdate(t){return!rtt(tje(this.props,"helmetData"),tje(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 Jwe(eje.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 ${eje.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),Jwe(!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 it.Children.forEach(t,s=>{if(!s||!s.props)return;const{children:a,...o}=s.props,l=Object.keys(o).reduce((u,p)=>(u[ott[p]||p]=o[p],u),{});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 nhe)){const a=s;s=new nhe(a.context,!0),delete n.helmetData}return s?it.createElement(nje,{...n,context:s.value}):it.createElement(CIe.Consumer,null,a=>it.createElement(nje,{...n,context:a}))}},Zn(Pde,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Pde),ahe=function(t,e){return ahe=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])},ahe(t,e)};function TIe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ahe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Kf=function(){return Kf=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 EIe(t,e){return function(n,s){e(n,s,t)}}function IIe(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,u=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,w=n.length-1;w>=0;w--){var S={};for(var N in s)S[N]=N==="access"?{}:s[N];for(var N in s.access)S.access[N]=s.access[N];S.addInitializer=function(E){if(_)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(E||null))};var M=(0,n[w])(i==="accessor"?{get:x.get,set:x.set}:x[u],S);if(i==="accessor"){if(M===void 0)continue;if(M===null||typeof M!="object")throw new TypeError("Object expected");(y=l(M.get))&&(x.get=y),(y=l(M.set))&&(x.set=y),(y=l(M.init))&&a.unshift(y)}else(y=l(M))&&(i==="field"?a.unshift(y):x[u]=y)}p&&Object.defineProperty(p,s.name,x),_=!0}function PIe(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 Lge(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 zIe(){for(var t=[],e=0;e1||u(w,N)})},S&&(a[w]=S(a[w])))}function u(w,S){try{p(s[w](S))}catch(N){_(o[0][3],N)}}function p(w){w.value instanceof gC?Promise.resolve(w.value.v).then(x,y):_(o[0][2],w)}function x(w){u("next",w)}function y(w){u("throw",w)}function _(w,S){w(S),o.shift(),o.length&&u(o[0][0],o[0][1])}}function UIe(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:gC(t[a](l)),done:!1}:o?o(l):l}:o}}function qIe(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 dte=="function"?dte(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,u){l=t[o](l),a(i,u,l.done,l.value)})}}function a(o,l,i,u){Promise.resolve(u).then(function(p){o({value:p,done:i})},l)}}function VIe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var Ntt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},ihe=function(t){return ihe=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},ihe(t)};function HIe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=ihe(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(u=>{if(u=Att(u),u in sje)return;sje[u]=!0;const p=u.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${x}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":Ttt,p||(y.as="script"),y.crossOrigin="",y.href=u,i&&y.setAttribute("nonce",i),document.head.appendChild(y),p)return new Promise((_,w)=>{y.addEventListener("load",_),y.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${u}`)))})}))}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)})},Ett=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>p3(async()=>{const{default:s}=await Promise.resolve().then(()=>gk);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)};class Dge extends Error{constructor(e,n="FunctionsError",s){super(e),this.name=n,this.context=s}}class aje extends Dge{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class ije extends Dge{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class oje extends Dge{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ohe;(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"})(ohe||(ohe={}));class Itt{constructor(e,{headers:n={},customFetch:s,region:a=ohe.Any}={}){this.url=e,this.headers=n,this.region=a,this.fetch=Ett(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ls(this,arguments,void 0,function*(n,s={}){var a;try{const{headers:o,method:l,body:i,signal:u}=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 w=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),o),body:_,signal:u}).catch(E=>{throw E.name==="AbortError"?E:new aje(E)}),S=w.headers.get("x-relay-error");if(S&&S==="true")throw new ije(w);if(!w.ok)throw new oje(w);let N=((a=w.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),M;return N==="application/json"?M=yield w.json():N==="application/octet-stream"||N==="application/pdf"?M=yield w.blob():N==="text/event-stream"?M=w:N==="multipart/form-data"?M=yield w.formData():M=yield w.text(),{data:M,error:null,response:w}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new aje(o)}:{data:null,error:o,response:o instanceof oje||o instanceof ije?o.context:void 0}}})}}var xh={};const m3=wMe(Mtt);var jL={},kL={},NL={},SL={},CL={},Ptt=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")},xC=Ptt();const Ltt=xC.fetch,JIe=xC.fetch.bind(xC),ePe=xC.Headers,Ott=xC.Request,Dtt=xC.Response,gk=Object.freeze(Object.defineProperty({__proto__:null,Headers:ePe,Request:Ott,Response:Dtt,default:JIe,fetch:Ltt},Symbol.toStringTag,{value:"Module"})),Rtt=wMe(gk);var ML={},lje;function tPe(){if(lje)return ML;lje=1,Object.defineProperty(ML,"__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 ML.default=t,ML}var cje;function rPe(){if(cje)return CL;cje=1,Object.defineProperty(CL,"__esModule",{value:!0});const t=m3,e=t.__importDefault(Rtt),n=t.__importDefault(tPe());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 u=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async p=>{var x,y,_,w;let S=null,N=null,M=null,E=p.status,A=p.statusText;if(p.ok){if(this.method!=="HEAD"){const U=await p.text();U===""||(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=U:N=JSON.parse(U))}const z=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),R=(_=p.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");z&&R&&R.length>1&&(M=parseInt(R[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(N)&&(N.length>1?(S={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,M=null,E=406,A="Not Acceptable"):N.length===1?N=N[0]:N=null)}else{const z=await p.text();try{S=JSON.parse(z),Array.isArray(S)&&p.status===404&&(N=[],S=null,E=200,A="OK")}catch{p.status===404&&z===""?(E=204,A="No Content"):S={message:z}}if(S&&this.isMaybeSingle&&(!((w=S==null?void 0:S.details)===null||w===void 0)&&w.includes("0 rows"))&&(S=null,E=200,A="OK"),S&&this.shouldThrowOnError)throw new n.default(S)}return{error:S,data:N,count:M,status:E,statusText:A}});return this.shouldThrowOnError||(u=u.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:""}})),u.then(o,l)}returns(){return this}overrideTypes(){return this}}return CL.default=s,CL}var dje;function nPe(){if(dje)return SL;dje=1,Object.defineProperty(SL,"__esModule",{value:!0});const e=m3.__importDefault(rPe());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:u=i}={}){const p=u?`${u}.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 u=typeof i>"u"?"offset":`${i}.offset`,p=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(u,`${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:u=!1,format:p="text"}={}){var x;const y=[a?"analyze":null,o?"verbose":null,l?"settings":null,i?"buffers":null,u?"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 SL.default=n,SL}var uje;function Rge(){if(uje)return NL;uje=1,Object.defineProperty(NL,"__esModule",{value:!0});const e=m3.__importDefault(nPe()),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(u=>typeof u=="string"&&n.test(u)?`"${u}"`:`${u}`).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:u}={}){let p="";u==="plain"?p="pl":u==="phrase"?p="ph":u==="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 u=i?`${i}.or`:"or";return this.url.searchParams.append(u,`(${o})`),this}filter(o,l,i){return this.url.searchParams.append(o,`${l}.${i}`),this}}return NL.default=s,NL}var hje;function sPe(){if(hje)return kL;hje=1,Object.defineProperty(kL,"__esModule",{value:!0});const e=m3.__importDefault(Rge());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??{},u=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:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:o,defaultToNull:l=!0}={}){var i;const u="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:u,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:u=!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}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const y=a.reduce((_,w)=>_.concat(Object.keys(w)),[]);if(y.length>0){const _=[...new Set(y)].map(w=>`"${w}"`);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 kL.default=n,kL}var fje;function Ftt(){if(fje)return jL;fje=1,Object.defineProperty(jL,"__esModule",{value:!0});const t=m3,e=t.__importDefault(sPe()),n=t.__importDefault(Rge());class s{constructor(o,{headers:l={},schema:i,fetch:u}={}){this.url=o,this.headers=new Headers(l),this.schemaName=i,this.fetch=u}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:u=!1,count:p}={}){var x;let y;const _=new URL(`${this.url}/rpc/${o}`);let w;i||u?(y=i?"HEAD":"GET",Object.entries(l).filter(([N,M])=>M!==void 0).map(([N,M])=>[N,Array.isArray(M)?`{${M.join(",")}}`:`${M}`]).forEach(([N,M])=>{_.searchParams.append(N,M)})):(y="POST",w=l);const S=new Headers(this.headers);return p&&S.set("Prefer",`count=${p}`),new n.default({method:y,url:_,headers:S,schema:this.schemaName,body:w,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return jL.default=s,jL}Object.defineProperty(xh,"__esModule",{value:!0});var aPe=xh.PostgrestError=mPe=xh.PostgrestBuilder=fPe=xh.PostgrestTransformBuilder=uPe=xh.PostgrestFilterBuilder=cPe=xh.PostgrestQueryBuilder=oPe=xh.PostgrestClient=void 0;const g3=m3,iPe=g3.__importDefault(Ftt());var oPe=xh.PostgrestClient=iPe.default;const lPe=g3.__importDefault(sPe());var cPe=xh.PostgrestQueryBuilder=lPe.default;const dPe=g3.__importDefault(Rge());var uPe=xh.PostgrestFilterBuilder=dPe.default;const hPe=g3.__importDefault(nPe());var fPe=xh.PostgrestTransformBuilder=hPe.default;const pPe=g3.__importDefault(rPe());var mPe=xh.PostgrestBuilder=pPe.default;const gPe=g3.__importDefault(tPe());aPe=xh.PostgrestError=gPe.default;var xPe=xh.default={PostgrestClient:iPe.default,PostgrestQueryBuilder:lPe.default,PostgrestFilterBuilder:dPe.default,PostgrestTransformBuilder:hPe.default,PostgrestBuilder:pPe.default,PostgrestError:gPe.default};const ztt=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return mPe},get PostgrestClient(){return oPe},get PostgrestError(){return aPe},get PostgrestFilterBuilder(){return uPe},get PostgrestQueryBuilder(){return cPe},get PostgrestTransformBuilder(){return fPe},default:xPe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Btt,PostgrestQueryBuilder:XYt,PostgrestFilterBuilder:QYt,PostgrestTransformBuilder:JYt,PostgrestBuilder:eXt,PostgrestError:tXt}=xPe||ztt;class $tt{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 Utt="2.78.0",qtt=`realtime-js/${Utt}`,Vtt="1.0.0",lhe=1e4,Htt=1e3,Wtt=100;var xA;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(xA||(xA={}));var Wc;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Wc||(Wc={}));var sm;(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"})(sm||(sm={}));var che;(function(t){t.websocket="websocket"})(che||(che={}));var Bw;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Bw||(Bw={}));class Gtt{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 u=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:u,payload:p}}}class yPe{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 Yo;(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"})(Yo||(Yo={}));const pje=(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]=Ktt(l,t,e,a),o),{}):{}},Ktt=(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)?vPe(o,l):dhe(l)},vPe=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Qtt(e,n)}switch(t){case Yo.bool:return Ztt(e);case Yo.float4:case Yo.float8:case Yo.int2:case Yo.int4:case Yo.int8:case Yo.numeric:case Yo.oid:return Ytt(e);case Yo.json:case Yo.jsonb:return Xtt(e);case Yo.timestamp:return Jtt(e);case Yo.abstime:case Yo.date:case Yo.daterange:case Yo.int4range:case Yo.int8range:case Yo.money:case Yo.reltime:case Yo.text:case Yo.time:case Yo.timestamptz:case Yo.timetz:case Yo.tsrange:case Yo.tstzrange:return dhe(e);default:return dhe(e)}},dhe=t=>t,Ztt=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Ytt=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Xtt=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},Qtt=(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=>vPe(e,i))}return t},Jtt=t=>typeof t=="string"?t.replace(" ","T"):t,_Pe=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 Vle{constructor(e,n,s={},a=lhe){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 mje;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(mje||(mje={}));class yA{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=yA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(u=>{this.state=yA.syncDiff(this.state,u,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=yA.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={},u={};return this.map(o,(p,x)=>{l[p]||(u[p]=x)}),this.map(l,(p,x)=>{const y=o[p];if(y){const _=x.map(M=>M.presence_ref),w=y.map(M=>M.presence_ref),S=x.filter(M=>w.indexOf(M.presence_ref)<0),N=y.filter(M=>_.indexOf(M.presence_ref)<0);S.length>0&&(i[p]=S),N.length>0&&(u[p]=N)}else i[p]=x}),this.syncDiff(o,{joins:i,leaves:u},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,u)=>{var p;const x=(p=e[i])!==null&&p!==void 0?p:[];if(e[i]=this.cloneDeep(u),x.length>0){const y=e[i].map(w=>w.presence_ref),_=x.filter(w=>y.indexOf(w.presence_ref)<0);e[i].unshift(..._)}s(i,x,u)}),this.map(l,(i,u)=>{let p=e[i];if(!p)return;const x=u.map(y=>y.presence_ref);p=p.filter(y=>x.indexOf(y.presence_ref)<0),e[i]=p,a(i,p,u),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 gje;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(gje||(gje={}));var vA;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(vA||(vA={}));var Ix;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Ix||(Ix={}));class Fge{constructor(e,n={config:{}},s){var a,o;if(this.topic=e,this.params=n,this.socket=s,this.bindings={},this.state=Wc.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 Vle(this,sm.join,this.params,this.timeout),this.rejoinTimer=new yPe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Wc.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=Wc.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Wc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Wc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Wc.errored,this.rejoinTimer.scheduleTimeout())}),this._on(sm.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new yA(this),this.broadcastEndpointURL=_Pe(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==Wc.closed){const{config:{broadcast:l,presence:i,private:u}}=this.params,p=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(w=>w.filter))!==null&&a!==void 0?a:[],x=!!this.bindings[vA.PRESENCE]&&this.bindings[vA.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:u};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(w=>e==null?void 0:e(Ix.CHANNEL_ERROR,w)),this._onClose(()=>e==null?void 0:e(Ix.CLOSED)),this.updateJoinPayload(Object.assign({config:_},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:w})=>{var S;if(this.socket.setAuth(),w===void 0){e==null||e(Ix.SUBSCRIBED);return}else{const N=this.bindings.postgres_changes,M=(S=N==null?void 0:N.length)!==null&&S!==void 0?S:0,E=[];for(let A=0;A{this.state=Wc.errored,e==null||e(Ix.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(w).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Ix.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===Wc.joined&&e===vA.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 u=i.statusText;try{const p=await i.json();u=p.error||p.message||u}catch{}return Promise.reject(new Error(u))}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,u={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,u,(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,u;const p=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(i=(l=this.params)===null||l===void 0?void 0:l.config)===null||i===void 0?void 0:i.broadcast)===null||u===void 0)&&u.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=Wc.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(sm.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new Vle(this,sm.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=Wc.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 Vle(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>Wtt){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:u,leave:p,join:x}=sm;if(s&&[i,u,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(w=>{var S,N,M;return((S=w.filter)===null||S===void 0?void 0:S.event)==="*"||((M=(N=w.filter)===null||N===void 0?void 0:N.event)===null||M===void 0?void 0:M.toLocaleLowerCase())===l}).map(w=>w.callback(_,s)):(o=this.bindings[l])===null||o===void 0||o.filter(w=>{var S,N,M,E,A,P;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in w){const z=w.id,R=(S=w.filter)===null||S===void 0?void 0:S.event;return z&&((N=n.ids)===null||N===void 0?void 0:N.includes(z))&&(R==="*"||(R==null?void 0:R.toLocaleLowerCase())===((M=n.data)===null||M===void 0?void 0:M.type.toLocaleLowerCase()))}else{const z=(A=(E=w==null?void 0:w.filter)===null||E===void 0?void 0:E.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return z==="*"||z===((P=n==null?void 0:n.event)===null||P===void 0?void 0:P.toLocaleLowerCase())}else return w.type.toLocaleLowerCase()===l}).map(w=>{if(typeof _=="object"&&"ids"in _){const S=_.data,{schema:N,table:M,commit_timestamp:E,type:A,errors:P}=S;_=Object.assign(Object.assign({},{schema:N,table:M,commit_timestamp:E,eventType:A,new:{},old:{},errors:P}),this._getPayloadRecords(S))}w.callback(_,s)})}_isClosed(){return this.state===Wc.closed}_isJoined(){return this.state===Wc.joined}_isJoining(){return this.state===Wc.joining}_isLeaving(){return this.state===Wc.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&&Fge.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(sm.close,{},e)}_onError(e){this._on(sm.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Wc.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=pje(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=pje(e.columns,e.old_record)),n}}const Hle=()=>{},TL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},ert=[1e3,2e3,5e3,1e4],trt=1e4,rrt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class nrt{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=lhe,this.transport=null,this.heartbeatIntervalMs=TL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Hle,this.ref=0,this.reconnectTimer=null,this.logger=Hle,this.conn=null,this.sendBuffer=[],this.serializer=new Gtt,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)=>p3(async()=>{const{default:i}=await Promise.resolve().then(()=>gk);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}/${che.websocket}`,this.httpEndpoint=_Pe(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=$tt.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:Vtt}))}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 xA.connecting:return Bw.Connecting;case xA.open:return Bw.Open;case xA.closing:return Bw.Closing;default:return Bw.Closed}}isConnected(){return this.connectionState()===Bw.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 Fge(`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 u;(u=this.conn)===null||u===void 0||u.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(Htt,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},TL.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})`:"",u=o.status||"";this.log("receive",`${u} ${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(sm.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([rrt],{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:qtt};n&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(sm.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 yPe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},TL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,s,a,o,l,i,u,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:lhe,this.heartbeatIntervalMs=(a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:TL.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:Hle,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=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:y=>ert[y-1]||trt,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 zge extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Il(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class srt extends zge{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 uhe extends zge{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}const Bge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>p3(async()=>{const{default:s}=await Promise.resolve().then(()=>gk);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},art=()=>Ls(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield p3(()=>Promise.resolve().then(()=>gk),void 0)).Response:Response}),hhe=t=>{if(Array.isArray(t))return t.map(n=>hhe(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]=hhe(s)}),e},irt=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)},Wle=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)},ort=(t,e,n)=>Ls(void 0,void 0,void 0,function*(){const s=yield art();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 srt(Wle(a),o,l))}).catch(a=>{e(new uhe(Wle(a),a))}):e(new uhe(Wle(t),t))}),lrt=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!s?a:(irt(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 EI(t,e,n,s,a,o){return Ls(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(n,lrt(e,s,a,o)).then(u=>{if(!u.ok)throw u;return s!=null&&s.noResolveJson?u:u.json()}).then(u=>l(u)).catch(u=>ort(u,i,s))})})}function dE(t,e,n,s){return Ls(this,void 0,void 0,function*(){return EI(t,"GET",e,n,s)})}function em(t,e,n,s,a){return Ls(this,void 0,void 0,function*(){return EI(t,"POST",e,s,a,n)})}function fhe(t,e,n,s,a){return Ls(this,void 0,void 0,function*(){return EI(t,"PUT",e,s,a,n)})}function crt(t,e,n,s){return Ls(this,void 0,void 0,function*(){return EI(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function $ge(t,e,n,s,a){return Ls(this,void 0,void 0,function*(){return EI(t,"DELETE",e,s,a,n)})}class drt{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return Ls(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Il(e))return{data:null,error:e};throw e}})}}var bPe;class urt{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n,this[bPe]="BlobDownloadBuilder",this.promise=null}asStream(){return new drt(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 Ls(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Il(e))return{data:null,error:e};throw e}})}}bPe=Symbol.toStringTag;const hrt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},xje={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class frt{constructor(e,n={},s,a){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=s,this.fetch=Bge(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,s,a){return Ls(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},xje),a);let i=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(l.upsert)});const u=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u))):(o=s,i["cache-control"]=`max-age=${l.cacheControl}`,i["content-type"]=l.contentType,u&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),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"?fhe:em)(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(Il(o))return{data:null,error:o};throw o}})}upload(e,n,s){return Ls(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,s)})}uploadToSignedUrl(e,n,s,a){return Ls(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 u;const p=Object.assign({upsert:xje.upsert},a),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(u=new FormData,u.append("cacheControl",p.cacheControl),u.append("",s)):typeof FormData<"u"&&s instanceof FormData?(u=s,u.append("cacheControl",p.cacheControl)):(u=s,x["cache-control"]=`max-age=${p.cacheControl}`,x["content-type"]=p.contentType);const y=yield fhe(this.fetch,i.toString(),u,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if(Il(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,n){return Ls(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 em(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 zge("No token returned by API");return{data:{signedUrl:l.toString(),path:e,token:i},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Il(s))return{data:null,error:s};throw s}})}update(e,n,s){return Ls(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,s)})}move(e,n,s){return Ls(this,void 0,void 0,function*(){try{return{data:yield em(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(Il(a))return{data:null,error:a};throw a}})}copy(e,n,s){return Ls(this,void 0,void 0,function*(){try{return{data:{path:(yield em(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(Il(a))return{data:null,error:a};throw a}})}createSignedUrl(e,n,s){return Ls(this,void 0,void 0,function*(){try{let a=this._getFinalPath(e),o=yield em(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(Il(a))return{data:null,error:a};throw a}})}createSignedUrls(e,n,s){return Ls(this,void 0,void 0,function*(){try{const a=yield em(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(Il(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),u=()=>dE(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new urt(u,this.shouldThrowOnError)}info(e){return Ls(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const s=yield dE(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:hhe(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Il(s))return{data:null,error:s};throw s}})}exists(e){return Ls(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield crt(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Il(s)&&s instanceof uhe){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",u=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});u!==""&&a.push(u);let p=a.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}${p}`)}}}remove(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield $ge(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}list(e,n,s){return Ls(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},hrt),n),{prefix:e||""});return{data:yield em(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Il(a))return{data:null,error:a};throw a}})}listV2(e,n){return Ls(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield em(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Il(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 wPe="2.78.0",jPe={"X-Client-Info":`storage-js/${wPe}`};class prt{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({},jPe),n),this.fetch=Bge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Ls(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(e);return{data:yield dE(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}getBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield dE(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}createBucket(e){return Ls(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield em(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(Il(a))return{data:null,error:a};throw a}})}updateBucket(e,n){return Ls(this,void 0,void 0,function*(){try{return{data:yield fhe(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(Il(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield em(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield $ge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(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 mrt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},jPe),n),this.fetch=Bge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield em(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}listBuckets(e){return Ls(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 dE(this.fetch,a,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield $ge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Il(n))return{data:null,error:n};throw n}})}}const Uge={"X-Client-Info":`storage-js/${wPe}`,"Content-Type":"application/json"};class kPe extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Jh(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class Gle extends kPe{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 grt extends kPe{constructor(e,n){super(e),this.name="StorageVectorsUnknownError",this.originalError=n}}var yje;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(yje||(yje={}));const qge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>p3(async()=>{const{default:s}=await Promise.resolve().then(()=>gk);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},xrt=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)},vje=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),yrt=(t,e,n)=>Ls(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 Gle(vje(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;e(new Gle(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;e(new Gle(i,a,l))}}else e(new grt(vje(t),t))}),vrt=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return s?(xrt(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 _rt(t,e,n,s,a,o){return Ls(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(n,vrt(e,s,a,o)).then(u=>{if(!u.ok)throw u;if(s!=null&&s.noResolveJson)return u;const p=u.headers.get("content-type");return!p||!p.includes("application/json")?{}:u.json()}).then(u=>l(u)).catch(u=>yrt(u,i,s))})})}function ef(t,e,n,s,a){return Ls(this,void 0,void 0,function*(){return _rt(t,"POST",e,s,a,n)})}class brt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Uge),n),this.fetch=qge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Ls(this,void 0,void 0,function*(){try{return{data:(yield ef(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}getIndex(e,n){return Ls(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Jh(s))return{data:null,error:s};throw s}})}listIndexes(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}deleteIndex(e,n){return Ls(this,void 0,void 0,function*(){try{return{data:(yield ef(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Jh(s))return{data:null,error:s};throw s}})}}class wrt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Uge),n),this.fetch=qge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ls(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 ef(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}getVectors(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}listVectors(e){return Ls(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 ef(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}queryVectors(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}deleteVectors(e){return Ls(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 ef(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}}class jrt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Uge),n),this.fetch=qge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:(yield ef(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}getBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}listBuckets(){return Ls(this,arguments,void 0,function*(e={}){try{return{data:yield ef(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Ls(this,void 0,void 0,function*(){try{return{data:(yield ef(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Jh(n))return{data:null,error:n};throw n}})}}class krt extends jrt{constructor(e,n={}){super(e,n.headers||{},n.fetch)}from(e){return new Nrt(this.url,this.headers,e,this.fetch)}}class Nrt extends brt{constructor(e,n,s,a){super(e,n,a),this.vectorBucketName=s}createIndex(e){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Ls(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 Ls(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 Ls(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 Ls(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Srt(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class Srt extends wrt{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 Ls(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 Ls(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 Ls(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 Ls(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 Ls(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Crt extends prt{constructor(e,n={},s,a){super(e,n,s,a)}from(e){return new frt(this.url,this.headers,e,this.fetch)}get vectors(){return new krt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new mrt(this.url+"/iceberg",this.headers,this.fetch)}}const Mrt="2.78.0";let yT="";typeof Deno<"u"?yT="deno":typeof document<"u"?yT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?yT="react-native":yT="node";const Trt={"X-Client-Info":`supabase-js-${yT}/${Mrt}`},Art={headers:Trt},Ert={schema:"public"},Irt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Prt={},Lrt=t=>{let e;return t?e=t:typeof fetch>"u"?e=JIe:e=fetch,(...n)=>e(...n)},Ort=()=>typeof Headers>"u"?ePe:Headers,Drt=(t,e,n)=>{const s=Lrt(n),a=Ort();return async(o,l)=>{var i;const u=(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 ${u}`),s(o,Object.assign(Object.assign({},l),{headers:p}))}};function Rrt(t){return t.endsWith("/")?t:t+"/"}function Frt(t,e){var n,s;const{db:a,auth:o,realtime:l,global:i}=t,{db:u,auth:p,realtime:x,global:y}=e,_={db:Object.assign(Object.assign({},u),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 zrt(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(Rrt(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const NPe="2.78.0",C4=30*1e3,phe=3,Kle=phe*C4,Brt="http://localhost:9999",$rt="supabase.auth.token",Urt={"X-Client-Info":`gotrue-js/${NPe}`},mhe="X-Supabase-Api-Version",SPe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},qrt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Vrt=10*60*1e3;class uE extends Error{constructor(e,n,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function ta(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Hrt extends uE{constructor(e,n,s){super(e,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function Wrt(t){return ta(t)&&t.name==="AuthApiError"}class $w extends uE{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class pv extends uE{constructor(e,n,s,a){super(e,s,a),this.name=n,this.status=s}}class Zp extends pv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Grt(t){return ta(t)&&t.name==="AuthSessionMissingError"}class o4 extends pv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class AL extends pv{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class EL extends pv{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 Krt(t){return ta(t)&&t.name==="AuthImplicitGrantRedirectError"}class _je extends pv{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 ghe extends pv{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function Zle(t){return ta(t)&&t.name==="AuthRetryableFetchError"}class bje extends pv{constructor(e,n,s){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class xhe extends pv{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const ute="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),wje=` \r=`.split(""),Zrt=(()=>{const t=new Array(128);for(let e=0;e=6;){const s=e.queue>>e.queuedBits-6&63;n(ute[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(ute[s]),e.queuedBits-=6}}function CPe(t,e,n){const s=Zrt[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 kje(t){const e=[],n=l=>{e.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{Qrt(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 Xrt(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}Yrt(s,e)}}function Qrt(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 LS(t){const e=[],n={queue:0,queuedBits:0},s=a=>{e.push(a)};for(let a=0;ae.push(n)),new Uint8Array(e)}function Kw(t){const e=[],n={queue:0,queuedBits:0},s=a=>{e.push(a)};return t.forEach(a=>jje(a,n,s)),jje(null,n,s),e.join("")}function ent(t){return Math.round(Date.now()/1e3)+t}function tnt(){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 Ou=()=>typeof window<"u"&&typeof document<"u",p_={tested:!1,writable:!1},MPe=()=>{if(!Ou())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(p_.tested)return p_.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),p_.tested=!0,p_.writable=!0}catch{p_.tested=!0,p_.writable=!1}return p_.writable};function rnt(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 TPe=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>p3(async()=>{const{default:s}=await Promise.resolve().then(()=>gk);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},nnt=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",M4=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},m_=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},S0=async(t,e)=>{await t.removeItem(e)};class Jne{constructor(){this.promise=new Jne.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Jne.promiseConstructor=Promise;function Yle(t){const e=t.split(".");if(e.length!==3)throw new xhe("Invalid JWT structure");for(let s=0;s{setTimeout(()=>e(null),t)})}function ant(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 int(t){return("0"+t.toString(16)).substr(-2)}function ont(){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,int).join("")}async function lnt(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 cnt(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 lnt(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function l4(t,e,n=!1){const s=ont();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await M4(t,`${e}-code-verifier`,a);const o=await cnt(s);return[o,s===o?"plain":"s256"]}const dnt=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function unt(t){const e=t.headers.get(mhe);if(!e||!e.match(dnt))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function hnt(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 fnt(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 pnt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function c4(t){if(!pnt.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Xle(){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 mnt(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 Nje(t){return JSON.parse(JSON.stringify(t))}const Ow=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),gnt=[502,503,504];async function Sje(t){var e;if(!nnt(t))throw new ghe(Ow(t),0);if(gnt.includes(t.status))throw new ghe(Ow(t),t.status);let n;try{n=await t.json()}catch(o){throw new $w(Ow(o),o)}let s;const a=unt(t);if(a&&a.getTime()>=SPe["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 bje(Ow(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new Zp}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 bje(Ow(n),t.status,n.weak_password.reasons);throw new Hrt(Ow(n),t.status||500,s)}const xnt=(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 Pa(t,e,n,s){var a;const o=Object.assign({},s==null?void 0:s.headers);o[mhe]||(o[mhe]=SPe["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():"",u=await ynt(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(u):{data:Object.assign({},u),error:null}}async function ynt(t,e,n,s,a,o){const l=xnt(e,s,a,o);let i;try{i=await t(n,Object.assign({},l))}catch(u){throw console.error(u),new ghe(Ow(u),0)}if(i.ok||await Sje(i),s!=null&&s.noResolveJson)return i;try{return await i.json()}catch(u){await Sje(u)}}function Yp(t){var e;let n=null;bnt(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=ent(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:s},error:null}}function Cje(t){const e=Yp(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 Z0(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function vnt(t){return{data:t,error:null}}function _nt(t){const{action_link:e,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o}=t,l=fv(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},u=Object.assign({},l);return{data:{properties:i,user:u},error:null}}function Mje(t){return t}function bnt(t){return t.access_token&&t.refresh_token&&t.expires_in}const Qle=["global","local","others"];class wnt{constructor({url:e="",headers:n={},fetch:s}){this.url=e,this.headers=n,this.fetch=TPe(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=Qle[0]){if(Qle.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Qle.join(", ")}`);try{return await Pa(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ta(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,n={}){try{return await Pa(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Z0})}catch(s){if(ta(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:n}=e,s=fv(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 Pa(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:_nt,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(ta(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await Pa(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Z0})}catch(n){if(ta(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,s,a,o,l,i,u;try{const p={nextPage:null,lastPage:0,total:0},x=await Pa(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:Mje});if(x.error)throw x.error;const y=await x.json(),_=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,w=(u=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&u!==void 0?u:[];return w.length>0&&(w.forEach(S=>{const N=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),M=JSON.parse(S.split(";")[1].split("=")[1]);p[`${M}Page`]=N}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(ta(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){c4(e);try{return await Pa(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Z0})}catch(n){if(ta(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){c4(e);try{return await Pa(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Z0})}catch(s){if(ta(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,n=!1){c4(e);try{return await Pa(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Z0})}catch(s){if(ta(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){c4(e.userId);try{const{data:n,error:s}=await Pa(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(ta(n))return{data:null,error:n};throw n}}async _deleteFactor(e){c4(e.userId),c4(e.id);try{return{data:await Pa(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(ta(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,s,a,o,l,i,u;try{const p={nextPage:null,lastPage:0,total:0},x=await Pa(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:Mje});if(x.error)throw x.error;const y=await x.json(),_=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,w=(u=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&u!==void 0?u:[];return w.length>0&&(w.forEach(S=>{const N=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),M=JSON.parse(S.split(";")[1].split("=")[1]);p[`${M}Page`]=N}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(ta(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await Pa(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ta(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await Pa(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ta(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await Pa(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ta(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{return await Pa(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ta(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await Pa(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ta(n))return{data:null,error:n};throw n}}}function Tje(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const d4={debug:!!(globalThis&&MPe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class APe extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class jnt extends APe{}async function knt(t,e,n){d4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),d4.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){d4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,a.name);try{return await n()}finally{d4.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,a.name)}}else{if(e===0)throw d4.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new jnt(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(d4.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 Nnt(){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 EPe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Snt(t){return parseInt(t,16)}function Cnt(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function Mnt(t){var e;const{chainId:n,domain:s,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:u,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 w=EPe(t.address),S=x?`${x}://${s}`:s,N=t.statement?`${t.statement} `:"",M=`${S} wants you to sign in with your Ethereum account: ${w} ${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()}`),u&&(E+=` Request ID: ${u}`),p){let A=` 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}`);A+=` - ${P}`}E+=A}return`${M} ${E}`}class Ic 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 hte extends Ic{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function Tnt({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 Ic({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 Ic({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 Ic({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 Ic({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 Ic({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ic({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 Ic({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ic({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(IPe(l)){if(o.rp.id!==l)return new Ic({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ic({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 Ic({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 Ic({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 Ic({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Ant({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 Ic({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ic({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(IPe(s)){if(n.rpId!==s)return new Ic({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ic({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ic({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 Ic({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Ent{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 Int=new Ent;function Pnt(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=fv(t,["challenge","user","excludeCredentials"]),o=LS(e).buffer,l=Object.assign(Object.assign({},n),{id:LS(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 u=0;u0){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]=fte(i,l):s[o]=fte(l)}else s[o]=l}return s}function $nt(t,e){return fte(znt,t,e||{})}function Unt(t,e){return fte(Bnt,t,e||{})}class qnt{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 u=a??Int.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=$nt(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Rnt({publicKey:p,signal:u});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=Unt(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Fnt(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:u}));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 ta(l)?{data:null,error:l}:{data:null,error:new $w("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 uE("rpId is required for WebAuthn authentication")};try{if(!Aje())return{data:null,error:new $w("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:u}=l;return this._verify({factorId:e,challengeId:l.challengeId,webauthn:{type:u.type,rpId:n,rpOrigins:s,credential_response:u.credential_response}})}catch(l){return ta(l)?{data:null,error:l}:{data:null,error:new $w("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 uE("rpId is required for WebAuthn registration")};try{if(!Aje())return{data:null,error:new $w("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:u,error:p}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:a},{create:o});return u?this._verify({factorId:l.id,challengeId:u.challengeId,webauthn:{rpId:n,rpOrigins:s,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:p}}catch(l){return ta(l)?{data:null,error:l}:{data:null,error:new $w("Unexpected error in register",l)}}}}Nnt();const Vnt={url:Brt,storageKey:$rt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Urt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Eje(t,e,n){return await n()}const u4={};class hE{get jwks(){var e,n;return(n=(e=u4[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){u4[this.storageKey]=Object.assign(Object.assign({},u4[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=u4[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){u4[this.storageKey]=Object.assign(Object.assign({},u4[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=hE.nextInstanceID,hE.nextInstanceID+=1,this.instanceID>0&&Ou()&&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({},Vnt),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 wnt({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=TPe(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:Ou()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=knt: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 qnt(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:MPe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Tje(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Tje(this.memoryStorage)),Ou()&&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} (${NPe}) ${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=rnt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),Ou()&&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),Krt(o)){const u=(e=o.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="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 ta(n)?{error:n}:{error:new $w("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,s,a;try{const o=await Pa(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:Yp}),{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const u=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:p,session:u},error:null}}catch(o){if(ta(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 w=null,S=null;this.flowType==="pkce"&&([w,S]=await l4(this.storage,this.storageKey)),o=await Pa(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:w,code_challenge_method:S},xform:Yp})}else if("phone"in e){const{phone:x,password:y,options:_}=e;o=await Pa(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:Yp})}else throw new AL("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 u=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:p,session:u},error:null}}catch(o){if(ta(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 Pa(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:Cje})}else if("phone"in e){const{phone:o,password:l,options:i}=e;n=await Pa(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:Cje})}else throw new AL("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 o4}:(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(ta(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,u,p,x,y,_;let w,S;if("message"in e)w=e.message,S=e.signature;else{const{chain:N,wallet:M,statement:E,options:A}=e;let P;if(Ou())if(typeof M=="object")P=M;else{const W=window;if("ethereum"in W&&typeof W.ethereum=="object"&&"request"in W.ethereum&&typeof W.ethereum.request=="function")P=W.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 M!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=M}const z=new URL((n=A==null?void 0:A.url)!==null&&n!==void 0?n:window.location.href),R=await P.request({method:"eth_requestAccounts"}).then(W=>W).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!R||R.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const U=EPe(R[0]);let V=(s=A==null?void 0:A.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!V){const W=await P.request({method:"eth_chainId"});V=Snt(W)}const K={domain:z.host,address:U,statement:E,uri:z.href,version:"1",chainId:V,nonce:(a=A==null?void 0:A.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(l=(o=A==null?void 0:A.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(i=A==null?void 0:A.signInWithEthereum)===null||i===void 0?void 0:i.expirationTime,notBefore:(u=A==null?void 0:A.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(p=A==null?void 0:A.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(x=A==null?void 0:A.signInWithEthereum)===null||x===void 0?void 0:x.resources};w=Mnt(K),S=await P.request({method:"personal_sign",params:[Cnt(w),U]})}try{const{data:N,error:M}=await Pa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:w,signature:S},!((y=e.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Yp});if(M)throw M;return!N||!N.session||!N.user?{data:{user:null,session:null},error:new o4}:(N.session&&(await this._saveSession(N.session),await this._notifyAllSubscribers("SIGNED_IN",N.session)),{data:Object.assign({},N),error:M})}catch(N){if(ta(N))return{data:{user:null,session:null},error:N};throw N}}async signInWithSolana(e){var n,s,a,o,l,i,u,p,x,y,_,w;let S,N;if("message"in e)S=e.message,N=e.signature;else{const{chain:M,wallet:E,statement:A,options:P}=e;let z;if(Ou())if(typeof E=="object")z=E;else{const U=window;if("solana"in U&&typeof U.solana=="object"&&("signIn"in U.solana&&typeof U.solana.signIn=="function"||"signMessage"in U.solana&&typeof U.solana.signMessage=="function"))z=U.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 R=new URL((n=P==null?void 0:P.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in z&&z.signIn){const U=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},P==null?void 0:P.signInWithSolana),{version:"1",domain:R.host,uri:R.href}),A?{statement:A}:null));let V;if(Array.isArray(U)&&U[0]&&typeof U[0]=="object")V=U[0];else if(U&&typeof U=="object"&&"signedMessage"in U&&"signature"in U)V=U;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)S=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");S=[`${R.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${R.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}`]:[],...!((u=P==null?void 0:P.signInWithSolana)===null||u===void 0)&&u.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 U=await z.signMessage(new TextEncoder().encode(S),"utf8");if(!U||!(U instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");N=U}}try{const{data:M,error:E}=await Pa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:Kw(N)},!((_=e.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Yp});if(E)throw E;return!M||!M.session||!M.user?{data:{user:null,session:null},error:new o4}:(M.session&&(await this._saveSession(M.session),await this._notifyAllSubscribers("SIGNED_IN",M.session)),{data:Object.assign({},M),error:E})}catch(M){if(ta(M))return{data:{user:null,session:null},error:M};throw M}}async _exchangeCodeForSession(e){const n=await m_(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(n??"").split("/");try{const{data:o,error:l}=await Pa(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:Yp});if(await S0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new o4}:(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(ta(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 Pa(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:Yp}),{data:u,error:p}=i;return p?{data:{user:null,session:null},error:p}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new o4}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:p})}catch(n){if(ta(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:u}=e;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await l4(this.storage,this.storageKey));const{error:y}=await Pa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(n=u==null?void 0:u.data)!==null&&n!==void 0?n:{},create_user:(s=u==null?void 0:u.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:p,code_challenge_method:x},redirectTo:u==null?void 0:u.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in e){const{phone:i,options:u}=e,{data:p,error:x}=await Pa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:i,data:(a=u==null?void 0:u.data)!==null&&a!==void 0?a:{},create_user:(o=u==null?void 0:u.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(l=u==null?void 0:u.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 AL("You must provide either an email or phone number.")}catch(i){if(ta(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 Pa(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:Yp});if(i)throw i;if(!l)throw new Error("An error occurred on token verification.");const u=l.session,p=l.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:p,session:u},error:null}}catch(a){if(ta(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 l4(this.storage,this.storageKey)),await Pa(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:vnt})}catch(o){if(ta(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 Zp;const{error:a}=await Pa(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:a}})}catch(e){if(ta(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 Pa(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 Pa(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 AL("You must provide either an email or phone number and a type")}catch(n){if(ta(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 m_(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 Pa(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Z0}):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 Zp}:await Pa(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:Z0})})}catch(n){if(ta(n))return Grt(n)&&(await this._removeSession(),await S0(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 Zp;const l=a.session;let i=null,u=null;this.flowType==="pkce"&&e.email!=null&&([i,u]=await l4(this.storage,this.storageKey));const{data:p,error:x}=await Pa(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:u}),jwt:l.access_token,xform:Z0});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(ta(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 Zp;const n=Date.now()/1e3;let s=n,a=!0,o=null;const{payload:l}=Yle(e.access_token);if(l.exp&&(s=l.exp,a=s<=n),a){const{data:i,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!i)return{data:{user:null,session:null},error:null};o=i}else{const{data:i,error:u}=await this._getUser(e.access_token);if(u)throw u;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(ta(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 Zp;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(ta(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!Ou())throw new EL("No browser detected.");if(e.error||e.error_description||e.error_code)throw new EL(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 _je("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new EL("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 _je("No code detected.");const{data:A,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:A.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:o,refresh_token:l,expires_in:i,expires_at:u,token_type:p}=e;if(!o||!i||!l||!p)throw new EL("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(i);let _=x+y;u&&(_=parseInt(u));const w=_-x;w*1e3<=C4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${w}s, should have been closer to ${y}s`);const S=_-y;x-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,_,x):x-S<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",S,_,x);const{data:N,error:M}=await this._getUser(o);if(M)throw M;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(ta(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 m_(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&&!(Wrt(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return e!=="others"&&(await this._removeSession(),await S0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=tnt(),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 l4(this.storage,this.storageKey,!0));try{return await Pa(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(ta(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(ta(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,u,p,x;const{data:y,error:_}=o;if(_)throw _;const w=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:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await Pa(this.fetch,"GET",w,{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 Ou()&&!(!((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(ta(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:u,access_token:p,nonce:x}=e,y=await Pa(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:u,access_token:p,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Yp}),{data:_,error:w}=y;return w?{data:{user:null,session:null},error:w}:!_||!_.session||!_.user?{data:{user:null,session:null},error:new o4}:(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),{data:_,error:w})}catch(a){if(ta(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 Pa(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(ta(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 ant(async a=>(a>0&&await snt(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Pa(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Yp})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Zle(o)&&Date.now()+l-s{try{await i.callback(e,n)}catch(u){o.push(u)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),C4);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)/C4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${C4}ms, refresh threshold is ${phe} ticks`),a<=phe&&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 APe)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ou()||!(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 l4(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 Pa(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(ta(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:u,error:p}=await Pa(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"&&u.type==="totp"&&(!((a=u==null?void 0:u.totp)===null||a===void 0)&&a.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),{data:u,error:null})})}catch(n){if(ta(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"?Ont(e.webauthn.credential_response):Dnt(e.webauthn.credential_response)})}:{code:e.code}),{data:i,error:u}=await Pa(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 u?{data:null,error:u}:(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:u})})}catch(n){if(ta(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 Pa(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:Pnt(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:Lnt(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ta(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}=Yle(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 Pa(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 Zp}})}catch(n){if(ta(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 Zp};const l=await Pa(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&&Ou()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(ta(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 Zp};const l=await Pa(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&&Ou()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(ta(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+Vrt>a)return s;const{data:o,error:l}=await Pa(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:w,error:S}=await this.getSession();if(S||!w.session)return{data:null,error:S};s=w.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:u}}=Yle(s);n!=null&&n.allowExpired||hnt(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:w}=await this.getUser(s);if(w)throw w;return{data:{claims:o,header:a,signature:l},error:null}}const x=fnt(a.alg),y=await crypto.subtle.importKey("jwk",p,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Jrt(`${i}.${u}`)))throw new xhe("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(s){if(ta(s))return{data:null,error:s};throw s}}}hE.nextInstanceID=0;const Hnt=hE;class Wnt extends Hnt{constructor(e){super(e)}}class Gnt{constructor(e,n,s){var a,o,l;this.supabaseUrl=e,this.supabaseKey=n;const i=zrt(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 u=`sb-${i.hostname.split(".")[0]}-auth-token`,p={db:Ert,realtime:Prt,auth:Object.assign(Object.assign({},Irt),{storageKey:u}),global:Art},x=Frt(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=Drt(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 Btt(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new Crt(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new Itt(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:u,debug:p},x,y){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Wnt({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:u,debug:p,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new nrt(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 Knt=(t,e,n)=>new Gnt(t,e,n);function Znt(){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}Znt()&&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 Ynt="https://relzejiswnotikjgvjhz.supabase.co",Xnt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",Q=Knt(Ynt,Xnt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),PPe=I.createContext(void 0),Qnt=({children:t})=>{const[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(!0),[i,u]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState(null),[w,S]=I.useState([]),[N,M]=I.useState(null),E=Gn(),A=async U=>{try{console.log("Checking roles via RPC for user:",U);const[{data:V,error:K},{data:W,error:J}]=await Promise.all([Q.rpc("has_role",{_user_id:U,_role:"admin"}),Q.rpc("has_role",{_user_id:U,_role:"brokerage_manager"})]);if(K||J)console.error("Role RPC errors:",{isAdminError:K,isBrokerError:J}),u(!1),x(!1);else{const xe=!!V,ie=!!W;console.log("RPC roles result:",{adminValue:xe,brokerValue:ie}),u(xe),x(ie)}const{data:ae,error:oe}=await Q.from("profiles").select("brokerage_id").eq("id",U).single();if(_(!oe&&ae?ae.brokerage_id:null),W){console.log("Fetching managed brokerages for user:",U);const{data:xe,error:ie}=await Q.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",U);if(console.log("Managed brokerage assignments result:",{assignments:xe,assignmentsError:ie}),ie||!xe){console.error("Error fetching managed brokerage assignments:",ie),S([]);return}const pe=Array.from(new Set(xe.map(ye=>ye.brokerage_id).filter(Boolean)));if(pe.length===0){S([]);return}const{data:se,error:fe}=await Q.from("brokerages").select("id, name").in("id",pe);if(console.log("Managed brokerages details result:",{brokeragesData:se,brokeragesError:fe}),fe||!se){console.error("Error fetching managed brokerages details:",fe),S([]);return}const he=se.map(ye=>({id:ye.id,name:ye.name})).sort((ye,Ce)=>pe.indexOf(ye.id)-pe.indexOf(Ce.id));console.log("Parsed managed brokerages:",he),S(he),he.length>0&&!N&&M(he[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),S([])}catch(V){console.error("Unexpected error in checkRoles:",V),u(!1),x(!1),_(null),S([])}};I.useEffect(()=>{const{data:{subscription:U}}=Q.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(()=>{A(K.user.id)},0):(u(!1),x(!1),_(null),S([]),M(null))});return Q.auth.getSession().then(({data:{session:V}})=>{a(V),n((V==null?void 0:V.user)??null),V!=null&&V.user?A(V.user.id).finally(()=>{l(!1)}):l(!1)}),()=>U.unsubscribe()},[]);const P=async(U,V)=>{const{error:K}=await Q.auth.signInWithPassword({email:U,password:V});if(K)throw Oe.error(K.message),K;Oe.success("Welcome back!"),E("/dashboard")},z=async(U,V,K)=>{const W=`${window.location.origin}/dashboard`,{error:J}=await Q.auth.signUp({email:U,password:V,options:{emailRedirectTo:W,data:{name:K}}});if(J)throw Oe.error(J.message),J;Oe.success("Account created! Welcome to LevelUp."),E("/dashboard")},R=async()=>{try{const{data:{session:U}}=await Q.auth.getSession();if(U){const{error:V}=await Q.auth.signOut();V?V.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",V.message):(console.error("Sign out error:",V),Oe.error(V.message)):Oe.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),a(null),u(!1),x(!1),_(null),S([]),M(null),E("/auth")}catch(U){console.error("Unexpected sign out error:",U),E("/auth")}};return r.jsx(PPe.Provider,{value:{user:e,session:s,loading:o,signIn:P,signUp:z,signOut:R,isAdmin:i,isBrokerageManager:p,brokerageId:y,managedBrokerages:w,selectedBrokerageId:N,setSelectedBrokerageId:M},children:t})},Qr=()=>{const t=I.useContext(PPe);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},LPe=I.createContext(void 0),h4="levelup_admin_session",g_="levelup_impersonation",Jnt=({children:t})=>{const[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState(!1);I.useEffect(()=>{const p=sessionStorage.getItem(g_);if(p)try{const x=JSON.parse(p);n(!0),a(x)}catch{sessionStorage.removeItem(g_)}},[]);const i=async p=>{l(!0);try{const{data:{session:x}}=await Q.auth.getSession();if(!x)return Oe.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(h4,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})}),w=await _.json();if(!_.ok)throw new Error(w.error||"Failed to impersonate user");const S={id:w.targetUser.id,name:w.targetUser.name,email:w.targetUser.email};sessionStorage.setItem(g_,JSON.stringify(S));const{error:N}=await Q.auth.verifyOtp({token_hash:w.token_hash,type:"magiclink"});if(N)throw console.error("Verify OTP error:",N),sessionStorage.removeItem(h4),sessionStorage.removeItem(g_),new Error("Failed to establish impersonation session");return n(!0),a(S),Oe.success(`Now viewing as ${S.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),Oe.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(h4),sessionStorage.removeItem(g_),!1}finally{l(!1)}},u=async()=>{l(!0);try{const p=sessionStorage.getItem(h4);if(!p){await Q.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(p);await Q.auth.signOut();const{error:y}=await Q.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(h4),sessionStorage.removeItem(g_),y){console.error("Failed to restore admin session:",y),Oe.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),a(null),Oe.success("Returned to admin account"),window.location.href="/admin/members"}catch(p){console.error("Stop impersonation error:",p),Oe.error("Failed to restore admin session"),sessionStorage.removeItem(h4),sessionStorage.removeItem(g_),window.location.href="/auth"}finally{l(!1)}};return r.jsx(LPe.Provider,{value:{isImpersonating:e,impersonatedUser:s,startImpersonation:i,stopImpersonation:u,isLoading:o},children:t})},OPe=()=>{const t=I.useContext(LPe);if(t===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return t},fE=i3("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-full px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),te=I.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,...a},o)=>{const l=s?cge:"button";return r.jsx(l,{className:zt(fE({variant:e,size:n,className:t})),ref:o,...a})});te.displayName="Button";const est=()=>{const{isImpersonating:t,impersonatedUser:e,stopImpersonation:n,isLoading:s}=OPe();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(Xh,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("span",{className:"font-medium text-sm md:text-base",children:[r.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),r.jsx("strong",{children:e.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",e.email,")"]})]})]}),r.jsx(te,{size:"sm",variant:"secondary",onClick:n,disabled:s,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:s?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(gs,{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"})]})})]})})},DPe=I.createContext(void 0),VM="levelup_acting_as",tst=({children:t})=>{const{user:e}=Qr(),[n,s]=I.useState(!1),[a,o]=I.useState([]),[l,i]=I.useState(null),[u,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:M}=await Q.rpc("has_role",{_user_id:e.id,_role:"assistant"});if(!M){s(!1),o([]),i(null),p({}),y(!1);return}s(!0);const{data:E,error:A}=await Q.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",e.id);if(A||!E||E.length===0){o([]),y(!1);return}const P=E.map(V=>V.agent_id),{data:z}=await Q.from("profiles").select("id, name, email, avatar_url").in("id",P),R=(z||[]).map(V=>({id:V.id,name:V.name||V.email||"Unknown",email:V.email||"",avatar_url:V.avatar_url}));o(R);const U=sessionStorage.getItem(VM);if(U){const V=R.find(K=>K.id===U);if(V){i(V);const K=E.find(W=>W.agent_id===U);p((K==null?void 0:K.permissions)||{})}else if(R.length>0){i(R[0]);const K=E.find(W=>W.agent_id===R[0].id);p((K==null?void 0:K.permissions)||{}),sessionStorage.setItem(VM,R[0].id)}}else if(R.length>0){i(R[0]);const V=E.find(K=>K.agent_id===R[0].id);p((V==null?void 0:V.permissions)||{}),sessionStorage.setItem(VM,R[0].id)}}catch(M){console.error("Error loading assistant data:",M)}finally{y(!1)}})()},[e==null?void 0:e.id]);const _=N=>{i(N),N?(sessionStorage.setItem(VM,N.id),Q.from("agent_assistant_assignments").select("permissions").eq("assistant_id",(e==null?void 0:e.id)||"").eq("agent_id",N.id).single().then(({data:M})=>{p((M==null?void 0:M.permissions)||{})})):(sessionStorage.removeItem(VM),p({}))},w=N=>n?u[N]===!0:!0,S=n&&l?l.id:(e==null?void 0:e.id)||null;return r.jsx(DPe.Provider,{value:{isAssistant:n,assignedAgents:a,actingAsAgent:l,setActingAsAgent:_,effectiveUserId:S,permissions:u,hasPermission:w,isLoading:x},children:t})},Vge=()=>{const t=I.useContext(DPe);if(t===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return t},Bc=()=>{const{effectiveUserId:t}=Vge();return t};var RPe={exports:{}},FPe={};/** * @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 yC=I;function rst(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var nst=typeof Object.is=="function"?Object.is:rst,sst=yC.useState,ast=yC.useEffect,ist=yC.useLayoutEffect,ost=yC.useDebugValue;function lst(t,e){var n=e(),s=sst({inst:{value:n,getSnapshot:e}}),a=s[0].inst,o=s[1];return ist(function(){a.value=n,a.getSnapshot=e,Jle(a)&&o({inst:a})},[t,n,e]),ast(function(){return Jle(a)&&o({inst:a}),t(function(){Jle(a)&&o({inst:a})})},[t]),ost(n),n}function Jle(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!nst(t,n)}catch{return!0}}function cst(t,e){return e()}var dst=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?cst:lst;FPe.useSyncExternalStore=yC.useSyncExternalStore!==void 0?yC.useSyncExternalStore:dst;RPe.exports=FPe;var ust=RPe.exports;function hst(){return ust.useSyncExternalStore(fst,()=>!0,()=>!1)}function fst(){return()=>{}}var Hge="Avatar",[pst]=lc(Hge),[mst,zPe]=pst(Hge),BPe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,...s}=t,[a,o]=I.useState("idle");return r.jsx(mst,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx(Rn.span,{...s,ref:e})})});BPe.displayName=Hge;var $Pe="AvatarImage",UPe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...o}=t,l=zPe($Pe,n),i=gst(s,o),u=nc(p=>{a(p),l.onImageLoadingStatusChange(p)});return ic(()=>{i!=="idle"&&u(i)},[i,u]),i==="loaded"?r.jsx(Rn.img,{...o,ref:e,src:s}):null});UPe.displayName=$Pe;var qPe="AvatarFallback",VPe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:s,...a}=t,o=zPe(qPe,n),[l,i]=I.useState(s===void 0);return I.useEffect(()=>{if(s!==void 0){const u=window.setTimeout(()=>i(!0),s);return()=>window.clearTimeout(u)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Rn.span,{...a,ref:e}):null});VPe.displayName=qPe;function Ije(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function gst(t,{referrerPolicy:e,crossOrigin:n}){const s=hst(),a=I.useRef(null),o=s?(a.current||(a.current=new window.Image),a.current):null,[l,i]=I.useState(()=>Ije(o,t));return ic(()=>{i(Ije(o,t))},[o,t]),ic(()=>{const u=y=>()=>{i(y)};if(!o)return;const p=u("loaded"),x=u("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 HPe=BPe,WPe=UPe,GPe=VPe;const Ys=I.forwardRef(({className:t,...e},n)=>r.jsx(HPe,{ref:n,className:zt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Ys.displayName=HPe.displayName;const Pi=I.forwardRef(({className:t,...e},n)=>r.jsx(WPe,{ref:n,className:zt("aspect-square h-full w-full",t),...e}));Pi.displayName=WPe.displayName;const Xs=I.forwardRef(({className:t,...e},n)=>r.jsx(GPe,{ref:n,className:zt("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Xs.displayName=GPe.displayName;const xst=i3("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 Lt({className:t,variant:e,...n}){return r.jsx("div",{className:zt(xst({variant:e}),t),...n})}var yst=I.createContext(void 0);function xk(t){const e=I.useContext(yst);return t||e||"ltr"}var ece=0;function ese(){I.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Pje()),document.body.insertAdjacentElement("beforeend",t[1]??Pje()),ece++,()=>{ece===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),ece--}},[])}function Pje(){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 tce="focusScope.autoFocusOnMount",rce="focusScope.autoFocusOnUnmount",Lje={bubbles:!1,cancelable:!0},vst="FocusScope",II=I.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=t,[i,u]=I.useState(null),p=nc(a),x=nc(o),y=I.useRef(null),_=ra(e,N=>u(N)),w=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(s){let N=function(P){if(w.paused||!i)return;const z=P.target;i.contains(z)?y.current=z:A0(y.current,{select:!0})},M=function(P){if(w.paused||!i)return;const z=P.relatedTarget;z!==null&&(i.contains(z)||A0(y.current,{select:!0}))},E=function(P){if(document.activeElement===document.body)for(const R of P)R.removedNodes.length>0&&A0(i)};document.addEventListener("focusin",N),document.addEventListener("focusout",M);const A=new MutationObserver(E);return i&&A.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",M),A.disconnect()}}},[s,i,w.paused]),I.useEffect(()=>{if(i){Dje.add(w);const N=document.activeElement;if(!i.contains(N)){const E=new CustomEvent(tce,Lje);i.addEventListener(tce,p),i.dispatchEvent(E),E.defaultPrevented||(_st(Nst(KPe(i)),{select:!0}),document.activeElement===N&&A0(i))}return()=>{i.removeEventListener(tce,p),setTimeout(()=>{const E=new CustomEvent(rce,Lje);i.addEventListener(rce,x),i.dispatchEvent(E),E.defaultPrevented||A0(N??document.body,{select:!0}),i.removeEventListener(rce,x),Dje.remove(w)},0)}}},[i,p,x,w]);const S=I.useCallback(N=>{if(!n&&!s||w.paused)return;const M=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(M&&E){const A=N.currentTarget,[P,z]=bst(A);P&&z?!N.shiftKey&&E===z?(N.preventDefault(),n&&A0(P,{select:!0})):N.shiftKey&&E===P&&(N.preventDefault(),n&&A0(z,{select:!0})):E===A&&N.preventDefault()}},[n,s,w.paused]);return r.jsx(Rn.div,{tabIndex:-1,...l,ref:_,onKeyDown:S})});II.displayName=vst;function _st(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(A0(s,{select:e}),document.activeElement!==n)return}function bst(t){const e=KPe(t),n=Oje(e,t),s=Oje(e.reverse(),t);return[n,s]}function KPe(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 Oje(t,e){for(const n of t)if(!wst(n,{upTo:e}))return n}function wst(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 jst(t){return t instanceof HTMLInputElement&&"select"in t}function A0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&jst(t)&&e&&t.select()}}var Dje=kst();function kst(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Rje(t,e),t.unshift(e)},remove(e){var n;t=Rje(t,e),(n=t[0])==null||n.resume()}}}function Rje(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function Nst(t){return t.filter(e=>e.tagName!=="A")}var nce="rovingFocusGroup.onEntryFocus",Sst={bubbles:!1,cancelable:!0},PI="RovingFocusGroup",[yhe,ZPe,Cst]=jI(PI),[Mst,x3]=lc(PI,[Cst]),[Tst,Ast]=Mst(PI),YPe=I.forwardRef((t,e)=>r.jsx(yhe.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(yhe.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(Est,{...t,ref:e})})}));YPe.displayName=PI;var Est=I.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:u,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...y}=t,_=I.useRef(null),w=ra(e,_),S=xk(o),[N,M]=Ku({prop:l,defaultProp:i??null,onChange:u,caller:PI}),[E,A]=I.useState(!1),P=nc(p),z=ZPe(n),R=I.useRef(!1),[U,V]=I.useState(0);return I.useEffect(()=>{const K=_.current;if(K)return K.addEventListener(nce,P),()=>K.removeEventListener(nce,P)},[P]),r.jsx(Tst,{scope:n,orientation:s,dir:S,loop:a,currentTabStopId:N,onItemFocus:I.useCallback(K=>M(K),[M]),onItemShiftTab:I.useCallback(()=>A(!0),[]),onFocusableItemAdd:I.useCallback(()=>V(K=>K+1),[]),onFocusableItemRemove:I.useCallback(()=>V(K=>K-1),[]),children:r.jsx(Rn.div,{tabIndex:E||U===0?-1:0,"data-orientation":s,...y,ref:w,style:{outline:"none",...t.style},onMouseDown:cn(t.onMouseDown,()=>{R.current=!0}),onFocus:cn(t.onFocus,K=>{const W=!R.current;if(K.target===K.currentTarget&&W&&!E){const J=new CustomEvent(nce,Sst);if(K.currentTarget.dispatchEvent(J),!J.defaultPrevented){const ae=z().filter(se=>se.focusable),oe=ae.find(se=>se.active),xe=ae.find(se=>se.id===N),pe=[oe,xe,...ae].filter(Boolean).map(se=>se.ref.current);JPe(pe,x)}}R.current=!1}),onBlur:cn(t.onBlur,()=>A(!1))})})}),XPe="RovingFocusGroupItem",QPe=I.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:o,children:l,...i}=t,u=Qc(),p=o||u,x=Ast(XPe,n),y=x.currentTabStopId===p,_=ZPe(n),{onFocusableItemAdd:w,onFocusableItemRemove:S,currentTabStopId:N}=x;return I.useEffect(()=>{if(s)return w(),()=>S()},[s,w,S]),r.jsx(yhe.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:cn(t.onMouseDown,M=>{s?x.onItemFocus(p):M.preventDefault()}),onFocus:cn(t.onFocus,()=>x.onItemFocus(p)),onKeyDown:cn(t.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){x.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const E=Lst(M,x.orientation,x.dir);if(E!==void 0){if(M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;M.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(M.currentTarget);P=x.loop?Ost(P,z+1):P.slice(z+1)}setTimeout(()=>JPe(P))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:N!=null}):l})})});QPe.displayName=XPe;var Ist={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Pst(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Lst(t,e,n){const s=Pst(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Ist[s]}function JPe(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function Ost(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var Wge=YPe,Gge=QPe,Dst=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},f4=new WeakMap,IL=new WeakMap,PL={},sce=0,e6e=function(t){return t&&(t.host||e6e(t.parentNode))},Rst=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=e6e(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})},Fst=function(t,e,n,s){var a=Rst(e,Array.isArray(t)?t:[t]);PL[n]||(PL[n]=new WeakMap);var o=PL[n],l=[],i=new Set,u=new Set(a),p=function(y){!y||i.has(y)||(i.add(y),p(y.parentNode))};a.forEach(p);var x=function(y){!y||u.has(y)||Array.prototype.forEach.call(y.children,function(_){if(i.has(_))x(_);else try{var w=_.getAttribute(s),S=w!==null&&w!=="false",N=(f4.get(_)||0)+1,M=(o.get(_)||0)+1;f4.set(_,N),o.set(_,M),l.push(_),N===1&&S&&IL.set(_,!0),M===1&&_.setAttribute(n,"true"),S||_.setAttribute(s,"true")}catch(E){console.error("aria-hidden: cannot operate on ",_,E)}})};return x(e),i.clear(),sce++,function(){l.forEach(function(y){var _=f4.get(y)-1,w=o.get(y)-1;f4.set(y,_),o.set(y,w),_||(IL.has(y)||y.removeAttribute(s),IL.delete(y)),w||y.removeAttribute(n)}),sce--,sce||(f4=new WeakMap,f4=new WeakMap,IL=new WeakMap,PL={})}},tse=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),a=Dst(t);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),Fst(s,a,n,"aria-hidden")):function(){return null}},xee="right-scroll-bar-position",yee="width-before-scroll-bar",zst="with-scroll-bars-hidden",Bst="--removed-body-scroll-bar-size";function ace(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function $st(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 Ust=typeof window<"u"?I.useLayoutEffect:I.useEffect,Fje=new WeakMap;function qst(t,e){var n=$st(null,function(s){return t.forEach(function(a){return ace(a,s)})});return Ust(function(){var s=Fje.get(n);if(s){var a=new Set(s),o=new Set(t),l=n.current;a.forEach(function(i){o.has(i)||ace(i,null)}),o.forEach(function(i){a.has(i)||ace(i,l)})}Fje.set(n,t)},[t]),n}function Vst(t){return t}function Hst(t,e){e===void 0&&(e=Vst);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 u=function(){var x=l;l=[],x.forEach(o)},p=function(){return Promise.resolve().then(u)};p(),n={push:function(x){l.push(x),p()},filter:function(x){return l=l.filter(x),n}}}};return a}function Wst(t){t===void 0&&(t={});var e=Hst(null);return e.options=Kf({async:!0,ssr:!1},t),e}var t6e=function(t){var e=t.sideCar,n=fv(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,Kf({},n))};t6e.isSideCarExport=!0;function Gst(t,e){return t.useMedium(e),t6e}var r6e=Wst(),ice=function(){},rse=I.forwardRef(function(t,e){var n=I.useRef(null),s=I.useState({onScrollCapture:ice,onWheelCapture:ice,onTouchMoveCapture:ice}),a=s[0],o=s[1],l=t.forwardProps,i=t.children,u=t.className,p=t.removeScrollBar,x=t.enabled,y=t.shards,_=t.sideCar,w=t.noRelative,S=t.noIsolation,N=t.inert,M=t.allowPinchZoom,E=t.as,A=E===void 0?"div":E,P=t.gapMode,z=fv(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=_,U=qst([n,e]),V=Kf(Kf({},z),a);return I.createElement(I.Fragment,null,x&&I.createElement(R,{sideCar:r6e,removeScrollBar:p,shards:y,noRelative:w,noIsolation:S,inert:N,setCallbacks:o,allowPinchZoom:!!M,lockRef:n,gapMode:P}),l?I.cloneElement(I.Children.only(i),Kf(Kf({},V),{ref:U})):I.createElement(A,Kf({},V,{className:u,ref:U}),i))});rse.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};rse.classNames={fullWidth:yee,zeroRight:xee};var Kst=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Zst(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Kst();return e&&t.setAttribute("nonce",e),t}function Yst(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Xst(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Qst=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Zst())&&(Yst(e,n),Xst(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Jst=function(){var t=Qst();return function(e,n){I.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},n6e=function(){var t=Jst(),e=function(n){var s=n.styles,a=n.dynamic;return t(s,a),null};return e},eat={left:0,top:0,right:0,gap:0},oce=function(t){return parseInt(t||"",10)||0},tat=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[oce(n),oce(s),oce(a)]},rat=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return eat;var e=tat(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])}},nat=n6e(),OS="data-scroll-locked",sat=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(zst,` { overflow: hidden `).concat(s,`; padding-right: `).concat(i,"px ").concat(s,`; } body[`).concat(OS,`] { 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(xee,` { right: `).concat(i,"px ").concat(s,`; } .`).concat(yee,` { margin-right: `).concat(i,"px ").concat(s,`; } .`).concat(xee," .").concat(xee,` { right: 0 `).concat(s,`; } .`).concat(yee," .").concat(yee,` { margin-right: 0 `).concat(s,`; } body[`).concat(OS,`] { `).concat(Bst,": ").concat(i,`px; } `)},zje=function(){var t=parseInt(document.body.getAttribute(OS)||"0",10);return isFinite(t)?t:0},aat=function(){I.useEffect(function(){return document.body.setAttribute(OS,(zje()+1).toString()),function(){var t=zje()-1;t<=0?document.body.removeAttribute(OS):document.body.setAttribute(OS,t.toString())}},[])},iat=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,a=s===void 0?"margin":s;aat();var o=I.useMemo(function(){return rat(a)},[a]);return I.createElement(nat,{styles:sat(o,!e,a,n?"":"!important")})},vhe=!1;if(typeof window<"u")try{var LL=Object.defineProperty({},"passive",{get:function(){return vhe=!0,!0}});window.addEventListener("test",LL,LL),window.removeEventListener("test",LL,LL)}catch{vhe=!1}var p4=vhe?{passive:!1}:!1,oat=function(t){return t.tagName==="TEXTAREA"},s6e=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!oat(t)&&n[e]==="visible")},lat=function(t){return s6e(t,"overflowY")},cat=function(t){return s6e(t,"overflowX")},Bje=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=a6e(t,s);if(a){var o=i6e(t,s),l=o[1],i=o[2];if(l>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},dat=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},uat=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},a6e=function(t,e){return t==="v"?lat(e):cat(e)},i6e=function(t,e){return t==="v"?dat(e):uat(e)},hat=function(t,e){return t==="h"&&e==="rtl"?-1:1},fat=function(t,e,n,s,a){var o=hat(t,window.getComputedStyle(e).direction),l=o*s,i=n.target,u=e.contains(i),p=!1,x=l>0,y=0,_=0;do{if(!i)break;var w=i6e(t,i),S=w[0],N=w[1],M=w[2],E=N-M-o*S;(S||E)&&a6e(t,i)&&(y+=E,_+=S);var A=i.parentNode;i=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!u&&i!==document.body||u&&(e.contains(i)||e===i));return(x&&Math.abs(y)<1||!x&&Math.abs(_)<1)&&(p=!0),p},OL=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},$je=function(t){return[t.deltaX,t.deltaY]},Uje=function(t){return t&&"current"in t?t.current:t},pat=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mat=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},gat=0,m4=[];function xat(t){var e=I.useRef([]),n=I.useRef([0,0]),s=I.useRef(),a=I.useState(gat++)[0],o=I.useState(n6e)[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=Oge([t.lockRef.current],(t.shards||[]).map(Uje),!0).filter(Boolean);return N.forEach(function(M){return M.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),N.forEach(function(M){return M.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var i=I.useCallback(function(N,M){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!l.current.allowPinchZoom;var E=OL(N),A=n.current,P="deltaX"in N?N.deltaX:A[0]-E[0],z="deltaY"in N?N.deltaY:A[1]-E[1],R,U=N.target,V=Math.abs(P)>Math.abs(z)?"h":"v";if("touches"in N&&V==="h"&&U.type==="range")return!1;var K=Bje(V,U);if(!K)return!0;if(K?R=V:(R=V==="v"?"h":"v",K=Bje(V,U)),!K)return!1;if(!s.current&&"changedTouches"in N&&(P||z)&&(s.current=R),!R)return!0;var W=s.current||R;return fat(W,M,N,W==="h"?P:z)},[]),u=I.useCallback(function(N){var M=N;if(!(!m4.length||m4[m4.length-1]!==o)){var E="deltaY"in M?$je(M):OL(M),A=e.current.filter(function(R){return R.name===M.type&&(R.target===M.target||M.target===R.shadowParent)&&pat(R.delta,E)})[0];if(A&&A.should){M.cancelable&&M.preventDefault();return}if(!A){var P=(l.current.shards||[]).map(Uje).filter(Boolean).filter(function(R){return R.contains(M.target)}),z=P.length>0?i(M,P[0]):!l.current.noIsolation;z&&M.cancelable&&M.preventDefault()}}},[]),p=I.useCallback(function(N,M,E,A){var P={name:N,delta:M,target:E,should:A,shadowParent:yat(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=OL(N),s.current=void 0},[]),y=I.useCallback(function(N){p(N.type,$je(N),N.target,i(N,t.lockRef.current))},[]),_=I.useCallback(function(N){p(N.type,OL(N),N.target,i(N,t.lockRef.current))},[]);I.useEffect(function(){return m4.push(o),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:_}),document.addEventListener("wheel",u,p4),document.addEventListener("touchmove",u,p4),document.addEventListener("touchstart",x,p4),function(){m4=m4.filter(function(N){return N!==o}),document.removeEventListener("wheel",u,p4),document.removeEventListener("touchmove",u,p4),document.removeEventListener("touchstart",x,p4)}},[]);var w=t.removeScrollBar,S=t.inert;return I.createElement(I.Fragment,null,S?I.createElement(o,{styles:mat(a)}):null,w?I.createElement(iat,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function yat(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const vat=Gst(r6e,xat);var LI=I.forwardRef(function(t,e){return I.createElement(rse,Kf({},t,{ref:e,sideCar:vat}))});LI.classNames=rse.classNames;var _he=["Enter"," "],_at=["ArrowDown","PageUp","Home"],o6e=["ArrowUp","PageDown","End"],bat=[..._at,...o6e],wat={ltr:[..._he,"ArrowRight"],rtl:[..._he,"ArrowLeft"]},jat={ltr:["ArrowLeft"],rtl:["ArrowRight"]},OI="Menu",[pE,kat,Nat]=jI(OI),[yk,l6e]=lc(OI,[Nat,Wg,x3]),nse=Wg(),c6e=x3(),[Sat,vk]=yk(OI),[Cat,DI]=yk(OI),d6e=t=>{const{__scopeMenu:e,open:n=!1,children:s,dir:a,onOpenChange:o,modal:l=!0}=t,i=nse(e),[u,p]=I.useState(null),x=I.useRef(!1),y=nc(o),_=xk(a);return I.useEffect(()=>{const w=()=>{x.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>x.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),r.jsx(CI,{...i,children:r.jsx(Sat,{scope:e,open:n,onOpenChange:y,content:u,onContentChange:p,children:r.jsx(Cat,{scope:e,onClose:I.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:_,modal:l,children:s})})})};d6e.displayName=OI;var Mat="MenuAnchor",Kge=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,a=nse(n);return r.jsx(d3,{...a,...s,ref:e})});Kge.displayName=Mat;var Zge="MenuPortal",[Tat,u6e]=yk(Zge,{forceMount:void 0}),h6e=t=>{const{__scopeMenu:e,forceMount:n,children:s,container:a}=t,o=vk(Zge,e);return r.jsx(Tat,{scope:e,forceMount:n,children:r.jsx(jc,{present:n||o.open,children:r.jsx(a3,{asChild:!0,container:a,children:s})})})};h6e.displayName=Zge;var ip="MenuContent",[Aat,Yge]=yk(ip),f6e=I.forwardRef((t,e)=>{const n=u6e(ip,t.__scopeMenu),{forceMount:s=n.forceMount,...a}=t,o=vk(ip,t.__scopeMenu),l=DI(ip,t.__scopeMenu);return r.jsx(pE.Provider,{scope:t.__scopeMenu,children:r.jsx(jc,{present:s||o.open,children:r.jsx(pE.Slot,{scope:t.__scopeMenu,children:l.modal?r.jsx(Eat,{...a,ref:e}):r.jsx(Iat,{...a,ref:e})})})})}),Eat=I.forwardRef((t,e)=>{const n=vk(ip,t.__scopeMenu),s=I.useRef(null),a=ra(e,s);return I.useEffect(()=>{const o=s.current;if(o)return tse(o)},[]),r.jsx(Xge,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:cn(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Iat=I.forwardRef((t,e)=>{const n=vk(ip,t.__scopeMenu);return r.jsx(Xge,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Pat=ev("MenuContent.ScrollLock"),Xge=I.forwardRef((t,e)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:u,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:_,onDismiss:w,disableOutsideScroll:S,...N}=t,M=vk(ip,n),E=DI(ip,n),A=nse(n),P=c6e(n),z=kat(n),[R,U]=I.useState(null),V=I.useRef(null),K=ra(e,V,M.onContentChange),W=I.useRef(0),J=I.useRef(""),ae=I.useRef(0),oe=I.useRef(null),xe=I.useRef("right"),ie=I.useRef(0),pe=S?LI:I.Fragment,se=S?{as:Pat,allowPinchZoom:!0}:void 0,fe=ye=>{var Ue,Re;const Ce=J.current+ye,Se=z().filter(Be=>!Be.disabled),Ne=document.activeElement,be=(Ue=Se.find(Be=>Be.ref.current===Ne))==null?void 0:Ue.textValue,rt=Se.map(Be=>Be.textValue),Te=Hat(rt,Ce,be),Pe=(Re=Se.find(Be=>Be.textValue===Te))==null?void 0:Re.ref.current;(function Be(Ye){J.current=Ye,window.clearTimeout(W.current),Ye!==""&&(W.current=window.setTimeout(()=>Be(""),1e3))})(Ce),Pe&&setTimeout(()=>Pe.focus())};I.useEffect(()=>()=>window.clearTimeout(W.current),[]),ese();const he=I.useCallback(ye=>{var Se,Ne;return xe.current===((Se=oe.current)==null?void 0:Se.side)&&Gat(ye,(Ne=oe.current)==null?void 0:Ne.area)},[]);return r.jsx(Aat,{scope:n,searchRef:J,onItemEnter:I.useCallback(ye=>{he(ye)&&ye.preventDefault()},[he]),onItemLeave:I.useCallback(ye=>{var Ce;he(ye)||((Ce=V.current)==null||Ce.focus(),U(null))},[he]),onTriggerLeave:I.useCallback(ye=>{he(ye)&&ye.preventDefault()},[he]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:I.useCallback(ye=>{oe.current=ye},[]),children:r.jsx(pe,{...se,children:r.jsx(II,{asChild:!0,trapped:a,onMountAutoFocus:cn(o,ye=>{var Ce;ye.preventDefault(),(Ce=V.current)==null||Ce.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(uv,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:_,onDismiss:w,children:r.jsx(Wge,{asChild:!0,...P,dir:E.dir,orientation:"vertical",loop:s,currentTabStopId:R,onCurrentTabStopIdChange:U,onEntryFocus:cn(u,ye=>{E.isUsingKeyboardRef.current||ye.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(MI,{role:"menu","aria-orientation":"vertical","data-state":T6e(M.open),"data-radix-menu-content":"",dir:E.dir,...A,...N,ref:K,style:{outline:"none",...N.style},onKeyDown:cn(N.onKeyDown,ye=>{const Se=ye.target.closest("[data-radix-menu-content]")===ye.currentTarget,Ne=ye.ctrlKey||ye.altKey||ye.metaKey,be=ye.key.length===1;Se&&(ye.key==="Tab"&&ye.preventDefault(),!Ne&&be&&fe(ye.key));const rt=V.current;if(ye.target!==rt||!bat.includes(ye.key))return;ye.preventDefault();const Pe=z().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);o6e.includes(ye.key)&&Pe.reverse(),qat(Pe)}),onBlur:cn(t.onBlur,ye=>{ye.currentTarget.contains(ye.target)||(window.clearTimeout(W.current),J.current="")}),onPointerMove:cn(t.onPointerMove,mE(ye=>{const Ce=ye.target,Se=ie.current!==ye.clientX;if(ye.currentTarget.contains(Ce)&&Se){const Ne=ye.clientX>ie.current?"right":"left";xe.current=Ne,ie.current=ye.clientX}}))})})})})})})});f6e.displayName=ip;var Lat="MenuGroup",Qge=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{role:"group",...s,ref:e})});Qge.displayName=Lat;var Oat="MenuLabel",p6e=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});p6e.displayName=Oat;var pte="MenuItem",qje="menu.itemSelect",sse=I.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:s,...a}=t,o=I.useRef(null),l=DI(pte,t.__scopeMenu),i=Yge(pte,t.__scopeMenu),u=ra(e,o),p=I.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const _=new CustomEvent(qje,{bubbles:!0,cancelable:!0});y.addEventListener(qje,w=>s==null?void 0:s(w),{once:!0}),dge(y,_),_.defaultPrevented?p.current=!1:l.onClose()}};return r.jsx(m6e,{...a,ref:u,disabled:n,onClick:cn(t.onClick,x),onPointerDown:y=>{var _;(_=t.onPointerDown)==null||_.call(t,y),p.current=!0},onPointerUp:cn(t.onPointerUp,y=>{var _;p.current||(_=y.currentTarget)==null||_.click()}),onKeyDown:cn(t.onKeyDown,y=>{const _=i.searchRef.current!=="";n||_&&y.key===" "||_he.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});sse.displayName=pte;var m6e=I.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...o}=t,l=Yge(pte,n),i=c6e(n),u=I.useRef(null),p=ra(e,u),[x,y]=I.useState(!1),[_,w]=I.useState("");return I.useEffect(()=>{const S=u.current;S&&w((S.textContent??"").trim())},[o.children]),r.jsx(pE.ItemSlot,{scope:n,disabled:s,textValue:a??_,children:r.jsx(Gge,{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:cn(t.onPointerMove,mE(S=>{s?l.onItemLeave(S):(l.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:cn(t.onPointerLeave,mE(S=>l.onItemLeave(S))),onFocus:cn(t.onFocus,()=>y(!0)),onBlur:cn(t.onBlur,()=>y(!1))})})})}),Dat="MenuCheckboxItem",g6e=I.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:s,...a}=t;return r.jsx(b6e,{scope:t.__scopeMenu,checked:n,children:r.jsx(sse,{role:"menuitemcheckbox","aria-checked":mte(n)?"mixed":n,...a,ref:e,"data-state":exe(n),onSelect:cn(a.onSelect,()=>s==null?void 0:s(mte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});g6e.displayName=Dat;var x6e="MenuRadioGroup",[Rat,Fat]=yk(x6e,{value:void 0,onValueChange:()=>{}}),y6e=I.forwardRef((t,e)=>{const{value:n,onValueChange:s,...a}=t,o=nc(s);return r.jsx(Rat,{scope:t.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Qge,{...a,ref:e})})});y6e.displayName=x6e;var v6e="MenuRadioItem",_6e=I.forwardRef((t,e)=>{const{value:n,...s}=t,a=Fat(v6e,t.__scopeMenu),o=n===a.value;return r.jsx(b6e,{scope:t.__scopeMenu,checked:o,children:r.jsx(sse,{role:"menuitemradio","aria-checked":o,...s,ref:e,"data-state":exe(o),onSelect:cn(s.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,n)},{checkForDefaultPrevented:!1})})})});_6e.displayName=v6e;var Jge="MenuItemIndicator",[b6e,zat]=yk(Jge,{checked:!1}),w6e=I.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:s,...a}=t,o=zat(Jge,n);return r.jsx(jc,{present:s||mte(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{...a,ref:e,"data-state":exe(o.checked)})})});w6e.displayName=Jge;var Bat="MenuSeparator",j6e=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:e})});j6e.displayName=Bat;var $at="MenuArrow",k6e=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,a=nse(n);return r.jsx(TI,{...a,...s,ref:e})});k6e.displayName=$at;var Uat="MenuSub",[rXt,N6e]=yk(Uat),vT="MenuSubTrigger",S6e=I.forwardRef((t,e)=>{const n=vk(vT,t.__scopeMenu),s=DI(vT,t.__scopeMenu),a=N6e(vT,t.__scopeMenu),o=Yge(vT,t.__scopeMenu),l=I.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:u}=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),u(null)}},[i,u]),r.jsx(Kge,{asChild:!0,...p,children:r.jsx(m6e,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":T6e(n.open),...t,ref:gy(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:cn(t.onPointerMove,mE(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:cn(t.onPointerLeave,mE(y=>{var w,S;x();const _=(w=n.content)==null?void 0:w.getBoundingClientRect();if(_){const N=(S=n.content)==null?void 0:S.dataset.side,M=N==="right",E=M?-5:5,A=_[M?"left":"right"],P=_[M?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+E,y:y.clientY},{x:A,y:_.top},{x:P,y:_.top},{x:P,y:_.bottom},{x:A,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:cn(t.onKeyDown,y=>{var w;const _=o.searchRef.current!=="";t.disabled||_&&y.key===" "||wat[s.dir].includes(y.key)&&(n.onOpenChange(!0),(w=n.content)==null||w.focus(),y.preventDefault())})})})});S6e.displayName=vT;var C6e="MenuSubContent",M6e=I.forwardRef((t,e)=>{const n=u6e(ip,t.__scopeMenu),{forceMount:s=n.forceMount,...a}=t,o=vk(ip,t.__scopeMenu),l=DI(ip,t.__scopeMenu),i=N6e(C6e,t.__scopeMenu),u=I.useRef(null),p=ra(e,u);return r.jsx(pE.Provider,{scope:t.__scopeMenu,children:r.jsx(jc,{present:s||o.open,children:r.jsx(pE.Slot,{scope:t.__scopeMenu,children:r.jsx(Xge,{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=u.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:cn(t.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:cn(t.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:cn(t.onKeyDown,x=>{var w;const y=x.currentTarget.contains(x.target),_=jat[l.dir].includes(x.key);y&&_&&(o.onOpenChange(!1),(w=i.trigger)==null||w.focus(),x.preventDefault())})})})})})});M6e.displayName=C6e;function T6e(t){return t?"open":"closed"}function mte(t){return t==="indeterminate"}function exe(t){return mte(t)?"indeterminate":t?"checked":"unchecked"}function qat(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Vat(t,e){return t.map((n,s)=>t[(e+s)%t.length])}function Hat(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=Vat(t,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const u=l.find(p=>p.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function Wat(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 Gat(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Wat(n,e)}function mE(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Kat=d6e,Zat=Kge,Yat=h6e,Xat=f6e,Qat=Qge,Jat=p6e,eit=sse,tit=g6e,rit=y6e,nit=_6e,sit=w6e,ait=j6e,iit=k6e,oit=S6e,lit=M6e,ase="DropdownMenu",[cit]=lc(ase,[l6e]),Ju=l6e(),[dit,A6e]=cit(ase),E6e=t=>{const{__scopeDropdownMenu:e,children:n,dir:s,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=t,u=Ju(e),p=I.useRef(null),[x,y]=Ku({prop:a,defaultProp:o??!1,onChange:l,caller:ase});return r.jsx(dit,{scope:e,triggerId:Qc(),triggerRef:p,contentId:Qc(),open:x,onOpenChange:y,onOpenToggle:I.useCallback(()=>y(_=>!_),[y]),modal:i,children:r.jsx(Kat,{...u,open:x,onOpenChange:y,dir:s,modal:i,children:n})})};E6e.displayName=ase;var I6e="DropdownMenuTrigger",P6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=t,o=A6e(I6e,n),l=Ju(n);return r.jsx(Zat,{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:gy(e,o.triggerRef),onPointerDown:cn(t.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:cn(t.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});P6e.displayName=I6e;var uit="DropdownMenuPortal",L6e=t=>{const{__scopeDropdownMenu:e,...n}=t,s=Ju(e);return r.jsx(Yat,{...s,...n})};L6e.displayName=uit;var O6e="DropdownMenuContent",D6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=A6e(O6e,n),o=Ju(n),l=I.useRef(!1);return r.jsx(Xat,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...s,ref:e,onCloseAutoFocus:cn(t.onCloseAutoFocus,i=>{var u;l.current||(u=a.triggerRef.current)==null||u.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:cn(t.onInteractOutside,i=>{const u=i.detail.originalEvent,p=u.button===0&&u.ctrlKey===!0,x=u.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)"}})});D6e.displayName=O6e;var hit="DropdownMenuGroup",fit=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(Qat,{...a,...s,ref:e})});fit.displayName=hit;var pit="DropdownMenuLabel",R6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(Jat,{...a,...s,ref:e})});R6e.displayName=pit;var mit="DropdownMenuItem",F6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(eit,{...a,...s,ref:e})});F6e.displayName=mit;var git="DropdownMenuCheckboxItem",z6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(tit,{...a,...s,ref:e})});z6e.displayName=git;var xit="DropdownMenuRadioGroup",yit=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(rit,{...a,...s,ref:e})});yit.displayName=xit;var vit="DropdownMenuRadioItem",B6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(nit,{...a,...s,ref:e})});B6e.displayName=vit;var _it="DropdownMenuItemIndicator",$6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(sit,{...a,...s,ref:e})});$6e.displayName=_it;var bit="DropdownMenuSeparator",U6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(ait,{...a,...s,ref:e})});U6e.displayName=bit;var wit="DropdownMenuArrow",jit=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(iit,{...a,...s,ref:e})});jit.displayName=wit;var kit="DropdownMenuSubTrigger",q6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(oit,{...a,...s,ref:e})});q6e.displayName=kit;var Nit="DropdownMenuSubContent",V6e=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Ju(n);return r.jsx(lit,{...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)"}})});V6e.displayName=Nit;var Sit=E6e,Cit=P6e,Mit=L6e,H6e=D6e,W6e=R6e,G6e=F6e,K6e=z6e,Z6e=B6e,Y6e=$6e,X6e=U6e,Q6e=q6e,J6e=V6e;const Th=Sit,Ah=Cit,Tit=I.forwardRef(({className:t,inset:e,children:n,...s},a)=>r.jsxs(Q6e,{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(Bi,{className:"ml-auto h-4 w-4"})]}));Tit.displayName=Q6e.displayName;const Ait=I.forwardRef(({className:t,...e},n)=>r.jsx(J6e,{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}));Ait.displayName=J6e.displayName;const eh=I.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(Mit,{children:r.jsx(H6e,{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})}));eh.displayName=H6e.displayName;const ri=I.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(G6e,{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}));ri.displayName=G6e.displayName;const Eit=I.forwardRef(({className:t,children:e,checked:n,...s},a)=>r.jsxs(K6e,{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(Y6e,{children:r.jsx(_i,{className:"h-4 w-4"})})}),e]}));Eit.displayName=K6e.displayName;const Iit=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(Z6e,{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(Y6e,{children:r.jsx(Gu,{className:"h-2 w-2 fill-current"})})}),e]}));Iit.displayName=Z6e.displayName;const bhe=I.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(W6e,{ref:s,className:zt("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));bhe.displayName=W6e.displayName;const Zj=I.forwardRef(({className:t,...e},n)=>r.jsx(X6e,{ref:n,className:zt("-mx-1 my-1 h-px bg-muted",t),...e}));Zj.displayName=X6e.displayName;const Pit=()=>{const{isAssistant:t,actingAsAgent:e,assignedAgents:n,setActingAsAgent:s}=Vge();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(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"secondary",size:"sm",className:"gap-2 bg-primary-foreground/20 hover:bg-primary-foreground/30 text-primary-foreground border-0",children:[r.jsxs(Ys,{className:"h-5 w-5",children:[r.jsx(Pi,{src:e.avatar_url||void 0}),r.jsx(Xs,{className:"text-[10px] bg-primary-foreground/30",children:o(e.name)})]}),r.jsx("strong",{children:e.name}),r.jsx(Qd,{className:"h-3 w-3"})]})}),r.jsx(eh,{align:"start",children:n.map(l=>r.jsxs(ri,{onClick:()=>s(l),className:"gap-2",children:[r.jsxs(Ys,{className:"h-6 w-6",children:[r.jsx(Pi,{src:l.avatar_url||void 0}),r.jsx(Xs,{className:"text-[10px]",children:o(l.name)})]}),r.jsx("span",{children:l.name}),l.id===e.id&&r.jsx(Lt,{variant:"secondary",className:"ml-auto text-[10px]",children:"Current"})]},l.id))})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ys,{className:"h-5 w-5",children:[r.jsx(Pi,{src:e.avatar_url||void 0}),r.jsx(Xs,{className:"text-[10px] bg-primary-foreground/30",children:o(e.name)})]}),r.jsx("strong",{children:e.name})]})]}),r.jsx(Lt,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Nn=({children:t,requireAdmin:e=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:a,isAdmin:o,isBrokerageManager:l}=Qr();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(Ble,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(Ble,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:t}):r.jsx(Ble,{to:"/auth",replace:!0})};var txe={};(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 Ce=new OffscreenCanvas(1,1),Se=Ce.getContext("2d");Se.fillRect(0,0,1,1);var Ne=Ce.transferToImageBitmap();Se.createPattern(Ne,"no-repeat")}catch{return!1}return!0}();function u(){}function p(Ce){var Se=n.exports.Promise,Ne=Se!==void 0?Se:e.Promise;return typeof Ne=="function"?new Ne(Ce):(Ce(u,u),null)}var x=function(Ce,Se){return{transform:function(Ne){if(Ce)return Ne;if(Se.has(Ne))return Se.get(Ne);var be=new OffscreenCanvas(Ne.width,Ne.height),rt=be.getContext("2d");return rt.drawImage(Ne,0,0),Se.set(Ne,be),be},clear:function(){Se.clear()}}}(i,new Map),y=function(){var Ce=Math.floor(16.666666666666668),Se,Ne,be={},rt=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Se=function(Te){var Pe=Math.random();return be[Pe]=requestAnimationFrame(function Ue(Re){rt===Re||rt+Ce-1{const{data:e,error:n}=await Q.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 Oit(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}function Dit(){const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{error:s}=await Q.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 ise="Dialog",[eLe,tLe]=lc(ise),[Rit,Pm]=eLe(ise),rLe=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,i=I.useRef(null),u=I.useRef(null),[p,x]=Ku({prop:s,defaultProp:a??!1,onChange:o,caller:ise});return r.jsx(Rit,{scope:e,triggerRef:i,contentRef:u,contentId:Qc(),titleId:Qc(),descriptionId:Qc(),open:p,onOpenChange:x,onOpenToggle:I.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};rLe.displayName=ise;var nLe="DialogTrigger",sLe=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Pm(nLe,n),o=ra(e,a.triggerRef);return r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":sxe(a.open),...s,ref:o,onClick:cn(t.onClick,a.onOpenToggle)})});sLe.displayName=nLe;var rxe="DialogPortal",[Fit,aLe]=eLe(rxe,{forceMount:void 0}),iLe=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:a}=t,o=Pm(rxe,e);return r.jsx(Fit,{scope:e,forceMount:n,children:I.Children.map(s,l=>r.jsx(jc,{present:n||o.open,children:r.jsx(a3,{asChild:!0,container:a,children:l})}))})};iLe.displayName=rxe;var gte="DialogOverlay",oLe=I.forwardRef((t,e)=>{const n=aLe(gte,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,o=Pm(gte,t.__scopeDialog);return o.modal?r.jsx(jc,{present:s||o.open,children:r.jsx(Bit,{...a,ref:e})}):null});oLe.displayName=gte;var zit=ev("DialogOverlay.RemoveScroll"),Bit=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Pm(gte,n);return r.jsx(LI,{as:zit,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Rn.div,{"data-state":sxe(a.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),Yj="DialogContent",lLe=I.forwardRef((t,e)=>{const n=aLe(Yj,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,o=Pm(Yj,t.__scopeDialog);return r.jsx(jc,{present:s||o.open,children:o.modal?r.jsx($it,{...a,ref:e}):r.jsx(Uit,{...a,ref:e})})});lLe.displayName=Yj;var $it=I.forwardRef((t,e)=>{const n=Pm(Yj,t.__scopeDialog),s=I.useRef(null),a=ra(e,n.contentRef,s);return I.useEffect(()=>{const o=s.current;if(o)return tse(o)},[]),r.jsx(cLe,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cn(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:cn(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:cn(t.onFocusOutside,o=>o.preventDefault())})}),Uit=I.forwardRef((t,e)=>{const n=Pm(Yj,t.__scopeDialog),s=I.useRef(!1),a=I.useRef(!1);return r.jsx(cLe,{...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 u,p;(u=t.onInteractOutside)==null||u.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()}})}),cLe=I.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=t,i=Pm(Yj,n),u=I.useRef(null),p=ra(e,u);return ese(),r.jsxs(r.Fragment,{children:[r.jsx(II,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(uv,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":sxe(i.open),...l,ref:p,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Vit,{titleId:i.titleId}),r.jsx(Wit,{contentRef:u,descriptionId:i.descriptionId})]})]})}),nxe="DialogTitle",dLe=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Pm(nxe,n);return r.jsx(Rn.h2,{id:a.titleId,...s,ref:e})});dLe.displayName=nxe;var uLe="DialogDescription",hLe=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Pm(uLe,n);return r.jsx(Rn.p,{id:a.descriptionId,...s,ref:e})});hLe.displayName=uLe;var fLe="DialogClose",pLe=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Pm(fLe,n);return r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:cn(t.onClick,()=>a.onOpenChange(!1))})});pLe.displayName=fLe;function sxe(t){return t?"open":"closed"}var mLe="DialogTitleWarning",[qit,gLe]=_Ze(mLe,{contentName:Yj,titleName:nxe,docsSlug:"dialog"}),Vit=({titleId:t})=>{const e=gLe(mLe),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},Hit="DialogDescriptionWarning",Wit=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gLe(Hit).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},ose=rLe,axe=sLe,lse=iLe,y3=oLe,v3=lLe,RI=dLe,FI=hLe,cse=pLe;const Dr=ose,Uo=axe,Git=lse,xLe=I.forwardRef(({className:t,...e},n)=>r.jsx(y3,{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}));xLe.displayName=y3.displayName;const Or=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(Git,{children:[r.jsx(xLe,{}),r.jsxs(v3,{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(cse,{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(gs,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Or.displayName=v3.displayName;const Br=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Br.displayName="DialogHeader";const Ws=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ws.displayName="DialogFooter";const zr=I.forwardRef(({className:t,...e},n)=>r.jsx(RI,{ref:n,className:zt("text-lg font-semibold leading-none tracking-tight",t),...e}));zr.displayName=RI.displayName;const Jn=I.forwardRef(({className:t,...e},n)=>r.jsx(FI,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Jn.displayName=FI.displayName;const Kit={points_earned:Yi,listing_created:ua,deal_closed:wd,custom:_s},Hje={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 Zit(){const{user:t}=Qr(),e=qr(),{data:n}=Lit(),s=Oit(),[a,o]=I.useState(null),[l,i]=I.useState(!1),u=I.useCallback(()=>{const w=Date.now()+3e3,S={startVelocity:30,spread:360,ticks:60,zIndex:9999},N=(E,A)=>Math.random()*(A-E)+E,M=setInterval(()=>{const E=w-Date.now();if(E<=0){clearInterval(M);return}const A=50*(E/3e3);Vje({...S,particleCount:A,origin:{x:N(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),Vje({...S,particleCount:A,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(u,100))},[n,a,u]);const p=async()=>{if(a){const _=a.id;i(!1),o(null),e.setQueryData(["celebrations","pending",t==null?void 0:t.id],w=>(w==null?void 0:w.filter(S=>S.id!==_))??[]),await s.mutateAsync(_)}};if(!a)return null;const x=Kit[a.celebration_type]||_s,y=Hje[a.celebration_type]||Hje.custom;return r.jsx(Dr,{open:l,onOpenChange:_=>!_&&p(),children:r.jsxs(Or,{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(As,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(As,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(As,{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(te,{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 yLe="/assets/levelup-logo-horizontal-DEFNc0ms.png",ixe="/assets/levelup-logo-white-C2RAgAoG.png",Yit="/assets/listings-hero-BI9Ki9Dq.jpg",ot=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}));ot.displayName="Input";var vLe={exports:{}};(function(t,e){(function(n,s){t.exports=s()})($x,function(){var n,s,a;function o(i,u){if(!n)n=u;else if(!s)s=u;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=u(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 u=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var h=c[0],g=c[1],v=c[2],k=c[3],C=h*k-v*g;return C?(f[0]=k*(C=1/C),f[1]=-g*C,f[2]=-v*C,f[3]=h*C,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 h=c[0],g=c[1],v=c[2],k=c[3],C=c[4],L=c[5],F=c[6],$=c[7],G=c[8];return f[0]=C*G-L*$,f[1]=v*$-g*G,f[2]=g*L-v*C,f[3]=L*F-k*G,f[4]=h*G-v*F,f[5]=v*k-h*L,f[6]=k*$-C*F,f[7]=g*F-h*$,f[8]=h*C-g*k,f}function w(f,c,h){var g=c[0],v=c[1],k=c[2],C=c[3],L=c[4],F=c[5],$=c[6],G=c[7],Z=c[8],X=h[0],re=h[1],ne=h[2],me=h[3],ke=h[4],je=h[5],Fe=h[6],$e=h[7],Xe=h[8];return f[0]=X*g+re*C+ne*$,f[1]=X*v+re*L+ne*G,f[2]=X*k+re*F+ne*Z,f[3]=me*g+ke*C+je*$,f[4]=me*v+ke*L+je*G,f[5]=me*k+ke*F+je*Z,f[6]=Fe*g+$e*C+Xe*$,f[7]=Fe*v+$e*L+Xe*G,f[8]=Fe*k+$e*F+Xe*Z,f}function S(){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 M(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 h=c[0],g=c[1],v=c[2],k=c[3],C=c[4],L=c[5],F=c[6],$=c[7],G=c[8],Z=c[9],X=c[10],re=c[11],ne=c[12],me=c[13],ke=c[14],je=c[15],Fe=h*L-g*C,$e=h*F-v*C,Xe=h*$-k*C,mt=g*F-v*L,ct=g*$-k*L,_t=v*$-k*F,Ct=G*me-Z*ne,Et=G*ke-X*ne,Yt=G*je-re*ne,Rt=Z*ke-X*me,rr=Z*je-re*me,lr=X*je-re*ke,cr=Fe*lr-$e*rr+Xe*Rt+mt*Yt-ct*Et+_t*Ct;return cr?(f[0]=(L*lr-F*rr+$*Rt)*(cr=1/cr),f[1]=(v*rr-g*lr-k*Rt)*cr,f[2]=(me*_t-ke*ct+je*mt)*cr,f[3]=(X*ct-Z*_t-re*mt)*cr,f[4]=(F*Yt-C*lr-$*Et)*cr,f[5]=(h*lr-v*Yt+k*Et)*cr,f[6]=(ke*Xe-ne*_t-je*$e)*cr,f[7]=(G*_t-X*Xe+re*$e)*cr,f[8]=(C*rr-L*Yt+$*Ct)*cr,f[9]=(g*Yt-h*rr-k*Ct)*cr,f[10]=(ne*ct-me*Xe+je*Fe)*cr,f[11]=(Z*Xe-G*ct-re*Fe)*cr,f[12]=(L*Et-C*Rt-F*Ct)*cr,f[13]=(h*Rt-g*Et+v*Ct)*cr,f[14]=(me*$e-ne*mt-ke*Fe)*cr,f[15]=(G*mt-Z*$e+X*Fe)*cr,f):null}function A(f,c,h){var g=c[0],v=c[1],k=c[2],C=c[3],L=c[4],F=c[5],$=c[6],G=c[7],Z=c[8],X=c[9],re=c[10],ne=c[11],me=c[12],ke=c[13],je=c[14],Fe=c[15],$e=h[0],Xe=h[1],mt=h[2],ct=h[3];return f[0]=$e*g+Xe*L+mt*Z+ct*me,f[1]=$e*v+Xe*F+mt*X+ct*ke,f[2]=$e*k+Xe*$+mt*re+ct*je,f[3]=$e*C+Xe*G+mt*ne+ct*Fe,f[4]=($e=h[4])*g+(Xe=h[5])*L+(mt=h[6])*Z+(ct=h[7])*me,f[5]=$e*v+Xe*F+mt*X+ct*ke,f[6]=$e*k+Xe*$+mt*re+ct*je,f[7]=$e*C+Xe*G+mt*ne+ct*Fe,f[8]=($e=h[8])*g+(Xe=h[9])*L+(mt=h[10])*Z+(ct=h[11])*me,f[9]=$e*v+Xe*F+mt*X+ct*ke,f[10]=$e*k+Xe*$+mt*re+ct*je,f[11]=$e*C+Xe*G+mt*ne+ct*Fe,f[12]=($e=h[12])*g+(Xe=h[13])*L+(mt=h[14])*Z+(ct=h[15])*me,f[13]=$e*v+Xe*F+mt*X+ct*ke,f[14]=$e*k+Xe*$+mt*re+ct*je,f[15]=$e*C+Xe*G+mt*ne+ct*Fe,f}function P(f,c,h){var g,v,k,C,L,F,$,G,Z,X,re,ne,me=h[0],ke=h[1],je=h[2];return c===f?(f[12]=c[0]*me+c[4]*ke+c[8]*je+c[12],f[13]=c[1]*me+c[5]*ke+c[9]*je+c[13],f[14]=c[2]*me+c[6]*ke+c[10]*je+c[14],f[15]=c[3]*me+c[7]*ke+c[11]*je+c[15]):(v=c[1],k=c[2],C=c[3],L=c[4],F=c[5],$=c[6],G=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]=C,f[4]=L,f[5]=F,f[6]=$,f[7]=G,f[8]=Z,f[9]=X,f[10]=re,f[11]=ne,f[12]=g*me+L*ke+Z*je+c[12],f[13]=v*me+F*ke+X*je+c[13],f[14]=k*me+$*ke+re*je+c[14],f[15]=C*me+G*ke+ne*je+c[15]),f}function z(f,c,h){var g=h[0],v=h[1],k=h[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 R(f,c,h){var g=Math.sin(h),v=Math.cos(h),k=c[4],C=c[5],L=c[6],F=c[7],$=c[8],G=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]=C*v+G*g,f[6]=L*v+Z*g,f[7]=F*v+X*g,f[8]=$*v-k*g,f[9]=G*v-C*g,f[10]=Z*v-L*g,f[11]=X*v-F*g,f}function U(f,c,h){var g=Math.sin(h),v=Math.cos(h),k=c[0],C=c[1],L=c[2],F=c[3],$=c[8],G=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]=C*v-G*g,f[2]=L*v-Z*g,f[3]=F*v-X*g,f[8]=k*g+$*v,f[9]=C*g+G*v,f[10]=L*g+Z*v,f[11]=F*g+X*v,f}function V(f,c,h){var g=Math.sin(h),v=Math.cos(h),k=c[0],C=c[1],L=c[2],F=c[3],$=c[4],G=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]=C*v+G*g,f[2]=L*v+Z*g,f[3]=F*v+X*g,f[4]=$*v-k*g,f[5]=G*v-C*g,f[6]=Z*v-L*g,f[7]=X*v-F*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 W(f,c,h){var g,v,k,C=h[0],L=h[1],F=h[2],$=Math.sqrt(C*C+L*L+F*F);return $0&&(k=1/Math.sqrt(k)),f[0]=c[0]*k,f[1]=c[1]*k,f[2]=c[2]*k,f}function Ye(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function ht(f,c,h){var g=c[0],v=c[1],k=c[2],C=h[0],L=h[1],F=h[2];return f[0]=v*F-k*L,f[1]=k*C-g*F,f[2]=g*L-v*C,f}function Me(f,c,h,g){var v=c[0],k=c[1],C=c[2];return f[0]=v+g*(h[0]-v),f[1]=k+g*(h[1]-k),f[2]=C+g*(h[2]-C),f}function Qe(f,c,h){var g=c[0],v=c[1],k=c[2],C=h[3]*g+h[7]*v+h[11]*k+h[15];return f[0]=(h[0]*g+h[4]*v+h[8]*k+h[12])/(C=C||1),f[1]=(h[1]*g+h[5]*v+h[9]*k+h[13])/C,f[2]=(h[2]*g+h[6]*v+h[10]*k+h[14])/C,f}function le(f,c,h){var g=c[0],v=c[1],k=c[2];return f[0]=g*h[0]+v*h[3]+k*h[6],f[1]=g*h[1]+v*h[4]+k*h[7],f[2]=g*h[2]+v*h[5]+k*h[8],f}function Ve(f,c,h){var g=h[0],v=h[1],k=h[2],C=h[3],L=c[0],F=c[1],$=c[2],G=v*$-k*F,Z=k*L-g*$,X=g*F-v*L;return f[0]=L+C*(G+=G)+v*(X+=X)-k*(Z+=Z),f[1]=F+C*Z+k*G-g*X,f[2]=$+C*X+g*Z-v*G,f}function Le(f){return f[0]=0,f[1]=0,f[2]=0,f}function We(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var _e=ye,st=Ce,ze=pe;function Ee(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function Je(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f[2]=c[2]*h,f[3]=c[3]*h,f}function at(f,c){var h=c[0],g=c[1],v=c[2],k=c[3],C=h*h+g*g+v*v+k*k;return C>0&&(C=1/Math.sqrt(C)),f[0]=h*C,f[1]=g*C,f[2]=v*C,f[3]=k*C,f}function pt(f,c,h){var g=c[0],v=c[1],k=c[2],C=c[3];return f[0]=h[0]*g+h[4]*v+h[8]*k+h[12]*C,f[1]=h[1]*g+h[5]*v+h[9]*k+h[13]*C,f[2]=h[2]*g+h[6]*v+h[10]*k+h[14]*C,f[3]=h[3]*g+h[7]*v+h[11]*k+h[15]*C,f}function gt(){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,h){h*=.5;var g=c[0],v=c[1],k=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F+C*L,f[1]=v*F+k*L,f[2]=k*F-v*L,f[3]=C*F-g*L,f}function Xt(f,c,h){h*=.5;var g=c[0],v=c[1],k=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F-k*L,f[1]=v*F+C*L,f[2]=k*F+g*L,f[3]=C*F-v*L,f}xe(),Ee();var Sr,an,wn,Xr=at,Pn=(Sr=xe(),an=se(1,0,0),wn=se(0,1,0),function(f,c,h){var g=Ye(c,h);return g<-.999999?(ht(Sr,an,c),ze(Sr)<1e-6&&ht(Sr,wn,c),Be(Sr,Sr),function(v,k,C){C*=.5;var L=Math.sin(C);v[0]=L*k[0],v[1]=L*k[1],v[2]=L*k[2],v[3]=Math.cos(C)}(f,Sr,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(ht(Sr,c,h),f[0]=Sr[0],f[1]=Sr[1],f[2]=Sr[2],f[3]=1+g,Xr(f,f))});function Ns(){var f=new p(2);return p!=Float32Array&&(f[0]=0,f[1]=0),f}function hr(f,c){var h=new p(2);return h[0]=f,h[1]=c,h}function ys(f,c,h){return f[0]=c,f[1]=h,f}function Ca(f,c,h){return f[0]=c[0]+h[0],f[1]=c[1]+h[1],f}function va(f,c,h){return f[0]=c[0]-h[0],f[1]=c[1]-h[1],f}function $i(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f}function Ui(f){var c=f[0],h=f[1];return Math.sqrt(c*c+h*h)}function al(f,c){var h=c[0],g=c[1],v=h*h+g*g;return v>0&&(v=1/Math.sqrt(v)),f[0]=c[0]*v,f[1]=c[1]*v,f}function yo(f,c){return f[0]*c[0]+f[1]*c[1]}gt(),gt(),y();var Gs,Qa,Cs=va;function Ba(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}Ns();var Ra=function(){if(Qa)return Gs;function f(c,h,g,v){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(v-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=h,this.p2x=g,this.p2y=v}return Qa=1,Gs=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,h){if(h===void 0&&(h=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:F=g,g=.5*(F-L)+L;return g},solve:function(c,h){return this.sampleCurveY(this.solveCurveX(c,h))}},Gs}(),Fo=Ba(Ra);function ir(f,c){this.x=f,this.y=c}function po(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let h=0;h=1)return 1;const c=f*f,h=c*f;return 4*(f<.5?h:3*(f-c)+h-.75)}function Nu(f,c,h,g){const v=new Fo(f,c,h,g);return function(k){return v.solve(k)}}const nt=Nu(.25,.1,.25,1);function ge(f,c,h){return Math.min(h,Math.max(c,f))}function Ae(f,c,h){return(h=ge((h-f)/(c-f),0,1))*h*(3-2*h)}function Ze(f,c,h){const g=h-c,v=((f-c)%g+g)%g+c;return v===c?h:v}function Nt(f,c,h){if(!f.length)return h(null,[]);let g=f.length;const v=new Array(f.length);let k=null;f.forEach((C,L)=>{c(C,(F,$)=>{F&&(k=F),v[L]=$,--g==0&&h(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(h=>{c[h]&&(c[h]=c[h].bind(c))})}function Ut(f,c,h){const g={};for(const v in f)g[v]=c.call(this,f[v],v,f);return g}function fr(f,c,h){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 h=0;h=0)return!0;return!1}const jn={};function Vr(f){jn[f]||(typeof console<"u"&&console.warn(f),jn[f]=!0)}function ts(f,c,h){return(h.y-f.y)*(c.x-f.x)>(c.y-f.y)*(h.x-f.x)}function rs(f){let c=0;for(let h,g,v=0,k=f.length,C=k-1;v@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,g,v,k)=>{const C=v||k;return c[g]=!C||C.toLowerCase(),""}),c["max-age"]){const h=parseInt(c["max-age"],10);isNaN(h)?delete c["max-age"]:c["max-age"]=h}return c}let mo=null;function fa(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function _o(f,c,h,g){for(;c>1;f[v]>1;f[v]<=g?c=v+1:h=v}return c}function Ks(f){return f>0?1/(1.001-f):1+f}function Si(f){return f>0?1-1/(1.001-f):-f}function $a(f,c,h){return(f-c.min)*(h.max-h.min)/(c.max-c.min)+h.min}const Ms={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(!Ms.API_URL)return null;try{const f=new URL(Ms.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 Ci(f){return Ms.API_URL_REGEX.test(f)}function xl(f){return Ms.API_SPRITE_REGEX.test(f)}let Ml,$c,wf,qo,Ed,cc;function th(){return Ml==null&&(Ml=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Ml}const Vo={now:()=>qo!==void 0?qo:performance.now(),setNow(f){qo=f},restoreNow(){qo=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:h,height:g}=f;Ed||(Ed=document.createElement("canvas"));const v=Ed.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return(h>Ed.width||g>Ed.height)&&(Ed.width=h,Ed.height=g),v.clearRect(-c,-c,h+2*c,g+2*c),v.drawImage(f,0,0,h,g),v.getImageData(-c,-c,h+2*c,g+2*c)},resolveURL:f=>($c||($c=document.createElement("a")),$c.href=f,$c.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(wf==null&&(wf=window.matchMedia("(prefers-reduced-motion: reduce)")),wf.matches)},hasCanvasFingerprintNoise(){if(cc!==void 0)return cc;if(!th())return cc=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let h=0;for(let v=0;v0?`?${k}`:""}`}const Fy="mapbox-tiles";let zy=500,By=50;const Ph=["language","worldview","jobid"];let Su,Uc;function ru(){try{return caches}catch{}}function qc(){const f=ru();f&&Su==null&&(Su=f.open(Fy))}let bo=1/0;const Id={supported:!1,testSupport:function(f){!$y&&kc&&(vp?Uy(f):rh=f)}};let rh,kc,$y=!1,vp=!1;const _p=typeof self<"u"?self:{};function Uy(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,kc),f.isContextLost())return;Id.supported=!0}catch{}f.deleteTexture(c),$y=!0}_p.document&&(kc=_p.document.createElement("img"),kc.onload=function(){rh&&Uy(rh),rh=null,vp=!0},kc.onerror=function(){$y=!0,rh=null},kc.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Jg={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(Jg);class ad extends Error{constructor(c,h,g){h===401&&Ci(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=h,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const ex=Rs()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Lh=function(f,c){if(!(/^file:/.test(h=f.url)||/^file:/.test(ex())&&!/^\w+:/.test(h))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,v){const k=new AbortController,C=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:ex(),referrerPolicy:g.referrerPolicy,signal:k.signal});let L=!1,F=!1;const $=(G=C.url).indexOf("sku=")>0&&Ci(G);var G;g.type==="json"&&C.headers.set("Accept","application/json");const Z=(re,ne,me)=>{if(F)return;if(re&&re.message!=="SecurityError"&&Vr(re.toString()),ne&&me)return X(ne);const ke=Date.now();fetch(C).then(je=>{if(je.ok){const Fe=$?je.clone():null;return X(je,Fe,ke)}return v(new ad(je.statusText,je.status,g.url))}).catch(je=>{je.name!=="AbortError"&&v(new Error(`${je.message} ${g.url}`))})},X=(re,ne,me)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(ke=>{F||(ne&&me&&function(je,Fe,$e){if(qc(),Su==null)return;const Xe=Oi(Fe.headers.get("Cache-Control")||"");if(Xe["no-store"])return;const mt={status:Fe.status,statusText:Fe.statusText,headers:new Headers};Fe.headers.forEach((Ct,Et)=>mt.headers.set(Et,Ct)),Xe["max-age"]&&mt.headers.set("Expires",new Date($e+1e3*Xe["max-age"]).toUTCString());const ct=mt.headers.get("Expires");if(!ct||new Date(ct).getTime()-$e<42e4)return;let _t=Rm(je.url,{persistentParams:Ph});if(Fe.status===206){const Ct=je.headers.get("Range");if(!Ct)return;mt.status=200,_t=yp(_t,{range:Ct})}(function(Ct,Et){if(Uc===void 0)try{new Response(new ReadableStream),Uc=!0}catch{Uc=!1}Uc?Et(Ct.body):Ct.blob().then(Et).catch(Yt=>Vr(Yt.message))})(Fe,Ct=>{const Et=new Response((Yt=Fe.status)!==200&&Yt!==404&&[101,103,204,205,304].includes(Yt)?null:Ct,mt);var Yt;qc(),Su!=null&&Su.then(Rt=>Rt.put(_t,Et)).catch(Rt=>Vr(Rt.message))})}(C,ne,me),L=!0,v(null,ke,re.headers))}).catch(ke=>{F||v(new Error(ke.message))})};return $?function(re,ne){if(qc(),Su==null)return ne(null);Su.then(me=>{let ke=Rm(re.url,{persistentParams:Ph});const je=re.headers.get("Range");je&&(ke=yp(ke,{range:je})),me.match(ke).then(Fe=>{const $e=function(Xe){if(!Xe)return!1;const mt=new Date(Xe.headers.get("Expires")||0),ct=Oi(Xe.headers.get("Cache-Control")||"");return Number(mt)>Date.now()&&!ct["no-cache"]}(Fe);me.delete(ke).catch(ne),$e&&me.put(ke,Fe.clone()).catch(ne),ne(null,Fe,$e)}).catch(ne)}).catch(ne)}(C,Z):Z(null,null),{cancel:()=>{F=!0,L||k.abort()}}}(f,c);if(Rs(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var h;return function(g,v){const k=new XMLHttpRequest;k.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(k.responseType="arraybuffer");for(const C in g.headers)k.setRequestHeader(C,g.headers[C]);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 C=k.response;if(g.type==="json")try{C=JSON.parse(k.response)}catch(F){return v(F)}const L=new Headers;k.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(F=>{const $=F.split(": "),G=$.shift(),Z=$.join(": ");L.append(G,Z)}),v(null,C,L)}else v(new ad(k.statusText,k.status,g.url))},k.send(g.body),{cancel:()=>k.abort()}}(f,c)},Oh=function(f,c){return Lh(Object.assign(f,{type:"arrayBuffer"}),c)};function B3(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const Sk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let jf,Qs;jf=[],Qs=0;const qy=function(f,c){if(Id.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),Qs>=Ms.MAX_PARALLEL_IMAGE_REQUESTS){const k={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return jf.push(k),k}Qs++;let h=!1;const g=()=>{if(!h)for(h=!0,Qs--;jf.length&&Qs{g(),k?c(k):C&&(self.createImageBitmap?function(F,$){const G=new Blob([new Uint8Array(F)],{type:"image/png"});createImageBitmap(G).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.`))})}(C,(F,$)=>c(F,$,L)):function(F,$){const G=new Image;G.onload=()=>{$(null,G),URL.revokeObjectURL(G.src),G.onload=null,requestAnimationFrame(()=>{G.src=Sk})},G.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(F)],{type:"image/png"});G.src=F.byteLength?URL.createObjectURL(Z):Sk}(C,(F,$)=>c(F,$,L)))});return{cancel:()=>{v.cancel(),g()}}};var Sv,Ck,Mk,Dh={exports:{}},tx={exports:{}},kt={exports:{}},gr=function(){if(Mk)return Dh.exports;Mk=1;var f=(Sv||(Sv=1,tx.exports=function(h,g){var v,k,C,L,F,$,G,Z;for(k=h.length-(v=3&h.length),C=g,F=3432918353,$=461845907,Z=0;Z>>16)*F&65535)<<16)&4294967295)<<15|G>>>17))*$+(((G>>>16)*$&65535)<<16)&4294967295)<<13|C>>>19))+((5*(C>>>16)&65535)<<16)&4294967295))+((58964+(L>>>16)&65535)<<16);switch(G=0,v){case 3:G^=(255&h.charCodeAt(Z+2))<<16;case 2:G^=(255&h.charCodeAt(Z+1))<<8;case 1:C^=G=(65535&(G=(G=(65535&(G^=255&h.charCodeAt(Z)))*F+(((G>>>16)*F&65535)<<16)&4294967295)<<15|G>>>17))*$+(((G>>>16)*$&65535)<<16)&4294967295}return C^=h.length,C=2246822507*(65535&(C^=C>>>16))+((2246822507*(C>>>16)&65535)<<16)&4294967295,C=3266489909*(65535&(C^=C>>>13))+((3266489909*(C>>>16)&65535)<<16)&4294967295,(C^=C>>>16)>>>0}),tx.exports),c=(Ck||(Ck=1,kt.exports=function(h,g){for(var v,k=h.length,C=g^k,L=0;k>=4;)v=1540483477*(65535&(v=255&h.charCodeAt(L)|(255&h.charCodeAt(++L))<<8|(255&h.charCodeAt(++L))<<16|(255&h.charCodeAt(++L))<<24))+((1540483477*(v>>>16)&65535)<<16),C=1540483477*(65535&C)+((1540483477*(C>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),k-=4,++L;switch(k){case 3:C^=(255&h.charCodeAt(L+2))<<16;case 2:C^=(255&h.charCodeAt(L+1))<<8;case 1:C=1540483477*(65535&(C^=255&h.charCodeAt(L)))+((1540483477*(C>>>16)&65535)<<16)}return C=1540483477*(65535&(C^=C>>>13))+((1540483477*(C>>>16)&65535)<<16),(C^=C>>>15)>>>0}),kt.exports);return Dh.exports=f,Dh.exports.murmur3=f,Dh.exports.murmur2=c,Dh.exports}(),Pr=Ba(gr);class Wn{constructor(c,...h){Object.assign(this,h[0]||{}),this.type=c}}class ns extends Wn{constructor(c,h={}){super("error",Object.assign({error:c},h))}}function Ma(f,c,h){h[f]&&h[f].indexOf(c)!==-1||(h[f]=h[f]||[],h[f].push(c))}function na(f,c,h){if(h&&h[f]){const g=h[f].indexOf(c);g!==-1&&h[f].splice(g,1)}}class gi{on(c,h){return this._listeners=this._listeners||{},Ma(c,h,this._listeners),this}off(c,h){return na(c,h,this._listeners),na(c,h,this._oneTimeListeners),this}once(c,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Ma(c,h,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,h){const g=typeof c=="string"?new Wn(c,h):c,v=g.type;if(this.listens(v)){g.target=this;const k=this._listeners&&this._listeners[v]?this._listeners[v].slice():[];for(const F of k)F.call(this,g);const C=this._oneTimeListeners&&this._oneTimeListeners[v]?this._oneTimeListeners[v].slice():[];for(const F of C)na(v,F,this._oneTimeListeners),F.call(this,g);const L=this._eventedParent;if(L){const F=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,F),L.fire(g)}}else g instanceof ns&&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,h){return this._eventedParent=c,this._eventedParentData=h,this}}class yl{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new yl(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[h,g]=c.split("");return new yl({name:h,iconsetId:g})}static isEqual(c,h){return c.name===h.name&&c.iconsetId===h.iconsetId}toString(){return yl.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var bp,wp={},nu=function(){if(bp)return wp;bp=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 h(k){return c(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function g(k){return(C=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:C>1?1:C;var C}function v(k,C,L){return L<0?L+=1:L>1&&(L-=1),6*L<1?k+(C-k)*L*6:2*L<1?C:3*L<2?k+(C-k)*(2/3-L)*6:k}try{wp.parseCSSColor=function(k){var C,L=k.replace(/ /g,"").toLowerCase();if(L in f)return f[L].slice();if(L[0]==="#")return L.length===4?(C=parseInt(L.substr(1),16))>=0&&C<=4095?[(3840&C)>>4|(3840&C)>>8,240&C|(240&C)>>4,15&C|(15&C)<<4,1]:null:L.length===7&&(C=parseInt(L.substr(1),16))>=0&&C<=16777215?[(16711680&C)>>16,(65280&C)>>8,255&C,1]:null;var F=L.indexOf("("),$=L.indexOf(")");if(F!==-1&&$+1===L.length){var G=L.substr(0,F),Z=L.substr(F+1,$-(F+1)).split(","),X=1;switch(G){case"rgba":if(Z.length!==4)return null;X=g(Z.pop());case"rgb":return Z.length!==3?null:[h(Z[0]),h(Z[1]),h(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]),me=g(Z[2]),ke=me<=.5?me*(ne+1):me+ne-me*ne,je=2*me-ke;return[c(255*v(je,ke,re+1/3)),c(255*v(je,ke,re)),c(255*v(je,ke,re-1/3)),X];default:return null}}return null}}catch{}return wp}();class Ta{constructor(c,h,g,v=1){this.r=c,this.g=h,this.b=g,this.a=v}static parse(c){if(!c)return;if(c instanceof Ta)return c;if(typeof c!="string")return;const h=nu.parseCSSColor(c);return h?new Ta(h[0]/255,h[1]/255,h[2]/255,h[3]):void 0}toString(){const[c,h,g,v]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*h)},${Math.round(255*g)},${v})`}toNonPremultipliedRenderColor(c){const{r:h,g,b:v,a:k}=this;return new oP(c,h,g,v,k)}toPremultipliedRenderColor(c){const{r:h,g,b:v,a:k}=this;return new lP(c,h*k,g*k,v*k,k)}clone(){return new Ta(this.r,this.g,this.b,this.a)}}class iP{constructor(c,h,g,v,k,C=!1){if(this.premultiplied=!1,this.premultiplied=C,c){const L=c.image.height,F=L*L;this.premultiplied?(h=k===0?0:h/k*(L-1),g=k===0?0:g/k*(L-1),v=k===0?0:v/k*(L-1)):(h*=L-1,g*=L-1,v*=L-1);const $=Math.floor(h),G=Math.floor(g),Z=Math.floor(v),X=Math.ceil(h),re=Math.ceil(g),ne=Math.ceil(v),me=h-$,ke=g-G,je=v-Z,Fe=c.image.data,$e=4*($+G*F+Z*L),Xe=4*($+G*F+ne*L),mt=4*($+re*F+Z*L),ct=4*($+re*F+ne*L),_t=4*(X+G*F+Z*L),Ct=4*(X+G*F+ne*L),Et=4*(X+re*F+Z*L),Yt=4*(X+re*F+ne*L);if($e<0||Yt>=Fe.length)throw new Error("out of range");this.r=Fn(Fn(Fn(Fe[$e],Fe[Xe],je),Fn(Fe[mt],Fe[ct],je),ke),Fn(Fn(Fe[_t],Fe[Ct],je),Fn(Fe[Et],Fe[Yt],je),ke),me)/255*(this.premultiplied?k:1),this.g=Fn(Fn(Fn(Fe[$e+1],Fe[Xe+1],je),Fn(Fe[mt+1],Fe[ct+1],je),ke),Fn(Fn(Fe[_t+1],Fe[Ct+1],je),Fn(Fe[Et+1],Fe[Yt+1],je),ke),me)/255*(this.premultiplied?k:1),this.b=Fn(Fn(Fn(Fe[$e+2],Fe[Xe+2],je),Fn(Fe[mt+2],Fe[ct+2],je),ke),Fn(Fn(Fe[_t+2],Fe[Ct+2],je),Fn(Fe[Et+2],Fe[Yt+2],je),ke),me)/255*(this.premultiplied?k:1),this.a=k}else this.r=h,this.g=g,this.b=v,this.a=k}toArray(){const{r:c,g:h,b:g,a:v}=this;return[255*c,255*h,255*g,v]}toHslaArray(){let{r:c,g:h,b:g,a:v}=this;if(this.premultiplied){if(v===0)return[0,0,0,0];const ne=1/v;c*=ne,h*=ne,g*=ne}const k=Math.min(Math.max(c,0),1),C=Math.min(Math.max(h,0),1),L=Math.min(Math.max(g,0),1),F=Math.min(k,C,L),$=Math.max(k,C,L),G=$-F,Z=.5*(F+$);if(G===0)return[0,0,100*Z,v];const X=Z>.5?G/(2-$-F):G/($+F);let re;switch($){case k:re=60*((C-L)/G+(CFn(g,c[v],h))}Ta.black=new Ta(0,0,0,1),Ta.white=new Ta(1,1,1,1),Ta.transparent=new Ta(0,0,0,0),Ta.red=new Ta(1,0,0,1),Ta.blue=new Ta(0,0,1,1);var Cv=Object.freeze({__proto__:null,array:$3,color:function(f,c,h){return new Ta(Fn(f.r,c.r,h),Fn(f.g,c.g,h),Fn(f.b,c.b,h),Fn(f.a,c.a,h))},number:Fn});class nh extends Error{constructor(c,h){super(h),this.message=h,this.key=c}}class Vy{constructor(c,h=[]){this.parent=c,this.bindings={};for(const[g,v]of h)this.bindings[g]=v}concat(c){return new Vy(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 Rh={kind:"null"},yn={kind:"number"},Zs={kind:"string"},Fa={kind:"boolean"},Pd={kind:"color"},kf={kind:"object"},Na={kind:"value"},Tk={kind:"collator"},Mv={kind:"formatted"},Tv={kind:"resolvedImage"};function Nc(f,c){return{kind:"array",itemType:f,N:c}}function Io(f){if(f.kind==="array"){const c=Io(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const oie=[Rh,yn,Zs,Fa,Pd,Mv,kf,Nc(Na),Tv];function Fm(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Fm(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 h of oie)if(!Fm(h,c))return null}}return`Expected ${Io(f)} but found ${Io(c)} instead.`}function U3(f,c){return c.some(h=>h.kind===f.kind)}function Av(f,c){return c.some(h=>h==="null"?f===null:h==="array"?Array.isArray(f):h==="object"?f&&!Array.isArray(f)&&typeof f=="object":h===typeof f)}function Ak(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&Ak(f.itemType,c.itemType):f.kind===c.kind}class q3{constructor(c,h,g){this.sensitivity=c?h?"variant":"case":h?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,h){return this.collator.compare(c,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ek{constructor(c,h,g,v,k){this.text=c.normalize?c.normalize():c,this.image=h,this.scale=g,this.fontStack=v,this.textColor=k}}class id{constructor(c){this.sections=c}static fromString(c){return new id([new Ek(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 id?c:id.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const h of this.sections){if(h.image){const v=h.image.getPrimary().id.toString();c.push(["image",v]);continue}c.push(h.text);const g={};h.fontStack&&(g["text-font"]=["literal",h.fontStack.split(",")]),h.scale&&(g["font-scale"]=h.scale),h.textColor&&(g["text-color"]=["rgba"].concat(h.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(g)}return c}}class jp{constructor(c,h={}){this.id=yl.from(c),this.params=h.params,this.sx=h.sx||1,this.sy=h.sy||1}toString(){return JSON.stringify(this)}static parse(c){let h,g,v,k;try{({id:h,params:g,sx:v,sy:k}=JSON.parse(c)||{})}catch{return null}return h?new jp(h,{params:g,sx:v,sy:k}):null}scaleSelf(c,h=c){return this.sx*=c,this.sy*=h,this}}class od{constructor(c,h,g,v,k=!1){this.primaryId=yl.from(c),this.primaryOptions=h,g&&(this.secondaryId=yl.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 jp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new jp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?od.build({name:c}):c}static build(c,h,g,v){return!c||typeof c=="object"&&!("name"in c)?null:new od(c,g,h,v)}}function rx(f,c,h,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof h=="number"&&h>=0&&h<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,h,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,h,g]:[f,c,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Hy(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof Ta||f instanceof q3||f instanceof id||f instanceof od)return!0;if(Array.isArray(f)){for(const c of f)if(!Hy(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!Hy(f[c]))return!1;return!0}return!1}function vl(f){if(f===null)return Rh;if(typeof f=="string")return Zs;if(typeof f=="boolean")return Fa;if(typeof f=="number")return yn;if(f instanceof Ta)return Pd;if(f instanceof q3)return Tk;if(f instanceof id)return Mv;if(f instanceof od)return Tv;if(Array.isArray(f)){const c=f.length;let h;for(const g of f){const v=vl(g);if(h){if(h===v)continue;h=Na;break}h=v}return Nc(h||Na,c)}return kf}function sh(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof id||f instanceof od||f instanceof Ta?f.toString():JSON.stringify(f)}class kp{constructor(c,h){this.type=c,this.value=h}static parse(c,h){if(c.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!Hy(c[1]))return h.error("invalid value");const g=c[1];let v=vl(g);const k=h.expectedType;return v.kind!=="array"||v.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(v=k),new kp(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 Ta?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof id?this.value.serialize():this.value}}class il{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const V3={string:Zs,number:yn,boolean:Fa,object:kf};class Fh{constructor(c,h){this.type=c,this.args=h}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");let g,v=1;const k=c[0];if(k==="array"){let L,F;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in V3)||$==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);L=V3[$],v++}else L=Na;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return h.error('The length argument to "array" must be a positive integer literal',2);F=c[2],v++}g=Nc(L,F)}else g=V3[k];const C=[];for(;vc.outputDefined())}serialize(){const c=this.type,h=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){h.push(g.kind);const v=c.N;(typeof v=="number"||this.args.length>1)&&h.push(v)}}return h.concat(this.args.map(g=>g.serialize()))}}class Nf{constructor(c){this.type=Mv,this.sections=c}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return h.error("First argument must be an image or text section.");const v=[];let k=!1;for(let C=1;C<=c.length-1;++C){const L=c[C];if(k&&typeof L=="object"&&!Array.isArray(L)){k=!1;let F=null;if(L["font-scale"]&&(F=h.parseObjectValue(L["font-scale"],C,"font-scale",yn),!F))return null;let $=null;if(L["text-font"]&&($=h.parseObjectValue(L["text-font"],C,"text-font",Nc(Zs)),!$))return null;let G=null;if(L["text-color"]&&(G=h.parseObjectValue(L["text-color"],C,"text-color",Pd),!G))return null;const Z=v[v.length-1];Z.scale=F,Z.font=$,Z.textColor=G}else{const F=h.parse(c[C],C,Na);if(!F)return null;const $=F.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,v.push({content:F,scale:null,font:null,textColor:null})}}return new Nf(v)}evaluate(c){return new id(this.sections.map(h=>{const g=h.content.evaluate(c);return Ak(vl(g),Tv)?new Ek("",g,null,null,null):new Ek(sh(g),null,h.scale?h.scale.evaluate(c):null,h.font?h.font.evaluate(c).join(","):null,h.textColor?h.textColor.evaluate(c):null)}))}eachChild(c){for(const h of this.sections)c(h.content),h.scale&&c(h.scale),h.font&&c(h.font),h.textColor&&c(h.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const h of this.sections){c.push(h.content.serialize());const g={};h.scale&&(g["font-scale"]=h.scale.serialize()),h.font&&(g["text-font"]=h.font.serialize()),h.textColor&&(g["text-color"]=h.textColor.serialize()),c.push(g)}return c}}class ls{constructor(c,h,g,v){this._imageWarnHistory={},this.type=Tv,this.namePrimary=c,this.nameSecondary=h,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,h){if(c.length<2)return h.error("Expected two or more arguments.");let g=1;const v=[];function k(){if(gyl.isEqual(C,k)),v.available){const C=v.getSecondary()?v.getSecondary().id:null;C&&(v.available=c.availableImages.some(L=>yl.isEqual(L,C)))}}return v}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const h in this.paramsPrimary)this.paramsPrimary[h]&&c(this.paramsPrimary[h]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const h in this.paramsSecondary)this.paramsSecondary[h]&&c(this.paramsSecondary[h])}outputDefined(){return!1}serializeOptions(c,h){const g={};if(h&&(g.iconset={id:h}),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 h=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);h&&c.push(h)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const h=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);h&&c.push(h)}return c}}function un(f){return Un(f)?"string":Wy(f)?"number":Pk(f)?"boolean":Array.isArray(f)?"array":f===null?"null":Ik(f)?"object":typeof f}function Ik(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function Un(f){return typeof f=="string"||f instanceof String}function Wy(f){return typeof f=="number"||f instanceof Number}function Pk(f){return typeof f=="boolean"||f instanceof Boolean}const zn={"to-boolean":Fa,"to-color":Pd,"to-number":yn,"to-string":Zs};class Sf{constructor(c,h){this.type=c,this.args=h}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const g=c[0],v=[];let k=Rh;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const C=c[1].length;if(h.expectedType){if(h.expectedType.kind!=="array")return h.error(`Expected ${h.expectedType.kind} but found array.`);k=Nc(h.expectedType.itemType,C)}else{if(!(C>0&&Hy(c[1][0])))return null;k=Nc(vl(c[1][0]),C)}for(let L=0;L4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:rx(h[0],h[1],h[2],h[3]),!g))return new Ta(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new il(g||`Could not parse color from value '${typeof h=="string"?h:String(JSON.stringify(h))}'`)}if(this.type.kind==="number"){let h=null;for(const g of this.args){if(h=g.evaluate(c),h===null)return 0;const v=Number(h);if(!isNaN(v))return v}throw new il(`Could not convert ${JSON.stringify(h)} to number.`)}return this.type.kind==="formatted"?id.fromString(sh(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?od.build(sh(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(h=>h.evaluate(c)):sh(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 Nf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ls(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(h=>{c.push(h.serialize())}),c}}const H3=["Unknown","Point","LineString","Polygon"];class Lk{constructor(c,h,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=h,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"?H3[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,h=this.featureDistanceData.scale,{x:g,y:v}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*h-c[0])+this.featureDistanceData.bearing[1]*(v*h-c[1])}return 0}parseColor(c){let h=this._parseColorCache[c];return h||(h=this._parseColorCache[c]=Ta.parse(c)),h}getConfig(c){return this.options?this.options.get(c):null}}class ld{constructor(c,h,g,v,k){this.name=c,this.type=h,this._evaluate=g,this.args=v,this._overloadIndex=k}evaluate(c){if(!this._evaluate){const h=ld.definitions[this.name];this._evaluate=Array.isArray(h)?h[2]:h.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,h){const g=c[0],v=ld.definitions[g];if(!v)return h.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(v)?v[0]:v.type,C=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,L=[];let F=null,$=-1;for(const[G,Z]of C){if(Array.isArray(G)&&G.length!==c.length-1)continue;L.push(G),$++,F=new Wk(h.registry,h.path,null,h.scope,void 0,h._scope,h.options,h.iconImageUseTheme);const X=[];let re=!1;for(let ne=1;neX)).map(Ok).join(" | "),Z=[];for(let X=1;Xh;){if(g-h>600){const F=g-h+1,$=c-h+1,G=Math.log(F),Z=.5*Math.exp(2*G/3),X=.5*Math.sqrt(G*Z*(F-Z)/F)*($-F/2<0?-1:1);Dk(f,c,Math.max(h,Math.floor(c-$*Z/F+X)),Math.min(g,Math.floor(c+(F-$)*Z/F+X)),v)}const k=f[c];let C=h,L=g;for(zh(f,h,c),v(f[g],k)>0&&zh(f,h,g);C0;)L--}v(f[h],k)===0?zh(f,h,L):(L++,zh(f,L,g)),L<=c&&(h=L+1),c<=L&&(g=L-1)}}function zh(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function W3(f,c){return fc?1:0}function zm(f){let c=0;for(let h,g,v=0,k=f.length,C=k-1;v=c[2]||f[1]<=c[1]||f[3]>=c[3])}function lie(f,c,h){const g=f[0]-c[0],v=f[1]-c[1],k=f[0]-h[0],C=f[1]-h[1];return g*C-k*v==0&&g*k<=0&&v*C<=0}function Gy(f,c,h=!1){let g=!1;for(let L=0,F=c.length;L(v=f)[1]!=(C=ne)[1]>v[1]&&v[0]<(C[0]-k[0])*(v[1]-k[1])/(C[1]-k[1])+k[0]&&(g=!g)}}var v,k,C;return g}function Iv(f,c,h,g){const v=g[0]-h[0],k=g[1]-h[1],C=(f[0]-h[0])*k-v*(f[1]-h[1]),L=(c[0]-h[0])*k-v*(c[1]-h[1]);return C>0&&L<0||C<0&&L>0}function Pv(f,c,h,g){return(v=[g[0]-h[0],g[1]-h[1]])[0]*(k=[c[0]-f[0],c[1]-f[1]])[1]-v[1]*k[0]!=0&&!(!Iv(f,c,h,g)||!Iv(h,g,f,c));var v,k}function Np(f){const c=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=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),h.xh[2]){const v=.5*g;let k=f[0]-h[0]>v?-g:h[0]-f[0]>v?g:0;k===0&&(k=f[0]-h[2]>v?-g:h[2]-f[0]>v?g:0),f[0]+=k}ah(c,f)}function hP(f,c,h,g){const v=Math.pow(2,g.z)*Bm,k=[g.x*Bm,g.y*Bm],C=[];if(!f)return C;for(const L of f)for(const F of L){const $=[F.x+k[0],F.y+k[1]];uP($,c,h,v),C.push($)}return C}function Rk(f,c,h,g){const v=Math.pow(2,g.z)*Bm,k=[g.x*Bm,g.y*Bm],C=[];if(!f)return C;for(const F of f){const $=[];for(const G of F){const Z=[G.x+k[0],G.y+k[1]];ah(c,Z),$.push(Z)}C.push($)}if(c[2]-c[0]<=v/2){(L=c)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const F of C)for(const $ of F)uP($,c,h,v)}var L;return C}class Um{constructor(c,h){this.type=Fa,this.geojson=c,this.geometries=h}static parse(c,h){if(c.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(Hy(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let v=0;vh)return Fk(k,C,(h-(g-L))/L)}return c[c.length-1]}pointToSegmentDistance(c,h,g){let[v,k]=h,C=Cu(g[0]-v)*this.kx,L=(g[1]-k)*this.ky;if(C!==0||L!==0){const F=(Cu(c[0]-v)*this.kx*C+(c[1]-k)*this.ky*L)/(C*C+L*L);F>1?(v=g[0],k=g[1]):F>0&&(v+=C/this.kx*F,k+=L/this.ky*F)}return C=Cu(c[0]-v)*this.kx,L=(c[1]-k)*this.ky,Math.sqrt(C*C+L*L)}pointOnLine(c,h){let g=1/0,v=c[0][0],k=c[0][1],C=0,L=0;for(let F=0;F1?($=c[F+1][0],G=c[F+1][1]):re>0&&($+=Z/this.kx*re,G+=X/this.ky*re)),Z=Cu(h[0]-$)*this.kx,X=(h[1]-G)*this.ky;const ne=Z*Z+X*X;nek.index||v.index===k.index&&v.t>k.t){const $=v;v=k,k=$}const C=[v.point],L=v.index+1,F=k.index;!Z3(g[L],C[0])&&L<=F&&C.push(g[L]);for(let $=L+1;$<=F;$++)C.push(g[$]);return Z3(g[F],k.point)||C.push(k.point),C}lineSliceAlong(c,h,g){let v=0;const k=[];for(let C=0;Cc&&k.length===0&&k.push(Fk(L,F,(c-(v-$))/$)),v>=h)return k.push(Fk(L,F,(h-(v-$))/$)),k;v>c&&k.push(F)}return k}bufferPoint(c,h){const g=h/this.ky,v=h/this.kx;return[c[0]-v,c[1]-g,c[0]+v,c[1]+g]}bufferBBox(c,h){const g=h/this.ky,v=h/this.kx;return[c[0]-v,c[1]-g,c[2]+v,c[3]+g]}insideBBox(c,h){return Cu(c[0]-h[0])>=0&&Cu(c[0]-h[2])<=0&&c[1]>=h[1]&&c[1]<=h[3]}}function Z3(f,c){return f[0]===c[0]&&f[1]===c[1]}function Fk(f,c,h){const g=Cu(c[0]-f[0]);return[f[0]+g*h,f[1]+(c[1]-f[1])*h]}function Cu(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class zk{constructor(c=[],h=(g,v)=>gv?1:0){if(this.data=c,this.length=this.data.length,this.compare=h,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],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:h,compare:g}=this,v=h[c];for(;c>0;){const k=c-1>>1,C=h[k];if(g(v,C)>=0)break;h[c]=C,c=k}h[c]=v}_down(c){const{data:h,compare:g}=this,v=this.length>>1,k=h[c];for(;c=0)break;h[c]=h[C],c=C}h[c]=k}}var Cr=8192;function Y3(f,c){return c.dist-f.dist}const Bk=100,$k=50;function X3(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let h=0;h=f[0]&&f[1]f[1])return[null,null];const h=Ov(f);if(c){if(h===2)return[f,null];const g=Math.floor(h/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(h===1)return[f,null];const g=Math.floor(h/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function nx(f,c){const h=[1/0,1/0,-1/0,-1/0];if(!Cf(c,f.length))return h;for(let g=c[0];g<=c[1];++g)ah(h,f[g]);return h}function sx(f){const c=[1/0,1/0,-1/0,-1/0];for(let h=0;hc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(v=f[1]-c[3]),f[3]=g)return g;if(Ev(v,k)){if(e5(f,c))return 0}else if(e5(c,f))return 0;let C=g;for(const L of f)for(let F=0,$=L.length,G=$-1;F<$;G=F++)for(const Z of c)for(let X=0,re=Z.length,ne=re-1;X=k)continue;const G=$.range1;if(Ov(G)<=L){if(!Cf(G,f.length))return NaN;if(c){const Z=pie(f,G,h,g);if((k=Math.min(k,Z))===0)return k}else for(let Z=G[0];Z<=G[1];++Z){const X=fie(f[Z],h,g);if((k=Math.min(k,X))===0)return k}}else{const Z=Q3(G,c);if(Z[0]!==null){const X=qm(nx(f,Z[0]),F,g);X=C)continue;const Z=G.range1,X=G.range2;if(Ov(Z)<=F&&Ov(X)<=$){if(!Cf(Z,f.length)||!Cf(X,h.length))return NaN;if(c&&g?C=Math.min(C,Js(f,Z,h,X,v)):c||g?c&&!g?C=Math.min(C,J3(h,X,f,Z,v)):!c&&g&&(C=Math.min(C,J3(f,Z,h,X,v))):C=Math.min(C,hie(f,Z,h,X,v)),C===0)return C}else{const re=Q3(Z,c),ne=Q3(X,g);Mi(L,C,v,f,h,re[0],ne[0]),Mi(L,C,v,f,h,re[0],ne[1]),Mi(L,C,v,f,h,re[1],ne[0]),Mi(L,C,v,f,h,re[1],ne[1])}}return C}function t5(f,c,h,g,v=1/0){let k=v;const C=nx(f,[0,f.length-1]);for(const L of h)if(!(k!==1/0&&qm(C,nx(L,[0,L.length-1]),g)>=k)&&(k=Math.min(k,gP(f,c,L,!0,g,k)),k===0))return k;return k}function Vk(f,c,h,g,v=1/0){let k=v;const C=nx(f,[0,f.length-1]);for(const L of h){if(k!==1/0&&qm(C,sx(L),g)>=k)continue;const F=gie(f,c,L,g,k);if(isNaN(F))return F;if((k=Math.min(k,F))===0)return k}return k}function r5(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class ax{constructor(c,h){this.type=yn,this.geojson=c,this.geometries=h}static parse(c,h){if(c.length!==2)return h.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(Hy(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let v=0;v{c&&!Yy(h)&&(c=!1)}),c}function Dv(f){if(f instanceof ld&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(h=>{c&&!Dv(h)&&(c=!1)}),c}function Xy(f,c){if(f instanceof ld&&c.indexOf(f.name)>=0)return!1;let h=!0;return f.eachChild(g=>{h&&!Xy(g,c)&&(h=!1)}),h}function xP(f,c,h){return[f,c,h].filter(Boolean).join("")}function n5(f,c){switch(f){case"string":return sh(c);case"number":return+c;case"boolean":return!!c;case"color":return Ta.parse(c);case"formatted":return id.fromString(sh(c));case"resolvedImage":return od.build(sh(c))}return c}function yP(f,c,h,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fh&&(f=h),f}class Qy{constructor(c,h,g,v=!1){this.type=c,this.key=h,this.scope=g,this.featureConstant=v}static parse(c,h){let g=h.expectedType;if(g==null&&(g=Na),c.length<2||c.length>3)return h.error("Invalid number of arguments for 'config' expression.");const v=h.parse(c[1],1);if(!(v instanceof kp))return h.error("Key name of 'config' expression must be a string literal.");let k,C=!0;const L=sh(v.value);if(c.length>=3){const F=h.parse(c[2],2);if(!(F instanceof kp))return h.error("Scope of 'config' expression must be a string literal.");k=sh(F.value)}if(h.options){const F=xP(L,k,h._scope),$=h.options.get(F);$&&(C=Yy($.value||$.default))}return new Qy(g,L,k,C)}evaluate(c){const h=xP(this.key,this.scope,c.scope),g=c.getConfig(h);if(!g)return null;const{type:v,value:k,values:C,minValue:L,maxValue:F,stepValue:$}=g,G=g.default.evaluate(c);let Z=G;if(k){const X=c.scope;c.scope=(X||"").split("").slice(1).join(""),Z=k.evaluate(c),c.scope=X}return v&&(Z=n5(v,Z)),Z===void 0||L===void 0&&F===void 0&&$===void 0||(typeof Z=="number"?Z=yP(Z,L,F,$):Array.isArray(Z)&&(Z=Z.map(X=>typeof X=="number"?yP(X,L,F,$):X))),k!==void 0&&Z!==void 0&&C&&!C.includes(Z)&&(Z=G,v&&(Z=n5(v,Z))),(v&&v!==this.type||Z!==void 0&&!Ak(vl(Z),this.type))&&(Z=n5(this.type.kind,Z)),Z}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class Hk{constructor(c,h){this.type=h.type,this.name=c,this.boundExpression=h}static parse(c,h){if(c.length!==2||typeof c[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const g=c[1];return h.scope.has(g)?new Hk(g,h.scope.get(g)):h.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 Wk{constructor(c,h=[],g,v=new Vy,k=[],C,L,F){this.registry=c,this.path=h,this.key=h.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=v,this.errors=k,this.expectedType=g,this._scope=C,this.options=L,this.iconImageUseTheme=F}parse(c,h,g,v,k={}){return h||g?this.concat(h,null,g,v)._parse(c,k):this._parse(c,k)}parseObjectValue(c,h,g,v,k,C={}){return this.concat(h,g,v,k)._parse(c,C)}_parse(c,h){function g(v,k,C){return C==="assert"?new Fh(k,[v]):C==="coerce"?new Sf(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 C=this.expectedType,L=k.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||L.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string"){if(this.checkSubtype(C,L))return null}else k=g(k,C,h.typeAnnotation||"coerce");else k=g(k,C,h.typeAnnotation||"assert")}if(!(k instanceof kp)&&k.type.kind!=="resolvedImage"&&s5(k)){const C=new Lk(this._scope,this.options,this.iconImageUseTheme);try{k=new kp(k.type,k.evaluate(C))}catch(L){return this.error(L.message),null}}return k}return Sf.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,h,g,v){let k=typeof c=="number"?this.path.concat(c):this.path;k=typeof h=="string"?k.concat(h):k;const C=v?this.scope.concat(v):this.scope;return new Wk(this.registry,k,g||null,C,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...h){const g=`${this.key}${h.map(v=>`[${v}]`).join("")}`;this.errors.push(new nh(g,c))}checkSubtype(c,h){const g=Fm(c,h);return g&&this.error(g),g}}function s5(f){if(f instanceof Hk)return s5(f.boundExpression);if(f instanceof ld&&f.name==="error"||f instanceof Tl||f instanceof Um||f instanceof ax||f instanceof Qy)return!1;const c=f instanceof Sf||f instanceof Fh;let h=!0;return f.eachChild(g=>{h=c?h&&s5(g):h&&g instanceof kp}),!!h&&Yy(f)&&Xy(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 Gk(f,c){const h=f.length-1;let g,v,k=0,C=h,L=0;for(;k<=C;)if(L=Math.floor((k+C)/2),g=f[L],v=f[L+1],g<=c){if(L===h||cc))throw new il("Input is not a number.");C=L-1}return 0}class Rv{constructor(c,h,g){this.type=c,this.input=h,this.labels=[],this.outputs=[];for(const[v,k]of g)this.labels.push(v),this.outputs.push(k)}static parse(c,h){if(c.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return h.error("Expected an even number of arguments.");const g=h.parse(c[1],1,yn);if(!g)return null;const v=[];let k=null;h.expectedType&&h.expectedType.kind!=="value"&&(k=h.expectedType);for(let C=1;C=L)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const Z=h.parse(F,G,k);if(!Z)return null;k=k||Z.type,v.push([L,Z])}return new Rv(k,g,v)}evaluate(c){const h=this.labels,g=this.outputs;if(h.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=h[0])return g[0].evaluate(c);const k=h.length;return v>=h[k-1]?g[k-1].evaluate(c):g[Gk(h,v)].evaluate(c)}eachChild(c){c(this.input);for(const h of this.outputs)c(h)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let h=0;h0&&c.push(this.labels[h]),c.push(this.outputs[h].serialize());return c}}const vP=.95047,_P=1.08883,bP=4/29,Jy=6/29,wP=3*Jy*Jy,xie=Jy*Jy*Jy,yie=Math.PI/180,vie=180/Math.PI;function a5(f){return f>xie?Math.pow(f,1/3):f/wP+bP}function i5(f){return f>Jy?f*f*f:wP*(f-bP)}function o5(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function l5(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function jP(f){const c=l5(f.r),h=l5(f.g),g=l5(f.b),v=a5((.4124564*c+.3575761*h+.1804375*g)/vP),k=a5((.2126729*c+.7151522*h+.072175*g)/1);return{l:116*k-16,a:500*(v-k),b:200*(k-a5((.0193339*c+.119192*h+.9503041*g)/_P)),alpha:f.a}}function Kk(f){let c=(f.l+16)/116,h=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*i5(c),h=vP*i5(h),g=_P*i5(g),new Ta(o5(3.2404542*h-1.5371385*c-.4985314*g),o5(-.969266*h+1.8760108*c+.041556*g),o5(.0556434*h-.2040259*c+1.0572252*g),f.alpha)}function Zk(f,c,h){const g=c-f;return f+h*(g>180||g<-180?g-360*Math.round(g/360):g)}const e0={forward:jP,reverse:Kk,interpolate:function(f,c,h){return{l:Fn(f.l,c.l,h),a:Fn(f.a,c.a,h),b:Fn(f.b,c.b,h),alpha:Fn(f.alpha,c.alpha,h)}}},Fv={forward:function(f){const{l:c,a:h,b:g}=jP(f),v=Math.atan2(g,h)*vie;return{h:v<0?v+360:v,c:Math.sqrt(h*h+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*yie,h=f.c;return Kk({l:f.l,a:Math.cos(c)*h,b:Math.sin(c)*h,alpha:f.alpha})},interpolate:function(f,c,h){return{h:Zk(f.h,c.h,h),c:Fn(f.c,c.c,h),l:Fn(f.l,c.l,h),alpha:Fn(f.alpha,c.alpha,h)}}};var kP=Object.freeze({__proto__:null,hcl:Fv,lab:e0});class Mu{constructor(c,h,g,v,k){this.type=c,this.operator=h,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[C,L]of k)this.labels.push(C),this.outputs.push(L)}static interpolationFactor(c,h,g,v){let k=0;if(c.name==="exponential")k=Yk(h,c.base,g,v);else if(c.name==="linear")k=Yk(h,1,g,v);else if(c.name==="cubic-bezier"){const C=c.controlPoints;k=new Fo(C[0],C[1],C[2],C[3]).solve(Yk(h,1,g,v))}return k}static parse(c,h){let[g,v,k,...C]=c;if(!Array.isArray(v)||v.length===0)return h.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 h.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:$}}else{if(v[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const $=v.slice(1);if($.length!==4||$.some(G=>typeof G!="number"||G<0||G>1))return h.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 h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(k=h.parse(k,2,yn),!k)return null;const L=[];let F=null;g==="interpolate-hcl"||g==="interpolate-lab"?F=Pd:h.expectedType&&h.expectedType.kind!=="value"&&(F=h.expectedType);for(let $=0;$=G)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const ne=h.parse(Z,re,F);if(!ne)return null;F=F||ne.type,L.push([G,ne])}return F.kind==="number"||F.kind==="color"||F.kind==="array"&&F.itemType.kind==="number"&&typeof F.N=="number"?new Mu(F,g,v,k,L):h.error(`Type ${Io(F)} is not interpolatable.`)}evaluate(c){const h=this.labels,g=this.outputs;if(h.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=h[0])return g[0].evaluate(c);const k=h.length;if(v>=h[k-1])return g[k-1].evaluate(c);const C=Gk(h,v),L=Mu.interpolationFactor(this.interpolation,v,h[C],h[C+1]),F=g[C].evaluate(c),$=g[C+1].evaluate(c);return this.operator==="interpolate"?Cv[this.type.kind.toLowerCase()](F,$,L):this.operator==="interpolate-hcl"?Fv.reverse(Fv.interpolate(Fv.forward(F),Fv.forward($),L)):e0.reverse(e0.interpolate(e0.forward(F),e0.forward($),L))}eachChild(c){c(this.input);for(const h of this.outputs)c(h)}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 h=[this.operator,c,this.input.serialize()];for(let g=0;gFm(v,L.type));return new zv(C?Na:g,k)}evaluate(c){let h,g=null,v=0;for(const k of this.args){if(v++,g=k.evaluate(c),g&&g instanceof od&&!g.available&&(h||(h=g),g=null,v===this.args.length))return h;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(h=>{c.push(h.serialize())}),c}}class Sp{constructor(c,h){this.type=h.type,this.bindings=[].concat(c),this.result=h}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const h of this.bindings)c(h[1]);c(this.result)}static parse(c,h){if(c.length<4)return h.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let k=1;k=g.length)throw new il("Array index out of bounds: index exceeds array size");if(h!==Math.floor(h))throw new il("Array index must be an integer. Use at-interpolated for fractional indices");return g[h]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Qk{constructor(c,h,g){this.type=c,this.index=h,this.input=g}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,yn),v=h.parse(c[2],2,Nc(h.expectedType||Na));return g&&v?new Qk(v.type.itemType,g,v):null}evaluate(c){const h=this.index.evaluate(c),g=this.input.evaluate(c);if(h<0)throw new il(`Array index out of bounds: ${h} < 0.`);if(h>g.length-1)throw new il(`Array index out of bounds: ${h} > ${g.length-1}.`);if(h===Math.floor(h))return g[h];const v=Math.floor(h),k=Math.ceil(h),C=g[v],L=g[k];if(typeof C!="number"||typeof L!="number")throw new il(`Cannot interpolate between non-number values at index ${h}.`);const F=h-v;return C*(1-F)+L*F}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class c5{constructor(c,h){this.type=Fa,this.needle=c,this.haystack=h}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Na),v=h.parse(c[2],2,Na);return g&&v?U3(g.type,[Fa,Zs,yn,Rh,Na])?new c5(g,v):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Io(g.type)} instead`):null}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!Av(h,["boolean","string","number","null"]))throw new il(`Expected first argument to be of type boolean, string, number or null, but found ${Io(vl(h))} instead.`);if(!Av(g,["string","array"]))throw new il(`Expected second argument to be of type array or string, but found ${Io(vl(g))} instead.`);return g.indexOf(h)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class t0{constructor(c,h,g){this.type=yn,this.needle=c,this.haystack=h,this.fromIndex=g}static parse(c,h){if(c.length<=2||c.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Na),v=h.parse(c[2],2,Na);if(!g||!v)return null;if(!U3(g.type,[Fa,Zs,yn,Rh,Na]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Io(g.type)} instead`);if(c.length===4){const k=h.parse(c[3],3,yn);return k?new t0(g,v,k):null}return new t0(g,v)}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!Av(h,["boolean","string","number","null"]))throw new il(`Expected first argument to be of type boolean, string, number or null, but found ${Io(vl(h))} instead.`);if(!Av(g,["string","array"]))throw new il(`Expected second argument to be of type array or string, but found ${Io(vl(g))} instead.`);if(this.fromIndex){const v=this.fromIndex.evaluate(c);return g.indexOf(h,v)}return g.indexOf(h)}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 Bv{constructor(c,h,g,v,k,C){this.inputType=c,this.type=h,this.input=g,this.cases=v,this.outputs=k,this.otherwise=C}static parse(c,h){if(c.length<5)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return h.error("Expected an even number of arguments.");let g,v;h.expectedType&&h.expectedType.kind!=="value"&&(v=h.expectedType);const k={},C=[];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,vl(ne)))return null}else g=vl(ne);if(k[String(ne)]!==void 0)return X.error("Branch labels must be unique.");k[String(ne)]=C.length}const re=h.parse(Z,$,v);if(!re)return null;v=v||re.type,C.push(re)}const L=h.parse(c[1],1,Na);if(!L)return null;const F=h.parse(c[c.length-1],c.length-1,v);return F?L.type.kind!=="value"&&h.concat(1).checkSubtype(g,L.type)?null:new Bv(g,v,L,k,C,F):null}evaluate(c){const h=this.input.evaluate(c);return(Ak(vl(h),this.inputType)&&this.outputs[this.cases[h]]||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()],h=Object.keys(this.cases).sort(),g=[],v={};for(const C of h){const L=v[this.cases[C]];L===void 0?(v[this.cases[C]]=g.length,g.push([this.cases[C],[C]])):g[L][1].push(C)}const k=C=>this.inputType.kind==="number"?Number(C):C;for(const[C,L]of g)c.push(L.length===1?k(L[0]):L.map(k)),c.push(this.outputs[C].serialize());return c.push(this.otherwise.serialize()),c}}class $v{constructor(c,h,g){this.type=c,this.branches=h,this.otherwise=g}static parse(c,h){if(c.length<4)return h.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return h.error("Expected an odd number of arguments.");let g;h.expectedType&&h.expectedType.kind!=="value"&&(g=h.expectedType);const v=[];for(let C=1;Ch.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(h=>{c.push(h.serialize())}),c}}class Jk{constructor(c,h,g,v){this.type=c,this.input=h,this.beginIndex=g,this.endIndex=v}static parse(c,h){if(c.length<=2||c.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Na),v=h.parse(c[2],2,yn);if(!g||!v)return null;if(!U3(g.type,[Nc(Na),Zs,Na]))return h.error(`Expected first argument to be of type array or string, but found ${Io(g.type)} instead`);if(c.length===4){const k=h.parse(c[3],3,yn);return k?new Jk(g.type,g,v,k):null}return new Jk(g.type,g,v)}evaluate(c){const h=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!Av(h,["string","array"]))throw new il(`Expected first argument to be of type array or string, but found ${Io(vl(h))} instead.`);if(this.endIndex){const v=this.endIndex.evaluate(c);return h.slice(g,v)}return h.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 d5{constructor(c,h){this.type=Nc(Zs),this.str=c,this.delimiter=h}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Zs),v=h.parse(c[2],2,Zs);return g&&v?new d5(g,v):void 0}evaluate(c){const h=this.str.evaluate(c),g=this.delimiter.evaluate(c);return h.split(g)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function u5(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 h5(f,c,h,g){return g.compare(c,h)===0}function r0(f,c,h){const g=f!=="=="&&f!=="!=";return class _Le{constructor(k,C,L){this.type=Fa,this.lhs=k,this.rhs=C,this.collator=L,this.hasUntypedArgument=k.type.kind==="value"||C.type.kind==="value"}static parse(k,C){if(k.length!==3&&k.length!==4)return C.error("Expected two or three arguments.");const L=k[0];let F=C.parse(k[1],1,Na);if(!F)return null;if(!u5(L,F.type))return C.concat(1).error(`"${L}" comparisons are not supported for type '${Io(F.type)}'.`);let $=C.parse(k[2],2,Na);if(!$)return null;if(!u5(L,$.type))return C.concat(2).error(`"${L}" comparisons are not supported for type '${Io($.type)}'.`);if(F.type.kind!==$.type.kind&&F.type.kind!=="value"&&$.type.kind!=="value")return C.error(`Cannot compare types '${Io(F.type)}' and '${Io($.type)}'.`);g&&(F.type.kind==="value"&&$.type.kind!=="value"?F=new Fh($.type,[F]):F.type.kind!=="value"&&$.type.kind==="value"&&($=new Fh(F.type,[$])));let G=null;if(k.length===4){if(F.type.kind!=="string"&&$.type.kind!=="string"&&F.type.kind!=="value"&&$.type.kind!=="value")return C.error("Cannot use collator to compare non-string types.");if(G=C.parse(k[3],3,Tk),!G)return null}return new _Le(F,$,G)}evaluate(k){const C=this.lhs.evaluate(k),L=this.rhs.evaluate(k);if(g&&this.hasUntypedArgument){const F=vl(C),$=vl(L);if(F.kind!==$.kind||F.kind!=="string"&&F.kind!=="number")throw new il(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${F.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const F=vl(C),$=vl(L);if(F.kind!=="string"||$.kind!=="string")return c(k,C,L)}return this.collator?h(k,C,L,this.collator.evaluate(k)):c(k,C,L)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}serialize(){const k=[f];return this.eachChild(C=>{k.push(C.serialize())}),k}}}const _ie=r0("==",function(f,c,h){return c===h},h5),bie=r0("!=",function(f,c,h){return c!==h},function(f,c,h,g){return!h5(0,c,h,g)}),NP=r0("<",function(f,c,h){return c",function(f,c,h){return c>h},function(f,c,h,g){return g.compare(c,h)>0}),eN=r0("<=",function(f,c,h){return c<=h},function(f,c,h,g){return g.compare(c,h)<=0}),wie=r0(">=",function(f,c,h){return c>=h},function(f,c,h,g){return g.compare(c,h)>=0});class tN{constructor(c,h,g,v,k,C){this.type=Zs,this.number=c,this.locale=h,this.currency=g,this.unit=v,this.minFractionDigits=k,this.maxFractionDigits=C}static parse(c,h){if(c.length!==3)return h.error("Expected two arguments.");const g=h.parse(c[1],1,yn);if(!g)return null;const v=c[2];if(typeof v!="object"||Array.isArray(v))return h.error("NumberFormat options argument must be an object.");let k=null;if(v.locale&&(k=h.parseObjectValue(v.locale,2,"locale",Zs),!k))return null;let C=null;if(v.currency&&(C=h.parseObjectValue(v.currency,2,"currency",Zs),!C))return null;let L=null;if(v.unit&&(L=h.parseObjectValue(v.unit,2,"unit",Zs),!L))return null;let F=null;if(v["min-fraction-digits"]&&(F=h.parseObjectValue(v["min-fraction-digits"],2,"min-fraction-digits",yn),!F))return null;let $=null;return v["max-fraction-digits"]&&($=h.parseObjectValue(v["max-fraction-digits"],2,"max-fraction-digits",yn),!$)?null:new tN(g,k,C,L,F,$)}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 f5{constructor(c){this.type=yn,this.input=c}static parse(c,h){if(c.length!==2)return h.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=h.parse(c[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${Io(g.type)} instead.`):new f5(g):null}evaluate(c){const h=this.input.evaluate(c);if(typeof h=="string"||Array.isArray(h))return h.length;throw new il(`Expected value to be of type string or array, but found ${Io(vl(h))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(h=>{c.push(h.serialize())}),c}}function CP(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 n0={"==":_ie,"!=":bie,">":SP,"<":NP,">=":wie,"<=":eN,array:Fh,at:Xk,"at-interpolated":Qk,boolean:Fh,case:$v,coalesce:zv,collator:Tl,format:Nf,image:ls,in:c5,"index-of":t0,interpolate:Mu,"interpolate-hcl":Mu,"interpolate-lab":Mu,length:f5,let:Sp,literal:kp,match:Bv,number:Fh,"number-format":tN,object:Fh,slice:Jk,step:Rv,string:Fh,"to-boolean":Sf,"to-color":Sf,"to-number":Sf,"to-string":Sf,var:Hk,within:Um,distance:ax,config:Qy,split:d5};function p5(f,[c,h,g,v]){c=c.evaluate(f),h=h.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,C=rx(c,h,g,k);if(C)throw new il(C);return new Ta(c/255,h/255,g/255,k)}function m5(f,[c,h,g,v]){c=c.evaluate(f),h=h.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,C=function($,G,Z,X){return typeof $=="number"&&$>=0&&$<=360?typeof G=="number"&&G>=0&&G<=100&&typeof Z=="number"&&Z>=0&&Z<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[$,G,Z,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[$,G,Z,X]:[$,G,Z]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[$,G,Z,X]:[$,G,Z]).join(", ")}]: 'h' must be between 0 and 360.`}(c,h,g,k);if(C)throw new il(C);const L=`hsla(${c}, ${h}%, ${g}%, ${k})`,F=Ta.parse(L);if(!F)throw new il(`Failed to parse HSLA color: ${L}`);return F}function MP(f,c){return f in c}function g5(f,c){const h=c[f];return h===void 0?null:h}function Hm(f){return{type:f}}function ix(f){if(f instanceof Qy)return new Set([f.key]);let c=new Set;return f.eachChild(h=>{c=new Set([...c,...ix(h)])}),c}function rN(f){if(f instanceof ld&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(h=>{!c&&rN(h)&&(c=!0)}),c}function TP(f){return{result:"success",value:f}}function Wm(f){return{result:"error",value:f}}function x5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Uv(f){return f["property-type"]==="data-driven"}function AP(f){return x5(f.expression,"measure-light")}function EP(f){return x5(f.expression,"zoom")}function nN(f){return!!f.expression&&f.expression.interpolated}function sN(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function IP(f){return f}function PP(f,c){const h=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",v=g||!(g||f.property!==void 0),k=f.type||(nN(c)?"exponential":"interval");if(h&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],Ta.parse($[1])])),f.default=Ta.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!kP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let C,L,F;if(k==="exponential")C=LP;else if(k==="interval")C=kie;else if(k==="categorical"){C=jie,L=Object.create(null);for(const $ of f.stops)L[$[0]]=$[1];F=typeof f.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);C=OP}if(g){const $={},G=[];for(let re=0;rere[0]),evaluate:({zoom:re},ne)=>LP({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:Mu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(G=>G[0]),evaluate:({zoom:G})=>C(f,c,G,L,F)}}return{kind:"source",evaluate($,G){const Z=G&&G.properties?G.properties[f.property]:void 0;return Z===void 0?Mf(f.default,c.default):C(f,c,Z,L,F)}}}function Mf(f,c,h){return f!==void 0?f:c!==void 0?c:h!==void 0?h:void 0}function jie(f,c,h,g,v){return Mf(typeof h===v?g[h]:void 0,f.default,c.default)}function kie(f,c,h){if(!Wy(h))return Mf(f.default,c.default);const g=f.stops.length;if(g===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[g-1][0])return f.stops[g-1][1];const v=Gk(f.stops.map(k=>k[0]),h);return f.stops[v][1]}function LP(f,c,h){const g=f.base!==void 0?f.base:1;if(!Wy(h))return Mf(f.default,c.default);const v=f.stops.length;if(v===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[v-1][0])return f.stops[v-1][1];const k=Gk(f.stops.map(G=>G[0]),h),C=function(G,Z,X,re){const ne=re-X,me=G-X;return ne===0?0:Z===1?me/ne:(Math.pow(Z,me)-1)/(Math.pow(Z,ne)-1)}(h,g,f.stops[k][0],f.stops[k+1][0]),L=f.stops[k][1],F=f.stops[k+1][1];let $=Cv[c.type]||IP;if(f.colorSpace&&f.colorSpace!=="rgb"){const G=kP[f.colorSpace];$=(Z,X)=>G.reverse(G.interpolate(G.forward(Z),G.forward(X),C))}return typeof L.evaluate=="function"?{evaluate(...G){const Z=L.evaluate.apply(void 0,G),X=F.evaluate.apply(void 0,G);if(Z!==void 0&&X!==void 0)return $(Z,X,C)}}:$(L,F,C)}function OP(f,c,h){return c.type==="color"?h=Ta.parse(h):c.type==="formatted"?h=id.fromString(h.toString()):c.type==="resolvedImage"?h=od.build(h.toString()):un(h)===c.type||c.type==="enum"&&c.values[h]||(h=void 0),Mf(h,f.default,c.default)}ld.register(n0,{error:[{kind:"error"},[Zs],(f,[c])=>{throw new il(c.evaluate(f))}],typeof:[Zs,[Na],(f,[c])=>Io(vl(c.evaluate(f)))],"to-rgba":[Nc(yn,4),[Pd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Nc(yn,4),[Pd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Pd,[yn,yn,yn],p5],rgba:[Pd,[yn,yn,yn,yn],p5],hsl:[Pd,[yn,yn,yn],m5],hsla:[Pd,[yn,yn,yn,yn],m5],has:{type:Fa,overloads:[[[Zs],(f,[c])=>MP(c.evaluate(f),f.properties())],[[Zs,kf],(f,[c,h])=>MP(c.evaluate(f),h.evaluate(f))]]},get:{type:Na,overloads:[[[Zs],(f,[c])=>g5(c.evaluate(f),f.properties())],[[Zs,kf],(f,[c,h])=>g5(c.evaluate(f),h.evaluate(f))]]},"feature-state":[Na,[Zs],(f,[c])=>g5(c.evaluate(f),f.featureState||{})],properties:[kf,[],f=>f.properties()],"geometry-type":[Zs,[],f=>f.geometryType()],worldview:[Zs,[],f=>f.globals.worldview||""],"is-active-floor":[Fa,Hm(Zs),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const h=f.globals.activeFloors;return c.some(g=>{const v=g.evaluate(f);return h.has(v)})}],id:[Na,[],f=>f.id()],zoom:[yn,[],f=>f.globals.zoom],pitch:[yn,[],f=>f.globals.pitch||0],"distance-from-center":[yn,[],f=>f.distanceFromCenter()],"measure-light":[yn,[Zs],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[yn,[],f=>f.globals.heatmapDensity||0],"line-progress":[yn,[],f=>f.globals.lineProgress||0],"raster-value":[yn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[yn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[yn,[],f=>f.globals.skyRadialProgress||0],accumulated:[Na,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[yn,Hm(yn),(f,c)=>{let h=0;for(const g of c)h+=g.evaluate(f);return h}],"*":[yn,Hm(yn),(f,c)=>{let h=1;for(const g of c)h*=g.evaluate(f);return h}],"-":{type:yn,overloads:[[[yn,yn],(f,[c,h])=>c.evaluate(f)-h.evaluate(f)],[[yn],(f,[c])=>-c.evaluate(f)]]},"/":[yn,[yn,yn],(f,[c,h])=>c.evaluate(f)/h.evaluate(f)],"%":[yn,[yn,yn],(f,[c,h])=>c.evaluate(f)%h.evaluate(f)],ln2:[yn,[],()=>Math.LN2],pi:[yn,[],()=>Math.PI],e:[yn,[],()=>Math.E],"^":[yn,[yn,yn],(f,[c,h])=>Math.pow(c.evaluate(f),h.evaluate(f))],sqrt:[yn,[yn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[yn,[yn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[yn,[yn],(f,[c])=>Math.log(c.evaluate(f))],log2:[yn,[yn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[yn,[yn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[yn,[yn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[yn,[yn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[yn,[yn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[yn,[yn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[yn,[yn],(f,[c])=>Math.atan(c.evaluate(f))],min:[yn,Hm(yn),(f,c)=>Math.min(...c.map(h=>h.evaluate(f)))],max:[yn,Hm(yn),(f,c)=>Math.max(...c.map(h=>h.evaluate(f)))],abs:[yn,[yn],(f,[c])=>Math.abs(c.evaluate(f))],round:[yn,[yn],(f,[c])=>{const h=c.evaluate(f);return h<0?-Math.round(-h):Math.round(h)}],floor:[yn,[yn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[yn,[yn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Fa,[Zs,Na],(f,[c,h])=>f.properties()[c.value]===h.value],"filter-id-==":[Fa,[Na],(f,[c])=>f.id()===c.value],"filter-type-==":[Fa,[Zs],(f,[c])=>f.geometryType()===c.value],"filter-<":[Fa,[Zs,Na],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g{const h=f.id(),g=c.value;return typeof h==typeof g&&h":[Fa,[Zs,Na],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g>v}],"filter-id->":[Fa,[Na],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>g}],"filter-<=":[Fa,[Zs,Na],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Fa,[Na],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h<=g}],"filter->=":[Fa,[Zs,Na],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Fa,[Na],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>=g}],"filter-has":[Fa,[Na],(f,[c])=>c.value in f.properties()],"filter-has-id":[Fa,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Fa,[Nc(Zs)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Fa,[Nc(Na)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Fa,[Zs,Nc(Na)],(f,[c,h])=>h.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Fa,[Zs,Nc(Na)],(f,[c,h])=>function(g,v,k,C){for(;k<=C;){const L=k+C>>1;if(v[L]===g)return!0;v[L]>g?C=L-1:k=L+1}return!1}(f.properties()[c.value],h.value,0,h.value.length-1)],all:{type:Fa,overloads:[[[Fa,Fa],(f,[c,h])=>c.evaluate(f)&&h.evaluate(f)],[Hm(Fa),(f,c)=>{for(const h of c)if(!h.evaluate(f))return!1;return!0}]]},any:{type:Fa,overloads:[[[Fa,Fa],(f,[c,h])=>c.evaluate(f)||h.evaluate(f)],[Hm(Fa),(f,c)=>{for(const h of c)if(h.evaluate(f))return!0;return!1}]]},"!":[Fa,[Fa],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Fa,[Zs],(f,[c])=>{const h=f.globals&&f.globals.isSupportedScript;return!h||h(c.evaluate(f))}],upcase:[Zs,[Zs],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[Zs,[Zs],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[Zs,Hm(Na),(f,c)=>c.map(h=>sh(h.evaluate(f))).join("")],"resolved-locale":[Zs,[Tk],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[yn,[yn,yn,Na],(f,c)=>{const[h,g,v]=c.map(C=>C.evaluate(f));if(h>g||h===g)return h;let k;if(typeof v=="string")k=function(C){let L=0;if(C.length===0)return L;for(let F=0;FJSON.stringify(Z)).join(", ")}, but found ${JSON.stringify(G)} instead.`);return G}catch(G){const Z=G;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 qv(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in n0}function Gm(f,c,h,g,v){const k=new Wk(n0,[],c?function(L){const F={color:Pd,string:Zs,number:yn,enum:Zs,boolean:Fa,formatted:Mv,resolvedImage:Tv};return L.type==="array"?Nc(F[L.value]||Na,L.length):F[L.type]}(c):void 0,void 0,void 0,h,g,v),C=k.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return C?TP(new aN(C,c,h,g,v)):Wm(k.errors)}class s0{constructor(c,h,g,v){this.kind=c,this._styleExpression=h,this.isLightConstant=g,this.isLineProgressConstant=v,this.isStateDependent=c!=="constant"&&!Dv(h.expression),this.configDependencies=ix(h.expression),this.isIndoorDependent=rN(h.expression)}evaluateWithoutErrorHandling(c,h,g,v,k,C){return this._styleExpression.evaluateWithoutErrorHandling(c,h,g,v,k,C)}evaluate(c,h,g,v,k,C,L){return this._styleExpression.evaluate(c,h,g,v,k,C,void 0,void 0,L)}}class ox{constructor(c,h,g,v,k,C){this.kind=c,this.zoomStops=g,this._styleExpression=h,this.isStateDependent=c!=="camera"&&!Dv(h.expression),this.isIndoorDependent=rN(h.expression),this.isLightConstant=k,this.isLineProgressConstant=C,this.configDependencies=ix(h.expression),this.interpolationType=v}evaluateWithoutErrorHandling(c,h,g,v,k,C){return this._styleExpression.evaluateWithoutErrorHandling(c,h,g,v,k,C)}evaluate(c,h,g,v,k,C){return this._styleExpression.evaluate(c,h,g,v,k,C)}interpolationFactor(c,h,g){return this.interpolationType?Mu.interpolationFactor(this.interpolationType,c,h,g):0}}function y5(f,c,h,g,v){if((f=Gm(f,c,h,g,v)).result==="error")return f;const k=f.value.expression,C=Yy(k);if(!C&&!Uv(c))return Wm([new nh("","data expressions not supported")]);const L=Xy(k,["zoom","pitch","distance-from-center"]);if(!L&&!EP(c))return Wm([new nh("","zoom expressions not supported")]);const F=Xy(k,["measure-light"]);if(!F&&!AP(c))return Wm([new nh("","measure-light expression not supported")]);const $=Xy(k,["line-progress"]);if(!$&&!function(X){return x5(X.expression,"line-progress")}(c))return Wm([new nh("","line-progress expression not supported")]);const G=c.expression&&c.expression.relaxZoomRestriction,Z=Bh(k);return Z||L||G?Z instanceof nh?Wm([Z]):Z instanceof Mu&&!nN(c)?Wm([new nh("",'"interpolate" expressions cannot be used with this property')]):TP(Z?new ox(C&&$?"camera":"composite",f.value,Z.labels,Z instanceof Mu?Z.interpolation:void 0,F,$):new s0(C&&$?"constant":"source",f.value,F,$)):Wm([new nh("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class iN{constructor(c,h){this._parameters=c,this._specification=h,Object.assign(this,PP(this._parameters,this._specification))}static deserialize(c){return new iN(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Bh(f){let c=null;if(f instanceof Sp)c=Bh(f.result);else if(f instanceof zv){for(const h of f.args)if(c=Bh(h),c)break}else(f instanceof Rv||f instanceof Mu)&&f.input instanceof ld&&f.input.name==="zoom"&&(c=f);return c instanceof nh||f.eachChild(h=>{const g=Bh(h);g instanceof nh?c=g:c&&g&&c!==g&&(c=new nh("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var v5,DP,RP=function(){if(DP)return v5;DP=1,v5=c;var f=3;function c(h,g,v){var k=this.cells=[];if(h instanceof ArrayBuffer){this.arrayBuffer=h;var C=new Int32Array(this.arrayBuffer);h=C[0],this.d=(g=C[1])+2*(v=C[2]);for(var L=0;L=X[me+0]&&k>=X[me+1])?(F[ne]=!0,L.push(Z[ne])):F[ne]=!1}}},c.prototype._forEachCell=function(h,g,v,k,C,L,F,$){for(var G=this._convertToCellCoord(h),Z=this._convertToCellCoord(g),X=this._convertToCellCoord(v),re=this._convertToCellCoord(k),ne=G;ne<=X;ne++)for(var me=Z;me<=re;me++){var ke=this.d*me+ne;if((!$||$(this._convertFromCellCoord(ne),this._convertFromCellCoord(me),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(me+1)))&&C.call(this,h,g,v,k,ke,L,F,$))return}},c.prototype._convertFromCellCoord=function(h){return(h-this.padding)/this.scale},c.prototype._convertToCellCoord=function(h){return Math.max(0,Math.min(this.d-1,Math.floor(h*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var h=this.cells,g=f+this.cells.length+1+1,v=0,k=0;k=0||(v[k]=Cp(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 Km(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||Vv(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(Km);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const v=f.entries||[],k=new Map;for(let C=0;Cf>=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 Hv(f){for(const c of f)if(oN(c.charCodeAt(0)))return!0;return!1}function _5(f){for(const c of f)if(!FP(c.charCodeAt(0)))return!1;return!0}function FP(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 oN(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 lN(f){return!(oN(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 cN(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 b5(f){return f>=1424&&f<=2303||An["Arabic Presentation Forms-A"](f)||An["Arabic Presentation Forms-B"](f)}function Mp(f,c){return!(!c&&b5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||An.Khmer(f))}function Nie(f){for(const c of f)if(b5(c.charCodeAt(0)))return!0;return!1}const su={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let w5=null,cd=su.unavailable,Tp=null;const Wv=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(cd=su.error),w5&&w5(f)};function dN(){uN.fire(new Wn("pluginStateChange",{pluginStatus:cd,pluginURL:Tp}))}const uN=new gi,Gv=function(){return cd},zP=function(){if(cd!==su.deferred||!Tp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");cd=su.loading,dN(),Tp&&Oh({url:Tp},f=>{f?Wv(f):(cd=su.loaded,dN())})},Ap={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>cd===su.loaded||Ap.applyArabicShaping!=null,isLoading:()=>cd===su.loading,setState(f){cd=f.pluginStatus,Tp=f.pluginURL},isParsing:()=>cd===su.parsing,isParsed:()=>cd===su.parsed,getPluginURL:()=>Tp};class si{constructor(c,h){this.zoom=c,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.transition=h.transition,this.pitch=h.pitch,this.brightness=h.brightness,this.worldview=h.worldview,this.activeFloors=h.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(c){return function(h,g){for(const v of h)if(!Mp(v.charCodeAt(0),g))return!1;return!0}(c,Ap.isLoaded())}}class hN{constructor(c,h,g,v,k){this.property=c,this.value=h,this.expression=function(C,L,F,$,G){if(sN(C))return new iN(C,L);if(qv(C)||Array.isArray(C)&&C.length>0){const Z=y5(C,L,F,$,G);if(Z.result==="error")throw new Error(Z.value.map(X=>`${X.key}: ${X.message}`).join(", "));return Z.value}{let Z=C;return typeof C=="string"&&L.type==="color"&&(Z=Ta.parse(C)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>Z}}}(h===void 0?c.specification.default:h,c.specification,g,v,k)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,h,g,v){return this.property.possiblyEvaluate(this,c,h,g,v)}}class j5{constructor(c,h,g,v){this.property=c,this.value=new hN(c,void 0,h,g,v)}transitioned(c,h){return new $P(this.property,this.value,h,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new $P(this.property,this.value,null,{},0)}}class BP{constructor(c,h,g,v){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=h,this._options=g,this._iconImageUseTheme=v,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return ar(this._values[c].value.value)}setValue(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new j5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new hN(this._values[c].property,h===null?void 0:ar(h),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,h){h&&(this._options=h);const g=this._properties.properties;if(c)for(const v in c){const k=c[v];if(v.endsWith("-transition")){const C=v.slice(0,-11);g[C]&&this.setTransition(C,k)}else g.hasOwnProperty(v)&&this.setValue(v,k)}}getTransition(c){return ar(this._values[c].transition)}setTransition(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new j5(this._values[c].property)),this._values[c].transition=ar(h)||void 0}serialize(){const c={};for(const h of Object.keys(this._values)){const g=this.getValue(h);g!==void 0&&(c[h]=g);const v=this.getTransition(h);v!==void 0&&(c[`${h}-transition`]=v)}return c}transitioned(c,h){const g=new UP(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(c,h._values[v]);return g}untransitioned(){const c=new UP(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class $P{constructor(c,h,g,v,k){const C=v.delay||0,L=v.duration||0;k=k||0,this.property=c,this.value=h,this.begin=k+C,this.end=this.begin+L,c.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(c,h,g){const v=c.now||0,k=this.value.possiblyEvaluate(c,h,g),C=this.prior;if(C){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 VP(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function fN(f){if(Array.isArray(f))return f.map(fN);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const h in f)c[h]=fN(f[h]);return c}return VP(f)}function Tf(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(!Tf(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function pN(f,c="",h=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Tf(f)||(f=mN(f));const v=f;let k=!0;try{k=function(G){if(!i0(G))return G;let Z=fN(G);return HP(Z),Z=hx(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 C=null,L=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){L=Ft[`filter_${g}`];const G=Gm(k,L,c,h);if(G.result==="error")throw new Error(G.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));C=(Z,X,re)=>G.value.evaluate(Z,X,{},re)}let F=null,$=null;if(k!==v){const G=Gm(v,L,c,h);if(G.result==="error")throw new Error(G.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));F=(Z,X,re,ne,me)=>G.value.evaluate(Z,X,{},re,void 0,void 0,ne,me),$=!Yy(G.value.expression)}return{filter:C,dynamicFilter:F||void 0,needGeometry:WP(k),needFeature:!!$}}function hx(f){if(!Array.isArray(f))return f;const c=function(h){if(Sie.has(h[0])){for(let g=1;ghx(h))}function HP(f){let c=!1;const h=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function Cie(f,c){return fc?1:0}function WP(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?gN(f[1],f[2],c):c==="any"?(h=f.slice(1),["any"].concat(h.map(mN))):c==="all"?["all"].concat(f.slice(1).map(mN)):c==="none"?["all"].concat(f.slice(1).map(mN).map(Kv)):c==="in"?xN(f[1],f.slice(2)):c==="!in"?Kv(xN(f[1],f.slice(2))):c==="has"?yN(f[1]):c!=="!has"||Kv(yN(f[1]));var h}function gN(f,c,h){switch(f){case"$type":return[`filter-type-${h}`,c];case"$id":return[`filter-id-${h}`,c];default:return[`filter-${h}`,f,c]}}function xN(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(h=>typeof h!=typeof c[0])?["filter-in-large",f,["literal",c.sort(Cie)]]:["filter-in-small",f,["literal",c]]}}function yN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function Kv(f){return["!",f]}const fx="";function $h(f,c){return c?`${f}${fx}${c}`:f}let GP;const KP=()=>GP||(GP=new Gi({"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 ZP{constructor(c,h,g,v,k,C){const L=Gm(c,Ft.appearance.condition);if(L.result==="success"&&(this.condition=L.value),this.name=h,g){this.properties=new dx(KP()),this.unevaluatedLayout=new qP(KP(),v,k,C);for(const F in g)this.unevaluatedLayout.setValue(F,g[F])}}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,h,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,h,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"),h=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),v=this.hasProperty("icon-rotate");return c||h||g||v}hasTextProperties(){const c=this.hasProperty("text-size"),h=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||h||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const YP="-transition",Af=new Set(["fill","line","background","hillshade","raster"]);class dd extends gi{constructor(c,h,g,v,k,C){if(super(),this.id=c.id,this.fqid=$h(this.id,g),this.type=c.type,this.scope=g,this.lut=v,this.options=k,this.iconImageUseTheme=C,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=Gm(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),h.layout&&(this._unevaluatedLayout=new qP(h.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()),h.paint){this._transitionablePaint=new BP(h.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 dx(h.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&Af.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,h){if(this.type==="custom"&&c==="visibility")return void(this.visibility=h);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,h),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(h=>{this.appearances.push(new ZP(h.condition,h.name,h.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(YP)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,h){const g=this._transitionablePaint,v=g._properties.properties;if(c.endsWith(YP)){const Z=c.slice(0,-11);return v[Z]&&g.setTransition(Z,h||void 0),!1}if(!v[c])return!1;const k=g._values[c],C=k.value.isDataDriven(),L=k.value;g.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const F=g._values[c].value,$=F.isDataDriven(),G=c.endsWith("pattern")||c==="line-dasharray";return $||C||G||this._handleOverridablePaintPropertyUpdate(c,L,F)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,h,g){return null}_handleOverridablePaintPropertyUpdate(c,h,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,h){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,h,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,h)}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(h=>h.serialize())),fr(c,(h,g)=>!(h===void 0||g==="layout"&&!Object.keys(h).length||g==="paint"&&!Object.keys(h).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 h=this.paint.get(c);if(h instanceof cx&&Uv(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}for(const c of this.appearances)if(!Dv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=pN(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,h,g){return{}}queryRadius(c){}queryIntersectsFeature(c,h,g,v,k,C,L,F,$){}}const XP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Zv{constructor(c,h){this._structArray=c,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const Mie=new ArrayBuffer(0);class xi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,h){return c._trim(),h&&c.arrayBuffer&&h.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const h=Object.create(this.prototype);return h.arrayBuffer=c.arrayBuffer,h.length=c.length,c.arrayBuffer?h.capacity=c.arrayBuffer.byteLength/h.bytesPerElement:(h.capacity=0,h.arrayBuffer=Mie),h._refreshViews(),h}_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 h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}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 Es(f,c=1){let h=0,g=0;return{members:f.map(v=>{const k=XP[v.type].BYTES_PER_ELEMENT,C=h=QP(h,Math.max(c,k)),L=v.components||1;return g=Math.max(g,k),h+=k*L,{name:v.name,type:v.type,components:L,offset:C}}),size:QP(h,Math.max(g,c)),alignment:c}}function QP(f,c){return Math.ceil(f/c)*c}class Zm extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const v=2*c;return this.int16[v+0]=h,this.int16[v+1]=g,c}}Zm.prototype.bytesPerElement=4,Jr(Zm,"StructArrayLayout2i4");class o0 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const k=3*c;return this.int16[k+0]=h,this.int16[k+1]=g,this.int16[k+2]=v,c}}o0.prototype.bytesPerElement=6,Jr(o0,"StructArrayLayout3i6");class l0 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,h,g,v)}emplace(c,h,g,v,k){const C=4*c;return this.int16[C+0]=h,this.int16[C+1]=g,this.int16[C+2]=v,this.int16[C+3]=k,c}}l0.prototype.bytesPerElement=8,Jr(l0,"StructArrayLayout4i8");class Ep extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.float32[1*c+0]=h,c}}Ep.prototype.bytesPerElement=4,Jr(Ep,"StructArrayLayout1f4");class k5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const k=4*c,C=2*c;return this.int16[k+0]=h,this.int16[k+1]=g,this.float32[C+1]=v,c}}k5.prototype.bytesPerElement=8,Jr(k5,"StructArrayLayout2i1f8");class N5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const k=4*c;return this.int16[k+0]=h,this.int16[k+1]=g,this.int16[k+2]=v,c}}N5.prototype.bytesPerElement=8,Jr(N5,"StructArrayLayout3i8");class S5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,k)}emplace(c,h,g,v,k,C){const L=5*c;return this.int16[L+0]=h,this.int16[L+1]=g,this.int16[L+2]=v,this.int16[L+3]=k,this.int16[L+4]=C,c}}S5.prototype.bytesPerElement=10,Jr(S5,"StructArrayLayout5i10");class vN extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,k,C,L)}emplace(c,h,g,v,k,C,L,F){const $=6*c,G=12*c,Z=3*c;return this.int16[$+0]=h,this.int16[$+1]=g,this.uint8[G+4]=v,this.uint8[G+5]=k,this.uint8[G+6]=C,this.uint8[G+7]=L,this.float32[Z+2]=F,c}}vN.prototype.bytesPerElement=12,Jr(vN,"StructArrayLayout2i4ub1f12");class Tu extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const k=3*c;return this.float32[k+0]=h,this.float32[k+1]=g,this.float32[k+2]=v,c}}Tu.prototype.bytesPerElement=12,Jr(Tu,"StructArrayLayout3f12");class Ld extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,k)}emplace(c,h,g,v,k,C){const L=6*c,F=3*c;return this.uint16[L+0]=h,this.uint16[L+1]=g,this.uint16[L+2]=v,this.uint16[L+3]=k,this.float32[F+2]=C,c}}Ld.prototype.bytesPerElement=12,Jr(Ld,"StructArrayLayout4ui1f12");class px extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,h,g,v)}emplace(c,h,g,v,k){const C=4*c;return this.uint16[C+0]=h,this.uint16[C+1]=g,this.uint16[C+2]=v,this.uint16[C+3]=k,c}}px.prototype.bytesPerElement=8,Jr(px,"StructArrayLayout4ui8");class _N extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,k,C)}emplace(c,h,g,v,k,C,L){const F=6*c;return this.int16[F+0]=h,this.int16[F+1]=g,this.int16[F+2]=v,this.int16[F+3]=k,this.int16[F+4]=C,this.int16[F+5]=L,c}}_N.prototype.bytesPerElement=12,Jr(_N,"StructArrayLayout6i12");class C5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L,F,$,G,Z,X){const re=this.length;return this.resize(re+1),this.emplace(re,c,h,g,v,k,C,L,F,$,G,Z,X)}emplace(c,h,g,v,k,C,L,F,$,G,Z,X,re){const ne=12*c;return this.int16[ne+0]=h,this.int16[ne+1]=g,this.int16[ne+2]=v,this.int16[ne+3]=k,this.uint16[ne+4]=C,this.uint16[ne+5]=L,this.uint16[ne+6]=F,this.uint16[ne+7]=$,this.int16[ne+8]=G,this.int16[ne+9]=Z,this.int16[ne+10]=X,this.int16[ne+11]=re,c}}C5.prototype.bytesPerElement=24,Jr(C5,"StructArrayLayout4i4ui4i24");class M5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,k,C)}emplace(c,h,g,v,k,C,L){const F=10*c,$=5*c;return this.int16[F+0]=h,this.int16[F+1]=g,this.int16[F+2]=v,this.float32[$+2]=k,this.float32[$+3]=C,this.float32[$+4]=L,c}}M5.prototype.bytesPerElement=20,Jr(M5,"StructArrayLayout3i3f20");class Ym extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,h,g,v)}emplace(c,h,g,v,k){const C=4*c;return this.float32[C+0]=h,this.float32[C+1]=g,this.float32[C+2]=v,this.float32[C+3]=k,c}}Ym.prototype.bytesPerElement=16,Jr(Ym,"StructArrayLayout4f16");class bN extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint32[1*c+0]=h,c}}bN.prototype.bytesPerElement=4,Jr(bN,"StructArrayLayout1ul4");class Au extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const v=2*c;return this.uint16[v+0]=h,this.uint16[v+1]=g,c}}Au.prototype.bytesPerElement=4,Jr(Au,"StructArrayLayout2ui4");class wN extends xi{_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,h,g,v,k,C,L,F,$,G,Z,X,re){const ne=this.length;return this.resize(ne+1),this.emplace(ne,c,h,g,v,k,C,L,F,$,G,Z,X,re)}emplace(c,h,g,v,k,C,L,F,$,G,Z,X,re,ne){const me=20*c,ke=10*c;return this.int16[me+0]=h,this.int16[me+1]=g,this.int16[me+2]=v,this.int16[me+3]=k,this.int16[me+4]=C,this.float32[ke+3]=L,this.float32[ke+4]=F,this.float32[ke+5]=$,this.float32[ke+6]=G,this.int16[me+14]=Z,this.uint32[ke+8]=X,this.uint16[me+18]=re,this.uint16[me+19]=ne,c}}wN.prototype.bytesPerElement=40,Jr(wN,"StructArrayLayout5i4f1i1ul2ui40");class jN extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,k,C,L)}emplace(c,h,g,v,k,C,L,F){const $=8*c;return this.int16[$+0]=h,this.int16[$+1]=g,this.int16[$+2]=v,this.int16[$+4]=k,this.int16[$+5]=C,this.int16[$+6]=L,this.int16[$+7]=F,c}}jN.prototype.bytesPerElement=16,Jr(jN,"StructArrayLayout3i2i2i16");class kN extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,k)}emplace(c,h,g,v,k,C){const L=4*c,F=8*c;return this.float32[L+0]=h,this.float32[L+1]=g,this.float32[L+2]=v,this.int16[F+6]=k,this.int16[F+7]=C,c}}kN.prototype.bytesPerElement=16,Jr(kN,"StructArrayLayout2f1f2i16");class T5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,k,C)}emplace(c,h,g,v,k,C,L){const F=20*c,$=5*c;return this.uint8[F+0]=h,this.uint8[F+1]=g,this.float32[$+1]=v,this.float32[$+2]=k,this.float32[$+3]=C,this.float32[$+4]=L,c}}T5.prototype.bytesPerElement=20,Jr(T5,"StructArrayLayout2ub4f20");class Ho extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const k=3*c;return this.uint16[k+0]=h,this.uint16[k+1]=g,this.uint16[k+2]=v,c}}Ho.prototype.bytesPerElement=6,Jr(Ho,"StructArrayLayout3ui6");class c0 extends xi{_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,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt){const ct=this.length;return this.resize(ct+1),this.emplace(ct,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt)}emplace(c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt,ct){const _t=30*c,Ct=15*c,Et=60*c;return this.int16[_t+0]=h,this.int16[_t+1]=g,this.int16[_t+2]=v,this.float32[Ct+2]=k,this.float32[Ct+3]=C,this.uint16[_t+8]=L,this.uint16[_t+9]=F,this.uint32[Ct+5]=$,this.uint32[Ct+6]=G,this.uint32[Ct+7]=Z,this.uint16[_t+16]=X,this.uint16[_t+17]=re,this.uint16[_t+18]=ne,this.float32[Ct+10]=me,this.float32[Ct+11]=ke,this.uint8[Et+48]=je,this.uint8[Et+49]=Fe,this.uint8[Et+50]=$e,this.uint32[Ct+13]=Xe,this.int16[_t+28]=mt,this.uint8[Et+58]=ct,c}}c0.prototype.bytesPerElement=60,Jr(c0,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class A5 extends xi{_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,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt,ct,_t,Ct,Et,Yt,Rt,rr,lr,cr,xr,vr,ur){const pr=this.length;return this.resize(pr+1),this.emplace(pr,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt,ct,_t,Ct,Et,Yt,Rt,rr,lr,cr,xr,vr,ur)}emplace(c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt,ct,_t,Ct,Et,Yt,Rt,rr,lr,cr,xr,vr,ur,pr){const tr=20*c,Qt=40*c,mr=80*c;return this.float32[tr+0]=h,this.float32[tr+1]=g,this.int16[Qt+4]=v,this.int16[Qt+5]=k,this.int16[Qt+6]=C,this.int16[Qt+7]=L,this.int16[Qt+8]=F,this.int16[Qt+9]=$,this.int16[Qt+10]=G,this.int16[Qt+11]=Z,this.int16[Qt+12]=X,this.uint16[Qt+13]=re,this.uint16[Qt+14]=ne,this.uint16[Qt+15]=me,this.uint16[Qt+16]=ke,this.uint16[Qt+17]=je,this.uint16[Qt+18]=Fe,this.uint16[Qt+19]=$e,this.uint16[Qt+20]=Xe,this.uint16[Qt+21]=mt,this.uint16[Qt+22]=ct,this.uint16[Qt+23]=_t,this.uint16[Qt+24]=Ct,this.uint16[Qt+25]=Et,this.uint16[Qt+26]=Yt,this.uint16[Qt+27]=Rt,this.uint32[tr+14]=rr,this.float32[tr+15]=lr,this.float32[tr+16]=cr,this.float32[tr+17]=xr,this.float32[tr+18]=vr,this.uint8[mr+76]=ur,this.uint16[Qt+39]=pr,c}}A5.prototype.bytesPerElement=80,Jr(A5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class E5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,k,C)}emplace(c,h,g,v,k,C,L){const F=6*c;return this.float32[F+0]=h,this.float32[F+1]=g,this.float32[F+2]=v,this.float32[F+3]=k,this.float32[F+4]=C,this.float32[F+5]=L,c}}E5.prototype.bytesPerElement=24,Jr(E5,"StructArrayLayout6f24");class mx extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,k)}emplace(c,h,g,v,k,C){const L=5*c;return this.float32[L+0]=h,this.float32[L+1]=g,this.float32[L+2]=v,this.float32[L+3]=k,this.float32[L+4]=C,c}}mx.prototype.bytesPerElement=20,Jr(mx,"StructArrayLayout5f20");class I5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,k,C,L)}emplace(c,h,g,v,k,C,L,F){const $=7*c;return this.float32[$+0]=h,this.float32[$+1]=g,this.float32[$+2]=v,this.float32[$+3]=k,this.float32[$+4]=C,this.float32[$+5]=L,this.float32[$+6]=F,c}}I5.prototype.bytesPerElement=28,Jr(I5,"StructArrayLayout7f28");class P5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L,F,$,G,Z){const X=this.length;return this.resize(X+1),this.emplace(X,c,h,g,v,k,C,L,F,$,G,Z)}emplace(c,h,g,v,k,C,L,F,$,G,Z,X){const re=11*c;return this.float32[re+0]=h,this.float32[re+1]=g,this.float32[re+2]=v,this.float32[re+3]=k,this.float32[re+4]=C,this.float32[re+5]=L,this.float32[re+6]=F,this.float32[re+7]=$,this.float32[re+8]=G,this.float32[re+9]=Z,this.float32[re+10]=X,c}}P5.prototype.bytesPerElement=44,Jr(P5,"StructArrayLayout11f44");class d0 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L,F,$){const G=this.length;return this.resize(G+1),this.emplace(G,c,h,g,v,k,C,L,F,$)}emplace(c,h,g,v,k,C,L,F,$,G){const Z=9*c;return this.float32[Z+0]=h,this.float32[Z+1]=g,this.float32[Z+2]=v,this.float32[Z+3]=k,this.float32[Z+4]=C,this.float32[Z+5]=L,this.float32[Z+6]=F,this.float32[Z+7]=$,this.float32[Z+8]=G,c}}d0.prototype.bytesPerElement=36,Jr(d0,"StructArrayLayout9f36");class Ef extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const v=2*c;return this.float32[v+0]=h,this.float32[v+1]=g,c}}Ef.prototype.bytesPerElement=8,Jr(Ef,"StructArrayLayout2f8");class Od extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,h,g,v)}emplace(c,h,g,v,k){const C=6*c;return this.uint32[3*c+0]=h,this.uint16[C+2]=g,this.uint16[C+3]=v,this.uint16[C+4]=k,c}}Od.prototype.bytesPerElement=12,Jr(Od,"StructArrayLayout1ul3ui12");class Xm extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint16[1*c+0]=h,c}}Xm.prototype.bytesPerElement=2,Jr(Xm,"StructArrayLayout1ui2");class L5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke){const je=this.length;return this.resize(je+1),this.emplace(je,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke)}emplace(c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je){const Fe=16*c;return this.float32[Fe+0]=h,this.float32[Fe+1]=g,this.float32[Fe+2]=v,this.float32[Fe+3]=k,this.float32[Fe+4]=C,this.float32[Fe+5]=L,this.float32[Fe+6]=F,this.float32[Fe+7]=$,this.float32[Fe+8]=G,this.float32[Fe+9]=Z,this.float32[Fe+10]=X,this.float32[Fe+11]=re,this.float32[Fe+12]=ne,this.float32[Fe+13]=me,this.float32[Fe+14]=ke,this.float32[Fe+15]=je,c}}L5.prototype.bytesPerElement=64,Jr(L5,"StructArrayLayout16f64");class NN extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,k,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,k,C,L)}emplace(c,h,g,v,k,C,L,F){const $=10*c,G=5*c;return this.uint16[$+0]=h,this.uint16[$+1]=g,this.uint16[$+2]=v,this.uint16[$+3]=k,this.float32[G+2]=C,this.float32[G+3]=L,this.float32[G+4]=F,c}}NN.prototype.bytesPerElement=20,Jr(NN,"StructArrayLayout4ui3f20");class O5 extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.int16[1*c+0]=h,c}}O5.prototype.bytesPerElement=2,Jr(O5,"StructArrayLayout1i2");class SN extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint8[1*c+0]=h,c}}SN.prototype.bytesPerElement=1,Jr(SN,"StructArrayLayout1ub1");class CN extends Zv{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]}}CN.prototype.size=40;class JP extends wN{get(c){return new CN(this,c)}}Jr(JP,"CollisionBoxArray");class MN extends Zv{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}}MN.prototype.size=60;class e6 extends c0{get(c){return new MN(this,c)}}Jr(e6,"PlacedSymbolArray");class t6 extends Zv{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]}}t6.prototype.size=80;class D5 extends A5{get(c){return new t6(this,c)}}Jr(D5,"SymbolInstanceArray");class TN extends Ep{getoffsetX(c){return this.float32[1*c+0]}}Jr(TN,"GlyphOffsetArray");class r6 extends Zm{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}Jr(r6,"SymbolLineVertexArray");class R5 extends Zv{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]}}R5.prototype.size=12;class F5 extends Od{get(c){return new R5(this,c)}}Jr(F5,"FeatureIndexArray");class n6 extends Au{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}Jr(n6,"FillExtrusionCentroidArray");class AN extends Zv{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]}}AN.prototype.size=6;class Yv extends o0{get(c){return new AN(this,c)}}Jr(Yv,"FillExtrusionWallArray");const s6=Es([{name:"a_pos",components:2,type:"Int16"}],4),Tie=Es([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),a6=Es([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Di{constructor(c=[]){this.segments=c}_prepareSegment(c,h,g,v){let k=this.segments[this.segments.length-1];return c>Di.MAX_VERTEX_ARRAY_LENGTH&&Vr(`Max vertices per segment is ${Di.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!k||k.vertexLength+c>Di.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==v)&&(k={vertexOffset:h,primitiveOffset:g,vertexLength:0,primitiveLength:0},v!==void 0&&(k.sortKey=v),this.segments.push(k)),k}prepareSegment(c,h,g,v){return this._prepareSegment(c,h.length,g.length,v)}get(){return this.segments}destroy(){for(const c of this.segments)for(const h in c.vaos)c.vaos[h].destroy()}static simpleSegment(c,h,g,v){return new Di([{vertexOffset:c,primitiveOffset:h,vertexLength:g,primitiveLength:v,vaos:{},sortKey:0}])}}function EN(f,c){return 256*(f=ge(Math.floor(f),0,255))+ge(Math.floor(c),0,255)}Di.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Jr(Di,"SegmentVector");const Aie=Es([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Eie=Es([{name:"a_pattern_b",components:4,type:"Uint16"}]),Iie=Es([{name:"a_dash",components:4,type:"Uint16"}]);class Xv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,h,g,v){this.ids.push(z5(c)),this.positions.push(h,g,v)}eachPosition(c,h){const g=z5(c);let v=0,k=this.ids.length-1;for(;v>1;this.ids[C]>=g?k=C:v=C+1}for(;this.ids[v]===g;)h(this.positions[3*v],this.positions[3*v+1],this.positions[3*v+2]),v++}static serialize(c,h){const g=new Float64Array(c.ids),v=new Uint32Array(c.positions);return B5(g,v,0,g.length-1),h&&(h.add(g.buffer),h.add(v.buffer)),{ids:g,positions:v}}static deserialize(c){const h=new Xv;let g;h.ids=c.ids,h.positions=c.positions;for(const v of h.ids)v!==g&&h.uniqueIds.push(v),g=v;return h.indexed=!0,h}}function z5(f){const c=+f;return Number.isSafeInteger(c)?c:Pr(String(f))}function B5(f,c,h,g){for(;h>1];let k=h-1,C=g+1;for(;;){do k++;while(f[k]v);if(k>=C)break;IN(f,k,C),IN(c,3*k,3*C),IN(c,3*k+1,3*C+1),IN(c,3*k+2,3*C+2)}C-h`u_${k}`),this.type=g,this.context=v}setUniform(c,h,g,v,k){const C=v.constantOr(this.value);h.set(c,k,C instanceof Ta?C.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):C)}getBinding(c,h){return this.type==="color"?new Jv(c):new Wo(c)}}class u0{constructor(c,h){this.uniformNames=h.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,h){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=h?h.tl.concat(h.br):this.pattern}setUniform(c,h,g,v,k){let C=null;k!=="u_pattern"&&k!=="u_dash"||(C=this.pattern),k==="u_pattern_b"&&(C=this.patternTransition),k==="u_pixel_ratio"&&(C=this.pixelRatio),C&&h.set(c,k,C)}getBinding(c,h){return h==="u_pattern"||h==="u_pattern_b"||h==="u_dash"?new LN(c):new Wo(c)}}class Pp{constructor(c,h,g,v){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=h.map(k=>({name:`a_${k}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new v}populatePaintArray(c,h,g,v,k,C,L,F){const $=this.paintVertexArray.length,G=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new si(0,{brightness:C,worldview:F}),h,{},k,v,L):this.expression.kind==="constant"&&this.expression.value,Z=t_(this.lutExpression,h,{},v,k,C,L,F);this.paintVertexArray.resize(c),this._setPaintValue($,c,G,Z?null:this.context.lut)}updatePaintArray(c,h,g,v,k,C,L,F){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:L,worldview:F},g,v,void 0,k):this.expression.kind==="constant"&&this.expression.value,G=t_(this.lutExpression,g,v,k,void 0,L,void 0,F);this._setPaintValue(c,h,$,G?null:this.context.lut)}_setPaintValue(c,h,g,v){if(this.type==="color"){const k=$5(g.toPremultipliedRenderColor(v));for(let C=c;C`u_${L}_t`),this.type=g,this.useIntegerZoom=v,this.context=k,this.maxValue=0,this.paintVertexAttributes=h.map(L=>({name:`a_${L}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new C}populatePaintArray(c,h,g,v,k,C,L,F){const $=this.expression.evaluate(new si(this.context.zoom,{brightness:C,worldview:F}),h,{},k,v,L),G=this.expression.evaluate(new si(this.context.zoom+1,{brightness:C,worldview:F}),h,{},k,v,L),Z=t_(this.lutExpression,h,{},v,k,C,L,F),X=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(X,c,$,G,Z?null:this.context.lut)}updatePaintArray(c,h,g,v,k,C,L,F){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:L,worldview:F},g,v,void 0,k),G=this.expression.evaluate({zoom:this.context.zoom+1,brightness:L,worldview:F},g,v,void 0,k),Z=t_(this.lutExpression,g,v,k,void 0,L,void 0,F);this._setPaintValue(c,h,$,G,Z?null:this.context.lut)}_setPaintValue(c,h,g,v,k){if(this.type==="color"){const C=$5(g.toPremultipliedRenderColor(k)),L=$5(g.toPremultipliedRenderColor(k));for(let F=c;F!0){this.binders={},this._buffers=[],this.context=h;const v=[];for(const k in c.paint._values){const C=c.paint.get(k);if(k.endsWith("-use-theme")||!g(k)||!(C instanceof cx&&Uv(C.property.specification)))continue;const L=Die(k,c.type),F=C.value,$=C.property.specification.type,G=!!C.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(F.kind!=="constant"||re)if(F.kind==="source"||re||Z){const ne=U5(k,$,"source");this.binders[k]=Z?new Op(F,L,$,ne,c.id):new Pp(F,L,$,ne),v.push(`/a_${k}`)}else{const ne=U5(k,$,"composite");this.binders[k]=new Lp(F,L,$,G,h,ne),v.push(`/z_${k}`)}else this.binders[k]=Z?new u0(F.value,L):new r_(F.value,L,$,h),v.push(`/u_${k}`);X&&(this.binders[k].lutExpression=X.value)}this.cacheKey=v.sort().join("")}getMaxValue(c){const h=this.binders[c];return h instanceof Pp||h instanceof Lp?h.maxValue:0}populatePaintArrays(c,h,g,v,k,C,L,F){for(const $ in this.binders){const G=this.binders[$];G.context=this.context,(G instanceof Pp||G instanceof Lp||G instanceof Op)&&G.populatePaintArray(c,h,g,v,k,C,L,F)}}setConstantPatternPositions(c,h){for(const g in this.binders){const v=this.binders[g];v instanceof u0&&v.setConstantPatternPositions(c,h)}}getPatternTransitionVertexBuffer(c){const h=this.binders[c];return h instanceof Op?h.paintTransitionVertexBuffer:null}updatePaintArrays(c,h,g,v,k,C,L,F,$,G){let Z=!1;const X=Object.keys(c),re=X.length!==0&&!F,ne=re?X:h.uniqueIds;this.context.lut=k.lut;for(const me in this.binders){const ke=this.binders[me];if(ke.context=this.context,(ke instanceof Pp||ke instanceof Lp||ke instanceof Op)&&ke.expression&&ke.expression.kind&&ke.expression.kind!=="constant"&&(ke.expression.isStateDependent===!0||ke.expression.isLightConstant===!1)){const je=k.paint.get(me);ke.expression=je.value;for(const Fe of ne){const $e=c[Fe.toString()];h.eachPosition(Fe,(Xe,mt,ct)=>{const _t=v.feature(Xe);ke.updatePaintArray(mt,ct,_t,$e,C,L,$,G)})}if(!re)for(const Fe of g.uniqueIds){const $e=c[Fe.toString()];g.eachPosition(Fe,(Xe,mt,ct)=>{const _t=v.feature(Xe);ke.updatePaintArray(mt,ct,_t,$e,C,L,$,G)})}Z=!0}}return Z}defines(){const c=[];for(const h in this.binders){const g=this.binders[h];(g instanceof r_||g instanceof u0)&&c.push(...g.uniformNames.map(v=>`#define HAS_UNIFORM_${v}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const h=[];for(const g in this.binders){const v=this.binders[g];if(v instanceof r_||v instanceof u0||v instanceof Lp)for(const k of v.uniformNames)h.push({name:k,property:g,binding:v.getBinding(c,k)})}return h}setUniforms(c,h,g,v,k){for(const{name:C,property:L,binding:F}of g)this.binders[L].setUniform(c,F,k,v.get(L),C)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const h=this.binders[c];(h instanceof Pp||h instanceof Lp||h instanceof Op)&&h.paintVertexBuffer&&this._buffers.push(h.paintVertexBuffer),h instanceof Op&&h.paintTransitionVertexBuffer&&this._buffers.push(h.paintTransitionVertexBuffer)}}upload(c){for(const h in this.binders){const g=this.binders[h];(g instanceof Pp||g instanceof Lp||g instanceof Op)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const h=this.binders[c];(h instanceof Pp||h instanceof Lp||h instanceof Op)&&h.destroy()}}}class Uh{constructor(c,h,g=()=>!0){this.programConfigurations={};for(const v of c)this.programConfigurations[v.id]=new Qm(v,h,g);this.needsUpload=!1,this._featureMap=new Xv,this._featureMapWithoutIds=new Xv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,h,g,v,k,C,L,F,$){for(const G in this.programConfigurations)this.programConfigurations[G].populatePaintArrays(c,h,v,k,C,L,F,$);h.id!==void 0?this._featureMap.add(h.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,h,g,v,k,C,L,F){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,h,$,v,k,C,L||0,F)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const Oie={"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 Die(f,c){return Oie[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const Rie={"line-pattern":{source:Ld,composite:Ld},"fill-pattern":{source:Ld,composite:Ld},"fill-extrusion-pattern":{source:Ld,composite:Ld},"line-dasharray":{source:px,composite:px}},Fie={color:{source:Ef,composite:Ym},number:{source:Ep,composite:Ef}};function U5(f,c,h){const g=Rie[f];return g&&g[h]||Fie[c][h]}Jr(r_,"ConstantBinder"),Jr(u0,"PatternConstantBinder"),Jr(Pp,"SourceExpressionBinder"),Jr(Op,"PatternCompositeBinder"),Jr(Lp,"CompositeExpressionBinder"),Jr(Qm,"ProgramConfiguration",{omit:["_buffers"]}),Jr(Uh,"ProgramConfigurationSet");const Sc=Cr/Math.PI/2,oh=5,RN=6,zie=16383,h0=64,q5=[h0,32,16],lh=-Sc,ch=Sc;function gx(f,c,h,g=Sc){return h=is(h),[f*Math.sin(h)*g,-c*g,f*Math.cos(h)*g]}function f0(f,c,h){return gx(Math.cos(is(f)),Math.sin(is(f)),c,h)}const b=63710088e-1,d=2*Math.PI*b;class m{constructor(c,h){if(isNaN(c)||isNaN(h))throw new Error(`Invalid LngLat object: (${c}, ${h})`);if(this.lng=+c,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new m(Ze(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const h=Math.PI/180,g=this.lat*h,v=c.lat*h,k=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((c.lng-this.lng)*h);return b*Math.acos(Math.min(k,1))}toBounds(c=0){const h=360*c/40075017,g=h/Math.cos(Math.PI/180*this.lat);return new j({lng:this.lng-g,lat:this.lat-h},{lng:this.lng+g,lat:this.lat+h})}toEcef(c){return f0(this.lat,this.lng,Sc+c*Sc/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 j{constructor(c,h){c&&(h?this.setSouthWest(c).setNorthEast(h):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 h=this._sw,g=this._ne;let v,k;if(c instanceof m)v=c,k=c;else{if(!(c instanceof j))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(j.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 h||g?(h.lng=Math.min(v.lng,h.lng),h.lat=Math.min(v.lat,h.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:h,lat:g}=m.convert(c);let v=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(v=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&v}static convert(c){if(c)return c instanceof j?c:new j(c)}}const T=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 ee(f){return 360*f-180}function de(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function ce(f,c){return f*D(de(c))}const ue=85.051129;function we(f){return Math.cos(is(ge(f,-ue,ue)))}function ve(f,c){const h=ge(c,T,O),g=Math.pow(2,h);return we(f)*d/(512*g)}function De(f){return 1/Math.cos(f*Math.PI/180)}function Ie(f,c=0){const h=Math.exp(Math.PI*(1-(f.y+c/Cr)/(1<=F?(tt(f,c,h,$,G,k,Z,L,F),tt(f,$,G,g,v,Z,C,L,F)):f.push(C)}function Ge(f,c,h){let g=f[0],v=g.x,k=g.y;c(g);const C=[g];for(let L=1;Lf.x+1||gf.y+1)&&Vr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function St(f,c,h){const g=f.loadGeometry(),v=f.extent,k=Cr/v;if(c&&h&&h.projection.isReprojectedInTileSpace){const C=1<{const re=ee((c.x+X.x/v)/C),ne=de((c.y+X.y/v)/C),me=G.project(re,ne);X.x=(me.x*L-F)*v,X.y=(me.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 C of g)for(const L of C)lt(L,k);return g}function Dt(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?St(f):[]}}class Ot{constructor(c,h,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(Wt,this,h)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos,g=[];let v,k=1,C=0,L=0,F=0;for(;c.pos>3}if(C--,k===1||k===2)L+=c.readSVarint(),F+=c.readSVarint(),k===1&&(v&&g.push(v),v=[]),v&&v.push(new ir(L,F));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 h=c.readVarint()+c.pos;let g=1,v=0,k=0,C=0,L=1/0,F=-1/0,$=1/0,G=-1/0;for(;c.pos>3}if(v--,g===1||g===2)k+=c.readSVarint(),C+=c.readSVarint(),kF&&(F=k),C<$&&($=C),C>G&&(G=C);else if(g!==7)throw new Error(`unknown command ${g}`)}return[L,$,F,G]}toGeoJSON(c,h,g){const v=this.extent*Math.pow(2,g),k=this.extent*c,C=this.extent*h,L=this.loadGeometry();function F(X){return[360*(X.x+k)/v-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+C)/v)*Math.PI))-90]}function $(X){return X.map(F)}let G;if(this.type===1){const X=[];for(const ne of L)X.push(ne[0]);const re=$(X);G=X.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const X=L.map($);G=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 me=ne.length;if(me<=1)return[ne];const ke=[];let je,Fe;for(let $e=0;$e=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const h=this._pbf.readVarint()+this._pbf.pos;return new Ot(this._pbf,h,this.extent,this._keys,this._values)}}function _r(f,c,h){f===15?c.version=h.readVarint():f===1?c.name=h.readString():f===5?c.extent=h.readVarint():f===2?c._features.push(h.pos):f===3?c._keys.push(h.readString()):f===4&&c._values.push(function(g){let v=null;const k=g.readVarint()+g.pos;for(;g.pos>3;v=C===1?g.readString():C===2?g.readFloat():C===3?g.readDouble():C===4?g.readVarint64():C===5?g.readVarint():C===6?g.readSVarint():C===7?g.readBoolean():null}if(v==null)throw new Error("unknown feature value");return v}(h))}class $t{constructor(c,h){this.layers=c.readFields(Tt,{},h)}}function Tt(f,c,h){if(f===3){const g=new sr(h,h.readVarint()+h.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,h){return this._valid&&c(h(this._geometry)),this}require(c,h,g){return this.get(c,!0,h,g)}optional(c,h,g){return this.get(c,!1,h,g)}success(){return this._valid}get(c,h,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):h&&(this._valid=!1),this}}class Ar{constructor(c,h){this.featureFunc=c,this.vertexFunc=h}parseFeature(c,h,g){return this.featureFunc(c,h,g)}parseVertex(c,h,g){return this.vertexFunc(c,h,g)}}const Hr=new Ar((f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).optional("fixed_height_relative",g=>{h.constantHeight=g},br.decodeRelativeHeight).geometry(g=>{h.bounds=g},Np).success(),(f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).require("elevation_idx",g=>{h.idx=g}).require("extent",g=>{h.extent=g}).require("height_relative",g=>{h.height=g},br.decodeRelativeHeight).geometry(g=>{h.position=g},br.getPoint).success()),Nr=new Ar((f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).optional("fixed_height",g=>{h.constantHeight=g},br.decodeMetricHeight).geometry(g=>{h.bounds=g},Np).success(),(f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).require("elevation_idx",g=>{h.idx=g}).require("extent",g=>{h.extent=g}).require("height",g=>{h.height=g},br.decodeMetricHeight).geometry(g=>{h.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 h=[],g=[],v=c.length,k=new dr;for(let C=0;C=0);if(k===0)return 0;k!==c.length&&(h=!1)}return h?2:1}function Qn(f,c){for(const h of f.projections){const g=Gr(c,f.points[0],h.axis);if(h.projection[1]g[1])return 0}return 1}function Fs(f,c){let h=0;const g=[0,0,0,0];for(let C=0;C=0&&h++;var v,k;return h}class pa{constructor(c,h){this.points=c||new Array(8).fill([0,0,0]),this.planes=h||new Array(6).fill([0,0,0,0]),this.bounds=dn.fromPoints(this.points),this.projections=[],this.frustumEdges=[_e([],this.points[2],this.points[3]),_e([],this.points[0],this.points[3]),_e([],this.points[4],this.points[0]),_e([],this.points[5],this.points[1]),_e([],this.points[6],this.points[2]),_e([],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,h,g,v){const k=Math.pow(2,g),C=[[-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 G=pt([],$,c),Z=1/G[3]/h*k;return(X=G)[0]=(re=G)[0]*(ne=[Z,Z,v?1/G[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 G=Be([],ht([],_e([],C[$[0]],C[$[1]]),_e([],C[$[2]],C[$[1]]))),Z=-Ye(G,C[$[1]]);return G.concat(Z)}),F=[];for(let $=0;$$[1]||$[0]>F[1])return 0}return 1}containsPoint(c){for(const h of this.planes){const g=h[3];if(Ye([h[0],h[1],h[2]],c)+g<0)return!1}return!0}}class dn{static fromPoints(c){const h=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const v of c)Se(h,h,v),Ne(g,g,v);return new dn(h,g)}static fromTileIdAndHeight(c,h,g){const v=1<c.max[h]||c.min[h]>this.max[h])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 h=0;h<3;h++)this.min[h]=Math.min(this.min[h],c.min[h]),this.max[h]=Math.max(this.max[h],c.max[h])}encapsulatePoint(c){for(let h=0;h<3;h++)this.min[h]=Math.min(this.min[h],c[h]),this.max[h]=Math.max(this.max[h],c[h])}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])]}}Jr(dn,"Aabb");class oa{constructor(c,h){this.feature=c,this.metersToTile=h,this.index=0}get(){const c=this.feature.vertices[this.index],h=this.feature.vertexProps[this.index].dir,g=h[1],v=-h[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?be(F,F,1/$):fe(F,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let h=0,g=Number.POSITIVE_INFINITY,v=0;const[k,C,L,F,$,G,Z]=this._tmpVec2;ys(Z,c.x,c.y);const X=new on(Z,null);for(let re=0;re0?yo(F,L)/Xe:0,ct=ge(mt,0,1),_t=Math.abs((mt-ct)*this.edgeProps[re].len);va($,Z,ke),ys(G,me[1],-me[0]);const Ct=_t+Math.abs(yo($,G));Ct=0;--C){const L=this.edges[C].a,F=this.edges[C].b,{position:$,height:G,extent:Z}=this.vertices[L],{position:X,height:re,extent:ne}=this.vertices[F],me=this.vertexProps[L].dir,ke=this.vertexProps[F].dir;if(fe(h,$[0]/c,$[1]/c,G),fe(g,X[0]/c,X[1]/c,re),fe(v,me[1],-me[0],0),be(v,v,Z),fe(k,ke[1],-ke[0],0),be(k,k,ne),this.distSqLines(se(h[0]+.5*v[0],h[1]+.5*v[1],h[2]+.5*v[2]),se(g[0]-.5*k[0],g[1]-.5*k[1],g[2]-.5*k[2]),se(h[0]-.5*v[0],h[1]-.5*v[1],h[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,Fe=Ca(Ns(),$,X);this.vertices.push({position:$i(Fe,Fe,.5),height:.5*(G+re),extent:.5*(Z+ne)});const $e=Ca(Ns(),me,ke);this.vertexProps.push({dir:al($e,$e)}),this.edges.splice(C,1),this.edgeProps.splice(C,1),this.edges.push({a:L,b:je}),this.edges.push({a:je,b:F});const Xe=va(Ns(),this.vertices[je].position,$),mt=Ui(Xe),ct={vec:Xe,dir:$i(Ns(),Xe,1/mt),len:mt};this.edgeProps.push(ct),this.edgeProps.push(ct)}}distSqLines(c,h,g,v){const k=ye(xe(),h,c),C=ye(xe(),v,g),L=ye(xe(),c,g),F=Ye(k,k),$=Ye(k,C),G=Ye(k,L),Z=Ye(C,C),X=Ye(C,L),re=F*Z-$*$;if(re===0)return Pe(Me(k,g,v,Ye(L,C)/Ye(C,C)),c);const ne=(F*X-$*G)/re;return Pe(Me(k,c,h,($*X-G*Z)/re),Me(C,g,v,ne))}}class _a{static parseFrom(c,h){const g=br.parse(c);if(!g)return[];let{vertices:v,features:k}=g;const C=1/Ie(h);k.sort((G,Z)=>G.id-Z.id),v.sort((G,Z)=>G.id-Z.id||G.idx-Z.idx),v=v.filter((G,Z,X)=>Z===X.findIndex(re=>re.id===G.id&&re.idx===G.idx));const L=new Array;let F=0;const $=v.length;for(const G of k){if(G.constantHeight){L.push(new Kn(G.id,G.bounds,G.constantHeight));continue}for(;F!==$&&v[F].idv.id===g)}}class za{constructor(c,h){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(h)||(this.zScale=Math.pow(2,h.z-c.z),this.xOffset=(c.x*this.zScale-h.x)*Cr,this.yOffset=(c.y*this.zScale-h.y)*Cr)}constantElevation(c,h){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,h)}pointElevation(c,h,g){const v=this.constantElevation(h,g);return v??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(h.pointElevation(c),g))}computeBiasedHeight(c,h){return h<=0?c:c+h*Ae(0,h,c>=0?c:Math.abs(.5*c))}}Jr(Kn,"ElevationFeature");class Aa{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new Zm,this.indexArray=new Ho,this.segments=new Di,this.programConfigurations=new Uh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Ep),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){const k=this.layers[0],C=[];let L=null;k.type==="circle"&&(L=k.layout.get("circle-sort-key"));for(const{feature:$,id:G,index:Z,sourceLayerIndex:X}of c){const re=this.layers[0]._featureFilter.needGeometry,ne=Dt($,re);if(!this.layers[0]._featureFilter.filter(new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ne,g))continue;const me=L?L.evaluate(ne,{},g):void 0,ke={id:G,properties:$.properties,type:$.type,sourceLayerIndex:X,index:Z,geometry:re?ne.geometry:St($,g,v),patterns:{},sortKey:me};C.push(ke)}L&&C.sort(($,G)=>$.sortKey-G.sortKey);let F=null;v.projection.name==="globe"&&(this.globeExtVertexArray=new _N,F=v.projection);for(const $ of C){const{geometry:G,index:Z,sourceLayerIndex:X}=$,re=c[Z].feature;this.addFeature($,G,Z,h.availableImages,g,F,h.brightness,h.elevationFeatures),h.featureIndex.insert(re,G,Z,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,h,g,v,k,C,L){this.programConfigurations.updatePaintArrays(c,h,k,g,v,C,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,s6.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,a6.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,Tie.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,h,g,v,k,C,L,F){let $;this.elevationMode!=="none"&&($=_a.getElevationFeature(c,F));for(const G of h)for(const Z of G){const X=Z.x,re=Z.y;if(X<0||X>=Cr||re<0||re>=Cr)continue;if(C){const ke=C.projectTilePoint(X,re,k),je=C.upVector(k,X,re);this.addGlobeExtVertex(ke,je),this.addGlobeExtVertex(ke,je),this.addGlobeExtVertex(ke,je),this.addGlobeExtVertex(ke,je)}const ne=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),me=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 ke=$?$.pointElevation(new ir(X,re)):0;this.hasElevation=this.hasElevation||ke!==0;for(let je=0;je<4;je++)this.elevatedLayoutVertexArray.emplaceBack(ke)}this.indexArray.emplaceBack(me,me+1,me+2),this.indexArray.emplaceBack(me,me+2,me+3),ne.vertexLength+=4,ne.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},v,k,L,void 0,this.worldview)}addCircleVertex(c,h,g,v){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*h+(v+1)/2)}addGlobeExtVertex(c,h){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}}function ia(f,c){for(let h=0;h1){if(yi(f,c))return!0;for(let g=0;g1?h:h.sub(c)._mult(v)._add(c))}function Ri(f,c){let h,g,v,k=!1;for(let C=0;Cc.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 Ga(f,c){let h=!1;for(let g=0,v=f.length-1;gc.y!=C.y>c.y&&c.x<(C.x-k.x)*(c.y-k.y)/(C.y-k.y)+k.x&&(h=!h)}return h}function ud(f,c,h,g,v){for(const C of f)if(c<=C.x&&h<=C.y&&g>=C.x&&v>=C.y)return!0;const k=[new ir(c,h),new ir(c,v),new ir(g,v),new ir(g,h)];if(f.length>2){for(const C of k)if(Ga(f,C))return!0}for(let C=0;Cv.x&&c.x>v.x||f.yv.y&&c.y>v.y)return!1;const k=ts(f,c,h[0]);return k!==ts(f,c,h[1])||k!==ts(f,c,h[2])||k!==ts(f,c,h[3])}function Go(f,c,h,g,v,k){let C=c.y-f.y,L=f.x-c.x;if(k=k||0){const F=C*C+L*L;if(F===0)return!0;const $=Math.sqrt(F);C/=$,L/=$}return!((h.x-f.x)*C+(h.y-f.y)*L-k<0||(g.x-f.x)*C+(g.y-f.y)*L-k<0||(v.x-f.x)*C+(v.y-f.y)*L-k<0)}function Cc(f,c,h,g,v,k,C){return!(Go(f,c,g,v,k,C)||Go(c,h,g,v,k,C)||Go(h,f,g,v,k,C)||Go(g,v,f,c,h,C)||Go(v,k,f,c,h,C)||Go(k,g,f,c,h,C))}function Mc(f,c,h){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:h.programConfigurations.get(c.id).getMaxValue(f)}function Wl(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function Eu(f,c,h,g,v){if(!c[0]&&!c[1])return f;const k=ir.convert(c)._mult(v);h==="viewport"&&k._rotate(-g);const C=[];for(let L=0;L>h&&c.y===this.y>>h}url(c,h){const g=function(k,C,L){var F=lo(256*k,256*(C=Math.pow(2,L)-C-1),L),$=lo(256*(k+1),256*(C+1),L);return F[0]+","+F[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),v=function(k,C,L){let F,$="";for(let G=k;G>0;G--)F=1<this.canonical.z?new Vi(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vi(c,this.wrap,c,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(c,h=!0){if(this.overscaledZ===c&&h)return this.key;if(c>this.canonical.z)return Fi(this.wrap*+h,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Fi(this.wrap*+h,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const h=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>h&&c.canonical.y===this.canonical.y>>h}children(c){if(this.overscaledZ>=c)return[new Vi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,g=2*this.canonical.x,v=2*this.canonical.y;return[new Vi(h,this.wrap,h,g,v),new Vi(h,this.wrap,h,g+1,v),new Vi(h,this.wrap,h,g,v+1),new Vi(h,this.wrap,h,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,h=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,h=f.wrap;return c===1<new Vi(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Vi(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,v,k,C){const L=Math.sin(k);return g*(Math.sin((1-C)*k)/L)+v*(Math.sin(C*k)/L)}(f.a[c],f.b[c],f.angle,ge(h,0,1))+f.center[c]}function Vh(f){if(f.z<=1)return Dp[f.z+2*f.y+f.x];const c=Bie(i6(f));return dn.fromPoints(c)}function Fp(f,c,h){return be(f,f,1-h),rt(f,f,c,h)}function c1e(f,c,h){for(const g of f)Qe(g,g,c),be(g,g,h)}function d1e(f,c,h,g){const v=c/f.worldSize,k=f.globeMatrix;if(h.z<=1){const Et=Vh(h).getCorners();return c1e(Et,k,v),dn.fromPoints(Et)}const C=i6(h,g),L=Bie(C,Sc+Pf(f._tileCoverLift));c1e(L,k,v);const F=Number.MAX_VALUE,$=[-F,-F,-F],G=[F,F,F];if(C.contains(f.center)){for(const Rt of L)Se(G,G,Rt),Ne($,$,Rt);$[2]=0;const Et=f.point,Yt=[Et.x*v,Et.y*v,0];return Se(G,G,Yt),Ne($,$,Yt),new dn(G,$)}if(f._tileCoverLift>0){for(const Et of L)Se(G,G,Et),Ne($,$,Et);return new dn(G,$)}const Z=[k[12]*v,k[13]*v,k[14]*v],X=C.getCenter(),re=ge(f.center.lat,-ue,ue),ne=ge(X.lat,-ue,ue),me=B(f.center.lng),ke=H(re);let je=me-B(X.lng);const Fe=ke-H(ne);je>.5?je-=1:je<-.5&&(je+=1);let $e=0;Math.abs(je)>Math.abs(Fe)?$e=je>=0?1:3:($e=Fe>=0?0:2,rt(Z,Z,[k[4]*v,k[5]*v,k[6]*v],-Math.sin(is(Fe>=0?C.getSouth():C.getNorth()))*Sc));const Xe=L[$e],mt=L[($e+1)%4],ct=new Jm(Xe,mt,Z),_t=[Rp(ct,0)||Xe[0],Rp(ct,1)||Xe[1],Rp(ct,2)||Xe[2]],Ct=g0(f.zoom);if(Ct>0){const Et=function({x:Rt,y:rr,z:lr},cr,xr,vr,ur){const pr=1/(1<.5?wr=-1:hn<-.5&&(wr=1),tr=((tr+wr)*cr-(vr*=cr))*xr+vr,Qt=((Qt+wr)*cr-vr)*xr+vr,mr=(mr*cr-(ur*=cr))*xr+ur,Tr=(Tr*cr-ur)*xr+ur,[[tr,Tr,0],[Qt,Tr,0],[Qt,mr,0],[tr,mr,0]]}(h,c,f._pixelsPerMercatorPixel,me,ke);for(let Rt=0;RtMath.PI/2*1.01}const m1e=is(85),sqe=Math.cos(m1e),aqe=Math.sin(m1e),iqe=S(),g1e=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 x1e(f,c,h,g,v,k,C,L,F){if(k&&f.queryGeometry.isAboveHorizon)return!1;k&&(F*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,G=h.projection.upVectorScale($,h.center.lat,h.worldSize).metersToTile;for(const Z of c)for(const X of Z){const re=X.add(L),ne=v&&h.elevation?h.elevation.exaggeration()*v.getElevationAt(re.x,re.y,!0):0,me=h.projection.projectTilePoint(re.x,re.y,$);if(ne>0){const $e=h.projection.upVector($,re.x,re.y);me.x+=$e[0]*G*ne,me.y+=$e[1]*G*ne,me.z+=$e[2]*G*ne}const ke=k?re:oqe(me.x,me.y,me.z,g),je=k?f.tilespaceRays.map($e=>cqe($e,ne)):f.queryGeometry.screenGeometry,Fe=pt([],[me.x,me.y,me.z,1],g);if(!C&&k?F*=Fe[3]/h.cameraToCenterDistance:C&&!k&&(F*=h.cameraToCenterDistance/Fe[3]),k){const $e=de((X.y/Cr+$.y)/(1<<$.z));F/=h.projection.pixelsPerMeter($e,1)/Y(1,$e)}if(cs(je,ke,F))return!0}return!1}function oqe(f,c,h,g){const v=pt([],[f,c,h,1],g);return new ir(v[0]/v[3],v[1]/v[3])}const y1e=se(0,0,0),lqe=se(0,0,1);function cqe(f,c){const h=xe();return y1e[2]=c,f.intersectsPlane(y1e,lqe,h),new ir(h[0],h[1])}class v1e extends Aa{}let _1e,b1e,w1e,j1e;function k1e(f,{width:c,height:h},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==c*h*g)throw new RangeError("mismatched image size")}else v=new Uint8Array(c*h*g);return f.width=c,f.height=h,f.data=v,f}function N1e(f,c,h){const{width:g,height:v}=c;g===f.width&&v===f.height||(Vie(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,v)},h,null),f.width=g,f.height=v,f.data=c.data)}function Vie(f,c,h,g,v,k,C,L){if(v.width===0||v.height===0)return c;if(v.width>f.width||v.height>f.height||h.x>f.width-v.width||h.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 F=f.data,$=c.data,G=k===4&&L;for(let Z=0;Z{c[f.evaluationKey]=F;const $=f.expression.evaluate(c),G=$?$.toNonPremultipliedRenderColor(null):null;G&&(v.data[C+L+0]=Math.floor(255*G.r),v.data[C+L+1]=Math.floor(255*G.g),v.data[C+L+2]=Math.floor(255*G.b),v.data[C+L+3]=Math.floor(255*G.a))};if(f.clips)for(let C=0,L=0;C80*h){L=f[0],F=f[1];let G=L,Z=F;for(let X=h;XG&&(G=re),ne>Z&&(Z=ne)}$=Math.max(G-L,Z-F),$=$!==0?32767/$:0}return W5(k,C,h,L,F,$,0),C}function C1e(f,c,h,g,v){let k;if(v===function(C,L,F,$){let G=0;for(let Z=L,X=F-$;Z0)for(let C=c;C=c;C-=g)k=E1e(C/g|0,f[C],f[C+1],k);return k&&zN(k,k.next)&&(Z5(k),k=k.next),k}function a_(f,c){if(!f)return f;c||(c=f);let h,g=f;do if(h=!1,g.steiner||!zN(g,g.next)&&Al(g.prev,g,g.next)!==0)g=g.next;else{if(Z5(g),g=c=g.prev,g===g.next)break;h=!0}while(h||g!==c);return c}function W5(f,c,h,g,v,k,C){if(!f)return;!C&&k&&function(F,$,G,Z){let X=F;do X.z===0&&(X.z=Hie(X.x,X.y,$,G,Z)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==F);X.prevZ.nextZ=null,X.prevZ=null,function(re){let ne,me=1;do{let ke,je=re;re=null;let Fe=null;for(ne=0;je;){ne++;let $e=je,Xe=0;for(let ct=0;ct0||mt>0&&$e;)Xe!==0&&(mt===0||!$e||je.z<=$e.z)?(ke=je,je=je.nextZ,Xe--):(ke=$e,$e=$e.nextZ,mt--),Fe?Fe.nextZ=ke:re=ke,ke.prevZ=Fe,Fe=ke;je=$e}Fe.nextZ=null,me*=2}while(ne>1)}(X)}(f,g,v,k);let L=f;for(;f.prev!==f.next;){const F=f.prev,$=f.next;if(k?mqe(f,g,v,k):pqe(f))c.push(F.i,f.i,$.i),Z5(f),f=$.next,L=$.next;else if((f=$)===L){C?C===1?W5(f=gqe(a_(f),c),c,h,g,v,k,2):C===2&&xqe(f,c,h,g,v,k):W5(a_(f),c,h,g,v,k,1);break}}}function pqe(f){const c=f.prev,h=f,g=f.next;if(Al(c,h,g)>=0)return!1;const v=c.x,k=h.x,C=g.x,L=c.y,F=h.y,$=g.y,G=Math.min(v,k,C),Z=Math.min(L,F,$),X=Math.max(v,k,C),re=Math.max(L,F,$);let ne=g.next;for(;ne!==c;){if(ne.x>=G&&ne.x<=X&&ne.y>=Z&&ne.y<=re&&G5(v,L,k,F,C,$,ne.x,ne.y)&&Al(ne.prev,ne,ne.next)>=0)return!1;ne=ne.next}return!0}function mqe(f,c,h,g){const v=f.prev,k=f,C=f.next;if(Al(v,k,C)>=0)return!1;const L=v.x,F=k.x,$=C.x,G=v.y,Z=k.y,X=C.y,re=Math.min(L,F,$),ne=Math.min(G,Z,X),me=Math.max(L,F,$),ke=Math.max(G,Z,X),je=Hie(re,ne,c,h,g),Fe=Hie(me,ke,c,h,g);let $e=f.prevZ,Xe=f.nextZ;for(;$e&&$e.z>=je&&Xe&&Xe.z<=Fe;){if($e.x>=re&&$e.x<=me&&$e.y>=ne&&$e.y<=ke&&$e!==v&&$e!==C&&G5(L,G,F,Z,$,X,$e.x,$e.y)&&Al($e.prev,$e,$e.next)>=0||($e=$e.prevZ,Xe.x>=re&&Xe.x<=me&&Xe.y>=ne&&Xe.y<=ke&&Xe!==v&&Xe!==C&&G5(L,G,F,Z,$,X,Xe.x,Xe.y)&&Al(Xe.prev,Xe,Xe.next)>=0))return!1;Xe=Xe.nextZ}for(;$e&&$e.z>=je;){if($e.x>=re&&$e.x<=me&&$e.y>=ne&&$e.y<=ke&&$e!==v&&$e!==C&&G5(L,G,F,Z,$,X,$e.x,$e.y)&&Al($e.prev,$e,$e.next)>=0)return!1;$e=$e.prevZ}for(;Xe&&Xe.z<=Fe;){if(Xe.x>=re&&Xe.x<=me&&Xe.y>=ne&&Xe.y<=ke&&Xe!==v&&Xe!==C&&G5(L,G,F,Z,$,X,Xe.x,Xe.y)&&Al(Xe.prev,Xe,Xe.next)>=0)return!1;Xe=Xe.nextZ}return!0}function gqe(f,c){let h=f;do{const g=h.prev,v=h.next.next;!zN(g,v)&&T1e(g,h,h.next,v)&&K5(g,v)&&K5(v,g)&&(c.push(g.i,h.i,v.i),Z5(h),Z5(h.next),h=f=v),h=h.next}while(h!==f);return a_(h)}function xqe(f,c,h,g,v,k){let C=f;do{let L=C.next.next;for(;L!==C.prev;){if(C.i!==L.i&&wqe(C,L)){let F=A1e(C,L);return C=a_(C,C.next),F=a_(F,F.next),W5(C,c,h,g,v,k,0),void W5(F,c,h,g,v,k,0)}L=L.next}C=C.next}while(C!==f)}function yqe(f,c){let h=f.x-c.x;return h===0&&(h=f.y-c.y,h===0)&&(h=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),h}function vqe(f,c){const h=function(v,k){let C=k;const L=v.x,F=v.y;let $,G=-1/0;if(zN(v,C))return C;do{if(zN(v,C.next))return C.next;if(F<=C.y&&F>=C.next.y&&C.next.y!==C.y){const me=C.x+(F-C.y)*(C.next.x-C.x)/(C.next.y-C.y);if(me<=L&&me>G&&(G=me,$=C.x=C.x&&C.x>=X&&L!==C.x&&M1e(F$.x||C.x===$.x&&_qe($,C)))&&($=C,ne=me)}C=C.next}while(C!==Z);return $}(f,c);if(!h)return c;const g=A1e(h,f);return a_(g,g.next),a_(h,h.next)}function _qe(f,c){return Al(f.prev,f,c.prev)<0&&Al(c.next,f,f.next)<0}function Hie(f,c,h,g,v){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-h)*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 bqe(f){let c=f,h=f;do(c.x=(f-C)*(k-L)&&(f-C)*(g-L)>=(h-C)*(c-L)&&(h-C)*(k-L)>=(v-C)*(g-L)}function G5(f,c,h,g,v,k,C,L){return!(f===C&&c===L)&&M1e(f,c,h,g,v,k,C,L)}function wqe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(h,g){let v=h;do{if(v.i!==h.i&&v.next.i!==h.i&&v.i!==g.i&&v.next.i!==g.i&&T1e(v,v.next,h,g))return!0;v=v.next}while(v!==h);return!1}(f,c)&&(K5(f,c)&&K5(c,f)&&function(h,g){let v=h,k=!1;const C=(h.x+g.x)/2,L=(h.y+g.y)/2;do v.y>L!=v.next.y>L&&v.next.y!==v.y&&C<(v.next.x-v.x)*(L-v.y)/(v.next.y-v.y)+v.x&&(k=!k),v=v.next;while(v!==h);return k}(f,c)&&(Al(f.prev,f,c.prev)||Al(f,c.prev,c))||zN(f,c)&&Al(f.prev,f,f.next)>0&&Al(c.prev,c,c.next)>0)}function Al(f,c,h){return(c.y-f.y)*(h.x-c.x)-(c.x-f.x)*(h.y-c.y)}function zN(f,c){return f.x===c.x&&f.y===c.y}function T1e(f,c,h,g){const v=d6(Al(f,c,h)),k=d6(Al(f,c,g)),C=d6(Al(h,g,f)),L=d6(Al(h,g,c));return v!==k&&C!==L||!(v!==0||!c6(f,h,c))||!(k!==0||!c6(f,g,c))||!(C!==0||!c6(h,f,g))||!(L!==0||!c6(h,c,g))}function c6(f,c,h){return c.x<=Math.max(f.x,h.x)&&c.x>=Math.min(f.x,h.x)&&c.y<=Math.max(f.y,h.y)&&c.y>=Math.min(f.y,h.y)}function d6(f){return f>0?1:f<0?-1:0}function K5(f,c){return Al(f.prev,f,f.next)<0?Al(f,c,f.next)>=0&&Al(f,f.prev,c)>=0:Al(f,c,f.prev)<0||Al(f,f.next,c)<0}function A1e(f,c){const h=Wie(f.i,f.x,f.y),g=Wie(c.i,c.x,c.y),v=f.next,k=c.prev;return f.next=c,c.prev=f,h.next=v,v.prev=h,g.next=h,h.prev=g,k.next=g,g.prev=k,g}function E1e(f,c,h,g){const v=Wie(f,c,h);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function Z5(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 Wie(f,c,h){return{i:f,x:c,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Y5(f,c){const h=f.length;if(h<=1)return[f];const g=[];let v,k;for(let C=0;C1)for(let C=0;C=Cr&&h>=Cr}static evaluate(c){if(c.length===0)return new xx;let h=[];for(const F of c)h.push(...F.portals);if(h.length===0)return new xx;for(const F of h){const $=F.va,G=F.vb;(xx.isOnBorder($.x,G.x)||xx.isOnBorder($.y,G.y))&&(F.type="border")}const g=h.filter(F=>F.type!=="unevaluated"),v=h.filter(F=>F.type==="unevaluated");if(v.length===0)return new xx;v.sort((F,$)=>F.hash===$.hash?F.isTunnel===$.isTunnel?0:F.isTunnel?-1:1:F.hash<$.hash?1:-1),h=g.concat(v);let k=g.length,C=k,L=k;do if(C++,C===h.length||h[k].hash!==h[C].hash){if(C-k==2){LF.hash<$.hash?1:-1),{portals:h}}}Jr(xx,"ElevationPortalGraph"),Jr(P1e,"ElevationPolygons");class kqe{constructor(c,h,g){this.outPositions=c,this.outNormals=h,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,h,g){let v=c[2];g!=null&&(v*=g);const k=`${c[0]},${c[1]},${c[2]},${h[0]},${h[1]},${h[2]}`,C=this.vertexLookup.get(k);if(C!=null)return C;const L=this.outPositions.length;this.vertexLookup.set(k,L);const F=Math.trunc(16384*h[0]),$=Math.trunc(16384*h[1]),G=Math.trunc(16384*h[2]);return this.outPositions.emplaceBack(c[0],c[1],v),this.outNormals.emplaceBack(F,$,G),L}addTriangle(c,h,g){this.outIndices.emplaceBack(c,h,g)}addTriangles(c,h,g){if(c.length===0)return;const v=g.length===1,k=xe(),C=xe();for(let L=0;Lk!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Uh(h,{zoom:g,lut:v},k=>k!=="fill-bridge-guard-rail-color")}addVertices(c,h){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||dc(Z,X,L))||this.isOnBorder(Z.x,X.x)||this.isOnBorder(Z.y,X.y))continue;const re=Iu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[G]);let ne,me=this.vertexHashLookup.get(Iu.computePosHash(Z));me!=null?ne=me.next:(me=this.vertexHashLookup.get(Iu.computePosHash(X)),ne=me!=null?me.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:G,hash:re,portalHash:ne,isTunnel:v,type:"unevaluated",featureInfo:C})}}addPortalCandidates(c,h,g,v,k){if(h.length===0)return;this.portalPolygons.add(c,{geometry:h,zLevel:k});const C=h[0];this.vertexHashLookup.clear();let L=Iu.computeEdgeHash(C[C.length-2],C[C.length-1]);for(let F=0;F({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},v=new kqe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const k=h(),C=h(),L=h(),F=(X,re)=>{X.sort((me,ke)=>me.type===re&&ke.type!==re?-1:me.type!==re&&ke.type===re?1:0);const ne=X.findIndex(me=>me.type!==re);return ne>=0?ne:X.length};let $=0;this.unevalEdges.length>0&&($=F(this.unevalEdges,"none"),this.constructBridgeStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(L);const G=h(),Z=h();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice($),re=F(X,"tunnel")+$;this.unevalEdges.push(...X),this.constructTunnelStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:re})}g(G),v.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(Z),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(C),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(k),this.maskSegments=Di.simpleSegment(0,Z.primitiveOffset,0,Z.primitiveLength),this.depthSegments=Di.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength),this.renderableBridgeSegments=Di.simpleSegment(0,L.primitiveOffset,0,L.primitiveLength),this.renderableTunnelSegments=Di.simpleSegment(0,G.primitiveOffset,0,G.primitiveLength),this.shadowCasterSegments=Di.simpleSegment(0,k.primitiveOffset,0,k.primitiveLength)}update(c,h,g,v,k,C,L,F){this.bridgeProgramConfigurations.updatePaintArrays(c,h,k,g,v,C,L,F),this.tunnelProgramConfigurations.updatePaintArrays(c,h,k,g,v,C,L,F)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,hqe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,fqe.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,h,g,v,k){const C=(L,F)=>{for(let $=0;$fe(xr,h[vr].x,h[vr].y,g[vr]*F),Z=xe(),X=xe(),re=xe(),ne=xe(),me=xe(),ke=(xr,vr)=>{const ur=L.get(Iu.computePosHash(h[vr])),pr=ur.from,tr=ur.to;if(!pr||!tr)return;G(Z,pr),G(X,vr),G(re,tr),Le(ne),We(Z,X)||(_e(me,X,Z),Be(ne,me)),We(re,X)||(_e(me,re,X),he(ne,ne,Be(me,me)));const Qt=ze(ne);return Qt>0?be(xr,ne,1/Qt):void 0};let je=Number.POSITIVE_INFINITY;this.sortSubarray(v,k.min,k.max,(xr,vr)=>xr.featureInfo.featureIndex-vr.featureInfo.featureIndex);const Fe=xe(),$e=xe(),Xe=xe(),mt=xe(),ct=xe(),_t=xe(),Ct=xe(),Et=xe(),Yt=xe(),Rt=[xe(),xe(),xe(),xe()],rr=[xe(),xe(),xe(),xe()],lr=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],cr=(xr,vr)=>xr>vr;for(let xr=k.min;xrje.featureInfo.featureIndex-Fe.featureInfo.featureIndex;this.sortSubarray(v,k.min,k.max,F),this.sortSubarray(v,C.min,C.max,F);const $=je=>Be(je,je),G=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],Z=(je,Fe)=>jeL.hash===F.hash?F.polygonIdx-L.polygonIdx:F.hash>L.hash?1:-1);let g=0,v=0,k=0,C=h[g].polygonIdx;do v++,(v===h.length||h[g].hash!==h[v].hash)&&((v-g==1||h[v-1].polygonIdx!==C)&&(k$.portalHashG.hash?L++:G.hash>$.portalHash?F++:($.type=G.type,L++)}}}isOnBorder(c,h){return c<=0&&h<=0||c>=Cr&&h>=Cr}addFeatureSection(c,h,g,v){return c!==h&&(h=c,g.push({featureIndex:c,vertexStart:v.getVertexCount()}),v.clearVertexLookup()),h}sortSubarray(c,h,g,v){const k=c.slice(h,g);k.sort(v),c.splice(h,k.length,...k)}static computeEdgeHash(c,h){return(c.y===h.y&&c.x>h.x||c.y>h.y)&&([c,h]=[h,c]),BigInt(Iu.computePosHash(c))<<32n|BigInt(Iu.computePosHash(h))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var L1e,O1e={exports:{}},D1e=(L1e||(L1e=1,function(f){function c(dt,xt){return dt>xt?1:dt0){var gn=yr+Math.floor(Fr/2),bn={key:xt[gn],data:nr[gn],parent:dt};return bn.left=v(bn,xt,nr,yr,gn),bn.right=v(bn,xt,nr,gn+1,Rr),bn}return null}function k(dt,xt,nr,yr,Rr){if(!(nr>=yr)){for(var Fr=dt[nr+yr>>1],gn=nr-1,bn=yr+1;;){do gn++;while(Rr(dt[gn],Fr)<0);do bn--;while(Rr(dt[bn],Fr)>0);if(gn>=bn)break;var es=dt[gn];dt[gn]=dt[bn],dt[bn]=es,es=xt[gn],xt[gn]=xt[bn],xt[bn]=es}k(dt,xt,nr,bn,Rr),k(dt,xt,bn+1,yr,Rr)}}h.prototype.rotateLeft=function(dt){var xt=dt.right;xt&&(dt.right=xt.left,xt.left&&(xt.left.parent=dt),xt.parent=dt.parent),dt.parent?dt===dt.parent.left?dt.parent.left=xt:dt.parent.right=xt:this._root=xt,xt&&(xt.left=dt),dt.parent=xt},h.prototype.rotateRight=function(dt){var xt=dt.left;xt&&(dt.left=xt.right,xt.right&&(xt.right.parent=dt),xt.parent=dt.parent),dt.parent?dt===dt.parent.left?dt.parent.left=xt:dt.parent.right=xt:this._root=xt,xt&&(xt.right=dt),dt.parent=xt},h.prototype._splay=function(dt){for(;dt.parent;){var xt=dt.parent;xt.parent?xt.left===dt&&xt.parent.left===xt?(this.rotateRight(xt.parent),this.rotateRight(xt)):xt.right===dt&&xt.parent.right===xt?(this.rotateLeft(xt.parent),this.rotateLeft(xt)):xt.left===dt&&xt.parent.right===xt?(this.rotateRight(xt),this.rotateLeft(xt)):(this.rotateLeft(xt),this.rotateRight(xt)):xt.left===dt?this.rotateRight(xt):this.rotateLeft(xt)}},h.prototype.splay=function(dt){for(var xt,nr,yr,Rr,Fr;dt.parent;)(nr=(xt=dt.parent).parent)&&nr.parent?((yr=nr.parent).left===nr?yr.left=dt:yr.right=dt,dt.parent=yr):(dt.parent=null,this._root=dt),Rr=dt.left,Fr=dt.right,dt===xt.left?(nr&&(nr.left===xt?(xt.right?(nr.left=xt.right,nr.left.parent=nr):nr.left=null,xt.right=nr,nr.parent=xt):(Rr?(nr.right=Rr,Rr.parent=nr):nr.right=null,dt.left=nr,nr.parent=dt)),Fr?(xt.left=Fr,Fr.parent=xt):xt.left=null,dt.right=xt,xt.parent=dt):(nr&&(nr.right===xt?(xt.left?(nr.right=xt.left,nr.right.parent=nr):nr.right=null,xt.left=nr,nr.parent=xt):(Fr?(nr.left=Fr,Fr.parent=nr):nr.left=null,dt.right=nr,nr.parent=dt)),Rr?(xt.right=Rr,Rr.parent=xt):xt.right=null,dt.left=xt,xt.parent=dt)},h.prototype.replace=function(dt,xt){dt.parent?dt===dt.parent.left?dt.parent.left=xt:dt.parent.right=xt:this._root=xt,xt&&(xt.parent=dt.parent)},h.prototype.minNode=function(dt){if(dt===void 0&&(dt=this._root),dt)for(;dt.left;)dt=dt.left;return dt},h.prototype.maxNode=function(dt){if(dt===void 0&&(dt=this._root),dt)for(;dt.right;)dt=dt.right;return dt},h.prototype.insert=function(dt,xt){var nr=this._root,yr=null,Rr=this._compare;if(this._noDuplicates)for(;nr;){if(yr=nr,Rr(nr.key,dt)===0)return;nr=Rr(nr.key,dt)<0?nr.right:nr.left}else for(;nr;)yr=nr,nr=Rr(nr.key,dt)<0?nr.right:nr.left;return nr={key:dt,data:xt,left:null,right:null,parent:yr},yr?Rr(yr.key,nr.key)<0?yr.right=nr:yr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},h.prototype.find=function(dt){for(var xt=this._root,nr=this._compare;xt;){var yr=nr(xt.key,dt);if(yr<0)xt=xt.right;else{if(!(yr>0))return xt;xt=xt.left}}return null},h.prototype.contains=function(dt){for(var xt=this._root,nr=this._compare;xt;){var yr=nr(dt,xt.key);if(yr===0)return!0;xt=yr<0?xt.left:xt.right}return!1},h.prototype.remove=function(dt){var xt=this.find(dt);if(!xt)return!1;if(this.splay(xt),xt.left)if(xt.right){var nr=this.minNode(xt.right);nr.parent!==xt&&(this.replace(nr,nr.right),nr.right=xt.right,nr.right.parent=nr),this.replace(xt,nr),nr.left=xt.left,nr.left.parent=nr}else this.replace(xt,xt.left);else this.replace(xt,xt.right);return this._size--,!0},h.prototype.removeNode=function(dt){if(!dt)return!1;if(this.splay(dt),dt.left)if(dt.right){var xt=this.minNode(dt.right);xt.parent!==dt&&(this.replace(xt,xt.right),xt.right=dt.right,xt.right.parent=xt),this.replace(dt,xt),xt.left=dt.left,xt.left.parent=xt}else this.replace(dt,dt.left);else this.replace(dt,dt.right);return this._size--,!0},h.prototype.erase=function(dt){var xt=this.find(dt);if(xt){this.splay(xt);var nr=xt.left,yr=xt.right,Rr=null;nr&&(nr.parent=null,Rr=this.maxNode(nr),this.splay(Rr),this._root=Rr),yr&&(nr?Rr.right=yr:this._root=yr,yr.parent=Rr),this._size--}},h.prototype.pop=function(){var dt=this._root,xt=null;if(dt){for(;dt.left;)dt=dt.left;xt={key:dt.key,data:dt.data},this.remove(dt.key)}return xt},h.prototype.next=function(dt){var xt=dt;if(xt)if(xt.right)for(xt=xt.right;xt&&xt.left;)xt=xt.left;else for(xt=dt.parent;xt&&xt.right===dt;)dt=xt,xt=xt.parent;return xt},h.prototype.prev=function(dt){var xt=dt;if(xt)if(xt.left)for(xt=xt.left;xt&&xt.right;)xt=xt.right;else for(xt=dt.parent;xt&&xt.left===dt;)dt=xt,xt=xt.parent;return xt},h.prototype.forEach=function(dt){for(var xt=this._root,nr=[],yr=!1,Rr=0;!yr;)xt?(nr.push(xt),xt=xt.left):nr.length>0?(dt(xt=nr.pop(),Rr++),xt=xt.right):yr=!0;return this},h.prototype.range=function(dt,xt,nr,yr){for(var Rr=[],Fr=this._compare,gn=this._root;Rr.length!==0||gn;)if(gn)Rr.push(gn),gn=gn.left;else{if(Fr((gn=Rr.pop()).key,xt)>0)break;if(Fr(gn.key,dt)>=0&&nr.call(yr,gn))return this;gn=gn.right}return this},h.prototype.keys=function(){for(var dt=this._root,xt=[],nr=[],yr=!1;!yr;)dt?(xt.push(dt),dt=dt.left):xt.length>0?(dt=xt.pop(),nr.push(dt.key),dt=dt.right):yr=!0;return nr},h.prototype.values=function(){for(var dt=this._root,xt=[],nr=[],yr=!1;!yr;)dt?(xt.push(dt),dt=dt.left):xt.length>0?(dt=xt.pop(),nr.push(dt.data),dt=dt.right):yr=!0;return nr},h.prototype.at=function(dt){for(var xt=this._root,nr=[],yr=!1,Rr=0;!yr;)if(xt)nr.push(xt),xt=xt.left;else if(nr.length>0){if(xt=nr.pop(),Rr===dt)return xt;Rr++,xt=xt.right}else yr=!0;return null},h.prototype.load=function(dt,xt,nr){if(dt===void 0&&(dt=[]),xt===void 0&&(xt=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var yr=dt.length;return nr&&k(dt,xt,0,yr-1,this._compare),this._root=v(null,dt,xt,0,yr),this._size=yr,this},h.prototype.min=function(){var dt=this.minNode(this._root);return dt?dt.key:null},h.prototype.max=function(){var dt=this.maxNode(this._root);return dt?dt.key:null},h.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},h.createTree=function(dt,xt,nr,yr,Rr){return new h(nr,Rr).load(dt,xt,yr)},Object.defineProperties(h.prototype,g);var C=0,L=1,F=2,$=3,G=0,Z=1,X=2,re=3;function ne(dt,xt,nr){xt===null?(dt.inOut=!1,dt.otherInOut=!0):(dt.isSubject===xt.isSubject?(dt.inOut=!xt.inOut,dt.otherInOut=xt.otherInOut):(dt.inOut=!xt.otherInOut,dt.otherInOut=xt.isVertical()?!xt.inOut:xt.inOut),xt&&(dt.prevInResult=!me(xt,nr)||xt.isVertical()?xt.prevInResult:xt));var yr=me(dt,nr);dt.resultTransition=yr?function(Rr,Fr){var gn,bn=!Rr.inOut,es=!Rr.otherInOut;switch(Fr){case G:gn=bn&&es;break;case Z:gn=bn||es;break;case re:gn=bn^es;break;case X:gn=Rr.isSubject?bn&&!es:es&&!bn}return gn?1:-1}(dt,nr):0}function me(dt,xt){switch(dt.type){case C:switch(xt){case G:return!dt.otherInOut;case Z:return dt.otherInOut;case X:return dt.isSubject&&dt.otherInOut||!dt.isSubject&&!dt.otherInOut;case re:return!0}break;case F:return xt===G||xt===Z;case $:return xt===X;case L:return!1}return!1}var ke=function(dt,xt,nr,yr,Rr){this.left=xt,this.point=dt,this.otherEvent=nr,this.isSubject=yr,this.type=Rr||C,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 Fe(dt,xt){return dt[0]===xt[0]&&dt[1]===xt[1]}ke.prototype.isBelow=function(dt){var xt=this.point,nr=this.otherEvent.point;return this.left?(xt[0]-dt[0])*(nr[1]-dt[1])-(nr[0]-dt[0])*(xt[1]-dt[1])>0:(nr[0]-dt[0])*(xt[1]-dt[1])-(xt[0]-dt[0])*(nr[1]-dt[1])>0},ke.prototype.isAbove=function(dt){return!this.isBelow(dt)},ke.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},je.inResult.get=function(){return this.resultTransition!==0},ke.prototype.clone=function(){var dt=new ke(this.point,this.left,this.otherEvent,this.isSubject,this.type);return dt.contourId=this.contourId,dt.resultTransition=this.resultTransition,dt.prevInResult=this.prevInResult,dt.isExteriorRing=this.isExteriorRing,dt.inOut=this.inOut,dt.otherInOut=this.otherInOut,dt},Object.defineProperties(ke.prototype,je);var $e=11102230246251565e-32,Xe=134217729,mt=(3+8*$e)*$e;function ct(dt,xt,nr,yr,Rr){var Fr,gn,bn,es,us=xt[0],ms=yr[0],Is=0,Ln=0;ms>us==ms>-us?(Fr=us,us=xt[++Is]):(Fr=ms,ms=yr[++Ln]);var qn=0;if(Isus==ms>-us?(bn=Fr-((gn=us+Fr)-us),us=xt[++Is]):(bn=Fr-((gn=ms+Fr)-ms),ms=yr[++Ln]),Fr=gn,bn!==0&&(Rr[qn++]=bn);Isus==ms>-us?(bn=Fr-((gn=Fr+us)-(es=gn-Fr))+(us-es),us=xt[++Is]):(bn=Fr-((gn=Fr+ms)-(es=gn-Fr))+(ms-es),ms=yr[++Ln]),Fr=gn,bn!==0&&(Rr[qn++]=bn);for(;Is0!=Is>0)return Ln;var qn=Math.abs(ms+Is);return Math.abs(Ln)>=Ct*qn?Ln:-function(sa,la,ca,Ea,Za,qa,ma){var wa,hs,$s,Ti,En,Ps,Ha,Ja,ai,co,ei,In,zi,Ia,vi,Ko,bl,Po,Lo=sa-Za,ll=ca-Za,Rd=la-qa,ti=Ea-qa;Rt[0]=(vi=(Ja=Lo-(Ha=(Ps=Xe*Lo)-(Ps-Lo)))*(co=ti-(ai=(Ps=Xe*ti)-(Ps-ti)))-((Ia=Lo*ti)-Ha*ai-Ja*ai-Ha*co))-((ei=vi-(bl=(Ja=Rd-(Ha=(Ps=Xe*Rd)-(Ps-Rd)))*(co=ll-(ai=(Ps=Xe*ll)-(Ps-ll)))-((Ko=Rd*ll)-Ha*ai-Ja*ai-Ha*co)))+(En=vi-ei))+(En-bl),Rt[1]=(zi=Ia-((In=Ia+ei)-(En=In-Ia))+(ei-En))-((ei=zi-Ko)+(En=zi-ei))+(En-Ko),Rt[2]=In-((Po=In+ei)-(En=Po-In))+(ei-En),Rt[3]=Po;var no=function(rg,uc){for(var hd=uc[0],Lu=1;Lu<4;Lu++)hd+=uc[Lu];return hd}(0,Rt),uo=Et*ma;if(no>=uo||-no>=uo||(wa=sa-(Lo+(En=sa-Lo))+(En-Za),$s=ca-(ll+(En=ca-ll))+(En-Za),hs=la-(Rd+(En=la-Rd))+(En-qa),Ti=Ea-(ti+(En=Ea-ti))+(En-qa),wa===0&&hs===0&&$s===0&&Ti===0)||(uo=Yt*ma+mt*Math.abs(no),(no+=Lo*Ti+ti*wa-(Rd*$s+ll*hs))>=uo||-no>=uo))return no;xr[0]=(vi=(Ja=wa-(Ha=(Ps=Xe*wa)-(Ps-wa)))*(co=ti-(ai=(Ps=Xe*ti)-(Ps-ti)))-((Ia=wa*ti)-Ha*ai-Ja*ai-Ha*co))-((ei=vi-(bl=(Ja=hs-(Ha=(Ps=Xe*hs)-(Ps-hs)))*(co=ll-(ai=(Ps=Xe*ll)-(Ps-ll)))-((Ko=hs*ll)-Ha*ai-Ja*ai-Ha*co)))+(En=vi-ei))+(En-bl),xr[1]=(zi=Ia-((In=Ia+ei)-(En=In-Ia))+(ei-En))-((ei=zi-Ko)+(En=zi-ei))+(En-Ko),xr[2]=In-((Po=In+ei)-(En=Po-In))+(ei-En),xr[3]=Po;var au=ct(4,Rt,4,xr,rr);xr[0]=(vi=(Ja=Lo-(Ha=(Ps=Xe*Lo)-(Ps-Lo)))*(co=Ti-(ai=(Ps=Xe*Ti)-(Ps-Ti)))-((Ia=Lo*Ti)-Ha*ai-Ja*ai-Ha*co))-((ei=vi-(bl=(Ja=Rd-(Ha=(Ps=Xe*Rd)-(Ps-Rd)))*(co=$s-(ai=(Ps=Xe*$s)-(Ps-$s)))-((Ko=Rd*$s)-Ha*ai-Ja*ai-Ha*co)))+(En=vi-ei))+(En-bl),xr[1]=(zi=Ia-((In=Ia+ei)-(En=In-Ia))+(ei-En))-((ei=zi-Ko)+(En=zi-ei))+(En-Ko),xr[2]=In-((Po=In+ei)-(En=Po-In))+(ei-En),xr[3]=Po;var Zo=ct(au,rr,4,xr,lr);xr[0]=(vi=(Ja=wa-(Ha=(Ps=Xe*wa)-(Ps-wa)))*(co=Ti-(ai=(Ps=Xe*Ti)-(Ps-Ti)))-((Ia=wa*Ti)-Ha*ai-Ja*ai-Ha*co))-((ei=vi-(bl=(Ja=hs-(Ha=(Ps=Xe*hs)-(Ps-hs)))*(co=$s-(ai=(Ps=Xe*$s)-(Ps-$s)))-((Ko=hs*$s)-Ha*ai-Ja*ai-Ha*co)))+(En=vi-ei))+(En-bl),xr[1]=(zi=Ia-((In=Ia+ei)-(En=In-Ia))+(ei-En))-((ei=zi-Ko)+(En=zi-ei))+(En-Ko),xr[2]=In-((Po=In+ei)-(En=Po-In))+(ei-En),xr[3]=Po;var Of=ct(Zo,lr,4,xr,cr);return cr[Of-1]}(Rr,Fr,gn,bn,es,us,qn)}(dt[0],dt[1],xt[0],xt[1],nr[0],nr[1]);return yr>0?-1:yr<0?1:0}function ur(dt,xt){var nr=dt.point,yr=xt.point;return nr[0]>yr[0]?1:nr[0]yr[1]?1:-1:function(Rr,Fr,gn,bn){return Rr.left!==Fr.left?Rr.left?1:-1:vr(gn,Rr.otherEvent.point,Fr.otherEvent.point)!==0?Rr.isBelow(Fr.otherEvent.point)?-1:1:!Rr.isSubject&&Fr.isSubject?1:-1}(dt,xt,nr)}function pr(dt,xt,nr){var yr=new ke(xt,!1,dt,dt.isSubject),Rr=new ke(xt,!0,dt.otherEvent,dt.isSubject);return Fe(dt.point,dt.otherEvent.point)&&console.warn("what is that, a collapsed segment?",dt),yr.contourId=Rr.contourId=dt.contourId,ur(Rr,dt.otherEvent)>0&&(dt.otherEvent.left=!0,Rr.left=!1),dt.otherEvent.otherEvent=Rr,dt.otherEvent=yr,nr.push(Rr),nr.push(yr),nr}function tr(dt,xt){return dt[0]*xt[1]-dt[1]*xt[0]}function Qt(dt,xt){return dt[0]*xt[0]+dt[1]*xt[1]}function mr(dt,xt,nr){var yr=function(es,us,ms,Is,Ln){var qn=[us[0]-es[0],us[1]-es[1]],sa=[Is[0]-ms[0],Is[1]-ms[1]];function la(Ps,Ha,Ja){return[Ps[0]+Ha*Ja[0],Ps[1]+Ha*Ja[1]]}var ca=[ms[0]-es[0],ms[1]-es[1]],Ea=tr(qn,sa),Za=Ea*Ea,qa=Qt(qn,qn);if(Za>0){var ma=tr(ca,sa)/Ea;if(ma<0||ma>1)return null;var wa=tr(ca,qn)/Ea;return wa<0||wa>1?null:ma===0||ma===1?[la(es,ma,qn)]:wa===0||wa===1?[la(ms,wa,sa)]:[la(es,ma,qn)]}if((Za=(Ea=tr(ca,qn))*Ea)>0)return null;var hs=Qt(qn,ca)/qa,$s=hs+Qt(qn,sa)/qa,Ti=Math.min(hs,$s),En=Math.max(hs,$s);return Ti<=1&&En>=0?Ti===1?[la(es,Ti>0?Ti:0,qn)]:En===0?[la(es,En<1?En:1,qn)]:[la(es,Ti>0?Ti:0,qn),la(es,En<1?En:1,qn)]:null}(dt.point,dt.otherEvent.point,xt.point,xt.otherEvent.point),Rr=yr?yr.length:0;if(Rr===0||Rr===1&&(Fe(dt.point,xt.point)||Fe(dt.otherEvent.point,xt.otherEvent.point))||Rr===2&&dt.isSubject===xt.isSubject)return 0;if(Rr===1)return Fe(dt.point,yr[0])||Fe(dt.otherEvent.point,yr[0])||pr(dt,yr[0],nr),Fe(xt.point,yr[0])||Fe(xt.otherEvent.point,yr[0])||pr(xt,yr[0],nr),1;var Fr=[],gn=!1,bn=!1;return Fe(dt.point,xt.point)?gn=!0:ur(dt,xt)===1?Fr.push(xt,dt):Fr.push(dt,xt),Fe(dt.otherEvent.point,xt.otherEvent.point)?bn=!0:ur(dt.otherEvent,xt.otherEvent)===1?Fr.push(xt.otherEvent,dt.otherEvent):Fr.push(dt.otherEvent,xt.otherEvent),gn&&bn||gn?(xt.type=L,dt.type=xt.inOut===dt.inOut?F:$,gn&&!bn&&pr(Fr[1].otherEvent,Fr[0].point,nr),2):bn?(pr(Fr[0],Fr[1].point,nr),3):Fr[0]!==Fr[3].otherEvent?(pr(Fr[0],Fr[1].point,nr),pr(Fr[1],Fr[2].point,nr),3):(pr(Fr[0],Fr[1].point,nr),pr(Fr[3].otherEvent,Fr[2].point,nr),3)}function Tr(dt,xt){if(dt===xt)return 0;if(vr(dt.point,dt.otherEvent.point,xt.point)!==0||vr(dt.point,dt.otherEvent.point,xt.otherEvent.point)!==0)return Fe(dt.point,xt.point)?dt.isBelow(xt.otherEvent.point)?-1:1:dt.point[0]===xt.point[0]?dt.point[1]xt.contourId?1:-1:ur(dt,xt)===1?1:-1}var wr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function hn(dt,xt,nr,yr){var Rr,Fr=dt+1,gn=xt[dt].point,bn=xt.length;for(Fryr;)Fr--;return Fr}wr.prototype.isExterior=function(){return this.holeOf==null};var Ur=nn,Kr=nn;function nn(dt,xt){if(!(this instanceof nn))return new nn(dt,xt);if(this.data=dt||[],this.length=this.data.length,this.compare=xt||xs,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function xs(dt,xt){return dtxt?1:0}nn.prototype={push:function(dt){this.data.push(dt),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var dt=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),dt}},peek:function(){return this.data[0]},_up:function(dt){for(var xt=this.data,nr=this.compare,yr=xt[dt];dt>0;){var Rr=dt-1>>1,Fr=xt[Rr];if(nr(yr,Fr)>=0)break;xt[dt]=Fr,dt=Rr}xt[dt]=yr},_down:function(dt){for(var xt=this.data,nr=this.compare,yr=this.length>>1,Rr=xt[dt];dt=0)break;xt[dt]=bn,dt=Fr}xt[dt]=Rr}},Ur.default=Kr;var jr=Math.max,sn=Math.min,Vn=0;function zs(dt,xt,nr,yr,Rr,Fr){var gn,bn,es,us,ms,Is;for(gn=0,bn=dt.length-1;gn0?Is.left=!0:ms.left=!0;var Ln=es[0],qn=es[1];Rr[0]=sn(Rr[0],Ln),Rr[1]=sn(Rr[1],qn),Rr[2]=jr(Rr[2],Ln),Rr[3]=jr(Rr[3],qn),yr.push(ms),yr.push(Is)}}var Hs=[];function as(dt,xt,nr){typeof dt[0][0][0]=="number"&&(dt=[dt]),typeof xt[0][0][0]=="number"&&(xt=[xt]);var yr=function(qn,sa,la){var ca=null;return qn.length*sa.length==0&&(la===G?ca=Hs:la===X?ca=qn:la!==Z&&la!==re||(ca=qn.length===0?sa:qn)),ca}(dt,xt,nr);if(yr)return yr===Hs?null:yr;var Rr=[1/0,1/0,-1/0,-1/0],Fr=[1/0,1/0,-1/0,-1/0],gn=function(qn,sa,la,ca,Ea){var Za,qa,ma,wa,hs,$s,Ti=new Ur(null,ur);for(ma=0,wa=qn.length;maca[2]||ca[0]>la[2]||la[1]>ca[3]||ca[1]>la[3])&&(Ea===G?Za=Hs:Ea===X?Za=qn:Ea!==Z&&Ea!==re||(Za=qn.concat(sa))),Za}(dt,xt,Rr,Fr,nr))return yr===Hs?null:yr;for(var bn=function(qn){var sa,la,ca=function(ma){var wa,hs,$s,Ti,En=[];for(hs=0,$s=ma.length;hs<$s;hs++)((wa=ma[hs]).left&&wa.inResult||!wa.left&&wa.otherEvent.inResult)&&En.push(wa);for(var Ps=!1;!Ps;)for(Ps=!0,hs=0,$s=En.length;hs<$s;hs++)hs+1<$s&&ur(En[hs],En[hs+1])===1&&(Ti=En[hs],En[hs]=En[hs+1],En[hs+1]=Ti,Ps=!1);for(hs=0,$s=En.length;hs<$s;hs++)(wa=En[hs]).otherPos=hs;for(hs=0,$s=En.length;hs<$s;hs++)(wa=En[hs]).left||(Ti=wa.otherPos,wa.otherPos=wa.otherEvent.otherPos,wa.otherEvent.otherPos=Ti);return En}(qn),Ea={},Za=[],qa=function(){if(!Ea[sa]){var ma=Za.length,wa=function(En,Ps,Ha){var Ja=new wr;if(En.prevInResult!=null){var ai=En.prevInResult,co=ai.outputContourId;if(ai.resultTransition>0){var ei=Ps[co];if(ei.holeOf!=null){var In=ei.holeOf;Ps[In].holeIds.push(Ha),Ja.holeOf=In,Ja.depth=Ps[co].depth}else Ps[co].holeIds.push(Ha),Ja.holeOf=co,Ja.depth=Ps[co].depth+1}else Ja.holeOf=null,Ja.depth=Ps[co].depth}else Ja.holeOf=null,Ja.depth=0;return Ja}(ca[sa],Za,ma),hs=function(En){Ea[En]=!0,En=ca.length)&&ca[$s];);Za.push(wa)}};for(sa=0,la=ca.length;saTi||Za===X&&En.point[0]>ca[2])break;if(En.left){ma=qa=hs.insert(En),qa=qa!==(wa=hs.minNode())?hs.prev(qa):null,ma=hs.next(ma);var Ps=qa?qa.key:null;if(ne(En,Ps,Za),ma&&mr(En,ma.key,qn)===2&&(ne(En,Ps,Za),ne(ma.key,En,Za)),qa&&mr(qa.key,En,qn)===2){var Ha=qa;ne(Ps,(Ha=Ha!==wa?hs.prev(Ha):null)?Ha.key:null,Za),ne(En,Ps,Za)}}else ma=qa=hs.find(En=En.otherEvent),qa&&ma&&(qa=qa!==wa?hs.prev(qa):null,ma=hs.next(ma),hs.remove(En),ma&&qa&&mr(qa.key,ma.key,qn))}return $s}(gn,0,0,Rr,Fr,nr)),es=[],us=0;us * @license MIT * @preserve */function u6(f,c,h,g){const v=[],k=g===0?(C,L,F,$,G,Z)=>{C.push(new ir(Z,F+(Z-L)/($-L)*(G-F)))}:(C,L,F,$,G,Z)=>{C.push(new ir(L+(Z-F)/(G-F)*($-L),Z))};for(const C of f){const L=[];for(const F of C){if(F.length<=2)continue;const $=[];for(let X=0;Xc&&k($,re,ne,me,ke,c):je>h?Fe=c&&k($,re,ne,me,ke,c),Fe>h&&je<=h&&k($,re,ne,me,ke,h)}let G=F[F.length-1];const Z=g===0?G.x:G.y;Z>=c&&Z<=h&&$.push(G),$.length&&(G=$[$.length-1],$[0].x===G.x&&$[0].y===G.y||$.push($[0]),L.push($))}L.length&&v.push(L)}return v}function Nqe(f,c){const h=Zie(f),g=Zie([c]),v=D1e.intersection(h,g);return v==null?[]:R1e(v)}function Sqe(f,c){let g=Zie(f,65536);const v=[];for(;c.valid();c.next()){const[k,C]=c.get(),L=k.x*65536,F=k.y*65536,$=C.x*65536,G=C.y*65536,Z=$-L,X=G-F,re=Math.hypot(Z,X);if(re===0)continue;const ne=Math.trunc(X/re*3),me=-Math.trunc(Z/re*3);v.push([[[L,F],[$,G],[$+ne,G+me],[L+ne,F+me],[L,F]]])}return v.length>0&&(g=D1e.diff(g,v)),R1e(g,1/65536)}function Zie(f,c=1){return[f.map(h=>h.map(g=>[g.x*c,g.y*c]))]}function R1e(f,c=1){return f.map(h=>h.map((g,v)=>{const k=g.map(C=>new ir(C[0]*c,C[1]*c).round());return v>0&&k.reverse(),k}))}class Yie{constructor(c,h){this.layoutVertexArray=new Zm,this.indexArray=new Ho,this.lineIndexArray=new Au,this.triangleSegments=new Di,this.lineSegments=new Di,this.programConfigurations=new Uh(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,h&&(this.elevatedLayoutVertexArray=new Ep)}update(c,h,g,v,k,C,L,F){this.programConfigurations.updatePaintArrays(c,h,k,g,v,C,L,F)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,dqe.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,uqe.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,h,g,v,k,C,L){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,h,g,v,k,C,void 0,L)}}class Xie{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Yie(c,!1),this.elevationBufferData=new Yie(c,!0),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.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,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.hasPattern=Gie("fill",this.layers,this.pixelRatio,h);const k=this.layers[0].layout.get("fill-sort-key"),C=[];for(const{feature:L,id:F,index:$,sourceLayerIndex:G}of c){const Z=this.layers[0]._featureFilter.needGeometry,X=Dt(L,Z);if(!this.layers[0]._featureFilter.filter(new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),X,g))continue;const re=k?k.evaluate(X,{},g,h.availableImages):void 0,ne={id:F,properties:L.properties,type:L.type,sourceLayerIndex:G,index:$,geometry:Z?X.geometry:St(L,g,v),patterns:{},sortKey:re};C.push(ne)}k&&C.sort((L,F)=>L.sortKey-F.sortKey);for(const L of C){const{geometry:F,index:$,sourceLayerIndex:G}=L;if(this.hasPattern){const Z=Kie("fill",this.layers,L,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Z)}else this.addFeature(L,F,$,g,{},h.availableImages,h.brightness,h.elevationFeatures);h.featureIndex.insert(c[$].feature,F,$,G,this.index)}}update(c,h,g,v,k,C,L){this.bufferData.update(c,h,g,v,k,C,L,this.worldview),this.elevationBufferData.update(c,h,g,v,k,C,L,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,h,g,v,k,C,L,this.worldview)}addFeatures(c,h,g,v,k,C){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,g,v,C,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,h,g,v,k,C=[],L,F){const $=Y5(h,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,v,g,F):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,k,C,v,L,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,k,C,v,L,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,h,g,v,k){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(h,g,v,k,this.worldview))}addElevatedRoadFeature(c,h,g,v,k){const C=new Array,L=_a.getElevationFeature(c,k);if(!L)return void this.addGeometry(h,this.bufferData);{const $=this.clipPolygonsToTile(h,1);$.length>0&&C.push({polygons:$,elevationFeature:L,elevationTileID:g})}const F={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:v};for(const $ of C)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Iu($.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 G=new za(g,$.elevationTileID);this.addElevatedGeometry($.polygons,G,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,v,F)}}addElevatedGeometry(c,h,g,v,k,C){const L={elevation:g,elevationSampler:h,bias:v,index:k,featureInfo:C},[F,$]=this.addGeometry(c,this.elevationBufferData,L);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:F,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,F),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,h,g){let v=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,C=null;g&&(C=g.elevationSampler.constantElevation(g.elevation,g.bias),C!=null&&(v=C,k=C));const L=(F,$,G)=>{if(g!=null)if($.push(F),C!=null)h.elevatedLayoutVertexArray.emplaceBack(C),G.push(C);else{const Z=g.elevationSampler.pointElevation(F,g.elevation,g.bias);h.elevatedLayoutVertexArray.emplaceBack(Z),G.push(Z),v=Math.min(v,Z),k=Math.max(k,Z)}};for(const F of c){let $=0;for(const $e of F)$+=$e.length;const G=h.triangleSegments.prepareSegment($,h.layoutVertexArray,h.indexArray),Z=G.vertexLength,X=[],re=[],ne=[],me=[],ke=[],je=h.layoutVertexArray.length;for(const $e of F){if($e.length===0)continue;$e!==F[0]&&re.push(X.length/2);const Xe=h.lineSegments.prepareSegment($e.length,h.layoutVertexArray,h.lineIndexArray),mt=Xe.vertexLength;g&&ke.push(h.layoutVertexArray.length-je),L($e[0],ne,me),h.layoutVertexArray.emplaceBack($e[0].x,$e[0].y),h.lineIndexArray.emplaceBack(mt+$e.length-1,mt),X.push($e[0].x),X.push($e[0].y);for(let ct=1;ct<$e.length;ct++)L($e[ct],ne,me),h.layoutVertexArray.emplaceBack($e[ct].x,$e[ct].y),h.lineIndexArray.emplaceBack(mt+ct-1,mt+ct),X.push($e[ct].x),X.push($e[ct].y);Xe.vertexLength+=$e.length,Xe.primitiveLength+=$e.length}const Fe=FN(X,re);for(let $e=0;$e0&&g&&this.elevationMode==="hd-road-base"){const $e=g.elevation.isTunnel(),Xe=g.elevation.safeArea,mt=this.elevatedStructures.addVertices(ne,me);this.elevatedStructures.addTriangles(Fe,mt,$e);const ct=ke.length;if(ct>0){for(let _t=0;_t=g&&re.max.x<=k&&re.min.y>=v&&re.max.y<=C?F:$).push(X)}if(F.length===c.length)return c;const G=[new ir(g,v),new ir(k,v),new ir(k,C),new ir(g,C),new ir(g,v)],Z=F;for(const X of $)Z.push(...Nqe(X,G));return Z}}let F1e,z1e,B1e,$1e;Jr(Xie,"FillBucket",{omit:["layers","patternFeatures"]}),Jr(Yie,"FillBufferData"),Jr(Iu,"ElevatedStructures");class h6{constructor(c,h,g,v){if(this.triangleCount=h.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,C]=[c[0].clone(),c[0].clone()];for(let Z=1;ZZ.cellIdx-X.cellIdx||Z.triIdx-X.triIdx);let G=0;for(;G<$.length;){const Z=$[G].cellIdx,X={start:this.payload.length,len:0};for(;G<$.length&&$[G].cellIdx===Z;)++X.len,this.payload.push($[G++].triIdx);this.cells[Z]=X}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,h){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=eg(c.x-this.min.x,this.xScale,this.cellsX),v=eg(c.y-this.min.y,this.yScale,this.cellsY),k=this.cells[v*this.cellsX+g];if(k){this._lazyInitLookup();for(let C=0;Cthis.max.x||this.min.x>h.x||c.y>this.max.y||this.min.y>h.y)return;this._lazyInitLookup();const v=eg(c.x-this.min.x,this.xScale,this.cellsX),k=eg(h.x-this.min.x,this.xScale,this.cellsX),C=eg(c.y-this.min.y,this.yScale,this.cellsY),L=eg(h.y-this.min.y,this.yScale,this.cellsY);for(let F=C;F<=L;F++)for(let $=v;$<=k;$++){const G=this.cells[F*this.cellsX+$];if(G)for(let Z=0;Zh.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){for(const g of this.footprints)h.push({footprint:g,id:c})}updateAppearances(c,h,g,v){}populate(c,h,g,v){const k=[];for(const{feature:C,id:L,index:F,sourceLayerIndex:$}of c){const G=this.layers[0]._featureFilter.needGeometry,Z=Dt(C,G);if(!this.layers[0]._featureFilter.filter(new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const X={id:L,properties:C.properties,type:C.type,sourceLayerIndex:$,index:F,geometry:G?Z.geometry:St(C,g,v),patterns:{}};k.push(X)}for(const C of k){const{geometry:L,index:F,sourceLayerIndex:$}=C;this.addFeature(C,L,F,g,{},h.availableImages,h.brightness),h.featureIndex.insert(c[F].feature,L,F,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,h,g,v,k,C,L){}destroy(){}addFeature(c,h,g,v,k,C=[],L){for(const F of Y5(h,2)){const $=[],G=[],Z=[],X=new ir(1/0,1/0),re=new ir(-1/0,-1/0);for(const ke of F)if(ke.length!==0){ke!==F[0]&&Z.push(G.length/2);for(let je=0;jeC===v)===void 0}(g,f.clipScope)}function f6(f,c){return f.x-c.x||f.y-c.y}function H1e(f,c){return f6(f.min,c.min)===0&&f6(f.max,c.max)===0}function Qie(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew ir((F.x+k.x*Cr)*L-C.x*Cr,(F.y+k.y*Cr)*L-C.y*Cr))}return Jie(h,v,f.indices,0,f.indices.length,0,0)}function K1e(f,c,h,g){const v=Math.pow(2,g.z-h.z);return new ir((f+h.x*Cr)*v-g.x*Cr,(c+h.y*Cr)*v-g.y*Cr)}function Z1e(f,c){const h=[];c.grid.queryPoint(f,h);const g=c.indices,v=c.vertices;for(let k=0;k0&&(g.length>1&&h.push(g),g=[])}return g.length>1&&h.push(g),h}const toe=Ot.types,Dqe=["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"],Rqe=["fill-extrusion-flood-light-ground-radius"],Fqe=Math.pow(2,13),zqe=Math.pow(2,15)-1,X1e=new ir(0,1),yx=2147483648,Q1e=7,J1e=450;function Q5(f,c,h,g,v,k,C,L){f.emplaceBack((c<<1)+C,(h<<1)+k,(Math.floor(g*Fqe)<<1)+v,Math.round(L))}function J5(f,c,h){f.emplaceBack(c.x*Cr,c.y*Cr,h?1:0)}function m6(f,c,h,g,v,k){f.emplaceBack(c.x,c.y,(h.x<<1)+g,(h.y<<1)+v,k)}function eM(f,c,h){f.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}class eve{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class tve{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 rve{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,h){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=h.x,c.min.y=c.max.y=h.y)}appendEdge(c,h,g){this.accCount++,this.acc._add(h);let v=!!this.borders;h.xc.max.x&&(c.max.x=h.x,v=!0),h.yc.max.y&&(c.max.y=h.y,v=!0),((h.x===0||h.x===Cr)&&h.x===g.x)!=((h.y===0||h.y===Cr)&&h.y===g.y)&&this.processBorderOverlap(h,g),v&&this.checkBorderIntersection(h,g)}checkBorderIntersection(c,h){h.x<0!=c.x<0&&this.addBorderIntersection(0,Fn(h.y,c.y,(0-h.x)/(c.x-h.x))),h.x>Cr!=c.x>Cr&&this.addBorderIntersection(1,Fn(h.y,c.y,(Cr-h.x)/(c.x-h.x))),h.y<0!=c.y<0&&this.addBorderIntersection(2,Fn(h.x,c.x,(0-h.y)/(c.y-h.y))),h.y>Cr!=c.y>Cr&&this.addBorderIntersection(3,Fn(h.x,c.x,(Cr-h.y)/(c.y-h.y)))}addBorderIntersection(c,h){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];hg[1]&&(g[1]=h)}processBorderOverlap(c,h){if(c.x===h.x){if(c.y===h.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,h.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,h.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,h)=>c+ +(h[0]!==Number.MAX_VALUE),0):0}}function nve(f,c){const h=f.add(c)._unit(),g=ge(f.x*h.x+f.y*h.y,-1,1);var v,k,C;return v=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(v)))/4*zqe*((k=f).x*(C=c).y-k.y*C.x<0?-1:1)}const Bqe=[f=>f.x<0,f=>f.x>Cr,f=>f.y<0,f=>f.y>Cr];function $qe(f,c,h,g){const v=[4];if(g===0)return v;h._mult(g);const k=f.sub(h),C=c.sub(h),L=[f,c,k,C];for(let F=0;F<4;F++)for(const $ of L)if(Bqe[F]($)){v.push(F);break}return v}class roe{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new S5,this.indexArray=new Ho,this.programConfigurations=new Uh(c.layers,{zoom:c.zoom,lut:c.lut},h=>Rqe.includes(h)),this._segments=new Di,this.hiddenByLandmarkVertexArray=new SN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Di}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,h,g,v=!1){const k=c.length;if(k>2){let C=Math.max(0,this._segments.get().length-1);const L=this._segments._prepareSegment(4*k,this.vertexArray.length,2*this._segmentToGroundQuads[C].length);let F;C!==this._segments.get().length-1&&(C++,this._segmentToGroundQuads[C]=[],this._segmentToRegionTriCounts[C]=[0,0,0,0,0]);{const $=c[0],G=c[1];F=nve($.sub(c[k-1])._perp()._unit(),G.sub($)._perp()._unit())}for(let $=0;$v.region-k.region);for(let g=0;gF+$,0);let L=0;for(let F=0;F<=4;F++){const $=C[F];if($!==0){let G=this.regionSegments[F];G||(G=this.regionSegments[F]=new Di);const Z={vertexOffset:k.vertexOffset,primitiveOffset:k.primitiveOffset+L,vertexLength:k.vertexLength,primitiveLength:$};G.get().push(Z)}L+=$}for(let F=0;F0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,Iqe.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 h=this.regionSegments[c];h&&h.destroy()}}}}class g6{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(h=>h.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 Ho,this.footprintVertices=new Zm,this.footprintSegments=[],this.layoutVertexArray=new l0,this.centroidVertexArray=new n6,this.wallVertexArray=new Yv,this.indexArray=new Ho,this.programConfigurations=new Uh(c.layers,{zoom:c.zoom,lut:c.lut},h=>Dqe.includes(h)),this.segments=new Di,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.groundEffect=new roe(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.features=[],this.hasPattern=Gie("fill-extrusion",this.layers,this.pixelRatio,h),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=Ie(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:C,index:L,sourceLayerIndex:F}of c){const $=this.layers[0]._featureFilter.needGeometry,G=Dt(k,$);if(!this.layers[0]._featureFilter.filter(new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),G,g))continue;const Z={id:C,sourceLayerIndex:F,index:L,geometry:$?G.geometry:St(k,g,v),properties:k.properties,type:k.type,patterns:{}},X=this.layoutVertexArray.length,re=toe[Z.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:k.id,feature:Kie("fill-extrusion",this.layers,Z,this.zoom,this.pixelRatio,h)});else if(this.wallMode)for(const ne of Z.geometry)for(const me of Y1e(ne,re))this.addFeature(k.id,Z,[me],L,g,{},h.availableImages,v,h.brightness);else this.addFeature(k.id,Z,Z.geometry,L,g,{},h.availableImages,v,h.brightness);h.featureIndex.insert(k,Z.geometry,L,F,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,h,g,v,k,C){for(const{featureId:L,feature:F}of this.features){const $=toe[F.type]==="Polygon",{geometry:G}=F;if(this.wallMode)for(const Z of G)for(const X of Y1e(Z,$))this.addFeature(L,F,[X],F.index,h,g,v,k,C);else this.addFeature(L,F,G,F.index,h,g,v,k,C)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,h,g,v,k,C,L){this.programConfigurations.updatePaintArrays(c,h,k,g,v,C,L,this.worldview),this.groundEffect.update(c,h,k,g,v,C,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,Lqe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,Eqe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,Pqe.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,Aqe.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,h,g,v,k,C,L,F,$){const G=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(h,{})/this.tileToMeter,Z=[new ir(0,0),new ir(Cr,Cr)],X=F.projection,re=X.name==="globe",ne=this.wallMode||toe[h.type]==="Polygon",me=new rve;me.centroidDataIndex=this.centroidData.length;const ke=new tve;ke.buildingId=c,h.properties&&h.properties.hasOwnProperty("building_id")&&(ke.buildingId=h.properties.building_id);const je=this.layers[0].paint.get("fill-extrusion-base").evaluate(h,{},k)<=0,Fe=this.layers[0].paint.get("fill-extrusion-height").evaluate(h,{},k);let $e;if(ke.height=Fe,ke.vertexArrayOffset=this.layoutVertexArray.length,ke.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new _N),this.wallMode){if(re)return void Vr("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 nn=0;const xs=Kr.length;for(let jr=0;jr=0})(Rt)||(Rt=Rt.reverse());const cr={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 cr;let tr,Qt,mr,Tr,wr,hn=0;for(;hn0;let Vn="miter";const zs=2;Vn==="miter"&&jr>zs&&(Vn="bevel"),Vn==="bevel"&&(jr>100&&(Vn="flipbevel"),jr{const nr=new ir(as.x,as.y),yr=new ir(as.x,as.y);nr.x+=Ua.x*xt,nr.y+=Ua.y*xt,yr.x-=Ua.x*Math.max(dt,1),yr.y-=Ua.y*Math.max(dt,1),ur.push(Ua),xr.push(nr),vr.push(yr)};if(Vn==="miter")nn._mult(jr),Hs(tr,nn,0,0);else if(Vn==="flipbevel")nn=wr.mult(-1),Hs(tr,nn,0,0),Hs(tr,nn.mult(-1),0,0);else{const as=-Math.sqrt(jr*jr-1),Ua=sn?as:0,dt=sn?0:as;Qt&&Hs(tr,Tr,Ua,dt),mr&&Hs(tr,wr,Ua,dt)}}cr.geometry=[...xr,...vr.reverse(),xr[0]],cr.joinNormals=[...ur,...ur.reverse(),ur[ur.length-1]];const Ur=cr.geometry.length-1;for(let Kr=0;KrRt<(rr.length-1)/2||Rt===rr.length-1,mt=this.wallMode?[g]:Y5(g,500);for(let Rt=mt.length-1;Rt>=0;Rt--){const rr=mt[Rt];(rr.length===0||(ct=rr[0]).every(lr=>lr.x<=0)||ct.every(lr=>lr.x>=Cr)||ct.every(lr=>lr.y<=0)||ct.every(lr=>lr.y>=Cr))&&mt.splice(Rt,1)}var ct;let _t;if(re)_t=dve(mt,Z,k);else{_t=[];for(const Rt of mt)_t.push({polygon:Rt,bounds:Z})}const Ct=ne?this.edgeRadius:0,Et=Ct>0&&this.zoom<17,Yt=(Rt,rr)=>{if(Rt.length===0)return!1;const lr=Rt[Rt.length-1];return rr.x===lr.x&&rr.y===lr.y};for(const{polygon:Rt,bounds:rr}of _t){let lr=0,cr=0;for(const pr of Rt)ne&&!pr[0].equals(pr[pr.length-1])&&pr.push(pr[0]),cr+=ne?pr.length-1:pr.length;const xr=this.segments.prepareSegment((ne?5:4)*cr,this.layoutVertexArray,this.indexArray);ke.footprintSegIdx<0&&(ke.footprintSegIdx=this.footprintSegments.length),ke.polygonSegIdx<0&&(ke.polygonSegIdx=this.polygonSegments.length);const vr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ur=new eve;if(ur.vertexOffset=this.footprintVertices.length,ur.indexOffset=3*this.footprintIndices.length,ur.ringIndices=[],ne){const pr=[],tr=[];lr=xr.vertexLength;for(let mr=0;mr4&&ove(tr[tr.length-2],tr[0],tr[1]),mr=Ct?Uqe(tr[tr.length-2],tr[0],tr[1],Ct):0;const Tr=[];let wr,hn,Ur;hn=tr[1].sub(tr[0])._perp()._unit();let Kr=!0;for(let nn=1,xs=0;nn0?1:0,Ua=jr.dist(sn);if(xs+Ua>32768&&(xs=0),Ct){Ur=Vn.sub(sn)._perp()._unit();let yr=ave(jr,sn,Vn,sve(hn,Ur),Ct);isNaN(yr)&&(yr=0);const Rr=sn.sub(jr)._unit();jr=jr.add(Rr.mult(mr))._round(),sn=sn.add(Rr.mult(-yr))._round(),mr=yr,hn=Ur,je&&this.zoom>=17&&(Yt(Tr,jr)||Tr.push(jr),Yt(Tr,sn)||Tr.push(sn))}const dt=xr.vertexLength,xt=tr.length>4&&ove(jr,sn,Vn);let nr=lve(xs,Qt,Kr);if(Q5(this.layoutVertexArray,jr.x,jr.y,Hs,as,0,0,nr),Q5(this.layoutVertexArray,jr.x,jr.y,Hs,as,0,1,nr),this.wallMode){const yr=Xe(nn-1,tr),Rr=$e.joinNormals[nn-1];J5(this.wallVertexArray,Rr,yr),J5(this.wallVertexArray,Rr,yr)}if(xs+=Ua,nr=lve(xs,xt,!Kr),Qt=xt,Q5(this.layoutVertexArray,sn.x,sn.y,Hs,as,0,0,nr),Q5(this.layoutVertexArray,sn.x,sn.y,Hs,as,0,1,nr),this.wallMode){const yr=Xe(nn,tr),Rr=$e.joinNormals[nn];J5(this.wallVertexArray,Rr,yr),J5(this.wallVertexArray,Rr,yr)}if(xr.vertexLength+=4,this.indexArray.emplaceBack(dt+0,dt+1,dt+2),this.indexArray.emplaceBack(dt+1,dt+3,dt+2),xr.primitiveLength+=2,Ct){const yr=lr+(nn===1?tr.length-2:nn-2),Rr=nn===1?lr:yr+1;if(this.indexArray.emplaceBack(dt+1,yr,dt+3),this.indexArray.emplaceBack(yr,Rr,dt+3),xr.primitiveLength+=2,wr===void 0&&(wr=dt),!noe(Vn,tr[nn],rr)){const Fr=nn===tr.length-1?wr:xr.vertexLength;this.indexArray.emplaceBack(dt+2,dt+3,Fr),this.indexArray.emplaceBack(dt+3,Fr+1,Fr),this.indexArray.emplaceBack(dt+3,Rr,Fr+1),xr.primitiveLength+=3}Kr=!Kr}if(re){const yr=this.layoutVertexExtArray,Rr=X.projectTilePoint(jr.x,jr.y,k),Fr=X.projectTilePoint(sn.x,sn.y,k),gn=X.upVector(k,jr.x,jr.y),bn=X.upVector(k,sn.x,sn.y);eM(yr,Rr,gn),eM(yr,Rr,gn),eM(yr,Fr,bn),eM(yr,Fr,bn)}}ne&&(lr+=tr.length-1),je&&Ct&&this.zoom>=17&&(Tr.length!==0&&Yt(Tr,Tr[0])&&Tr.pop(),this.groundEffect.addData(Tr,rr,G,Ct>0))}this.footprintSegments.push(ur),vr.triangleCount=this.indexArray.length-vr.triangleArrayOffset,this.polygonSegments.push(vr),++ke.footprintSegLen,++ke.polygonSegLen}if(ke.vertexCount=this.layoutVertexArray.length-ke.vertexArrayOffset,ke.groundVertexCount=this.groundEffect.vertexArray.length-ke.groundVertexArrayOffset,ke.vertexCount!==0){if(ke.centroidXY=me.borders?X1e:this.encodeCentroid(me,ke),this.centroidData.push(ke),me.borders){this.featuresOnBorder.push(me);const Rt=this.featuresOnBorder.length-1;for(let rr=0;rrthis.featuresOnBorder[h].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let L=0;LCr),G=2*$+(+(F.min.x+F.max.x>Cr)^$);for(let Z=0;ZL.triangleSegmentIdx===F.triangleSegmentIdx?L.subtile-F.subtile:L.triangleSegmentIdx-F.triangleSegmentIdx);let g=0,v=0,k=0;for(const L of c){if(L.triangleSegmentIdx!==g)break;k++}const C=c.length;for(;v!==c.length;){g=c[v].triangleSegmentIdx;let L=0,F=v,$=v;for(let G=F;G0&&this.triangleSubSegments.push({segment:re,min:Z,max:X}),F=$;for(let ne=F;ne[me[0]*(1-je[0])+ke[0]*je[0],me[1]*(1-je[1])+ke[1]*je[1]],re=[],ne=[];for(const me of this.triangleSubSegments){re[0]=me.min.x/Cr,re[1]=me.min.y/Cr,ne[0]=me.max.x/Cr,ne[1]=me.max.y/Cr;const ke=X(G,Z,re),je=X(G,Z,ne);if(new dn([ke[0],ke[1],k],[je[0],je[1],C]).intersectsPrecise(g)===0){$&&(v.segments.push($),$=void 0);continue}const Fe=me.segment;$&&$.vertexOffset!==Fe.vertexOffset&&(v.segments.push($),$=void 0),$?($.vertexLength+=Fe.vertexLength,$.primitiveLength+=Fe.primitiveLength):$={vertexOffset:Fe.vertexOffset,primitiveLength:Fe.primitiveLength,vertexLength:Fe.vertexLength,primitiveOffset:Fe.primitiveOffset,sortKey:void 0,vaos:{}}}return $&&v.segments.push($),v}encodeCentroid(c,h){const g=c.centroid(),v=h.span(),k=Math.min(7,Math.round(v.x*this.tileToMeter/10)),C=Math.min(7,Math.round(v.y*this.tileToMeter/10));return new ir(ge(g.x,1,Cr-1)<<3|k,ge(g.y,1,Cr-1)<<3|C)}encodeBorderCentroid(c){if(!c.borders)return new ir(0,0);const h=c.borders,g=Number.MAX_VALUE;if(h[0][0]!==g||h[1][0]!==g){const v=h[0][0]!==g?0:1;return new ir(6|(h[0][0]!==g?0:65528),(h[v][0]+h[v][1])/2<<3|6)}{const v=h[2][0]!==g?2:3;return new ir((h[v][0]+h[v][1])/2<<3|6,6|(h[2][0]!==g?0:65528))}}showCentroid(c){const h=this.centroidData[c.centroidDataIndex];h.flags&=2147483647,h.centroidXY.x=0,h.centroidXY.y=0,this.writeCentroidToBuffer(h)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const h=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,v=c.flags&yx?X1e:c.centroidXY,k=this.centroidVertexArray.geta_centroid_pos0(h);if(this.centroidVertexArray.geta_centroid_pos1(h)!==v.y||k!==v.x){for(let C=h;CF.max.x||F.min.x>C.max.x||C.min.y>F.max.y||F.min.y>C.max.y||C.footprint.buildingIds.has(F.buildingId)&&(F.flags|=yx);else for(const F of this.centroidData)if(!(F.flags&yx||C.min.x>F.max.x||F.min.x>C.max.x||C.min.y>F.max.y||F.min.y>C.max.y))for(let $=0;$h!=re>h&&c<(this.footprintVertices.int16[2*(G+C.vertexOffset)+0]-Z)*(h-X)/(re-X)+Z&&(v=!v)}L=F}}return v}getHeightAtTileCoord(c,h){let g=Number.NEGATIVE_INFINITY,v=!0;const k=4*(c+Cr)*Cr+(h+Cr);if(this.partLookup.hasOwnProperty(k)){const C=this.partLookup[k];return C?{height:C.height,hidden:!!(C.flags&yx)}:void 0}for(const C of this.centroidData)c>C.max.x||C.min.x>c||h>C.max.y||C.min.y>h||C.height<=g||this.footprintContainsPoint(c,h,C)&&(g=C.height,this.partLookup[k]=C,v=!!(C.flags&yx));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.partLookup[k]=void 0}}function sve(f,c){const h=f.add(c)._unit();return f.x*h.x+f.y*h.y}function Uqe(f,c,h,g){const v=c.sub(f)._perp()._unit(),k=h.sub(c)._perp()._unit();return ave(f,c,h,sve(v,k),g)}function ave(f,c,h,g,v){const k=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(h)/3,v*k/g)}function noe(f,c,h){return f.xh[1].x&&c.x>h[1].x||f.yh[1].y&&c.y>h[1].y}function ive(f,c){return f.xc[1].x||f.yc[1].y}function ove(f,c,h){if(f.x<0||f.x>=Cr||c.x<0||c.x>=Cr||h.x<0||h.x>=Cr)return!1;const g=h.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 lve(f,c,h){const g=c?2|f:-3&f;return h?1|g:-2&g}function cve(){const f=Math.PI/32,c=Math.tan(f),h=b;return h*Math.sqrt(1+2*c*c)-h}function dve(f,c,h){const g=1<{for(const Ct of ct)ne.push({polygon:Ct,bounds:_t})},ke=Math.ceil(Math.log2(G)),je=Math.ceil(Math.log2(Z)),Fe=ke-je,$e=[];for(let ct=0;ct0?0:1);for(let ct=0;ct_t+1?mt.push({polygons:cr,bounds:vr,depth:_t+1}):me(cr,vr)}if(xr.length){const vr=[new ir(Ct===0?lr:Et.x,Ct===1?lr:Et.y),Yt];$e.length>_t+1?mt.push({polygons:xr,bounds:vr,depth:_t+1}):me(xr,vr)}}return ne}(f,c,Math.ceil((k-v)/11.25),Math.ceil((C-L)/11.25),1,(F,$,G)=>{if(F===0)return .5*($+G);{const Z=de((h.y+$/Cr)/g);return(H(.5*(de((h.y+G/Cr)/g)+Z))*g-h.y)*Cr}})}function qqe(f,c,h,g,v,k){const C=Math.pow(2,g.z-v.z);for(let L=0;L=F[C]&&(L=c,F=f),L[C]v&&pve(L,F,C,v),L[C]k&&pve(F,L,C,k)}}function x6(f,c,h,g,v,k){const C=[];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],C.push($),k&&k.push({progress:{min:ke+gve(je,Fe,re)*me,max:1},parentIndex:L,prevPoint:je,nextPoint:Fe})),$.push(ne),k&&(k[k.length-1].progress.max=ke+gve(je,Fe,ne)*me,k[k.length-1].nextPoint=Fe)))))}if(k&&Z>0)for(let X=G;X$.t-G.t);let C=0,L=0,F=[];for(g.push(F);C!==f.length;){if(L===k.length){for(;C!==f.length;)F.length!==0&&F[F.length-1].equals(f[C])||F.push(f[C]),C++;break}k[L].t<=C?(F.length!==0&&F[F.length-1].equals(k[L].point)||F.push(k[L].point),Math.trunc(k[L].t),L++):(F.length!==0&&F[F.length-1].equals(f[C])||F.push(f[C]),C++)}}function gve(f,c,h){return f.x!==c.x?(h.x-f.x)/(c.x-f.x):f.y!==c.y?(h.y-f.y)/(c.y-f.y):0}function tM(f,c){return f.x*c.x+f.y*c.y}function xve(f,c){if(f.length===1){let h=0;const g=c[h++];let v;for(;!v||g.equals(v);)if(v=c[h++],!v)return 1/0;for(;h{lr[0]=cr,lr[1]=xr,lr[2]=vr,lr[3]=1},rr=cve();re>0&&(re+=rr),ne+=rr;for(const lr of X){const cr=[],xr=[];for(const vr of lr){const ur=vr.x+me.x,pr=vr.y+me.y,tr=Z.projection.projectTilePoint(ur,pr,mt),Qt=Z.projection.upVector(mt,vr.x,vr.y);let mr=re,Tr=ne;if(je){const wr=_ve(ur,pr,re,ne,je,Fe,$e,Xe);mr+=wr.base,Tr+=wr.top}re!==0?Rt(Et,tr.x+Qt[0]*Ct*mr,tr.y+Qt[1]*Ct*mr,tr.z+Qt[2]*Ct*mr):Rt(Et,tr.x,tr.y,tr.z),Rt(Yt,tr.x+Qt[0]*Ct*Tr,tr.y+Qt[1]*Ct*Tr,tr.z+Qt[2]*Ct*Tr),Qe(Et,Et,ke),Qe(Yt,Yt,ke),cr.push(new i_(Et[0],Et[1],Et[2])),xr.push(new i_(Yt[0],Yt[1],Yt[2]))}ct.push(cr),_t.push(xr)}return[ct,_t]}(f,c,h,g,v,k,C,L,F,$,G):C?function(Z,X,re,ne,me,ke,je,Fe,$e){const Xe=[],mt=[],ct=[0,0,0,1];for(const _t of Z){const Ct=[],Et=[];for(const Yt of _t){const Rt=Yt.x+ne.x,rr=Yt.y+ne.y,lr=_ve(Rt,rr,X,re,ke,je,Fe,$e);ct[0]=Rt,ct[1]=rr,ct[2]=lr.base,ct[3]=1,pt(ct,ct,me),ct[3]=Math.max(ct[3],1e-5);const cr=new i_(ct[0]/ct[3],ct[1]/ct[3],ct[2]/ct[3]);ct[0]=Rt,ct[1]=rr,ct[2]=lr.top,ct[3]=1,pt(ct,ct,me),ct[3]=Math.max(ct[3],1e-5);const xr=new i_(ct[0]/ct[3],ct[1]/ct[3],ct[2]/ct[3]);Ct.push(cr),Et.push(xr)}Xe.push(Ct),mt.push(Et)}return[Xe,mt]}(c,h,g,v,k,C,L,F,$):function(Z,X,re,ne,me){const ke=[],je=[],Fe=me[8]*X,$e=me[9]*X,Xe=me[10]*X,mt=me[11]*X,ct=me[8]*re,_t=me[9]*re,Ct=me[10]*re,Et=me[11]*re;for(const Yt of Z){const Rt=[],rr=[];for(const lr of Yt){const cr=lr.x+ne.x,xr=lr.y+ne.y,vr=me[0]*cr+me[4]*xr+me[12],ur=me[1]*cr+me[5]*xr+me[13],pr=me[2]*cr+me[6]*xr+me[14],tr=me[3]*cr+me[7]*xr+me[15],Qt=vr+Fe,mr=ur+$e,Tr=pr+Xe,wr=Math.max(tr+mt,1e-5),hn=vr+ct,Ur=ur+_t,Kr=pr+Ct,nn=Math.max(tr+Et,1e-5);Rt.push(new i_(Qt/wr,mr/wr,Tr/wr)),rr.push(new i_(hn/nn,Ur/nn,Kr/nn))}ke.push(Rt),je.push(rr)}return[ke,je]}(c,h,g,v,k)}function _ve(f,c,h,g,v,k,C,L){const F=C*v.getElevationAt(f,c,!0,!0),$=k[0]!==0,G=$?k[1]===0?C*(k[0]/Q1e-J1e):C*function(Z,X,re){const ne=Math.floor(X[0]/8),me=Math.floor(X[1]/8),ke=10*(X[0]-8*ne),je=10*(X[1]-8*me),Fe=Z.getElevationAt(ne,me,!0,!0),$e=Z.getMeterToDEM(re),Xe=Math.floor(.5*(ke*$e-1)),mt=Math.floor(.5*(je*$e-1)),ct=Z.tileCoordToPixel(ne,me),_t=2*Xe+1,Ct=2*mt+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,ct.x-Xe,ct.y-mt,_t,Ct),Yt=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]),lr=Math.min(.25,.5*$e*(Yt+Rt)/_t),cr=Math.min(.25,.5*$e*rr/Ct);return Fe+Math.max(lr*ke,cr*je)}(v,k,L):F;return{base:F+(h===0?-1:h),top:$?Math.max(G+g,F+h+2):F+g}}class Hqe{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 Wqe{constructor(){this.tasks={},this.taskQueue=[],Pt(["process"],this),this.invoker=new Hqe(this.process),this.nextId=0}add(c,h){const g=this.nextId++,v=function({type:k,isSymbolTile:C,zoom:L}){return L=L||0,k==="message"?0:k!=="maybePrepare"||C?k!=="parseTile"||C?k==="parseTile"&&C?300-L:k==="maybePrepare"&&C?400-L:500:200-L:100-L}(h);if(v===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:h,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 h=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!h)return;h.fn()}finally{}}pick(){let c=null,h=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 h=c.data;if(!h)return;const g=h.id;if(g&&(!h.targetMapId||this.mapId===h.targetMapId))if(h.type===""){const v=this.cancelCallbacks[g];delete this.cancelCallbacks[g],v&&v.cancel()}else if(h.mustQueue||Rs(self)){const v=this.callbacks[g],k=this.scheduler.add(()=>this.processTask(g,h),v&&v.metadata||{type:"message"});k&&(this.cancelCallbacks[g]=k)}else this.processTask(g,h)}processTask(c,h){if(delete this.cancelCallbacks[c],h.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(h.error?g(Km(h.error)):g(null,Km(h.data)))}else{const g=new Set,v=h.hasCallback?(C,L)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:C?Cp(C):null,data:Cp(L,g)},g)}:()=>{},k=Km(h.data);if(this.parent[h.type])this.parent[h.type](h.sourceMapId,k,v);else if(this.parent.getWorkerSource){const C=h.type.split("."),{source:L,scope:F}=k;this.parent.getWorkerSource(h.sourceMapId,C[0],L,F)[C[1]](k,v)}else v(new Error(`Could not find function ${h.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var rM={workerUrl:"",workerClass:null,workerParams:void 0};const soe="mapboxgl_preloaded_worker_pool";class o_{constructor(c){this.active={},this.name=c}acquire(c,h=o_.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[soe]}numActive(){return Object.keys(this.active).length}}o_.workerCount=2;class BN{constructor(c,h,g="Worker",v=o_.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=At();const k=this.workerPool.acquire(this.id,v);for(let C=0;C{this.ready=!0})}broadcast(c,h,g){Nt(this.actors,(v,k)=>{v.send(c,h,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 nM,aoe;function y6(){return nM||(nM=new o_),nM}BN.Actor=bve;const ioe=4096;class Gqe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(ioe),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>ioe?-1:(new Int32Array(this.module.heap32.buffer,h,c.length).set(c),h)}createFloatArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>ioe?-1:(new Float32Array(this.module.heapF32.buffer,h,c.length).set(c),h)}readStringBuffer(c){let h="";for(;this.module.heapU8[c]!==0;)h+=String.fromCharCode(this.module.heapU8[c]),++c;return h}setStyle(c){const h=c.normalScale;this.module.setStyle(h[0],h[1],h[2],c.tileToMeters)}setAOOptions(c,h){this.module.setAOOptions(c?1:0,h)}setMetricOptions(c,h){this.module.setMetricOptions(c?1:0,h)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,h){this.module.setFacadeOptions(c,h?1:0)}setFauxFacadeOptions(c,h,g){this.module.setFauxFacadeOptions(c?1:0,h?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,h){this.memoryStackNextFree=this.memoryStack;for(const L of c){const F=this.createIntArray(L.ringIndices),$=this.createFloatArray(L.coordinates);if(F===-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,$,F,L.ringIndices.length-1)}for(const L of h){let F;F=L.entrances?JSON.parse(L.entrances):[];const $=this.createFloatArray(F),G=this.createFloatArray(L.coordinates);if($===-1||G===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(L.sourceId,L.crossPerc,L.distanceToRoad,$,F.length,G,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[h]=v})}function Tve(f,c){const h=f.json.bufferViews[c];return new Uint8Array(f.buffers[h.buffer],h.byteOffset||0,h.byteLength)}function Jqe(f,c,h,g){if(f.uri){const v=Mve(f.uri,g);return fetch(v).then(k=>k.blob()).then(k=>createImageBitmap(k)).then(k=>{c.images[h]=k})}if(f.bufferView!==void 0){const v=Tve(c,f.bufferView),k=new Blob([v],{type:f.mimeType});return createImageBitmap(k).then(C=>{c.images[h]=C})}}function Ave(f,c=0,h){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===Sve){const G=new Uint32Array(f,c);let Z=2;const X=(G[Z++]>>2)-3,re=G[Z++]>>2;if(Z++,g.json=JSON.parse(Cve.decode(G.subarray(Z,Z+re))),Z+=re,Z{const G=[],Z=L&&L.includes(coe),X=L&&L.includes(b6);if(Z&&G.push(function(){if(!zp)return sM??(sM=function(re){let ne,me=null;function ke(){ne=new Uint8Array(me.buffer)}function je(){throw new Error("Unexpected Draco error.")}const Fe={a:{a:je,d:function($e,Xe,mt){return ne.copyWithin($e,Xe,Xe+mt)},c:function($e){const Xe=ne.length,mt=Math.max($e>>>0,Math.ceil(1.2*Xe)),ct=Math.ceil((mt-Xe)/65536);try{return me.grow(ct),ke(),!0}catch{return!1}},b:je}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Fe):re.then($e=>$e.arrayBuffer()).then($e=>WebAssembly.instantiate($e,Fe))).then($e=>{const{Rb:Xe,Qb:mt,P:ct,T:_t,X:Ct,Ja:Et,La:Yt,Qa:Rt,Va:rr,Wa:lr,eb:cr,jb:xr,f:vr,e:ur,yb:pr,zb:tr,Ab:Qt,Bb:mr,Db:Tr,Gb:wr}=$e.instance.exports;me=ur;const hn=(()=>{let Ur=0,Kr=0,nn=0,xs=0;return jr=>{nn&&(Xe(xs),Xe(Ur),Kr+=nn,nn=Ur=0),Ur||(Kr+=128,Ur=mt(Kr));const sn=jr.length+7&-8;let Vn=Ur;sn>=Kr&&(nn=sn,Vn=xs=mt(sn));for(let zs=0;zs{zp=re,sM=void 0}))}()),X&&G.push(function(){if(loe)return;const re=function(ne){let me;const ke=WebAssembly.instantiateStreaming(ne,{}).then($e=>{me=$e.instance,me.exports.__wasm_call_ctors()}),je={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Fe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:ke,supported:!0,decodeGltfBuffer($e,Xe,mt,ct,_t,Ct){(function(Et,Yt,Rt,rr,lr,cr,xr){const vr=Et.exports.sbrk,ur=rr+3&-4,pr=vr(ur*lr),tr=vr(cr.length),Qt=new Uint8Array(Et.exports.memory.buffer);Qt.set(cr,tr);const mr=Yt(pr,rr,lr,tr,cr.length);if(mr===0&&xr&&xr(pr,ur,lr),Rt.set(Qt.subarray(pr,pr+rr*lr)),vr(pr-vr(0)),mr!==0)throw new Error(`Malformed buffer data: ${mr}`)})(me,me.exports[Fe[_t]],$e,Xe,mt,ct,me.exports[je[Ct]])}}}(fetch(kve()));return re.ready.then(()=>{loe=re})}()),k)for(let re=0;re{if(Z&&C)for(const{primitives:re}of C)for(const ne of re)Yqe(ne,g);if(X&&C&&F)for(const re of F)Xqe(re,g);return g})})}function Eve(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>Ave(c,0,f))}function doe(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 uoe(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 hoe{constructor(c,h,g,v){this.context=c,this.format=g,this.useMipmap=v&&v.useMipmap,this.texture=c.gl.createTexture(),this.update(h,{premultiply:v&&v.premultiply})}update(c,h){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:C}=k,{x:L,y:F}=h&&h.position?h.position:{x:0,y:0},$=L+g,G=F+v;!this.size||this.size[0]===$&&this.size[1]===G||(C.bindTexture(C.TEXTURE_2D,null),C.deleteTexture(this.texture),this.texture=C.createTexture(),this.size=null),C.bindTexture(C.TEXTURE_2D,this.texture),k.pixelStoreUnpackFlipY.set(!1),k.pixelStoreUnpack.set(1),k.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA8&&(!h||h.premultiply!==!1));const Z=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&G>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max($,G)))+1:1;C.texStorage2D(C.TEXTURE_2D,X,this.format,$,G),this.size=[$,G]}this.size&&(Z?C.texSubImage2D(C.TEXTURE_2D,0,L,F,doe(this.format),uoe(this.format),c):"data"in c&&c.data&&C.texSubImage2D(C.TEXTURE_2D,0,L,F,g,v,doe(this.format),uoe(this.format),c.data)),this.useMipmap&&C.generateMipmap(C.TEXTURE_2D)}bind(c,h,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),h!==this.wrapS&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,h),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,h),this.wrapS=h)}bindExtraParam(c,h,g,v,k){const{context:C}=this,{gl:L}=C;L.bindTexture(L.TEXTURE_2D,this.texture),h!==this.magFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,h),this.magFilter=h),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 iM{constructor(c,h){this.context=c,this.texture=h}bind(c,h){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),h!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,h),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,h),this.wrapS=h)}}const eVe=Es([{name:"a_pos_3f",components:3,type:"Float32"}]),tVe=Es([{name:"a_color_3f",components:3,type:"Float32"}]),rVe=Es([{name:"a_color_4f",components:4,type:"Float32"}]),nVe=Es([{name:"a_uv_2f",components:2,type:"Float32"}]),sVe=Es([{name:"a_normal_3f",components:3,type:"Float32"}]),aVe=Es([{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"}]),iVe=Es([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Ive(f,c){const h=w6(f.projection,f.zoom,f.width,f.height),g=function(k,C,L,F,$){const G=new m(L.lng-180*y0,L.lat),Z=new m(L.lng+180*y0,L.lat),X=k.project(G.lng,G.lat),re=k.project(Z.lng,Z.lat),ne=-Math.atan2(re.y-X.y,re.x-X.x),me=He.fromLngLat(L);me.y=ge(me.y,-1+y0,1-y0);const ke=me.toLngLat(),je=k.project(ke.lng,ke.lat),Fe=He.fromLngLat(ke);Fe.x+=y0;const $e=Fe.toLngLat(),Xe=k.project($e.lng,$e.lat),mt=Lve(Xe.x-je.x,Xe.y-je.y,ne),ct=He.fromLngLat(ke);ct.y+=y0;const _t=ct.toLngLat(),Ct=k.project(_t.lng,_t.lat),Et=Lve(Ct.x-je.x,Ct.y-je.y,ne),Yt=Math.abs(mt.x)/Math.abs(Et.y),Rt=M([]);V(Rt,Rt,-ne*(1-($?0:F)));const rr=M([]);return z(rr,rr,[1,1-(1-Yt)*F,1]),rr[4]=-Et.x/Et.y*F,V(rr,rr,ne),A(rr,Rt,rr),rr}(f.projection,0,f.center,h,c),v=Pve(f);return z(g,g,[v,v,1]),g}function Pve(f){const c=f.projection,h=w6(f.projection,f.zoom,f.width,f.height),g=foe(c,f.center),v=foe(c,m.convert(c.center));return Math.pow(2,g*h+(1-h)*v)}function w6(f,c,h,g,v=1/0){const k=f.range;if(!k)return 0;const C=Math.min(v,Math.max(h,g)),L=Math.log2(C/1024);return Ae(k[0]+L,k[1]+L,c)}const y0=1/4e4;function foe(f,c){const h=ge(c.lat,-ue,ue),g=new m(c.lng-180*y0,h),v=new m(c.lng+180*y0,h),k=f.project(g.lng,h),C=f.project(v.lng,h),L=He.fromLngLat(g),F=He.fromLngLat(v),$=C.x-k.x,G=C.y-k.y,Z=F.x-L.x,X=F.y-L.y,re=Math.sqrt((Z*Z+X*X)/($*$+G*G));return Math.log2(re)}function Lve(f,c,h){const g=Math.cos(h),v=Math.sin(h);return{x:f*g-c*v,y:f*v+c*g}}function Ove(f,c,h){M(f),V(f,f,is(c[2])),R(f,f,is(c[0])),U(f,f,is(c[1])),z(f,f,h),A(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function j6(f,c,h,g,v,k,C,L){const F=[h[0]-c[0],h[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(pe(F)<1e-12||pe($)<1e-12)return Mt(f);const G=ht([],F,$);Be(G,G),ye($,g,c),F[2]=(k-v)*L,$[2]=(C-v)*L;const Z=F;return ht(Z,F,$),Be(Z,Z),Pn(f,G,Z)}function k6(f,c,h=!1){const g=g0(c.zoom),v=function(k,C,L){const F=C.worldSize,$=[k[12],k[13],k[14]],G=de($[1]/F),Z=ee($[0]/F),X=M([]),re=Y(1,G)*F,ne=Y(1,0)*F*ve(G,C.zoom),me=1/Uie(F);let ke=ne*me;if(L){const Xe=w6(C.projection,C.zoom,C.width,C.height,1024);ke=me*C.projection.pixelSpaceConversion(C.center.lat,F,Xe)}const je=f0(G,Z);he(je,je,be([],Be([],je),re*ke*$[2]));const Fe=function(Xe){const mt=[Xe[0],Xe[1],Xe[2]];let ct=[0,1,0];const _t=ht([],ct,mt);return ht(ct,mt,_t),Ue(ct)===0&&(ct=[0,1,0],ht(_t,mt,ct)),Be(_t,_t),Be(ct,ct),Be(mt,mt),[_t[0],_t[1],_t[2],0,ct[0],ct[1],ct[2],0,mt[0],mt[1],mt[2],0,Xe[0],Xe[1],Xe[2],1]}(je);z(X,X,[ke,ke,ke*re]),P(X,X,[-$[0],-$[1],-$[2]]);const $e=A([],C.globeMatrix,Fe);return A($e,$e,X),A($e,$e,k),$e}(f,c,h);if(g>0){const k=function(C,L){const F=L.worldSize,$=Y(1,0)*F*ve(L.center.lat,L.zoom)/Uie(F),G=Y(1,L.center.lat)*F,Z=M([]);U(Z,Z,is(L.center.lng)),R(Z,Z,is(L.center.lat)),P(Z,Z,[0,0,Sc]),z(Z,Z,[$,$,$*G]);const X=L.point;return P(Z,Z,[-X.x,-X.y,0]),A(Z,Z,C),A(Z,L.globeMatrix,Z)}(f,c);return function(C,L,F){const $=(ne,me,ke)=>{const je=pe(ne),Fe=pe(me),$e=Fp(ne,me,ke);return be($e,$e,1/pe($e)*Fn(je,Fe,ke))},G=$([C[0],C[1],C[2]],[L[0],L[1],L[2]],F),Z=$([C[4],C[5],C[6]],[L[4],L[5],L[6]],F),X=$([C[8],C[9],C[10]],[L[8],L[9],L[10]],F),re=Fp([C[12],C[13],C[14]],[L[12],L[13],L[14]],F);return[G[0],G[1],G[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 poe(f,c,h,g){const v=dn.projectAabbCorners(g,h);let k=Number.MAX_VALUE;for(let L=0;L0||ke===0&&ne[0]*me[0]+ne[1]*me[1]>=0&&ne[0]*ne[0]+ne[1]*ne[1]>me[0]*me[0]+me[1]*me[1])&&(G=re)}Z=G}while(Z!==$);return F.length>0&&F.push(F[0]),F}(v);if(ia(f,C))return k}const l_=64,VN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function N6(f,c,h,g,v,k,C,L,F,$=!1){const G=h.zoom,Z=h.project(g),X=ve(g.lat,G),re=1/X;M(f),P(f,f,[Z.x+C[0]*re,Z.y+C[1]*re,C[2]]);let ne=1,me=1;const ke=h.worldSize;if($){if(h.projection.name==="mercator"){let Xe=0;h.elevation&&(Xe=h.elevation.getAtPointOrZero(new He(Z.x/ke,Z.y/ke),0));const mt=pt([],[Z.x,Z.y,Xe,1],h.projMatrix)[3]/h.cameraToCenterDistance;ne=mt,me=mt*ve(h.center.lat,G)}else if(h.projection.name==="globe"){const Xe=k6(f,h),mt=[0,0,0,1];pt(mt,mt,A([],h.projMatrix,Xe));const ct=mt[3]/h.cameraToCenterDistance,_t=g0(G),Ct=h.projection.pixelsPerMeter(g.lat,ke)*ve(g.lat,G),Et=h.projection.pixelsPerMeter(h.center.lat,ke)*ve(h.center.lat,G);ne=ct/Fn(Ct,we(h.center.lat),_t),me=ct*X/Ct,ne*=Et,me*=Et}}else ne=re;z(f,f,[ne,ne,me]);const je=[...f],Fe=c.orientation,$e=[];if(Ove($e,[Fe[0]+(v?v[0]:0),Fe[1]+(v?v[1]:0),Fe[2]+(v?v[2]:0)],k),A(f,je,$e),L&&h.elevation){let Xe=0;const mt=[];if(F&&h.elevation){Xe=function(_t,Ct,Et,Yt,Rt){const rr=Ct.elevation;if(!rr)return 0;const lr=dn.projectAabbCorners(Et,Yt),cr=Y(1,Rt.lat)*Ct.worldSize,xr=function(Kr,nn){const xs=[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 sn of jr){const Vn=Kr[sn.corners[0]],zs=Kr[sn.corners[1]],Hs=Kr[sn.corners[2]],as=[zs[0]-Vn[0],zs[1]-Vn[1],nn*(zs[2]-Vn[2])],Ua=ht(as,as,[Hs[0]-Vn[0],Hs[1]-Vn[1],nn*(Hs[2]-Vn[2])]);Be(Ua,Ua),sn.dotProductWithUp=Ye(Ua,xs)}return jr.sort((sn,Vn)=>sn.dotProductWithUp-Vn.dotProductWithUp),jr[0].corners}(lr,cr),vr=lr[xr[0]],ur=lr[xr[1]],pr=lr[xr[2]],tr=lr[xr[3]],Qt=rr.getAtPointOrZero(new He(vr[0]/Ct.worldSize,vr[1]/Ct.worldSize),0),mr=rr.getAtPointOrZero(new He(ur[0]/Ct.worldSize,ur[1]/Ct.worldSize),0),Tr=rr.getAtPointOrZero(new He(pr[0]/Ct.worldSize,pr[1]/Ct.worldSize),0),wr=rr.getAtPointOrZero(new He(tr[0]/Ct.worldSize,tr[1]/Ct.worldSize),0),hn=(Qt+wr)/2,Ur=(mr+Tr)/2;return hn>Ur?mr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function oVe(f,c,h){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,eVe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,sVe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,nVe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?tVe:rVe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,iVe.members,!0)),f.segments=Di.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&oM(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&oM(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&oM(g.normalTexture,c),g.occlusionTexture&&oM(g.occlusionTexture,c,h),g.emissionTexture&&oM(g.emissionTexture,c)}function moe(f,c,h){if(f.meshes)for(const g of f.meshes)oVe(g,c,h);if(f.children)for(const g of f.children)moe(g,c,h)}function S6(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)S6(c)}function goe(f){if(f.meshes)for(const h of f.meshes)h.vertexBuffer&&(h.vertexBuffer.destroy(),h.indexBuffer.destroy(),h.normalBuffer&&h.normalBuffer.destroy(),h.texcoordBuffer&&h.texcoordBuffer.destroy(),h.colorBuffer&&h.colorBuffer.destroy(),h.pbrBuffer&&h.pbrBuffer.destroy(),h.segments.destroy(),h.material&&((c=h.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 h of f.children)goe(h)}function c_(f,c){const h=f.json.bufferViews[c.bufferView],g=_6[c.componentType];return new g(f.buffers[h.buffer],(c.byteOffset||0)+(h.byteOffset||0),c.count*(h.byteStride&&h.byteStride!==aM[c.type]*g.BYTES_PER_ELEMENT?h.byteStride/g.BYTES_PER_ELEMENT:aM[c.type]))}function xoe(f,c,h,g){const v=_6[c.componentType],k=function(G){switch(G){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(v),C=f.json.bufferViews[c.bufferView],L=C.byteStride?C.byteStride/v.BYTES_PER_ELEMENT:aM[c.type],F=h.float32,$=F.length/h.capacity;for(let G=0,Z=0;G0){for(let ke=0;ke0){k.texcoordArray=new Ef;const X=c.json.accessors[v.TEXCOORD_0];k.texcoordArray.resize(X.count);const re=c_(c,X);xoe(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=c_(c,X))}v._FEATURE_RGBA4444!==void 0&&(k.featureData=new Uint32Array(c_(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:me="OPAQUE",alphaCutoff:ke=.5,normalTexture:je,occlusionTexture:Fe,emissiveTexture:$e,doubleSided:Xe,name:mt}=X,{baseColorFactor:ct=[1,1,1,1],metallicFactor:_t=1,roughnessFactor:Ct=1,baseColorTexture:Et,metallicRoughnessTexture:Yt}=X.pbrMetallicRoughness||{},Rt=Fe?re[Fe.index]:void 0;if(Fe&&Fe.extensions&&Fe.extensions.KHR_texture_transform&&Rt){const rr=Fe.extensions.KHR_texture_transform;Rt.offsetScale=[rr.offset[0],rr.offset[1],rr.scale[0],rr.scale[1]]}return{name:mt,pbrMetallicRoughness:{baseColorFactor:new Ta(...ct),metallicFactor:_t,roughnessFactor:Ct,baseColorTexture:Et?re[Et.index]:void 0,metallicRoughnessTexture:Yt?re[Yt.index]:void 0},doubleSided:Xe,emissiveFactor:new Ta(...ne),alphaMode:me,alphaCutoff:ke,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},h),k}function Rve(f,c,h){const{matrix:g,rotation:v,translation:k,scale:C,mesh:L,extras:F,children:$,name:G}=f,Z={};if(Z.name=G,Z.localMatrix=g||function(X,re,ne,me){var ke=re[0],je=re[1],Fe=re[2],$e=re[3],Xe=ke+ke,mt=je+je,ct=Fe+Fe,_t=ke*Xe,Ct=ke*mt,Et=ke*ct,Yt=je*mt,Rt=je*ct,rr=Fe*ct,lr=$e*Xe,cr=$e*mt,xr=$e*ct,vr=me[0],ur=me[1],pr=me[2];return X[0]=(1-(Yt+rr))*vr,X[1]=(Ct+xr)*vr,X[2]=(Et-cr)*vr,X[3]=0,X[4]=(Ct-xr)*ur,X[5]=(1-(_t+rr))*ur,X[6]=(Rt+lr)*ur,X[7]=0,X[8]=(Et+cr)*pr,X[9]=(Rt-lr)*pr,X[10]=(1-(_t+Yt))*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],C||[1,1,1]),Z.globalMatrix=N(Z.localMatrix),L!==void 0){Z.meshes=h[L];const X=Z.anchor=[0,0];for(const re of Z.meshes){const{min:ne,max:me}=re.aabb;X[0]+=ne[0]+me[0],X[1]+=ne[1]+me[1]}X[0]=Math.floor(X[0]/Z.meshes.length/2),X[1]=Math.floor(X[1]/Z.meshes.length/2)}if(F&&(F.id&&(Z.id=F.id),F.lights&&(Z.lights=function(X){if(!X.length)return[];const re=function(Fe){const $e=atob(Fe),Xe=new Uint8Array($e.length);for(let mt=0;mt<$e.length;mt++)Xe[mt]=$e.codePointAt(mt);return Xe}(X),ne=[],me=re.length/24,ke=new Uint16Array(re.buffer),je=new Float32Array(re.buffer);for(let Fe=0;Fe1&&g[g.length-1].equals(g[0])&&g.pop();let v=0;for(let C=0;C0&&g.reverse();const k=FN(g.flatMap(C=>[C.x,C.y]),[]);return k.length===0?null:{vertices:g,indices:k}}function uVe(f,c){const h=[],g=[];let v=0;const k=[];for(const C of f){v=h.length;const L=C.vertexArray.float32,F=C.indexArray.uint16;for(let $=0;$0&&([g[C+1],g[C+2]]=[g[C+2],g[C+1]])}return{vertices:h,indices:g}}function yoe(f){const c=function(F,$){const G=[],Z=WebGL2RenderingContext;if(F.json.textures)for(const X of F.json.textures){const re={magFilter:Z.LINEAR,minFilter:Z.NEAREST,wrapS:Z.REPEAT,wrapT:Z.REPEAT};X.sampler!==void 0&&Object.assign(re,F.json.samplers[X.sampler]),G.push({image:$[X.source],sampler:re,uploaded:!1})}return G}(f,f.images),h=function(F,$){const G=[];for(const Z of F.json.meshes){const X=[];for(const re of Z.primitives)X.push(lVe(re,F,$));G.push(X)}return G}(f,c),{scenes:g,scene:v,nodes:k}=f.json,C=g?g[v||0].nodes:[...k.keys()],L=[];for(const F of C)L.push(Rve(k[F],f,h));return function(F,$,G){const Z={},X=new Set;for(let re=0;re0){const re=Array.from(X.values()).sort((ne,me)=>ne-me);for(let ne=re.length-1;ne>=0;ne--)F.splice(re[ne],1)}}(L,C,f.json.nodes),L}function hVe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,h=f.aabb.min[0]-1,g=f.aabb.min[1]-1,v=l_/(f.aabb.max[0]-h+2),k=l_/(f.aabb.max[1]-g+2);for(let C=0;Cf.heightmap[$*l_+F]&&(f.heightmap[$*l_+F]=L)}}function Fve(f,c,h,g,v){h.reserve(h.length+4*f.length),g.reserve(g.length+10*f.length),v.reserve(v.length+10*f.length);let k=g.length;for(const C of f){const L=Math.min(10,Math.max(4,1.3*C.height))*c,F=[-C.normal[1],C.normal[0],0],$=Math.min(.29,.1*C.width/C.depth),G=C.width-2*C.depth*c*($+.01),Z=rt([],C.pos,F,G/2),X=rt([],C.pos,F,-G/2),re=[Z[0],Z[1],Z[2]+C.height],ne=[X[0],X[1],X[2]+C.height],me=rt([],C.normal,F,$);be(me,me,L);const ke=rt([],C.normal,F,-$);be(ke,ke,L),he(me,Z,me),he(ke,X,ke),Z[2]+=.1,X[2]+=.1,g.emplaceBack(me[0],me[1],me[2]),g.emplaceBack(ke[0],ke[1],ke[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(me[0],me[1],me[2]),g.emplaceBack(ke[0],ke[1],ke[2]);const je=G/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),h.emplaceBack(6+k,4+k,8+k),h.emplaceBack(7+k,9+k,5+k),h.emplaceBack(0+k,1+k,2+k),h.emplaceBack(1+k,3+k,2+k),k+=10}}function fVe(f,c){const h={};h.indexArray=new Ho,h.vertexArray=new Tu,h.colorArray=new Ym,Fve(f,c,h.indexArray,h.vertexArray,h.colorArray);const g={defined:!0};g.emissiveFactor=Ta.black;const v={};return v.baseColorFactor=Ta.white,g.pbrMetallicRoughness=v,h.material=g,h.aabb=new dn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),h}const zve=Es([{name:"a_pos_3f",components:3,type:"Float32"}]),pVe=Es([{name:"a_normal_3",components:3,type:"Int16"}]),mVe=Es([{name:"a_centroid_3",components:3,type:"Int16"}]),Bve=Es([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),gVe=Es([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),xVe=Es([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),yVe=Es([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),vVe=Es([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),_Ve=Es([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),$ve=Ot.types,C6=32767;function bVe(f,c){const h=Cr+c;for(const g of f)for(const v of g)if(v.x<-c||v.x>h||v.y<-c||v.y>h)return!1;return!0}function wVe(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 voe{constructor(){this.layoutVertexArray=new Tu,this.layoutAttenuationArray=new Ym,this.layoutColorArray=new Au,this.indexArray=new Ho,this.indexArrayForConflation=new Ho,this.segmentsBucket=new Di}}class _oe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Di,this.entranceBloom=new voe;const h=66560;this.layoutVertexArray=new Tu,this.layoutVertexArray.reserve(h),this.layoutNormalArray=new o0,this.layoutNormalArray.reserve(h),this.layoutCentroidArray=new o0,this.layoutCentroidArray.reserve(h),this.layoutColorArray=new Au,this.layoutColorArray.reserve(h),this.layoutFloodLightDataArray=new Xm,this.layoutFloodLightDataArray.reserve(h),this.layoutAOArray=new SN,this.layoutAOArray.reserve(h),this.indexArray=new Ho,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ho,this.segmentsBucket=new Di,this.entranceBloom=new voe,c&&(this.layoutFacadePaintArray=new Au,this.layoutFacadeDataArray=new px,this.layoutFacadeVerticalRangeArray=new Au)}reserve(c,h,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(h),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 Ef,this.footprintsIndices=new Xm,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new _oe(!1),this.buildingWithFacade=new _oe(!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(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Uh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.projection=c.projection,this.groundEffect=new roe(c),this.groundEffect.groundRadiusArray=new Ep,this.hasAppearances=null}updateFootprints(c,h){const g=new h6([],[],1),v={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};h.push({footprint:v,id:c})}updateAppearances(c,h,g,v){}prepare(){return function(){if(v6!=null||wve!=null)return null;if(qN!=null)return qN;const c=fetch(Ms.BUILDING_GEN_URL);return qN=function(h){let g,v,k,C,L;function F(){g=new Uint8Array(L.buffer),v=new Int16Array(L.buffer),k=new Int32Array(L.buffer),C=new Float32Array(L.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const G=()=>{},Z={a:{a:$,f:function(X){const re=g.length,ne=Math.max(X>>>0,Math.ceil(1.2*re)),me=Math.ceil((ne-re)/65536);try{return L.grow(me),F(),!0}catch{return!1}},g:$,b:G,c:G,d:G,e:G}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(h,Z):h.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,Z))).then(X=>{const re=X.instance.exports;return(0,re.g)(),L=re.f,F(),new Gqe({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:C})})}(c).then(h=>(qN=null,v6=h,v6)).catch(h=>{Vr("Could not load building-gen"),qN=null,wve=h}),qN}()}populate(c,h,g,v){const k=Kqe();if(!k)return;const C=Ie(g);this.tileToMeter=C,this.brightness=h.brightness,k.setStyle({normalScale:[1,-1,C],tileToMeters:C}),k.setAOOptions(!1,.3),k.setMetricOptions(!1,16),k.setStructuralOptions(!0),k.setFacadeClassifierOptions(3);const L=new Map,F=new Map;let $=0;for(const{feature:je}of c){if($ve[je.type]!=="LineString"){L.set(je.id,je.properties.source_id);continue}const Fe=this.layers[0]._featureFilter.needGeometry;if(Fe&&!this.layers[0]._featureFilter.filter(new si(this.zoom),je,g))continue;const $e=Dt(je,Fe);if(!Fe&&!this.layers[0]._featureFilter.filter(new si(this.zoom),$e,g))continue;const Xe=Fe?$e.geometry:St(je,g,v),mt=[];for(const Et of Xe)for(const Yt of Et)mt.push(Yt.x),mt.push(Yt.y);const ct={coordinates:mt,crossPerc:je.properties.cross_perc,distanceToRoad:je.properties.distance_to_road,entrances:je.properties.entrances,sourceId:0},_t=je.properties.source_id;let Ct=F.get(_t);Ct||(Ct=[],F.set(_t,Ct)),Ct.push(ct),++$}this.maxHeight=0;const G=new Array,Z=new Set,X=je=>{je!=null&&Z.add(je)},re=(je,Fe)=>{je!=null&&G.push({buildingId:je,footprintIndex:Fe})},ne=64*(c.length-$),me=ne/2;this.buildingWithFacade.reserve(ne,me,!0),this.buildingWithoutFacade.reserve(2*ne,2*me,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:je,id:Fe,index:$e,sourceLayerIndex:Xe}of c){if($ve[je.type]==="LineString")continue;const mt=this.layers[0]._featureFilter.needGeometry;if(mt&&!this.layers[0]._featureFilter.filter(new si(this.zoom),je,g))continue;let ct=null;if(je.properties&&je.properties.hasOwnProperty("building_id")&&(ct=je.properties.building_id,Z.has(ct)))continue;const _t=Dt(je,mt);if(!mt&&!this.layers[0]._featureFilter.filter(new si(this.zoom),_t,g))continue;const Ct=mt?_t.geometry:St(je,g,v),Et=Y5(Ct,500);let Yt=!1;for(const In of Et)if(In.length!==1){Yt=!0;break}if(Yt){X(ct);continue}if(!bVe(Ct,163)){X(ct);continue}const Rt=this.layers[0],rr=wVe(Rt.layout.get("building-roof-shape").evaluate(je,{},g)),lr=Rt.layout.get("building-base").evaluate(je,{},g),cr=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 Qt=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 Tr=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 hn=Rt.paint.get("building-color").evaluate(je,{},this.canonical).toPremultipliedRenderColor(this.lut),Ur=Rt.paint.get("building-emissive-strength").evaluate(je,{},this.canonical);let Kr=Rt.layout.get("building-flood-light-wall-radius").evaluate(je,{},g);Kr=ge(Kr,0,2048);const nn=Kr/2048*C6,xs=L.get(Fe),jr=F.get(xs)||[],sn=jr.length!==0&&Rt.layout.get("building-facade").evaluate(je,{},g);k.setFacadeOptions(4,!0),k.setFauxFacadeOptions(sn,!1,1);let Vn=0,zs=0,Hs=0,as=0,Ua=0,dt=0,xt=0,nr=0,yr=0,Rr=0,Fr=0;if(sn){let In=Math.round(Rt.layout.get("building-facade-floors").evaluate(je,{},g));if(lr===0){In=Math.max(1,In-(jr.length>0?1:0));let Ia=4;if(cr>100){const vi=[10,13,15];Ia=vi[je.id?je.id%vi.length:0]}else cr<=10&&(Ia=3);k.setFacadeOptions(Ia,!0),Ua=(cr<15?1.3:1.61803)*Ia/C}else Ua=lr/C;dt=cr/C,Ua=Math.min(Ua,dt),Hs=Rt.layout.get("building-facade-unit-width").evaluate(je,{},g)/C,as=(dt-Ua)/In,k.setFauxFacadeOptions(!0,!0,Hs);const zi=Rt.layout.get("building-facade-window").evaluate(je,{},g);Vn=zi[0],zs=zi[1],xt=Math.floor(65535*Math.min(1,Ua/Cr)),nr=Math.floor(65535*Math.min(1,dt/Cr)),yr=Math.floor(255*Vn)<<8|Math.floor(255*zs),Rr=Math.floor(65535*Math.min(1,Hs/Cr)),Fr=Math.floor(65535*Math.min(1,as/Cr))}const gn=Array(Et.length),bn={x:1/0,y:1/0},es={x:-1/0,y:-1/0},us={x:0,y:0};let ms=0;for(let In=0;In0){const Ia=[],vi=Array(zi.length+1);vi[0]=0;for(let Ko=0;KoCr||bn.y<0||es.y>Cr)&&this.featuresOnBorder.push({featureId:je.id,footprintIndex:this.footprints.length});{const In=FN(Ha,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+In.length),this.footprintsIndices.uint16.set(In,En),this.buildingIds.add(ct??je.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Ja.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Ja.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ai.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ai.y);const zi={footprintVertexOffset:Ps,footprintVertexLength:this.footprintsVertices.length-Ps,footprintIndexOffset:En,footprintIndexLength:this.footprintsIndices.length-En,min:Ja,max:ai,hiddenFlags:0,indicesOffset:wa,indicesLength:Ti,bloomIndicesOffset:Ea,bloomIndicesLength:Za,groundEffectVertexOffset:co,groundEffectVertexLength:ei,hasFauxFacade:sn,height:hs,promoteId:Fe,feature:_t,parts:la,buildingBloom:ca},Ia=this.footprints.length;je.id!==void 0&&this.featureFootprintLookup.set(je.id,Ia),re(ct,Ia),this.footprints.push(zi)}this.programConfigurations.populatePaintArrays(Ln.layoutVertexArray.length,je,$e,{},h.availableImages,g,h.brightness),this.groundEffect.addPaintPropertiesData(je,$e,{},h.availableImages,g,h.brightness),h.featureIndex.insert(je,Ct,$e,Xe,this.index,qa)}G.forEach(({buildingId:je,footprintIndex:Fe})=>{Z.has(je)&&(this.footprints[Fe].hiddenFlags|=4)});const ke=new Set;this.buildingIds.forEach((je,Fe,$e)=>{Z.has(je)||ke.add(je)}),this.buildingIds=ke,this.groundEffect.prepareBorderSegments()}update(c,h,g,v,k,C,L){this.programConfigurations.updatePaintArrays(c,h,k,g,v,C,L),this.groundEffect.update(c,h,k,g,v,C,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 h=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,zve.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,pVe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,mVe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,_Ve.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,xVe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,yVe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,zve.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,vVe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=h=>{h.layoutVertexBuffer&&(h.layoutVertexBuffer.destroy(),h.layoutNormalBuffer.destroy(),h.layoutColorBuffer.destroy(),h.segmentsBucket.destroy(),h.indexBuffer&&h.indexBuffer.destroy(),h.entranceBloom.layoutVertexBuffer&&(h.entranceBloom.layoutVertexBuffer.destroy(),h.entranceBloom.layoutColorBuffer.destroy(),h.entranceBloom.layoutAttenuationBuffer.destroy(),h.entranceBloom.indexBuffer.destroy(),h.entranceBloom.segmentsBucket.destroy()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,h,g=!0){let v=!1;const k=g?h:0,C=0|(g?-1:~h);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const L of c){const F=this.footprints[L],$=F.hiddenFlags&C|k;F.hiddenFlags!==$&&(F.hiddenFlags=$,v=!0,this.groundEffect.updateHiddenByLandmarkRange(F.groundEffectVertexOffset,F.groundEffectVertexLength,F.hiddenFlags!==0))}return v&&(this.indexArrayForConflationUploaded=!1),v}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const h=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))};h(this.buildingWithoutFacade),h(this.buildingWithFacade);for(const v of this.footprints){const k=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,C=v.indicesOffset+v.indicesLength;if(v.hiddenFlags!==0){for(let F=v.indicesOffset;F{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 h=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,Bve.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,gVe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,Bve.members,!0)};h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,h){const g=c.paint.get("building-ambient-occlusion-intensity");for(const v of this.footprints){if(4&v.hiddenFlags)continue;const k=h[v.promoteId],C=v.feature;C.properties["building-part"]="roof";const L=c.paint.get("building-color").evaluate(C,k,this.canonical).toPremultipliedRenderColor(this.lut),F=c.paint.get("building-emissive-strength").evaluate(C,k,this.canonical);C.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(C,k,this.canonical).toPremultipliedRenderColor(this.lut),G=c.paint.get("building-emissive-strength").evaluate(C,k,this.canonical);C.properties["building-part"]="window";const Z=c.paint.get("building-color").evaluate(C,k,this.canonical).toPremultipliedRenderColor(this.lut),X=c.paint.get("building-emissive-strength").evaluate(C,k,this.canonical);C.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(C,k,this.canonical).toPremultipliedRenderColor(this.lut),ne=c.paint.get("building-emissive-strength").evaluate(C,k,this.canonical),me=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const je of v.parts){let Fe,$e=L;je.part===1?($e=L,Fe=F):je.part===0?($e=$,Fe=G):je.part===2?($e=Z,Fe=X):je.part===3&&($e=re,Fe=ne),Fe=ge(Fe,0,1);for(let Xe=0;XeC.max.x||F.max.xC.max.y||F.max.yL.max.x||L.min.x>c||h>L.max.y||L.min.y>h||L.height<=g||jVe(C,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 jVe(f,c,h){for(let g=0;g1&&(F=c[++L]);const G=Math.abs($-F.left),Z=Math.abs($-F.right),X=Math.min(G,Z);let re;const ne=k/g*(v+1);if(F.isDash){const me=v-Math.abs(ne);re=Math.sqrt(X*X+me*me)}else re=v-Math.sqrt(X*X+ne*ne);this.image.data[C+$]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,h){for(let F=c.length-1;F>=0;--F){const $=c[F],G=c[F+1];$.zeroLength?c.splice(F,1):G&&G.isDash===$.isDash&&(G.left=$.left,c.splice(F,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 C=0,L=c[C];for(let F=0;F1&&(L=c[++C]);const $=Math.abs(F-L.left),G=Math.abs(F-L.right),Z=Math.min($,G);this.image.data[k+F]=Math.max(0,Math.min(255,(L.isDash?Z:-Z)+h+128))}}addDash(c,h){const g=this.getKey(c,h);if(this.positions[g])return this.positions[g];const v=h==="round",k=v?7:0,C=2*k+1;if(this.nextRow+C>this.height)return Vr("LineAtlas out of space"),null;c.length===0&&c.push(1);let L=0;for(let G=0;Gh.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new vN,this.layoutVertexArray2=new Tu,this.patternVertexArray=new Tu,this.indexArray=new Ho,this.programConfigurations=new Uh(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Di,this.maxLineLength=0,this.zOffsetVertexArray=new Tu,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Cr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.hasPattern=Gie("line",this.layers,this.pixelRatio,h);const k=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Ie(g);const C=this.layers[0].layout.get("line-elevation-reference");if(C==="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=C!=="sea"&&C!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&C==="none"&&Vr(`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 F=[];for(const{feature:X,id:re,index:ne,sourceLayerIndex:me}of c){const ke=this.layers[0]._featureFilter.needGeometry,je=Dt(X,ke);if(!this.layers[0]._featureFilter.filter(new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),je,g))continue;const Fe=k?k.evaluate(je,{},g):void 0,$e={id:re,properties:X.properties,type:X.type,sourceLayerIndex:me,index:ne,geometry:ke?je.geometry:St(X,g,v),patterns:{},sortKey:Fe};F.push($e)}k&&F.sort((X,re)=>X.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:G}=h,Z=this.addConstantDashes($);for(const X of F){const{geometry:re,index:ne,sourceLayerIndex:me}=X;if(Z&&this.addFeatureDashes(X,$),this.hasPattern){const ke=Kie("line",this.layers,X,this.zoom,this.pixelRatio,h);this.patternFeatures.push(ke)}else this.addFeature(X,re,ne,g,$.positions,h.availableImages,h.brightness,h.elevationFeatures);G.insert(c[ne].feature,re,ne,me,this.index)}}addConstantDashes(c){let h=!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")h=!0;else{const C=k.value,L=v.value;if(!L)continue;c.addDash(L,C)}}return h}addFeatureDashes(c,h){const g=this.zoom;for(const v of this.layers){const k=v.paint.get("line-dasharray").value,C=v.layout.get("line-cap").value;if(k.kind==="constant"&&C.kind==="constant")continue;let L,F;if(k.kind==="constant"){if(L=k.value,!L)continue}else L=k.evaluate({zoom:g},c);F=C.kind==="constant"?C.value:C.evaluate({zoom:g},c),h.addDash(L,F),c.patterns[v.id]=[h.getKey(L,F)]}}update(c,h,g,v,k,C,L,F){this.programConfigurations.updatePaintArrays(c,h,k,g,v,C,L,F)}addFeatures(c,h,g,v,k,C){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,g,v,C,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,TVe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,EVe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,SVe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,CVe),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,h){let g,v;if(h&&h>0?(g=`mapbox_clip_start_${h}`,v=`mapbox_clip_end_${h}`):(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,h,g,v,k,C,L,F){const $=this.layers[0].layout,G=$.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 me=this.layers[0].paint.get("line-width").value;if(me.kind!=="constant"&&me.isLineProgressConstant===!1&&(this.variableWidthValue=me),this.elevationType==="road"){const ke=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,h,v,F,G,Z,X,re)){const[je,Fe]=this.clipRuntimeLinesToTile(h,1);for(let $e=0;$e0?mt.parentIndex:null)}this.fillNonElevatedRoadSegment(ke)}}else for(let ke=0;ke0?ke:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,k,C,v,L,void 0,this.worldview)}computeSegNextDir(c,h){return c.nextPoint.sub(h.at(-2)).unit()}computeSegPrevDir(c,h){return h[1].sub(c.prevPoint).unit()}clipLinesToTile(c,h){return x6(c,-h,-h,Cr+h,Cr+h)}clipRuntimeLinesToTile(c,h){const g=[];return[x6(c,-h,-h,Cr+h,Cr+h,g),g]}addElevatedRoadFeature(c,h,g,v,k,C,L,F){const $=[],G=_a.getElevationFeature(c,v);if(G){const Z=this.clipLinesToTile(h,1),X=this.prepareElevatedLines(Z,G,g);for(const re of X)$.push({geometry:re,elevation:G,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,C,L,F);const re=new za(g,Z.elevationTileID);if(Z.elevation)for(let ne=X;ne>1,this.layoutVertexArray.int16[6*ne+1]>>1),ke=re.pointElevation(me,Z.elevation,.05);this.updateHeightRange(ke),this.zOffsetVertexArray.emplaceBack(ke,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(c,h,g){if(h.constantHeight!=null)return c;const v=[],k=1/Ie(g);for(const C of c)Vqe(C,new oa(h,k),0,v);return v}fillNonElevatedRoadSegment(c){for(let h=c;h0,X=F&&F.progress.max<1;if(this.lineClips){let Et={min:this.lineClips.start,max:this.lineClips.end},Yt=1;if(F){const lr=this.lineClips.end-this.lineClips.start;Et=function(cr,xr,vr){return{min:$a(cr.min,xr,vr),max:$a(cr.max,xr,vr)}}(F.progress,{min:0,max:1},Et),lr>0&&(Yt=(Et.max-Et.min)/lr)}const Rt=+h.properties.mapbox_clip_feature_len,rr=+h.properties.mapbox_clip_seg_len;if(Number.isNaN(Rt)||Number.isNaN(rr)){for(let cr=0;cr=2&&c[ne-1].equals(c[ne-2]);)ne--;let me=0;for(;me0,tr=this.overscaling<=16?15*Cr/(512*this.overscaling):0;if(Yt&&Rt==="round"){if(xrC&&(Rt="bevel"),Rt==="bevel"&&(xr>2&&(Rt="flipbevel"),xr2*tr){const Tr=je.sub(je.sub(Fe)._mult(tr/Qt)._round());this.updateDistance(Fe,Tr),this.addCurrentVertex(Tr,Xe,0,0,ke,Ct),Fe=Tr}this.updateDistance(Fe,je),lr._mult(xr),this.addCurrentVertex(je,lr,0,0,ke,Ct);const mr=je.dist($e);if(mr>2*tr){const Tr=je.add($e.sub(je)._mult(tr/mr)._round());this.updateDistance(je,Tr),this.addCurrentVertex(Tr,mt,0,0,ke,Ct),je=Tr}}else lr._mult(xr),this.addCurrentVertex(je,lr,0,0,ke,Ct);else if(Rt==="flipbevel"){if(xr>100)lr=mt.mult(-1);else{const Qt=xr*Xe.add(mt).mag()/Xe.sub(mt).mag();lr._perp()._mult(Qt*(pr?-1:1))}this.addCurrentVertex(je,lr,0,0,ke,Ct),this.addCurrentVertex(je,lr.mult(-1),0,0,ke,Ct)}else if(Rt==="bevel"||Rt==="fakeround"){Ct!=null&&Fe&&this.addCurrentVertex(je,_t||Xe,-1,-1,ke,Ct);const Qt=je.dist(Fe)<=2*tr&&Rt!=="bevel",mr=lr.mult(pr?1:-1);mr._mult(xr);const Tr=mt.mult(pr?-1:1),wr=Xe.mult(pr?-1:1),hn=this.evaluateLineProgressFeatures(this.distance);if(Ct==null&&(this.addHalfVertex(je,mr.x,mr.y,!1,!pr,0,ke,hn),Qt||this.addHalfVertex(je,mr.x+2*wr.x,mr.y+2*wr.y,!1,pr,0,ke,hn)),Rt==="fakeround"){const Ur=Math.round(180*vr/Math.PI/20);this.addHalfVertex(je,wr.x,wr.y,!1,pr,0,ke,hn);for(let Kr=0;Kr1){this.lineSoFar=c.w;const me=(h.x-c.x)/Z,ke=(h.y-c.y)/Z,je=(h.z-c.z)/Z,Fe=(h.w-c.w)/Z;for(let $e=1;$e=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,G),F.primitiveLength++),C?this.e2=G:this.e1=G,$!=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,h){this.prevDistance=this.distance,this.distance+=c.dist(h),this.updateScaledDistance()}}function woe(f,c,h){return f.xh||f.yh}let Wve,Gve;function Kve(f,c,h){return c*(Cr/(f.tileSize*Math.pow(2,h-f.tileID.overscaledZ)))}Jr(boe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Zve=(f,c,h)=>(1-h)*f+h*c;function Yve(f,c){return 1/Kve(f,1,c.tileZoom)}function Xve(f,c,h,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Qve=f=>{const c=[];Jve(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const h=f.paint.get("line-trim-offset");h[0]===0&&h[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 Jve(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let joe;const e_e=()=>joe||(joe={layout:Wve||(Wve=new Gi({"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 Gi({"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 ux(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"})}))},joe);class OVe extends Er{possiblyEvaluate(c,h){return h=new si(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,transition:h.transition,worldview:h.worldview}),super.possiblyEvaluate(c,h)}evaluate(c,h,g,v){return h=Object.assign({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(c,h,g,v)}}let lM;function t_e(f,c){return c>0?c+2*f:f}const DVe=Es([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),RVe=Es([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),FVe=Es([{name:"a_projected_pos",components:4,type:"Float32"}],4);Es([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const zVe=Es([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),BVe=Es([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),$Ve=Es([{name:"a_texb",components:2,type:"Uint16"}]),UVe=Es([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),qVe=Es([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Es([{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 r_e=Es([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),VVe=Es([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Es([{name:"triangle",components:3,type:"Uint16"}]),Es([{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"}]),Es([{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"}]),Es([{type:"Float32",name:"offsetX"}]),Es([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var _l=24;function HVe(f,c,h){return f.sections.forEach(g=>{g.text=function(v,k,C){const L=k.layout.get("text-transform").evaluate(C,{});return L==="uppercase"?v=v.toLocaleUpperCase():L==="lowercase"&&(v=v.toLocaleLowerCase()),Ap.applyArabicShaping&&(v=Ap.applyArabicShaping(v)),v}(g.text,c,h)}),f}const cM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function WVe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function GVe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const koe=4294967296,n_e=1/koe,s_e=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let M6=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,h=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)*koe;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*koe;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 h,g;return g=c[this.pos++],h=127&g,g<128?h:(g=c[this.pos++],h|=(127&g)<<7,g<128?h:(g=c[this.pos++],h|=(127&g)<<14,g<128?h:(g=c[this.pos++],h|=(127&g)<<21,g<128?h:(g=c[this.pos],h|=(15&g)<<28,function(v,k,C){const L=C.buf;let F,$;if($=L[C.pos++],F=(112&$)>>4,$<128||($=L[C.pos++],F|=(127&$)<<3,$<128)||($=L[C.pos++],F|=(127&$)<<10,$<128)||($=L[C.pos++],F|=(127&$)<<17,$<128)||($=L[C.pos++],F|=(127&$)<<24,$<128)||($=L[C.pos++],F|=(1&$)<<31,$<128))return HN(v,F,k);throw new Error("Expected varint not more than 10 bytes")}(h,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&&s_e?s_e.decode(this.buf.subarray(c,f)):function(h,g,v){let k="",C=g;for(;C239?4:L>223?3:L>191?2:1;if(C+X>v)break;X===1?L<128&&(Z=L):X===2?(F=h[C+1],(192&F)==128&&(Z=(31&L)<<6|63&F,Z<=127&&(Z=null))):X===3?(F=h[C+1],$=h[C+2],(192&F)==128&&(192&$)==128&&(Z=(15&L)<<12|(63&F)<<6|63&$,(Z<=2047||Z>=55296&&Z<=57343)&&(Z=null))):X===4&&(F=h[C+1],$=h[C+2],G=h[C+3],(192&F)==128&&(192&$)==128&&(192&G)==128&&(Z=(15&L)<<18|(63&F)<<12|(63&$)<<6|63&G,(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),C+=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 h=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,h){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");h.realloc(10),function(k,C,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,h),function(k,C){const L=(7&k)<<4;C.buf[C.pos++]|=L|((k>>>=3)?128:0),k&&(C.buf[C.pos++]=127&k|((k>>>=7)?128:0),k&&(C.buf[C.pos++]=127&k|((k>>>=7)?128:0),k&&(C.buf[C.pos++]=127&k|((k>>>=7)?128:0),k&&(C.buf[C.pos++]=127&k|((k>>>=7)?128:0),k&&(C.buf[C.pos++]=127&k)))))}(v,h)}(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 C,L,F=0;F55295&&C<57344){if(!L){C>56319||F+1===v.length?(g[k++]=239,g[k++]=191,g[k++]=189):L=C;continue}if(C<56320){g[k++]=239,g[k++]=191,g[k++]=189,L=C;continue}C=L-55296<<10|C-56320|65536,L=null}else L&&(g[k++]=239,g[k++]=191,g[k++]=189,L=null);C<128?g[k++]=C:(C<2048?g[k++]=C>>6|192:(C<65536?g[k++]=C>>12|224:(g[k++]=C>>18|240,g[k++]=C>>12&63|128),g[k++]=C>>6&63|128),g[k++]=63&C|128)}return k}(this.buf,f,this.pos);const h=this.pos-c;h>=128&&a_e(c,h,this),this.pos=c-1,this.writeVarint(h),this.pos+=h}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 h=0;h=128&&a_e(h,g,this),this.pos=h-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,h){this.writeTag(f,2),this.writeRawMessage(c,h)}writePackedVarint(f,c){c.length&&this.writeMessage(f,KVe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,ZVe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,QVe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,YVe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,XVe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,JVe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,eHe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,tHe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,rHe,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 HN(f,c,h){return h?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function a_e(f,c,h){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));h.realloc(g);for(let v=h.pos-1;v>=f;v--)h.buf[v+g]=h.buf[v]}function KVe(f,c){for(let h=0;h=0&&g>=c&&T6[this.text.charCodeAt(g)];g--)h--;this.text=this.text.substring(c,h),this.sectionIndex=this.sectionIndex.slice(c,h)}substring(c,h){const g=new WN;return g.text=this.text.substring(c,h),g.sectionIndex=this.sectionIndex.slice(c,h),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,h)=>Math.max(c,this.sections[h].scale),0)}addTextSection(c,h){this.text+=c.text,this.sections.push(dM.forText(c.scale,c.fontStack||h));const g=this.sections.length-1;for(let v=0;v=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Soe(f,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me=1){const ke=WN.fromFeature(f,v,me);Z===Pu.vertical&&ke.verticalizePunctuation(X);let je=[];const Fe=function(_t,Ct,Et,Yt,Rt,rr){if(!_t)return[];const lr=[],cr=function(pr,tr,Qt,mr,Tr,wr){let hn=0;for(let Ur=0;Ur=0;let vr=0;for(let pr=0;pr<_t.length();pr++){const tr=_t.getSection(pr),Qt=_t.getCodePoint(pr);if(T6[Qt]||(vr+=o_e(Qt,tr,Yt,Rt,Ct,rr)),pr<_t.length()-1){const mr=!((ur=Qt)<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)));(iHe[Qt]||mr||tr.image)&&lr.push(c_e(pr+1,vr,cr,lr,oHe(Qt,_t.getCodePoint(pr+1),mr&&xr),!1))}}var ur;return d_e(c_e(_t.length(),vr,cr,lr,0,!0))}(ke,$,k,c,g,re),{processBidirectionalText:$e,processStyledBidirectionalText:Xe}=Ap;if($e&&ke.sections.length===1){const _t=$e(ke.toString(),Fe);for(const Ct of _t){const Et=new WN;Et.text=Ct,Et.sections=ke.sections;for(let Yt=0;Yt0&&ca>as&&(as=ca)}else{const sa=Et[yr.fontStack];if(!sa)continue;sa[Fr]&&(es=sa[Fr]);const la=Ct[yr.fontStack];if(!la)continue;const ca=la.glyphs[Fr];if(!ca)continue;if(bn=ca.metrics,ms=Fr!==8203?_l:0,wr){const Ea=la.ascender!==void 0?Math.abs(la.ascender):0,Za=la.descender!==void 0?Math.abs(la.descender):0,qa=(Ea+Za)*gn;Ua-h/2;){if(C--,C<0)return!1;L-=f[C].dist(k),k=f[C]}L+=f[C].dist(f[C+1]),C++;const F=[];let $=0;for(;Lg;)$-=F.shift().angleDelta;if($>v)return!1;C++,L+=G.dist(Z)}return!0}function g_e(f){let c=0;for(let h=0;h$){const ne=($-F)/re,me=Fn(Z.x,X.x,ne),ke=Fn(Z.y,X.y,ne),je=new vx(me,ke,0,X.angleTo(Z),G);return!C||m_e(f,je,L,C,c)?je:void 0}F+=re}}function cHe(f,c,h,g,v,k,C,L,F){const $=x_e(g,k,C),G=y_e(g,v),Z=G*C,X=f[0].x===0||f[0].x===F||f[0].y===0||f[0].y===F;return c-Z=0&&Xe=0&&mt=0&&X+$<=G){const ct=new vx(Xe,mt,0,Fe,ne);g&&!m_e(f,ct,k,g,v)||re.push(ct)}}Z+=je}return L||re.length||C||(re=v_e(f,Z/2,h,g,v,k,C,!0,F)),re}function __e(f){let c=0,h=0;for(const C of f)c+=C.w*C.h,h=Math.max(h,C.w);f.sort((C,L)=>L.h-C.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),h),h:1/0}];let v=0,k=0;for(const C of f)for(let L=g.length-1;L>=0;L--){const F=g[L];if(!(C.w>F.w||C.h>F.h)){if(C.x=F.x,C.y=F.y,k=Math.max(k,C.y+C.h),v=Math.max(v,C.x+C.w),C.w===F.w&&C.h===F.h){const $=g.pop();$&&L1?ne-1:ne,Tc.copy(Z.data,$,{x:0,y:0},{x:me,y:ke},Z.data,g),Tc.copy(Z.data,$,{x:0,y:Fe-ne},{x:me,y:ke-ne},{width:je,height:ne},g),Tc.copy(Z.data,$,{x:0,y:0},{x:me,y:ke+Fe},{width:je,height:ne},g),Tc.copy(Z.data,$,{x:je-ne,y:0},{x:me-ne,y:ke},{width:ne,height:Fe},g),Tc.copy(Z.data,$,{x:0,y:0},{x:me+je,y:ke},{width:ne,height:Fe},g),Tc.copy(Z.data,$,{x:je-ne,y:Fe-ne},{x:me-ne,y:ke-ne},{width:ne,height:ne},g),Tc.copy(Z.data,$,{x:0,y:Fe-ne},{x:me+je,y:ke-ne},{width:ne,height:ne},g),Tc.copy(Z.data,$,{x:0,y:0},{x:me+je,y:ke+Fe},{width:ne,height:ne},g),Tc.copy(Z.data,$,{x:je-ne,y:0},{x:me-ne,y:ke+Fe},{width:ne,height:ne},g)}this.lut=g,this.image=$,this.iconPositions=v,this.patternPositions=k}addImages(c,h,g,v){for(const[k,C]of c.entries()){const{bin:L,imagePosition:F,imageVariant:$}=Eoe(k,C,g);h.set(k,F),v.push(L),C.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,h,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 C=jp.parse(k);if(yl.isEqual(C.id,v)){const L=c.getImage(v,g);this.patchUpdatedImage(this.iconPositions.get(k),L,h,null)}}for(const k of this.patternPositions.keys()){const C=jp.parse(k);if(yl.isEqual(C.id,v)){const L=c.getImage(v,g);this.patchUpdatedImage(this.patternPositions.get(k),L,h,this.lut)}}}}patchUpdatedImage(c,h,g,v=null){if(!c||!h||c.version===h.version)return;c.version=h.version;const[k,C]=c.tl,L=c.sdf;if(this.lut||L){const F={width:h.data.width,height:h.data.height},$=new Tc(F);Tc.copy(h.data,$,{x:0,y:0},{x:0,y:0},F,v,L),g.update($,{position:{x:k,y:C}})}else g.update(h.data,{position:{x:k,y:C}})}}Jr(uM,"ImagePosition"),Jr(b_e,"ImageAtlas");const hM=1e20;function w_e(f,c,h,g,v,k,C,L,F){for(let $=c;$-1);F++,k[F]=L,C[F]=$,C[F+1]=hM}for(let L=0,F=0;L{let F=this.entries[k];F||(F=this.entries[k]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=F.glyphs[C];if($!==void 0)return void L(null,{stack:k,id:C,glyph:$});if($=this._tinySDF(F,k,C),$)return F.glyphs[C]=$,void L(null,{stack:k,id:C,glyph:$});const G=Math.floor(C/256);if(256*G>65535)return Vr("glyphs > 65535 not supported"),void L(null,{stack:k,id:C,glyph:$});if(F.ranges[G])return void L(null,{stack:k,id:C,glyph:$});let Z=F.requests[G];Z||(Z=F.requests[G]=[],ZN.loadGlyphRange(k,G,v,this.requestManager,(X,re)=>{if(re){F.ascender=re.ascender,F.descender=re.descender;for(const ne in re.glyphs)this._doesCharSupportLocalGlyph(+ne)||(F.glyphs[+ne]=re.glyphs[+ne]);F.ranges[G]=!0}for(const ne of Z)ne(X,re);delete F.requests[G]})),Z.push((X,re)=>{X?L(X):re&&L(null,{stack:k,id:C,glyph:re.glyphs[C]||null})})},(k,C)=>{if(k)h(k);else if(C){const L={};for(const{stack:F,id:$,glyph:G}of C)L[F]===void 0&&(L[F]={}),L[F].glyphs===void 0&&(L[F].glyphs={}),L[F].glyphs[$]=G&&{id:G.id,bitmap:G.bitmap.clone(),metrics:G.metrics},L[F].ascender=this.entries[F].ascender,L[F].descender=this.entries[F].descender;h(null,L)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==Ioe.none&&(this.localGlyphMode===Ioe.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,h,g){const v=this.localFontFamily;if(!v||!this._doesCharSupportLocalGlyph(g))return;let k=c.tinySDF;if(!k){let me="400";/bold/i.test(h)?me="900":/medium/i.test(h)?me="500":/light/i.test(h)&&(me="200"),k=c.tinySDF=new ZN.TinySDF({fontFamily:v,fontWeight:me,fontSize:24*$p,buffer:3*$p,radius:8*$p}),k.fontWeight=me}if(this.localGlyphs[k.fontWeight][g])return this.localGlyphs[k.fontWeight][g];const C=String.fromCodePoint(g),{data:L,width:F,height:$,glyphWidth:G,glyphHeight:Z,glyphLeft:X,glyphTop:re,glyphAdvance:ne}=k.draw(C);return this.localGlyphs[k.fontWeight][g]={id:g,bitmap:new x0({width:F,height:$},L),metrics:{width:G/$p,height:Z/$p,left:X/$p,top:re/$p-27,advance:ne/$p,localGlyph:!0}}}}ZN.loadGlyphRange=function(f,c,h,g,v){const k=256*c,C=k+255,L=g.transformRequest(g.normalizeGlyphsURL(h).replace("{fontstack}",f).replace("{range}",`${k}-${C}`),Jg.Glyphs);Oh(L,(F,$)=>{if(F)v(F);else if($){const G={},Z=function(X){return new M6(X).readFields(nHe,{})}($);for(const X of Z.glyphs)G[X.id]=X;v(null,{glyphs:G,ascender:Z.ascender,descender:Z.descender})}})},ZN.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:h=8,cutoff:g=.25,fontFamily:v="sans-serif",fontWeight:k="normal",fontStyle:C="normal",lang:L=null}={}){this.buffer=c,this.cutoff=g,this.radius=h,this.lang=L;const F=this.size=f+4*c,$=this._createCanvas(F),G=this.ctx=$.getContext("2d",{willReadFrequently:!0});G.font=`${C} ${k} ${f}px ${v}`,G.textBaseline="alphabetic",G.textAlign="left",G.fillStyle="black",this.gridOuter=new Float64Array(F*F),this.gridInner=new Float64Array(F*F),this.f=new Float64Array(F),this.z=new Float64Array(F+1),this.v=new Uint16Array(F)}_createCanvas(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:h,actualBoundingBoxDescent:g,actualBoundingBoxLeft:v,actualBoundingBoxRight:k}=this.ctx.measureText(f),C=Math.ceil(h),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(k-v))),F=Math.min(this.size-this.buffer,C+Math.ceil(g)),$=L+2*this.buffer,G=F+2*this.buffer,Z=Math.max($*G,0),X=new Uint8ClampedArray(Z),re={data:X,width:$,height:G,glyphWidth:L,glyphHeight:F,glyphTop:C,glyphLeft:0,glyphAdvance:c};if(L===0||F===0)return re;const{ctx:ne,buffer:me,gridInner:ke,gridOuter:je}=this;this.lang&&(ne.lang=this.lang),ne.clearRect(me,me,L,F),ne.fillText(f,me,me+C);const Fe=ne.getImageData(me,me,L,F);je.fill(hM,0,Z),ke.fill(0,0,Z);for(let $e=0;$e0?_t*_t:0,ke[ct]=_t<0?_t*_t:0}}w_e(je,0,0,$,G,$,this.f,this.v,this.z),w_e(ke,me,me,L,F,$,this.f,this.v,this.z);for(let $e=0;$e{const xr=I6(Rt.stretch-Fe,$e,G,f.left*v),vr=P6(Rt.fixed-ct,_t,Rt.stretch,ne),ur=I6(rr.stretch-Xe,mt,Z,f.top*v),pr=P6(rr.fixed-Ct,Et,rr.stretch,me),tr=I6(lr.stretch-Fe,$e,G,f.left*v),Qt=P6(lr.fixed-ct,_t,lr.stretch,ne),mr=I6(cr.stretch-Xe,mt,Z,f.top*v),Tr=P6(cr.fixed-Ct,Et,cr.stretch,me),wr=new ir(xr,ur),hn=new ir(tr,ur),Ur=new ir(tr,mr),Kr=new ir(xr,mr),nn=new ir(vr/L,pr/L),xs=new ir(Qt/L,Tr/L),jr=c*Math.PI/180;if(jr){const Ua=Math.sin(jr),dt=Math.cos(jr),xt=[dt,-Ua,Ua,dt];wr._matMult(xt),hn._matMult(xt),Kr._matMult(xt),Ur._matMult(xt)}const sn=Rt.stretch+Rt.fixed,Vn=lr.stretch+lr.fixed,zs=rr.stretch+rr.fixed,Hs=cr.stretch+cr.fixed,as=f.imageSecondary;return{tl:wr,tr:hn,bl:Kr,br:Ur,texPrimary:{x:C.paddedRect.x+tg+sn,y:C.paddedRect.y+tg+zs,w:Vn-sn,h:Hs-zs},texSecondary:as?{x:as.paddedRect.x+tg+sn,y:as.paddedRect.y+tg+zs,w:Vn-sn,h:Hs-zs}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:nn,pixelOffsetBR:xs,minFontScaleX:_t/L/G,minFontScaleY:Et/L/Z,isSDF:h}};if(g&&(C.stretchX||C.stretchY)){const Rt=N_e(X,ke,ne),rr=N_e(re,je,me);for(let lr=0;lrk)&&(k=ne.x),(!re||ne.y>C)&&(C=ne.y)}const F=Math.min(k-g,C-v);let $=F/2;const G=new zk([],fHe);if(F===0)return new ir(g,v);for(let re=g;reZ.d||!Z.d)&&(Z=re,h&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,X)),re.max-Z.d<=c||($=re.h/2,G.push(new YN(re.p.x-$,re.p.y-$,$,f)),G.push(new YN(re.p.x+$,re.p.y-$,$,f)),G.push(new YN(re.p.x-$,re.p.y+$,$,f)),G.push(new YN(re.p.x+$,re.p.y+$,$,f)),X+=4)}return h&&(console.log(`num probes: ${X}`),console.log(`best distance: ${Z.d}`)),Z.p}function fHe(f,c){return c.max-f.max}class YN{constructor(c,h,g,v){this.p=new ir(c,h),this.h=g,this.d=function(k,C){let L=!1,F=1/0;for(let $=0;$k.y!=me.y>k.y&&k.x<(me.x-ne.x)*(k.y-ne.y)/(me.y-ne.y)+ne.x&&(L=!L),F=Math.min(F,ro(k,ne,me))}}return(L?1:-1)*Math.sqrt(F)}(this.p,v),this.max=this.d+this.h*Math.SQRT2}}const pHe=Object.keys,Loe=Number.POSITIVE_INFINITY,mHe=Math.sqrt(2);function v0(f,c,h,g,v){const k=Moe(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],C={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,F){L.top*=F,L.bottom*=F,L.left*=F,L.right*=F,L.scaled=!0}(C,g),h&&function(L,F){if(!F)return;const $=is(F),G=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);G._rotateAround($,ne),Z._rotateAround($,ne),X._rotateAround($,ne),re._rotateAround($,ne),L.left=Math.min(G.x,Z.x,X.x,re.x),L.right=Math.max(G.x,Z.x,X.x,re.x),L.top=Math.min(G.y,Z.y,X.y,re.y),L.bottom=Math.max(G.y,Z.y,X.y,re.y)}(C,h),v&&(C.left+=v[0],C.right+=v[0],C.top+=v[1],C.bottom+=v[1]),c?{top:Math.min(c.top,C.top),bottom:Math.max(c.bottom,C.bottom),left:Math.min(c.left,C.left),right:Math.max(c.right,C.right),scaled:c.scaled||C.scaled}:C}function C_e(f,[c,h]){let g=0,v=0;if(h===Loe){c<0&&(c=0);const k=c/mHe;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),h=Math.abs(h),f){case"top-right":case"top-left":case"top":v=h-7;break;case"bottom-right":case"bottom-left":case"bottom":v=7-h}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 gHe(f,c,h,g,v,k,C,L,F,$,G,Z,X,re){const ne=f.layers[0],me=ne.appearances;if(me.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const ke={iconBBox:null,iconVerticalBBox:null},je={textBBox:null,textVerticalBBox:null},{baseIconRotate:Fe,baseTextRotate:$e,iconScaleFactor:Xe}=function(ct,_t,Ct){const Et=ct.get("icon-rotate").evaluate(_t,{},Ct),Yt=ct.get("text-rotate").evaluate(_t,{},Ct),[Rt,rr]=ct.get("icon-size-scale-range");return{baseIconRotate:Et,baseTextRotate:Yt,iconScaleFactor:ge(1,Rt,rr)}}(g,v,k);c&&(ke.iconBBox=v0(c,ke.iconBBox,Fe,C),h)&&(ke.iconVerticalBBox=v0(h,ke.iconVerticalBBox,Fe+90,C));const mt=O6(Z.horizontal);mt&&(je.textBBox=v0(mt,je.textBBox,$e,1,re)),Z.vertical&&(je.textVerticalBBox=v0(Z.vertical,je.textVerticalBBox,$e+90,1,re));for(const ct of me)ct.hasIconProperties()&&xHe(ke,f,ne,ct,v,k,L,Fe,C,F,c,$,Xe,G),ct.hasTextProperties()&&yHe(je,ne,ct,v,k,re,$e,X,mt,Z.vertical);return{iconBBox:ke.iconBBox,iconVerticalBBox:ke.iconVerticalBBox,textBBox:je.textBBox,textVerticalBBox:je.textVerticalBBox}}function xHe(f,c,h,g,v,k,C,L,F,$,G,Z,X,re){const{appearanceIconOffset:ne,appearanceIconRotate:me,appearanceIconSize:ke}=function(Xe,mt,ct,_t,Ct,Et,Yt,Rt){const rr=Xe.hasProperty("icon-offset")?mt.getAppearanceValueAndResolveTokens(Xe,"icon-offset",ct,_t,[]):null,lr=rr&&Array.isArray(rr)?rr:Ct,cr=Xe.hasProperty("icon-rotate")?mt.getAppearanceValueAndResolveTokens(Xe,"icon-rotate",ct,_t,[]):null,xr=typeof cr=="number"?cr:Et,vr=Xe.hasProperty("icon-size")?mt.getAppearanceValueAndResolveTokens(Xe,"icon-size",ct,_t,[]):null;return{appearanceIconOffset:lr,appearanceIconRotate:xr,appearanceIconSize:typeof vr=="number"?vr*Rt.iconScaleFactor:Yt}}(g,h,v,k,C,L,F,$);let je=null,Fe=null,$e=null;g.hasProperty("icon-image")?$e=function(Xe,mt,ct,_t,Ct,Et,Yt){let Rt=null;const rr=mt.getAppearanceValueAndResolveTokens(ct,"icon-image",_t,Ct,[]);if(rr){const lr=Xe.getResolvedImageFromTokens(rr),cr=ct.getUnevaluatedProperty("icon-size"),xr=fM(lr,GN(Xe.zoom,cr,Xe.worldview),cr,Ct,Xe.zoom,_t,Xe.pixelRatio,Yt,Xe.worldview);Rt=Et.get(xr.iconPrimary.toString())}return Rt}(c,h,g,v,k,Z,X):G&&($e=G.imagePrimary),$e&&(je=A6($e,null,ne,re),c.allowVerticalPlacement&&(Fe=A6($e,null,ne,re))),je&&(f.iconBBox=v0(je,f.iconBBox,me,ke)),Fe&&(f.iconVerticalBBox=v0(Fe,f.iconVerticalBBox,me+90,ke))}function yHe(f,c,h,g,v,k,C,L,F,$){const{appearanceTextOffset:G,appearanceTextRotate:Z,appearanceTextSize:X}=function(ne,me,ke,je,Fe,$e,Xe){const mt=ne.hasProperty("text-offset")?me.getAppearanceValueAndResolveTokens(ne,"text-offset",ke,je,[]):null,ct=mt&&Array.isArray(mt)?[mt[0]*_l,mt[1]*_l]:Fe,_t=ne.hasProperty("text-rotate")?me.getAppearanceValueAndResolveTokens(ne,"text-rotate",ke,je,[]):null,Ct=typeof _t=="number"?_t:$e,Et=ne.hasProperty("text-size")?me.getAppearanceValueAndResolveTokens(ne,"text-size",ke,je,[]):null;return{appearanceTextOffset:ct,appearanceTextRotate:Ct,appearanceTextSize:typeof Et=="number"?Et:Xe}}(h,c,g,v,k,C,L),re=X/L;F&&(f.textBBox=v0(F,f.textBBox,Z,re,G)),$&&(f.textVerticalBBox=v0($,f.textVerticalBBox,Z+90,re,G))}function L6(f,c,h,g,v,k,C,L,F){if(!c||!c.usvg)return;const $=p_e(g),G=p_e(v),Z=k!=="both"&&k!=="width"||!h_e(g)?1:G.width/$.width,X=k!=="both"&&k!=="height"||!f_e(g)?1:G.height/$.height;h.scaleSelf(Z,X);const re=h.toString();C.set(re,h),L.set(re,c);const{imagePosition:ne}=Eoe(re,c,d_);F.set(re,ne)}function M_e(f,c,h,g,v,k,C,L,F){if(!f)return;const $=function(G,Z,X,re,ne,me){if(G.kind==="camera")return G.maxSize;if(G.kind==="composite"){const ke=Z.possiblyEvaluate(new si(G.maxZoom,{worldview:me}),X).evaluate(ne,{},X),je=Z.possiblyEvaluate(new si(G.minZoom,{worldview:me}),X).evaluate(ne,{},X);return Math.max(ke,je)}return Z.possiblyEvaluate(new si(re,{worldview:me})).evaluate(ne,{},X)}(c,h,g,v,k,F);return f.scaleSelf($*L*C)}function fM(f,c,h,g,v,k,C,L,F){return{iconPrimary:M_e(f.getPrimary(),c,h,g,v,k,C,L,F),iconSecondary:M_e(f.getSecondary(),c,h,g,v,k,C,L,F)}}function vHe(f,c,h){if(!c)return;const g=h.get(f.toString()),v=h.get(c.toString());g&&v&&(g.paddedRect.w===v.paddedRect.w&&g.paddedRect.h===v.paddedRect.h||Vr(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==v.usvg&&Vr(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function T_e(f,c,h,g){if(!f)return;const v=c.get(h.toString());if(f.imagePrimary=v,g){const k=c.get(g.toString());f.imageSecondary=k}}function _He(f,c){for(const h in f.horizontal)A_e(f.horizontal[h],c);A_e(f.vertical,c)}function A_e(f,c){if(f){for(const h of f.positionedLines)for(const g of h.positionedGlyphs)if(g.image!==null){const v=g.image.toString();g.rect=c.get(v).paddedRect}}}function Ooe(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 bHe(f,c,h,g,v,k,C,L,F){const $=O6(k.horizontal)||k.vertical,G=h.get("icon-text-fit-padding").evaluate(g,{},v);let Z,X=c;return c&&F!=="none"&&(f.allowVerticalPlacement&&k.vertical&&(Z=Toe(c,k.vertical,F,G,L,C)),$&&(X=Toe(c,$,F,G,L,C))),{defaultShapedIcon:X,verticallyShapedIcon:Z}}function wHe(f,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe,$e,Xe,mt,ct,_t){let Ct=C.textMaxSize.evaluate(c,{},X);Ct===void 0?Ct=L*C.textScaleFactor:Ct*=C.textScaleFactor;const Et=f.layers[0].layout,Yt=_l,Rt=L*C.textScaleFactor/Yt,rr=O6(h.horizontal)||h.vertical;if(ke!=="none"&&f.appearanceFeatureData&&c.index18&&mr>2&&(mr>>=1),Math.max(Cr/(512*mr),1)*Et.get("symbol-spacing")),vr=Et.get("text-padding")*f.tilePixelRatio,ur=Et.get("icon-padding")*f.tilePixelRatio,pr=is(Et.get("text-max-angle")),tr=Et.get("icon-rotation-alignment")==="map"&&$e!=="point",Qt=xr/2;var mr;f.hasAnyIconTextFit===!1&&ke!=="none"&&(f.hasAnyIconTextFit=!0);const Tr=c.properties?+c.properties[Jt]:null,wr=Tr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Tr):65535,hn=(Ur,Kr,nn)=>{if(Kr.x<0||Kr.x>=Cr||Kr.y<0||Kr.y>=Cr)return;let xs=null;if(lr){const{x:jr,y:sn,z:Vn}=re.projectTilePoint(Kr.x,Kr.y,nn);xs={anchor:new vx(jr,sn,Vn,0,void 0),up:re.upVector(nn,Kr.x,Kr.y)}}(function(jr,sn,Vn,zs,Hs,as,Ua,dt,xt,nr,yr,Rr,Fr,gn,bn,es,us,ms,Is,Ln,qn,sa,la,ca,Ea,Za,qa,ma,wa,hs,$s,Ti,En){const Ps=jr.addToLineVertexArray(sn,zs);let Ha,Ja,ai,co,ei,In,zi,Ia=0,vi=0,Ko=0,bl=0,Po=-1,Lo=-1;const ll={};let Rd=Pr("");const ti=Vn?Vn.anchor:sn,no=ma!=="none";let uo=0,au=0;if(xt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const uc=xt.layout.get("text-offset").evaluate(qn,{},Ea);uo=uc[0]*_l,au=uc[1]*_l}else uo=xt.layout.get("text-radial-offset").evaluate(qn,{},Ea)*_l,au=Loe;if(jr.allowVerticalPlacement&&Hs.vertical){const uc=Hs.vertical;if(bn)In=Doe(uc),dt&&(zi=Doe(dt));else{const hd=xt.layout.get("text-rotate").evaluate(qn,{},Ea)+90;ai=D6(nr,ti,sn,yr,Rr,Fr,uc,gn,hd,es,Ti),dt&&(co=D6(nr,ti,sn,yr,Rr,Fr,dt,ms,hd,null,$s))}}if(as){const uc=jr.iconSizeData,hd=xt.layout.get("icon-rotate").evaluate(qn,{},Ea),Lu=Poe(as,hd,la,no,sa.iconScaleFactor),w0=dt?Poe(dt,hd,la,no,sa.iconScaleFactor):void 0;Ja=D6(nr,ti,sn,yr,Rr,Fr,as,ms,hd,null,hs);const n4=function(Hp,EM,Z2e,LWe,Y2e,X2e,OWe,DWe){const Q2e=Hp.layers[0],J2e=Q2e.appearances;let s4=EM.length;if(Z2e&&(s4=Math.max(s4,Z2e.length)),J2e.length===0)return s4;const[RWe,FWe]=LWe.get("icon-size-scale-range"),zWe=ge(1,RWe,FWe);for(const ebe of J2e){const tbe=ebe.getUnevaluatedProperties();if(tbe._values["icon-image"].value!==void 0){const rbe=Q2e.getAppearanceValueAndResolveTokens(ebe,"icon-image",Y2e,X2e,[]);if(rbe){const nbe=Hp.getResolvedImageFromTokens(rbe);if(nbe){const sbe=tbe._values["icon-size"],BWe=fM(nbe,GN(Hp.zoom,sbe,Hp.worldview),sbe,X2e,Hp.zoom,Y2e,Hp.pixelRatio,zWe,Hp.worldview),$We=OWe.get(BWe.iconPrimary.toString());s4=Math.max(s4,dHe($We,DWe))}}}}return s4}(jr,Lu,w0,xt.layout,qn,Ea,jr.iconAtlasPositions,no);Ia=4*n4;let Vp=null;uc.kind==="source"?(Vp=[Bp*xt.layout.get("icon-size").evaluate(qn,{},Ea)*sa.iconScaleFactor],Vp[0]>_x&&Vr(`${jr.layerIds[0]}: Value for "icon-size" is >= ${pM}. Reduce your "icon-size".`)):uc.kind==="composite"&&(Vp=[Bp*sa.compositeIconSizes[0].evaluate(qn,{},Ea)*sa.iconScaleFactor,Bp*sa.compositeIconSizes[1].evaluate(qn,{},Ea)*sa.iconScaleFactor],(Vp[0]>_x||Vp[1]>_x)&&Vr(`${jr.layerIds[0]}: Value for "icon-size" is >= ${pM}. Reduce your "icon-size".`)),jr.addSymbols(jr.icon,Lu,Vp,Ln,Is,qn,void 0,Vn,sn,Ps.lineStartIndex,Ps.lineLength,-1,ca,Ea,Za,qa,jr.symbolInstances.length,n4),Po=jr.icon.placedSymbolArray.length-1,w0&&(vi=4*n4,jr.addSymbols(jr.icon,w0,Vp,Ln,Is,qn,Pu.vertical,Vn,sn,Ps.lineStartIndex,Ps.lineLength,-1,ca,Ea,Za,qa,jr.symbolInstances.length,n4),Lo=jr.icon.placedSymbolArray.length-1)}for(const uc in Hs.horizontal){const hd=uc,Lu=Hs.horizontal[hd];Ha||(Rd=Pr(Lu.text),bn?ei=Doe(Lu):Ha=D6(nr,ti,sn,yr,Rr,Fr,Lu,gn,xt.layout.get("text-rotate").evaluate(qn,{},Ea),es,Ti));const w0=Lu.positionedLines.length===1;if(Ko+=E_e(jr,Vn,sn,Lu,Ua,xt,bn,qn,es,Ps,Hs.vertical?Pu.horizontal:Pu.horizontalOnly,w0?pHe(Hs.horizontal):[hd],ll,Po,sa,ca,Ea,jr.symbolInstances.length,Za),w0)break}Hs.vertical&&(bl+=E_e(jr,Vn,sn,Hs.vertical,Ua,xt,bn,qn,es,Ps,Pu.vertical,["vertical"],ll,Lo,sa,ca,Ea,jr.symbolInstances.length,Za));let Zo=-1;const Of=(uc,hd)=>uc?Math.max(uc,hd):hd;Zo=Of(ei,Zo),Zo=Of(In,Zo),Zo=Of(zi,Zo);const rg=Zo>-1?1:0;jr.glyphOffsetArray.length>=65535&&Vr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),qn.sortKey!==void 0&&jr.addToSortKeyRanges(jr.symbolInstances.length,qn.sortKey),jr.symbolInstances.emplaceBack(sn.x,sn.y,ti.x,ti.y,ti.z,ll.right>=0?ll.right:-1,ll.center>=0?ll.center:-1,ll.left>=0?ll.left:-1,ll.vertical>=0?ll.vertical:-1,Po,Lo,Rd,Ha!==void 0?Ha:jr.collisionBoxArray.length,Ha!==void 0?Ha+1:jr.collisionBoxArray.length,ai!==void 0?ai:jr.collisionBoxArray.length,ai!==void 0?ai+1:jr.collisionBoxArray.length,Ja!==void 0?Ja:jr.collisionBoxArray.length,Ja!==void 0?Ja+1:jr.collisionBoxArray.length,co||jr.collisionBoxArray.length,co?co+1:jr.collisionBoxArray.length,yr,Ko,bl,Ia,vi,rg,0,uo,au,Zo,0,no?1:0,wa)})(f,Kr,xs,Ur,h,g,k,v,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,vr,Fe,$,0,ur,tr,je,c,C,G,Z,X,ne,me,ke,wr,Xe,mt,ct)};if($e==="line")for(const Ur of x6(c.geometry,0,0,Cr,Cr)){const Kr=cHe(Ur,xr,pr,h.vertical||rr,g,Yt,cr,f.overscaling,Cr);for(const nn of Kr)rr&&jHe(f,rr.text,Qt,nn)||hn(Ur,nn,X)}else if($e==="line-center"){for(const Ur of c.geometry)if(Ur.length>1){const Kr=lHe(Ur,pr,h.vertical||rr,g,Yt,cr);Kr&&hn(Ur,Kr,X)}}else if(c.type==="Polygon")for(const Ur of Y5(c.geometry,0)){const Kr=hHe(Ur,16);hn(Ur[0],new vx(Kr.x,Kr.y,0,0,void 0),X)}else if(c.type==="LineString")for(const Ur of c.geometry)hn(Ur,new vx(Ur[0].x,Ur[0].y,0,0,void 0),X);else if(c.type==="Point")for(const Ur of c.geometry)for(const Kr of Ur)hn([Kr],new vx(Kr.x,Kr.y,0,0,void 0),X)}const pM=255,_x=pM*Bp;function E_e(f,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe){const $e=function(ct,_t,Ct,Et,Yt,Rt,rr,lr){const cr=[];if(_t.positionedLines.length===0)return cr;const xr=Et.layout.get("text-rotate").evaluate(Rt,{})*Math.PI/180,vr=function(mr){const Tr=mr[0],wr=mr[1],hn=Tr*wr;return hn>0?[Tr,-wr]:hn<0?[-Tr,wr]:Tr===0?[wr,Tr]:[wr,-Tr]}(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 Qt=_t.top-Ct[1];for(let mr=0;mr_x&&Vr(`${f.layerIds[0]}: Value for "text-size" is >= ${pM}. Reduce your "text-size".`)):Xe.kind==="composite"&&(mt=[Bp*ne.compositeTextSizes[0].evaluate(L,{},ke)*ne.textScaleFactor,Bp*ne.compositeTextSizes[1].evaluate(L,{},ke)*ne.textScaleFactor],(mt[0]>_x||mt[1]>_x)&&Vr(`${f.layerIds[0]}: Value for "text-size" is >= ${pM}. Reduce your "text-size".`)),f.addSymbols(f.text,$e,mt,F,C,L,G,c,h,$.lineStartIndex,$.lineLength,re,me,ke,Fe,!1,je,$e.length);for(const ct of Z)X[ct]=f.text.placedSymbolArray.length-1;return 4*$e.length}function O6(f){for(const c in f)return f[c];return null}function D6(f,c,h,g,v,k,C,L,F,$,G){let Z,X,re,ne;if(Z=G?G.top:C.top,X=G?G.bottom:C.bottom,re=G?G.left:C.left,ne=G?G.right:C.right,Moe(C)&&C.collisionPadding){const me=C.collisionPadding;re-=me[0],Z-=me[1],ne+=me[2],X+=me[3]}if(F){const me=new ir(re,Z),ke=new ir(ne,Z),je=new ir(re,X),Fe=new ir(ne,X),$e=is(F);let Xe=new ir(0,0);$&&(Xe=new ir($[0],$[1])),me._rotateAround($e,Xe),ke._rotateAround($e,Xe),je._rotateAround($e,Xe),Fe._rotateAround($e,Xe),re=Math.min(me.x,ke.x,je.x,Fe.x),ne=Math.max(me.x,ke.x,je.x,Fe.x),Z=Math.min(me.y,ke.y,je.y,Fe.y),X=Math.max(me.y,ke.y,je.y,Fe.y)}return f.emplaceBack(c.x,c.y,c.z,h.x,h.y,re,Z,ne,X,L,g,v,k),f.length-1}function Doe(f){Moe(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 jHe(f,c,h,g){const v=f.compareText;if(c in v){const k=v[c];for(let C=k.length-1;C>=0;C--)if(g.dist(k[C])$e&&(Xe(ct,cr,Ct,Et,rr,lr),Xe(cr,_t,rr,lr,Yt,Rt))}Xe(Z,X,g,k,v,k),Xe(X,re,v,k,v,C),Xe(re,ne,v,C,g,C),Xe(ne,Z,g,C,g,k),me-=$e,ke-=$e,je+=$e,Fe+=$e;const mt=1/Math.max(je-me,Fe-ke);return{scale:mt,x:me*mt,y:ke*mt,x2:je*mt,y2:Fe*mt,projection:c}}function P_e(f,{x:c,y:h},g=0){return new ir(((c-g)*f.scale-f.x)*Cr,(h*f.scale-f.y)*Cr)}const kHe=M(new Float32Array(16));class _0{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,h){return{x:0,y:0,z:0}}unproject(c,h){return new m(0,0)}projectTilePoint(c,h,g){return{x:c,y:h,z:0}}locationPoint(c,h,g,v=!0){return c._coordinatePoint(c.locationCoordinate(h,g),v)}pixelsPerMeter(c,h){return Y(1,c)*h}pixelSpaceConversion(c,h,g){return 1}farthestPixelDistance(c){return I_e(c,c.pixelsPerMeter)}pointCoordinate(c,h,g,v){const k=c.horizonLineFromTop(!1),C=new ir(h,Math.max(k,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(C,v))}pointCoordinate3D(c,h,g){const v=new ir(h,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,h){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,h.x,h.y);const g=c.horizonLineFromTop();return h.y0?h<-XN+g&&(h=-XN+g):h>XN-g&&(h=XN-g);const C=k/Math.pow(F6(h),v);let L=C*Math.sin(v*c),F=k-C*Math.cos(v*c);return L=.5*(L/Math.PI+.5),F=.5*(F/Math.PI+.5),{x:L,y:this.southernCenter?F:1-F,z:0}}unproject(c,h){c=(2*c-.5)*Math.PI,this.southernCenter&&(h=1-h),h=(2*(1-h)-.5)*Math.PI;const{n:g,f:v}=this,k=v-h,C=Math.sign(k),L=Math.sign(g)*Math.sqrt(c*c+k*k);let F=Math.atan2(c,Math.abs(k))*C;k*g<0&&(F-=Math.PI*Math.sign(c)*C);const $=ge(vo(F/g)+this.center[0],-180,180),G=ge(vo(2*Math.atan(Math.pow(v/L,1/g))-XN),-ue,ue);return new m($,this.southernCenter?-G:G)}}class L_e extends _0{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,h){return{x:B(c),y:H(h),z:0}}unproject(c,h){const g=ee(c),v=de(h);return new m(g,v)}}const O_e=is(ue);class THe extends _0{project(c,h){const g=(h=is(h))*h,v=g*g;return{x:.5*((c=is(c))*(.8707-.131979*g+v*(v*(.003971*g-.001529*v)-.013791))/Math.PI+.5),y:1-.5*(h*(1.007226+g*(.015085+v*(.028874*g-.044475-.005916*v)))/Math.PI+1),z:0}}unproject(c,h){c=(2*c-.5)*Math.PI;let g=h=(2*(1-h)-1)*Math.PI,v=25,k=0,C=g*g;do{C=g*g;const $=C*C;k=(g*(1.007226+C*(.015085+$*(.028874*C-.044475-.005916*$)))-h)/(1.007226+C*(.045255+$*(.259866*C-.311325-.005916*11*$))),g=ge(g-k,-O_e,O_e)}while(Math.abs(k)>1e-6&&--v>0);C=g*g;const L=ge(vo(c/(.8707+C*(C*(C*C*C*(.003971-.001529*C)-.013791)-.131979))),-180,180),F=vo(g);return new m(L,F)}}const D_e=is(ue);class AHe extends _0{project(c,h){h=is(h),c=is(c);const g=Math.cos(h),v=2/Math.PI,k=Math.acos(g*Math.cos(c/2)),C=Math.sin(k)/k,L=.5*(c*v+2*g*Math.sin(c/2)/C)||0,F=.5*(h+Math.sin(h)/C)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(F/Math.PI+1),z:0}}unproject(c,h){let g=c=(2*c-.5)*Math.PI,v=h=(2*(1-h)-1)*Math.PI,k=25;const C=1e-6;let L=0,F=0;do{const $=Math.cos(v),G=Math.sin(v),Z=2*G*$,X=G*G,re=$*$,ne=Math.cos(g/2),me=Math.sin(g/2),ke=2*ne*me,je=me*me,Fe=1-re*ne*ne,$e=Fe?1/Fe:0,Xe=Fe?Math.acos($*ne)*Math.sqrt(1/Fe):0,mt=.5*(2*Xe*$*me+2*g/Math.PI)-c,ct=.5*(Xe*G+v)-h,_t=.5*$e*(re*je+Xe*$*ne*X)+1/Math.PI,Ct=$e*(ke*Z/4-Xe*G*me),Et=.125*$e*(Z*me-Xe*G*re*ke),Yt=.5*$e*(X*ne+Xe*je*$)+.5,Rt=Ct*Et-Yt*_t;L=(ct*Ct-mt*Yt)/Rt,F=(mt*Et-ct*_t)/Rt,g=ge(g-L,-Math.PI,Math.PI),v=ge(v-F,-D_e,D_e)}while((Math.abs(L)>C||Math.abs(F)>C)&&--k>0);return new m(vo(g),vo(v))}}class R_e extends _0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(is(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,h){const{scale:g,cosPhi:v}=this;return{x:is(c)*v*g+.5,y:-Math.sin(is(h))/v*g+.5,z:0}}unproject(c,h){const{scale:g,cosPhi:v}=this,k=-(h-.5)/g,C=ge(vo((c-.5)/g)/v,-180,180),L=Math.asin(ge(k*v,-1,1)),F=ge(vo(L),-ue,ue);return new m(C,F)}}class EHe extends L_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,h,g){const v=V5(c,h,g);return Qe(v,v,l6(Vh(g))),{x:v[0],y:v[1],z:v[2]}}locationPoint(c,h,g){const v=f0(h.lat,h.lng),k=Be([],v),C=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(h),c._centerAltitude):c._centerAltitude;rt(v,v,k,Y(1,0)*Cr*C);const L=M(new Float64Array(16));return A(L,c.pixelMatrix,c.globeMatrix),Qe(v,v,L),new ir(v[0],v[1])}pixelsPerMeter(c,h){return Y(1,0)*h}pixelSpaceConversion(c,h,g){const v=Y(1,c)*h,k=Fn(Y(1,45)*h,v,g);return this.pixelsPerMeter(c,h)/k}createTileMatrix(c,h,g){const v=$ie(Vh(g.canonical));return A(new Float64Array(16),c.globeMatrix,v)}createInversionMatrix(c,h){const{center:g}=c,v=l6(Vh(h));return U(v,v,is(g.lng)),R(v,v,is(g.lat)),z(v,v,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(v)}pointCoordinate(c,h,g,v){return m0(c,h,g,!0)||new He(0,0)}pointCoordinate3D(c,h,g){const v=this.pointCoordinate(c,h,g,0);return[v.x,v.y,v.z]}isPointAboveHorizon(c,h){return!m0(c,h.x,h.y,!1)}farthestPixelDistance(c){const h=function(v,k){const C=v.cameraToCenterDistance,L=v._centerAltitude*k,F=v._camera,$=v._camera.forward(),G=he([],be([],$,-C),[0,0,L]),Z=v.worldSize/(2*Math.PI),X=[0,0,-Z],re=v.width/v.height,ne=Math.tan(v.fovAboveCenter),me=be([],F.up(),ne),ke=be([],F.right(),ne*re),je=Be([],he([],he([],$,me),ke)),Fe=[];let $e;if(new en(G,je).closestPointOnSphere(X,Z,Fe)){const Xe=he([],Fe,X),mt=_e([],Xe,G);$e=Math.cos(v.fovAboveCenter)*pe(mt)}else{const Xe=_e([],G,X),mt=_e([],X,G);Be(mt,mt);const ct=pe(Xe)-Z;$e=Math.sqrt(ct*(ct+2*Z));const _t=Math.acos($e/(Z+ct))-Math.acos(Ye($,mt));$e*=Math.cos(_t)}return 1.01*$e}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=g0(c.zoom);if(g>0){const v=I_e(c,Y(1,c.center.lat)*c.worldSize),k=c.worldSize/(2*Math.PI),C=Math.max(c.width,c.height)/c.worldSize*Math.PI;return Fn(h,v+k*(1-Math.cos(C)),Math.pow(g,10))}return h}upVector(c,h,g){return V5(h,g,c,1)}upVectorScale(c){return{metersToTile:Pf(o6(Vh(c)))}}}function F_e(f){const c=f.parallels,h=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new L_e(f);case"equirectangular":return new CHe(f);case"naturalEarth":return new THe(f);case"equalEarth":return new SHe(f);case"winkelTripel":return new AHe(f);case"albers":return h?new R_e(f):new NHe(f);case"lambertConformalConic":return h?new R_e(f):new MHe(f);case"globe":return new EHe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const IHe=Ot.types,PHe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function _M(f,c,h,g,v,k,C,L,F,$,G,Z,X){const re=L?Math.min(_x,Math.round(L[0])):0,ne=L?Math.min(_x,Math.round(L[1])):0;f.emplaceBack(c,h,Math.round(32*g),Math.round(32*v),k,C,(re<<1)+(F?1:0),0+(ne<<1),16*$,16*G,256*Z,256*X)}function bM(f,c,h){f.emplaceBack(c,h)}function wM(f,c,h,g,v,k,C){f.emplaceBack(c,h,g,v,k,C)}const z6=(f,c,h,g)=>{for(let v=0;v0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,$Ve.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,RVe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||k)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,zVe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,BVe.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())}}Jr(Roe,"SymbolBuffers");class Foe{constructor(c,h,g){this.layoutVertexArray=new c,this.layoutAttributes=h,this.indexArray=new g,this.segments=new Di,this.collisionVertexArray=new T5,this.collisionVertexArrayExt=new Ym}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,UVe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,qVe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Jr(Foe,"CollisionBuffers");class B6{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(C=>C.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=M([]),this.placementViewportMatrix=M([]);const h=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=GN(this.zoom,h["text-size"],this.worldview),this.iconSizeData=GN(this.zoom,h["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(C=>Pu[C]),this.stateDependentLayerIds=this.layers.filter(C=>C.isStateDependent()).map(C=>C.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 h=this.layers[0].getAppearances();return!(!h||h.length===0)&&h.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new Roe(new Uh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new Roe(new Uh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new TN,this.lineVertexArray=new r6,this.symbolInstances=new D5}calculateGlyphDependencies(c,h,g,v,k){for(const C of c){const L=C.codePointAt(0);if(L===void 0)break;if(h[L]=!0,v&&k&&L<=65535){const F=cM[C];F&&(h[F.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,h,g,v,k,C){let L=1;const F=c.getUnevaluatedProperties()._values["icon-size"],$=GN(this.zoom,F,this.worldview),G=KN($,h);if($.kind!=="constant"&&$.kind!=="camera"||(L=G.uSize),$.kind==="composite"){const{minZoom:Z,maxZoom:X}=$,re=F.possiblyEvaluate(new si(Z,{worldview:this.worldview}),v),ne=F.possiblyEvaluate(new si(X,{worldview:this.worldview}),v),me=re.evaluate(g,{},v,k);L=me+(ne.evaluate(g,{},v,k)-me)*G.uSizeT}return $.kind==="source"&&(L=F.possiblyEvaluate(new si(this.zoom,{worldview:this.worldview}),v).evaluate(g,{},v,k)),L*C}updateFootprints(c,h){}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const g=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!p6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?od.build(c):c}populate(c,h,g,v){const k=this.layers[0],C=k.layout,L=this.projection.name==="globe",F=C.get("text-font"),$=C.get("text-field"),G=C.get("icon-image"),[Z,X]=C.get("icon-size-scale-range"),re=ge(h.scaleFactor||1,Z,X),ne=($.value.kind!=="constant"||$.value.value instanceof id&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(F.value.kind!=="constant"||F.value.value.length>0),me=G.value.kind!=="constant"||!!G.value.value||Object.keys(G.parameters).length>0,ke=this.hasAnyAppearanceProperty("icon-image"),je=C.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!ne&&!me&&!ke)return;const Fe=h.iconDependencies,$e=h.glyphDependencies,Xe=h.availableImages,mt=new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ct=_t=>{const Ct=_t.id.toString();Fe.has(Ct)?Fe.get(Ct).push(_t):Fe.set(Ct,[_t])};for(const _t of c){const{feature:Ct,id:Et,index:Yt,sourceLayerIndex:Rt}=_t,rr=k._featureFilter.needGeometry,lr=Dt(Ct,rr);if(!k._featureFilter.filter(mt,lr,g))continue;if(rr||(lr.geometry=St(Ct,g,v)),L&&Ct.type!==1&&g.z<=5){const mr=lr.geometry,Tr=.98078528056,wr=(hn,Ur)=>Ye(V5(hn.x,hn.y,g,1),V5(Ur.x,Ur.y,g,1)){if(!mr.getProperty("icon-image"))return;const Tr=this.getCombinedIconPrimary(mr,vr,lr,g,Xe,tr,re);Tr&&ct(Tr)}),cr){const mr=F.evaluate(lr,{},g).join(","),Tr=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Pu.vertical)>=0;for(const wr of cr.sections)if(wr.image){const hn=wr.image.getPrimary().scaleSelf(this.pixelRatio),Ur=hn.id.toString(),Kr=Fe.get(Ur)||[];Kr.push(hn),Fe.set(Ur,Kr)}else{const hn=Hv(cr.toString()),Ur=wr.fontStack||mr,Kr=$e[Ur]=$e[Ur]||{};this.calculateGlyphDependencies(wr.text,Kr,Tr,this.allowVerticalPlacement,hn)}}}if(C.get("symbol-placement")==="line"&&(this.features=function(_t){const Ct={},Et={},Yt=[];let Rt=0;function rr(vr){Yt.push(_t[vr]),Rt++}function lr(vr,ur,pr){const tr=Et[vr];return delete Et[vr],Et[ur]=tr,Yt[tr].geometry[0].pop(),Yt[tr].geometry[0]=Yt[tr].geometry[0].concat(pr[0]),tr}function cr(vr,ur,pr){const tr=Ct[ur];return delete Ct[ur],Ct[vr]=tr,Yt[tr].geometry[0].shift(),Yt[tr].geometry[0]=pr[0].concat(Yt[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 Qt=xr(tr,pr),mr=xr(tr,pr,!0);if(Qt in Et&&mr in Ct&&Et[Qt]!==Ct[mr]){const Tr=cr(Qt,mr,pr),wr=lr(Qt,mr,Yt[Tr].geometry);delete Ct[Qt],delete Et[mr],Et[xr(tr,Yt[wr].geometry,!0)]=wr,Yt[Tr].geometry=null}else Qt in Et?lr(Qt,mr,pr):mr in Ct?cr(Qt,mr,pr):(rr(vr),Ct[Qt]=Rt-1,Et[mr]=Rt-1)}return Yt.filter(vr=>vr.geometry)}(this.features)),C.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",h.elevationFeatures){!this.elevationFeatures&&h.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const _t of h.elevationFeatures)this.elevationFeatureIdToIndex.set(_t.id,this.elevationFeatures.length),this.elevationFeatures.push(_t)}}else C.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,h,g,v,k,C,L){let F,$;const G=c.getUnevaluatedProperties();if(G._values["icon-image"].value!==void 0){const Z=h.getAppearanceValueAndResolveTokens(c,"icon-image",g,v,k);F=this.getResolvedImageFromTokens(Z)}else{const Z=h.getValueAndResolveTokens("icon-image",g,v,k);F=this.getResolvedImageFromTokens(Z)}if(F){const Z=G._values["icon-size"]||h._unevaluatedLayout._values["icon-size"];$=fM(F,GN(this.zoom,Z,this.worldview),Z,v,this.zoom,C,this.pixelRatio,L,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,h,g,v){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const k=this.layers[0];let C=!1,L=0;const F=k.layout,[$,G]=F.get("icon-size-scale-range"),Z=ge(1,$,G);for(let X=0;X=0){const ke=me.id,je=h&&ke!==void 0?h[String(ke)]:void 0,Fe={type:"Point",id:me.id,properties:me.properties,geometry:[]},$e=this.layers[0].appearances&&this.layers[0].appearances.find(Xe=>Xe.isActive({globals:v,feature:Fe,canonical:c,featureState:je}));if(me.activeAppearance===$e){L+=re.numIconVertices;continue}if($e){me.activeAppearance=$e;const Xe=this.getCombinedIconPrimary($e,k,Fe,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:me.properties,type:"Point",id:me.id},Z);if(!Xe)continue;const mt=Xe.toString(),ct=this.iconAtlasPositions&&this.iconAtlasPositions.get(mt);if(ct){const _t=k.getAppearanceValueAndResolveTokens($e,"icon-offset",Fe,c,g),Ct=_t&&Array.isArray(_t)?_t:[0,0];let Et=A6(ct,void 0,Ct,k.layout.get("icon-anchor").evaluate(Fe,{},c));const Yt=k.getAppearanceValueAndResolveTokens($e,"icon-rotate",Fe,c,g),Rt=typeof Yt=="number"?Yt:0,rr=ct.sdf,lr=k.layout.get("icon-text-fit").constantOr("none");lr!=="none"&&me.textShaping&&me.iconTextFitPadding&&me.fontScale&&(Et=Toe(Et,me.textShaping,lr,me.iconTextFitPadding,Ct,me.fontScale));const cr=this.calculateEffectiveAppearanceIconSize($e,v.zoom,Fe,c,g,Z),xr=0,vr=1+(Math.min(_x,Math.round(cr*Bp))<<1),ur=Poe(Et,Rt,rr,lr!=="none",Z);me.isUsingAppearanceVertexData||(me.isUsingAppearanceVertexData=!0,me.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),C=!0),L+=re.numIconVertices,me.activeAppearance=null;else if(me.isUsingAppearanceVertexData){const mt=me.layoutBasedVertexData.length/12;for(let ct=0;ct0||X>0,ke=re>0,je=this.elevationFeatures[F.elevationFeatureIndex];if(je){const Fe=new ir(F.tileAnchorX,F.tileAnchorY),$e=.075+je.pointElevation(Fe);F.zOffset!==$e&&(h=!0,F.zOffset=$e),$e!==0&&(this.hasAnyZOffset=!0);const Xe=je.computeSlopeNormal(Fe,v),mt=Pn(gt(),se(0,0,1),Xe);Ve($,$,mt),Ve(G,G,mt),$[2]*=g,G[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&G[0]===0&&G[1]===1&&G[2]===0||(k=k||me,C=C||ke)}if(me&&(z6(this.text.orientationVertexArray,Z,$,G),z6(this.text.orientationVertexArray,X,$,G)),ke){const{placedIconSymbolIndex:Fe,verticalPlacedIconSymbolIndex:$e}=F;Fe>=0&&z6(this.icon.orientationVertexArray,re,$,G),$e>=0&&z6(this.icon.orientationVertexArray,ne,$,G)}}k||(this.text.orientationVertexArray=void 0),C||(this.icon.orientationVertexArray=void 0),h&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(k,C,L)=>{g+=C,g>k.length&&k.resize(g);for(let F=-C;F<0;F++)k.emplace(F+g,L)},h=(k,C,L)=>{v+=C,v>k.length&&k.resize(v);for(let F=-C;F<0;F++)k.emplace(F+v,L)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,v=0;for(let k=0;k0;if((L>0||F>0)&&(c(this.text.zOffsetVertexArray,L,G),c(this.text.zOffsetVertexArray,F,G)),Z){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:re}=C;X>=0&&h(this.icon.zOffsetVertexArray,$,G),re>=0&&h(this.icon.zOffsetVertexArray,C.numVerticalIconVertices,G)}}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,h,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(C=>C.appearances&&C.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,h,g,v){return!!(c&&h&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,h,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=F_e(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,h){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:v,y:k}of h)this.lineVertexArray.emplaceBack(v,k);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me,ke,je,Fe){const $e=c.indexArray,Xe=c.layoutVertexArray,mt=c.globeExtVertexArray,ct=c.segments.prepareSegment(4*Fe,Xe,$e,this.canOverlap?C.sortKey:void 0),_t=this.glyphOffsetArray.length,Ct=ct.vertexLength,Et=this.allowVerticalPlacement&&L===Pu.vertical?Math.PI/2:0,Yt=C.text&&C.text.sections;for(let lr=0;lr=0?h.rightJustifiedTextSymbolIndex:h.centerJustifiedTextSymbolIndex>=0?h.centerJustifiedTextSymbolIndex:h.leftJustifiedTextSymbolIndex>=0?h.leftJustifiedTextSymbolIndex:h.verticalPlacedTextSymbolIndex>=0?h.verticalPlacedTextSymbolIndex:v),C=Aoe(this.textSizeData,c,k)/_l;return this.tilePixelRatio*C}getSymbolInstanceIconSize(c,h,g){const v=this.icon.placedSymbolArray.get(g),k=Aoe(this.iconSizeData,c,v);return this.tilePixelRatio*k}_commitDebugCollisionVertexUpdate(c,h,g,v){c.emplaceBack(h,-g,-g,v),c.emplaceBack(h,g,-g,v),c.emplaceBack(h,g,g,v),c.emplaceBack(h,-g,g,v)}_updateTextDebugCollisionBoxes(c,h,g,v,k,C,L){for(let F=v;F0}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,h){const g=c.placedSymbolArray.get(h),v=g.vertexStartIndex+4*g.numGlyphs;for(let k=g.vertexStartIndex;kv[L]-v[F]||k[F]-k[L]),C}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(h).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,h){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===h?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:h,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 h of this.symbolInstanceIndexes){const g=this.symbolInstances.get(h);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:v,centerJustifiedTextSymbolIndex:k,leftJustifiedTextSymbolIndex:C,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:F,verticalPlacedIconSymbolIndex:$}=g;v>=0&&this.addIndicesForPlacedSymbol(this.text,v),k>=0&&k!==v&&this.addIndicesForPlacedSymbol(this.text,k),C>=0&&C!==k&&C!==v&&this.addIndicesForPlacedSymbol(this.text,C),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),F>=0&&this.addIndicesForPlacedSymbol(this.icon,F),$>=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 h=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&hg in f?String(f[g]):"")}let B_e,$_e,zoe;Jr(B6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),B6.addDynamicAttributes=QN;class U_e{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Rh,this.defaultValue=c}evaluate(c){if(c.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(c.formattedSection))return h.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}}Jr(U_e,"FormatSectionOverride",{omit:["defaultValue"]});const Boe=()=>zoe||(zoe={layout:B_e||(B_e=new Gi({"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:$_e||($_e=new Gi({"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:Pd,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"})}))},zoe);class $6 extends dd{constructor(c,h,g,v){super(c,Boe(),h,g,v,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=M([]),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,h){super.recalculate(c,h),this.appearances&&this.appearances.forEach(v=>{v.recalculate(c,h,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,h,g,v){return this._saturation===c&&this._contrast===h&&this._brightnessMin===g&&this._brightnessMax===v||(this._colorAdjustmentMatrix=function(k,C,L,F){k=Si(k),C=Ks(C);const $=S(),G=k/3,Z=1-2*G,X=[Z,G,G,0,G,Z,G,0,G,G,Z,0,0,0,0,1],re=.5-.5*C,ne=F-L;return A($,[ne,0,0,0,0,ne,0,0,0,0,ne,0,L,L,L,1],[C,0,0,0,0,C,0,0,0,0,C,0,re,re,re,1]),A($,$,X),$}(c,h,g,v),this._saturation=c,this._contrast=h,this._brightnessMin=g,this._brightnessMax=v),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,h,g,v){const k=this.layout.get(c).evaluate(h,{},g,v),C=this._unevaluatedLayout._values[c];return C.isDataDriven()||qv(C.value)||!k?k:z_e(h.properties,k)}getAppearanceValueAndResolveTokens(c,h,g,v,k){const C=c.getProperty(h);if(!C)return;const L=C.evaluate(g,{},v,k),F=c.getUnevaluatedProperties()._values[h];return F.isDataDriven()||qv(F.value)||!L||typeof L!="string"?L:z_e(g.properties,L)}createBucket(c){return new B6(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of Boe().paint.overridableProperties){if(!$6.hasPaintOverride(this.layout,c))continue;const h=this.paint.get(c),g=new U_e(h),v=new aN(g,h.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let k=null;k=h.value.kind==="constant"||h.value.kind==="source"?new s0("source",v):new ox("composite",v,h.value.zoomStops,h.value.interpolationType),this.paint._values[c]=new cx(h.property,k,h.parameters)}}_handleOverridablePaintPropertyUpdate(c,h,g){return!(!this.layout||h.isDataDriven()||g.isDataDriven())&&$6.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,h){const g=c.get("text-field"),v=Boe().paint.properties[h];let k=!1;const C=L=>{for(const F of L)if(v.overrides&&v.overrides.hasOverride(F))return void(k=!0)};if(g.value.kind==="constant"&&g.value.value instanceof id)C(g.value.value.sections);else if(g.value.kind==="source"){const L=$=>{k||($ instanceof kp&&vl($.value)===Mv?C($.value.sections):$ instanceof Nf?C($.sections):$.eachChild(L))},F=g.value;F._styleExpression&&L(F._styleExpression.expression)}return k}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,h,g){return{config:new Qm(this,{zoom:h,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let q_e,V_e,H_e,W_e;var $oe=Es([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function U6(f,c,h,g,v,k,C,L){const F=[f,c,1,h,g,1,v,k,1],$=[C,L,1],G=_([],F),[Z,X,re]=le($,$,G);return w(F,F,[Z,0,0,0,X,0,0,0,re])}function G_e(f,c,h,g,v,k,C,L){const F=function($,G,Z,X,re,ne,me,ke){const je=U6(0,0,1,0,1,1,0,1),Fe=U6($,G,Z,X,re,ne,me,ke);return w(Fe,Fe,_([],je))}(f,c,h,g,v,k,C,L);return[F[2]/F[8]/Cr,F[5]/F[8]/Cr]}function q6(f){return[f[0],Math.min(Math.max(f[1],-ue),ue)]}class K_e extends gi{constructor(c,h,g,v){super(),this.id=c,this.dispatcher=g,this.coordinates=h.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=h,this._dirty=!1}load(c,h){if(this._loaded=h||!1,this.fire(new Wn("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=qy(this.map._requestManager.transformRequest(this.url,Jg.Image),(g,v)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new ns(g)):v&&(this.image=v instanceof HTMLImageElement?Vo.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 iM(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 Wn("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 iM||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 h=c[0][1],g=c[0][1];for(const k of c)k[1]>g&&(g=k[1]),k[1]ue?this.onNorthPole=!0:v<-ue&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const k=c.map(He.fromLngLat);this.tileID=function(C){let L=1/0,F=1/0,$=-1/0,G=-1/0;for(const me of C)L=Math.min(L,me.x),F=Math.min(F,me.y),$=Math.max($,me.x),G=Math.max(G,me.y);const Z=Math.max($-L,G-F),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 Ka(X,ne,Math.floor((F+G)/2*re))}(k),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Wn("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof iM||(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 Fe=this.tiles[je];Fe.state!=="loaded"&&(Fe.state="loaded",Fe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const h=mM(new Ka(0,0,0),this.map.transform.projection),g=[h.projection.project(this.coordinates[0][0],this.coordinates[0][1]),h.projection.project(this.coordinates[1][0],this.coordinates[1][1]),h.projection.project(this.coordinates[2][0],this.coordinates[2][1]),h.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(je){const Fe=je[1].x-je[0].x,$e=je[1].y-je[0].y,Xe=je[2].x-je[1].x,mt=je[2].y-je[1].y,ct=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,Yt=Fe*mt-Xe*$e,Rt=Xe*_t-ct*mt,rr=ct*Et-Ct*_t,lr=Ct*$e-Fe*Et;return Yt>0&&Rt>0&&rr>0&&lr>0||Yt<0&&Rt<0&&rr<0&&lr<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const v=mM(this.tileID,this.map.transform.projection),[k,C,L,F]=this.coordinates.map(je=>{const Fe=v.projection.project(je[0],je[1]);return P_e(v,Fe)._round()});this.perspectiveTransform=G_e(k.x,k.y,C.x,C.y,L.x,L.y,F.x,F.y);const $=this._boundsArray=new l0;$.emplaceBack(k.x,k.y,0,0),$.emplaceBack(C.x,C.y,Cr,0),$.emplaceBack(F.x,F.y,0,Cr),$.emplaceBack(L.x,L.y,Cr,Cr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,$oe.members),this.boundsSegments=Di.simpleSegment(0,0,4,2);const G=[],Z=[q6((X=this.coordinates)[0]),q6(X[1]),q6(X[2]),q6(X[3])];var X;const[re,ne,me,ke]=function(je){let Fe=je[0][0],$e=Fe,Xe=je[0][1],mt=Xe;for(let ct=1;ct$e&&($e=je[ct][0]),je[ct][1]mt&&(mt=je[ct][1]);return[Fe,Xe,$e-Fe,mt-Xe]}(Z);{const je=new l0,[Fe,$e,Xe,mt]=function(ur){let pr=ur[0].x,tr=pr,Qt=ur[0].y,mr=Qt;for(let Tr=1;Trtr&&(tr=ur[Tr].x),ur[Tr].ymr&&(mr=ur[Tr].y);return[pr,Qt,tr-pr,mr-Qt]}(g),ct=ur=>[(ur.x-Fe)/Xe,(ur.y-$e)/mt],[_t,Ct,Et,Yt]=g.map(ct),Rt=function(ur,pr,tr,Qt,mr,Tr,wr,hn){const Ur=U6(0,0,1,0,1,1,0,1);return w(Ur,Ur,_([],U6(ur,pr,tr,Qt,mr,Tr,wr,hn)))}(_t[0],_t[1],Ct[0],Ct[1],Et[0],Et[1],Yt[0],Yt[1]);this.elevatedGlobePerspectiveTransform=G_e(_t[0],_t[1],Ct[0],Ct[1],Et[0],Et[1],Yt[0],Yt[1]);const rr=(ur,pr)=>{G.push(ur.lng);const tr=Math.round((ur.lng-re)/me*Cr),Qt=Math.round((ur.lat-ne)/ke*Cr),mr=ct(pr),Tr=le([],[mr[0],mr[1],1],Rt),wr=Math.round(Tr[0]/Tr[2]*Cr),hn=Math.round(Tr[1]/Tr[2]*Cr);je.emplaceBack(tr,Qt,wr,hn)},lr=g[3].x-g[0].x,cr=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*lr,g[0].y+pr*cr],Qt=[g[1].x+pr*xr,g[1].y+pr*vr],mr=Qt[0]-tr[0],Tr=Qt[1]-tr[1];for(let wr=0;wr<65;wr++){const hn=wr/64,Ur={x:tr[0]+mr*hn,y:tr[1]+Tr*hn};rr(h.projection.unproject(Ur.x,Ur.y),Ur)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(je,$oe.members)}{this.maxLongitudeTriangleSize=0;let je=[],Fe=new Ho;const $e=(Xe,mt,ct)=>{Fe.emplaceBack(Xe,mt,ct);const _t=G[Xe],Ct=G[mt],Et=G[ct],Yt=Math.min(Math.min(_t,Ct),Et),Rt=Math.max(Math.max(_t,Ct),Et)-Yt;Rt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Rt),je.push(Yt+Rt/2)};for(let Xe=0;Xe<64;Xe++)for(let mt=0;mt<64;mt++){const ct=65*Xe+mt,_t=ct+1,Ct=ct+65,Et=Ct+1;$e(ct,Ct,_t),$e(_t,Ct,Et)}[je,Fe]=function(Xe,mt){const ct=Array.from({length:Xe.length},(Et,Yt)=>Yt);ct.sort((Et,Yt)=>Xe[Et]-Xe[Yt]);const _t=[],Ct=new Ho;for(let Et=0;Et{C.segments.push({vertexOffset:0,primitiveOffset:Z,vertexLength:h.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},F=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-v)<=F){const Z=Ni(g,0,g.length,v+F);return Z===g.length||L(Z,_o(g,Z+1,g.length,v+360-F)-Z),C}vCr?v-Cr:v,new ir(Math.trunc(v),Math.trunc(g[h+1]))}translationForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+4],g[h+5],g[h+6]]}rotationScaleForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+7],g[h+8],g[h+9],g[h+10],g[h+11],g[h+12],g[h+13],g[h+14],g[h+15]]}transformForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+7],g[h+8],g[h+9],g[h+4],g[h+10],g[h+11],g[h+12],g[h+5],g[h+13],g[h+14],g[h+15],g[h+6],0,0,0,1]}}class Voe{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(h=>h.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.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,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.tileToMeter=Ie(g);const k=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:C,id:L,index:F,sourceLayerIndex:$}of c){const G=L??(C.properties&&C.properties.hasOwnProperty("id")?C.properties.id:void 0),Z=Dt(C,k);if(!this.layers[0]._featureFilter.filter(new si(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const X={id:G,sourceLayerIndex:$,index:F,geometry:k?Z.geometry:St(C,g,v),properties:C.properties,type:C.type,patterns:{}},re=this.addFeature(X,X.geometry,Z);re&&h.featureIndex.insert(C,X.geometry,F,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Cr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,h=this.layers[0].scope;let g=0;for(const v of this.modelUris){const k=c.getModel(v,h);if(!k)continue;const C=this.instancesPerModel[v];if(C){const L=.5*Te(k.aabb.max,k.aabb.min)*C.maxScale+C.maxXYTranslationDistance,F=Math.min(Cr,Math.max(L/this.tileToMeter,Cr/32));g=Math.max(F,g)}}return g}update(c,h,g,v){for(const k in this.instancesPerModel){const C=this.instancesPerModel[k];for(const L in c)C.idToFeaturesIndex.hasOwnProperty(L)&&(this.evaluate(C.features[C.idToFeaturesIndex[L]],c[L],C,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const h in this.instancesPerModel){const g=this.instancesPerModel[h];for(const v of g.features){const k=this.layers[0],C=v.feature,L=this.canonical,F=k.paint.get("model-rotation").evaluate(C,{},L),$=k.paint.get("model-scale").evaluate(C,{},L),G=k.paint.get("model-translation").evaluate(C,{},L);We(v.rotation,F)&&We(v.scale,$)&&We(v.translation,G)||(this.evaluate(v,v.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,h,g,v){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const k=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(p6(this.activeReplacements,k))return!1;this.activeReplacements=k;let C=!1;for(const L in this.instancesPerModel){const F=this.instancesPerModel[L],$=F.instancedDataArray;for(const G of F.features){const Z=G.instancedDataOffset,X=G.instancedDataCount;for(let re=0;reCr;me=ke?me-Cr:me;const je=Math.floor(me),Fe=Math.floor($.float32[ne+1]);let $e=!1;for(const Xe of this.activeReplacements)if(!V1e(Xe,g,r2e.Model,v)&&!(Xe.min.x>je||je>Xe.max.x||Xe.min.y>Fe||Fe>Xe.max.y)&&($e=Z1e(K1e(je,Fe,c.canonical,Xe.footprintTileId.canonical),Xe.footprint),$e))break;$.float32[ne]=$e?me+Cr:me,C=C||$e!==ke}}}return C}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 h in this.instancesPerModel){const g=this.instancesPerModel[h];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=c.createVertexBuffer(g.instancedDataArray,aVe.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 h=this.layers[0].modelManager;if(c&&h&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)h.removeModel(g,"",!0)}addFeature(c,h,g){const v=this.layers[0],k=v.layout.get("model-id").evaluate(g,{},this.canonical);if(!k)return Vr(`modelId is not evaluated for layer ${v.id} and it is not going to get rendered.`),k;(qoe(k,!1)||this.styleDefinedModelURLs[k]!==void 0)&&(this.modelUris.includes(k)||this.modelUris.push(k)),this.instancesPerModel[k]||(this.instancesPerModel[k]=new s2e);const C=this.instancesPerModel[k],L=C.instancedDataArray,F=new n2e(g,L.length);for(const $ of h)for(const G of $){if(G.x<0||G.x>=Cr||G.y<0||G.y>=Cr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Cr,re=this.lookupDim*(G.y*X|0)+G.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),C.instancesEvaluatedElevation.push(0),L.float32[16*Z]=G.x,L.float32[16*Z+1]=G.y}return F.instancedDataCount=C.instancedDataArray.length-F.instancedDataOffset,F.instancedDataCount>0&&(c.id&&(C.idToFeaturesIndex[c.id]=C.features.length),C.features.push(F),this.evaluate(F,{},C,!1)),k}getModelUris(){return this.modelUris}evaluate(c,h,g,v){const k=this.layers[0],C=c.feature,L=this.canonical,F=c.rotation=k.paint.get("model-rotation").evaluate(C,h,L),$=c.scale=k.paint.get("model-scale").evaluate(C,h,L),G=c.translation=k.paint.get("model-translation").evaluate(C,h,L),Z=Object.assign({},k.paint.get("model-color").evaluate(C,h,L));Z.a=k.paint.get("model-color-mix-intensity").evaluate(C,h,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])),Ove(X,F,$);const me=Math.round(100*Z.a)+Z.b/1.05;for(let ke=0;ke10?this.tileToMeter:Ie(L,mt)),$e[Fe+4]=G[0],$e[Fe+5]=G[1],$e[Fe+6]=G[2]+Xe,$e[Fe+7]=X[0],$e[Fe+8]=X[1],$e[Fe+9]=X[2],$e[Fe+10]=X[4],$e[Fe+11]=X[5],$e[Fe+12]=X[6],$e[Fe+13]=X[8],$e[Fe+14]=X[9],$e[Fe+15]=X[10],g.instancesEvaluatedElevation[je]=G[2]}}}let a2e,i2e;Jr(Voe,"ModelBucket",{omit:["layers"]}),Jr(s2e,"PerModelAttributes"),Jr(n2e,"ModelFeature");class JN{constructor(c,h,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=h,this._offset=g}static create(c,h,g){const v=g||c.findDEMTileFor(h);if(!v||!v.dem)return;const k=v.dem,C=v.tileID,L=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=VN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,v&&(this.modelTraits|=VN.HasMapboxMeshFeatures),k&&(this.modelTraits|=VN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=C,this.worldview=F,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of h)this.nodesInfo.push(new d2e($)),l2e($,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,h){for(const g of this.getNodesInfo()){const v=g.node;v.footprint&&h.push({footprint:v.footprint,id:c})}}updateAppearances(c,h,g,v){}update(c){const h=Object.keys(c).length!==0;if(h&&!this.stateDependentLayers.length)return;const g=h?this.stateDependentLayers:this.layers;if(!po(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 h=this.getNodesInfo();for(const g of h){const v=g.node;this.uploaded?this.updatePbrBuffer(v):moe(v,c,!0)}for(const g of h)S6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let h=!1;if(!c.meshes)return h;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),h=!0);return h}needsReEvaluation(c,h,g){const v=c.transform.projectionOptions,k=c.style.getBrightness(),C=this.brightness!==k;if(!this.uploaded||this.dirty||v.name!==this.projection.name||jM(g.paint.get("model-color").value,C)||jM(g.paint.get("model-color-mix-intensity").value,C)||jM(g.paint.get("model-roughness").value,C)||jM(g.paint.get("model-emissive-strength").value,C)||jM(g.paint.get("model-height-based-emissive-strength-multiplier").value,C)){this.projection=v,this.brightness=k;const L=this.getNodesInfo();for(const F of L)F.state=null;return!0}return!1}evaluateTransform(c,h){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 C=k.feature;k.evaluatedTranslation=h.paint.get("model-translation").evaluate(C,{},v),k.evaluatedScale=h.paint.get("model-scale").evaluate(C,{},v)}}evaluate(c,h){const g=this.getNodesInfo();for(const v of g){if(!v.node.meshes)continue;const k=v.feature,C=h&&h[k.id];if(po(C,v.state))continue;v.state=structuredClone(C);const L=v.node.meshes&&v.node.meshes[0].featureData,F=v.evaluatedColor[2],$=v.evaluatedRMEA[2],G=this.id.canonical;if(v.hasTranslucentParts=!1,L){for(let Z=0;Z=ct)continue;const ur=Hoe[vr],pr=Math.abs(ur);pr>Rt&&(Yt=ur,Rt=pr,rr=xr,lr=cr)}if(Rt>.1){const cr=1-(ct+.5*Math.abs(rr*lr))/ne;let xr=h._dem.get(Ct,_t)+Yt*cr;const vr=h._dem.get(Ct+rr,_t+lr),ur=h._dem.get(Ct-rr,_t-lr,!0);(xr-vr)*(xr-ur)>0&&(xr=(vr+ur)/2),Hoe[Et]=h._dem.set(Ct,_t,xr),u_[Et]=ct}}}}}L&&(h._demTile.needsDEMTextureUpload=!0,h._dem._timestamp=Vo.now())}setFilter(c){this.filter=c?pN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new si(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const h of c)S6(h.node),goe(h.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=h.updateTime;const g=h.getReplacementRegionsForTile(c.toUnwrapped());for(const v of this.getNodesInfo()){const k=v.node.footprint;v.hiddenByReplacement=!!k&&!g.find(C=>C.footprint===k)}}getHeightAtTileCoord(c,h){const g=[],v=[0,0,0],k=M([]);for(const C of this.getNodesInfo()){const L=C.node.meshes[0],F=L.transformedAabb;if(cF.max[0]||h>F.max[1])continue;if(C.node.hidden===!0)return{height:1/0,maxHeight:C.feature.properties.height,hidden:!1,verticalScale:C.evaluatedScale[2]};E(k,C.node.globalMatrix),v[0]=c,v[1]=h,Qe(v,v,k);const $=(v[0]-L.aabb.min[0])/(L.aabb.max[0]-L.aabb.min[0])*l_|0,G=Math.min(63,(v[1]-L.aabb.min[1])/(L.aabb.max[1]-L.aabb.min[1])*l_|0)*l_+Math.min(63,$),Z=L.heightmap[G];if(!(Z<0&&C.node.footprint))return C.hiddenByReplacement?void 0:{height:Z,maxHeight:C.feature.properties.height,hidden:!1,verticalScale:C.evaluatedScale[2]};if(C.node.footprint.grid.query(new ir(c,h),new ir(c,h),g),g.length>0)return{height:void 0,maxHeight:C.feature.properties.height,hidden:C.hiddenByReplacement,verticalScale:C.evaluatedScale[2]}}}}function jM(f,c){return f instanceof s0&&!f.isLightConstant&&c}function RHe(f,c,h,g,v,k,C,L){let F=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,G=240&c|(240&c)>>4;h[3]>0&&(F=Fn(F,255*h[0],h[3]),$=Fn($,255*h[1],h[3]),G=Fn(G,255*h[2],h[3]));const Z=F<<8|$,X=G<<8|Math.floor(255*g[3]),re=function(ct){const _t=ge(ct,0,2);return Math.min(Math.round(.5*_t*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],ne=ge(v[0],0,1),me=ge(v[1],0,1),ke=ge(v[2],0,1),je=ge(v[3],0,1);let Fe,$e,Xe,mt;if(ne!==me&&C!==k&&me!==ne){const ct=C-k;$e=1/(ct*(me-ne)),Xe=-(k+ct*ne)/(ct*(me-ne));const _t=ge(v[4],-1,1);mt=Math.pow(10,_t),Fe=255*ke<<8|255*je}else Fe=65535,$e=0,Xe=1,mt=1;if(f.emplaceBack(Z,X,re,Fe,$e,Xe,mt),L){const ct=L.length;L.clear();for(let _t=0;_t>16&65535,G=k?F>>16&65535:65535&F,Z=(15&G)<8?15&G:0,X=f.evaluatedRMEA[Z],re=f.evaluatedColor[Z],ne=f.emissionHeightBasedParams[Z];let me;if(L&&Z===2&&g.lights&&(me=new NN,me.resize(10*g.lights.length)),RHe(C.featureArray,$,re,X,ne,C.aabb.min[2],C.aabb.max[2],me),me&&L){L=!1;const ke=g.meshes[g.lightMeshIndex];ke.featureArray=me,ke.featureArray._trim()}}C.featureArray._trim(),v++}}Jr(H6,"Tiled3dModelBucket",{omit:["layers"]}),Jr(d2e,"Tiled3dModelFeature");const zHe=["id","tile","layer","source","sourceLayer","state"];class h_{constructor(c,h,g,v,k){this.type="Feature",this._vectorTileFeature=c,this._z=h,this._x=g,this._y=v,this.properties=c?c.properties:{},this.id=k}clone(){const c=new h_(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 h of zHe)this[h]!==void 0&&(c[h]=this[h]);return c}}class f_ extends gi{constructor(c,h,g,v){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=h,this._modelsInfo=new Map}load(){const c=[];for(const h in this._options.models){const g=this._options.models[h],v=this._modelsInfo.get(h);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,f_.applyModelSpecification(k,g),k.computeBoundsAndApplyParent(),this.models.push(k)}else{const k=Eve(this.map._requestManager.transformRequest(g.uri,Jg.Model).url).then(C=>{if(!C)return;const L=yoe(C),F=new Dve(h,g.uri,g.position,g.orientation,L);f_.applyModelSpecification(F,g),F.computeBoundsAndApplyParent(),this.models.push(F),this._modelsInfo.set(h,{modelSpec:g,model:F})}).catch(C=>{this.fire(new ns(new Error(`Could not load model ${h} from ${g.uri}: ${C.message}`)))});c.push(k)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new Wn("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(h=>{this._loaded=!0,this.fire(new ns(new Error(`Could not load models: ${h.message}`)))})}static applyModelSpecification(c,h){h.nodeOverrides&&f_.convertNodeOverrides(c,h.nodeOverrides),h.materialOverrides&&f_.convertMaterialOverrides(c,h.materialOverrides),h.nodeOverrideNames&&(c.nodeOverrideNames=[...h.nodeOverrideNames]),h.materialOverrideNames&&(c.materialOverrideNames=[...h.materialOverrideNames]),h.featureProperties&&(c.featureProperties=h.featureProperties)}static convertNodeOverrides(c,h){if(Array.isArray(h)&&h.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of h)c.nodeOverrideNames.push(g)}else Object.entries(h).forEach(([g,v])=>{const k={orientation:[0,0,0]};if(v.hasOwnProperty("orientation")){const C=v.orientation;C&&(k.orientation=C)}c.nodeOverrides.set(g,k)})}static convertMaterialOverrides(c,h){if(Array.isArray(h)&&h.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of h)c.materialOverrideNames.push(g)}else Object.entries(h).forEach(([g,v])=>{const k={color:new Ta(1,1,1),colorMix:0,emissionStrength:0,opacity:1},C=v["model-color"];C!==void 0&&(k.color.r=C[0],k.color.g=C[1],k.color.b=C[2]);const L=v["model-color-mix-intensity"];L!==void 0&&(k.colorMix=L);const F=v["model-emissive-strength"];F!==void 0&&(k.emissionStrength=F);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,h){}serialize(){return this._options}setProperty(c,h){return!1}reload(){const c=$h(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const h=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&&h.set(g,k)}}this._modelsInfo=h,this._options.models=c,this._loaded=!1,this.load()}}function Woe(f,c,h,g){const v=1<Xe.polygon).flat());const ke=re?L:null,[je,Fe]=vve(k,g,Z,G,$,C,ke,X,ne,k.center.lat,f.tileID.canonical),$e=f.queryGeometry;return yve(je,Fe,$e.isPointQuery()?$e.screenBounds:$e.screenGeometry)}},building:class extends dd{constructor(f,c,h,g){super(f,{layout:qve||(qve=new Gi({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:Vve||(Vve=new Gi({"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,h,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,h,g,v,k,C,L,F){let $=this.layout.get("building-height").evaluate(c,h);const G=this.layout.get("building-base").evaluate(c,h),Z=f.tile.getBucket(this).getFootprint(c);if(Z){if(Z.hiddenFlags!==0)return!1;$=Z.height}const[X,re]=vve(k,g,G,$,new ir(0,0),C,null,[0,0],1,k.center.lat,f.tileID.canonical),ne=f.queryGeometry;return yve(X,re,ne.isPointQuery()?ne.screenBounds:ne.screenGeometry)}},line:class extends dd{constructor(f,c,h,g){const v=e_e();super(f,v,c,h,g),v.layout&&(this.layout=new dx(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 Rv,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(lM)return lM;const h=e_e();return lM=new OVe(h.paint.properties["line-width"].specification),lM.useIntegerZoom=!0,lM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new boe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,h){const g=Qve(this);return{config:new Qm(this,{zoom:c,lut:h}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,h=t_e(Mc("line-width",this,c),Mc("line-gap-width",this,c)),g=Mc("line-offset",this,c);return h/2+Math.abs(g)+Wl(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,h,g,v,k){if(f.queryGeometry.isAboveHorizon)return!1;const C=Eu(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,f.pixelToTileUnitsFactor),L=f.pixelToTileUnitsFactor/2*t_e(this.paint.get("line-width").evaluate(c,h),this.paint.get("line-gap-width").evaluate(c,h)),F=this.paint.get("line-offset").evaluate(c,h);return F&&(g=function($,G){const Z=[],X=new ir(0,0);for(let re=0;re<$.length;re++){const ne=$[re],me=[];for(let ke=0;ke=3){for(let ne=0;ne>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function eWe(f,c,h){f===1?(c.rgb_color=Z6(h.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=h.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=h.readVarint(),c.paint="radial_gradient_idx"):f===5?h.readPackedFloat(c.dasharray):f===6?c.dashoffset=h.readFloat():f===7?c.miterlimit=h.readFloat():f===8?c.opacity=h.readVarint():f===9?c.width=h.readFloat():f===10?c.linecap=h.readVarint():f===11&&(c.linejoin=h.readVarint())}function tWe(f,c,h){f===1?c.transform=K6(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(p2e(h,h.readVarint()+h.pos)):f===4?c.x1=h.readFloat():f===5?c.y1=h.readFloat():f===6?c.x2=h.readFloat():f===7&&(c.y2=h.readFloat())}function p2e(f,c){return f.readFields(rWe,{offset:0,opacity:255,rgb_color:Goe},c)}function rWe(f,c,h){f===1?c.offset=h.readFloat():f===2?c.opacity=h.readVarint():f===3&&(c.rgb_color=Z6(h.readVarint()))}function nWe(f,c,h){f===1?c.transform=K6(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(p2e(h,h.readVarint()+h.pos)):f===4?c.cx=h.readFloat():f===5?c.cy=h.readFloat():f===6?c.r=h.readFloat():f===7?c.fx=h.readFloat():f===8?c.fy=h.readFloat():f===9&&(c.fr=h.readFloat())}function sWe(f,c,h){f===1?c.transform=K6(h,h.readVarint()+h.pos):f===2?c.clip_path_idx=h.readVarint():f===3&&c.children.push(G6(h,h.readVarint()+h.pos))}function aWe(f,c,h){f===1?c.left=c.top=h.readFloat():f===2?c.width=c.height=h.readFloat():f===3?c.top=h.readFloat():f===4?c.height=h.readFloat():f===5?c.mask_type=h.readVarint():f===6?c.mask_idx=h.readVarint():f===7&&c.children.push(G6(h,h.readVarint()+h.pos))}class iWe{static calculate(c={},h=[]){const g=new Map,v=new Map;if(Object.keys(c).length===0)return g;h.forEach(k=>{v.set(k.name,k.rgb_color||new Ta(0,0,0))});for(const[k,C]of Object.entries(c))v.has(k)?g.set(v.get(k).toString(),C):console.warn(`Ignoring unknown image variable "${k}"`);return g}}function e4(f,c=255,h){const g=c/255,v=f.toString(),k=h.has(v)?h.get(v).clone():f.clone();return k.a*=g,k.toString()}function NM(f,c){if(!th()){const h=document.createElement("canvas");return h.width=f,h.height=c,h}return new OffscreenCanvas(f,c)}let Yoe,SM=null;function Xoe(f,c,h,g,v){for(const k of g.children)m2e(f,c,h,k,v)}function m2e(f,c,h,g,v){g.group?(f.save(),function(k,C,L,F,$){const G=F.mask_idx!=null?L.masks[F.mask_idx]:null,Z=F.clip_path_idx!=null?L.clip_paths[F.clip_path_idx]:null;if(F.transform&&(C=t4(F.transform).preMultiplySelf(C)),!function(ne,me,ke){return ne.opacity!==255||me||ke}(F,Z!=null,G!=null))return void Xoe(k,C,L,F,$);const X=NM(k.canvas.width,k.canvas.height),re=X.getContext("2d");Xoe(re,C,L,F,$),Z&&w2e(re,C,L,Z),G&&j2e(re,C,L,G,$),k.globalAlpha=F.opacity/255,k.drawImage(X,0,0)}(f,c,h,g.group,v),f.restore()):g.path&&(f.save(),function(k,C,L,F,$){k.setTransform(C),F.paint_order===UHe.PAINT_ORDER_FILL_AND_STROKE?(g2e(k,L,F,$),y2e(k,L,F,$)):(y2e(k,L,F,$),g2e(k,L,F,$))}(f,c,h,g.path,v),f.restore())}function g2e(f,c,h,g){const v=h.fill;if(!v)return;const k=v.opacity/255;switch(f.save(),f.beginPath(),k2e(h,f),v.paint){case"rgb_color":f.fillStyle=e4(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":{const C=c.linear_gradients[v.linear_gradient_idx];C.transform&&f.setTransform(t4(C.transform).preMultiplySelf(f.getTransform())),f.fillStyle=v2e(f,C,k,g);break}case"radial_gradient_idx":{const C=c.radial_gradients[v.radial_gradient_idx];C.transform&&f.setTransform(t4(C.transform).preMultiplySelf(f.getTransform())),f.fillStyle=_2e(f,C,k,g)}}f.fill(x2e(h)),f.restore()}function x2e(f){return f.rule===Koe.PATH_RULE_NON_ZERO?"nonzero":f.rule===Koe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function y2e(f,c,h,g){const v=h.stroke;if(!v)return;const k=N2e(h);f.lineWidth=v.width,f.miterLimit=v.miterlimit,f.setLineDash(v.dasharray),f.lineDashOffset=v.dashoffset;const C=v.opacity/255;switch(v.paint){case"rgb_color":f.strokeStyle=e4(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=v2e(f,c.linear_gradients[v.linear_gradient_idx],C,g,!0);break;case"radial_gradient_idx":f.strokeStyle=_2e(f,c.radial_gradients[v.radial_gradient_idx],C,g,!0)}switch(v.linejoin){case W6.LINE_JOIN_MITER_CLIP:case W6.LINE_JOIN_MITER:f.lineJoin="miter";break;case W6.LINE_JOIN_ROUND:f.lineJoin="round";break;case W6.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(v.linecap){case Zoe.LINE_CAP_BUTT:f.lineCap="butt";break;case Zoe.LINE_CAP_ROUND:f.lineCap="round";break;case Zoe.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(k)}function v2e(f,c,h,g,v=!1){if(c.stops.length===1){const X=c.stops[0];return e4(X.rgb_color,X.opacity*h,g)}const{x1:k,y1:C,x2:L,y2:F}=c;let $=new DOMPoint(k,C),G=new DOMPoint(L,F);if(v){const X=t4(c.transform);$=X.transformPoint($),G=X.transformPoint(G)}const Z=f.createLinearGradient($.x,$.y,G.x,G.y);for(const X of c.stops)Z.addColorStop(X.offset,e4(X.rgb_color,X.opacity*h,g));return Z}function _2e(f,c,h,g,v=!1){if(c.stops.length===1){const je=c.stops[0];return e4(je.rgb_color,je.opacity*h,g)}const k=t4(c.transform),{fx:C,fy:L,fr:F,cx:$,cy:G,r:Z}=c;let X=new DOMPoint(C,L),re=new DOMPoint($,G),ne=F,me=Z;if(v){X=k.transformPoint(X),re=k.transformPoint(re);const je=(k.a+k.d)/2;ne=F*je,me=c.r*je}const ke=f.createRadialGradient(X.x,X.y,ne,re.x,re.y,me);for(const je of c.stops)ke.addColorStop(je.offset,e4(je.rgb_color,je.opacity*h,g));return ke}function b2e(f,c,h,g){const v=g.transform?t4(g.transform).preMultiplySelf(c):c,k=NM(f.canvas.width,f.canvas.height),C=k.getContext("2d");for(const F of g.children)if(F.group)b2e(C,v,h,F.group);else if(F.path){const $=F.path,G=new Path2D;G.addPath(N2e($),v),C.fill(G,x2e($))}const L=g.clip_path_idx!=null?h.clip_paths[g.clip_path_idx]:null;L&&w2e(C,v,h,L),f.globalCompositeOperation="source-over",f.drawImage(k,0,0)}function w2e(f,c,h,g){const v=NM(f.canvas.width,f.canvas.height);b2e(v.getContext("2d"),c,h,g),f.globalCompositeOperation="destination-in",f.drawImage(v,0,0)}function j2e(f,c,h,g,v){if(g.children.length===0)return;const k=g.mask_idx!=null?h.masks[g.mask_idx]:null;k&&j2e(f,c,h,k,v);const C=f.canvas.width,L=f.canvas.height,F=NM(C,L),$=F.getContext("2d"),G=g.width,Z=g.height,X=g.left,re=g.top,ne=new Path2D,me=new Path2D;me.rect(X,re,G,Z),ne.addPath(me,c),$.clip(ne);for(const Fe of g.children)m2e($,c,h,Fe,v);const ke=$.getImageData(0,0,C,L),je=ke.data;if(g.mask_type===u2e.MASK_TYPE_LUMINANCE)for(let Fe=0;Fec[C])return null}else{const L=1/g[C];let F=(f[C]-h[C])*L,$=(c[C]-h[C])*L;if(F>$){const G=F;F=$,$=G}if(F>v&&(v=F),$k)return null}return v}function M2e(f,c,h,g,v,k,C,L,F,$,G){const Z=g-f,X=v-c,re=k-h,ne=C-f,me=L-c,ke=F-h,je=G[1]*ke-G[2]*me,Fe=G[2]*ne-G[0]*ke,$e=G[0]*me-G[1]*ne,Xe=Z*je+X*Fe+re*$e;if(Math.abs(Xe)<1e-15)return null;const mt=1/Xe,ct=$[0]-f,_t=$[1]-c,Ct=$[2]-h,Et=(ct*je+_t*Fe+Ct*$e)*mt;if(Et<0||Et>1)return null;const Yt=_t*re-Ct*X,Rt=Ct*Z-ct*re,rr=ct*X-_t*Z,lr=(G[0]*Yt+G[1]*Rt+G[2]*rr)*mt;return lr<0||Et+lr>1?null:(ne*Yt+me*Rt+ke*rr)*mt}function T2e(f,c,h){return(f-c)/(h-c)}function A2e(f,c,h,g,v,k,C,L,F){const $=1<{const Fe=ke?1:0,$e=(re+1)*me-Fe,Xe=ne*me,mt=(ne+1)*me-Fe;je[0]=re*me,je[1]=Xe,je[2]=$e,je[3]=mt};let Z=new S2e(F);const X=[];for(let re=0;re=1;F/=2){const re=L[L.length-1];Z=new S2e(F);for(let ne=0;ne0;){const{idx:ne,t:me,nodex:ke,nodey:je,depth:Fe}=re.pop();if(this.leaves[ne]){A2e(ke,je,Fe,c,h,g,v,Z,X);const Xe=1<=vr[2])return me}continue}let $e=0;for(let Xe=0;Xe=$[G[Ct]]&&(G.splice(Ct,0,Xe),_t=!0);_t||(G[$e]=Xe),$e++}}for(let Xe=0;Xe<$e;Xe++){const mt=G[Xe];re.push({idx:this.childOffsets[ne]+mt,t:$[mt],nodex:(ke<<1)+this._siblingOffset[mt][0],nodey:(je<<1)+this._siblingOffset[mt][1],depth:Fe+1})}}return null}_addNode(c,h,g){return this.minimums.push(c),this.maximums.push(h),this.leaves.push(g),this.childOffsets.push(0),this.nodeCount++}_construct(c,h,g,v,k){if(c[v].isLeaf(h,g)===1)return;this.childOffsets[k]||(this.childOffsets[k]=this.nodeCount);const C=v-1,L=c[C];let F=0,$=0;for(let G=0;G=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(c+1)}static pack(c,h){const g=[0,0,0,0],v=X6.getUnpackVector(h);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 S1e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,h,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let v=h*this.dim,k=h*this.dim+this.dim,C=g*this.dim,L=g*this.dim+this.dim;switch(h){case-1:v=k-1;break;case 1:k=v+1}switch(g){case-1:C=L-1;break;case 1:L=C+1}const F=-h*this.dim,$=-g*this.dim;for(let G=C;G=1;g--){const v=g===1?1:0,k=g===2?1:0;for(let C=0;C>>1^-(1&f[c]);return f}function _We(f,c){switch(c){case"uint32":return f;case"uint16":for(let h=0;h>4|(61440&g)>>8|(240&v)<<4|61440&v,f[h+1]=15&g|(3840&g)>>4|(15&v)<<8|(3840&v)<<4}return f;case"uint8":for(let h=0;h>6|(192&v)>>4|(192&k)>>2|192&C,f[h+1]=(48&g)>>4|(48&v)>>2|48&k|(48&C)<<2,f[h+2]=(12&g)>>2|12&v|(12&k)<<2|(12&C)<<4,f[h+3]=3&g|(3&v)<<2|(3&k)<<4|(3&C)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}Jr(X6,"DEMData"),Jr(E2e,"DemMinMaxQuadTree",{omit:["dem"]});var Hh=Uint8Array,CM=Uint16Array,bWe=Int32Array,P2e=new Hh([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]),L2e=new Hh([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]),wWe=new Hh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),O2e=function(f,c){for(var h=new CM(31),g=0;g<31;++g)h[g]=c+=1<>1|(21845&ol)<<1;F2e[ol]=((65280&(r4=(61680&(r4=(52428&r4)>>2|(13107&r4)<<2))>>4|(3855&r4)<<4))>>8|(255&r4)<<8)>>1}var MM=function(f,c,h){for(var g=f.length,v=0,k=new CM(c);v>F]=$;return C},TM=new Hh(288);for(ol=0;ol<144;++ol)TM[ol]=8;for(ol=144;ol<256;++ol)TM[ol]=9;for(ol=256;ol<280;++ol)TM[ol]=7;for(ol=280;ol<288;++ol)TM[ol]=8;var z2e=new Hh(32);for(ol=0;ol<32;++ol)z2e[ol]=5;var NWe=MM(TM,9),SWe=MM(z2e,5),Joe=function(f){for(var c=f[0],h=1;hc&&(c=f[h]);return c},Up=function(f,c,h){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&h},ele=function(f,c){var h=c/8|0;return(f[h]|f[h+1]<<8|f[h+2]<<16)>>(7&c)},CWe=["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"],qp=function(f,c,h){var g=new Error(c||CWe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,qp),!h)throw g;return g},MWe=new Hh(0),TWe=typeof TextDecoder<"u"&&new TextDecoder;try{TWe.decode(MWe,{stream:!0})}catch{}const AWe={gzip_data:"gzip"};class Lf extends Error{constructor(c){super(c),this.name="MRTError"}}const EWe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},B2e={uint32:1,uint16:2,uint8:4},IWe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let tle;class Q6{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const h=this.layers[c];if(!h)throw new Lf(`Layer '${c}' not found`);return h}getHeaderLength(c){const h=new Uint8Array(c),g=new DataView(c);if(h[0]!==13)throw new Lf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const h=new Uint8Array(c),g=this.getHeaderLength(c);if(h.length= ${g} but got buffer of length ${h.length}`);const v=new tle(h.subarray(0,g)).readFields(dWe,{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 Lf(`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 $2e(k,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const h=[],g=this.getLayer(c.layerName);for(let v of c.blockIndices){const k=g.dataIndex[v],C=k.firstByte-c.firstByte,L=k.lastByte-c.firstByte;if(g._blocksInProgress.has(v))continue;const F={layerName:g.name,firstByte:C,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),h.push(F)}return new U2e(h,()=>{h.forEach(v=>g._blocksInProgress.delete(v.blockIndex))},(v,k)=>{if(h.forEach(C=>g._blocksInProgress.delete(C.blockIndex)),v)throw v;k.forEach(C=>{this.getLayer(C.layerName).processDecodedData(C)})})}}class $2e{constructor({version:c,name:h,units:g,tileSize:v,pixelFormat:k,buffer:C,dataIndex:L},F){if(this.version=c,this.version!==1)throw new Lf(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=h,this.units=g,this.tileSize=v,this.buffer=C,this.pixelFormat=EWe[k],this.dataIndex=L,this.bandShape=[v+2*C,v+2*C,B2e[this.pixelFormat]],this._decodedBlocks=new Y6(F?F.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return B2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const h=c.blockIndex.toString();this._decodedBlocks.get(h)||this._decodedBlocks.put(h,c.data)}getBlockForBand(c){let h=0;switch(typeof c){case"string":for(const[g,v]of this.dataIndex.entries()){for(const[k,C]of v.bands.entries())if(C===c)return{bandIndex:h+k,blockIndex:g,blockBandIndex:k};h+=v.bands.length}break;case"number":for(const[g,v]of this.dataIndex.entries()){if(c>=h&&cthis.cacheSize)throw new Lf(`Number of blocks to decode (${k.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:h,lastByte:g,blockIndices:v}}hasBand(c){const{blockIndex:h}=this.getBlockForBand(c);return h>=0}hasDataForBand(c){const{blockIndex:h}=this.getBlockForBand(c);return h>=0&&!!this._decodedBlocks.get(h.toString())}getBandView(c){const{blockIndex:h,blockBandIndex:g}=this.getBlockForBand(c);if(h<0)throw new Lf(`Band not found: ${JSON.stringify(c)}`);const v=this._decodedBlocks.get(h.toString());if(!v)throw new Lf(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const k=this.dataIndex[h],C=this.bandShape.reduce(($,G)=>$*G,1),L=g*C,F=v.subarray(L,L+C);return{data:F,bytes:new Uint8Array(F.buffer).subarray(F.byteOffset,F.byteOffset+F.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:k.offset,scale:k.scale}}}Q6.setPbf=function(f){tle=f};class U2e{constructor(c,h,g){this.tasks=c,this._onCancel=h,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,h){this._finalized||(this._onComplete(c,h),this._finalized=!0)}}Q6.performDecoding=function(f,c){const h=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:v,firstByte:k,lastByte:C,pixelFormat:L,blockShape:F,blockIndex:$,filters:G,codec:Z}=g,X=h.subarray(k,C+1),re=new Uint32Array(F[0]*F[1]*F[2]);let ne;if(Z!=="gzip_data")throw new Lf(`Unhandled codec: ${Z}`);return ne=function(me,ke){if(!globalThis.DecompressionStream&&ke==="gzip_data")return Promise.resolve(((Xe=function(_t){_t[0]==31&&_t[1]==139&&_t[2]==8||qp(6,"invalid gzip data");var Ct=_t[3],Et=10;4&Ct&&(Et+=2+(_t[10]|_t[11]<<8));for(var Yt=(Ct>>3&1)+(Ct>>4&1);Yt>0;Yt-=!_t[Et++]);return Et+(2&Ct)}($e=me))+8>$e.length&&qp(6,"invalid gzip data"),function(_t,Ct,Et,Yt){var Rt=_t.length;if(!Rt||Ct.f&&!Ct.l)return Et||new Hh(0);var rr=!Et,lr=rr||Ct.i!=2,cr=Ct.i;rr&&(Et=new Hh(3*Rt));var xr,vr,ur=function(qa){var ma=Et.length;if(qa>ma){var wa=new Hh(Math.max(2*ma,qa));wa.set(Et),Et=wa}},pr=Ct.f||0,tr=Ct.p||0,Qt=Ct.b||0,mr=Ct.l,Tr=Ct.d,wr=Ct.m,hn=Ct.n,Ur=8*Rt;do{if(!mr){pr=Up(_t,tr,1);var Kr=Up(_t,tr+1,3);if(tr+=3,!Kr){var nn=_t[(nr=4+((tr+7)/8|0))-4]|_t[nr-3]<<8,xs=nr+nn;if(xs>Rt){cr&&qp(0);break}lr&&ur(Qt+nn),Et.set(_t.subarray(nr,xs),Qt),Ct.b=Qt+=nn,Ct.p=tr=8*xs,Ct.f=pr;continue}if(Kr==1)mr=NWe,Tr=SWe,wr=9,hn=5;else if(Kr==2){var jr=Up(_t,tr,31)+257,sn=Up(_t,tr+10,15)+4,Vn=jr+Up(_t,tr+5,31)+1;tr+=14;for(var zs=new Hh(Vn),Hs=new Hh(19),as=0;as>4)<16)zs[as++]=nr;else{var Rr=0,Fr=0;for(nr==16?(Fr=3+Up(_t,tr,3),tr+=2,Rr=zs[as-1]):nr==17?(Fr=3+Up(_t,tr,7),tr+=3):nr==18&&(Fr=11+Up(_t,tr,127),tr+=7);Fr--;)zs[as++]=Rr}}var gn=zs.subarray(0,jr),bn=zs.subarray(jr);wr=Joe(gn),hn=Joe(bn),mr=MM(gn,wr),Tr=MM(bn,hn)}else qp(1);if(tr>Ur){cr&&qp(0);break}}lr&&ur(Qt+131072);for(var es=(1<>4;if((tr+=15&Rr)>Ur){cr&&qp(0);break}if(Rr||qp(2),Is<256)Et[Qt++]=Is;else{if(Is==256){ms=tr,mr=null;break}var Ln=Is-254;Is>264&&(Ln=Up(_t,tr,(1<<(la=P2e[as=Is-257]))-1)+R2e[as],tr+=la);var qn=Tr[ele(_t,tr)&us],sa=qn>>4;if(qn||qp(3),tr+=15&qn,bn=kWe[sa],sa>3){var la=L2e[sa];bn+=ele(_t,tr)&(1<Ur){cr&&qp(0);break}lr&&ur(Qt+131072);var ca=Qt+Ln;if(Qtxr.length)&&(vr=xr.length),new Hh(xr.subarray(0,vr))):Et.subarray(0,Qt)}($e.subarray(Xe,-8),{i:2},new Hh(((je=$e)[(Fe=je.length)-4]|je[Fe-3]<<8|je[Fe-2]<<16|je[Fe-1]<<24)>>>0))));var je,Fe,$e,Xe;const mt=AWe[ke];if(!mt)throw new Error(`Unhandled codec: ${ke}`);const ct=new globalThis.DecompressionStream(mt);return new Response(new Blob([me]).stream().pipeThrough(ct)).arrayBuffer().then(_t=>new Uint8Array(_t))}(X,Z).then(me=>(function(ke,je){ke.readFields(gWe,je)}(new tle(me),re),new IWe[L](re.buffer))),ne.then(me=>{for(let ke=G.length-1;ke>=0;ke--)switch(G[ke]){case"delta_filter":yWe(me,F);break;case"zigzag_filter":vWe(me);break;case"bitshuffle_filter":_We(me,L);break;default:throw new Lf(`Unhandled filter "${G[ke]}"`)}return{layerName:v,blockIndex:$,data:me}}).catch(me=>{throw me})}))},Jr(U2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Jr(Q6,"MapboxRasterTile"),Jr($2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class q2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let h=0;h=0&&X[3]>=0&&$.insert(F,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new $t(new M6(this.rawTileData)).layers,this.sourceLayerCoder=new q2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,h){const{tilespaceGeometry:g,transform:v,tileTransform:k,pixelPosMatrix:C,availableImages:L,worldview:F}=h;this.loadVTLayers(),this.serializedLayersCache.clear();const $=h.queryRadius?h.queryRadius:0,G=g.bufferedTilespaceBounds,Z=this.grid.query(G.min.x,G.min.y,G.max.x,G.max.y,(me,ke,je,Fe)=>ud(g.bufferedTilespaceGeometry,me-$,ke-$,je+$,Fe+$));Z.sort(PWe);let X=null;v.elevation&&Z.length>0&&(X=JN.create(v.elevation,this.tileID));const re={};let ne;for(let me=0;me(Fe||(Fe=St($e,this.tileID.canonical,k)),Xe.queryIntersectsFeature(g,$e,mt,Fe,this.z,v,C,X,ct)))}return re}loadMatchingFeature(c,h,g,v,k,C){const{featureIndex:L,bucketIndex:F,sourceLayerIndex:$,layoutVertexArrayOffset:G}=h,Z=this.bucketLayerIDs[F],X=g.layers,re=Object.keys(X);if(re.length&&!Wr(re,Z))return;const ne=g.sourceCache,me=this.sourceLayerCoder.decode($),ke=this.vtLayers[me].feature(L),je=this.getId(ke,me);for(let Fe=0;Fe`${L.key}: ${L.message}`).join(", ");return void Vr(`Failed to create expression for promoteId: ${C}`)}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 H2e(f,c,h,g,v){return Ut(f,(k,C)=>{const L=c instanceof dx?c.get(C):null;return L&&L.evaluate?L.evaluate(h,g,void 0,v):L})}function PWe(f,c){return c-f}Jr(V2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const W2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class rle{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,g]=new Uint8Array(c,0,2);if(h!==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=W2e[15&g];if(!k)throw new Error("Unrecognized array type.");const[C]=new Uint16Array(c,2,1),[L]=new Uint32Array(c,4,1);return new rle(L,C,k,c)}constructor(c,h=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(+h,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const k=W2e.indexOf(this.ArrayType),C=2*c*this.ArrayType.BYTES_PER_ELEMENT,L=c*this.IndexArrayType.BYTES_PER_ELEMENT,F=(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+F,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+C+L+F),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+F,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]=h,new Uint32Array(this.data,4,1)[0]=c)}add(c,h){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=h,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return nle(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,h,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:C,nodeSize:L}=this,F=[0,k.length-1,0],$=[];for(;F.length;){const G=F.pop()||0,Z=F.pop()||0,X=F.pop()||0;if(Z-X<=L){for(let ke=X;ke<=Z;ke++){const je=C[2*ke],Fe=C[2*ke+1];je>=c&&je<=g&&Fe>=h&&Fe<=v&&$.push(k[ke])}continue}const re=X+Z>>1,ne=C[2*re],me=C[2*re+1];ne>=c&&ne<=g&&me>=h&&me<=v&&$.push(k[re]),(G===0?c<=ne:h<=me)&&(F.push(X),F.push(re-1),F.push(1-G)),(G===0?g>=ne:v>=me)&&(F.push(re+1),F.push(Z),F.push(1-G))}return $}within(c,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:k,nodeSize:C}=this,L=[0,v.length-1,0],F=[],$=g*g;for(;L.length;){const G=L.pop()||0,Z=L.pop()||0,X=L.pop()||0;if(Z-X<=C){for(let ke=X;ke<=Z;ke++)K2e(k[2*ke],k[2*ke+1],c,h)<=$&&F.push(v[ke]);continue}const re=X+Z>>1,ne=k[2*re],me=k[2*re+1];K2e(ne,me,c,h)<=$&&F.push(v[re]),(G===0?c-g<=ne:h-g<=me)&&(L.push(X),L.push(re-1),L.push(1-G)),(G===0?c+g>=ne:h+g>=me)&&(L.push(re+1),L.push(Z),L.push(1-G))}return F}}function nle(f,c,h,g,v,k){if(v-g<=h)return;const C=g+v>>1;G2e(f,c,C,g,v,k),nle(f,c,h,g,C-1,1-k),nle(f,c,h,C+1,v,1-k)}function G2e(f,c,h,g,v,k){for(;v>g;){if(v-g>600){const $=v-g+1,G=h-g+1,Z=Math.log($),X=.5*Math.exp(2*Z/3),re=.5*Math.sqrt(Z*X*($-X)/$)*(G-$/2<0?-1:1);G2e(f,c,h,Math.max(g,Math.floor(h-G*X/$+re)),Math.min(v,Math.floor(h+($-G)*X/$+re)),k)}const C=c[2*h+k];let L=g,F=v;for(AM(f,c,g,h),c[2*v+k]>C&&AM(f,c,g,v);LC;)F--}c[2*g+k]===C?AM(f,c,g,F):(F++,AM(f,c,F,v)),F<=h&&(g=F+1),h<=F&&(v=F-1)}}function AM(f,c,h,g){sle(f,h,g),sle(c,2*h,2*g),sle(c,2*h+1,2*g+1)}function sle(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function K2e(f,c,h,g){const v=f-h,k=c-g;return v*v+k*k}i.$=Pk,i.A=jp,i.B=$h,i.C=2,i.D=BN,i.E=gi,i.F=uM,i.G=__e,i.H=Ik,i.I=yl,i.J=VP,i.K=un,i.L=Wy,i.M=nN,i.N=Uv,i.O=EP,i.P=ir,i.Q=qv,i.R=Jg,i.S=fN,i.T=hoe,i.U=Gm,i.V=V6,i.W=y5,i.X=Xy,i.Y=Yy,i.Z=Dv,i._=ld,i.a=function(f){return Ms.API_CDN_URL_REGEX.test(f)},i.a$=de,i.a0=Un,i.a1=nu,i.a2=Tf,i.a3=class extends V6{},i.a4=sN,i.a5=AP,i.a6=Ft,i.a7=function(f){const c=f.value;return c?Un(c)?qoe(c,!0)?[]:[new V6(f.key,c,`invalid url "${c}"`)]:[new V6(f.key,c,`string expected, "${un(c)}" found`)]:[]},i.a8=BP,i.a9=Gi,i.aA=ge,i.aB=A,i.aC=pt,i.aD=Sc,i.aE=Ga,i.aF=B,i.aG=Ge,i.aH=function(f,c){const h={};for(let g=0;g{g(k,C)},c):g(k,C),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=h((k,C)=>{v.result=[k,C];for(const L of v.callbacks)this.scheduler?this.scheduler.add(()=>{L(k,C)},c):L(k,C);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,h){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=Oh(f.request,(C,L,F)=>{C?v(C):L&&v(null,{rawData:L,vectorTile:h?void 0:new $t(new M6(L)),responseHeaders:new Map(F.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=ad,i.aO=function(f){bo++,bo>By&&(f.getActor().send("enforceCacheSizeLimit",zy),bo=0)},i.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},i.aQ=Vi,i.aR=Z_e,i.aS=t2e,i.aT=m,i.aU=K_e,i.aV=function(f,c){const h=document.createElement("video");h.muted=!0,h.onloadstart=function(){c(null,h)};for(let g=0;g{}}},i.aW=iM,i.aX=f_,i.aY=Pt,i.aZ=mM,i.a_=ee,i.aa=kr,i.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return Xn(f.expression.evaluate(c))}interpolate(f,c,h){return{x:Fn(f.x,c.x,h),y:Fn(f.y,c.y,h),z:Fn(f.z,c.z,h),azimuthal:Fn(f.azimuthal,c.azimuthal,h),polar:Fn(f.polar,c.polar,h)}}},i.ac=si,i.ad=ox,i.ae=He,i.af=Qe,i.ag=pe,i.ah=Ae,i.ai=dx,i.aj=g0,i.ak=Fn,i.al=Cr,i.am=$3,i.an=is,i.ao=Ta,i.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([h,g]){const v=Xn([1,h,g]);return{x:v.x,y:v.y,z:v.z}}(f.expression.evaluate(c))}interpolate(f,c,h){return{x:Fn(f.x,c.x,h),y:Fn(f.y,c.y,h),z:Fn(f.z,c.z,h)}}},i.aq=function(f,c,h=0,g=!0){const v=new ir(h,h),k=f.sub(v),C=c.add(v),L=[k,new ir(C.x,k.y),C,new ir(k.x,C.y)];return g&&L.push(k.clone()),L},i.ar=function(f,c){const h=[];for(let g=0;g1)return!1;const h=c.getSource().maxzoom,g=1<1)return c;const v=g.getSource().maxzoom,k=1<{const L=this.getAtTileOffset(f,v,k,C),F=g.upVector(f.canonical,v.x,v.y);return be(F,F,L*g.upVectorScale(f.canonical,c,h).metersToTile),F}}getForTilePoints(f,c,h,g){if(this.isUsingMockSource())return!1;const v=JN.create(this,f,g);return!!v&&(c.forEach(k=>{k[2]=this.exaggeration()*v.getElevationAt(k[0],k[1],h)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const h=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=Z1e,i.c1=Coe,i.c2=C_e,i.c3=Ooe,i.c4=rle,i.c5=be,i.c6=ze,i.c7=Mt,i.c8=function(f,c,h){h*=.5;var g=c[0],v=c[1],k=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F+v*L,f[1]=v*F-g*L,f[2]=k*F+C*L,f[3]=C*F-k*L,f},i.c9=wt,i.cA=xe,i.cB=pa,i.cC=Pve,i.cD=Ka,i.cE=d1e,i.cF=function(f,c,h,g,v,k,C,L,F){if(F.name==="globe")return d1e(f,c,new Ka(h,g,v),!1);const $=mM({z:h,x:g,y:v},F);return new dn([(k+$.x/$.scale)*c,c*($.y/$.scale),C],[(k+$.x2/$.scale)*c,c*($.y2/$.scale),L])},i.cG=function(f,c,h){return f[0]=Math.min(c[0],h[0]),f[1]=Math.min(c[1],h[1]),f[2]=Math.min(c[2],h[2]),f[3]=Math.min(c[3],h[3]),f},i.cH=function(f,c,h){return f[0]=Math.max(c[0],h[0]),f[1]=Math.max(c[1],h[1]),f[2]=Math.max(c[2],h[2]),f[3]=Math.max(c[3],h[3]),f},i.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return ku[c]},i.cJ=ue,i.cK=Je,i.cL=RN,i.cM=function(f){const c=M(new Float64Array(16));A(c,f.pixelMatrix,f.globeMatrix);const h=[0,lh,0],g=[0,ch,0];return Qe(h,h,c),Qe(g,g,c),[h[0]>0&&h[0]<=f.width&&h[1]>0&&h[1]<=f.height&&!qie(f,new m(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!qie(f,new m(f.center.lat,-90))]},i.cN=function(f,c){const{scale:h}=f.tileTransform,g=h*Cr/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(v,k,C){var L=k[1],F=k[2],$=k[3],G=C[0],Z=C[1];return v[0]=k[0]*G,v[1]=L*G,v[2]=F*Z,v[3]=$*Z,v}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},i.cO=w6,i.cP=oe,i.cQ=Ive,i.cR=function(f){const c=Ive(f,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=z,i.cT=$r,i.cU=R,i.cV=function(f){const{x:c,y:h}=f.point,{lng:g,lat:v}=f._center;return f1e(c,h,f.worldSize,g,v)},i.cW=Ce,i.cX=vo,i.cY=Fi,i.cZ=dc,i.c_=oh,i.ca=fa,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=ae,i.cd=function(f,c,h,g,v){var k=1/Math.tan(c/2);if(f[0]=k/h,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 C=1/(g-v);f[10]=(v+g)*C,f[14]=2*v*g*C}else f[10]=-1,f[14]=-2*g;return f},i.ce=function(f,c,h,g,v,k,C){var L=1/(c-h),F=1/(g-v),$=1/(k-C);return f[0]=-2*L,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*F,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+h)*L,f[13]=(v+g)*F,f[14]=(C+k)*$,f[15]=1,f},i.cf=Y,i.cg=function(f,c,h){f[4*c+0]=h[0],f[4*c+1]=h[1],f[4*c+2]=h[2],f[4*c+3]=h[3]},i.ch=PN,i.ci=Qv,i.cj=Wo,i.ck=If,i.cl=e_,i.cm=F_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,h){var g=c[0],v=c[1],k=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F+k*L,f[1]=v*F+C*L,f[2]=g*-L+k*F,f[3]=v*-L+C*F,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=We,i.cr=function(f){var c=f[0],h=f[1],g=f[2],v=f[3];return Math.sqrt(c*c+h*h+g*g+v*v)},i.cs=Xr,i.ct=Ve,i.cu=wo,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Me,i.d=function(f){return Ms.API_TILEJSON_REGEX.test(f)},i.d$=class{constructor(f,c,h,g){this.context=f,this.format=g,this.size=h,this.texture=f.gl.createTexture();const[v,k,C]=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,C,0,doe(this.format),uoe(this.format),c.data)}bind(f,c){const{context:h}=this,{gl:g}=h;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=LN,i.d4=function(f,c,h){const g=Math.sqrt(f*f+c*c+h*h),v=g>0?Math.acos(h/g)*Eo:0;let k=f!==0||c!==0?Math.atan2(-c,-f)*Eo+90:0;return k<0&&(k+=360),[g,k,v]},i.d5=se,i.d6=Xn,i.d7=Ie,i.d8=he,i.d9=dn,i.dA=function(f){return f({pluginStatus:cd,pluginURL:Tp}),uN.on("pluginStateChange",f),f},i.dB=Jv,i.dC=class extends Ip{constructor(f){super(f),this.current=ON}set(f,c,h){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(h[g]!==this.current[g]){this.current=h,this.gl.uniformMatrix3fv(this.location,!1,h);break}}}},i.dD=Hl,i.dE=function(f,c,h){const g=g0(h.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,h=c/Y(1,f.center.lat),g=M(new Float64Array(16));return P(g,g,[f.point.x,f.point.y,0]),z(g,g,[h,h,c]),Float32Array.from(g)},i.dG=i6,i.dH=function(f){const c=ue-5;f=ge(f,-c,c)/c*90;const h=Math.pow(Math.abs(Math.sin(is(f))),3);return Math.round(h*(q5.length-1))},i.dI=function(f,c,h,g){const v=c.getNorth(),k=c.getSouth(),C=c.getWest(),L=c.getEast(),F=1<0){const ne=180/g;w(re,re,[ne/$+1,0,0,0,ne/G+1,0,-.5*ne/Z,.5*ne/X,1])}return re[2]=F,re[5]=f.x,re[8]=f.y,re},i.dJ=Vh,i.dK=function(f,c,h){const g=M(new Float64Array(16)),v=(c/(1<({u_matrix:new e_(f),u_texsize:new If(f),u_pixels_to_tile_units:new DN(f),u_device_pixel_ratio:new Wo(f),u_width_scale:new Wo(f),u_floor_width_scale:new Wo(f),u_image:new PN(f),u_units_to_pixels:new If(f),u_tile_units_to_pixels:new Wo(f),u_alpha_discard_threshold:new Wo(f),u_trim_offset:new If(f),u_trim_fade_range:new If(f),u_trim_color:new LN(f),u_zbias_factor:new Wo(f),u_tile_to_meter:new Wo(f),u_ground_shadow_factor:new Qv(f),u_pattern_transition:new Wo(f)}),i.dX=f=>({u_matrix:new e_(f),u_pixels_to_tile_units:new DN(f),u_device_pixel_ratio:new Wo(f),u_width_scale:new Wo(f),u_floor_width_scale:new Wo(f),u_units_to_pixels:new If(f),u_dash_image:new PN(f),u_gradient_image:new PN(f),u_image_height:new Wo(f),u_texsize:new If(f),u_tile_units_to_pixels:new Wo(f),u_alpha_discard_threshold:new Wo(f),u_trim_offset:new If(f),u_trim_fade_range:new If(f),u_trim_color:new LN(f),u_zbias_factor:new Wo(f),u_tile_to_meter:new Wo(f),u_ground_shadow_factor:new Qv(f)}),i.dY=f=>({u_camera_to_center_distance:new Wo(f),u_extrude_scale:new DN(f),u_device_pixel_ratio:new Wo(f),u_matrix:new e_(f),u_inv_rot_matrix:new e_(f),u_merc_center:new If(f),u_tile_id:new Qv(f),u_zoom_transition:new Wo(f),u_up_dir:new Qv(f),u_emissive_strength:new Wo(f)}),i.dZ=kN,i.d_=VVe,i.da=ye,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=yoe,i.de=Dve,i.df=qoe,i.dg=function(f,c){return f.readFields(qHe,{icons:[]},c)},i.dh=y6,i.di=ZN,i.dj=Ioe,i.dk=ex,i.dl=Wv,i.dm=Rm,i.dn=Pr,i.dp=ar,i.dq=function(f){const c=f.indexOf(fx);return c>=0?f.slice(0,c):f},i.dr=function(f){return f.indexOf(fx)>=0},i.ds=function(f){const c=f.lastIndexOf(fx);return c>=0?f.slice(c+1):""},i.dt=function(f){const c=[],h=f.id;return h===void 0&&c.push({message:`layers.${h}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${h}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(f,c,h,g){return f.type==="custom"?new DHe(f,c):new $He[f.type](f,c,h,g)},i.dv=fr,i.dw=function(f){const c=f.indexOf(fx);return c>=0?f.slice(c+1):""},i.dx=class extends h_{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=uN,i.dz=Lh,i.e=Ms,i.e$=fe,i.e0=g1e,i.e1=(f,c,h,g,v,k)=>{const C=f.transform,L=C.projection.name==="globe";let F;if(k.paint.get("circle-pitch-alignment")==="map")if(L){const G=h1e(C.zoom,c.canonical)*C._pixelsPerMercatorPixel;F=Float32Array.from([G,0,0,G])}else F=C.calculatePixelsToTileUnitsMatrix(h);else F=new Float32Array([C.pixelsToGLUnits[0],0,0,C.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(C.projection),u_matrix:f.translatePosMatrix(c.projMatrix,h,k.paint.get("circle-translate"),k.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Vo.devicePixelRatio,u_extrude_scale:F,u_inv_rot_matrix:iqe,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 G=f.transform,Z=G.pitch<15?Zve(.07,.7,ge((14-G.zoom)/5,0,1)):.07,X=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Xve(f,c,h,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:G.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:v,u_width_scale:k,u_floor_width_scale:C,u_image:0,u_tile_units_to_pixels:Yve(c,G),u_units_to_pixels:[1/G.pixelsToGLUnits[0],1/G.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:L,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:h.lut).toArray01(),u_zbias_factor:Z,u_tile_to_meter:Ie(c.tileID.canonical,0),u_ground_shadow_factor:F,u_pattern_transition:$}},i.e5=(f,c,h,g,v,k,C,L,F,$)=>{const G=f.transform,Z=G.calculatePixelsToTileUnitsMatrix(c),X=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=G.pitch<15?Zve(.07,.7,ge((14-G.zoom)/5,0,1)):.07;return{u_matrix:Xve(f,c,h,g),u_pixels_to_tile_units:Z,u_device_pixel_ratio:k,u_width_scale:C,u_floor_width_scale:L,u_units_to_pixels:[1/G.pixelsToGLUnits[0],1/G.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:Jve(h)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Yve(c,f.transform),u_alpha_discard_threshold:0,u_trim_offset:F,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:h.lut).toArray01(),u_zbias_factor:re,u_tile_to_meter:Ie(c.tileID.canonical,0),u_ground_shadow_factor:$}},i.e6=Bt,i.e7=H5,i.e8=ce,i.e9=uh,i.eA=function(f,c){var h=2*Math.acos(c[3]),g=Math.sin(h/2);return g>u?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),h},i.eB=Woe,i.eC=N6,i.eD=k6,i.eE=[1,1,1],i.eF=JN,i.eG=Ee,i.eH=function(f,c,h,g){var v=c[0],k=c[1],C=c[2],L=c[3];return f[0]=v+g*(h[0]-v),f[1]=k+g*(h[1]-k),f[2]=C+g*(h[2]-C),f[3]=L+g*(h[3]-L),f},i.eI=VN,i.eJ=Au,i.eK=Ef,i.eL=function(f,c,h,g,v,k,C,L,F,$,G,Z,X,re,ne,me){var ke=new p(16);return ke[0]=f,ke[1]=c,ke[2]=h,ke[3]=g,ke[4]=v,ke[5]=k,ke[6]=C,ke[7]=L,ke[8]=F,ke[9]=$,ke[10]=G,ke[11]=Z,ke[12]=X,ke[13]=re,ke[14]=ne,ke[15]=me,ke},i.eM=b,i.eN=d0,i.eO=P5,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 h=W1e(new ir(0,0),new ir(Cr,Cr),f),g=[];if(c&&!Qie(h,this._globalClipBounds))return g;for(const v of this._activeRegions){if(v.hiddenByOverlap||!Qie(h,v))continue;const k=Oqe(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 h=[];for(const g of c.cache.getVisibleCoordinates()){const v=c.cache.getTile(g).buckets[c.layer];v&&v.updateFootprints(g.toUnwrapped(),h)}return h},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const h=f.getOrder(),g=f.getClipMask(),v=f.getClipScope();for(const k of c){if(!k.footprint)continue;const C=W1e(k.footprint.min,k.footprint.max,k.id);this._activeRegions.push({min:C.min,max:C.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:k.id,footprint:k.footprint,order:h,clipMask:g,clipScope:v})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,h)=>c.priority-h.priority||f6(c.min,h.min)||f6(c.max,h.max)||c.order-h.order||c.clipMask-h.clipMask||function(g,v){const k=(C,L)=>C+L;return g.length-v.length||g.reduce(k,"").localeCompare(v.reduce(k,""))}(c.clipScope,h.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const h=this._activeRegions[c],g=this._prevRegions[c];f=h.priority!==g.priority||!H1e(h,g)||h.order!==g.order||h.clipMask!==g.clipMask||!po(h.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const h of this._activeRegions)h.order!==X5&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,h.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,h.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,h.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,h.max.y));const c=h=>{const g=this._activeRegions;if(h>=g.length)return h;const v=g[h].priority;for(;h1){let h=0,g=c(h);for(;h!==g;){let v=h;const k=h;for(;v!==g;){const C=this._activeRegions[v];C.hiddenByOverlap=!1;for(let L=0;L=0;c--)this._addSource(f[c]);this._computeReplacement()}},i.eQ=X5,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 h=new Zm,g=new Ho,v=[],k=f+1+2,C=c[0]+1,L=c[0]+1+(1+c.length),F=($,G,Z)=>{let X=$===k-1?$-2:$===0?$:$-1;return X+=Z?24575:0,[X,G]};for(let $=0;$0?(ke=2*Math.sqrt(me+1),f[3]=.25*ke,f[0]=(Z-re)/ke,f[1]=(X-F)/ke,f[2]=(L-$)/ke):C>G&&C>ne?(ke=2*Math.sqrt(1+C-G-ne),f[3]=(Z-re)/ke,f[0]=.25*ke,f[1]=(L+$)/ke,f[2]=(X+F)/ke):G>ne?(ke=2*Math.sqrt(1+G-C-ne),f[3]=(X-F)/ke,f[0]=(L+$)/ke,f[1]=.25*ke,f[2]=(Z+re)/ke):(ke=2*Math.sqrt(1+ne-C-G),f[3]=(L-$)/ke,f[0]=(X+F)/ke,f[1]=(Z+re)/ke,f[2]=.25*ke),f},i.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,h)=>String.fromCharCode(+("0x"+h))))},i.f0=function([f,c,h]){const g=Math.hypot(f,c,h),v=Math.atan2(f,h),k=.5*Math.PI-Math.acos(-c/g);return new m(vo(v),vo(k))},i.f1=at,i.f2=foe,i.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(h){if(mo==null){const g=h.navigator?h.navigator.userAgent:null;mo=!!h.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return mo}(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){zy=f,By=c},i.f5=qie,i.f6=p1e,i.f7=function(f){const c=[0,0,0],h=M(new Float64Array(16));return A(h,f.pixelMatrix,f.globeMatrix),Qe(c,c,h),new ir(c[0],c[1])},i.f8=function(){const f=nM;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(soe),nM=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},i.f9=function(){y6().acquire(soe)},i.fA=X6,i.fB=Ot,i.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==Sve){const h=new Uint32Array(f,0,7),[,,g,v,k,C]=h;c=h.byteLength+v+k+C+k,(g!==f.byteLength||c>=f.byteLength)&&Vr("Invalid b3dm header information.")}return Ave(f,c)},i.fD=function(f,c){const h=yoe(f);for(const g of h){for(const v of g.meshes)hVe(v);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(fVe(g.lights,c)))}return h},i.fE=H6,i.fF=Rs,i.fG=bve,i.fH=Ap,i.fI=su,i.fJ=function(f){qc(),Su!=null&&Su.then(c=>{c.keys().then(h=>{for(let g=0;gVr(v.message))}).catch(h=>Vr(h.message))}).catch(c=>Vr(c.message))},i.fa=Gv,i.fb=function(f,c,h=!1){if(cd===su.deferred||cd===su.loading||cd===su.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Tp=Vo.resolveURL(f),cd=su.deferred,w5=c,dN(),h||zP()},i.fc=function(f){$N=Vo.resolveURL(f),UN||(UN=new BN(y6(),new gi)),UN.broadcast("setMeshoptUrl",$N)},i.fd=kve,i.fe=function(f){ooe=Vo.resolveURL(f),UN||(UN=new BN(y6(),new gi)),UN.broadcast("setDracoUrl",ooe)},i.ff=jve,i.fg=rM,i.fh=function(f){const c=ru();if(!c)return;const h=c.delete(Fy);f&&h.then(()=>f()).catch(f)},i.fi=o_,i.fj=Jr,i.fk=x0,i.fl=$p,i.fm=q2e,i.fn=V2e,i.fo=Hve,i.fp=Jt,i.fq="hd_road_elevation",i.fr=_a,i.fs=Ut,i.ft=xx,i.fu=Eoe,i.fv=d_,i.fw=function(f,c,h,g,v,k,C,L=1,F,$,G){f.createArrays(),f.tilePixelRatio=Cr/(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,me]=re.textSizeScaleRange,[ke,je]=re.iconSizeScaleRange;re.textScaleFactor=ge(re.scaleFactor,ne,me),re.iconScaleFactor=ge(re.scaleFactor,ke,je);const Fe=X["text-size"],$e=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Yt}=f.textSizeData;re.compositeTextSizes=[Fe.possiblyEvaluate(new si(Et,{worldview:G}),k),Fe.possiblyEvaluate(new si(Yt,{worldview:G}),k)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Yt}=f.iconSizeData;re.compositeIconSizes=[$e.possiblyEvaluate(new si(Et,{worldview:G}),k),$e.possiblyEvaluate(new si(Yt,{worldview:G}),k)]}re.layoutTextSize=Fe.possiblyEvaluate(new si(C+1,{worldview:G}),k),re.layoutIconSize=$e.possiblyEvaluate(new si(C+1,{worldview:G}),k),re.textMaxSize=Fe.possiblyEvaluate(new si(18,{worldview:G}),k);const Xe=Z.get("symbol-placement"),mt=Z.get("text-rotation-alignment")==="map"&&Xe!=="point",ct=Z.get("text-size");let _t=!1;const Ct=[];for(const Et of f.features){const Yt=Z.get("text-font").evaluate(Et,{},k).join(","),Rt=ct.evaluate(Et,{},k)*re.textScaleFactor,rr=re.layoutTextSize.evaluate(Et,{},k)*re.textScaleFactor,lr=re.layoutIconSize.evaluate(Et,{},k)*re.iconScaleFactor,cr={horizontal:{},vertical:void 0},xr=Et.text;let vr,ur=[0,0];if(xr){const as=xr.toString(),Ua=Z.get("text-letter-spacing").evaluate(Et,{},k)*_l,dt=Z.get("text-line-height").evaluate(Et,{},k)*_l,xt=_5(as)?Ua:0,nr=Z.get("text-anchor").evaluate(Et,{},k),yr=Z.get("text-variable-anchor");if(!yr){const es=Z.get("text-radial-offset").evaluate(Et,{},k);if(es)ur=C_e(nr,[es*_l,Loe]);else{const us=Z.get("text-offset").evaluate(Et,{},k);ur=[us[0]*_l,us[1]*_l]}}let Rr=mt?"center":Z.get("text-justify").evaluate(Et,{},k);const Fr=Xe==="point",gn=Fr?Z.get("text-max-width").evaluate(Et,{},k)*_l:1/0,bn=es=>{f.allowVerticalPlacement&&Hv(as)&&(cr.vertical=Soe(xr,c,h,v,Yt,gn,dt,nr,es,xt,ur,Pu.vertical,!0,rr,Rt,F))};if(!mt&&yr){const es=Rr==="auto"?yr.map(ms=>Ooe(ms)):[Rr];let us=!1;for(let ms=0;ms=0||!Hv(as)){const es=Soe(xr,c,h,v,Yt,gn,dt,nr,Rr,xt,ur,Pu.horizontal,!1,rr,Rt,F);es&&(cr.horizontal[Rr]=es)}bn(Fr?"left":Rr)}}let pr,tr,Qt,mr,Tr,wr,hn=!1;const Ur=Z.get("icon-text-fit").evaluate(Et,{},k);if(Et.icon&&Et.icon.hasPrimary()){const as=fM(Et.icon,f.iconSizeData,X["icon-size"],k,f.zoom,Et,F,re.iconScaleFactor,G);pr=as.iconPrimary,Qt=as.iconSecondary;const Ua=pr.toString();if(tr=g.get(Ua),tr&&(Tr=Z.get("icon-offset").evaluate(Et,{},k),wr=Z.get("icon-anchor").evaluate(Et,{},k),vr=A6(v.get(Ua),Qt?v.get(Qt.toString()):void 0,Tr,wr),hn=tr.sdf,f.sdfIcons===void 0?f.sdfIcons=tr.sdf:f.sdfIcons!==tr.sdf&&Vr("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)),Qt){const dt=Qt.toString();mr=g.get(dt)}}_t=_t||!(!Et.icon||!Et.icon.hasSecondary());const Kr=O6(cr.horizontal)||cr.vertical;f.iconsInText||(f.iconsInText=!!Kr&&Kr.iconsInText);const nn=rr*re.textScaleFactor/_l,{defaultShapedIcon:xs,verticallyShapedIcon:jr}=bHe(f,vr,Z,Et,k,cr,nn,Tr,Ur);Ur!=="none"&&vr&&(h_e(vr)||f_e(vr))&&(L6(0,tr,pr,vr,xs,Ur,$,g,v),L6(0,mr,Qt,vr,xs,Ur,$,g,v),jr&&(L6(0,tr,pr,vr,jr,Ur,$,g,v),L6(0,mr,Qt,vr,jr,Ur,$,g,v))),vr=xs;const{iconBBox:sn,iconVerticalBBox:Vn,textBBox:zs,textVerticalBBox:Hs}=gHe(f,vr,jr,Z,Et,k,lr,Tr,re,v,wr,cr,rr,ur);Ct.push({feature:Et,shapedTextOrientations:cr,shapedText:Kr,shapedIcon:vr,iconPrimary:pr,iconSecondary:Qt,iconOffset:Tr,iconAnchor:wr,verticallyShapedIcon:jr,layoutTextSize:rr,layoutIconSize:lr,textOffset:ur,isSDFIcon:hn,iconTextFit:Ur,iconCollisionBounds:sn,iconVerticalCollisionBounds:Vn,textCollisionBounds:zs,textVerticalCollisionBounds:Hs})}return{featureData:Ct,sizes:re,hasAnySecondaryIcon:_t,textAlongLine:mt,symbolPlacement:Xe}},i.fx=b_e,i.fy=function(f,c,h,g,v,k,C,L,F,$){f.iconAtlasPositions=$.iconPositions;const{featureData:G,hasAnySecondaryIcon:Z,sizes:X,textAlongLine:re,symbolPlacement:ne}=c;for(const me of G){const{shapedIcon:ke,verticallyShapedIcon:je,feature:Fe,shapedTextOrientations:$e,shapedText:Xe,layoutTextSize:mt,textOffset:ct,isSDFIcon:_t,iconPrimary:Ct,iconSecondary:Et,iconTextFit:Yt,iconOffset:Rt,iconCollisionBounds:rr,iconVerticalCollisionBounds:lr,textCollisionBounds:cr}=me;T_e(ke,$.iconPositions,Ct,Et),T_e(je,$.iconPositions,Ct,Et),_He($e,$.iconPositions),vHe(Ct,Et,$.iconPositions),(Xe||ke)&&wHe(f,Fe,$e,ke,je,F,X,mt,0,ct,_t,g,v,C,L,Z,Yt,Rt,re,ne,rr,lr,cr)}h&&f.generateCollisionDebugBuffers(k,f.collisionBoxArray,X.textScaleFactor)},i.fz=$t,i.g=function(f,c){return Lh(Object.assign(f,{method:"GET"}),c)},i.h=function(f){return f.indexOf("mapbox:")===0},i.i=function(f){return Ms.API_STYLE_REGEX.test(f)&&!xl(f)},i.j=Ci,i.k=Id,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 Lh(Object.assign(f,{type:"json"}),c)},i.n=qy,i.o=Vo,i.p=function(f,c){return Lh(Object.assign(f,{method:"POST"}),c)},i.q=Tc,i.r=th,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 aoe||(aoe=new o_("ImageRasterizer")),aoe},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=Vr,i.x=Qoe,i.y=ns,i.z=Wn}),o(["./shared"],function(i){function u(nt){const ge=nt?nt.url.toString():void 0;return ge?performance.getEntriesByName(ge):[]}function p(nt){if(typeof nt=="number"||typeof nt=="boolean"||typeof nt=="string"||nt==null)return JSON.stringify(nt);if(Array.isArray(nt)){let Ae="[";for(const Ze of nt)Ae+=`${p(Ze)},`;return`${Ae}]`}let ge="{";for(const Ae of Object.keys(nt).sort())ge+=`${Ae}:${p(nt[Ae])},`;return`${ge}}`}function x(nt){let ge="";for(const Ae of i.bx)ge+=`/${p(nt[Ae])}`;return ge}class y{constructor(ge){this.keyCache={},this._layers={},this._layerConfigs={},ge&&this.replace(ge)}replace(ge,Ae){this._layerConfigs={},this._layers={},this.update(ge,[],Ae)}update(ge,Ae,Ze){this._options=Ze;for(const vt of ge)this._layerConfigs[vt.id]=vt,(this._layers[vt.id]=i.du(vt,this.scope,null,this._options)).compileFilter(Ze),this.keyCache[vt.id]&&delete this.keyCache[vt.id];for(const vt of Ae)delete this.keyCache[vt],delete this._layerConfigs[vt],delete this._layers[vt];this.familiesBySource={};const Nt=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 w{constructor(ge){const Ae={},Ze=[];for(const Bt in ge){const Pt=ge[Bt],Ut=Ae[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,jn={x:0,y:0,w:ar.bitmap.width+2*Wr,h:ar.bitmap.height+2*Wr};Ze.push(jn),Ut[fr]=jn}}const{w:Nt,h:vt}=i.G(Ze),At=new i.fk({width:Nt||1,height:vt||1});for(const Bt in ge){const Pt=ge[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=Ae[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=Ae}}function S(nt,ge,Ae){nt[ge]?Ae&&(nt[ge].center=Ae):nt[ge]={floorIds:new Set,center:Ae||[0,0],floors:{}}}function N(nt,ge,Ae,Ze){for(const Nt of ge)S(nt,Nt),nt[Nt].floors[Ae]=Ze,nt[Nt].floorIds.add(Ae)}function M(nt){return{id:nt.properties.id.toString(),center:nt.properties.center.toString().split(";").map(Number)}}function E(nt){return{id:nt.properties.id.toString(),isDefault:!!nt.properties.is_default&&nt.properties.is_default,connections:nt.properties.connected_floor_ids?new Set(nt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:nt.properties.conflicted_floor_ids?new Set(nt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:nt.properties.building_ids?new Set(nt.properties.building_ids.toString().split(";")):new Set,name:nt.properties.name.toString(),zIndex:nt.properties.z_index}}function A(nt,ge){return ge.every(Ae=>nt.properties&&nt.properties[Ae]!=null)}function P(nt){return A(nt,["type","id","name"])&&nt.properties.type==="building"}function z(nt){return A(nt,["type","id","name","z_index"])&&nt.properties.type==="floor"}i.fj(w,"GlyphAtlas");class R{constructor(ge){this.tileID=new i.aQ(ge.tileID.overscaledZ,ge.tileID.wrap,ge.tileID.canonical.z,ge.tileID.canonical.x,ge.tileID.canonical.y),this.tileZoom=ge.tileZoom,this.uid=ge.uid,this.zoom=ge.zoom,this.lut=ge.lut,this.canonical=ge.tileID.canonical,this.pixelRatio=ge.pixelRatio,this.tileSize=ge.tileSize,this.source=ge.source,this.scope=ge.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=ge.showCollisionBoxes,this.collectResourceTiming=!!ge.request&&ge.request.collectResourceTiming,this.promoteId=ge.promoteId,this.isSymbolTile=ge.isSymbolTile,this.tileTransform=i.aZ(ge.tileID.canonical,ge.projection),this.projection=ge.projection,this.worldview=ge.worldview,this.localizableLayerIds=ge.localizableLayerIds,this.brightness=ge.brightness,this.extraShadowCaster=!!ge.extraShadowCaster,this.tessellationStep=ge.tessellationStep,this.scaleFactor=ge.scaleFactor,this.worldview=ge.worldview,this.indoor=ge.indoor}parse(ge,Ae,Ze,Nt,vt,At){this.status="parsing",this.data=ge,this.collisionBoxArray=new i.b3;const Bt=new i.fm(Object.keys(ge.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:Ze,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const ts=this.indoor.indoorState.activeFloorsVisible,rs=function(Xn,Rs,Oi){const mo=function(Ni,Ks){if(!Ni)return i.w("No source layers defined in indoor specification"),Ks;if(Ni.size===0)return Ks;const Si=Ni.difference(Ks);for(const $a of Si)i.w(`Missing source layer required in indoor specification: ${$a}`);return Ks.intersection(Ks)}(Rs.sourceLayers,new Set(Object.keys(Xn.layers))),fa=Rs.indoorState,_o=function(Ni,Ks,Si,$a){const Ms=new Set,Ci=new Set,xl=new Set,Ml=new Map,$c={},wf=qo=>{const Ed=Ml.get(qo)||new Set;for(const cc of Ms)if((Ml.get(cc)||new Set).has(qo)||Ed.has(cc))return!0;return!1};for(const qo of Ks){const Ed=Ni.layers[qo];if(Ed)for(let cc=0;cc=Si.maxzoom||Si.visibility==="none")continue;U(Ks,this.zoom,ar.brightness,Ze,this.worldview);const $a=Ut[Si.id]=Si.createBucket({index:Pt.bucketLayerIDs.length,layers:Ks,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:mo,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:Nt,worldview:this.worldview,localizable:_o});Pt.bucketLayerIDs.push(Ks.map(Ci=>i.B(Ci.id,Ci.scope)));let Ms=$a.prepare?$a.prepare():null;Ms!=null?(Ms=Ms.then(()=>$a.populate(fa,ar,this.tileID.canonical,this.tileTransform)),Wr.push(Ms)):$a.populate(fa,ar,this.tileID.canonical,this.tileTransform)}}const Vr=()=>{let ts,rs,Xn,Rs,Oi,mo;fr.trim();const fa={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},_o=()=>{if(ts)return this.status="done",At(ts);if(this.extraShadowCaster)this.status="done",At(null,{buckets:Object.values(Ut).filter(Ks=>!Ks.isEmpty()),featureIndex:Pt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ar.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(rs&&Xn&&Rs){const Ks=new w(rs),Si=new Map;for(const[Ci,xl]of Xn.entries()){const{imagePosition:Ml}=i.fu(Ci,xl,i.fv);Si.set(Ci,Ml)}const $a={};for(const Ci in Ut){const xl=Ut[Ci];xl instanceof i.b4&&(U(xl.layers,this.zoom,ar.brightness,Ze,this.worldview),$a[Ci]=i.fw(xl,rs,Ks.positions,Xn,Si,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Oi,this.worldview))}const Ms={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(vt,Xn,Oi,()=>{Ms.iconsPending=!1,Ni($a,Ks,Ms)}),this.rasterizeIfNeeded(vt,Rs,mo,()=>{Ms.patternsPending=!1,Ni($a,Ks,Ms)})}},Ni=(Ks,Si,$a,Ms)=>{if($a.iconsPending||$a.patternsPending)return;const Ci=new i.fx(Xn,Rs,this.lut);for(const xl in Ut){const Ml=Ut[xl];if(xl in Ks)i.fy(Ml,Ks[xl],this.showCollisionBoxes,Ze,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Xn,Ci);else if(Ml.hasPattern&&(Ml instanceof i.ba||Ml instanceof i.bb||Ml instanceof i.ea)){U(Ml.layers,this.zoom,ar.brightness,Ze,this.worldview);const $c=Object.fromEntries(Ci.patternPositions);Ml.addFeatures(ar,this.tileID.canonical,$c,Ze,this.tileTransform,this.brightness)}}this.status="done",At(null,{buckets:Object.values(Ut).filter(xl=>!xl.isEmpty()),featureIndex:Pt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Si.image,lineAtlas:fr,imageAtlas:Ci,brightness:ar.brightness})};if(!this.extraShadowCaster){const Ks=i.fs(ar.glyphDependencies,Ms=>Object.keys(Ms).map(Number));Object.keys(Ks).length?vt.send("getGlyphs",{uid:this.uid,stacks:Ks},(Ms,Ci)=>{ts||(ts=Ms,rs=Ci,_o())},void 0,!1,fa):rs={};const Si=Array.from(ar.iconDependencies.keys()).map(Ms=>i.I.parse(Ms));Si.length?vt.send("getImages",{images:Si,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ms,Ci)=>{ts||(ts=Ms,Xn=new Map,Oi=this.updateImageMapAndGetImageTaskQueue(Xn,Ci,ar.iconDependencies),_o())},void 0,!1,fa):(Xn=new Map,Oi=new Map);const $a=Array.from(ar.patternDependencies.keys()).map(Ms=>i.I.parse(Ms));$a.length?vt.send("getImages",{images:$a,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ms,Ci)=>{ts||(ts=Ms,Rs=new Map,mo=this.updateImageMapAndGetImageTaskQueue(Rs,Ci,ar.patternDependencies),_o())},void 0,!1,fa):(Rs=new Map,mo=new Map)}if(ar.elevationFeatures&&ar.elevationFeatures.length>0){const Ks=[];for(const $a of Object.values(Ut))if($a instanceof i.bb){const Ms=$a.getUnevaluatedPortalGraph();Ms&&Ks.push(Ms)}const Si=i.ft.evaluate(Ks);for(const $a of Object.values(Ut))if($a instanceof i.bb){const Ms=ge.layers[Bt.decode($a.sourceLayerIndex)];$a.setEvaluatedPortalGraph(Si,Ms,this.tileID.canonical,ar.availableImages,ar.brightness)}}_o()};Wr.length>0?Promise.allSettled(Wr).then(Vr).catch(At):Vr()}updateParameters(ge){this.scaleFactor=ge.scaleFactor,this.showCollisionBoxes=ge.showCollisionBoxes,this.projection=ge.projection,this.brightness=ge.brightness,this.tileTransform=i.aZ(ge.tileID.canonical,ge.projection),this.extraShadowCaster=ge.extraShadowCaster,this.lut=ge.lut,this.worldview=ge.worldview,this.indoor=ge.indoor}rasterizeIfNeeded(ge,Ae,Ze,Nt){Array.from(Ae.values()).some(vt=>vt.usvg)?this.rasterize(ge,Ae,Ze,Nt):Nt()}updateImageMapAndGetImageTaskQueue(ge,Ae,Ze){const Nt=new Map;for(const vt of Ae.keys()){const At=Ze.get(vt)||[];for(const Bt of At){const Pt=Bt.toString(),Ut=Ae.get(Bt.id.toString());Ut.usvg?Nt.has(Pt)||(Nt.set(Pt,Bt),ge.set(Pt,Object.assign({},Ut))):ge.set(Pt,Ut)}}return Nt}rasterize(ge,Ae,Ze,Nt){this.rasterizeTask=ge.send("rasterizeImages",{scope:this.scope,tasks:Ze},(vt,At)=>{if(!vt)for(const[Bt,Pt]of At.entries()){const Ut=Object.assign(Ae.get(Bt),{data:Pt});Ae.set(Bt,Ut)}Nt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function U(nt,ge,Ae,Ze,Nt){const vt=new i.ac(ge,{brightness:Ae,worldview:Nt});for(const At of nt)At.recalculate(vt,Ze)}class V extends i.E{constructor(ge,Ae,Ze,Nt,vt,At,Bt){super(),this.actor=ge,this.layerIndex=Ae,this.availableImages=Ze,this.availableModels=Nt,this.loadVectorData=At||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(ge.scheduler),this.isSpriteLoaded=vt,this.scheduler=ge.scheduler,this.brightness=Bt}loadTile(ge,Ae){const Ze=ge.uid,Nt=ge&&ge.request,vt=Nt&&Nt.collectResourceTiming,At=this.loading[Ze]=new R(ge);At.abort=this.loadVectorData(ge,(Bt,Pt)=>{const Ut=!this.loading[Ze];if(delete this.loading[Ze],At.cancelRasterize(),Ut||Bt||!Pt)return At.status="done",Ut||(this.loaded[Ze]=At),Ae(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 jn=()=>{At.parse(At.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Vr,ts)=>{if(Vr||!ts)return Ae(Vr);const rs={};if(vt){const Xn=u(Nt);Xn.length>0&&(rs.resourceTiming=JSON.parse(JSON.stringify(Xn)))}Ae(null,Object.assign({rawTileData:fr.slice(0),responseHeaders:Pt.responseHeaders},ts,ar,rs))})};this.isSpriteLoaded?jn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(jn,{type:"parseTile",isSymbolTile:ge.isSymbolTile,zoom:ge.tileZoom}):jn()}),this.loaded=this.loaded||{},this.loaded[Ze]=At})}reloadTile(ge,Ae){const Ze=this.loaded,Nt=ge.uid;if(Ze&&Ze[Nt]){const vt=Ze[Nt];vt.updateParameters(ge);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)),Ae(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 Ae(null,void 0)}abortTile(ge,Ae){const Ze=ge.uid,Nt=this.loading[Ze];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ze]),Ae()}removeTile(ge,Ae){const Ze=this.loaded,Nt=ge.uid;Ze&&Ze[Nt]&&delete Ze[Nt],Ae()}}class K{loadTile(ge,Ae){const{uid:Ze,encoding:Nt,rawImageData:vt,padding:At}=ge,Bt=ImageBitmap&&vt instanceof ImageBitmap?this.getImageData(vt,At):vt;Ae(null,new i.fA(Ze,Bt,Nt,At<1))}reloadTile(ge,Ae){Ae(null,null)}abortTile(ge,Ae){Ae()}removeTile(ge,Ae){Ae()}getImageData(ge,Ae){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(ge.width,ge.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=ge.width,this.offscreenCanvas.height=ge.height,this.offscreenCanvasContext.drawImage(ge,0,0,ge.width,ge.height);const Ze=this.offscreenCanvasContext.getImageData(-Ae,-Ae,ge.width+2*Ae,ge.height+2*Ae);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ze}}i.bs.setPbf(i.bt);class W{constructor(ge){this._mrt=new i.bs(ge.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=ge.uid,this.tileID=ge.tileID,this.source=ge.source}parse(ge,Ae){const Ze=this._mrt;this.status="parsing",this._entireBuffer=ge;try{Ze.parseHeader(ge),this._isHeaderLoaded=!0;const Nt=[];for(const vt in Ze.layers){const At=Ze.getLayer(vt),Bt=At.getDataRange(At.getBandList()),Pt=Ze.createDecodingTask(Bt),Ut=ge.slice(Bt.firstByte,Bt.lastByte+1),fr=i.bs.performDecoding(Ut,Pt).then(ar=>Pt.complete(null,ar)).catch(ar=>Pt.complete(ar,null));Nt.push(fr)}Promise.allSettled(Nt).then(()=>Ae(null,Ze)).catch(vt=>Ae(vt))}catch(Nt){Ae(Nt)}}}class J{constructor(ge){this.actor=ge,this.loading={},this.loaded={}}loadTile(ge,Ae){const Ze=ge.uid,Nt=ge.request,vt=this.loading[Ze]=new W(ge),{cancel:At}=i.bu(Nt,(Bt,Pt,Ut)=>{const fr=!this.loading[Ze];if(delete this.loading[Ze],fr||Bt||!Pt)return vt.status="done",fr||(this.loaded[Ze]=vt),Ae(Bt);vt.parse(Pt,(ar,Wr)=>{if(ar||!Wr)return Ae(ar);Ae(null,Wr,Ut)}),this.loaded[Ze]=vt});vt.abort=At}reloadTile(ge,Ae){Ae(null,void 0)}abortTile(ge,Ae){const Ze=ge.uid,Nt=this.loading[Ze];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ze]),Ae()}removeTile(ge,Ae){const Ze=ge.uid;this.loaded[Ze]&&delete this.loaded[Ze],Ae()}decodeRasterArray(ge,Ae){i.bs.performDecoding(ge.buffer,ge.task).then(Ze=>Ae(null,Ze)).catch(Ze=>Ae(Ze))}}const ae=i.fB.prototype.toGeoJSON;class oe{constructor(ge){this._feature=ge,this.extent=i.al,this.type=ge.type,this.properties=ge.tags,"id"in ge&&!isNaN(ge.id)&&(this.id=parseInt(ge.id,10))}loadGeometry(){if(this._feature.type===1){const ge=[];for(const Ae of this._feature.geometry)ge.push([new i.P(Ae[0],Ae[1])]);return ge}{const ge=[];for(const Ae of this._feature.geometry){const Ze=[];for(const Nt of Ae)Ze.push(new i.P(Nt[0],Nt[1]));ge.push(Ze)}return ge}}toGeoJSON(ge,Ae,Ze){return ae.call(this,ge,Ae,Ze)}}class xe{constructor(ge,Ae){this.name=ge,this.extent=i.al,this.length=Ae.length,this._jsonFeatures=Ae}feature(ge){return new oe(this._jsonFeatures[ge])}}class ie{constructor(ge){this.layers={},this.extent=i.al;for(const Ae of Object.keys(ge))this.layers[Ae]=new xe(Ae,ge[Ae])}}const pe=64/4096,se=128;class fe{constructor(){this.features=new Map}clear(){this.features.clear()}load(ge=[],Ae){for(const Ze of ge){const Nt=Ze.id;if(Nt==null)continue;let vt=this.features.get(Nt);vt&&this.updateCache(vt,Ae),Ze.geometry?(vt=ye(Ze),this.updateCache(vt,Ae),this.features.set(Nt,vt)):this.features.delete(Nt),this.updateCache(vt,Ae)}}updateCache(ge,Ae){for(const{canonical:Ze,uid:Nt}of Object.values(Ae)){const{z:vt,x:At,y:Bt}=Ze;he(ge,Math.pow(2,vt),At,Bt)&&delete Ae[Nt]}}getTile(ge,Ae,Ze){const Nt=Math.pow(2,ge),vt=[];for(const At of this.features.values())he(At,Nt,Ae,Ze)&&vt.push(be(At,Nt,Ae,Ze));return{features:vt}}getFeatures(){return[...this.features.values()]}}function he({minX:nt,minY:ge,maxX:Ae,maxY:Ze},Nt,vt,At){return nt<(vt+1+pe)/Nt&&ge<(At+1+pe)/Nt&&Ae>(vt-pe)/Nt&&Ze>(At-pe)/Nt}function ye(nt){const{id:ge,geometry:Ae,properties:Ze}=nt;if(!Ae)return;if(Ae.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:Nt,coordinates:vt}=Ae,At={id:ge,type:1,geometry:[],tags:Ze,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Bt=At.geometry;if(Nt==="Point")Ce(vt,Bt,At);else if(Nt==="MultiPoint")for(const Pt of vt)Ce(Pt,Bt,At);else if(Nt==="LineString")At.type=2,Se(vt,Bt,At);else if(Nt==="MultiLineString")At.type=2,Ne(vt,Bt,At);else if(Nt==="Polygon")At.type=3,Ne(vt,Bt,At,!0);else{if(Nt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");At.type=3;for(const Pt of vt)Ne(Pt,Bt,At,!0)}return At}function Ce([nt,ge],Ae,Ze){const Nt=i.aF(nt);let vt=i.aJ(ge);vt=vt<0?0:vt>1?1:vt,Ae.push(Nt,vt),Ze.minX=Math.min(Ze.minX,Nt),Ze.minY=Math.min(Ze.minY,vt),Ze.maxX=Math.max(Ze.maxX,Nt),Ze.maxY=Math.max(Ze.maxY,vt)}function Se(nt,ge,Ae,Ze=!1,Nt=!1){const vt=[];for(const At of nt)Ce(At,vt,Ae);ge.push(vt),Ze&&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(Vr*((At-Ut)/jn)),Ut=At):ar>=At&&(Wr=fr+Math.round(Vr*((At-Ut)/jn)),ar=At),fr>=At&&Wr>=At||(fr>=At?(Ut+=Math.round(jn*((At-fr)/Vr)),fr=At):Wr>=At&&(ar=Ut+Math.round(jn*((At-fr)/Vr)),Wr=At),Bt&&Ut===Bt[Bt.length-1][0]&&fr===Bt[Bt.length-1][1]||(Bt=[[Ut,fr]],Nt.push(Bt)),Bt.push([ar,Wr])))))}}function Te(nt,ge,Ae,Ze,Nt){const vt=(Ae-pe)/ge,At=(Ze-pe)/ge,Bt=(Ae+1+pe)/ge,Pt=(Ze+1+pe)/ge;function Ut(Wr,jn){let Vr=0;return WrBt&&(Vr|=2),jnPt&&(Vr|=8),Vr}let fr=[];for(let Wr=1;Wr<=8;Wr*=2){let jn=nt[nt.length-2],Vr=nt[nt.length-1],ts=!(Ut(jn,Vr)&Wr);for(let rs=0;rs>31}function ht(nt,ge){const{geometry:Ae,type:Ze}=nt;let Nt=0,vt=0;if(Ze===1){ge.writeVarint(Be(1,Ae.length));for(const At of Ae){const Bt=At[0]-Nt,Pt=At[1]-vt;ge.writeVarint(Ye(Bt)),ge.writeVarint(Ye(Pt)),Nt+=Bt,vt+=Pt}}else for(const At of Ae){ge.writeVarint(Be(1,1));const Bt=At.length-(Ze===3?1:0);for(let Pt=0;Ptnt},le=Math.fround||(Ve=new Float32Array(1),nt=>(Ve[0]=+nt,Ve[0]));var Ve;const Le=3,We=5,_e=6;class st{constructor(ge){this.options=Object.assign(Object.create(Qe),ge),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ge){const{log:Ae,minZoom:Ze,maxZoom:Nt}=this.options;Ae&&console.time("total time");const vt=`prepare ${ge.length} points`;Ae&&console.time(vt),this.points=ge;const At=[];for(let Pt=0;Pt=Ze;Pt--){const Ut=+Date.now();Bt=this.trees[Pt]=this._createTree(this._cluster(Bt,Pt)),Ae&&console.log("z%d: %d clusters in %dms",Pt,Bt.numItems,+Date.now()-Ut)}return Ae&&console.timeEnd("total time"),this}getClusters(ge,Ae){let Ze=((ge[0]+180)%360+360)%360-180;const Nt=Math.max(-90,Math.min(90,ge[1]));let vt=ge[2]===180?180:((ge[2]+180)%360+360)%360-180;const At=Math.max(-90,Math.min(90,ge[3]));if(ge[2]-ge[0]>=360)Ze=-180,vt=180;else if(Ze>vt){const ar=this.getClusters([Ze,Nt,180,At],Ae),Wr=this.getClusters([-180,Nt,vt,At],Ae);return ar.concat(Wr)}const Bt=this.trees[this._limitZoom(Ae)],Pt=Bt.range(Je(Ze),at(At),Je(vt),at(Nt)),Ut=Bt.data,fr=[];for(const ar of Pt){const Wr=this.stride*ar;fr.push(Ut[Wr+We]>1?ze(Ut,Wr,this.clusterProps):this.points[Ut[Wr+Le]])}return fr}getChildren(ge){const Ae=this._getOriginId(ge),Ze=this._getOriginZoom(ge),Nt="No cluster with the specified id.",vt=this.trees[Ze];if(!vt)throw new Error(Nt);const At=vt.data;if(Ae*this.stride>=At.length)throw new Error(Nt);const Bt=this.options.radius/(this.options.extent*Math.pow(2,Ze-1)),Pt=vt.within(At[Ae*this.stride],At[Ae*this.stride+1],Bt),Ut=[];for(const fr of Pt){const ar=fr*this.stride;At[ar+4]===ge&&Ut.push(At[ar+We]>1?ze(At,ar,this.clusterProps):this.points[At[ar+Le]])}if(Ut.length===0)throw new Error(Nt);return Ut}getLeaves(ge,Ae,Ze){const Nt=[];return this._appendLeaves(Nt,ge,Ae=Ae||10,Ze=Ze||0,0),Nt}getTile(ge,Ae,Ze){const Nt=this.trees[this._limitZoom(ge)],vt=Math.pow(2,ge),{extent:At,radius:Bt}=this.options,Pt=Bt/At,Ut=(Ze-Pt)/vt,fr=(Ze+1+Pt)/vt,ar={features:[]};return this._addTileFeatures(Nt.range((Ae-Pt)/vt,Ut,(Ae+1+Pt)/vt,fr),Nt.data,Ae,Ze,vt,ar),Ae===0&&this._addTileFeatures(Nt.range(1-Pt/vt,Ut,1,fr),Nt.data,vt,Ze,vt,ar),Ae===vt-1&&this._addTileFeatures(Nt.range(0,Ut,Pt/vt,fr),Nt.data,-1,Ze,vt,ar),ar.features.length?ar:null}getClusterExpansionZoom(ge){let Ae=this._getOriginZoom(ge)-1;for(;Ae<=this.options.maxZoom;){const Ze=this.getChildren(ge);if(Ae++,Ze.length!==1)break;ge=Ze[0].properties.cluster_id}return Ae}_appendLeaves(ge,Ae,Ze,Nt,vt){const At=this.getChildren(Ae);for(const Bt of At){const Pt=Bt.properties;if(Pt&&Pt.cluster?vt+Pt.point_count<=Nt?vt+=Pt.point_count:vt=this._appendLeaves(ge,Pt.cluster_id,Ze,Nt,vt):vt1;let fr,ar,Wr;if(Ut)fr=Ee(Ae,Pt,this.clusterProps),ar=Ae[Pt],Wr=Ae[Pt+1];else{const ts=this.points[Ae[Pt+Le]];fr=ts.properties;const[rs,Xn]=ts.geometry.coordinates;ar=Je(rs),Wr=at(Xn)}const jn={type:1,geometry:[[Math.round(this.options.extent*(ar*vt-Ze)),Math.round(this.options.extent*(Wr*vt-Nt))]],tags:fr};let Vr;Vr=Ut||this.options.generateId?Ae[Pt+Le]:this.points[Ae[Pt+Le]].id,Vr!==void 0&&(jn.id=Vr),At.features.push(jn)}}_limitZoom(ge){return Math.max(this.options.minZoom,Math.min(Math.floor(+ge),this.options.maxZoom+1))}_cluster(ge,Ae){const{radius:Ze,extent:Nt,reduce:vt,minPoints:At}=this.options,Bt=Ze/(Nt*Math.pow(2,Ae)),Pt=ge.data,Ut=[],fr=this.stride;for(let ar=0;arAe&&(rs+=Pt[Rs+We])}if(rs>ts&&rs>=At){let Xn,Rs=Wr*ts,Oi=jn*ts,mo=-1;const fa=(ar/fr<<5)+(Ae+1)+this.points.length;for(const _o of Vr){const Ni=_o*fr;if(Pt[Ni+2]<=Ae)continue;Pt[Ni+2]=Ae;const Ks=Pt[Ni+We];Rs+=Pt[Ni]*Ks,Oi+=Pt[Ni+1]*Ks,Pt[Ni+4]=fa,vt&&(Xn||(Xn=this._map(Pt,ar,!0),mo=this.clusterProps.length,this.clusterProps.push(Xn)),vt(Xn,this._map(Pt,Ni)))}Pt[ar+4]=fa,Ut.push(Rs/rs,Oi/rs,1/0,fa,-1,rs),vt&&Ut.push(mo)}else{for(let Xn=0;Xn1)for(const Xn of Vr){const Rs=Xn*fr;if(!(Pt[Rs+2]<=Ae)){Pt[Rs+2]=Ae;for(let Oi=0;Oi>5}_getOriginZoom(ge){return(ge-this.points.length)%32}_map(ge,Ae,Ze){if(ge[Ae+We]>1){const At=this.clusterProps[ge[Ae+_e]];return Ze?Object.assign({},At):At}const Nt=this.points[ge[Ae+Le]].properties,vt=this.options.map(Nt);return Ze&&vt===Nt?Object.assign({},vt):vt}}function ze(nt,ge,Ae){return{type:"Feature",id:nt[ge+Le],properties:Ee(nt,ge,Ae),geometry:{type:"Point",coordinates:[(Ze=nt[ge],360*(Ze-.5)),pt(nt[ge+1])]}};var Ze}function Ee(nt,ge,Ae){const Ze=nt[ge+We],Nt=Ze>=1e4?`${Math.round(Ze/1e3)}k`:Ze>=1e3?Math.round(Ze/100)/10+"k":Ze,vt=nt[ge+_e],At=vt===-1?{}:Object.assign({},Ae[vt]);return Object.assign(At,{cluster:!0,cluster_id:nt[ge+Le],point_count:Ze,point_count_abbreviated:Nt})}function Je(nt){return nt/360+.5}function at(nt){const ge=Math.sin(nt*Math.PI/180),Ae=.5-.25*Math.log((1+ge)/(1-ge))/Math.PI;return Ae<0?0:Ae>1?1:Ae}function pt(nt){const ge=(180-360*nt)*Math.PI/180;return 360*Math.atan(Math.exp(ge))/Math.PI-90}function gt(nt,ge,Ae,Ze){let Nt=Ze;const vt=ge+(Ae-ge>>1);let At,Bt=Ae-ge;const Pt=nt[ge],Ut=nt[ge+1],fr=nt[Ae],ar=nt[Ae+1];for(let Wr=ge+3;WrNt)At=Wr,Nt=jn;else if(jn===Nt){const Vr=Math.abs(Wr-vt);VrZe&&(At-ge>3&>(nt,ge,At,Ze),nt[At+2]=Nt,Ae-At>3&>(nt,At,Ae,Ze))}function Mt(nt,ge,Ae,Ze,Nt,vt){let At=Nt-Ae,Bt=vt-Ze;if(At!==0||Bt!==0){const Pt=((nt-Ae)*At+(ge-Ze)*Bt)/(At*At+Bt*Bt);Pt>1?(Ae=Nt,Ze=vt):Pt>0&&(Ae+=At*Pt,Ze+=Bt*Pt)}return At=nt-Ae,Bt=ge-Ze,At*At+Bt*Bt}function wt(nt,ge,Ae,Ze){const Nt={id:nt??null,type:ge,geometry:Ae,tags:Ze,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ge==="Point"||ge==="MultiPoint"||ge==="LineString")Xt(Nt,Ae);else if(ge==="Polygon")Xt(Nt,Ae[0]);else if(ge==="MultiLineString")for(const vt of Ae)Xt(Nt,vt);else if(ge==="MultiPolygon")for(const vt of Ae)Xt(Nt,vt[0]);return Nt}function Xt(nt,ge){for(let Ae=0;Ae0&&(At+=Ze?(Nt*fr-Ut*vt)/2:Math.sqrt(Math.pow(Ut-Nt,2)+Math.pow(fr-vt,2))),Nt=Ut,vt=fr}const Bt=ge.length-3;ge[2]=1,gt(ge,0,Bt,Ae),ge[Bt+2]=1,ge.size=Math.abs(At),ge.start=0,ge.end=ge.size}function Xr(nt,ge,Ae,Ze){for(let Nt=0;Nt1?1:Ae}function hr(nt,ge,Ae,Ze,Nt,vt,At,Bt){if(Ze/=ge,vt>=(Ae/=ge)&&At=Ze)return null;const Pt=[];for(const Ut of nt){const fr=Ut.geometry;let ar=Ut.type;const Wr=Nt===0?Ut.minX:Ut.minY,jn=Nt===0?Ut.maxX:Ut.maxY;if(Wr>=Ae&&jn=Ze)continue;let Vr=[];if(ar==="Point"||ar==="MultiPoint")ys(fr,Vr,Ae,Ze,Nt);else if(ar==="LineString")Ca(fr,Vr,Ae,Ze,Nt,!1,Bt.lineMetrics);else if(ar==="MultiLineString")$i(fr,Vr,Ae,Ze,Nt,!1);else if(ar==="Polygon")$i(fr,Vr,Ae,Ze,Nt,!0);else if(ar==="MultiPolygon")for(const ts of fr){const rs=[];$i(ts,rs,Ae,Ze,Nt,!0),rs.length&&Vr.push(rs)}if(Vr.length){if(Bt.lineMetrics&&ar==="LineString"){for(const ts of Vr)Pt.push(wt(Ut.id,ar,ts,Ut.tags));continue}ar!=="LineString"&&ar!=="MultiLineString"||(Vr.length===1?(ar="LineString",Vr=Vr[0]):ar="MultiLineString"),ar!=="Point"&&ar!=="MultiPoint"||(ar=Vr.length===3?"Point":"MultiPoint"),Pt.push(wt(Ut.id,ar,Vr,Ut.tags))}}return Pt.length?Pt:null}function ys(nt,ge,Ae,Ze,Nt){for(let vt=0;vt=Ae&&At<=Ze&&Ui(ge,nt[vt],nt[vt+1],nt[vt+2])}}function Ca(nt,ge,Ae,Ze,Nt,vt,At){let Bt=va(nt);const Pt=Nt===0?al:yo;let Ut,fr,ar=nt.start;for(let rs=0;rsAe&&(fr=Pt(Bt,Xn,Rs,mo,fa,Ae),At&&(Bt.start=ar+Ut*fr)):_o>Ze?Ni=Ae&&(fr=Pt(Bt,Xn,Rs,mo,fa,Ae),Ks=!0),Ni>Ze&&_o<=Ze&&(fr=Pt(Bt,Xn,Rs,mo,fa,Ze),Ks=!0),!vt&&Ks&&(At&&(Bt.end=ar+Ut*fr),ge.push(Bt),Bt=va(nt)),At&&(ar+=Ut)}let Wr=nt.length-3;const jn=nt[Wr],Vr=nt[Wr+1],ts=Nt===0?jn:Vr;ts>=Ae&&ts<=Ze&&Ui(Bt,jn,Vr,nt[Wr+2]),Wr=Bt.length-3,vt&&Wr>=3&&(Bt[Wr]!==Bt[0]||Bt[Wr+1]!==Bt[1])&&Ui(Bt,Bt[0],Bt[1],Bt[2]),Bt.length&&ge.push(Bt)}function va(nt){const ge=[];return ge.size=nt.size,ge.start=nt.start,ge.end=nt.end,ge}function $i(nt,ge,Ae,Ze,Nt,vt){for(const At of nt)Ca(At,ge,Ae,Ze,Nt,vt,!1)}function Ui(nt,ge,Ae,Ze){nt.push(ge,Ae,Ze)}function al(nt,ge,Ae,Ze,Nt,vt){const At=(vt-ge)/(Ze-ge);return Ui(nt,vt,Ae+(Nt-Ae)*At,1),At}function yo(nt,ge,Ae,Ze,Nt,vt){const At=(vt-Ae)/(Nt-Ae);return Ui(nt,ge+(Ze-ge)*At,vt,1),At}function Gs(nt,ge){const Ae=[];for(let Ze=0;Ze0&&ge.size<(Nt?At:Ze))return void(Ae.numPoints+=ge.length/3);const Bt=[];for(let Pt=0;PtAt)&&(Ae.numSimplified++,Bt.push(ge[Pt],ge[Pt+1])),Ae.numPoints++;Nt&&function(Pt,Ut){let fr=0;for(let ar=0,Wr=Pt.length,jn=Wr-2;ar0===Ut)for(let ar=0,Wr=Pt.length;ar24)throw new Error("maxZoom should be in the 0-24 range");if(Ae.promoteId&&Ae.generateId)throw new Error("promoteId and generateId cannot be used together.");let Nt=function(vt,At){const Bt=[];if(vt.type==="FeatureCollection")for(let Pt=0;Pt1&&console.time("creation"),jn=this.tiles[Wr]=Ra(ge,Ae,Ze,Nt,Ut),this.tileCoords.push({z:Ae,x:Ze,y:Nt}),fr)){fr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ae,Ze,Nt,jn.numFeatures,jn.numPoints,jn.numSimplified),console.timeEnd("creation"));const Ks=`z${Ae}`;this.stats[Ks]=(this.stats[Ks]||0)+1,this.total++}if(jn.source=ge,vt==null){if(Ae===Ut.indexMaxZoom||jn.numPoints<=Ut.indexMaxPoints)continue}else{if(Ae===Ut.maxZoom||Ae===vt)continue;if(vt!=null){const Ks=vt-Ae;if(Ze!==At>>Ks||Nt!==Bt>>Ks)continue}}if(jn.source=null,ge.length===0)continue;fr>1&&console.time("clipping");const Vr=.5*Ut.buffer/Ut.extent,ts=.5-Vr,rs=.5+Vr,Xn=1+Vr;let Rs=null,Oi=null,mo=null,fa=null,_o=hr(ge,ar,Ze-Vr,Ze+rs,0,jn.minX,jn.maxX,Ut),Ni=hr(ge,ar,Ze+ts,Ze+Xn,0,jn.minX,jn.maxX,Ut);ge=null,_o&&(Rs=hr(_o,ar,Nt-Vr,Nt+rs,1,jn.minY,jn.maxY,Ut),Oi=hr(_o,ar,Nt+ts,Nt+Xn,1,jn.minY,jn.maxY,Ut),_o=null),Ni&&(mo=hr(Ni,ar,Nt-Vr,Nt+rs,1,jn.minY,jn.maxY,Ut),fa=hr(Ni,ar,Nt+ts,Nt+Xn,1,jn.minY,jn.maxY,Ut),Ni=null),fr>1&&console.timeEnd("clipping"),Pt.push(Rs||[],Ae+1,2*Ze,2*Nt),Pt.push(Oi||[],Ae+1,2*Ze,2*Nt+1),Pt.push(mo||[],Ae+1,2*Ze+1,2*Nt),Pt.push(fa||[],Ae+1,2*Ze+1,2*Nt+1)}}getTile(ge,Ae,Ze){ge=+ge,Ae=+Ae,Ze=+Ze;const Nt=this.options,{extent:vt,debug:At}=Nt;if(ge<0||ge>24)return null;const Bt=1<1&&console.log("drilling down to z%d-%d-%d",ge,Ae,Ze);let Ut,fr=ge,ar=Ae,Wr=Ze;for(;!Ut&&fr>0;)fr--,ar>>=1,Wr>>=1,Ut=this.tiles[Eo(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,ge,Ae,Ze),At>1&&console.timeEnd("drilling down"),this.tiles[Pt]?Cs(this.tiles[Pt],vt):null):null}}function Eo(nt,ge,Ae){return 32*((1<Ut.tags&&"3d_elevation_id"in Ut.tags&&"source"in Ut.tags&&Ut.tags.source==="elevation",vt=Ze.features.filter(Ut=>Nt(Ut));let At={_geojsonTileLayer:Ze.features};vt.length>0&&(At={_geojsonTileLayer:Ze.features.filter(Ut=>!Nt(Ut)),hd_road_elevation:vt});const Bt=new ie(At),Pt=function(Ut){const fr=new i.bt;for(const ar of Object.keys(Ut))fr.writeMessage(3,Pe,{name:ar,features:Ut[ar]});return fr.finish()}(At).buffer;ge(null,{vectorTile:Bt,rawData:Pt})}class vo extends V{constructor(ge,Ae,Ze,Nt,vt,At,Bt){super(ge,Ae,Ze,Nt,vt,is,Bt),At&&(this.loadGeoJSON=At),this._dynamicIndex=new fe}loadData(ge,Ae){const Ze=ge&&ge.request,Nt=Ze&&Ze.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(ge,(vt,At)=>{if(vt||!At)return Ae(vt);if(typeof At!="object")return Ae(new Error(`Input data given to '${ge.source}' is not a valid GeoJSON object.`));{try{if(ge.filter){const Pt=i.U(ge.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))}ge.dynamic?(At.type==="Feature"&&(At={type:"FeatureCollection",features:[At]}),ge.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(At.features,this.loaded),ge.cluster&&(At.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=ge.cluster?new st(function({superclusterOptions:Pt,clusterProperties:Ut}){if(!Ut||!Pt)return Pt;const fr={},ar={},Wr={accumulated:null,zoom:0},jn={properties:null},Vr=Object.keys(Ut);for(const ts of Vr){const[rs,Xn]=Ut[ts],Rs=i.U(Xn),Oi=i.U(typeof rs=="string"?[rs,["accumulated"],["get",ts]]:rs);fr[ts]=Rs.value,ar[ts]=Oi.value}return Pt.map=ts=>{jn.properties=ts;const rs={};for(const Xn of Vr)rs[Xn]=fr[Xn].evaluate(Wr,jn);return rs},Pt.reduce=(ts,rs)=>{jn.properties=rs;for(const Xn of Vr)Wr.accumulated=ts[Xn],ts[Xn]=ar[Xn].evaluate(Wr,jn)},Pt}(ge)).load(At.features):ge.dynamic?this._dynamicIndex:function(Pt,Ut){return new gl(Pt,Ut)}(At,ge.geojsonVtOptions)}catch(Pt){return Ae(Pt)}const Bt={};if(Nt){const Pt=u(Ze);Pt&&(Bt.resourceTiming={},Bt.resourceTiming[ge.source]=JSON.parse(JSON.stringify(Pt)))}Ae(null,Bt)}})}reloadTile(ge,Ae){const Ze=this.loaded;return Ze&&Ze[ge.uid]?ge.partial?Ae(null,void 0):super.reloadTile(ge,Ae):this.loadTile(ge,Ae)}loadGeoJSON(ge,Ae){if(ge.request)i.m(ge.request,Ae);else{if(typeof ge.data!="string")return Ae(new Error(`Input data given to '${ge.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Ae(null,JSON.parse(ge.data))}catch{return Ae(new Error(`Input data given to '${ge.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(ge,Ae){try{Ae(null,this._geoJSONIndex.getClusterExpansionZoom(ge.clusterId))}catch(Ze){Ae(Ze)}}getClusterChildren(ge,Ae){try{Ae(null,this._geoJSONIndex.getChildren(ge.clusterId))}catch(Ze){Ae(Ze)}}getClusterLeaves(ge,Ae){try{Ae(null,this._geoJSONIndex.getLeaves(ge.clusterId,ge.limit,ge.offset))}catch(Ze){Ae(Ze)}}}class ku{constructor(ge,Ae,Ze){this.tileID=new i.aQ(ge.tileID.overscaledZ,ge.tileID.wrap,ge.tileID.canonical.z,ge.tileID.canonical.x,ge.tileID.canonical.y),this.tileZoom=ge.tileZoom,this.uid=ge.uid,this.zoom=ge.zoom,this.canonical=ge.tileID.canonical,this.pixelRatio=ge.pixelRatio,this.tileSize=ge.tileSize,this.source=ge.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=ge.projection,this.brightness=Ae,this.worldview=Ze}parse(ge,Ae,Ze,Nt){this.status="parsing";const vt=new i.aQ(Ze.tileID.overscaledZ,Ze.tileID.wrap,Ze.tileID.canonical.z,Ze.tileID.canonical.x,Ze.tileID.canonical.y),At=[],Bt=Ae.familiesBySource[Ze.source],Pt=new i.fn(vt,Ze.promoteId);Pt.bucketLayerIDs=[],Pt.is3DTile=!0,i.fC(ge).then(Ut=>{if(!Ut)return Nt(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 jn in Bt)for(const Vr of Bt[jn]){const ts=Vr[0];Pt.bucketLayerIDs.push(Vr.map(Rs=>i.B(Rs.id,Rs.scope))),ts.recalculate(Wr,[]);const rs=i.fD(Ut,1/i.d7(Ze.tileID.canonical)),Xn=new i.fE(Vr,rs,vt,fr,ar,this.brightness,Pt,this.worldview);fr||(Xn.needsUpload=!0),At.push(Xn),Xn.evaluate(ts)}this.status="done",Nt(null,{buckets:At,featureIndex:Pt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ut=>Nt(new Error(Ut.message)))}}class Hl{constructor(ge,Ae,Ze,Nt,vt,At,Bt,Pt){this.actor=ge,this.layerIndex=Ae,this.availableImages=Ze,this.availableModels=Nt,this.brightness=Bt,this.loading={},this.loaded={},this.worldview=Pt}loadTile(ge,Ae){const Ze=ge.uid,Nt=this.loading[Ze]=new ku(ge,this.brightness,this.worldview);i.bu(ge.request,(vt,At)=>{const Bt=!this.loading[Ze];return delete this.loading[Ze],Bt||vt?(Nt.status="done",Bt||(this.loaded[Ze]=Nt),Ae(vt)):At&&At.byteLength!==0?void Nt.parse(At,this.layerIndex,ge,(Pt,Ut)=>{Nt.status="done",this.loaded=this.loaded||{},this.loaded[Ze]=Nt,Pt||!Ut?Ae(Pt):Ae(null,Ut)}):(Nt.status="done",this.loaded[Ze]=Nt,Ae())})}reloadTile(ge,Ae){const Ze=this.loaded,Nt=ge.uid;if(Ze&&Ze[Nt]){const vt=Ze[Nt];vt.projection=ge.projection,vt.brightness=ge.brightness;const At=(Bt,Pt)=>{vt.reloadCallback&&(delete vt.reloadCallback,this.loadTile(ge,Ae)),Ae(Bt,Pt)};vt.status==="parsing"?vt.reloadCallback=At:vt.status==="done"&&this.loadTile(ge,Ae)}}abortTile(ge,Ae){const Ze=ge.uid;this.loading[Ze]&&delete this.loading[Ze],Ae()}removeTile(ge,Ae){const Ze=this.loaded,Nt=ge.uid;Ze&&Ze[Nt]&&delete Ze[Nt],Ae()}}class Nu{constructor(ge){this.self=ge,this.actor=new i.fG(ge,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:vo,"raster-dem":K,"raster-array":J,"batched-model":Hl},this.workerSources={},this.self.registerWorkerSource=(Ae,Ze)=>{if(this.workerSourceTypes[Ae])throw new Error(`Worker source with name "${Ae}" already registered.`);this.workerSourceTypes[Ae]=Ze},this.self.registerRTLTextPlugin=Ae=>{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=Ae.applyArabicShaping,i.fH.processBidirectionalText=Ae.processBidirectionalText,i.fH.processStyledBidirectionalText=Ae.processStyledBidirectionalText;for(const Ze of this.rtlPluginParsingListeners)Ze(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(ge,Ae,Ze){delete this.layerIndexes[ge],delete this.availableImages[ge],delete this.availableModels[ge],delete this.workerSources[ge],Ze()}checkIfReady(ge,Ae,Ze){Ze()}setReferrer(ge,Ae){this.referrer=Ae}spriteLoaded(ge,Ae){this.isSpriteLoaded[ge]||(this.isSpriteLoaded[ge]={});const{scope:Ze,isLoaded:Nt}=Ae;if(this.isSpriteLoaded[ge][Ze]=Nt,this.workerSources[ge]&&this.workerSources[ge][Ze])for(const vt in this.workerSources[ge][Ze]){const At=this.workerSources[ge][Ze][vt];for(const Bt in At){const Pt=At[Bt];Pt instanceof V&&(Pt.isSpriteLoaded=Nt,Pt.fire(new i.z("isSpriteLoaded")))}}}setImages(ge,Ae,Ze){this.availableImages[ge]||(this.availableImages[ge]={});const{scope:Nt,images:vt}=Ae;if(this.availableImages[ge][Nt]=vt,this.workerSources[ge]&&this.workerSources[ge][Nt]){for(const At in this.workerSources[ge][Nt]){const Bt=this.workerSources[ge][Nt][At];for(const Pt in Bt)Bt[Pt].availableImages=vt}Ze()}else Ze()}setModels(ge,{scope:Ae,models:Ze},Nt){if(this.availableModels[ge]||(this.availableModels[ge]={}),this.availableModels[ge][Ae]=Ze,this.workerSources[ge]&&this.workerSources[ge][Ae]){for(const vt in this.workerSources[ge][Ae]){const At=this.workerSources[ge][Ae][vt];for(const Bt in At)At[Bt].availableModels=Ze}Nt()}else Nt()}setProjection(ge,Ae){this.projections[ge]=i.cm(Ae)}setBrightness(ge,Ae,Ze){this.brightness=Ae,Ze()}setWorldview(ge,Ae,Ze){this.worldview=Ae,Ze()}setLayers(ge,Ae,Ze){this.getLayerIndex(ge,Ae.scope).replace(Ae.layers,Ae.options),Ze()}updateLayers(ge,Ae,Ze){this.getLayerIndex(ge,Ae.scope).update(Ae.layers,Ae.removedIds,Ae.options),Ze()}loadTile(ge,Ae,Ze){Ae.projection=this.projections[ge]||this.defaultProjection,this.getWorkerSource(ge,Ae.type,Ae.source,Ae.scope).loadTile(Ae,Ze)}decodeRasterArray(ge,Ae,Ze){this.getWorkerSource(ge,Ae.type,Ae.source,Ae.scope).decodeRasterArray(Ae,Ze)}reloadTile(ge,Ae,Ze){Ae.projection=this.projections[ge]||this.defaultProjection,this.getWorkerSource(ge,Ae.type,Ae.source,Ae.scope).reloadTile(Ae,Ze)}abortTile(ge,Ae,Ze){this.getWorkerSource(ge,Ae.type,Ae.source,Ae.scope).abortTile(Ae,Ze)}removeTile(ge,Ae,Ze){this.getWorkerSource(ge,Ae.type,Ae.source,Ae.scope).removeTile(Ae,Ze)}removeSource(ge,Ae,Ze){if(!(this.workerSources[ge]&&this.workerSources[ge][Ae.scope]&&this.workerSources[ge][Ae.scope][Ae.type]&&this.workerSources[ge][Ae.scope][Ae.type][Ae.source]))return;const Nt=this.workerSources[ge][Ae.scope][Ae.type][Ae.source];delete this.workerSources[ge][Ae.scope][Ae.type][Ae.source],Nt.removeSource!==void 0?Nt.removeSource(Ae,Ze):Ze()}loadWorkerSource(ge,Ae,Ze){try{this.self.importScripts(Ae.url),Ze()}catch(Nt){Ze(Nt)}}syncRTLPluginState(ge,Ae,Ze){if(i.fH.isParsed())Ze(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ze);else try{i.fH.setState(Ae);const Nt=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||Nt==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(Nt),i.fH.isParsed()?Ze(null,!0):this.rtlPluginParsingListeners.push(Ze))}catch(Nt){Ze(Nt)}}setDracoUrl(ge,Ae){this.dracoUrl=Ae}getAvailableImages(ge,Ae){this.availableImages[ge]||(this.availableImages[ge]={});let Ze=this.availableImages[ge][Ae];return Ze||(Ze=[]),Ze}getAvailableModels(ge,Ae){this.availableModels[ge]||(this.availableModels[ge]={});let Ze=this.availableModels[ge][Ae];return Ze||(Ze={}),Ze}getLayerIndex(ge,Ae){this.layerIndexes[ge]||(this.layerIndexes[ge]={});let Ze=this.layerIndexes[ge][Ae];return Ze||(Ze=this.layerIndexes[ge][Ae]=new y,Ze.scope=Ae),Ze}getWorkerSource(ge,Ae,Ze,Nt){const vt=this.workerSources;return vt[ge]||(vt[ge]={}),vt[ge][Nt]||(vt[ge][Nt]={}),vt[ge][Nt][Ae]||(vt[ge][Nt][Ae]={}),this.isSpriteLoaded[ge]||(this.isSpriteLoaded[ge]={}),vt[ge][Nt][Ae][Ze]||(vt[ge][Nt][Ae][Ze]=new this.workerSourceTypes[Ae]({send:(At,Bt,Pt,Ut,fr,ar)=>this.actor.send(At,Bt,Pt,ge,fr,ar),scheduler:this.actor.scheduler},this.getLayerIndex(ge,Nt),this.getAvailableImages(ge,Nt),this.getAvailableModels(ge,Nt),this.isSpriteLoaded[ge][Nt],void 0,this.brightness,this.worldview)),vt[ge][Nt][Ae][Ze]}rasterizeImagesWorker(ge,Ae,Ze){const Nt=new Map;for(const[vt,{image:At,imageVariant:Bt}]of Ae.tasks.entries()){const Pt=this.imageRasterizer.rasterize(Bt,At,Ae.scope,ge);Nt.set(vt,Pt)}Ze(void 0,Nt)}removeRasterizedImages(ge,Ae,Ze){this.imageRasterizer.removeImagesFromCacheByIds(Ae.imageIds,Ae.scope,ge),Ze()}enforceCacheSizeLimit(ge,Ae){i.fJ(Ae)}getWorkerPerformanceMetrics(ge,Ae,Ze){Ze(void 0,void 0)}}return i.fF(self)&&(self.worker=new Nu(self)),Nu}),o(["./shared"],function(i){var u="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 _,w={},S=function(){if(_)return w;function b(j){return!d(j)}function d(j){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[T=j&&j.failIfMajorPerformanceCaveat]===void 0&&(m[T]=function(O){var D,B=function(H){var Y=document.createElement("canvas"),ee=Object.create(b.webGLContextAttributes);return ee.failIfMajorPerformanceCaveat=H,Y.getContext("webgl2",ee)}(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)}(T)),m[T]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var T}_=1,w.supported=b,w.notSupportedReason=d;var m={};return b.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},w}();function N(b,d,m){const j=document.createElement(b);return d!=null&&(j.className=d),m&&m.appendChild(j),j}function M(b,d,m){const j=document.createElementNS("http://www.w3.org/2000/svg",b);for(const T of Object.keys(d))j.setAttributeNS(null,T,String(d[T]));return m&&m.appendChild(j),j}const E=typeof document<"u"?document.documentElement&&document.documentElement.style:null,A=E&&E.userSelect!==void 0?"userSelect":"WebkitUserSelect";let P;function z(){E&&A&&(P=E[A],E[A]="none")}function R(){E&&A&&(E[A]=P)}function U(b){b.preventDefault(),b.stopPropagation(),window.removeEventListener("click",U,!0)}function V(){window.addEventListener("click",U,!0),window.setTimeout(()=>{window.removeEventListener("click",U,!0)},0)}function K(b,d){const m=b.getBoundingClientRect();return ae(b,m,d)}function W(b,d){const m=b.getBoundingClientRect(),j=[];for(let T=0;Tthis._skuTokenExpiresAt}transformRequest(d,m){return this._transformRequestFn&&this._transformRequestFn(d,m)||{url:d}}normalizeStyleURL(d,m){if(!i.h(d))return d;const j=se(d);return j.params.push(`sdk=js-${u}`),j.path=`/styles/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||m)}normalizeGlyphsURL(d,m){if(!i.h(d))return d;const j=se(d);return j.path=`/fonts/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||m)}normalizeModelURL(d,m){if(!i.h(d))return d;const j=se(d);return j.path=`/models/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||m)}normalizeSourceURL(d,m,j,T){if(!i.h(d))return d;const O=se(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),j&&O.params.push(`language=${j}`),T&&O.params.push(`worldview=${T}`),this._makeAPIURL(O,this._customAccessToken||m)}normalizeIconsetURL(d,m){const j=se(d);return i.h(d)?(j.path=`/styles/v1${j.path}/iconset.pbf`,this._makeAPIURL(j,this._customAccessToken||m)):fe(j)}normalizeSpriteURL(d,m,j,T){const O=se(d);return i.h(d)?(O.path=`/styles/v1${O.path}/sprite${m}${j}`,this._makeAPIURL(O,this._customAccessToken||T)):(O.path+=`${m}${j}`,fe(O))}normalizeTileURL(d,m,j){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!i.h(d))return d;const T=se(d);T.path=T.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${m||j&&T.authority!=="raster"&&j===512?"@2x":""}${i.k.supported?".webp":"$1"}`),T.authority==="raster"?T.path=`/${i.e.RASTER_URL_PREFIX}${T.path}`:T.authority==="rasterarrays"?T.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${T.path}`:T.authority==="3dtiles"?T.path=`/${i.e.TILES3D_URL_PREFIX}${T.path}`:(T.path=T.path.replace(/^.+\/v4\//,"/"),T.path=`/${i.e.TILE_URL_VERSION}${T.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}(T.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&T.params.push(`sku=${this._skuToken}`),this._makeAPIURL(T,O)}canonicalizeTileURL(d,m){const j=se(d);if(!j.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!j.path.match(/\.[\w]+$/))return d;let T="mapbox://";j.path.match(/^\/raster\/v1\//)?T+=`raster/${j.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:j.path.match(/^\/rasterarrays\/v1\//)?T+=`rasterarrays/${j.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:T+=`tiles/${j.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let O=j.params;return m&&(O=O.filter(D=>!D.match(/^access_token=/))),O.length&&(T+=`?${O.join("&")}`),T}canonicalizeTileset(d,m){const j=!!m&&i.h(m),T=[];for(const O of d.tiles||[])i.j(O)?T.push(this.canonicalizeTileURL(O,j)):T.push(O);return T}_makeAPIURL(d,m){const j="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",T=se(i.e.API_URL);if(d.protocol=T.protocol,d.authority=T.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(T.path!=="/"&&(d.path=`${T.path}${d.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return fe(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. ${j}`);if(m[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${j}`)}return d.params=d.params.filter(O=>O.indexOf("access_token")===-1),d.params.push(`access_token=${m||""}`),fe(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 fe(b){const d=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${d}`}const he="mapbox.eventData";function ye(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 Ce{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const m=ye(i.e.ACCESS_TOKEN);let j="";return j=m&&m.u?i.f(m.u):i.e.ACCESS_TOKEN||"",d?`${he}.${d}:${j}`:`${he}:${j}`}fetchEventData(){const d=i.s("localStorage"),m=this.getStorageKey(),j=this.getStorageKey("uuid"),T=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(m);O&&(this.eventData=JSON.parse(O));const D=localStorage.getItem(j);D&&(this.anonId=D);const B=localStorage.getItem(T);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(T,D.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,m,j,T){if(!i.e.EVENTS_URL)return;const O=se(i.e.EVENTS_URL);O.params.push(`access_token=${T||i.e.ACCESS_TOKEN||""}`);const D={event:this.type,created:new Date(d).toISOString()},B=m?Object.assign(D,m):D,H={url:fe(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=i.p(H,Y=>{this.pendingRequest=null,j(Y),this.saveEventData(),this.processRequests(T)})}queueRequest(d,m){this.queue.push(d),this.processRequests(m)}}class Se extends Ce{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:j}=this.queue.shift();this.postEvent(m,j,()=>{},d)}}const Ne=new class extends Ce{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=ye(i.e.ACCESS_TOKEN),m=d?d.u:i.e.ACCESS_TOKEN;let j=m!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),j=!0);const T=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),D=new Date(T),B=(T-this.eventData.lastSuccess)/864e5;j=j||B>=1||B<-1||O.getDate()!==D.getDate()}else j=!0;j?this.postEvent(T,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:oe,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=T,this.eventData.tokenU=m)},b):this.processRequests()}},be=Ne.postTurnstileEvent.bind(Ne),rt=new class extends Ce{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(b,d,m,j){this.skuToken=d,this.errorCb=j,i.e.EVENTS_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},m):this.errorCb(new Error(xe)))}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:u,skuId:oe,skuToken:this.skuToken,userId:this.anonId},j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},b))}remove(){this.errorCb=null}},Te=rt.postMapLoadEvent.bind(rt),Pe=new class extends Ce{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:j,importedStyles:T}=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:j};T.length&&(D.importedStyles=T),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)}},Ue=Pe.postStyleLoadEvent.bind(Pe),Re=new Se({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Be=Re.postMetricsEvent.bind(Re),Ye=new Se({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),ht=Ye.postMetricsEvent.bind(Ye),Me=new class extends Ce{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(),j=function(T){const O=performance.getEntriesByType("resource"),D=performance.getEntriesByType("mark"),B=function(ue){const we={};if(ue){for(const ve in ue)if(ve!=="other")for(const De of ue[ve]){const Ie=`${ve}ResolveRangeMin`,He=`${ve}ResolveRangeMax`,tt=`${ve}RequestCount`,Ge=`${ve}RequestCachedCount`;we[Ie]=Math.min(we[Ie]||1/0,De.startTime),we[He]=Math.max(we[He]||-1/0,De.responseEnd);const bt=ft=>{we[ft]===void 0&&(we[ft]=0),++we[ft]};De.transferSize!==void 0&&De.transferSize===0&&bt(Ge),bt(tt)}}return we}(function(ue,we){const ve={};if(ue)for(const De of ue){const Ie=we(De);ve[Ie]===void 0&&(ve[Ie]=[]),ve[Ie].push(De)}return ve}(O,y)),H=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,ee=Y?Y.effectiveType:void 0,de={counters:[],metadata:[],attributes:[]},ce=(ue,we,ve)=>{ve!=null&&ue.push({name:we,value:ve.toString()})};for(const ue in B)ce(de.counters,ue,B[ue]);if(T.interactionRange[0]!==1/0&&T.interactionRange[1]!==-1/0&&(ce(de.counters,"interactionRangeMin",T.interactionRange[0]),ce(de.counters,"interactionRangeMax",T.interactionRange[1])),D)for(const ue of Object.values(p)){const we=D.find(ve=>ve.name===ue);we&&ce(de.counters,ue,we.startTime)}return ce(de.counters,"visibilityHidden",T.visibilityHidden),ce(de.attributes,"style",function(ue){if(ue)for(const we of ue){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)),ce(de.attributes,"terrainEnabled",T.terrainEnabled?"true":"false"),ce(de.attributes,"fogEnabled",T.fogEnabled?"true":"false"),ce(de.attributes,"projection",T.projection),ce(de.attributes,"zoom",T.zoom),ce(de.metadata,"devicePixelRatio",H),ce(de.metadata,"connectionEffectiveType",ee),ce(de.metadata,"navigatorUserAgent",navigator.userAgent),ce(de.metadata,"screenWidth",window.screen.width),ce(de.metadata,"screenHeight",window.screen.height),ce(de.metadata,"windowWidth",window.innerWidth),ce(de.metadata,"windowHeight",window.innerHeight),ce(de.metadata,"mapWidth",T.width/H),ce(de.metadata,"mapHeight",T.height/H),ce(de.metadata,"webglRenderer",T.renderer),ce(de.metadata,"webglVendor",T.vendor),ce(de.metadata,"sdkVersion",u),ce(de.metadata,"sdkIdentifier","mapbox-gl-js"),de}(m);for(const T of j.metadata);for(const T of j.counters);for(const T of j.attributes);this.postEvent(d,j,()=>{},b)}},Qe=Me.postPerformanceEvent.bind(Me),le=new class extends Ce{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(b,d,m,j){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const T=se(i.e.API_URL+i.e.SESSION_PATH);T.params.push(`sku=${d||""}`),T.params.push(`access_token=${j||i.e.ACCESS_TOKEN||""}`);const O={url:fe(T),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(O,D=>{this.pendingRequest=null,m(D),this.saveEventData(),this.processRequests(j)})}getSessionAPI(b,d,m,j){this.skuToken=d,this.errorCb=j,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(xe)))}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,j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},b)}remove(){this.errorCb=null}},Ve=le.getSessionAPI.bind(le),Le=new Set;function We(b,d){d?Le.add(b):Le.delete(b)}class _e{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 st(b){const{userImage:d}=b;return!!(d&&d.render&&d.render())&&(b.data.replace(new Uint8Array(d.data.buffer)),!0)}class ze 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 j of m.values())j.hasPendingRequests()&&d.push(j);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:j,callback:T}of this.requestors)this._notify(j,m,T);this.requestors=[]}}hasImage(d,m){return!!this.getImage(d,m)}getImage(d,m){return this.images.get(m).get(d.toString())}addImage(d,m,j){this._validate(d,j)&&this.images.get(m).set(d.toString(),j)}_validate(d,m){let j=!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`))),j=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),j=!1),this._validateContent(m.content,m)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "content" value`))),j=!1),j}_validateStretch(d,m){if(!d)return!0;let j=0;for(const T of d){if(T[0]i.I.from(m))}getImages(d,m,j){const T=[],O=[],D=this.imageProviders.get(m);for(const ee of d){if(!ee.iconsetId){T.push(ee);continue}const de=D.get(ee.iconsetId);de&&(this.getImage(ee,m)?O.push(ee):de.addPendingRequest(ee))}if(T.length===0)return void this._notify(O,m,j);let B=!0;const H=!!this.loaded.get(m),Y=this.images.get(m);if(!H)for(const ee of T)Y.has(ee.toString())||(B=!1);H||B?this._notify(T,m,j):this.requestors.push({ids:T,scope:m,callback:j})}rasterizeImages(d,m){const j=new Map,{tasks:T,scope:O}=d;for(const[D,B]of T.entries()){const H=this.getImage(B.id,O);H&&j.set(D,{image:H,imageVariant:B})}this._rasterizeImages(O,j,m)}_rasterizeImages(d,m,j){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:m,scope:d},j);else{const T=new Map;for(const[O,{image:D,imageVariant:B}]of m.entries())T.set(O,this.imageRasterizer.rasterize(B,D,d,0));j(void 0,T)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,m,j){const T=this.images.get(m),O=new Map;for(const D of d){if(!T.get(D.toString())){if(D.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:D.name}))}const B=T.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)}j(null,O)}getPixelSize(d){const{width:m,height:j}=this.atlasImage.get(d);return{width:m,height:j}}getPattern(d,m,j){const T=d.toString(),O=this.patterns.get(m),D=O.get(T),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(T,m);if(this.patternsInFlight.has(H))return null;this.patternsInFlight.add(H);const Y=new i.A(d).scaleSelf(i.o.devicePixelRatio),ee=new Map([[Y.toString(),{image:B,imageVariant:Y}]]);return this._rasterizeImages(m,ee,(de,ce)=>this.storePatternImage(Y,m,B,j,ce)),null}this.storePattern(d,m,B)}return this._updatePatternAtlas(m,j),O.get(T).position}getPatternInFlightId(d,m){return i.B(d,m)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,m,j,T,O){const D=d.toString(),B=O?O.get(D):void 0;B&&(j.data=B,this.storePattern(d.id,m,j),this._updatePatternAtlas(m,T),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),m)))}storePattern(d,m,j){const T={w:j.data.width+2*i.C,h:j.data.height+2*i.C,x:0,y:0},O=new i.F(T,j,i.C);this.patterns.get(m).set(d.toString(),{bin:T,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,m){const j=d.gl;let T=this.atlasTexture.get(m);T?this.dirty&&(T.update(this.atlasImage.get(m)),this.dirty=!1):(T=new i.T(d,this.atlasImage.get(m),j.RGBA8),this.atlasTexture.set(m,T)),T.bind(j.LINEAR,j.CLAMP_TO_EDGE)}_updatePatternAtlas(d,m){const j=this.patterns.get(d),T=Array.from(j.values()).map(({bin:Y})=>Y),{w:O,h:D}=i.G(T),B=this.atlasImage.get(d);B.resize({width:O||1,height:D||1});const H=this.images.get(d);for(const[Y,{bin:ee,position:de}]of j.entries()){let ce=de.padding;const ue=ee.x+ce,we=ee.y+ce,ve=H.get(Y).data,De=ve.width,Ie=ve.height;ce=ce>1?ce-1:ce,i.q.copy(ve,B,{x:0,y:0},{x:ue,y:we},{width:De,height:Ie},m),i.q.copy(ve,B,{x:0,y:Ie-ce},{x:ue,y:we-ce},{width:De,height:ce},m),i.q.copy(ve,B,{x:0,y:0},{x:ue,y:we+Ie},{width:De,height:ce},m),i.q.copy(ve,B,{x:De-ce,y:0},{x:ue-ce,y:we},{width:ce,height:Ie},m),i.q.copy(ve,B,{x:0,y:0},{x:ue+De,y:we},{width:ce,height:Ie},m),i.q.copy(ve,B,{x:De-ce,y:Ie-ce},{x:ue-ce,y:we-ce},{width:ce,height:ce},m),i.q.copy(ve,B,{x:0,y:Ie-ce},{x:ue+De,y:we-ce},{width:ce,height:ce},m),i.q.copy(ve,B,{x:0,y:0},{x:ue+De,y:we+Ie},{width:ce,height:ce},m),i.q.copy(ve,B,{x:De-ce,y:0},{x:ue-ce,y:we+Ie},{width:ce,height:ce},m)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,m){const j=this.images.get(m);for(const T of d){if(this.callbackDispatchedThisFrame.get(m).has(T.toString()))continue;this.callbackDispatchedThisFrame.get(m).add(T.toString());const O=j.get(T.toString());st(O)&&this.updateImage(T,m,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ee(b){const d=b.value,m=b.valueSpec,j=b.style,T=b.styleSpec,O=b.key,D=b.arrayElementValidator||Gs;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.lengthT)return[new i.V(d,m,`${m} is greater than the maximum value ${T}`)]}return[]}function at(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 j=b.valueSpec,T=i.J(m.type);let O,D,B,H={};const Y=T!=="categorical"&&m.property===void 0,ee=!Y,de=function(ve){const De=ve.stops;return Array.isArray(De)&&Array.isArray(De[0])&&i.H(De[0][0])}(m),ce=Qa({key:b.key,value:b.value,valueSpec:b.styleSpec.function,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{stops:function(ve){if(T==="identity")return[new i.V(ve.key,ve.value,'identity function may not have a "stops" property')];let De=[];const Ie=ve.value;return De=De.concat(Ee({key:ve.key,value:Ie,valueSpec:ve.valueSpec,style:ve.style,styleSpec:ve.styleSpec,arrayElementValidator:ue})),Array.isArray(Ie)&&Ie.length===0&&De.push(new i.V(ve.key,Ie,"array must have at least one stop")),De},default:function(ve){return Gs({key:ve.key,value:ve.value,valueSpec:j,style:ve.style,styleSpec:ve.styleSpec})}}});return T==="identity"&&Y&&ce.push(new i.V(b.key,b.value,'missing required property "property"')),T==="identity"||m.stops||ce.push(new i.V(b.key,b.value,'missing required property "stops"')),T==="exponential"&&j.expression&&!i.M(j)&&ce.push(new i.V(b.key,b.value,"exponential functions not supported")),b.styleSpec.$version>=8&&(ee&&!i.N(j)?ce.push(new i.V(b.key,b.value,"property functions not supported")):Y&&!i.O(j)&&ce.push(new i.V(b.key,b.value,"zoom functions not supported"))),T!=="categorical"&&!de||m.property!==void 0||ce.push(new i.V(b.key,b.value,'"property" property is required')),ce;function ue(ve){let De=[];const Ie=ve.value,He=ve.key;if(!Array.isArray(Ie))return[new i.V(He,Ie,`array expected, ${i.K(Ie)} found`)];if(Ie.length!==2)return[new i.V(He,Ie,`array length 2 expected, length ${Ie.length} found`)];if(de){if(!i.H(Ie[0]))return[new i.V(He,Ie,`object expected, ${i.K(Ie[0])} found`)];const tt=Ie[0];if(tt.zoom===void 0)return[new i.V(He,Ie,"object stop key must have zoom")];if(tt.value===void 0)return[new i.V(He,Ie,"object stop key must have value")];const Ge=i.J(tt.zoom);if(typeof Ge!="number")return[new i.V(He,tt.zoom,"stop zoom values must be numbers")];if(B&&B>Ge)return[new i.V(He,tt.zoom,"stop zoom values must appear in ascending order")];Ge!==B&&(B=Ge,D=void 0,H={}),De=De.concat(Qa({key:`${He}[0]`,value:Ie[0],valueSpec:{zoom:{}},style:ve.style,styleSpec:ve.styleSpec,objectElementValidators:{zoom:Je,value:we}}))}else De=De.concat(we({key:`${He}[0]`,value:Ie[0],style:ve.style,styleSpec:ve.styleSpec},Ie));return i.Q(i.S(Ie[1]))?De.concat([new i.V(`${He}[1]`,Ie[1],"expressions are not allowed in function stops.")]):De.concat(Gs({key:`${He}[1]`,value:Ie[1],valueSpec:j,style:ve.style,styleSpec:ve.styleSpec}))}function we(ve,De){const Ie=i.K(ve.value),He=i.J(ve.value),tt=ve.value!==null?ve.value:De;if(O){if(Ie!==O)return[new i.V(ve.key,tt,`${Ie} stop domain type must match previous stop domain type ${O}`)]}else O=Ie;if(Ie!=="number"&&Ie!=="string"&&Ie!=="boolean"&&typeof He!="number"&&typeof He!="string"&&typeof He!="boolean")return[new i.V(ve.key,tt,"stop domain value must be a number, string, or boolean")];if(Ie!=="number"&&T!=="categorical"){let Ge=`number expected, ${Ie} found`;return i.N(j)&&T===void 0&&(Ge+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(ve.key,tt,Ge)]}return T!=="categorical"||Ie!=="number"||typeof He=="number"&&isFinite(He)&&Math.floor(He)===He?T!=="categorical"&&Ie==="number"&&typeof He=="number"&&typeof D=="number"&&D!==void 0&&Henew i.V(`${b.key}${j.key}`,b.value,j.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 gt(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 gt(b,d){const m=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const T of d.valueSpec.expression.parameters)m.delete(T);if(m.size===0)return[];const j=[];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(T=>{j.push(...gt(T,d))}),j)}function Mt(b,d){const m=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const T of d.valueSpec.expression.parameters)m.add(T);if(m.size===0)return[];const j=[];return b instanceof i._&&!m.has(b.name)?[new i.V(d.key,d.value,`["${b.name}"] is not an allowed parameter`)]:(b.eachChild(T=>{j.push(...Mt(T,d))}),j)}function wt(b){const d=b.key,m=b.value,j=b.valueSpec,T=[];return Array.isArray(j.values)?j.values.indexOf(i.J(m))===-1&&T.push(new i.V(d,m,`expected one of [${j.values.join(", ")}], ${JSON.stringify(m)} found`)):Object.keys(j.values).indexOf(i.J(m))===-1&&T.push(new i.V(d,m,`expected one of [${Object.keys(j.values).join(", ")}], ${JSON.stringify(m)} found`)),T}function Xt(b){return i.a2(i.S(b.value))?pt(Object.assign({},b,{expressionContext:"filter",valueSpec:b.styleSpec[`filter_${b.layerType||"fill"}`]})):Sr(b)}function Sr(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 j=b.styleSpec;let T=wt({key:`${m}[0]`,value:d[0],valueSpec:j.filter_operator});const O=()=>{d.length>=2&&(i.a0(d[1])||T.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"&&T.push(new i.V(m,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&T.push(new i.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&T.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(j,m[Y],`"${Y}" is prohibited for ref layers`))}),T.layers.forEach(Y=>{i.J(Y.id)===B&&(H=Y)}),H?H.ref?d.push(new i.V(j,m.ref,"ref cannot reference another ref layer")):D=i.J(H.type):typeof B=="string"&&d.push(new i.V(j,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=T.sources&&T.sources[m.source],Y=H&&i.J(H.type);H?Y==="vector"&&D==="raster"?d.push(new i.V(j,m.source,`layer "${m.id}" requires a raster source`)):Y==="raster"&&D!=="raster"?d.push(new i.V(j,m.source,`layer "${m.id}" requires a vector source`)):Y!=="vector"||m["source-layer"]?Y==="raster-dem"&&D!=="hillshade"?d.push(new i.V(j,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(j,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(j,m.source,`layer "${m.id}" requires a 'raster-array' source.`)):d.push(new i.V(j,m.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new i.V(j,m,`layer "${m.id}" must specify a "source-layer"`)):d.push(new i.V(j,m.source,`source "${m.source}" not found`))}else d.push(new i.V(`${j}.source`,m.source,'"source" must be a string'));else d.push(new i.V(j,m,'missing required property "source"'));return d=d.concat(Qa({key:j,value:m,valueSpec:O.layer,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Gs({key:`${j}.type`,value:m.type,valueSpec:O.layer.type,style:b.style,styleSpec:b.styleSpec,object:m,objectKey:"type"}),filter:H=>Xt(Object.assign({layerType:D},H)),layout:H=>Qa({layer:m,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":Y=>Xr(Object.assign({layerType:D},Y))}}),paint:H=>Qa({layer:m,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":Y=>wn(Object.assign({layerType:D,layer:m},Y))}}),appearances(H){const Y=Ee({key:H.key,value:H.value,valueSpec:H.valueSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:ce=>function(ue){const{key:we,layer:ve,layerType:De}=ue,Ie=i.J(ue.value),He=i.J(Ie.name),tt=i.J(Ie.condition),Ge=Qa({key:we,value:Ie,valueSpec:ue.styleSpec.appearance,style:ue.style,styleSpec:ue.styleSpec,objectElementValidators:{condition:bt=>function(ft){const yt=[];return yt.push(...pt({key:ft.key,value:ft.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),yt}(Object.assign({layer:ve,layerType:De},bt)),properties:bt=>function(ft){const yt=[],{styleSpec:ut,layer:lt,layerType:St}=ft,Dt=ut[`paint_${St}`],Ot=ut[`layout_${St}`],Wt=ft.object[ft.objectKey];for(const Gt in Wt){const sr=Gt in Dt?"paint":Gt in Ot?"layout":void 0;if(!sr){yt.push(new i.V(ft.key,Gt,`unknown property "${Gt}" for layer type "${St}"`));continue}const _r=Object.assign({},ft,{key:`${ft.key}.${Gt}`,object:Wt,objectKey:Gt,layer:lt,layerType:St,value:Wt[Gt],valueSpec:sr==="paint"?Dt[Gt]:Ot[Gt]});yt.push(...an(_r,sr))}return yt}(Object.assign({layer:ve,layerType:De},bt))}});return He!=="hidden"&&tt===void 0&&Ge.push(new i.V(ue.key,"name",'Appearance with name different than "hidden" must have a condition')),Ge}(Object.assign({layerType:D,layer:m},ce))}),ee=Array.isArray(H.value)?H.value:[],de=new Set;return ee.forEach((ce,ue)=>{const we=i.J(ce.name);if(we)if(de.has(we)){const ve=i.J(m.id);Y.push(new i.V(H.key,we,`Duplicated appearance name "${we}" for layer "${ve}"`))}else de.add(we)}),Y}}})),d}function Ns({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 Ns({key:d,value:m});if(Array.isArray(m)){const T=[],O=i.S(m),D=i.U(O);return D.result==="error"&&D.value.forEach(B=>{T.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"])||T.push(new i.V(`${d}`,null,"promoteId expression should be only feature dependent")),T}if(!i.H(m))return[new i.V(d,m,`string, expression or object expected, "${i.K(m)}" found`)];const j=[];for(const T in m)j.push(...b({key:`${d}.${T}`,value:m[T]}));return j}};function ys(b){const d=b.value,m=b.key,j=b.styleSpec,T=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(Qa({key:m,value:d,valueSpec:j[`source_${O.replace("-","_")}`],style:b.style,styleSpec:j,objectElementValidators:hr})),D;case"geojson":if(D=Qa({key:m,value:d,valueSpec:j.source_geojson,style:T,styleSpec:j,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,ee]=H,de=typeof Y=="string"?[Y,["accumulated"],["get",B]]:Y;D.push(...pt({key:`${m}.${B}.map`,value:ee,expressionContext:"cluster-map"})),D.push(...pt({key:`${m}.${B}.reduce`,value:de,expressionContext:"cluster-reduce"}))}}return D;case"video":return Qa({key:m,value:d,valueSpec:j.source_video,style:T,styleSpec:j});case"image":return Qa({key:m,value:d,valueSpec:j.source_image,style:T,styleSpec:j});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:Ca(j)}})}}function Ca(b){return b.source.reduce((d,m)=>{const j=b[m];return j.type.type==="enum"&&(d=d.concat(Object.keys(j.type.values||{}))),d},[])}function va(b){const d=b.value,m=b.styleSpec,j=m.light,T=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&&j[H[1]]?Gs({key:D,value:d[D],valueSpec:{type:"string"},style:T,styleSpec:m}):B&&j[B[1]]&&j[B[1]].transition?Gs({key:D,value:d[D],valueSpec:m.transition,style:T,styleSpec:m}):j[D]?Gs({key:D,value:d[D],valueSpec:j[D],style:T,styleSpec:m}):[new i.V(D,d[D],`unknown property "${D}"`)])}return O}function $i(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 j=[];const T=b.styleSpec,O=T["light-3d"],D=b.style,B=b.style.lights;for(const ee of["type","id"])if(!(ee in d))return j=j.concat([new i.V(m,d,`missing property "${ee}"`)]),j;if(!i.a0(d.type))return j=j.concat([new i.V(`${m}.type`,d.type,"string expected")]),j;if(B)for(let ee=0;ee[],array:Ee,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:Je,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:Xt,function:at,layer:Pn,object:Qa,source:ys,model:i.a7,light:va,"light-3d":$i,terrain:Ui,fog:al,string:Ns,formatted:function(b){return Ns(b).length===0?[]:pt(b)},resolvedImage:function(b){return Ns(b).length===0?[]:pt(b)},projection:function(b){const d=b.value,m=b.styleSpec,j=m.projection,T=b.style;if(i.H(d)){let O=[];for(const D in d)O=O.concat(Gs({key:D,value:d[D],valueSpec:j[D],style:T,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:j}=b;if(!i.H(m))return[new i.V(d,m,"import must be an object")];const{data:T,...O}=m;Object.defineProperty(O,"__line__",{value:m.__line__,enumerable:!1});let D=Qa(Object.assign({},b,{value:O,valueSpec:j.import}));return i.J(O.id)===""&&D.push(new i.V(`${b.key}.id`,O,"import id can't be an empty string")),T&&(D=D.concat(Ba(T,j,{key:`${b.key}.data`}))),D},iconset:function(b){const d=b.value,m=b.key,j=b.styleSpec,T=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(Qa({key:m,value:d,valueSpec:j[`iconset_${O}`],style:T,styleSpec:j})),function(B,H){return!(B!=="source"||!H.source)}(O,d)){const B=T.sources&&T.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 Gs(b,d=!1){const m=b.value,j=b.valueSpec,T=b.styleSpec;if(j.expression){if(i.a4(i.J(m)))return at(b);if(i.Q(i.S(m)))return pt(b)}if(j.type&&yo[j.type]){const O=yo[j.type](b);return d===!0&&O.length>0&&Array.isArray(b.value)?pt(b):O}return Qa(Object.assign({},b,{valueSpec:j.type?T[j.type]:j}))}function Qa(b){const d=b.key,m=b.value,j=b.valueSpec||{},T=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 ee;T[Y]?ee=T[Y]:j[Y]?ee=Gs:T["*"]?ee=T["*"]:j["*"]&&(ee=Gs),ee?B=B.concat(ee({key:(d&&`${d}.`)+H,value:m[H],valueSpec:j[Y]||j["*"],style:O,styleSpec:D,object:m,objectKey:H},m)):B.push(new i.a3(d,m[H],`unknown property "${H}"`))}for(const H in j){if(T[H])continue;const Y=j[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 Cs({key:b,value:d}){const m=Ns({key:b,value:d});if(m.length)return m;const j=d;return j.indexOf("{fontstack}")===-1&&m.push(new i.V(b,d,'"glyphs" url must include a "{fontstack}" token')),j.indexOf("{range}")===-1&&m.push(new i.V(b,d,'"glyphs" url must include a "{range}" token')),m}function Ba(b,d=i.a6,m={}){return Qa({key:m.key||"",value:b,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:b,objectElementValidators:{glyphs:Cs}})}function Ra(b,d=i.a6){return Ae(Ba(b,d))}const Fo=b=>Ae(ys(b)),ir=b=>Ae(va(b)),po=b=>Ae($i(b)),gl=b=>Ae(Ui(b)),Eo=b=>Ae(al(b)),is=b=>Ae(function(d){const m=d.value,j=d.style,T=d.styleSpec,O=T.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?Gs({key:B,value:m[B],valueSpec:T.transition,style:j,styleSpec:T}):O[B]?Gs({key:B,value:m[B],valueSpec:O[B],style:j,styleSpec:T}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return D}(b)),vo=b=>Ae(function(d){const m=d.value,j=d.style,T=d.styleSpec,O=T.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?Gs({key:B,value:m[B],valueSpec:T.transition,style:j,styleSpec:T}):O[B]?Gs({key:B,value:m[B],valueSpec:O[B],style:j,styleSpec:T}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return D}(b)),ku=b=>Ae(Pn(b)),Hl=b=>Ae(Xt(b)),Nu=b=>Ae(wn(b)),nt=b=>Ae(Xr(b)),ge=b=>Ae(i.a7(b));function Ae(b){return b.slice().sort((d,m)=>d.line&&m.line?d.line-m.line:0)}function Ze(b,d){let m=!1;if(d&&d.length)for(const j of d)j instanceof i.a3?i.w(j.message):(b.fire(new i.y(new Error(j.message))),m=!0);return m}const Nt=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(Nt.anchor),position:new i.ab(Nt.position),color:new i.aa(Nt.color),intensity:new i.aa(Nt.intensity)}))),this.setLight(d,m),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,m,j={}){this._validate(ir,d,j)||(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,j){return(!j||j.validate!==!1)&&Ze(this,d.call(Ra,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,j,T){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,j),this._transitionable.setTransitionOrValue(b,j),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=T}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,j=-1,T=1;for(const O of d.zoomStops)T=d.evaluate(new i.ac(O,{worldview:this.worldview})),T>.01?(m=O,j=-1):j=O;return T<.01&&m>0&&j>m?[m,j]: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,j){const T=i.ah(Ut,fr,m),[O,D]=jn(b,j);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*T*b.alpha}function jn(b,d){const m=.5/Math.tan(.5*d);return[b.range[0]+m,b.range[1]+m]}function Vr(b,d,m,j,T){const O=i.af([],[d,m,j],T.mercatorFogMatrix);return Wr(b,i.ag(O),T.pitch,T._fov)}function ts(b,d,m,j,T,O,D){const B=[[m,j,0],[T,j,0],[T,O,0],[m,O,0]];let H=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const ee of B){const de=i.af([],ee,d),ce=i.ag(de);H=Math.min(H,ce),Y=Math.max(Y,ce)}return[Wr(b,H,D.pitch,D._fov),Wr(b,Y,D.pitch,D._fov)]}const rs=i.a6.fog;class Xn extends i.E{constructor(d,m,j,T){super();const O=new i.a9({range:new i.aa(rs.range),color:new i.aa(rs.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(rs["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(rs["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(rs["horizon-blend"]),"star-intensity":new i.aa(rs["star-intensity"]),"vertical-range":new i.aa(rs["vertical-range"])});this._transitionable=new i.a8(O,j,new Map(T)),this.set(d,T),this._transitioning=this._transitionable.untransitioned(),this._transform=m,this.properties=new i.ai(O),this.scope=j}get state(){const d=this._transform,m=d.projection.name==="globe",j=i.aj(d.zoom),T=this.properties.get("range"),O=[.5,3];return{range:m?[i.ak(O[0],T[0],j),i.ak(O[1],T[1],j)]:T,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,m,j={}){if(this._validate(Eo,d,j))return;const T=Object.assign({},d);for(const O of Object.keys(rs))T[O]===void 0&&(T[O]=rs[O].default);this._options=T,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(j,T,O){const D=i.ae.fromLngLat(T),B=O.elevation?O.elevation.getAtPointOrZero(D):0;return Vr(j,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 ts(this.state,m,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,m,j,T,O){return this._transform.projection.supportsFog?ts(this.state,d,m,j,T,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?jn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const m=[4,5,6,7];for(const j of m){const T=d.points[j];let O;if(T[2]>=0)O=T;else{const D=d.points[j-4];O=i.am(D,T,D[2]/(D[2]-T[2]))}if(Vr(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,j){return(!j||j.validate!==!1)&&Ze(this,d.call(Ra,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let Rs,Oi,mo,fa,_o=class extends i.E{constructor(b,d,m,j){super();const T=Rs||(Rs=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(T,m,new Map(j)),this.set(b,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(T),this.scope=m}get state(){const b=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),j=i.an(m[0]),T=-Math.max(i.an(m[1]),.01),O=[Math.cos(j)*Math.cos(T),Math.sin(j)*Math.cos(T),Math.sin(T)],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(is,b,m))return;const j=Object.assign({},b),T=i.a6.snow;for(const O of Object.keys(T))j[O]===void 0&&(j[O]=T[O].default);this._options=j,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)&&Ze(this,b.call(Ra,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},Ni=class extends i.E{constructor(b,d,m,j){super();const T=Oi||(Oi=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(T,m,new Map(j)),this.set(b,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(T),this.scope=m}get state(){const b=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),j=i.an(m[0]),T=-Math.max(i.an(m[1]),.01),O=[Math.cos(j)*Math.cos(T),Math.sin(j)*Math.cos(T),Math.sin(T)],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(vo,b,m))return;const j=Object.assign({},b),T=i.a6.rain;for(const O of Object.keys(T))j[O]===void 0&&(j[O]=T[O].default);this._options=j,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)&&Ze(this,b.call(Ra,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class Ks extends i.E{constructor(d,m,j,T){super(),this.scope=j,this._options=d,this.properties=new i.ai(m),this._transitionable=new i.a8(m,j,new Map(T)),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 Si{constructor(d,m,j){this.screenBounds=d,this.cameraPoint=j.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=m,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,j)}static createFromScreenPoints(d,m){let j,T;if(d instanceof i.P||typeof d[0]=="number"){const O=i.P.convert(d);j=[O],T=m.isPointAboveHorizon(O)}else{const O=i.P.convert(d[0]),D=i.P.convert(d[1]),B=O.add(D)._div(2);j=[O,D],T=i.aq(O,D).every(H=>m.isPointAboveHorizon(H))&&m.isPointAboveHorizon(B)}return new Si(j,T,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],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],T=i.aq(m,j,0,!1);return this.cameraPoint.y>j.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x=j.x?T[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(T[3]=this.cameraPoint)),i.ar(T,d)}bufferedCameraGeometryGlobe(d){const m=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],T=i.aq(m,j,d),O=this.cameraPoint.clone();switch(3*((O.y>m.y)+(O.y>j.y))+((O.x>m.x)+(O.x>j.x))){case 0:T[0]=O,T[4]=O.clone();break;case 1:T.splice(1,0,O);break;case 2:T[1]=O;break;case 3:T.splice(4,0,O);break;case 5:T.splice(2,0,O);break;case 6:T[3]=O;break;case 7:T.splice(3,0,O);break;case 8:T[2]=O}return T}containsTile(d,m,j,T=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/m._pixelsPerMercatorPixel+1,D=j?this._bufferedCameraMercator(O,m):this._bufferedScreenMercator(O,m);let B=d.tileID.wrap+(D.unwrapped?T: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?T:0);const Y=this.screenGeometryMercator.polygon.map(De=>i.au(d.tileTransform,De,B)),ee=Y.map(De=>new i.P(De[0],De[1])),de=m.getFreeCameraOptions().position||new i.ae(0,0,0),ce=i.au(d.tileTransform,de,B),ue=Y.map(De=>{const Ie=i.av(De,De,ce);return i.aw(Ie,Ie),new i.ax(ce,Ie)}),we=i.ay(d,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:ee,tilespaceRays:ue,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 j=Ci(d);if(this._screenRaycastCache[j])return this._screenRaycastCache[j];{let T;return T=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),m):{polygon:this.bufferedScreenGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[j]=T,T}}_bufferedCameraMercator(d,m){const j=Ci(d);if(this._cameraRaycastCache[j])return this._cameraRaycastCache[j];{let T;return T=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),m):{polygon:this.bufferedCameraGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[j]=T,T}}_projectAndResample(d,m){const j=function(O,D){const B=i.aB([],D.pixelMatrix,D.globeMatrix),H=[0,-i.aD,0,1],Y=[0,i.aD,0,1],ee=[0,0,0,1];i.aC(H,H,B),i.aC(Y,Y,B),i.aC(ee,ee,B);const de=new i.P(H[0]/H[3],H[1]/H[3]),ce=new i.P(Y[0]/Y[3],Y[1]/Y[3]),ue=i.aE(O,de)&&H[3]1?$a(O.slice(0,De),D):[],tt=Denew i.P(Ms(yt.x),yt.y)),tt=tt.map(yt=>new i.P(Ms(yt.x),yt.y));const Ge=[...He];Ge.length===0&&Ge.push(tt[tt.length-1]);const bt=i.ak(Ge[Ge.length-1].y,(tt.length===0?He[0]:tt[0]).y,Ie);let ft;return ft=ue?[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)],Ge.push(...ft),tt.length===0?Ge.push(He[0]):Ge.push(...tt),{polygon:Ge.map(yt=>new i.ae(yt.x,yt.y)),unwrapped:!1}}(d,m);if(j)return j;const T=function(O,D){let B=!1,H=-1/0,Y=0;for(let de=0;deH&&(H=O[de].x,Y=de);for(let de=0;de.5&&(ue.x{de.x-=1}),{polygon:O,unwrapped:B}}($a(d,m).map(O=>new i.P(Ms(O.x),O.y)),m);return{polygon:T.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:T.unwrapped}}}function $a(b,d){return i.aG(b,m=>{const j=d.pointCoordinate3D(m);m.x=j.x,m.y=j.y},1/256)}function Ms(b){return b<0?1+b%1:b%1}function Ci(b){return 100*b|0}function xl(b,d,m,j,T){const O=function(B,H){if(B)return T(B);if(H){if(b.url&&H.tiles&&b.tiles&&delete b.tiles,H.variants){if(!Array.isArray(H.variants))return T(new Error("variants must be an array"));for(const ee of H.variants){if(ee==null||typeof ee!="object"||ee.constructor!==Object)return T(new Error("variant must be an object"));if(!Array.isArray(ee.capabilities))return T(new Error("capabilities must be an array"));if(ee.capabilities.length===1&&ee.capabilities[0]==="meshopt"){H=Object.assign(H,ee);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),T(null,Y)}},D=function(B,H,Y){if(!B)return null;if(!H&&!Y)return B;Y=Y||B.worldview_default;const ee=Object.values(B.language||{});if(ee.length===0)return null;const de=Object.values(B.worldview||{});if(de.length===0)return null;const ce=ee.every(we=>we===H),ue=de.every(we=>we===Y);return ce&&ue?B:H in(B.language_options||{})||Y in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(b.data,m,j);return D?i.o.frame(()=>O(null,D)):b.url?i.m(d.transformRequest(d.normalizeSourceURL(b.url,null,m,j),i.R.Source),O):i.o.frame(()=>{const{data:B,...H}=b;O(null,H)})}function Ml(b,d){const m=Math.pow(2,d.z),j=Math.floor(i.aF(b.getWest())*m),T=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>=j&&d.x=T&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,T)m&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${m}`),j&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${j}`),this.fire(new i.y(T));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=$c.fromTileJSON(O),be(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(T)})}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 j=d.tileID.canonical.url(this.tiles,this.scheme),T=this.map._requestManager.normalizeTileURL(j),O=this.map._requestManager.transformRequest(T,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(j)&&(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[T]=this._tileWorkers[T]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",H,Y.bind(this),void 0,!0);else{const ee=i.aL.call({deduped:this._deduped},H,(de,ce)=>{if(de||!ce)Y.call(this,de);else{const ue=i.aM(ce.responseHeaders);H.data={rawData:ce.rawData.slice(0),expires:ue.expires,cacheControl:ue.cacheControl},d.actor&&d.actor.send("loadTile",H,Y.bind(this),void 0,!0)}},!0);d.request={cancel:ee}}function Y(ee,de){return delete d.request,d.aborted?m(null):ee&&ee instanceof i.aN&&ee.status!==404?m(ee):(de&&de.resourceTiming&&(d.resourceTiming=de.resourceTiming),this.map._refreshExpiredTiles&&de&&d.setExpiryData(de),d.loadVectorData(de,this.map.painter),i.aO(this.dispatcher),m(null,de),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 qo extends i.E{constructor(d,m,j,T){super(),this.id=d,this.dispatcher=j,this.setEventedParent(T),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=xl(this._options,this.map._requestManager,null,m,(j,T)=>{this._tileJSONRequest=null,this._loaded=!0,j?this.fire(new i.y(j)):T&&(Object.assign(this,T),T.raster_layers&&(this.rasterLayers=T.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=$c.fromTileJSON(T),be(T.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(j)})}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 j=i.o.devicePixelRatio>=2,T=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),j,this.tileSize);d.request=i.n(this.map._requestManager.transformRequest(T,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 Ed([b,d],m,j,{scaled:T=!0}={}){const{tileSize:O,buffer:D}=j,{x:B,y:H,z:Y}=m;if(!isFinite(B)||!isFinite(H)||!isFinite(Y))throw new Error("Invalid MRT header");const ee=2**Y,de=ee*i.aF(b),ce=ee*i.aJ(d);return function([ue,we],ve,{scaled:De=!0}={}){if(!ve)throw new Error("bandView is undefined");const{data:Ie,tileSize:He,buffer:tt,offset:Ge,scale:bt,dimension:ft}=ve;if(ue<-tt||ue>He+tt||we<-tt||we>He+tt)throw new Error(`Point (${ue}, ${we}) out of bounds for tileSize=${He}, buffer=${tt}`);const yt=(we+tt)*(He+2*tt)+(ue+tt);if(new Uint32Array(Ie.buffer)[yt]===4294967295)return null;let ut=[];ut=De?[]:new ve.data.constructor(ft);for(let lt=0;lt{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 ee=i.aM(Y);d.setExpiryData(ee)}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 j=d.texturePerLayer;if(d.flushAllQueues(),j.size){d.destroy(!1);for(const T of j.values())this.map.painter.saveTileTexture(T)}else d.destroy()}prepareTile(d,m,j,T){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(m,j,T,(O,D)=>{if(O)return d.state="errored",this.fire(new i.y(O)),void this.triggerRepaint(d);D&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(j,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),j=m&&m.fields,T=j&&j.bands&&j.bands;return T?T[0]:0}getTextureDescriptor(d,m,j){if(!d)return;const T=m.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!T)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(T);if(D==null)return;if(!d.textureDescriptorPerLayer.get(m.id))return void this.prepareTile(d,T,m.id,D);if(d.updateNeeded(m.id,D)&&!j)return;const B=d.textureDescriptorPerLayer.get(m.id);return Object.assign({},B,{texture:d.texturePerLayer.get(m.id)})}getImages(d,m){const j=new Map;for(const T of d)for(const O of m){const[D,B]=O.split("/"),H=T.getLayer(D);if(!H||!H.hasBand(B)||!H.hasDataForBand(B))continue;const{bytes:Y,tileSize:ee,buffer:de}=H.getBandView(B),ce=ee+2*de,ue={data:new i.q({width:ce,height:ce},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};j.set(O,ue)}return j}queryRasterArrayValueByBandId(d,m,j){const T=m._mrt;return new Promise(O=>{const D={},B=new Set;for(const[H,Y]of Object.entries(T.layers)){if(j.layerName&&H!==j.layerName)continue;const ee={};D[H]=ee;for(const{bands:de}of Y.dataIndex)for(const ce of de)j.bands&&!j.bands.includes(ce)||(B.add(i.B(H,ce)),m.fetchBand(H,null,ce,ue=>{i.o.frame(()=>{ee[ce]=ue?null:Ed([d.lng,d.lat],T,Y.getBandView(ce)),B.delete(i.B(H,ce)),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 j=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),T=this.map._requestManager.transformRequest(j,i.R.Tile);d.actor.send("loadTile",{request:T,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,j){return new Promise((T,O)=>{this._loadTileForQuery(m,(D,B)=>{D?O(D):T(B?this.queryRasterArrayValueByBandId(d,m,j):null)})})}queryRasterArrayValue(d,m){const j=i.aT.convert(d),T=this.findLoadedParent(j);return T&&T._mrt?m.bands||!this.partial?this.queryRasterArrayValueByBandId(j,T,m):this.queryRasterArrayValueByAllBands(j,T,m):Promise.resolve(null)}findLoadedParent(d){const m=i.ae.fromLngLat(d,this.map.transform.tileSize),j=this.maxzoom+1,T=1<0&&(B[new i.aQ(b.overscaledZ,T,d.z,j,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,j)this.fire(new i.y(j));else{const O={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&T&&T.resourceTiming&&T.resourceTiming[this.id]&&(O.resourceTiming=T.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 j=this.map.style?this.map.style.getLut(this.scope):null,T=j?{image:j.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:T,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,j){super(b,d,m,j),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,j){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(j)}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=xl(this._options,this.map._requestManager,d,m,(j,T)=>{this._tileJSONRequest=null,this._loaded=!0,j?(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(j))):T&&(Object.assign(this,T),T.bounds&&(this.tileBounds=new $c(T.bounds,this.minzoom,this.maxzoom)),be(T.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(j)})}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)),j={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",j,T.bind(this))}else b.actor=this.dispatcher.getActor(),b.request=b.actor.send("loadTile",j,T.bind(this),void 0,!0);function T(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,j){super(b,d,m,j),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(T=>!Array.isArray(T)||T.length!==2||T.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,j){super(),this.id=b,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=d,this.setEventedParent(j),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 $c(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:j}=b.canonical;return this._implementation.hasTile({x:d,y:m,z:j})}return!this.tileBounds||this.tileBounds.contains(b.canonical)}loadTile(b,d){const{x:m,y:j,z:T}=b.tileID.canonical,O=new AbortController;b.request=Promise.resolve(this._implementation.loadTile({x:m,y:j,z:T},{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:j,z:T}=b.tileID.canonical;this._implementation.unloadTile({x:m,y:j,z:T})}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"}))}}},Vo=function(b,d,m,j){const T=new th[d.type](b,d,m,j);if(T.id!==b)throw new Error(`Expected Source id to be ${b} instead of ${T.id}`);return i.aY(["load","abort","unload","serialize","prepare"],T),T};function yp(b,d,m=""){return`${m}:${d.id||""}:${d.layer.id}:${function(j){if("layerId"in j)return`layer:${j.layerId}`;{const{featuresetId:T,importId:O}=j;return`featureset:${T}${O?`:import:${O}`:""}`}}(b.target)}`}function Rm(b,d,m,j=""){if(b.uniqueFeatureID){const T=yp(b,d,j);if(m.has(T))return!0;m.add(T)}return!1}function Fy(b,d,m,j,T=!1){const O=d.sourceCache.transform,D=d.sourceCache.tilesIn(b,d.has3DLayers,T);D.sort(Ph);const B=[];for(const H of D){const Y=H.tile.queryRenderedFeatures(d,H,m,j,O,T);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 ee=Y.styleLayer.queryRenderedFeatures(b,d.sourceCache,j);Object.keys(ee).length&&B.push({wrappedTileID:0,queryResults:ee})}}return B.length===0?{}:function(H){const Y={},ee={};for(const de of H){const ce=de.queryResults,ue=de.wrappedTileID,we=ee[ue]=ee[ue]||{};for(const ve in ce){const De=ce[ve],Ie=we[ve]=we[ve]||{},He=Y[ve]=Y[ve]||[];for(const tt of De)Ie[tt.featureIndex]||(Ie[tt.featureIndex]=!0,He.push(tt))}}return Y}(B)}function zy(b,d,m,j,T,O){const D={},B=j.queryRenderedSymbols(b),H=[];for(const Y of Object.keys(B).map(Number))H.push(T[Y]);H.sort(Ph);for(const Y of H){const ee=Y.featureIndex.lookupSymbolFeatures(B[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,m,O);for(const de in ee){const ce=D[de]=D[de]||[],ue=ee[de];ue.sort((we,ve)=>{const De=Y.featureSortOrder;if(De){const Ie=De.indexOf(we.featureIndex);return De.indexOf(ve.featureIndex)-Ie}return ve.featureIndex-we.featureIndex});for(const we of ue)ce.push(we)}}return D}function By(b,d){const m=b.getRenderableIds().map(O=>b.getTileByID(O)),j=[],T={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(T.length!==0){j.layers=T,j.stateDependentLayerIds&&(j.stateDependentLayers=j.stateDependentLayerIds.map(O=>T.filter(D=>D.id===O)[0]));for(const O of T)m[O.fqid]=j}}return m}const Uc=32,ru=33,qc=new Uint16Array(8184);for(let b=0;b<2046;b++){let d=b+2,m=0,j=0,T=0,O=0,D=0,B=0;for(1&d?T=O=D=Uc:m=j=B=Uc;(d>>=1)>1;){const Y=m+T>>1,ee=j+O>>1;1&d?(T=m,O=j,m=D,j=B):(m=T,j=O,T=D,O=B),D=Y,B=ee}const H=4*b;qc[H+0]=m,qc[H+1]=j,qc[H+2]=T,qc[H+3]=O}const bo=new Uint16Array(2178),Id=new Uint8Array(1089),rh=new Uint16Array(1089);function kc(b){return b===0?-.03125:b===32?.03125:0}const $y={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 vp{constructor(d,m,j,T,O,D){this.tileID=d,this.uid=i.b2(),this.uses=0,this.tileSize=m,this.tileZoom=j,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,T&&T.style&&(this._lastUpdatedBrightness=T.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",T&&T.transform&&(this.projection=T.transform.projection),this.worldview=D,this._hasAppearances=null}registerFadeDuration(d){const m=d+this.timeAdded;mj)T=!1;else if(m)if(this.expirationTimej.appearances&&j.appearances.length>0))return!0;return!1}updateBuckets(d,m){if(!this.latestFeatureIndex||!d.style)return;const j=d.style.listImages(),T=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 ee={};Y&&(ee=Y._state.getState(H,void 0));const de=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},ce=Object.keys(ee).length>0&&!m;D.hasAppearances=D.layers.some(ve=>ve.appearances&&ve.appearances.length>0);const ue=ce?D.stateDependentLayers:D.layers;if(ce&&D.stateDependentLayers.length!==0||m){const ve=this.latestFeatureIndex.loadVTLayers();D.update(ee,ve[H],j,de,ue,m,T)}if(ce&&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,ee,j,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 Ie=4*De,He=qc[Ie+0],tt=qc[Ie+1],Ge=qc[Ie+2],bt=qc[Ie+3],ft=He+Ge>>1,yt=tt+bt>>1,ut=ft+yt-tt,lt=yt+He-ft,St=tt*ru+He,Dt=bt*ru+Ge,Ot=yt*ru+ft,Wt=Math.hypot((bo[2*St+0]+bo[2*Dt+0])/2-bo[2*Ot+0],(bo[2*St+1]+bo[2*Dt+1])/2-bo[2*Ot+1])>=16;Id[Ot]=Id[Ot]||(Wt?1:0),De<1022&&(Id[Ot]=Id[Ot]||Id[(tt+lt>>1)*ru+(He+ut>>1)]||Id[(bt+lt>>1)*ru+(Ge+ut>>1)])}const de=new i.b1,ce=new i.b0;let ue=0;function we(De,Ie){const He=Ie*ru+De;return rh[He]===0&&(de.emplaceBack(bo[2*He+0],bo[2*He+1],De*i.al/Uc,Ie*i.al/Uc),rh[He]=++ue),rh[He]-1}function ve(De,Ie,He,tt,Ge,bt){const ft=De+He>>1,yt=Ie+tt>>1;if(Math.abs(De-Ge)+Math.abs(Ie-bt)>1&&Id[yt*ru+ft])ve(Ge,bt,De,Ie,ft,yt),ve(He,tt,Ge,bt,ft,yt);else{const ut=we(De,Ie),lt=we(He,tt),St=we(Ge,bt);ce.emplaceBack(ut,lt,St)}}return ve(0,0,Uc,Uc,Uc,0),ve(Uc,Uc,0,0,0,Uc),{vertices:de,indices:ce}}(this.tileID.canonical,m);T=D.vertices,O=D.indices}else{T=new i.b1,O=new i.b0;for(const{x:B,y:H}of j)T.emplaceBack(B,H,0,0);const D=i.bh(T.int16.subarray(0,4*T.length),void 0,4);for(let B=0;B0&&(H=i.bl(new Float64Array(16),m.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,T,m,D,H,B),this._makeGlobeTileDebugTextBuffer(d,T,m,D,H,B)}_globePoint(d,m,j,T,O,D,B){let H=i.bm(d,m,j);if(D){const Y=1<.5?ue=-1:ce<-.5&&(ue=1);let we=(d/i.al+j.x)/Y+ue,ve=(m/i.al+j.y)/Y;we=(we-ee)*T._pixelsPerMercatorPixel+ee,ve=(ve-de)*T._pixelsPerMercatorPixel+de;const De=[we*T.worldSize,ve*T.worldSize,0];i.af(De,De,D),H=i.bn(H,De,B)}return i.af(H,H,O)}_makeGlobeTileDebugBorderBuffer(d,m,j,T,O,D){const B=new i.bd,H=new i.be,Y=new i.bo,ee=(ce,ue,we,ve,De)=>{const Ie=(we-ce)/(De-1),He=(ve-ue)/(De-1),tt=B.length;for(let Ge=0;Gede*ue+we;for(let ue=0;ue{if(O)m(O);else try{const H=j.getHeaderLength(D);if(H>d)return void(this.request=this.fetchHeader(H,m));j.parseHeader(D),this._isHeaderLoaded=!0;let Y=0;for(const ee of Object.values(j.layers))Y=Math.max(Y,ee.dataIndex[ee.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,j,T){this.fetchBand(d,m,j,O=>{if(O)return void T(O);this.updateTextureDescriptor(d,m,j);const D=this.textureDescriptorPerLayer.get(m);T(null,D?D.img:null)})}fetchBand(d,m,j,T,O=!0){const D=this._mrt;if(!this._isHeaderLoaded||!D)return void T(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void T(new Error("Can't fetch tile band without an actor"));let H;const Y=i.B(String(j),i.B(this.tileID.key,d));let ee=this._taskQueue.get(Y);ee?ee.add(T):(ee=new Set,ee.add(T),this._taskQueue.set(Y,ee));const de=(ve,De)=>{H.complete(ve,De),ve?T(ve):(ee.forEach(Ie=>Ie(null,De)),this._taskQueue.delete(Y))},ce=(ve,De)=>{if(ve)return T(ve);const Ie=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:De,task:H},de,void 0,!0);if(m!==null){const He=this._workQueuePerLayer.get(m)||[];He.push(()=>{Ie&&Ie.cancel(),H.cancel()}),this._workQueuePerLayer.has(m)||this._workQueuePerLayer.set(m,He)}};let ue;try{ue=D.getLayer(d)}catch(ve){if(this.state==="reloading")return;throw ve}if(!ue)return void T(new Error(`Unknown sourceLayer "${d}"`));if(ue.hasDataForBand(j))return ee.forEach(ve=>ve(null,null)),void this._taskQueue.delete(Y);const we=ue.getDataRange([j]);if(H=D.createDecodingTask(we),!H||H.tasks.length)if(m!==null&&this.flushQueues(m),this.entireBuffer)ce(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,ce);if(m!==null){const Ie=this._fetchQueuePerLayer.get(m)||[];Ie.push(()=>{De.cancel(),H.cancel()}),this._fetchQueuePerLayer.has(m)||this._fetchQueuePerLayer.set(m,Ie)}}}updateNeeded(d,m){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==m||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,m,j){if(!this._mrt)return;const T=this._mrt.getLayer(d);if(!T||!T.hasBand(j)||!T.hasDataForBand(j))return;const{bytes:O,tileSize:D,buffer:B,offset:H,scale:Y}=T.getBandView(j),ee=D+2*B,de=new i.q({width:ee,height:ee},O),ce=this.texturePerLayer.get(m);ce&&ce instanceof i.T&&ce.update(de,{premultiply:!1}),this.textureDescriptorPerLayer.set(m,{layer:d,band:j,img:de,buffer:B,offset:H,tileSize:D,format:T.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 Uy{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,j){const T=d.wrapped().key;this.data[T]===void 0&&(this.data[T]=[]);const O={value:m,timeout:void 0};if(j!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},j)),this.data[T].push(O),this.order.push(T),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 j=d.wrapped().key,T=m===void 0?0:this.data[j].indexOf(m),O=this.data[j][T];return this.data[j].splice(T,1),O.timeout&&clearTimeout(O.timeout),this.data[j].length===0&&delete this.data[j],this.onRemove(O.value),this.order.splice(this.order.indexOf(j),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 j in this.data)for(const T of this.data[j])d(T.value)||m.push(T);for(const j of m)this.remove(j.value.tileID,j)}}class Jg{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,m,j){const T=String(m);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][T]=this.stateChanges[d][T]||{},Object.assign(this.stateChanges[d][T],j),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==T&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][T]===null){this.deletedStates[d][T]={};for(const O in this.state[d][T])j[O]||(this.deletedStates[d][T][O]=null)}else for(const O in j)this.deletedStates[d]&&this.deletedStates[d][T]&&this.deletedStates[d][T][O]===null&&delete this.deletedStates[d][T][O]}removeFeatureState(d,m,j){if(this.deletedStates[d]===null)return;const T=String(m);if(this.deletedStates[d]=this.deletedStates[d]||{},j&&m!==void 0)this.deletedStates[d][T]!==null&&(this.deletedStates[d][T]=this.deletedStates[d][T]||{},this.deletedStates[d][T][j]=null);else if(m!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][T])for(j in this.deletedStates[d][T]={},this.stateChanges[d][T])this.deletedStates[d][T][j]=null;else this.deletedStates[d][T]=null;else this.deletedStates[d]=null}getState(d,m){const j=this.state[d]||{},T=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(m!==void 0){const B=String(m),H=Object.assign({},j[B],T[B]);if(O){const Y=O[m];if(Y===null)return{};for(const ee in Y)delete H[ee]}return H}const D=Object.assign({},j,T);if(O)for(const B in O)delete D[B];return D}initializeTileState(d,m){d.refreshFeatureState(m)}coalesceChanges(d,m){const j={};for(const T in this.stateChanges){this.state[T]=this.state[T]||{};const O={};for(const D in this.stateChanges[T])this.state[T][D]||(this.state[T][D]={}),Object.assign(this.state[T][D],this.stateChanges[T][D]),O[D]=this.state[T][D];j[T]=O}for(const T in this.deletedStates){this.state[T]=this.state[T]||{};const O={};if(this.deletedStates[T]===null)for(const D in this.state[T])O[D]={},this.state[T][D]={};else for(const D in this.deletedStates[T]){if(this.deletedStates[T][D]===null)this.state[T][D]={};else if(this.state[T][D])for(const B of Object.keys(this.deletedStates[T][D]))delete this.state[T][D][B];O[D]=this.state[T][D]}j[T]=j[T]||{},Object.assign(j[T],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(j).length!==0)for(const T in d)d[T].refreshFeatureState(m)}}class ad extends i.E{constructor(d,m,j){super(),this.id=d,this._onlySymbols=j,m.on("data",T=>{T.dataType==="source"&&T.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&T.dataType==="source"&&T.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),m.on("error",()=>{this._sourceErrored=!0}),this._source=m,this._tiles={},this._cache=new Uy(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 Jg,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 j=this._tiles[m];j.upload(d,this.map?this.map.painter:void 0),j.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(ex).map(d=>d.key)}getRenderableIds(d,m){const j=[];for(const T in this._tiles)this._isIdRenderable(+T,d,m)&&j.push(this._tiles[T]);return d?j.sort((T,O)=>{const D=T.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(T=>T.tileID.key):j.map(T=>T.tileID).sort(ex).map(T=>T.key)}hasRenderableParent(d){const m=this.findLoadedParent(d,0);return!!m&&this._isIdRenderable(m.tileID.key)}_isIdRenderable(d,m,j){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(m||!this._tiles[d].holdingForFade())&&(j||!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 j=this._tiles[d];j&&(j.state!=="loading"&&(j.state=m),this._loadTile(j,this._tileLoaded.bind(this,j,d,m)))}_tileLoaded(d,m,j,T,O){if(T){if(d.state="errored",T.status!==404)this._source.fire(new i.y(T,{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(),j==="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 T=0;T1||(Math.abs(D)>1&&(Math.abs(D+H)===1?D+=H:Math.abs(D-H)===1&&(D-=H)),O.dem&&T.dem&&(T.dem.backfillBorder(O.dem,D,B),T.neighboringTiles&&T.neighboringTiles[Y]&&(T.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,m,j,T){for(const O in this._tiles){let D=this._tiles[O];if(T[O]||!D.hasData()||D.tileID.overscaledZ<=m||D.tileID.overscaledZ>j)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]){T[B.key]=B;break}}}findLoadedParent(d,m){if(d.key in this._loadedParentTiles){const j=this._loadedParentTiles[d.key];return j&&j.tileID.overscaledZ>=m?j:null}for(let j=d.overscaledZ-1;j>=m;j--){const T=d.scaledTo(j),O=this._getLoadedTile(T);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 j=Math.ceil(d.width/m)+1,T=Math.ceil(d.height/m)+1,O=Math.floor(j*T*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 j={};for(const T in this._tiles){const O=this._tiles[T];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+m),j[O.tileID.key]=O}this._tiles=j;for(const T in this._timers)clearTimeout(this._timers[T]),delete this._timers[T];for(const T in this._tiles)this._setTileReloadTimer(+T,this._tiles[T])}}update(d,m,j,T,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!j)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 ce=Y.attenuationRange()[0],ue=Math.floor(ce)-Math.log2(Y.getDemUpscale());H>ue&&(H=ue)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(ce=>new i.aQ(ce.canonical.z,ce.wrap,ce.canonical.z,ce.canonical.x,ce.canonical.y));else if(this.tileCoverLift!==0){const ce=d.clone();ce.tileCoverLift=this.tileCoverLift,B=ce.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!j,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&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.hasTile){const ce=this._source.hasTile.bind(this._source);B=B.filter(ue=>ce(ue))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Lh(this._source.type)){const ce=d.coveringZoomLevel({tileSize:m||this._source.tileSize,roundZoom:this._source.roundZoom&&!j}),ue=Math.min(ce,this._source.maxzoom);if(D){const we=d.extendTileCover(B,ue);for(const ve of we)B.push(ve)}else if(O){const we=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(ue),ue);for(const ve of we)B.push(ve)}else if(this.castsShadows&&T){const we=d.extendTileCover(B,ue,T,16);for(const ve of we)this._shadowCasterTiles[ve.key]=!0,B.push(ve)}}const ee=this._updateRetainedTiles(B);if(Lh(this._source.type)&&B.length!==0){const ce={},ue={},we=Object.keys(ee);for(const De of we){const Ie=ee[De],He=this._tiles[De];if(!He||He.fadeEndTime&&He.fadeEndTime<=i.o.now())continue;const tt=this.findLoadedParent(Ie,Math.max(Ie.overscaledZ-ad.maxOverzooming,this._source.minzoom));tt&&(this._addTile(tt.tileID),ce[tt.tileID.key]=tt.tileID),ue[De]=Ie}const ve=B[B.length-1].overscaledZ;for(const De in this._tiles){const Ie=this._tiles[De];if(ee[De]||!Ie.hasData())continue;let He=Ie.tileID;for(;He.overscaledZ>ve;){He=He.scaledTo(He.overscaledZ-1);const tt=this._tiles[He.key];if(tt&&tt.hasData()&&ue[He.key]){ee[De]=Ie.tileID;break}}}for(const De in ce)ee[De]||(this._coveredTiles[De]=!0,ee[De]=ce[De])}for(const ce in ee)this._tiles[ce].clearFadeHold();const de=i.bv(this._tiles,ee);for(const ce of de){const ue=this._tiles[ce];ue.hasSymbolBuckets&&!ue.holdingForFade()?ue.setHoldDuration(this.map._fadeDuration):ue.hasSymbolBuckets&&!ue.symbolFadeFinished()||this._removeTile(+ce)}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 j={},T=d.reduce((Y,ee)=>Math.min(Y,ee.overscaledZ),1/0),O=d[0].overscaledZ,D=Math.max(O-ad.maxOverzooming,this._source.minzoom),B=Math.max(O+ad.maxUnderzooming,this._source.minzoom),H={};for(const Y of d){const ee=this._addTile(Y);m[Y.key]=Y,ee.hasData()||T=this._source.maxzoom){const ce=Y.children(this._source.maxzoom)[0],ue=this.getTile(ce);if(ue&&ue.hasData()){m[ce.key]=ce;continue}}else{const ce=Y.children(this._source.maxzoom);if(m[ce[0].key]&&m[ce[1].key]&&m[ce[2].key]&&m[ce[3].key])continue}let de=ee.wasRequested();for(let ce=Y.overscaledZ-1;ce>=D;--ce){const ue=Y.scaledTo(ce);if(j[ue.key]||(j[ue.key]=!0,ee=this.getTile(ue),!ee&&de&&(ee=this._addTile(ue)),ee&&(m[ue.key]=ue,de=ee.wasRequested(),ee.hasData())))break}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const m=[];let j,T=this._tiles[d].tileID;for(;T.overscaledZ>0;){if(T.key in this._loadedParentTiles){j=this._loadedParentTiles[T.key];break}m.push(T.key);const O=T.scaledTo(T.overscaledZ-1);if(j=this._getLoadedTile(O),j)break;T=O}for(const O of m)this._loadedParentTiles[O]=j}}_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 j=!!m;if(!j){const T=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();m=this._source.type==="raster-array"?new _p(d,O,this.transform.tileZoom,T,this._isRaster):new vp(d,O,this.transform.tileZoom,T,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,j||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 j=m.getExpiryTimeout();j&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},j))}_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,j){const T=[],O=this.transform;if(!O)return T;const D=O.projection.name==="globe",B=i.aF(O.center.lng);for(const H in this._tiles){const Y=this._tiles[H];if(j&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let ee;if(D){const de=Y.tileID.canonical;if(de.z===0){const ce=[Math.abs(i.aA(B,...Oh(de,-1))-B),Math.abs(i.aA(B,...Oh(de,1))-B)];ee=[0,2*ce.indexOf(Math.min(...ce))-1]}else{const ce=[Math.abs(i.aA(B,...Oh(de,-1))-B),Math.abs(i.aA(B,...Oh(de,0))-B),Math.abs(i.aA(B,...Oh(de,1))-B)];ee=[ce.indexOf(Math.min(...ce))-1]}}else ee=[0];for(const de of ee){const ce=d.containsTile(Y,O,m,de);ce&&T.push(ce)}}return T}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,m){const j=this.getRenderableIds(d,m).map(O=>this._tiles[O].tileID),T=this.transform.projection.name==="globe";for(const O of j)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=T?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return j}sortCoordinatesByDistance(d){const m=d.slice(),j=this.transform._camera.position,T=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(Lh(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,j){this._state.updateState(d=d||"_geojsonTileLayer",m,j)}removeFeatureState(d,m,j){this._state.removeFeatureState(d=d||"_geojsonTileLayer",m,j)}getFeatureState(d,m){return this._state.getState(d=d||"_geojsonTileLayer",m)}setDependencies(d,m,j){const T=this._tiles[d];T&&T.setDependencies(m,j)}reloadTilesForDependencies(d,m){for(const j in this._tiles)this._tiles[j].hasDependency(d,m)&&this._reloadTile(+j,"reloading");this._cache.filter(j=>!j.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 j=new Map,T=Array.isArray(d)?d:[d],O=this.map.painter.terrain,D=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const H of T){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 ee of Y)j.set(ee.key,ee);this.usedForTerrain&&H.updateElevation(!1)}const B=Array.from(j.values());i.bw(B,(H,Y)=>{const ee=new vp(H,this._source.tileSize*H.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(ee,de=>{this._source.type==="raster-dem"&&ee.dem&&this._backfillDEM(ee),Y(de,ee)})},m)}}function ex(b,d){const m=Math.abs(2*b.wrap)-+(b.wrap<0),j=Math.abs(2*d.wrap)-+(d.wrap<0);return b.overscaledZ-d.overscaledZ||j-m||d.canonical.y-b.canonical.y||d.canonical.x-b.canonical.x}function Lh(b){return b==="raster"||b==="image"||b==="video"||b==="custom"}function Oh(b,d){const m=1<0:j.type==="building"?T=!j.isHidden(d)&&j.paint.get("building-opacity")>0:j.type==="model"&&(T=!j.isHidden(d)&&j.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!T&&m.visible,m.visible=T}}updateZOffset(d,m){this.currentBuildingBuckets=[];for(const T of this.layers){const O=T.layer,D=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=T.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=T.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 ee=D._tiles[Y];if(m.canonical.isChildOf(ee.tileID.canonical)){H=ee;break}}this.currentBuildingBuckets.push({bucket:H?H.getBucket(O):null,tileID:H?H.tileID:m,verticalScale:B})}d.hasAnyZOffset=!1;let j=!1;for(let T=0;T{j in d&&(m[j]=d[j])}),m}function jf(b){b=b.slice();const d=Object.create(null);for(let m=0;m0?(T-D)/B:0;return this.points[O].mult(1-H).add(this.points[m].mult(H))}}class Ma{constructor(d,m,j){const T=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/j),this.yCellCount=Math.ceil(m/j);for(let D=0;Dthis.width||T<0||m>this.height)return!O&&[];const B=[];if(d<=0&&m<=0&&this.width<=j&&this.height<=T){if(O)return!0;for(let H=0;H0:B}_queryCircle(d,m,j,T,O){const D=d-j,B=d+j,H=m-j,Y=m+j;if(B<0||D>this.width||Y<0||H>this.height)return!T&&[];const ee=[];return this._forEachCell(D,H,B,Y,this._queryCellCircle,ee,{hitTest:T,circle:{x:d,y:m,radius:j},seenUids:{box:{},circle:{}}},O),T?ee.length>0:ee}query(d,m,j,T,O){return this._query(d,m,j,T,!1,O)}hitTest(d,m,j,T,O){return this._query(d,m,j,T,!0,O)}hitTestCircle(d,m,j,T){return this._queryCircle(d,m,j,!0,T)}_queryCell(d,m,j,T,O,D,B,H){const Y=B.seenUids,ee=this.boxCells[O];if(ee!==null){const ce=this.bboxes;for(const ue of ee)if(!Y.box[ue]){Y.box[ue]=!0;const we=4*ue;if(d<=ce[we+2]&&m<=ce[we+3]&&j>=ce[we+0]&&T>=ce[we+1]&&(!H||H(this.boxKeys[ue]))){if(B.hitTest)return D.push(!0),!0;D.push({key:this.boxKeys[ue],x1:ce[we],y1:ce[we+1],x2:ce[we+2],y2:ce[we+3]})}}}const de=this.circleCells[O];if(de!==null){const ce=this.circles;for(const ue of de)if(!Y.circle[ue]){Y.circle[ue]=!0;const we=3*ue;if(this._circleAndRectCollide(ce[we],ce[we+1],ce[we+2],d,m,j,T)&&(!H||H(this.circleKeys[ue]))){if(B.hitTest)return D.push(!0),!0;{const ve=ce[we],De=ce[we+1],Ie=ce[we+2];D.push({key:this.circleKeys[ue],x1:ve-Ie,y1:De-Ie,x2:ve+Ie,y2:De+Ie})}}}}}_queryCellCircle(d,m,j,T,O,D,B,H){const Y=B.circle,ee=B.seenUids,de=this.boxCells[O];if(de!==null){const ue=this.bboxes;for(const we of de)if(!ee.box[we]){ee.box[we]=!0;const ve=4*we;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,ue[ve+0],ue[ve+1],ue[ve+2],ue[ve+3])&&(!H||H(this.boxKeys[we])))return D.push(!0),!0}}const ce=this.circleCells[O];if(ce!==null){const ue=this.circles;for(const we of ce)if(!ee.circle[we]){ee.circle[we]=!0;const ve=3*we;if(this._circlesCollide(ue[ve],ue[ve+1],ue[ve+2],Y.x,Y.y,Y.radius)&&(!H||H(this.circleKeys[we])))return D.push(!0),!0}}}_forEachCell(d,m,j,T,O,D,B,H){const Y=this._convertToXCellCoord(d),ee=this._convertToYCellCoord(m),de=this._convertToXCellCoord(j),ce=this._convertToYCellCoord(T);for(let ue=Y;ue<=de;ue++)for(let we=ee;we<=ce;we++)if(O.call(this,d,m,j,T,this.xCellCount*we+ue,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,j,T,O,D){const B=T-d,H=O-m,Y=j+D;return Y*Y>B*B+H*H}_circleAndRectCollide(d,m,j,T,O,D,B){const H=(D-T)/2,Y=Math.abs(d-(T+H));if(Y>H+j)return!1;const ee=(B-O)/2,de=Math.abs(m-(O+ee));if(de>ee+j)return!1;if(Y<=H||de<=ee)return!0;const ce=Y-H,ue=de-ee;return ce*ce+ue*ue<=j*j}}const na={unknown:0,flipRequired:1,flipNotRequired:2},gi=Math.tan(85*Math.PI/180);function yl(b,d,m,j,T,O,D){const B=i.bC();if(m)if(O.name==="globe"){const H=i.bD(T,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],j||i.bB(B,B,T.angle)}else i.aB(B,T.labelPlaneMatrix,b);return B}function bp(b,d,m,j,T,O,D){const B=yl(b,d,m,j,T,O,D);return O.name==="globe"&&m||(B[2]=B[6]=B[10]=B[14]=0),B}function wp(b,d,m,j,T,O,D){if(m){if(O.name==="globe"){const B=yl(b,d,m,j,T,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),j||i.bB(B,B,-T.angle),B}}return T.glCoordMatrix}function nu(b,d,m,j){const T=[b,d,m,1];m?i.aC(T,T,j):yn(T,T,j);const O=T[3];return T[0]/=O,T[1]/=O,T[2]/=O,T}function Ta(b,d){return Math.min(.5+b/d*.5,1.5)}function iP(b,d){const m=b[0]/b[3],j=b[1]/b[3];return m>=-d[0]&&m<=d[0]&&j>=-d[1]&&j<=d[1]}function oP(b,d,m,j,T,O,D,B,H,Y,ee=1){const de=m.transform,ce=j?b.textSizeData:b.iconSizeData,ue=i.bK(ce,m.transform.zoom,ee),we=de.projection.name==="globe",ve=[256/m.width*2+1,256/m.height*2+1],De=j?b.text.dynamicLayoutVertexArray:b.icon.dynamicLayoutVertexArray;De.clear();let Ie=null;we&&(Ie=j?b.text.globeExtVertexArray:b.icon.globeExtVertexArray);const He=b.lineVertexArray,tt=j?b.text.placedSymbolArray:b.icon.placedSymbolArray,Ge=m.transform.width/m.transform.height;let bt,ft=!1;for(let yt=0;ytMath.abs(m)?{useVertical:!0}:b===i.bL.vertical?j>0?{needsFlipping:!0}:null:d!==na.unknown&&function(T,O){return T===0||Math.abs(O/T)>gi}(m,j)?d===na.flipRequired?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function $3(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie,He,tt){const Ge=d/24,bt=b.lineOffsetX*Ge,ft=b.lineOffsetY*Ge,{lineStartIndex:yt,glyphStartIndex:ut,numGlyphs:lt,segment:St,writingMode:Dt,flipState:Ot}=b,Wt=yt+b.lineLength,Gt=sr=>{if(ee){const[Jt,Vt,dr]=sr.up,Ar=Y.length;i.bN(ee,Ar+0,Jt,Vt,dr),i.bN(ee,Ar+1,Jt,Vt,dr),i.bN(ee,Ar+2,Jt,Vt,dr),i.bN(ee,Ar+3,Jt,Vt,dr)}const[_r,$t,Tt]=sr.point;i.bO(Y,_r,$t,Tt,sr.angle)};if(lt>1){const sr=lP(Ge,B,bt,ft,m,de,ce,b,H,O,ue,ve,!1,De,Ie,He,tt);if(!sr)return{notEnoughRoom:!0};if(j&&!m){let[_r,$t,Tt]=sr.first.point,[Jt,Vt,dr]=sr.last.point;[_r,$t]=nu(_r,$t,Tt,D),[Jt,Vt]=nu(Jt,Vt,dr,D);const Ar=Fn(Dt,Ot,(Jt-_r)*we,Vt-$t);if(b.flipState=Ar&&Ar.needsFlipping?na.flipRequired:na.flipNotRequired,Ar)return Ar}Gt(sr.first);for(let _r=ut+1;_r0?Jt:nh(ce,Tt,_r,1,T,void 0,De,Ie.canonical),dr=Fn(Dt,Ot,(Vt[0]-_r[0])*we,Vt[1]-_r[1]);if(b.flipState=dr&&dr.needsFlipping?na.flipRequired:na.flipNotRequired,dr)return dr}const sr=Vy(Ge*B.getoffsetX(ut),bt,ft,m,de,ce,St,yt,Wt,H,O,ue,ve,!1,!1,De,Ie,He,tt);if(!sr)return{notEnoughRoom:!0};Gt(sr)}return{}}function Cv(b,d,m,j,T){const{x:O,y:D,z:B}=j.projectTilePoint(b.x,b.y,d);if(!T)return nu(O,D,B,m);const[H,Y,ee]=T.getElevation(b,T.elevation,T.elevationFeature);return nu(O+H,D+Y,B+ee,m)}function nh(b,d,m,j,T,O,D,B){const H=Cv(b.sub(d)._unit()._add(b),B,T,D,O);return i.av(H,m,H),i.aw(H,H),i.bH(H,m,H,j)}function Vy(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie,He){const tt=j?b-d:b+d;let Ge=tt>0?1:-1,bt=0;j&&(Ge*=-1,bt=Math.PI),Ge<0&&(bt+=Math.PI);let ft=B+D+(Ge>0?0:1)|0,yt=T,ut=T,lt=0,St=0;const Dt=Math.abs(tt),Ot=[],Wt=[];let Gt=O,sr=Gt,_r=i.bF([]);const $t=()=>nh(sr,Gt,ut,Dt-lt+1,ee,ce,ve,De.canonical);for(;lt+St<=Dt;){if(ft+=Ge,ft=H)return null;if(ut=yt,sr=Gt,Ot.push(ut),ue&&Wt.push(sr),Gt=new i.P(Y.getx(ft),Y.gety(ft)),yt=de[ft],!yt){const en=Cv(Gt,De.canonical,ee,ve,ce);yt=en[3]>0?de[ft]=en:$t()}lt+=St;const br=i.av([],yt,ut),on=i.bG(ut,yt);if(m&&on>0&&St>0&&i.bJ(_r,br)/(St*on)0,tt),yt=Y*ft.perspectiveRatio,ut=(j.x1*m+B.x-j.padding)*yt+ft.point.x,lt=(j.y1*m+B.y-j.padding)*yt+ft.point.y,St=(j.x2*m+B.x+j.padding)*yt+ft.point.x,Dt=(j.y2*m+B.y+j.padding)*yt+ft.point.y,Ot=ft.perspectiveRatio<=.55||ft.occluded;return!this.isInsideGrid(ut,lt,St,Dt)||!H&&this.grid.hitTest(ut,lt,St,Dt,de)||Ot?{box:[],offscreen:!1,occluded:ft.occluded}:{box:[ut,lt,St,Dt],offscreen:this.isOffscreen(ut,lt,St,Dt),occluded:!1}}placeCollisionCircles(d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De){const Ie=[],He=this.transform.elevation,tt=d.getProjection(),Ge=d.elevationType==="road",bt=!!He||Ge,ft=i.bV.getAtTileOffsetFunc(De,this.transform.center.lat,this.transform.worldSize,tt),yt=new i.P(j.tileAnchorX,j.tileAnchorY),ut=new i.P(j.tileAnchorX,j.tileAnchorY);let{x:lt,y:St,z:Dt}=tt.projectTilePoint(ut.x,ut.y,De.canonical),Ot=null;if(bt){const on=Ge?d.getElevationFeatureForText(T):null;Ot={getElevation:ft,elevation:He,elevationFeature:on};const[en,$r,Gr]=ft(yt,He,on);lt+=en,St+=$r,Dt+=Gr}const Wt=tt.name==="globe",Gt=this.projectAndGetPerspectiveRatio(H,lt,St,Dt,De,Wt||!!He||this.transform.pitch>0,tt),{perspectiveRatio:sr}=Gt,_r=(ce?B/sr:B*sr)/i.bY,$t=nu(lt,St,Dt,Y),Tt=j.lineOffsetX*_r,Jt=j.lineOffsetY*_r,Vt=i.an(d.layers[0].layout.get("text-max-angle")),dr=Math.cos(Vt),Ar=Gt.signedDistanceFromCamera>0?lP(_r,D,Tt,Jt,Ge&&j.flipState===1,$t,ut,j,O,Y,{},bt&&!ce?Ot:null,ce&&bt,tt,De,ce,dr):null;let Hr=!1,Nr=!1,br=!0;if(Ar&&!Gt.occluded){const on=.5*we*sr+ve,en=new i.P(-100,-100),$r=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Gr=new ns,{first:kn,last:Qn}=Ar,Fs=kn.path.length;let pa=[];for(let Kn=Fs-1;Kn>=1;Kn--)pa.push(kn.path[Kn]);for(let Kn=1;Kn(bt&&!Wt&&(za=ft(AaKn[3]<=0)&&(pa=[]));let oa=[];if(pa.length>0){let Kn=1/0,_a=-1/0,za=1/0,Aa=-1/0;for(const ia of pa)Kn=Math.min(Kn,ia[0]),za=Math.min(za,ia[1]),_a=Math.max(_a,ia[0]),Aa=Math.max(Aa,ia[1]);_a>=en.x&&Kn<=$r.x&&Aa>=en.y&&za<=$r.y&&(oa=[pa.map(ia=>new i.P(ia[0],ia[1]))],(Kn$r.x||za$r.y)&&(oa=i.bW(oa,en.x,en.y,$r.x,$r.y)))}for(const Kn of oa){Gr.reset(Kn,.25*on);let _a=0;_a=Gr.length<=.5*on?1:Math.ceil(Gr.paddedLength/dn)+1;for(let za=0;za<_a;za++){const Aa=za/Math.max(_a-1,1),ia=Gr.lerp(Aa),cs=ia.x+Zs,xa=ia.y+Zs;Ie.push(cs,xa,on,0);const qi=cs-on,yi=xa-on,ba=cs+on,ea=xa+on;if(br=br&&this.isOffscreen(qi,yi,ba,ea),Nr=Nr||this.isInsideGrid(qi,yi,ba,ea),!m&&this.grid.hitTestCircle(cs,xa,on,ue)&&(Hr=!0,!de))return{circles:[],offscreen:!1,collisionDetected:Hr,occluded:!1}}}}return{circles:!de&&Hr||!Nr?[]:Ie,offscreen:br,collisionDetected:Hr,occluded:Gt.occluded}}queryRenderedSymbols(d){if(d.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const m=[];let j=1/0,T=1/0,O=-1/0,D=-1/0;for(const ee of d){const de=new i.P(ee.x+Zs,ee.y+Zs);j=Math.min(j,de.x),T=Math.min(T,de.y),O=Math.max(O,de.x),D=Math.max(D,de.y),m.push(de)}const B=this.grid.query(j,T,O,D).concat(this.ignoredGrid.query(j,T,O,D)),H={},Y={};for(const ee of B){const de=ee.key;if(H[de.bucketInstanceId]===void 0&&(H[de.bucketInstanceId]={}),H[de.bucketInstanceId][de.featureIndex])continue;const ce=[new i.P(ee.x1,ee.y1),new i.P(ee.x2,ee.y1),new i.P(ee.x2,ee.y2),new i.P(ee.x1,ee.y2)];i.bX(m,ce)&&(H[de.bucketInstanceId][de.featureIndex]=!0,Y[de.bucketInstanceId]===void 0&&(Y[de.bucketInstanceId]=[]),Y[de.bucketInstanceId].push(de.featureIndex))}return Y}insertCollisionBox(d,m,j,T,O){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:j,featureIndex:T,collisionGroupID:O},d[0],d[1],d[2],d[3])}insertCollisionCircles(d,m,j,T,O){const D=m?this.ignoredGrid:this.grid,B={bucketInstanceId:j,featureIndex:T,collisionGroupID:O};for(let H=0;H0?(i.aC(H,H,d),this.fogState&&O&&B.name!=="globe"&&(Y=function(ce,ue,we,ve,De,Ie){const He=Ie.calculateFogTileMatrix(De),tt=[ue,we,ve];return i.af(tt,tt,He),Wr(ce,i.ag(tt),Ie.pitch,Ie._fov)}(this.fogState,m,j,T,O.toUnwrapped(),this.transform)>.9)):yn(H,H,d);const ee=H[3];return{point:new i.P((H[0]/ee+1)/2*this.transform.width+Zs,(-H[1]/ee+1)/2*this.transform.height+Zs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/ee*.5,1.5),signedDistanceFromCamera:ee,occluded:D&&H[2]>ee||Y}}isOffscreen(d,m,j,T){return j=this.screenRightBoundary||Tthis.screenBottomBoundary}isInsideGrid(d,m,j,T){return j>=0&&d=0&&mj.collisionGroupID===m}}return this.collisionGroups[d]}}function Nc(b,d,m,j,T){const{horizontalAlign:O,verticalAlign:D}=i.c1(b),B=-(O-.5)*d,H=-(D-.5)*m,Y=i.c2(b,j);return new i.P(B+Y[0]*T,H+Y[1]*T)}function Io(b,d,m,j,T){const O=new i.P(b,d);return m&&O._rotate(j?T:-T),O}class oie{constructor(d,m,j,T,O,D){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Fa(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 Tv(j),this.collisionCircleArrays={},this.prevPlacement=T,T&&(T.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,m,j,T,O=1){const D=j.getBucket(m),B=j.latestFeatureIndex;if(!D||!B||m.fqid!==D.layerIds[0])return;const H=D.layers[0].layout,Y=D.layers[0].paint,ee=j.collisionBoxArray,de=Math.pow(2,this.transform.zoom-j.tileID.overscaledZ),ce=j.tileSize/i.al,ue=j.tileID.toUnwrapped();this.transform.setProjection(D.projection);const we=(ve=j.tileID,De=D.getProjection(),Ie=this.transform,De.name===this.projection?Ie.calculateProjMatrix(ve.toUnwrapped()):gr(Ie,De,ve));var ve,De,Ie;const He=H.get("text-pitch-alignment")==="map",tt=H.get("text-rotation-alignment")==="map";m.compileFilter(m.options);const Ge=m.dynamicFilter(),bt=m.dynamicFilterNeedsFeature(),ft=this.transform.calculatePixelsToTileUnitsMatrix(j),yt=bp(we,j.tileID.canonical,He,tt,this.transform,D.getProjection(),ft);let ut=null;const lt=D.getProjection().createInversionMatrix(this.transform,j.tileID.canonical);if(He){const Tt=wp(we,j.tileID.canonical,He,tt,this.transform,D.getProjection(),ft);ut=i.aB([],this.transform.labelPlaneMatrix,Tt)}let St=null;Ge&&j.latestFeatureIndex&&(St={unwrappedTileID:ue,dynamicFilter:Ge,dynamicFilterNeedsFeature:bt}),this.retainedQueryData[D.bucketInstanceId]=new Mv(D.bucketInstanceId,B,D.sourceLayerIndex,D.index,j.tileID);const[Dt,Ot]=D.layers[0].layout.get("text-size-scale-range"),Wt=i.aA(O,Dt,Ot),[Gt,sr]=H.get("icon-size-scale-range"),_r=i.aA(O,Gt,sr),$t={bucket:D,layout:H,paint:Y,posMatrix:we,invMatrix:lt,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:yt,labelToScreenMatrix:ut,clippingData:St,scale:de,textPixelRatio:ce,holdingForFade:j.holdingForFade(),collisionBoxArray:ee,partiallyEvaluatedTextSize:i.bK(D.textSizeData,this.transform.zoom,Wt),partiallyEvaluatedIconSize:i.bK(D.iconSizeData,this.transform.zoom,_r),collisionGroup:this.collisionGroups.get(D.sourceID),latestFeatureIndex:j.latestFeatureIndex};if(T)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,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie,He,tt,Ge,bt){const{textOffset0:ft,textOffset1:yt,crossTileID:ut}=ve,lt=[ft,yt],St=Nc(d,D,B,lt,H),Dt=this.collisionIndex.placeCollisionBox(Ie,H,m,j,T,O,Io(St.x,St.y,Y,ee,this.transform.angle),we,de,ce,ue.predicate);if(tt){const Ot=Ie.getSymbolInstanceIconSize(bt,this.transform.zoom,ve.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Ie,Ot,tt,j,T,O,Io(St.x,St.y,Y,ee,this.transform.angle),we,de,ce,ue.predicate).box.length===0)return}if(Dt.box.length>0){let Ot;return this.prevPlacement&&this.prevPlacement.variableOffsets[ut]&&this.prevPlacement.placements[ut]&&this.prevPlacement.placements[ut].text&&(Ot=this.prevPlacement.variableOffsets[ut].anchor),this.variableOffsets[ut]={textOffset:lt,width:D,height:B,anchor:d,textScale:H,prevAnchor:Ot},this.markUsedJustification(Ie,d,ve,He),Ie.allowVerticalPlacement&&(this.markUsedOrientation(Ie,He,ve),this.placedOrientations[ut]=He),{shift:St,placedGlyphBoxes:Dt}}}placeLayerBucketPart(d,m,j,T,O=1){const{bucket:D,layout:B,paint:H,posMatrix:Y,textLabelPlaneMatrix:ee,labelToScreenMatrix:de,clippingData:ce,textPixelRatio:ue,mercatorCenter:we,invMatrix:ve,holdingForFade:De,collisionBoxArray:Ie,partiallyEvaluatedTextSize:He,partiallyEvaluatedIconSize:tt,collisionGroup:Ge,latestFeatureIndex:bt}=d.parameters,ft=B.get("text-optional"),yt=B.get("icon-optional"),ut=B.get("text-allow-overlap"),lt=B.get("icon-allow-overlap"),St=B.get("text-rotation-alignment")==="map",Dt=B.get("icon-rotation-alignment")==="map",Ot=B.get("text-pitch-alignment")==="map",Wt=H.get("symbol-z-offset"),Gt=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),Ar=B.get("text-variable-anchor"),Hr=St&&sr!=="point",Nr=Dt&&sr!=="point",br=Ar&&D.hasTextData(),on=D.hasIconTextFit()&&br&&D.hasIconData();this.transform.setProjection(D.projection);const en=br||Hr,$r=Nr||on;let Gr=ut&&(lt||!D.hasIconData()||yt),kn=lt&&(ut||!D.hasTextData()||ft);const Qn=!Wt.isConstant();!D.collisionArrays&&Ie&&D.deserializeCollisionBoxes(Ie),j&&T&&D.updateCollisionDebugBuffers(this.transform.zoom,Ie,Vt,dr);const Fs=(dn,oa,Kn)=>{const{crossTileID:_a,numVerticalGlyphVertices:za}=dn;let Aa=null;if(ce&&ce.dynamicFilterNeedsFeature||Qn){const Ki=this.retainedQueryData[D.bucketInstanceId];Aa=bt.loadFeature({featureIndex:dn.featureIndex,bucketIndex:Ki.bucketIndex,sourceLayerIndex:Ki.sourceLayerIndex,layoutVertexArrayOffset:0});const lo=Aa.properties?Aa.properties.worldview:null;if(D.localizable&&D.worldview&&typeof lo=="string")if(lo==="all")Aa.properties.$localized=!0;else{if(!lo.split(",").includes(D.worldview))return;Aa.properties.$localized=!0,Aa.properties.worldview=D.worldview}}if(ce&&!(0,ce.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:D.worldview},Aa,this.retainedQueryData[D.bucketInstanceId].tileID.canonical,new i.P(dn.tileAnchorX,dn.tileAnchorY),this.transform.calculateDistanceTileData(ce.unwrappedTileID)))return this.placements[_a]=new Na(!1,!1,!1,!0),void m.add(_a);const ia=Wt.evaluate(Aa,{});if(m.has(_a))return;if(De)return void(this.placements[_a]=new Na(!1,!1,!1));let cs=!1,xa=!1,qi=!0,yi=!1,ba=!1,ea=null,ds={box:null,offscreen:null,occluded:null},ci={box:null},ro=null,Ri=null,Ga=null,ud=0,dc=0,Go=0;Kn.textFeatureIndex?ud=Kn.textFeatureIndex:dn.useRuntimeCollisionCircles&&(ud=dn.featureIndex),Kn.verticalTextFeatureIndex&&(dc=Kn.verticalTextFeatureIndex);const Cc=D.elevationFeatures?D.elevationFeatures[dn.elevationFeatureIndex]:void 0,Mc=Ki=>{Ki.tileID=this.retainedQueryData[D.bucketInstanceId].tileID;const lo=this.transform.elevation;Ki.elevation=Gt?ia:ia+i.bV.getAtTileOffset(Ki.tileID,new i.P(Ki.tileAnchorX,Ki.tileAnchorY),lo,Cc),Ki.elevation+=dn.zOffset},Wl=Kn.textBox;if(Wl){Mc(Wl);const Ki=Ka=>{let wo=i.bL.horizontal;if(D.allowVerticalPlacement&&!Ka&&this.prevPlacement){const Vi=this.prevPlacement.placedOrientations[_a];Vi&&(this.placedOrientations[_a]=Vi,wo=Vi,this.markUsedOrientation(D,wo,dn))}return wo},lo=(Ka,wo)=>{if(D.allowVerticalPlacement&&za>0&&Kn.verticalTextBox){for(const Vi of D.writingModes)if(Vi===i.bL.vertical?(ds=wo(),ci=ds):ds=Ka(),ds&&ds.box&&ds.box.length)break}else ds=Ka()};if(Ar){let Ka=Ar;if(this.prevPlacement&&this.prevPlacement.variableOffsets[_a]){const Fi=this.prevPlacement.variableOffsets[_a];Ka.indexOf(Fi.anchor)>0&&(Ka=Ka.filter(uh=>uh!==Fi.anchor),Ka.unshift(Fi.anchor))}const wo=(Fi,uh,n_)=>{const qh=D.getSymbolInstanceTextSize(He,dn,this.transform.zoom,oa),s_=(Fi.x2-Fi.x1)*qh+2*Fi.padding,p0=(Fi.y2-Fi.y1)*qh+2*Fi.padding,Pf=dn.hasIconTextFit&&!lt?uh:null;Pf&&Mc(Pf);let Dp={box:[],offscreen:!1,occluded:!1};const m0=ut?2*Ka.length:Ka.length;for(let Jm=0;Jm=Ka.length,dn,oa,D,n_,Pf,He,tt);if(Rp&&(Dp=Rp.placedGlyphBoxes,Dp&&Dp.box&&Dp.box.length)){cs=!0,ea=Rp.shift;break}}return Dp};lo(()=>wo(Wl,Kn.iconBox,i.bL.horizontal),()=>{const Fi=Kn.verticalTextBox;return Fi&&Mc(Fi),D.allowVerticalPlacement&&!(ds&&ds.box&&ds.box.length)&&za>0&&Fi?wo(Fi,Kn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),ds&&(cs=ds.box,qi=ds.offscreen,yi=ds.occluded);const Vi=Ki(!(!ds||!ds.box));if(!cs&&this.prevPlacement){const Fi=this.prevPlacement.variableOffsets[_a];Fi&&(this.variableOffsets[_a]=Fi,this.markUsedJustification(D,Fi.anchor,dn,Vi))}}else{const Ka=(wo,Vi)=>{const Fi=D.getSymbolInstanceTextSize(He,dn,this.transform.zoom,oa),uh=this.collisionIndex.placeCollisionBox(D,Fi,wo,we,ve,en,new i.P(0,0),ut,ue,Y,Ge.predicate);return uh&&uh.box&&uh.box.length&&(this.markUsedOrientation(D,Vi,dn),this.placedOrientations[_a]=Vi),uh};lo(()=>Ka(Wl,i.bL.horizontal),()=>{const wo=Kn.verticalTextBox;return D.allowVerticalPlacement&&za>0&&wo?(Mc(wo),Ka(wo,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Ki(!!(ds&&ds.box&&ds.box.length))}}if(ro=ds,cs=ro&&ro.box&&ro.box.length>0,qi=ro&&ro.offscreen,yi=ro&&ro.occluded,dn.useRuntimeCollisionCircles){const Ki=dn.centerJustifiedTextSymbolIndex>=0?dn.centerJustifiedTextSymbolIndex:dn.verticalPlacedTextSymbolIndex,lo=D.text.placedSymbolArray.get(Ki),Ka=i.bM(D.textSizeData,He,lo),wo=B.get("text-padding");Ri=this.collisionIndex.placeCollisionCircles(D,ut,lo,Ki,D.lineVertexArray,D.glyphOffsetArray,Ka,Y,ee,de,j,Ot,Ge.predicate,dn.collisionCircleDiameter*Ka/i.bY,wo,this.retainedQueryData[D.bucketInstanceId].tileID),cs=ut||Ri.circles.length>0&&!Ri.collisionDetected,qi=qi&&Ri.offscreen,yi=Ri.occluded}if(Kn.iconFeatureIndex&&(Go=Kn.iconFeatureIndex),Kn.iconBox){const Ki=lo=>{Mc(lo);const Ka=dn.hasIconTextFit&&ea?Io(ea.x,ea.y,St,Ot,this.transform.angle):new i.P(0,0),wo=D.getSymbolInstanceIconSize(tt,this.transform.zoom,dn.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(D,wo,lo,we,ve,$r,Ka,lt,ue,Y,Ge.predicate)};ci&&ci.box&&ci.box.length&&Kn.verticalIconBox?(Ga=Ki(Kn.verticalIconBox),xa=Ga.box.length>0):(Ga=Ki(Kn.iconBox),xa=Ga.box.length>0),qi=qi&&Ga.offscreen,ba=Ga.occluded}const Eu=ft||dn.numHorizontalGlyphVertices===0&&za===0,dh=yt||dn.numIconVertices===0;if(Eu||dh?dh?Eu||(xa=xa&&cs):cs=xa&&cs:xa=cs=xa&&cs,cs&&ro&&ro.box&&this.collisionIndex.insertCollisionBox(ro.box,B.get("text-ignore-placement"),D.bucketInstanceId,ci&&ci.box&&dc?dc:ud,Ge.ID),xa&&Ga&&this.collisionIndex.insertCollisionBox(Ga.box,B.get("icon-ignore-placement"),D.bucketInstanceId,Go,Ge.ID),Ri&&(cs&&this.collisionIndex.insertCollisionCircles(Ri.circles,B.get("text-ignore-placement"),D.bucketInstanceId,ud,Ge.ID),j)){const Ki=D.bucketInstanceId;let lo=this.collisionCircleArrays[Ki];lo===void 0&&(lo=this.collisionCircleArrays[Ki]=new Tk);for(let Ka=0;Ka=0;--oa){const Kn=dn[oa];Fs(D.symbolInstances.get(Kn),Kn,D.collisionArrays[Kn])}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 dn=D.getSortedIndexesByZOffset();for(let oa=0;oa=0&&(d.text.placedSymbolArray.get(O).crossTileID=de>=0&&O!==de?0:Y),D>=0&&(d.text.placedSymbolArray.get(D).crossTileID=de>=0&&D!==de?0:Y),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=de>=0&&B!==de?0:Y),H>=0&&(d.text.placedSymbolArray.get(H).crossTileID=de>=0&&H!==de?0:Y)}markUsedOrientation(d,m,j){const T=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}=j,ee=d.text.placedSymbolArray;D>=0&&(ee.get(D).placedOrientation=T),B>=0&&(ee.get(B).placedOrientation=T),H>=0&&(ee.get(H).placedOrientation=T),Y>=0&&(ee.get(Y).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let j=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const T=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],ee=O[H];ee?(this.opacities[H]=new kf(ee,T,Y.text,Y.icon,null,Y.clipped),j=j||Y.text!==ee.text.placed||Y.icon!==ee.icon.placed):(this.opacities[H]=new kf(null,T,Y.text,Y.icon,Y.skipFade,Y.clipped),j=j||Y.text||Y.icon)}for(const H in O){const Y=O[H];if(!this.opacities[H]){const ee=new kf(Y,T,!1,!1);ee.isHidden()||(this.opacities[H]=ee,j=j||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]);j?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:d)}updateLayerOpacities(d,m,j,T){T&&(this.lastReplacementSourceUpdateTime=T.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,j,T,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,j,T,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,ee=d.layers[0].paint,de=!!d.layers[0].dynamicFilter(),ce=new kf(null,0,!1,!1,!0),ue=Y.get("text-allow-overlap"),we=Y.get("icon-allow-overlap"),ve=Y.get("text-variable-anchor"),De=Y.get("text-rotation-alignment")==="map",Ie=Y.get("text-pitch-alignment")==="map",He=ee.get("symbol-z-offset"),tt=Y.get("symbol-elevation-reference")==="sea",Ge=!He.isConstant(),bt=new kf(null,0,ue&&(we||!d.hasIconData()||Y.get("icon-optional")),we&&(ue||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&T&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(T);const ft=(ut,lt,St)=>{for(let Dt=0;Dt0||Dt>0,Ar=Wt>0,Hr=this.placedOrientations[Ot],Nr=Hr===i.bL.vertical,br=Hr===i.bL.horizontal||Hr===i.bL.horizontalOnly;!dr&&!Ar||Vt.isHidden()||yt++;let on=!1;if((dr||Ar)&&D)for(const en of d.activeReplacements){if(i.bZ(en,O,i.b_.Symbol,H)||en.min.x>Gt||Gt>en.max.x||en.min.y>sr||sr>en.max.y)continue;const $r=i.b$(Gt,sr,B.canonical,en.footprintTileId.canonical);if(on=i.c0($r,en.footprint),on)break}if(dr){const en=on?rx:od(Vt.text);ft(d.text,St,Nr?rx:en),ft(d.text,Dt,br?rx:en);const $r=Vt.text.isHidden(),{leftJustifiedTextSymbolIndex:Gr,centerJustifiedTextSymbolIndex:kn,rightJustifiedTextSymbolIndex:Qn,verticalPlacedTextSymbolIndex:Fs}=lt,pa=d.text.placedSymbolArray,dn=$r||Nr?1:0;Gr>=0&&(pa.get(Gr).hidden=dn),kn>=0&&(pa.get(kn).hidden=dn),Qn>=0&&(pa.get(Qn).hidden=dn),Fs>=0&&(pa.get(Fs).hidden=$r||br?1:0);const oa=this.variableOffsets[Ot];oa&&this.markUsedJustification(d,oa.anchor,lt,Hr);const Kn=this.placedOrientations[Ot];Kn&&(this.markUsedJustification(d,"left",lt,Kn),this.markUsedOrientation(d,Kn,lt))}if(Ar){const en=on?rx:od(Vt.icon),{placedIconSymbolIndex:$r,verticalPlacedIconSymbolIndex:Gr}=lt,kn=d.icon.placedSymbolArray,Qn=Vt.icon.isHidden()?1:0;$r>=0&&(ft(d.icon,Wt,Nr?rx:en),kn.get($r).hidden=Qn),Gr>=0&&(ft(d.icon,lt.numVerticalIconVertices,br?rx:en),kn.get(Gr).hidden=Qn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const en=d.collisionArrays[ut];if(en){let $r=new i.P(0,0),Gr=!0;if(en.textBox||en.verticalTextBox){if(ve){const Qn=this.variableOffsets[Ot];Qn?($r=Nc(Qn.anchor,Qn.width,Qn.height,Qn.textOffset,Qn.textScale),De&&$r._rotate(Ie?this.transform.angle:-this.transform.angle)):Gr=!1}de&&(Gr=!Vt.clipped),en.textBox&&Fm(d.textCollisionBox.collisionVertexArray,Vt.text.placed,!Gr||Nr,Tt,tt,$r.x,$r.y),en.verticalTextBox&&Fm(d.textCollisionBox.collisionVertexArray,Vt.text.placed,!Gr||br,Tt,tt,$r.x,$r.y)}const kn=Gr&&!!(!br&&en.verticalIconBox);en.iconBox&&Fm(d.iconCollisionBox.collisionVertexArray,Vt.icon.placed,kn,Tt,tt,lt.hasIconTextFit?$r.x:0,lt.hasIconTextFit?$r.y:0),en.verticalIconBox&&Fm(d.iconCollisionBox.collisionVertexArray,Vt.icon.placed,!kn,Tt,tt,lt.hasIconTextFit?$r.x:0,lt.hasIconTextFit?$r.y:0)}}}if(d.fullyClipped=yt===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 ut=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ut.invProjMatrix,d.placementViewportMatrix=ut.viewportMatrix,d.collisionCircleArray=ut.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 Fm(b,d,m,j,T,O,D){b.emplaceBack(d?1:0,m?1:0,O||0,D||0,j,T?1:0),b.emplaceBack(d?1:0,m?1:0,O||0,D||0,j,T?1:0),b.emplaceBack(d?1:0,m?1:0,O||0,D||0,j,T?1:0),b.emplaceBack(d?1:0,m?1:0,O||0,D||0,j,T?1:0)}const U3=Math.pow(2,25),Av=Math.pow(2,24),Ak=Math.pow(2,17),q3=Math.pow(2,16),Ek=Math.pow(2,9),id=Math.pow(2,8),jp=Math.pow(2,1);function od(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*U3+d*Av+m*Ak+d*q3+m*Ek+d*id+m*jp+d}const rx=0;class Hy{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,j,T,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 ee=H,de=ee.layout.get("symbol-z-elevate"),ce=ee.layout.get("symbol-sort-key").constantOr(1)!==void 0,ue=ee.layout.get("symbol-z-order"),we=ue==="viewport-y"||ue==="auto"&&!(ue!=="viewport-y"&&ce),ve=ee.layout.get("text-allow-overlap")||ee.layout.get("icon-allow-overlap")||ee.layout.get("text-ignore-placement")||ee.layout.get("icon-ignore-placement"),De=we&&ve,Ie=this._inProgressLayer=this._inProgressLayer||new Hy(ee),He=i.B(H.source,H.scope);if(Ie.continuePlacement(de||De?T[He]:j[He],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 sh=512/i.al/2;class kp{constructor(d,m,j){this.tileID=d,this.bucketInstanceId=j,this.index=new i.c4(m.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const T=d.canonical.x*i.al,O=d.canonical.y*i.al;for(let D=0;DDe-Ie);for(const De of ve){const Ie=this.crossTileIDs[De];if(this.keys[De]===ee&&!j.has(Ie)){j.add(Ie),Y.crossTileID=Ie;break}}}}}class il{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class V3{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const m=Math.round((d-this.lng)/360);if(m!==0)for(const j in this.indexes){const T=this.indexes[j],O={};for(const D in T){const B=T[D];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+m),O[B.tileID.key]=B}this.indexes[j]=O}this.lng=d}addBucket(d,m,j){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,T)}else{const B=D[d.scaledTo(Number(O)).key];B&&B.findMatches(m.symbolInstances,d,T)}}for(let O=0;O{m[j]=!0});for(const j in this.layerIndexes)m[j]||delete this.layerIndexes[j]}}const Nf=771;class ls{constructor(d,m,j,T){this.blendFunction=d,this.blendColor=m.toNonPremultipliedRenderColor(null),this.mask=j,this.blendEquation=T}}ls.Replace=[1,0,1,0],ls.disabled=new ls(ls.Replace,i.ao.transparent,[!1,!1,!1,!1]),ls.unblended=new ls(ls.Replace,i.ao.transparent,[!0,!0,!0,!0]),ls.alphaBlended=new ls([1,Nf,1,Nf],i.ao.transparent,[!0,!0,!0,!0]),ls.alphaBlendedNonPremultiplied=new ls([770,Nf,770,Nf],i.ao.transparent,[!0,!0,!0,!0]),ls.multiply=new ls([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),ls.additive=new ls([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class un{constructor(d,m,j){this.func=d,this.mask=m,this.range=j}}un.ReadOnly=!1,un.ReadWrite=!0,un.disabled=new un(519,un.ReadOnly,[0,1]);const Ik=7680;class Un{constructor(d,m,j,T,O,D){this.test=d,this.ref=m,this.mask=j,this.fail=T,this.depthFail=O,this.pass=D}}Un.disabled=new Un({func:519,mask:0},0,0,Ik,Ik,Ik);const Wy=1029,Pk=2305;class zn{constructor(d,m,j){this.enable=d,this.mode=m,this.frontFace=j}}function Sf(b,d){const m=i.ca(b,3);i.cc(b,d),i.cg(b,3,m)}function H3(b,d){const m=i.c7([]);return i.c8(m,m,-d),i.c9(m,m,-b),m}function Lk(b,d){const m=[b[0],b[1],0],j=[d[0],d[1],0];if(i.ag(m)>=1e-15){const D=i.aw([],m);i.c5(j,D,i.bJ(j,D)),d[0]=j[0],d[1]=j[1]}const T=i.bI([],d,b);if(i.c6(T)<1e-15)return null;const O=Math.atan2(-T[1],T[0]);return H3(Math.atan2(Math.sqrt(b[0]*b[0]+b[1]*b[1]),-b[2]),O)}zn.disabled=new zn(!1,Wy,Pk),zn.backCCW=new zn(!0,Wy,Pk),zn.backCW=new zn(!0,Wy,2304),zn.frontCW=new zn(!0,1028,2304),zn.frontCCW=new zn(!0,1028,Pk);class ld{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,j){if(this.orientation=null,!this.position)return;const T=this.position,O=j||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(d)):0),D=i.ae.fromLngLat(d,O),B=[D.x-T.x,D.y-T.y,D.z-T.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=Lk(B,m)}setPitchBearing(d,m){this.orientation=H3(i.an(d),i.an(-m))}}class Ok{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&&Sf(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=H3(d,m),Sf(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 j=new Float64Array(16);return i.bl(j,this.getWorldToCamera(d,m)),j}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,m,j){const T=this.position;i.c5(T,T,-d);const O=new Float64Array(16);return i.bq(O,[j,j,j]),i.br(O,O,T),O[10]*=m,O}getWorldToCamera(d,m){const j=new Float64Array(16),T=new Float64Array(4),O=this.position;return i.cb(T,this._orientation),i.c5(O,O,-d),i.cc(j,T),i.br(j,j,O),j[1]*=-1,j[5]*=-1,j[9]*=-1,j[13]*=-1,j[8]*=m,j[9]*=m,j[10]*=m,j[11]*=m,j}getCameraToClipPerspective(d,m,j,T){const O=new Float64Array(16);return i.cd(O,d,m,j,T),O}getCameraToClipOrthographic(d,m,j,T,O,D){const B=new Float64Array(16);return i.ce(B,d,m,j,T,O,D),B}getDistanceToElevation(d,m=!1){const j=d===0?0:i.cf(d,m?i.a$(this.position[1]):this.position[1]),T=this.forward();return(j-this.position[2])/T[2]}clone(){return new Ok([...this.position],[...this.orientation])}}const Tl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Dk{constructor(d=0,m=0,j=0,T=0){if(isNaN(d)||d<0||isNaN(m)||m<0||isNaN(j)||j<0||isNaN(T)||T<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=j,this.right=T}interpolate(d,m,j){return m.top!=null&&d.top!=null&&(this.top=i.ak(d.top,m.top,j)),m.bottom!=null&&d.bottom!=null&&(this.bottom=i.ak(d.bottom,m.bottom,j)),m.left!=null&&d.left!=null&&(this.left=i.ak(d.left,m.left,j)),m.right!=null&&d.right!=null&&(this.right=i.ak(d.right,m.right,j)),this}getCenter(d,m){const j=i.aA((this.left+d-this.right)/2,0,d),T=i.aA((this.top+m-this.bottom)/2,0,m);return new i.P(j,T)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new Dk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const zh=15;class W3{constructor(d,m,j,T,O,D,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=m||22,this._minPitch=j??0,this._maxPitch=T??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 Dk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Ok,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 W3(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 j=this._elevation;m||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&j.exaggeration()&&this._centerAltitudeValidForExaggeration!==j.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*j.exaggeration(),this._centerAltitudeValidForExaggeration=j.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=j.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]],j=this.horizonLineFromTop();let T=0,O=0;for(let D=0;D{const De=i.cY(ce,de,ue,we,ve);H.has(De)||(O.push(new i.aQ(de,ce,ue,we,ve)),H.add(De))};for(let de=0;dece.canonical.z)continue;const ue=ce.canonical,we=ce.overscaledZ,ve=ce.wrap,De=1<0,tt=ue.y+10,bt=ce.wrap-(He?0:1),ft=ce.wrap+(Ie?0:1),yt=He?ue.x-1:De-1,ut=Ie?ue.x+1:0;if(D)j[0]<0?(Y(we,ft,ue.z,ut,ue.y),j[1]<0&&tt&&(Y(we,ve,ue.z,ue.x,ue.y+1),Y(we,ft,ue.z,ut,ue.y+1)),j[1]>0&&Ge&&(Y(we,ve,ue.z,ue.x,ue.y-1),Y(we,ft,ue.z,ut,ue.y-1))):j[0]>0?(Y(we,bt,ue.z,yt,ue.y),j[1]<0&&tt&&(Y(we,ve,ue.z,ue.x,ue.y+1),Y(we,bt,ue.z,yt,ue.y+1)),j[1]>0&&Ge&&(Y(we,ve,ue.z,ue.x,ue.y-1),Y(we,bt,ue.z,yt,ue.y-1))):j[1]<0&&tt?Y(we,ve,ue.z,ue.x,ue.y+1):Ge&&Y(we,ve,ue.z,ue.x,ue.y-1);else{const lt=ce.visibleQuadrants;1<&&(Y(we,bt,ue.z,yt,ue.y),Ge&&(Y(we,ve,ue.z,ue.x,ue.y-1),Y(we,bt,ue.z,yt,ue.y-1))),2<&&(Y(we,ft,ue.z,ut,ue.y),Ge&&(Y(we,ve,ue.z,ue.x,ue.y-1),Y(we,ft,ue.z,ut,ue.y-1))),4<&&(Y(we,bt,ue.z,yt,ue.y),tt&&(Y(we,ve,ue.z,ue.x,ue.y+1),Y(we,bt,ue.z,yt,ue.y+1))),8<&&(Y(we,ft,ue.z,ut,ue.y),tt&&(Y(we,ve,ue.z,ue.x,ue.y+1),Y(we,ft,ue.z,ut,ue.y+1)))}}const ee=[];for(const de of O)O.some(ce=>de.isChildOf(ce))||ee.push(de);if(O=ee.filter(de=>!d.some(ce=>!!(de.overscaledZ{const Ie=De.canonical.x+.5-ue[0],He=De.canonical.y+.5-ue[1];return Ie*Ie+He*He{const yt=i.cY(tt,He,Ge,bt,ft);O.has(yt)||(T.push(new i.aQ(He,tt,Ge,bt,ft)),O.add(yt))},B=d.reduce((He,tt)=>Math.max(He,tt.overscaledZ),j),H=1<{const Ge=Math.floor(He[0]),bt=Math.floor(He[1]),ft=(He[0]-Ge)*i.al,yt=(He[1]-bt)*i.al,ut=Math.floor(tt[0]),lt=Math.floor(tt[1]),St=(tt[0]-ut)*i.al,Dt=(tt[1]-lt)*i.al;for(let Ot=-1;Ot<=1;Ot++){const Wt=Ge+Ot;if(!(Wt<0||Wt>=H)){ee.x=ft-Ot*i.al,de.x=St-(Wt-ut)*i.al;for(let Gt=-1;Gt<=1;Gt++){const sr=bt+Gt;ee.y=yt-Gt*i.al,de.y=Dt-(sr-lt)*i.al,i.cZ(ee,de,Y)&&D(B,0,j,Wt,sr)}}}},ue=m.points,we=ue[i.cv],ve=ue[i.cw],De=this._projectToGround(we,ue[i.cx]),Ie=this._projectToGround(ve,ue[i.cy]);return ce(we,De),ce(ve,Ie),T}_projectToGround(d,m){return i.cz(i.cA(),d,m,d[2]/(d[2]-m[2]))}coveringTiles(d){let m=this.coveringZoomLevel(d);const j=m,T=this.elevation&&this.elevation.exaggeration(),O=T&&!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),Ar=Tt.toLngLat(),Hr=Vt.toLngLat(),Nr=dr.toLngLat(),br=this.locationCoordinate(Ar),on=this.locationCoordinate(Hr),en=this.locationCoordinate(Nr),$r=Math.hypot(on.x-br.x,on.y-br.y),Gr=Math.hypot(en.x-br.x,en.y-br.y);return Math.sqrt($r*Gr)*yt/25e-6},lt=Tt=>{const Jt=bt,Vt=ft;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 Ot=m,Wt=d.reparseOverscaled?j:m,Gt=(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(Ie)*ve),this.projection.isReprojectedInTileSpace&&j<=5){const Gr=Math.pow(2,Tt.zoom),kn=ut(new i.ae((Tt.x+.5)/Gr,(Tt.y+.5)/Gr));Ar=kn>.85?1:kn}if(!D&&!de){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 Ar=()=>this.projection.name==="globe"&&(Tt.y===0||Tt.y===(1<>1),on={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&&!de&&(on.tileID=new i.aQ(Tt.zoom+1===Ot?Wt:Tt.zoom+1,Tt.wrap,Tt.zoom+1,Nr,br),sr(on)),St.push(on)}else{const Hr=Tt.zoom===Ot?Wt:Tt.zoom;if(d.minzoom&&d.minzoom>Hr)continue;let Nr=0;if(!dr){let $r=He?Tt.aabb.intersectsPrecise(ue):Tt.aabb.intersectsPreciseFlat(ue);if($r===0&&Ar()){const Gr=new i.cD(Tt.zoom,Jt,Vt);$r=i.cE(this,Y,Gr,!0).intersectsPrecise(ue)}if($r===0)continue;if(d.calculateQuadrantVisibility)if(ue.containsPoint(Tt.aabb.center))Nr=15;else for(let Gr=0;Gr<4;Gr++)Tt.aabb.quadrant(Gr).intersects(ue)!==0&&(Nr|=1<{const dr=[0,0,0,1],Ar=[i.al,i.al,0,1],Hr=this.calculateFogTileMatrix(Vt.tileID.toUnwrapped());i.aC(dr,dr,Hr),i.aC(Ar,Ar,Hr);const Nr=i.cG([],dr,Ar),br=i.cH([],dr,Ar),on=i.c$(Nr,br);if(on===0)return!0;let en=!1;const $r=this._elevation;if($r&&on>Tt&&Jt!==0){const Gr=this.calculateProjMatrix(Vt.tileID.toUnwrapped());let kn;d.isTerrainDEM||(kn=$r.getMinMaxForTile(Vt.tileID)),kn||(kn={min:ft,max:bt});const Qn=i.cI(this.rotation),Fs=[Qn[0]*i.al,Qn[1]*i.al,kn.max];i.af(Fs,Fs,Gr),en=(1-Fs[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),j=this.projection.project(d.lng,m);return new i.P(j.x*this.worldSize,j.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 j,T;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;j=(m.x-O.x)/B,T=(m.y-O.y)/B}else{const B=this.pointCoordinate(m),H=this.pointCoordinate(O);j=B.x-H.x,T=B.y-H.y}const D=this.locationCoordinate(d);this.setLocation(new i.ae(D.x-j,D.y-T))}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 j=m?i.cf(m,d.lat):void 0,T=this.projection.project(d.lng,d.lat);return new i.ae(T.x,T.y,j)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,m){const j=m??this._centerAltitude,T=[d.x,d.y,0,1],O=[d.x,d.y,1,1];i.aC(T,T,this.pixelMatrixInverse),i.aC(O,O,this.pixelMatrixInverse);const D=O[3];i.cK(T,T,1/T[3]),i.cK(O,O,1/D);const B=T[2],H=O[2];return{p0:T,p1:O,t:B===H?0:(j-B)/(H-B)}}screenPointToMercatorRay(d){const m=[d.x,d.y,0,1],j=[d.x,d.y,1,1];return i.aC(m,m,this.pixelMatrixInverse),i.aC(j,j,this.pixelMatrixInverse),i.cK(m,m,1/m[3]),i.cK(j,j,1/j[3]),m[2]=i.cf(m[2],this._center.lat)*this.worldSize,j[2]=i.cf(j[2],this._center.lat)*this.worldSize,i.cK(m,m,1/this.worldSize),i.cK(j,j,1/this.worldSize),new i.ax([m[0],m[1],m[2]],i.aw([],i.av([],j,m)))}rayIntersectionCoordinate(d){const{p0:m,p1:j,t:T}=d,O=i.cf(m[2],this._center.lat),D=i.cf(j[2],this._center.lat);return new i.ae(i.ak(m[0],j[0],T)/this.worldSize,i.ak(m[1],j[1],T)/this.worldSize,i.ak(O,D,T))}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 j=this.projection.pointCoordinate3D(this,d.x,d.y);if(j)return new i.ae(j[0],j[1],j[2]);let T=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-T>D;H++){B.y=i.ak(T,O,.66);const Y=this.projection.pointCoordinate3D(this,B.x,B.y);Y?(O=B.y,j=Y):T=B.y}return j?new i.ae(j[0],j[1],j[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 j=m&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,T=[d.x*this.worldSize,d.y*this.worldSize,j+d.toAltitude(),1];return i.aC(T,T,this.pixelMatrix),T[3]>0?new i.P(T[0]/T[3],T[1]/T[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:m}=this._edgeInsets,j=this.height-this._edgeInsets.bottom,T=this.width-this._edgeInsets.right,O=this.pointLocation3D(new i.P(m,d)),D=this.pointLocation3D(new i.P(T,d)),B=this.pointLocation3D(new i.P(T,j)),H=this.pointLocation3D(new i.P(m,j));let Y=Math.min(O.lng,D.lng,B.lng,H.lng),ee=Math.max(O.lng,D.lng,B.lng,H.lng),de=Math.min(O.lat,D.lat,B.lat,H.lat),ce=Math.max(O.lat,D.lat,B.lat,H.lat);const ue=Math.pow(2,-this.zoom)/16*270,we=this.projection.name==="globe"?1:4,ve=(De,Ie,He,tt,Ge)=>{const bt=(De+He)/2,ft=(Ie+tt)/2,yt=new i.P(bt,ft),{lng:ut,lat:lt}=this.pointLocation3D(yt),St=Math.max(0,Y-ut,de-lt,ut-ee,lt-ce);Y=Math.min(Y,ut),ee=Math.max(ee,ut),de=Math.min(de,lt),ce=Math.max(ce,lt),(Geue)&&(ve(De,Ie,bt,ft,Ge+1),ve(bt,ft,He,tt,Ge+1))};if(ve(m,d,T,d,1),ve(T,d,T,j,1),ve(T,j,m,j,1),ve(m,j,m,d,1),this.projection.name==="globe"){const[De,Ie]=i.cM(this);De?(ce=90,ee=180,Y=-180):Ie&&(de=-90,ee=180,Y=-180)}return new i.aI(new i.aT(Y,de),new i.aT(ee,ce))}_getBoundsRectangular(d,m){const{top:j,left:T}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,D=this.width-this._edgeInsets.right,B=new i.P(T,j),H=new i.P(D,j),Y=new i.P(D,O),ee=new i.P(T,O);let de=this.pointCoordinate(B,d),ce=this.pointCoordinate(H,d);const ue=this.pointCoordinate(Y,m),we=this.pointCoordinate(ee,m),ve=(De,Ie)=>(Ie.y-De.y)/(Ie.x-De.x);return de.y>1&&ce.y>=0?de=new i.ae((1-we.y)/ve(we,de)+we.x,1):de.y<0&&ce.y<=1&&(de=new i.ae(-we.y/ve(we,de)+we.x,0)),ce.y>1&&de.y>=0?ce=new i.ae((1-ue.y)/ve(ue,ce)+ue.x,1):ce.y<0&&de.y<=1&&(ce=new i.ae(-ue.y/ve(ue,ce)+ue.x,0)),new i.aI().extend(this.coordinateLocation(de)).extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(we)).extend(this.coordinateLocation(ue))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const m=d.visibleDemTiles.reduce((j,T)=>{if(T.dem){const O=T.dem.tree;j.min=Math.min(j.min,O.minimums[0]),j.max=Math.max(j.max,O.maximums[0])}return j},{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,j=this.height/2-m*(1-this._horizonShift);return d?Math.max(0,j):j}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.maxLngde&&(B=de-Y),de-eeue&&(D=ue-H),ue-ce{for(let $t=0;$t<16;$t++)Wt[$t]=i.ak(Gt[$t],sr[$t],_r)})(B,B,H,i.d0(this.pitch>=zh?1:this.pitch/zh))}else B=H;const Y=i.cP([],H,D);let ee=i.cP([],B,D);if(this.projection.isReprojectedInTileSpace){const lt=this.locationCoordinate(this.center),St=i.bA([]);i.br(St,St,[lt.x*this.worldSize,lt.y*this.worldSize,0]),i.aB(St,St,i.cQ(this)),i.br(St,St,[-lt.x*this.worldSize,-lt.y*this.worldSize,0]),i.aB(ee,ee,St),i.aB(Y,Y,St),this.inverseAdjustmentMatrix=i.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cS([],ee,[this.worldSize,this.worldSize,this.worldSize/O,1]),this.projMatrix=ee,this.invProjMatrix=i.bl(new Float64Array(16),this.projMatrix),m){const lt=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);lt[8]=2*-d.x/this.width,lt[9]=2*d.y/this.height,this.expandedFarZProjMatrix=i.cP([],lt,D)}else this.expandedFarZProjMatrix=this.projMatrix;const de=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(de,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!m);const ce=new Float32Array(16);i.bA(ce),i.cS(ce,ce,[1,-1,1]),i.cU(ce,ce,this._pitch),i.bB(ce,ce,this.angle);const ue=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(ue);const we=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;ue[8]=2*-d.x/this.width,ue[9]=2*(d.y+we)/this.height,this.skyboxMatrix=i.aB(ce,ue,ce);const ve=this.point,De=ve.x,Ie=ve.y,He=this.width%2/2,tt=this.height%2/2,Ge=Math.cos(this.angle),bt=Math.sin(this.angle),ft=De-Math.round(De)+Ge*He+bt*tt,yt=Ie-Math.round(Ie)+Ge*tt+bt*He,ut=new Float64Array(ee);if(i.br(ut,ut,[ft>.5?ft-1:ft,yt>.5?yt-1:yt,0]),this.alignedProjMatrix=ut,ee=i.bC(),i.cS(ee,ee,[this.width/2,-this.height/2,1]),i.br(ee,ee,[1,-1,0]),this.labelPlaneMatrix=ee,ee=i.bC(),i.cS(ee,ee,[1,-1,1]),i.br(ee,ee,[-1,-1,0]),i.cS(ee,ee,[2/this.width,2/this.height,1]),this.glCoordMatrix=ee,this.pixelMatrix=i.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},ee=i.bl(new Float64Array(16),this.pixelMatrix),!ee)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=ee,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=i.cV(this);const lt=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.af(lt,lt,D),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=ee;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,j=this._camera.position,T=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,m];i.c5(O,O,T),i.c5(j,j,-1),i.cW(j,j,O);const D=i.bC();i.br(D,D,j),i.cS(D,D,O),this.mercatorFogMatrix=D,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,m,T)}_computeCameraPosition(d){const m=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,j=this._camera.forward(),T=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-d/this.worldSize*this._centerAltitude;return[T.x/this.worldSize-j[0]*O,T.y/this.worldSize-j[1]*O,d/this.worldSize*this._centerAltitude-j[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),j=this._camera.position[2],T=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),T>0&&(O=Math.min((m-j)/T,1)),this._camera.position=i.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,m=this._camera.forward(),{pitch:j,bearing:T}=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(j),D),H=this._zoomFromMercatorZ(B);i.bH(d,d,m,B),this._pitch=i.aA(j,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(T,-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,j=i.cL,T=0,O=1/0;for(;j-m>1e-6&&j>m;){const D=m+.5*(j-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)),ee=Math.abs(D-Y);eeY||ce.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 j=i.ag(i.av([],this._camera.position,d)),T=this._zoomFromMercatorZ(j)+m;return j-this._mercatorZfromZoom(T)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([m,j,T],O){const D=[m,j,T,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,j=this.worldSize){const T=i.cO(d,m,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,j,T);let D=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(D=i.ak(1,D,i.d0(this.pitch>=zh?1:this.pitch/zh))),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 zm=(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,j=Math.max(Math.abs(m._zoom-(b.minCutoffZoom-1)),1),T=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=T))*m.cameraToCenterDistance+H*(m._farZ+D))*j;var H;return{shouldRenderCutoff:T<1,uniformValues:{u_cutoff_params:[m._nearZ,m._farZ,(B-m._nearZ)/O,(B-D-m._nearZ)/O]}}},ah=2048;class Ev{constructor(d,m){this.aabb=d,this.lastCascade=m}}class lie{add(d,m){const j=this.receivers[d.key];j!==void 0?(j.aabb.min[0]=Math.min(j.aabb.min[0],m.min[0]),j.aabb.min[1]=Math.min(j.aabb.min[1],m.min[1]),j.aabb.min[2]=Math.min(j.aabb.min[2],m.min[2]),j.aabb.max[0]=Math.max(j.aabb.max[0],m.max[0]),j.aabb.max[1]=Math.max(j.aabb.max[1],m.max[1]),j.aabb.max[2]=Math.max(j.aabb.max[2],m.max[2])):this.receivers[d.key]=new Ev(m,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,m,j){const T=i.d9.fromPoints(d.points);let O=0;for(const D in this.receivers){const B=this.receivers[D];if(!B||!T.intersectsAabb(B.aabb))continue;B.aabb.min=T.closestPoint(B.aabb.min),B.aabb.max=T.closestPoint(B.aabb.max);const H=B.aabb.getCorners();for(let Y=0;Y1||ce[1]<-1||ce[1]>1){ee=!1;break}}if(B.lastCascade=Y,O=Math.max(O,Y),ee)break}}return O+1}}class Gy{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new lie,this._depthMode=new un(d.context.gl.LEQUAL,un.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 j=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!m||!m.properties)return;const T=m.properties.get("shadow-intensity");if(!m.shadowsEnabled()||T<=0||(this._shadowLayerCount=j.style.order.reduce((we,ve)=>{const De=j.style._mergedLayers[ve];return we+(De.hasShadowPass()&&!De.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=j.context,D=ah,B=ah;if(this._cascades.length===0||ah!==this._cascades[0].texture.size[0]){this._cascades=[];for(let we=0;we<2;++we){const ve=j._shadowMapDebug,De=O.gl,Ie=O.createFramebuffer(D,B,ve?1:0,"texture"),He=new i.T(O,{width:D,height:B,data:null},De.DEPTH_COMPONENT16);if(Ie.depthAttachment.set(He.texture),ve){const tt=new i.T(O,{width:D,height:B,data:null},De.RGBA8);Ie.colorAttachment0.set(tt.texture)}this._cascades.push({framebuffer:Ie,texture:He,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=Pv(m);let H=0;if(d.elevation){const we=d.elevation,ve=[1e4,-1e4];we.visibleDemTiles.filter(De=>De.dem).forEach(De=>{const Ie=De.dem.tree;ve[0]=Math.min(ve[0],Ie.minimums[0]),ve[1]=Math.max(ve[1],Ie.maximums[0])}),ve[0]!==1e4&&(H=(ve[1]-ve[0])*we.exaggeration())}const Y=1.5*d.cameraToCenterDistance,ee=3*Y,de=new Float64Array(16);for(let we=0;we=0)return{};const O=function(H,Y,ee){const de=ee/(1<0&&(i.d8(O[1],O[1],[T[0]*D,0,0]),i.d8(O[2],O[2],[T[0]*D,0,0])),T[1]<0?(i.d8(O[0],O[0],[0,T[1]*D,0]),i.d8(O[1],O[1],[0,T[1]*D,0])):T[1]>0&&(i.d8(O[2],O[2],[0,T[1]*D,0]),i.d8(O[3],O[3],[0,T[1]*D,0]));const B={};return B.vertices=O,B.planes=[Iv(O[1],O[0],O[4]),Iv(O[2],O[1],O[5]),Iv(O[3],O[2],O[6]),Iv(O[0],O[3],O[7])],B}addShadowReceiver(d,m,j){this._receivers.add(d,i.d9.fromTileIdAndHeight(d,m,j))}getMaxCascadeForTile(d){const m=this._receivers.get(d);return m&&m.lastCascade?m.lastCascade:0}}function Iv(b,d,m){const j=i.av([],m,d),T=i.av([],b,d),O=i.bI([],j,T),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 Pv(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 j=i.d6([m[0],m[1],m[2]]);return i.d5(j.x,j.y,j.z)}function Np(b,d,m){const j=d.properties.get("color-use-theme")==="none",T=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"),ee=m.properties.get("intensity"),de=Math.max(i.bJ([0,0,1],B),0),ce=[0,0,0];i.c5(ce,Y.toPremultipliedRenderColor(H?null:b.getLut(d.scope)).toArray01Linear().slice(0,3),ee);const ue=[0,0,0];return i.c5(ue,T.toPremultipliedRenderColor(j?null:b.getLut(m.scope)).toArray01Linear().slice(0,3),de*O),i.db([ce[0]>0?ce[0]/(ce[0]+ue[0]):0,ce[1]>0?ce[1]/(ce[1]+ue[1]):0,ce[2]>0?ce[2]/(ce[2]+ue[2]):0])}function Bm(b,d,m,j,T,O){const D=b.zoom,B=b.scale,H=b.worldSize,Y=1/H,ee=b.aspect,de=Math.sqrt(1+ee*ee)*Math.tan(.5*b.fovX),ce=de*de,ue=j-m,we=j+m;let ve,De;ce>ue/we?(ve=j,De=j*de):(ve=.5*we*(1+ce),De=.5*Math.sqrt(ue*ue+2*(j*j+m*m)*ce+we*we*ce*ce));const Ie=b.projection.pixelsPerMeter(b.center.lat,H),He=b._camera.getCameraToWorldMercator(),tt=[0,0,-ve*Y];i.af(tt,tt,He);let Ge=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"?Ie:1),Ar=b._camera.getCameraToClipPerspective(b._fov,b.width/b.height,m,j);Ar[8]=2*-b.centerOffset.x/b.width,Ar[9]=2*b.centerOffset.y/b.height;const Hr=new Float64Array(16);i.cP(Hr,Ar,dr);const Nr=new Float64Array(16);i.bl(Nr,Hr);const br=i.cB.fromInvProjectionMatrix(Nr,H,D,!0);for(const on of br.points){const en=((ft=on)[0]/=B,ft[1]/=B,ft[2]=i.cf(ft[2],b._center.lat),ft);Ge=Math.max(Ge,i.c6(i.da([],tt,en)))}}var ft;Ge*=T/(T-1);const yt=Math.acos(d[2]),ut=Math.atan2(-d[0],-d[1]),lt=new Ok;lt.position=tt,lt.setPitchBearing(yt,ut);const St=lt.getWorldToCamera(H,Ie),Dt=Ge*H,Ot=Math.min(b._mercatorZfromZoom(17)*H*-2,-2*Dt),Wt=lt.getCameraToClipOrthographic(-Dt,Dt,-Dt,Dt,Ot,(Dt+O*Ie)/d[2]),Gt=new Float64Array(16);i.aB(Gt,Wt,St);const sr=i.d5(Math.floor(1e6*tt[0])/1e6*H,Math.floor(1e6*tt[1])/1e6*H,0),_r=.5*T,$t=[0,0,0];i.af($t,sr,Gt),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(Gt,Vt,Gt),[Gt,Dt]}class cie 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(j=>{if(!j)return;const T=i.dd(j),O=new i.de(d,m,void 0,void 0,T);return O.computeBoundsAndApplyParent(),O}).catch(j=>{if(j&&j.status===404)return null;this.fire(new i.y(new Error(`Could not load model ${d} from ${m}: ${j.message}`)))})}load(d,m,j={forceReload:!1}){this.models[m]||(this.models[m]={});const T=Object.keys(d),O=[],D=[];for(const B of T){const H=d[B];this.hasURLBeenRequested(H)&&!j.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,j={exactIdMatch:!1}){return!!(j.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,j){this.models[j]||(this.models[j]={}),this.modelUris[j]||(this.modelUris[j]={});const T=this.requestManager.normalizeModelURL(m);if((this.hasModel(d,j,{exactIdMatch:!0})||this.hasModelBeenAdded(d,j))&&this.modelUris[j][d]===T)this.models[j][d].numReferences++;else if(this.hasURLBeenRequested(T)){const{scope:O,modelId:D}=this.modelByURL[T];this.models[O][D].numReferences++}else this.modelUris[j][d]=T,this.load({[d]:this.modelUris[j][d]},j)}addModelURLs(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const j=this.modelUris[m];for(const T in d)j[T]=this.requestManager.normalizeModelURL(d[T])}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 j={};for(const T of d)this.hasModel(T,m,{exactIdMatch:!0})||this.hasURLBeenRequested(T)?this.models[m][T].numReferences++:this.modelUris[m][T]&&!this.hasURLBeenRequested(T)?j[T]=this.modelUris[m][T]:!this.hasURLBeenRequested(T)&&i.df(T,!1)&&(this.modelUris[m][T]=this.requestManager.normalizeModelURL(T),j[T]=this.modelUris[m][T]);this.load(j,m)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,m,j=!1,T=!1){if(this.models[m]&&this.models[m][d]&&(this.models[m][d].numReferences--,this.models[m][d].numReferences===0||T)){const O=this.modelUris[m][d];j||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 j=this.models[d][m].model;delete this.models[d][m],j&&j.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 j in this.models[m])this.models[m][j].model&&this.models[m][j].model.upload(d.context)}}const G3=i.a6.colorTheme,die=new i.a9({data:new i.aa(G3.data)});function cP(b){if(!b.metadata||!b.metadata.content_area)return;const d=i.o.devicePixelRatio,{left:m,top:j,width:T,height:O}=b.metadata.content_area,D=m*d,B=j*d;return[D,B,D+T*d,B+O*d]}function dP(b){if(b)return b.map(([d,m])=>[d*i.o.devicePixelRatio,m*i.o.devicePixelRatio])}class K3{constructor(d,m,j){this.id=d,this.scope=m,this.sourceCache=j,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 j=this.sourceCache.getSource();if(!(j instanceof cc))return d;const T=m.map(D=>this.sourceCache.getTile(D)),O=j.getImages(T,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 $m=(b,d)=>Ze(b,d&&d.filter(m=>m.identifier!=="source.canvas")),uP=i.aH(Qs,["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"]),hP=i.aH(Qs,["setCenter","setZoom","setBearing","setPitch"]),Rk=new Set(["background","sky","slot","custom"]),Um={version:8,layers:[],sources:{}},Lv={duration:300,delay:0};class ih 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({},Lv),this._buildingIndex=new B3(this),this.crossTileSymbolIndex=new Fh,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 _e,this._hasDataDrivenEmissive=!1,this.dispatcher=m.dispatcher?m.dispatcher:new i.D(i.dh(),this),m.imageManager?this.imageManager=m.imageManager:(this.imageManager=new ze(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 cie(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 j=this;this._rtlTextPluginCallback=ih.registerForPluginStateChange(T=>{j.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:T.pluginStatus,pluginURL:T.pluginURL},(O,D)=>{if(i.dl(O),D&&D.every(B=>B))for(const B in j._sourceCaches){const H=j._sourceCaches[B],Y=H.getSource().type;Y!=="vector"&&Y!=="geojson"||H.reload()}})}),this.on("data",T=>{if(T.dataType!=="source"||T.sourceDataType!=="metadata")return;const O=this.getOwnSource(T.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,j){this.globalId=this._getGlobalId(d);const T=(O,D)=>{try{D(null,this.setState(O,j))}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&&T(H,m)})}else typeof d=="object"&&T(d,m)}loadURL(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"}));const j=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 T=this.importsCache.get(d);if(T)return this._load(T,j);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,j)})}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(Um,!1)}_loadImports(d,m,j){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const T=[];for(const O of d){const D=this._createFragmentStyle(O),B=new Promise(ee=>{D.once("style.import.load",ee),D.once("error",ee)}).then(()=>this.mergeAll());if(T.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(j){const ee=this.fragments.findIndex(({id:de})=>de===j);this.fragments=this.fragments.slice(0,ee).concat(Y).concat(this.fragments.slice(ee))}else this.fragments.push(Y)}return Promise.allSettled(T)}getImportGlobalIds(d=this,m=new Set){for(const j of d.fragments)j.style.globalId&&m.add(j.style.globalId),this.getImportGlobalIds(j.style,m);return[...m.values()]}_createFragmentStyle(d){const m=this.scope?i.B(d.id,this.scope):d.id;let j;const T=this._initialConfig&&this._initialConfig[m];(d.config||T)&&(j=Object.assign({},d.config,T));const O=new ih(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:j,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({},Um,{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&&$m(this,Ra(d)))return;this._loaded=!0,this.stylesheet=i.dp(d);const j=()=>{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=jf(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 ee=this.getOwnLayerSourceCache(Y),de=!!this.directionalLight&&this.directionalLight.shadowsEnabled();ee&&Y.canCastShadows()&&de&&(ee.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 T=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(T){const O=this._evaluateColorThemeData(T);this._loadColorTheme(O).then(()=>{j()}).catch(D=>{i.w(`Couldn't load color theme from the stylesheet: ${D}`),j()})}else this._styleColorTheme.lut=null,j()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,m,j,T,O,D,B,H,Y,ee;const de={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(ce=>{if(ce.stylesheet){if(ce.light!=null&&(d=ce.light),ce.stylesheet.lights)for(const ue of ce.stylesheet.lights)ue.type==="ambient"&&ce.ambientLight!=null&&(m=ce.ambientLight),ue.type==="directional"&&ce.directionalLight!=null&&(j=ce.directionalLight);T=this._prioritizeTerrain(T,ce.terrain,ce.stylesheet.terrain),ce.stylesheet.fog&&ce.fog!=null&&(O=ce.fog),ce.stylesheet.snow&&ce.snow!=null&&(D=ce.snow),ce.stylesheet.rain&&ce.rain!=null&&(B=ce.rain),ce.stylesheet.camera!=null&&(ee=ce.stylesheet.camera),ce.stylesheet.projection!=null&&(H=ce.stylesheet.projection),ce.stylesheet.transition!=null&&(Y=ce.stylesheet.transition),de[ce.scope]=ce._styleColorTheme}}),this.light=d,this.ambientLight=m,this.directionalLight=j,this.fog=O,this.snow=D,this.rain=B,this._styleColorThemeForScope=de,T===null?delete this.terrain:this.terrain=T,this.camera=ee||{"camera-projection":"perspective"},this.projection=H||{name:"mercator"},this.transition=Object.assign({},Lv,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const m=j=>{for(const T of j.fragments)m(T.style);d(j)};m(this)}_prioritizeTerrain(d,m,j){const T=d&&d.drapeRenderMode===0;return j===null?m&&m.drapeRenderMode===0?m:T?d:null:m!=null&&(!d||T||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={},j={};this.forEachFragmentStyle(T=>{for(const O in T._sourceCaches){const D=i.B(O,T.scope);d[D]=T._sourceCaches[O]}for(const O in T._otherSourceCaches){const D=i.B(O,T.scope);m[D]=T._otherSourceCaches[O]}for(const O in T._symbolSourceCaches){const D=i.B(O,T.scope);j[D]=T._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=m,this._mergedSymbolSourceCaches=j}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const m of Object.values(d.stylesheet.indoor)){const j=m,T=i.B(j.sourceId,d.scope);this._mergedIndoor[T]=new Set(j.sourceLayers||[])}})}mergeLayers(){const d={},m=[],j={};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 T=-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),j[H]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,T=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=j,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,j,T,O){const D=Object.assign({},j);for(const H of Object.keys(G3))D[H]===void 0&&(D[H]=G3[H].default);const B=new i.a8(die,m,new Map(T));return B.setTransitionOrValue(D,T),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((j,T)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void j();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,T(new Error("Failed to load image data"))},H.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==m)return void j();this._styleColorTheme.lutLoading=!1;const{width:Y,height:ee,data:de}=i.o.getImageData(H);if(ee>32)return void T(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==ee*ee)return void T(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:ee},de),pixelRatio:1,sdf:!1,usvg:!1,version:0});const ce=this.imageManager.getImage(B,this.scope);ce?(this._styleColorTheme.lut={image:ce.data,data:d},j()):T(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,j,T){let O,D,B;const H=i.o.devicePixelRatio>1?"@2x":"";let Y=i.m(j.transformRequest(j.normalizeSpriteURL(m,H,".json"),i.R.SpriteJSON),(ce,ue)=>{Y=null,B||(B=ce,O=ue,de())}),ee=i.n(j.transformRequest(j.normalizeSpriteURL(m,H,".png"),i.R.SpriteImage),(ce,ue)=>{ee=null,B||(B=ce,D=ue,de())});function de(){if(B)T(B);else if(O&&D){const ce=i.o.getImageData(D),ue={};for(const we in O){const{width:ve,height:De,x:Ie,y:He,sdf:tt,pixelRatio:Ge,stretchX:bt,stretchY:ft,content:yt}=O[we],ut=new i.q({width:ve,height:De});i.q.copy(ce,ut,{x:Ie,y:He},{x:0,y:0},{width:ve,height:De},null),ue[we]={data:ut,pixelRatio:Ge!==void 0?Ge:1,sdf:tt!==void 0&&tt,stretchX:bt,stretchY:ft,content:yt,usvg:!1,version:0}}T(null,ue)}}return{cancel(){Y&&(Y.cancel(),Y=null),ee&&(ee.cancel(),ee=null)}}}(d,this.map._requestManager,(m,j)=>{if(this._spriteRequest=null,m)this.fire(new i.y(m));else if(j){const T=new Map;for(const O in j)T.set(i.I.from(O),j[O]);this.addImages(T)}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 j=this.getOwnSourceCache(m.source);if(!j)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 T=j.getSource();if(T.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`)));T.partial=!1;const O=new K3(d,this.scope,j);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 j,T;this._spriteRequest=(T=(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((j=this.map._requestManager).transformRequest(j.normalizeIconsetURL(d),i.R.Iconset),(O,D)=>{if(O)return void T(O);const B={},H=i.dg(new i.bt(D));for(const Y of H.icons){const ee={version:1,pixelRatio:i.o.devicePixelRatio,content:cP(Y),stretchX:Y.metadata?dP(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?dP(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};B[Y.name]=ee}T(null,B)}))}_validateLayer(d){const m=this.getOwnSource(d.source);if(!m)return;const j=d.sourceLayer;j&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(j)===-1)&&this.fire(new i.y(new Error(`Source layer "${j}" 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 j=this.fragments[m];return j&&j.style&&(d.data=j.style.serialize()),d})}_serializeSources(){const d={};for(const m in this._sourceCaches){const j=this._sourceCaches[m].getSource();d[j.id]||(d[j.id]=j.serialize())}return d}_serializeLayers(d){const m=[];for(const j of d){const T=this._layers[j];T&&T.type!=="custom"&&m.push(T.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 j=m._transitionablePaint._values["line-emissive-strength"];if(j&&j.value&&j.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 j=this.map.painter;if(j)for(let T=d.minzoom||0;T<(d.maxzoom||25.5);T++){const O=d.getProgramIds();if(O)for(const D of O){const B=d.getDefaultProgramParams(D,m.zoom,this._styleColorTheme.lut);B&&(j.style=this,this.fog&&(j._fogVisible=!0,B.overrideFog=!0,j.getOrCreateProgram(D,B)),j._fogVisible=!1,B.overrideFog=!1,j.getOrCreateProgram(D,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,j.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 j=this._changes.isDirty();let T=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const H in B){const{updatedIds:Y,removedIds:ee}=B[H];(Y||ee)&&(this._updateWorkerLayers(H,Y,ee),T=!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&&T&&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),j&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const m of d){const j=m.resolvePendingRequests(),T=this.getFragmentStyle(m.scope);T&&T.addImages(j)}}_updateTilesForChangedImages(){const d={};for(const m in this._mergedSourceCaches){const j=this._mergedSourceCaches[m].getSource().scope;d[j]=d[j]||this._changes.getUpdatedImages(j),d[j].length!==0&&this._mergedSourceCaches[m].reloadTilesForDependencies(["icons","patterns"],d[j])}for(const m in d)this._changes.resetUpdatedImages(m)}_updateWorkerLayers(d,m,j){const T=this.getFragmentStyle(d);T&&this.dispatcher.broadcast("updateLayers",{layers:m?T._serializeLayers(m):[],scope:d,removedIds:j||[],options:T.options})}setState(d,m){if(this._checkLoaded(),$m(this,Ra(d)))return!1;(d=i.dp(d)).layers=jf(d.layers);const j=function(D,B){if(!D)return[{command:Qs.setStyle,args:[B]}];let H=[];try{if(!i.by(D.version,B.version))return[{command:Qs.setStyle,args:[B]}];if(i.by(D.center,B.center)||H.push({command:Qs.setCenter,args:[B.center]}),i.by(D.zoom,B.zoom)||H.push({command:Qs.setZoom,args:[B.zoom]}),i.by(D.bearing,B.bearing)||H.push({command:Qs.setBearing,args:[B.bearing]}),i.by(D.pitch,B.pitch)||H.push({command:Qs.setPitch,args:[B.pitch]}),i.by(D.sprite,B.sprite)||H.push({command:Qs.setSprite,args:[B.sprite]}),i.by(D.glyphs,B.glyphs)||H.push({command:Qs.setGlyphs,args:[B.glyphs]}),i.by(D.imports,B.imports)||function(ue=[],we=[],ve){we=we||[];const De=(ue=ue||[]).map(tx),Ie=we.map(tx),He=ue.reduce(kt,{}),tt=we.reduce(kt,{}),Ge=De.slice();let bt,ft,yt,ut;for(bt=0,ft=0;bt{ue.source&&Y[ue.source]?H.push({command:Qs.removeLayer,args:[ue.id]}):de.push(ue)});let ce=D.terrain;ce&&Y[ce.source]&&(H.push({command:Qs.setTerrain,args:[void 0]}),ce=void 0),H=H.concat(ee),i.by(ce,B.terrain)||H.push({command:Qs.setTerrain,args:[B.terrain]}),function(ue,we,ve){we=we||[];const De=(ue=ue||[]).map(tx),Ie=we.map(tx),He=ue.reduce(kt,{}),tt=we.reduce(kt,{}),Ge=De.slice(),bt=Object.create(null);let ft,yt,ut,lt,St,Dt,Ot;for(ft=0,yt=0;ft!(D.command in hP));if(j.length===0)return!1;const T=j.filter(D=>!(D.command in uP));if(T.length>0)throw new Error(`Unimplemented: ${T.map(D=>D.command).join(", ")}.`);const O=[];return j.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,j]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,j),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,j=!1){this.imageManager.updateImage(d,this.scope,m),j&&(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,j={}){return this._checkLoaded(),this._validate(ge,`models.${d}`,m,null,j)||(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,j={}){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(Fo,`sources.${d}`,m,null,j))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const T=Vo(d,m,this.dispatcher,this);T.scope=this.scope,T.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(T.id),source:T.serialize(),sourceId:T.id}));const O=D=>{const B=(D?"symbol:":"other:")+T.id,H=i.B(B,this.scope),Y=this._sourceCaches[B]=new ad(H,T,D);(D?this._symbolSourceCaches:this._otherSourceCaches)[T.id]=Y,Y.onAdd(this.map)};O(!1),m.type!=="vector"&&m.type!=="geojson"||O(!0),T.onAdd&&T.onAdd(this.map),j.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 T in this._layers)if(this._layers[T].source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while layer "${T}" 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 T=Object.entries(this.stylesheet.iconsets).find(([O,D])=>D.type==="source"&&D.source===d);if(T)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while iconset "${T[0]}" is using it.`)))}const j=this.getOwnSourceCaches(d);for(const T of j){const O=i.dq(T.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(T.id),T.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:T.getSource().id})),T.setEventedParent(null),T.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 j=this.getOwnSourceCache(m);j&&d.push(j.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const m in d){const j=d[m]._tiles;for(const T in j){const O=j[T];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(po,"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 Ks(O,mo||(mo=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 Ks(O,fa||(fa=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 j=Object.assign(m,{worldview:this.map.getWorldview()}),T=new i.ac(this.z||0,j);this.ambientLight&&this.ambientLight.recalculate(T),this.directionalLight&&this.directionalLight.recalculate(T),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,m=this.ambientLight;if(!d||!m)return;const j=ce=>.2126*(ce[0]<=.03928?ce[0]/12.92:Math.pow((ce[0]+.055)/1.055,2.4))+.7152*(ce[1]<=.03928?ce[1]/12.92:Math.pow((ce[1]+.055)/1.055,2.4))+.0722*(ce[2]<=.03928?ce[2]/12.92:Math.pow((ce[2]+.055)/1.055,2.4)),T=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=j(T)*O*B,Y=m.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),ee=m.properties.get("intensity"),de=j(Y)*ee;return Number(((H+de)/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),j=this.fragments.find(({id:O})=>O===m);if(!j)return;const T=i.dq(d);return j.style.getFragmentStyle(T)}{const m=this.fragments.find(({id:j})=>j===d);return m?m.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const m={},j=(T,O="")=>`${T}::${O}`;this._featuresetSelectors={};for(const T in d){const O=this._featuresetSelectors[T]=[];for(const D of d[T].selectors){if(D.featureNamespace){const H=this.getOwnLayer(D.layer);if(!H){i.w(`Layer is undefined for selector: ${D.layer}`);continue}const Y=j(H.source,H.sourceLayer);if(Y in m&&m[Y]!==D.featureNamespace){i.w(`"featureNamespace ${D.featureNamespace} of featureset ${T}'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 j=[];for(const T in m.stylesheet.featuresets)j.push({featuresetId:T,importId:m.scope?m.scope:void 0});return j}getFeaturesetLayers(d,m){const j=this.getFragmentStyle(m),T=j.stylesheet.featuresets;if(!T||!T[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 T[d].selectors){const B=j.getOwnLayer(D.layer);B&&O.push(B)}return O}getConfigProperty(d,m){const j=this.getFragmentStyle(d);if(!j)return null;const T=i.B(m,j.scope),O=j.options.get(T),D=O?O.value||O.default:null;return D?D.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,m){const j=i.B(d,m);return this._mergedIndoor[j]}setIndoorData(d,m){this.map.indoor.setIndoorData(m)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,m,j){const T=this.getFragmentStyle(d);if(!T)return;const O=T.stylesheet.schema;if(!O||!O[m])return;const D=i.U(j);if(D.result!=="success")return void $m(this,D.value);const B=D.value.expression,H=i.B(m,T.scope),Y=T.options.get(H);if(!Y)return;let ee;const{minValue:de,maxValue:ce,stepValue:ue,type:we,values:ve}=O[m],De=i.U(O[m].default);De.result==="success"&&(ee=De.value.expression),ee?(this.options.set(H,Object.assign({},Y,{value:B,default:ee,minValue:de,maxValue:ce,stepValue:ue,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 j=m.stylesheet.schema;if(!j)return null;const T={};for(const O in j){const D=i.B(O,m.scope),B=m.options.get(D),H=B?B.value||B.default:null;T[O]=H?H.serialize():null}return T}setConfig(d,m){const j=this.getFragmentStyle(d);j&&(j.updateConfig(m,j.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const m=this.getFragmentStyle(d);return m?m.stylesheet.schema:null}setSchema(d,m){const j=this.getFragmentStyle(d);j&&(j.stylesheet.schema=m,j.updateConfig(j._config,m),this.updateConfigDependencies())}updateConfig(d,m){if(this._config=d,d||m)if(m)for(const j in m){let T,O;const D=i.U(m[j].default);if(D.result==="success"&&(T=D.value.expression),d&&d[j]!==void 0){const ce=i.U(d[j]);ce.result==="success"&&(O=ce.value.expression)}const{minValue:B,maxValue:H,stepValue:Y,type:ee,values:de}=m[j];if(T){const ce=i.B(j,this.scope);this.options.set(ce,{default:T,value:O,minValue:B,maxValue:H,stepValue:Y,type:ee,values:de})}else this.fire(new i.y(new Error(`No schema defined for config option "${j}".`)))}else this.fire(new i.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,m=()=>!0){for(const j of d){const T=this.getLayer(j);T&&m(T)&&(T.possiblyEvaluateVisibility(),this._updateLayer(T),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 j=m._styleColorTheme.colorThemeOverride?m._styleColorTheme.colorThemeOverride:m._styleColorTheme.colorTheme;if(j){const T=m._evaluateColorThemeData(j);(!m._styleColorTheme.lut&&T!==""||m._styleColorTheme.lut&&T!==m._styleColorTheme.lut.data)&&m.setColorTheme(j)}}),this._changes.setDirty()}addLayer(d,m,j={}){this._checkLoaded();const T=d.id;if(this._layers[T])return void this.fire(new i.y(new Error(`Layer with id "${T}" already exists on this map`)));let O;if(d.type==="custom"){if($m(this,i.dt(d)))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(T,d.source),d=i.dp(d),d=Object.assign(d,{source:T})),this._validate(ku,`layers.${T}`,d,{arrayIndex:-1},j))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:T}})}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 de=this._order.indexOf(m);if(de===-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=de:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,T),this._layerOrderChanged=!0,this._layers[T]=O;const H=this.getOwnLayerSourceCache(O),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();H&&O.canCastShadows()&&Y&&(H.castsShadows=!0);const ee=this._changes.getRemovedLayer(O);if(ee&&O.source&&H&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const de=i.B(O.source,O.scope);ee.type!==O.type?this._changes.updateSourceCache(de,"clear"):(this._changes.updateSourceCache(de,"reload"),H.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,m){this._checkLoaded();const j=this._checkLayer(d);if(!j||d===m)return;const T=this._order.indexOf(d);this._order.splice(T,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.`)));j.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 j=this._order.indexOf(d);this._order.splice(j,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 T=this.getOwnLayerSourceCache(m);if(T&&T.castsShadows){let O=!1;for(const D in this._layers)if(this._layers[D].source===m.source&&this._layers[D].canCastShadows()){O=!0;break}T.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,j){this._checkLoaded();const T=this._checkLayer(d);T&&(T.minzoom===m&&T.maxzoom===j||(m!=null&&(T.minzoom=m),j!=null&&(T.maxzoom=j),this._updateLayer(T)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,m){this._checkLoaded();const j=this._checkLayer(d);j&&j.slot!==m&&(j.slot=m,this._updateLayer(j))}setFilter(d,m,j={}){this._checkLoaded();const T=this._checkLayer(d);if(T&&!i.by(T.filter,m))return m==null?(T.filter=void 0,void this._updateLayer(T)):void(this._validate(Hl,`layers.${T.id}.filter`,m,{layerType:T.type},j)||(T.filter=i.dp(m),this._updateLayer(T)))}getFilter(d){const m=this._checkLayer(d);if(m)return i.dp(m.filter)}setLayoutProperty(d,m,j,T={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!i.by(O.getLayoutProperty(m),j)){if(j!=null&&(!T||T.validate!==!1)&&$m(O,nt.call(Ra,{key:`layers.${d}.layout.${m}`,layerType:O.type,objectKey:m,value:j,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(m,j),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,m,j,T={}){this._checkLoaded();const O=this._checkLayer(d);O&&(m==="appearances"?(O.setAppearances(j),this._changes.setDirty()):O.isPaintProperty(m)?this.setPaintProperty(d,m,j,T):this.setLayoutProperty(d,m,j,T))}getLayoutProperty(d,m){const j=this._checkLayer(d);if(j)return j.getLayoutProperty(m)}setPaintProperty(d,m,j,T={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||i.by(O.getPaintProperty(m),j)||j!=null&&(!T||T.validate!==!1)&&$m(O,Nu.call(Ra,{key:`layers.${d}.paint.${m}`,layerType:O.type,objectKey:m,value:j,styleSpec:i.a6})))return;const D=O.setPaintProperty(m,j);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 j=this._checkLayer(d);if(j)return j.getPaintProperty(m)}setFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:Y}=d.target,ee=this.getFragmentStyle(Y),de=ee.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:ue}of de)ee.setFeatureState({id:d.id,source:ce,sourceLayer:ue},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 j=d.source,T=d.sourceLayer,O=this._checkSource(j);if(!O)return;const D=O.type;if(D==="geojson"&&T)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(D==="vector"&&!T)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(j);for(const H of B)H.setFeatureState(T,d.id,m)}removeFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:Y}=d.target,ee=this.getFragmentStyle(Y),de=ee.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:ue}of de)ee.removeFeatureState({id:d.id,source:ce,sourceLayer:ue},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 j=d.source,T=this._checkSource(j);if(!T)return;const O=T.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(j);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:ee,sourceLayer:de}of Y){const ce=H.getFeatureState({id:d.id,source:ee,sourceLayer:de});if(ce&&!O)O=ce;else if(!i.by(O,ce))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,j=d.sourceLayer,T=this._checkSource(m);if(T){if(T.type!=="vector"||j)return d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(m)[0].getFeatureState(j,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)},j=>j!==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),j=i.B(d.source,d.scope),T=this._changes.getUpdatedSourceCaches();d.source&&!T[j]&&m&&m.getSource().type!=="raster"&&(this._changes.updateSourceCache(j,"reload"),m.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const m=B=>this._mergedLayers[B].is3D(!!this.terrain),j=this.order,T={},O=[];for(let B=j.length-1;B>=0;B--){const H=j[B];if(m(H)){T[H]=B;for(const Y of d){const ee=Y[H];if(ee)for(const de of ee)O.push(de)}}}O.sort((B,H)=>H.intersectionZ-B.intersectionZ);const D=[];for(let B=j.length-1;B>=0;B--){const H=j[B];if(m(H))for(let Y=O.length-1;Y>=0;Y--){const ee=O[Y].feature;if(ee.layer&&T[ee.layer.id]{if(Rk.has(ee.type))return;const de=this.getOwnLayerSourceCache(ee),ce=O[de.id]=O[de.id]||{sourceCache:de,layers:{},has3DLayers:!1};ee.is3D(!!this.terrain)&&(ce.has3DLayers=!0),ce.layers[ee.fqid]=ce.layers[ee.fqid]||{styleLayer:ee,targets:[]},ce.layers[ee.fqid].targets.push({filter:T})};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 ee of m.layers){const de=this._layers[ee];if(!de)return this.fire(new i.y(new Error(`The layer '${ee}' does not exist in the map's style and cannot be queried for features.`))),[];D(de)}}else for(const ee in this._layers)D(this._layers[ee]);const B=this._queryRenderedFeatures(d,O,j),H=this._flattenAndSortRenderedFeatures(B),Y=[];for(const ee of H)i.dw(ee.layer.id)===this.scope&&Y.push(ee);return Y}queryRenderedFeatureset(d,m,j){let T;m&&!Array.isArray(m)&&m.filter&&(this._validate(Hl,"queryRenderedFeatures.filter",m.filter,null,m),T=i.b6(m.filter));const O="mock",D=[];if(m&&m.target)D.push(Object.assign({},m,{targetId:O,filter:T}));else{const ee=this.getFeaturesetDescriptors();for(const de of ee)D.push({targetId:O,filter:T,target:de});for(const{style:de}of this.fragments){const ce=de.getFeaturesetDescriptors();for(const ue of ce)D.push({targetId:O,filter:T,target:ue})}}const B=this.queryRenderedTargets(d,D,j),H=[],Y=new Set;for(const ee of B)for(const de of ee.variants[O])Rm(de,ee,Y)||H.push(new i.dx(ee,de));return H}queryRenderedTargets(d,m,j){const T={},O=(B,H,Y,ee)=>{const de=T[H.id]=T[H.id]||{sourceCache:H,layers:{},has3DLayers:!1};if(de.layers[B.fqid]=de.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(de.has3DLayers=!0),!ee)return Y.uniqueFeatureID=!1,void de.layers[B.fqid].targets.push(Y);de.layers[B.fqid].targets.push(Object.assign({},Y,{namespace:ee.namespace,properties:ee.properties,uniqueFeatureID:ee.uniqueFeatureID}))};for(const B of m)if("featuresetId"in B.target){const{featuresetId:H,importId:Y}=B.target,ee=this.getFragmentStyle(Y);if(!ee||!ee._featuresetSelectors)continue;const de=ee._featuresetSelectors[H];if(!de){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 ce of de){const ue=ee.getOwnLayer(ce.layerId);ue&&!Rk.has(ue.type)&&O(ue,ee.getOwnLayerSourceCache(ue),B,ce)}}else if("layerId"in B.target){const{layerId:H}=B.target,Y=this.getLayer(H);if(!Y||Rk.has(Y.type))continue;O(Y,this.getLayerSourceCache(Y),B)}const D=this._queryRenderedFeatures(d,T,j);return this._flattenAndSortRenderedFeatures(D)}_queryRenderedFeatures(d,m,j){const T=[],O=!!this.map._showQueryGeometry,D=Si.createFromScreenPoints(d,j);for(const B in m){const H=Fy(D,m[B],this._availableImages,j,O);Object.keys(H).length&&T.push(H)}if(this.placement)for(const B in m){if(!m[B].sourceCache._onlySymbols)continue;const H=zy(D.screenGeometry,m[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(H).length&&T.push(H)}return T}querySourceFeatures(d,m){const j=m&&m.filter;j&&this._validate(Hl,"querySourceFeatures.filter",j,null,m);let T=[];const O=this.getOwnSourceCaches(d);for(const D of O)T=T.concat(By(D,m));return T}addSourceType(d,m,j){return ih.getSourceType(d)?j(new Error(`A source type called "${d}" already exists.`)):(ih.setSourceType(d,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:m.workerSourceURL},j):j(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,m,j={}){this._checkLoaded();const T=this.light.getLight();let O=!1;for(const B in d)if(!i.by(d[B],T[B])){O=!0;break}if(!O)return;const D=this._getTransitionParameters();this.light.setLight(d,m,j),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 j=d;const T=!("source"in d)||d.source==null;if(m===1){if(this.disableElevatedTerrain)return;if("source"in j&&typeof j.source=="object"){const B="terrain-dem-src";this.addSource(B,j.source),j=i.dp(j),j=Object.assign(j,{source:B})}const O=Object.assign({},j),D={};if(this.terrain&&T){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(D.style=B.serialize())}if(this._validate(gl,"terrain",O,D))return}if(!this.terrain||this.terrain.scope!==this.scope&&!T||this.terrain&&m!==this.terrain.drapeRenderMode){if(!j)return;this._createTerrain(j,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))!j.hasOwnProperty(B)&&i.a6.terrain[B].default&&(j[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 Xn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}_createSnow(d){const m=this.snow=new _o(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}_createRain(d){const m=this.rain=new Ni(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}_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 j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}}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 j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}}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 j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const T in this._layers)this._layers[T].lut=this._styleColorTheme.lut;for(const T in this._sourceCaches)this._sourceCaches[T].clearTiles()},m=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!m)return this._styleColorTheme.lut=null,void d();const j=this._evaluateColorThemeData(m);this._loadColorTheme(j).then(()=>{this.fire(new i.z("colorthemeset")),d()}).catch(T=>{i.w(`Couldn't set color theme: ${T}`)})}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 j=this.getFragmentStyle(d);j&&(j._styleColorTheme.colorThemeOverride=m,j._reloadColorTheme())}_getTransitionParameters(d){return{now:i.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],m=[];for(const j of this._mergedOrder)this.isLayerDraped(this._mergedLayers[j])?d.push(j):m.push(j);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...m)}_createTerrain(d,m){const j=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 T=this._getTransitionParameters({duration:0});j.updateTransitions(T)}_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,j,T,O={}){if(O&&O.validate===!1)return!1;const D=Object.assign({},this.serialize());return $m(this,d.call(Ra,Object.assign({key:m,style:D,value:j,styleSpec:i.a6},T)))}_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 j of m)j.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 j of m)j.resume(),j.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=Pv(this.directionalLight));const j=new Set,T=new Set;for(const O in this._mergedLayers){const D=this._mergedLayers[O];D.type==="building"&&j.add(D.source),D.hasElevation()&&!T.has(D.source)&&T.add(D.source)}for(const O in this._mergedSourceCaches){const D=this._mergedSourceCaches[O],B=T.has(D._source.id);j.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,j,T,O,D,B=!1){let H=!1,Y=!1;const ee={},de={};for(const ve of this._mergedOrder){const De=this._mergedLayers[ve];if(De.type!=="symbol")continue;const Ie=i.B(De.source,De.scope);let He=ee[Ie];if(!He){const Ge=this.getLayerSourceCache(De);if(!Ge)continue;const bt=Ge.getRenderableIds(!0).map(ft=>Ge.getTileByID(ft));de[Ie]=bt.slice(),He=ee[Ie]=bt.sort((ft,yt)=>yt.tileID.overscaledZ-ft.tileID.overscaledZ||(ft.tileID.isLessThan(yt.tileID)?-1:1))}const tt=this.crossTileSymbolIndex.addLayer(De,He,m.center.lng,m.projection);H=H||tt}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const ce=!!(this.placement&&!m.equals(this.placement.transform)),ue=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!D||this.placement.lastReplacementSourceUpdateTime!==D.updateTime)),we=(ce||ue||H||this.placement&&this.placement.isStale())&&T===0;if((B||!this.pauseablePlacement||we||T!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),m.zoom))&&(this.pauseablePlacement=new vl(m,this._mergedOrder,B||T===0,j,T,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,ee,de,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 j.push(d),this._loadImports([d],!0);const T=j.findIndex(({id:O})=>O===m);return T===-1&&this.fire(new i.y(new Error(`Import with id "${m}" does not exist on this map.`))),this.stylesheet.imports=j.slice(0,T).concat(d).concat(j.slice(T)),this._loadImports([d],!0,m)}updateImport(d,m){this._checkLoaded();const j=this.stylesheet.imports||[],T=this.getImportIndex(d);return T===-1?this:typeof m=="string"?(this.setImportUrl(d,m),this):(m.url&&m.url!==j[T].url&&this.setImportUrl(d,m.url),i.by(m.config,j[T].config)||this.setImportConfig(d,m.config,m.data.schema),i.by(m.data,j[T].data)||this.setImportData(d,m.data),this)}moveImport(d,m){this._checkLoaded();let j=this.stylesheet.imports||[];const T=this.getImportIndex(d);if(T===-1)return this;const O=this.getImportIndex(m);if(O===-1)return this;const D=j[T],B=this.fragments[T];return j=j.filter(({id:H})=>H!==d),this.fragments=this.fragments.filter(({id:H})=>H!==d),this.stylesheet.imports=j.slice(0,O).concat(D).concat(j.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 j=this.stylesheet.imports||[],T=this.getImportIndex(d);if(T===-1)return this;j[T].url=m;const O=this.fragments[T];return O.style=this._createFragmentStyle(j[T]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(m),this}setImportData(d,m){this._checkLoaded();const j=this.getImportIndex(d),T=this.stylesheet.imports||[];return j===-1?this:m?(this.fragments[j].style.setState(m),this._reloadImports(),this):(delete T[j].data,this.setImportUrl(d,T[j].url))}setImportConfig(d,m,j){this._checkLoaded();const T=this.getImportIndex(d),O=this.stylesheet.imports||[];if(T===-1)return this;m?O[T].config=m:delete O[T].config;const D=this.fragments[T];j&&D.style.stylesheet&&(D.style.stylesheet.schema=j);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||[],j=this.getImportIndex(d);j!==-1&&(m.splice(j,1),this.fragments[j].style._remove(),this.fragments.splice(j,1),this._reloadImports())}getImportIndex(d){const m=(this.stylesheet.imports||[]).findIndex(j=>j.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 j=this._mergedOtherSourceCaches[m];j&&d.push(j.getSource())}return d}getSource(d,m){const j=this.getSourceCache(d,m);return j&&j.getSource()}getLayerSource(d){const m=this.getLayerSourceCache(d);return m&&m.getSource()}getSourceCache(d,m){const j=i.B(d,m);return this._mergedOtherSourceCaches[j]}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 j=d[m];j==="reload"?this.reloadSource(m):j==="clear"&&this.clearSource(m)}}updateLayers(d){const m=this._changes.getUpdatedPaintProperties();for(const j of m){const T=this.getLayer(j);T&&T.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,m,j){this.imageManager.getImages(m.images,m.scope,j),this._updateTilesForChangedImages();const T=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);T(this._mergedOtherSourceCaches[O]),T(this._mergedSymbolSourceCaches[O]),m.images.some(D=>D.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(d,m,j){this.imageManager.rasterizeImages(m,j)}getGlyphs(d,m,j){this.glyphManager.getGlyphs(m.stacks,j)}getResource(d,m,j){return i.dz(m,j)}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(j=>j.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 j=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),T=d.type==="building";if(d.is3D(!!this.terrain)){if(j||T||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)}}ih.getSourceType=function(b){return th[b]},ih.setSourceType=function(b,d){th[b]=d},ih.registerForPluginStateChange=i.dA;class fP 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,j]of Object.entries(d.buildings))if(this._buildings[m])for(const T of j.floorIds)this._buildings[m].floors[T]||(this._buildings[m].floors[T]=j.floors[T]);else this._buildings[m]=j;for(const m of d.activeFloors)this._activeFloors.add(m);this._updateIndoorSelector()}getIndoorTileOptions(d,m){const j=this._style.getIndoorSourceLayers(d,m);return j&&this._indoorState?{sourceLayers:j,indoorState:this._indoorState}:null}_updateUI(d,m,j){const T=function(O,D,B,H){let Y=null,ee=Number.MAX_SAFE_INTEGER;if(H<16)return null;for(const[de,ce]of Object.entries(O)){const ue=ce.center;if(ue){const we=D.distanceTo(i.aT.convert(ue));we({id:D,name:j.floors[D].name,zIndex:j.floors[D].zIndex})).sort((D,B)=>B.zIndex-D.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:T,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 Ky=` #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`,Zy=` #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;}`,Z3=` #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`,Fk="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;}",Cu=` #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`,zk=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} #endif`,Cr=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} #endif`,Y3=`#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`,Bk=`#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;}`,$k=`#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`,X3=`#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 Ov=/#include\s+"([^"]+)"/g,Cf=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,Q3=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,nx=new Set(["ifdef","ifndef","elif","if","defined"]),sx=new Set;Vm(Ky,sx),Vm(Z3,sx),Vm(Zy,sx);const qm={"_prelude_fog.vertex.glsl":zk,"_prelude_terrain.vertex.glsl":Cu,"_prelude_shadow.vertex.glsl":$k,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer #define MATERIAL_TABLE_DEBUG 0 uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; #if MATERIAL_TABLE_DEBUG vec4 colorDebug; #endif };uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; }uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; #if MATERIAL_TABLE_DEBUG const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; #endif uint offset=0u; #if MATERIAL_TABLE_DEBUG bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} #endif offset++; #if MATERIAL_TABLE_DEBUG uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} #endif offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); #if MATERIAL_TABLE_DEBUG if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} #endif uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); #if MATERIAL_TABLE_DEBUG if(keepFinding) {uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} #endif offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; #if MATERIAL_TABLE_DEBUG if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} #endif info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) {uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) #define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); #define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; #endif`,"_prelude_fog.fragment.glsl":Cr,"_prelude_shadow.fragment.glsl":X3,"_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":Y3,"_prelude_raster_particle.glsl":Bk},Uk={};Js("",Cu),Js(Cr,zk),Js(X3,$k),Js(Y3,""),Js(Bk,"");const pP=Js(Zy,Z3),qk=Ky,uie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",qk,pP.fragmentSource].join(` `),mP=["precision highp float;",qk,pP.vertexSource].join(` `);var J3={background:Js(`#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:Js(`#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:Js(`#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:Js(`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:Js(`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:Js(`#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:Js("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:Js(`#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:Js(`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:Js("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:Js("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:Js("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:Js(`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:Js(`#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:Js(`#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:Js(`#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:Js(`#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:Js(`#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:Js(`#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:Js(`#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:Js(`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:Js(`#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:Js(`#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:Js(`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:Js(`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:Js(`#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:Js(`#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:Js(`#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:Js(`#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:Js(`#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:Js("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:Js("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:Js(`#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:Js(`#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:Js(`#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:Js("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:Js(`#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 }`,Fk),skyboxGradient:Js(`#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 }`,Fk),skyboxCapture:Js(` 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:Js(`#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:Js(`#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:Js(`#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:Js(`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:Js(`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:Js("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:Js("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:Js("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:Js("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 Vm(b,d){const m=b.split(` `);for(let j of m){if(j=j.trimStart(),j[0]!=="#"||!j.includes("if")||j.startsWith("#endif"))continue;const T=j.match(Q3);if(T)for(const O of T)nx.has(O)||d.add(O)}}function Js(b,d){const m=new Set,j=[],T=[];b=b.replace(Ov,(D,B)=>(T.push(B),"")),d=d.replace(Ov,(D,B)=>(j.push(B),""));let O=new Set(sx);Vm(b,O),Vm(d,O);for(const D of[...j,...T])Uk[D]||(Uk[D]=new Set,Vm(qm[D],Uk[D])),O=new Set([...O,...Uk[D]]);return{fragmentSource:b=b.replace(Cf,(D,B,H,Y,ee)=>(m.add(ee),B==="define"?` #ifndef HAS_UNIFORM_u_${ee} in ${H} ${Y} ${ee}; #else uniform ${H} ${Y} u_${ee}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${ee} ${H} ${Y} ${ee} = u_${ee}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${ee} in ${H} ${Y} ${ee}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(Cf,(D,B,H,Y,ee)=>{const de=`MATERIAL_ATTRIBUTE_OFFSET_${ee}`,ce=Y==="float"?"vec2":Y,ue=`GET_ATTRIBUTE_${ce}(a_${ee}, materialInfo, ${de})`,we=ee.match(/color/)?"color":ce;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${ee} in ${H} ${Y} a_${ee}; #endif `:m.has(ee)?B==="define"?` #ifndef HAS_UNIFORM_u_${ee} uniform lowp float u_${ee}_t; #if !defined(${de}) in ${H} ${ce} a_${ee}; #endif out ${H} ${Y} ${ee}; #else uniform ${H} ${Y} u_${ee}; #endif `:B==="initialize"?we==="vec4"?` #ifndef HAS_UNIFORM_u_${ee} ${ee} = a_${ee}; #else ${H} ${Y} ${ee} = u_${ee}; #endif `:` #if !defined(HAS_UNIFORM_u_${ee}) #ifdef ${de} ${ee} = unpack_mix_${we}(${ue}, u_${ee}_t); #else ${ee} = unpack_mix_${we}(a_${ee}, u_${ee}_t); #endif #else ${H} ${Y} ${ee} = u_${ee}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${ee} in ${H} ${Y} a_${ee}; out ${H} ${Y} ${ee}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${ee} ${ee} = a_${ee}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${ee} uniform lowp float u_${ee}_t; #if !defined(${de}) in ${H} ${ce} a_${ee}; #endif #else uniform ${H} ${Y} u_${ee}; #endif `:B==="define-instanced"?we==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${ee}0; in vec4 a_${ee}1; in vec4 a_${ee}2; in vec4 a_${ee}3; #else uniform ${H} ${Y} u_${ee}; #endif `:` #ifdef INSTANCED_ARRAYS in ${H} ${ce} a_${ee}; #else uniform ${H} ${Y} u_${ee}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${ee} ${H} ${Y} ${ee} = a_${ee}; #endif `:we==="vec4"?` #ifndef HAS_UNIFORM_u_${ee} #ifdef ${de} ${H} ${Y} ${ee} = ${ue}; #else ${H} ${Y} ${ee} = a_${ee}; #endif #else ${H} ${Y} ${ee} = u_${ee}; #endif `:` #ifndef HAS_UNIFORM_u_${ee} #ifdef ${de} ${H} ${Y} ${ee} = unpack_mix_${we}(${ue}, u_${ee}_t); #else ${H} ${Y} ${ee} = unpack_mix_${we}(a_${ee}, u_${ee}_t); #endif #else ${H} ${Y} ${ee} = u_${ee}; #endif `}),usedDefines:O,vertexIncludes:j,fragmentIncludes:T}}class hie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,m,j,T,O,D,B,H){this.context=d;let Y=this.boundPaintVertexBuffers.length!==T.length;for(let de=0;!Y&&de{const bt=tt.paint.get("hillshade-shadow-color"),ft=tt.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",yt=tt.paint.get("hillshade-highlight-color"),ut=tt.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",lt=tt.paint.get("hillshade-accent-color"),St=tt.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Dt=tt.paint.get("hillshade-emissive-strength");let Ot=i.an(tt.paint.get("hillshade-illumination-direction"));if(tt.paint.get("hillshade-illumination-anchor")==="viewport")Ot-=Ie.transform.angle;else if(Ie.style&&Ie.style.enable3dLights()&&Ie.style.directionalLight){const Gt=Ie.style.directionalLight.properties.get("direction"),sr=i.d4(Gt.x,Gt.y,Gt.z);Ot=i.an(sr[1])}const Wt=!Ie.options.moving;return{u_matrix:Ge||Ie.transform.calculateProjMatrix(He.tileID.toUnwrapped(),Wt),u_image:0,u_latrange:fie(0,He.tileID),u_light:[tt.paint.get("hillshade-exaggeration"),Ot],u_shadow:bt.toPremultipliedRenderColor(ft?null:tt.lut),u_highlight:yt.toPremultipliedRenderColor(ut?null:tt.lut),u_emissive_strength:Dt,u_accent:lt.toPremultipliedRenderColor(St?null:tt.lut)}})(b,m,j,b.terrain?d.projMatrix:null);b.uploadCommonUniforms(B,ce,d.toUnwrapped());const{tileBoundsBuffer:we,tileBoundsIndexBuffer:ve,tileBoundsSegments:De}=b.getTileBoundsBuffers(m);ce.draw(b,H.TRIANGLES,T,O,D,zn.disabled,ue,j.id,we,ve,De)}function e5(b,d,m){if(!d.needsDEMTextureUpload)return;const j=b.context,T=j.gl;j.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(j,O,T.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function mie(b,d,m){const j=b.context,T=j.gl;if(!d.dem)return;const O=d.dem;if(j.activeTexture.set(T.TEXTURE1),e5(b,d,O),!d.demTexture)return;d.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);const D=O.dim;j.activeTexture.set(T.TEXTURE0);let B=d.hillshadeFBO;if(!B){const ce=new i.T(j,{width:D,height:D,data:null},T.RGBA8);ce.bind(T.LINEAR,T.CLAMP_TO_EDGE),B=d.hillshadeFBO=j.createFramebuffer(D,D,1,"renderbuffer"),B.colorAttachment0.set(ce.texture)}j.bindFramebuffer.set(B.framebuffer),j.viewport.set([0,0,D,D]);const{tileBoundsBuffer:H,tileBoundsIndexBuffer:Y,tileBoundsSegments:ee}=b.getMercatorTileBoundsBuffers(),de=[];b.linearFloatFilteringSupported()&&de.push("TERRAIN_DEM_FLOAT_FORMAT"),b.terrain&&b.terrain.renderingToTexture&&b.emissiveMode==="mrt-fallback"&&de.push("USE_MRT1"),b.getOrCreateProgram("hillshadePrepare",{defines:de}).draw(b,T.TRIANGLES,un.disabled,Un.disabled,ls.unblended,zn.disabled,((ce,ue)=>{const we=ue.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:ce.overscaledZ}})(d.tileID,O),m.id,H,Y,ee),d.needsHillshadePrepare=!1}class Mi{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 gie extends Mi{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 gP extends Mi{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class t5 extends Mi{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class Vk extends Mi{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 r5 extends Mi{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class ax extends Mi{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Yy extends Mi{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 Dv extends Mi{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 Xy extends Mi{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 xP extends Mi{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 n5 extends Mi{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 yP extends Mi{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Qy extends Mi{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 Hk extends Mi{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 Wk extends Mi{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 s5 extends Mi{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 Gk extends Mi{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 Rv extends Mi{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class vP extends Mi{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let _P=class extends Mi{getDefault(){return null}set(b){(b!==this.current||this.dirty)&&(this.gl.useProgram(b),this.current=b,this.dirty=!1)}};class bP extends Mi{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class Jy extends Mi{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 wP extends Mi{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 xie extends Mi{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 yie extends Mi{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 vie extends Mi{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 a5 extends Mi{getDefault(){return null}set(d){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class i5 extends Mi{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class o5 extends Mi{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 l5 extends Mi{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 jP extends Mi{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 Kk extends Mi{constructor(d,m){super(d),this.context=d,this.parent=m}getDefault(){return null}}class Zk extends Kk{constructor(d,m,j=0){super(d,m),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+j}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 e0 extends Kk{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 Fv extends Kk{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 kP extends e0{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Mu=(b,d,m,j)=>({u_matrix:b,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:m,u_emissive_texture_available:j}),Yk=(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De)=>({u_proj_matrix:Float32Array.from(b),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(j),u_merc_matrix:m,u_zoom_transition:T,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:ee,u_globe_radius:de,u_viewport:ce,u_grid_matrix:De?Float32Array.from(De):new Float32Array(9),u_skirt_height:ue,u_far_z_cutoff:we,u_emissive_texture_available:ve});function zv(b,d){return b!=null&&d!=null&&!(!b.hasData()||!d.hasData())&&b.demTexture!=null&&d.demTexture!=null&&b.tileID.key!==d.tileID.key}const Sp=new class{constructor(){this.operations={}}newMorphing(b,d,m,j,T){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:j,phase:0,duration:T,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()}},Xk={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Qk(b,d,m){if(d===0)return 0;const j=d<1&&m===514?.25/d:1;return 6*Math.pow(1.5,22-b)*Math.max(d,1)*j}function c5(b,d){const m=1<({u_matrix:b});function $v(b,d,m,j,T){if(T>0){const O=i.o.now(),D=(O-b.timeAdded)/T,B=d?(O-d.timeAdded)/T:-1,H=m.getSource(),Y=j.coveringZoomLevel({tileSize:H.tileSize,roundZoom:H.roundZoom}),ee=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(b.tileID.overscaledZ-Y),de=ee&&b.refreshedUponExpiration?1:i.aA(ee?D:1-B,0,1);return d?{opacity:1,mix:1-de,isFading:D<1}:{opacity:de,mix:0,isFading:D<1}}return{opacity:1,mix:0,isFading:!1}}class Jk extends ad{constructor(d){const m=Vo("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 d5 extends ad{constructor(d){const m=Vo("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,j){if(d.freezeTileCoverage)return;this.transform=d;const T=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 vp(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 T||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const m=this.proxyCachedFBO[d];if(m!==void 0){const j=Object.values(m);this.renderCachePool.push(...j),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class u5 extends i.aQ{constructor(d,m,j){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=m,this.projMatrix=j}}class h5 extends i.bV{constructor(d,m){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[j,T,O]=function(H){const Y=new i.bd,ee=new i.b0,de=131;Y.reserve(17161),ee.reserve(33800);const ce=i.al/128,ue=i.al+ce/2,we=ue+ce;for(let De=-ce;Deue||De<0||De>ue?24575:0,tt=i.aA(Math.round(Ie),0,i.al),Ge=i.aA(Math.round(De),0,i.al);Y.emplaceBack(tt+He,Ge)}const ve=(De,Ie)=>{const He=Ie*de+De;ee.emplaceBack(He+1,He,He+de),ee.emplaceBack(He+de,He+de+1,He+1)};for(let De=1;De<129;De++)for(let Ie=1;Ie<129;Ie++)ve(Ie,De);return[0,129].forEach(De=>{for(let Ie=0;Ie<130;Ie++)ve(Ie,De),ve(De,Ie)}),[Y,ee,32768]}(),D=d.context;this.gridBuffer=D.createVertexBuffer(j,i.bf.members),this.gridIndexBuffer=D.createIndexBuffer(T),this.gridSegments=i.bg.simpleSegment(0,0,j.length,T.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,j.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new d5(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 Un({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 Jk(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,j){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const T=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=T.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):T.get("exaggeration"),!m.projection.requiresDraping&&D&&this._exaggeration===0)return void this._disable();this.enabled=!0;const ee=()=>{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 de=this.getScaledDemTileSize();this.sourceCache.update(m,de,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,ee(),this._initializing=!0),ee(),m.updateElevation(!0,j),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,j=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=j;const T=m!=null?j-m:Number.MAX_VALUE;if(Math.abs(T)<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*T<0&&(Y+=B)),this._evaluationZoom=Y;const ee=D.getExaggeration(Y),de=ee===D.getExaggeration(Math.max(0,Y-.1));if(de&&Math.abs(ee-this._exaggeration)<.01)return ee;let ce=Math.min(.1,.00375*(this._updateTimestamp-H));return(de||ee<.1||Math.abs(B)<1e-4)&&(ce=Math.min(.2,4*ce)),i.ak(this._exaggeration,ee,ce)}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,j=this.painter.transform;this._initializing&&(this._initializing=j._centerAltitude===0&&this.getAtPointOrZero(i.ae.fromLngLat(j.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const T=this.proxyCoords=m.getIds().map(H=>{const Y=m.getTileByID(H).tileID;return Y.projMatrix=j.calculateProjMatrix(Y.toUnwrapped()),Y});(function(H,Y){const ee=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),de=new i.P(ee.x,ee.y);H.sort((ce,ue)=>{if(ue.overscaledZ-ce.overscaledZ)return ue.overscaledZ-ce.overscaledZ;const we=new i.P(ce.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 ee=d[H];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(ee)}this.proxiedCoords[m.id]=T.map(H=>new u5(H,H.key,this.orthoMatrix)),this._assignTerrainTiles(T),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 ee=Y.tileID.key;ee in B||(this._visibleDemTiles.push(Y),B[ee]=ee)}}_assignTerrainTiles(d){this._initializing||d.forEach(m=>{if(this.terrainTileForTile[m.key])return;const j=this._findTileCoveringTileID(m,this.sourceCache);j&&(this.terrainTileForTile[m.key]=j)})}_prepareDEMTextures(){const d=this.painter.context,m=d.gl;for(const j in this.terrainTileForTile){const T=this.terrainTileForTile[j],O=T.dem;!O||T.demTexture&&!T.needsDEMTextureUpload||(d.activeTexture.set(m.TEXTURE1),e5(this.painter,T,O))}}_prepareDemTileUniforms(d,m,j,T){if(!m||m.demTexture==null)return!1;const O=d.tileID.canonical,D=Math.pow(2,m.tileID.canonical.z-O.z),B=T||"";return j[`u_dem_tl${B}`]=[O.x*D%1,O.y*D%1],j[`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((j,T)=>{if(!T.dem)return j;const O=T.dem.tree.minimums[0];return O>0&&d++,j+O},0);return d?m/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,m=d.gl;d.activeTexture.set(m.TEXTURE2);const j=this._getLoadedAreaMinimum(),T=new i.dL({width:1,height:1},new Float32Array([j]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(T,{premultiply:!1}):O=this._emptyDEMTexture=new i.T(d,T,m.R32F,{premultiply:!1}),O}setupElevationDraw(d,m,j){const T=this.painter.context,O=T.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(j&&j.morphing&&this._useVertexMorphing){const ue=j.morphing.srcDemTile,we=j.morphing.dstDemTile;Y=j.morphing.phase,ue&&we&&(this._prepareDemTileUniforms(d,ue,D,"_prev")&&(H=ue),this._prepareDemTileUniforms(d,we,D)&&(B=we))}const ee=ue=>ue&&ue.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let de=null;var ce;if(this.enabled?H&&B?(de=B.demTexture,T.activeTexture.set(O.TEXTURE4),H.demTexture.bind(ee(H),O.CLAMP_TO_EDGE),D.u_dem_lerp=Y):(B=this.terrainTileForTile[d.tileID.key],de=this._prepareDemTileUniforms(d,B,D)?B.demTexture:this.emptyDEMTexture):de=this.emptyDEMTexture,T.activeTexture.set(O.TEXTURE2),de&&(D.u_dem_size=(ce=de).size[0]===1?1:ce.size[0]-2,de.bind(ee(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(j&&j.useDepthForOcclusion,m,D),j&&j.useMeterToDem&&B){const ue=(1<{if(Ie===Gt)return;const sr=[Xk[Gt],"PROJECTION_GLOBE_VIEW"];tt&&sr.push("CUSTOM_ANTIALIASING");const _r=Y.isTileAffectedByFog(Wt);De=Y.getOrCreateProgram("globeRaster",{defines:sr,overrideFog:_r}),Ie=Gt},bt=Y.colorModeForRenderPass(),ft=new un(ve.LEQUAL,un.ReadWrite,Y.depthRangeFor3D);Sp.update(ue);const yt=i.dF(He),ut=[i.aF(He.center.lng),i.aJ(He.center.lat)],lt=Y.globeSharedBuffers,St=[He.width*i.o.devicePixelRatio,He.height*i.o.devicePixelRatio],Dt=Float32Array.from(He.globeMatrix),Ot={useDenormalizedUpVectorScale:!0};{const Wt=Y.transform,Gt=Qk(Wt.zoom,ee.exaggeration(),ee.sourceCache._source.tileSize);Ie=-1;const sr=ve.TRIANGLES;for(const _r of ce){const $t=de.getTile(_r),Tt=Un.disabled,Jt=ee.prevTerrainTileForTile[_r.key],Vt=ee.terrainTileForTile[_r.key];zv(Jt,Vt)&&Sp.newMorphing(_r.key,Jt,Vt,ue,250),t0(Y,$t.emissiveTexture),we.activeTexture.set(ve.TEXTURE0),$t.texture&&$t.texture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const dr=Sp.getMorphValuesForProxy(_r.key),Ar=dr?1:0;dr&&Object.assign(Ot,{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,Wt.worldSize/Wt._pixelsPerMercatorPixel),on=i.bk(i.dJ(_r.canonical)),en=Y.emissiveMode==="mrt-fallback"?1:0,$r=Yk(Wt.expandedFarZProjMatrix,Dt,yt,on,i.aj(Wt.zoom),ut,Wt.frustumCorners.TL,Wt.frustumCorners.TR,Wt.frustumCorners.BR,Wt.frustumCorners.BL,Wt.globeCenterInViewSpace,Wt.globeRadius,St,Gt,Wt._farZ,en,br);if(Ge(_r,Ar),De&&(ee.setupElevationDraw($t,De,Ot),Y.uploadCommonUniforms(we,De,_r.toUnwrapped()),lt)){const[Gr,kn,Qn]=lt.getGridBuffers(Nr,Gt!==0);De.draw(Y,sr,ft,Tt,bt,zn.backCCW,$r,"globe_raster",Gr,kn,Qn)}}}if(lt&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Wt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];tt&&Wt.push("CUSTOM_ANTIALIASING"),De=Y.getOrCreateProgram("globeRaster",{defines:Wt});for(const Gt of ce){const{x:sr,y:_r,z:$t}=Gt.canonical,Tt=_r===0,Jt=_r===(1<<$t)-1,[Vt,dr,Ar,Hr]=lt.getPoleBuffers($t,!1);if(Hr&&(Tt||Jt)){const Nr=de.getTile(Gt);t0(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,He);const on=i.bk(i.dJ(Gt.canonical)),en=Y.emissiveMode==="mrt-fallback"?1:0,$r=(Gr,kn)=>Gr.draw(Y,ve.TRIANGLES,ft,Un.disabled,bt,zn.disabled,Yk(He.expandedFarZProjMatrix,br,br,on,0,ut,He.frustumCorners.TL,He.frustumCorners.TR,He.frustumCorners.BR,He.frustumCorners.BL,He.globeCenterInViewSpace,He.globeRadius,St,0,He._farZ,en),"globe_pole_raster",kn,Ar,Hr);ee.setupElevationDraw(Nr,De,Ot),Y.uploadCommonUniforms(we,De,Gt.toUnwrapped()),Tt&&Y.renderDefaultNorthPole&&$r(De,Vt),Jt&&Y.renderDefaultSouthPole&&(br=i.cS(i.bC(),br,[1,-1,1]),$r(De,dr))}}}})(T,O,D,B,H);else{const Y=T.context,ee=Y.gl;let de,ce;const ue=T.shadowRenderer,we=zm(T,T.longestCutoffRange),ve=bt=>{if(ce===bt)return;const ft=[];ft.push(Xk[bt]),we.shouldRenderCutoff&&ft.push("RENDER_CUTOFF"),ue&&(ft.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ue.useNormalOffset&&ft.push("NORMAL_OFFSET")),de=T.getOrCreateProgram("terrainRaster",{defines:ft}),ce=bt},De=T.colorModeForRenderPass(),Ie=new un(ee.LEQUAL,un.ReadWrite,T.depthRangeFor3D);Sp.update(H);const He=T.transform,tt=Qk(He.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let Ge=[0,0,0];if(ue){const bt=T.style.directionalLight,ft=T.style.ambientLight;bt&&ft&&(Ge=Np(T.style,bt,ft))}{ce=-1;const bt=ee.TRIANGLES,[ft,yt]=[O.gridIndexBuffer,O.gridSegments];for(const ut of B){const lt=D.getTile(ut),St=Un.disabled,Dt=O.prevTerrainTileForTile[ut.key],Ot=O.terrainTileForTile[ut.key];zv(Dt,Ot)&&Sp.newMorphing(ut.key,Dt,Ot,H,250),t0(T,lt.emissiveTexture),Y.activeTexture.set(ee.TEXTURE0),lt.texture&<.texture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE);const Wt=Sp.getMorphValuesForProxy(ut.key),Gt=Wt?1:0;let sr;Wt&&(sr={morphing:{srcDemTile:Wt.from,dstDemTile:Wt.to,phase:i.dD(Wt.phase)}});const _r=T.emissiveMode==="mrt-fallback"?1:0,$t=Mu(ut.projMatrix,c5(ut.canonical,He.renderWorldCopies)?tt/10:tt,Ge,_r);if(ve(Gt),!de)continue;O.setupElevationDraw(lt,de,sr);const Tt=ut.toUnwrapped();ue&&ue.setupShadows(Tt,de),T.uploadCommonUniforms(Y,de,Tt,null,we),de.draw(T,bt,Ie,St,De,zn.backCCW,$t,"terrain_raster",O.gridBuffer,ft,yt)}}}}(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,j=this.painter.context,T=this.proxySourceCache,O=this.proxiedCoords[T.id],D=this._drapedRenderBatches.shift(),B=m.style.order,H=[];this._updateFBOs(m.emissiveMode==="mrt-fallback");let Y=0;for(const ee of O){const de=T.getTileByID(ee.proxyTileKey),ce=T.proxyCachedFBO[ee.key]?T.proxyCachedFBO[ee.key][d]:void 0,ue=ce!==void 0?T.renderCache[ce]:this.pool[Y++],we=ce!==void 0;if(de.texture=ue.tex,de.emissiveTexture=ue.emissiveTex,we&&!ue.dirty){H.push(de.tileID);continue}j.bindFramebuffer.set(ue.fb.framebuffer);const ve=j.gl;let De;ve.drawBuffers(m.emissiveMode==="mrt-fallback"?[ve.COLOR_ATTACHMENT0,ve.COLOR_ATTACHMENT1]:[ve.COLOR_ATTACHMENT0]),this.renderedToTile=!1,ue.dirty&&(j.clear({color:i.ao.transparent,stencil:0}),ue.dirty=!1);for(let Ie=D.start;Ie<=D.end;++Ie){const He=m.style._mergedLayers[B[Ie]];if(He.isHidden(m.transform.zoom))continue;const tt=m.style.getLayerSourceCache(He),Ge=tt?this.proxyToSource[ee.key][tt.id]:[ee];if(!Ge)continue;const bt=Ge;j.viewport.set([0,0,ue.fb.width,ue.fb.height]),De!==(tt?tt.id:null)&&(this._setupStencil(ue,Ge,He,tt),De=tt?tt.id:null),m.renderLayer(m,tt,He,bt)}if(ve.drawBuffers([ve.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Ie of this._pendingGroundEffectLayers){const He=m.style._mergedLayers[B[Ie]];if(He.isHidden(m.transform.zoom))continue;const tt=m.style.getLayerSourceCache(He),Ge=tt?this.proxyToSource[ee.key][tt.id]:[ee];if(!Ge)continue;const bt=Ge;j.viewport.set([0,0,ue.fb.width,ue.fb.height]),De!==(tt?tt.id:null)&&(this._setupStencil(ue,Ge,He,tt),De=tt?tt.id:null),m.renderLayer(m,tt,He,bt)}this.renderedToTile?(ue.dirty=!0,H.push(de.tileID)):we||--Y,Y===5&&(Y=0,this.renderToBackBuffer(H))}return this.renderToBackBuffer(H),this.renderingToTexture=!1,j.bindFramebuffer.set(null),j.viewport.set([0,0,m.width,m.height]),D.end+1}postRender(){}isLayerOrderingCorrect(d){const m=d.order.length;let j=-1,T=m;for(let O=0;Oj}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,j){if(!this._visibleDemTiles)return null;const T=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 T){if(O.t==null)return null;const D=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,m,j);if(D!=null)return D}return null}_createFBO(){const d=this.painter.context,m=d.gl,j=this.drapeBufferSize;d.activeTexture.set(m.TEXTURE0);const T=new i.T(d,{width:j[0],height:j[1],data:null},m.RGBA8);T.bind(m.LINEAR,m.CLAMP_TO_EDGE);const O=d.createFramebuffer(j[0],j[1],1,null);let D;return O.colorAttachment0.set(T.texture),this._emissiveTexture&&(D=new i.T(d,{width:j[0],height:j[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 kP(d,O.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,j[0],j[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:T,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 j=d.fb,T=this.painter.context,O=T.gl,D=this.drapeBufferSize;if(m){const B=new i.T(T,{width:D[0],height:D[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,j.createColorAttachment(T,1),j.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,j.removeColorAttachment(T,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const m=this._style._mergedLayers[d],j=m.isHidden(this.painter.transform.zoom);return m.type==="hillshade"||m.type==="custom"?!j&&m.shouldRedrape():!j&&m.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const j of this._style.getSources())if(j instanceof wf){d=!0;break}if(!d)return;const m={};for(let j=0;jH>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=j}_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=j[D];if(m.getTileByID(B.key),m.proxyCachedFBO[B.key]!==void 0){const H=d[B.key],Y=this.proxyToSource[B.key];let ee=0;for(const de in Y){const ce=Y[de],ue=H[de];if(!ue||ue.length!==ce.length||ce.some((we,ve)=>we!==ue[ve]||T[de]&&T[de].hasOwnProperty(we.key))){ee=-1;break}++ee}for(const de in m.proxyCachedFBO[B.key])m.renderCache[m.proxyCachedFBO[B.key][de]].dirty=ee<0||ee!==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 j){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,j,T){if(!T||!this._sourceTilesOverlap[T.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(j.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,j.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):Un.disabled}_renderTileClippingMasks(d,m){const j=this.painter,T=this.painter.context,O=T.gl;j._tileClippingMaskIDs={},T.setColorMode(ls.disabled),T.setDepthMode(un.disabled);const D=j.getOrCreateProgram("clippingMask");for(const B of d){const H=j._tileClippingMaskIDs[B.key]=--m;D.draw(j,O.TRIANGLES,un.disabled,new Un({func:O.ALWAYS,mask:0},H,255,O.KEEP,O.KEEP,O.REPLACE),ls.disabled,zn.disabled,Bv(B.projMatrix),"$clipping",j.tileExtentBuffer,j.quadTriangleIndexBuffer,j.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 j=[d.x,d.y,1,1];i.aC(j,j,m.pixelMatrixInverse),i.cK(j,j,1/j[3]),j[0]/=m.worldSize,j[1]/=m.worldSize;const T=m._camera.position,O=i.cf(1,m.center.lat),D=[T[0],T[1],T[2]/O,0],B=i.da([],j.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,j){if(d.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(d,m,j);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const T=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let H=0;Hee.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,m,j){if(!d.getSource().loaded())return;const T=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<(de.min.x=Math.min(de.min.x,ce.x-H.x),de.min.y=Math.min(de.min.y,ce.y-H.y),de.max.x=Math.max(de.max.x,ce.x-H.x),de.max.y=Math.max(de.max.y,ce.y-H.y),de),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),ee=(de,ce)=>{const ue=de.wrap+de.canonical.x/(1<De+Y.max.x||we+veIe+Y.max.y};for(let de=0;deD.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;T=i.bC();const Y=m.tileID.wrap-d.wrap<0?(D=i.al>>O,B=D*((m.tileID.canonical.x<=de){const ce=d.canonical.z-de;m.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,m.transform.tileZoom),D=new i.aQ(B,d.wrap,de,d.canonical.x>>ce,d.canonical.y>>ce)):ce!==0&&(B=de,D=new i.aQ(B,d.wrap,de,d.canonical.x>>ce,d.canonical.y>>ce))}D.key!==d.key&&(Y.push(D.key),j=m.getTile(D))}const ee=de=>{Y.forEach(ce=>{T[ce]=de}),Y.length=0};for(B-=1;B>=H&&(!j||!j.hasData());B--){j&&ee(j.tileID.key);const de=D.calculateScaledKey(B);if(j=m.getTileByID(de),j&&j.hasData())break;const ce=T[de];if(ce===null)break;ce===void 0?Y.push(de):j=m.getTileByID(ce)}return ee(j?j.tileID.key:null),j&&j.hasData()?j:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,m){let j=this._tilesDirty[d];j||(j=this._tilesDirty[d]={}),j[m.key]=!0}}function r0(b,d,m){const j=function(B,H,Y){const ee=i.bJ(H,B),de=i.bJ(Y,[.2126,.7152,.0722]),ce=(we,ve,De)=>(1-De)*we+De*ve,ue=ce(1-.3*Math.min(de,1),1,Math.min(ee+1,1));return ce(.92,1,Math.asin(i.aA(H[2],-1,1))/Math.PI+.5)*ue}(b,[0,0,1],d),T=[0,0,0];i.c5(T,m.slice(0,3),j);const O=[0,0,0];i.c5(O,d.slice(0,3),b[2]);const D=[0,0,0];return i.d8(D,T,O),i.db(D)}const _ie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],bie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class NP{static cacheKey(d,m,j,T){const O=[m];T&&O.push(T.cacheKey);for(const D of j)d.usedDefines.has(D)&&O.push(D);return O.join("/")}constructor(d,m,j,T,O,D){const B=d.gl;this.program=B.createProgram(),this.configuration=T,this.name=m,this.fixedDefines=[...D];const H=`#version 300 es ${(T?T.defines():[]).concat(D.map(ve=>`#define ${ve}`)).join(` `)}`,Y=[H,uie];for(const ve of j.fragmentIncludes)Y.push(qm[ve]);Y.push(j.fragmentSource);const ee=Y.join(` `),de=[H,mP];for(const ve of j.vertexIncludes)de.push(qm[ve]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&j.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&de.push("uniform int u_instanceID;"),de.push(j.vertexSource);let ce=de.join(` `);this.forceManualRenderingForInstanceIDShaders&&(ce=ce.replaceAll("gl_InstanceID","u_instanceID"));const ue=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(ue,ee),B.compileShader(ue),B.attachShader(this.program,ue);const we=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(we,ce),B.compileShader(we),B.attachShader(this.program,we),this.attributes={},B.linkProgram(this.program),B.deleteShader(we),B.deleteShader(ue),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=T?T.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 j=this.attributes[m];return j===void 0&&(j=this.attributes[m]=d.getAttribLocation(this.program,m)),j}setTerrainUniformValues(d,m){if(!this.terrainUniforms)return;const j=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const T in m)j[T]&&j[T].set(this.program,T,m[T])}}setGlobeUniformValues(d,m){if(!this.globeUniforms)return;const j=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const T in m)j[T]&&j[T].set(this.program,T,m[T])}}setFogUniformValues(d,m){if(!this.fogUniforms)return;const j=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const T in m)j[T].set(this.program,T,m[T])}}setCutoffUniformValues(d,m){if(!this.cutoffUniforms)return;const j=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const T in m)j[T].set(this.program,T,m[T])}}setLightsUniformValues(d,m){if(!this.lightsUniforms)return;const j=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const T in m)j[T].set(this.program,T,m[T])}}setShadowUniformValues(d,m){if(this.failedToCreate||!this.shadowUniforms)return;const j=this.shadowUniforms;d.program.set(this.program);for(const T in m)j[T].set(this.program,T,m[T])}_drawDebugWireframe(d,m,j,T,O,D,B,H,Y,ee){const de=d.options.wireframe;if(de.terrain===!1&&de.layers2D===!1&&de.layers3D===!1)return;const ce=d.context;if(!(!(!de.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!de.layers2D||d._terrain&&d._terrain.renderingToTexture||!_ie.includes(this.name))||!(!de.layers3D||!bie.includes(this.name))))return;const ue=ce.gl,we=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,ce);if(!we)return;const ve=[...this.fixedDefines,"DEBUG_WIREFRAME"],De=d.getOrCreateProgram(this.name,{config:this.configuration,defines:ve});ce.program.set(De.program);const Ie=(Ge,bt,ft)=>{if(bt[Ge]&&ft[Ge])for(const yt in bt[Ge])ft[Ge][yt]&&ft[Ge][yt].set(ft.program,yt,bt[Ge][yt].current)};Y&&Y.setUniforms(De.program,ce,De.binderUniforms,B,{zoom:H}),Ie("fixedUniforms",this,De),Ie("terrainUniforms",this,De),Ie("globeUniforms",this,De),Ie("fogUniforms",this,De),Ie("lightsUniforms",this,De),Ie("shadowUniforms",this,De),we.bind(),ce.setColorMode(new ls([ue.ONE,ue.ONE_MINUS_SRC_ALPHA,ue.ZERO,ue.ONE],i.ao.transparent,[!0,!0,!0,!1])),ce.setDepthMode(new un(m.func===ue.LESS?ue.LEQUAL:m.func,un.ReadOnly,m.range)),ce.setStencilMode(Un.disabled);const He=3*D.primitiveLength*2,tt=3*D.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ge=ee||1;for(let bt=0;bt1?ue.drawElementsInstanced(ue.LINES,He,ue.UNSIGNED_SHORT,tt,ee):ue.drawElements(ue.LINES,He,ue.UNSIGNED_SHORT,tt);O.bind(),ce.program.set(this.program),ce.setDepthMode(m),ce.setStencilMode(j),ce.setColorMode(T)}checkUniforms(d,m,j){if(this.fixedDefines.includes(m)){for(const T of Object.keys(j))if(!j[T].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${T} not set but required by ${m} being defined`)}}draw(d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De){const Ie=d.context,He=Ie.gl;if(this.failedToCreate)return;Ie.program.set(this.program),Ie.setDepthMode(j),Ie.setStencilMode(T),Ie.setColorMode(O),Ie.setCullFace(D);for(const[ut,lt]of this.fixedUniformsEntries)lt.set(this.program,ut,B[ut]);we&&we.setUniforms(this.program,Ie,this.binderUniforms,ce,{zoom:ue});const tt={[He.POINTS]:1,[He.LINES]:2,[He.TRIANGLES]:3,[He.LINE_STRIP]:1}[m];this.checkUniforms(H,"RENDER_SHADOWS",this.shadowUniforms);const Ge=ve||[],bt=we?we.getPaintVertexBuffers():[],ft=m===He.TRIANGLES&&ee,yt=De&&De>0?1:void 0;for(const ut of de.get()){const lt=ut.vaos||(ut.vaos={});if((lt[H]||(lt[H]=new hie)).bind(Ie,this,Y,bt,ee,ut.vertexOffset,Ge,yt),this.forceManualRenderingForInstanceIDShaders){const St=De||1;for(let Dt=0;Dt1?He.drawElementsInstanced(m,ut.primitiveLength*tt,He.UNSIGNED_SHORT,ut.primitiveOffset*tt*2,De):ee?He.drawElements(m,ut.primitiveLength*tt,He.UNSIGNED_SHORT,ut.primitiveOffset*tt*2):He.drawArrays(m,ut.vertexOffset,ut.vertexLength);ft&&this._drawDebugWireframe(d,j,T,O,ee,ut,ce,ue,we,De)}}}function SP(b,d,m=0){const j=Math.pow(2,d.tileID.overscaledZ),T=d.tileSize*Math.pow(2,b.transform.tileZoom)/j,O=T*(d.tileID.canonical.x+d.tileID.wrap*j),D=T*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 eN={terrain:0,flat:1},wie=i.bC(),tN=(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie)=>{const He=d.style.light,tt=He.properties.get("position"),Ge=[tt.x,tt.y,tt.z],bt=i.dO();He.properties.get("anchor")==="viewport"&&(i.dP(bt,-d.transform.angle),i.dQ(Ge,Ge,bt));const ft=He.properties.get("color").toPremultipliedRenderColor(null),yt=d.transform,ut={u_matrix:b,u_lightpos:Ge,u_lightintensity:He.properties.get("intensity"),u_lightcolor:[ft.r,ft.g,ft.b],u_vertical_gradient:+m,u_opacity:j,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:wie,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:eN[Y],u_base_type:eN[ee],u_ao:T,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:Ie};return yt.projection.name==="globe"&&(ut.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:b,u_edge_radius:d,u_width_scale:m,u_vertical_scale:j,u_height_type:eN[T],u_base_type:eN[O]}),CP=(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie)=>{const He=tN(b,d,m,j,T,O,D,B,Y,ee,de,ce,ue,we,ve,De,1,[0,0,0]),tt={u_height_factor:-Math.pow(2,B.overscaledZ)/H.tileSize/8};return Object.assign(He,SP(d,H,Ie),tt)},n0=(b,d,m,j,T,O,D,B,H,Y,ee)=>({u_matrix:d,u_opacity:m,u_ao_pass:j?1:0,u_meter_to_tile:T,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:ee,u_dynamic_offset:1}),p5=(b,d,m)=>({u_matrix:b,u_emissive_strength:d,u_ground_shadow_factor:m}),m5=(b,d,m,j,T,O=0)=>Object.assign(p5(b,d,T),SP(m,j,O)),MP=(b,d,m,j)=>({u_matrix:b,u_world:m,u_emissive_strength:d,u_ground_shadow_factor:j}),g5=(b,d,m,j,T,O,D=0)=>Object.assign(m5(b,d,m,j,O,D),{u_world:T}),Hm=(b,d)=>({u_matrix:b,u_ground_shadow_factor:d}),ix=(b,d,m,j,T)=>({u_matrix:b,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:m,u_height_scale:j,u_reset_depth:T}),rN=(b,d,m,j,T,O,D,B,H)=>({u_matrix:b,u_normal_matrix:d,u_opacity:m,u_faux_facade_ao_intensity:j,u_camera_pos:T,u_tile_to_meter:O,u_facade_emissive_chance:D,u_flood_light_color:B,u_flood_light_intensity:H}),TP=b=>({u_matrix:b}),Wm=b=>({u_matrix:b}),x5=(b,d,m,j,T,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:j,u_tile_id:D,u_merc_center:T}},Uv=(b,d,m=1)=>({u_matrix:b,u_color:d,u_overlay:0,u_overlay_scale:m}),AP=i.bC(),EP=(b,d,m,j,T,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),ee={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:D,u_inv_rot_matrix:AP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(H){ee.u_inv_rot_matrix=j,ee.u_merc_center=T,ee.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:b,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:j,u_grid_matrix:T,u_tl_parent:O,u_scale_parent:Y,u_fade_t:ee.mix,u_opacity:ee.opacity*de.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:de.paint.get("raster-brightness-min"),u_brightness_high:de.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(de.paint.get("raster-saturation")),u_contrast_factor:i.dS(de.paint.get("raster-contrast")),u_spin_weights:PP(de.paint.get("raster-hue-rotate")),u_perspective_transform:ce,u_raster_elevation:ue,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:H,u_colorization_mix:nN(i.dU,ve,Ie),u_colorization_offset:sN(i.dU,De,Ie),u_color_ramp:we,u_texture_offset:[tt/(He+2*tt),He/(He+2*tt)],u_texture_res:[He+2*tt,He+2*tt],u_emissive_strength:Ge});function PP(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 Mf=.05,jie=(b,d,m,j,T,O,D,B,H,Y,ee,de)=>({u_matrix:b,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:j,u_grid_matrix:T,u_tl_parent:O,u_scale_parent:Y,u_fade_t:ee.mix,u_opacity:ee.opacity,u_image0:0,u_image1:1,u_raster_elevation:de,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:H}),kie=(b,d,m,j,T,O,D,B,H,Y)=>({u_particle_texture:b,u_particle_texture_side_len:d,u_tile_offset:m,u_velocity:j,u_color_ramp:O,u_velocity_res:T,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:[Mf,Mf]}),LP=(b,d,m,j,T,O,D,B,H,Y)=>({u_particle_texture:b,u_particle_texture_side_len:d,u_velocity:m,u_velocity_res:j,u_max_speed:T,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:[Mf,Mf]}),OP=i.bC(),aN=(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie,He,tt,Ge,bt,ft,yt)=>{const ut=T.transform,lt={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:ut.getCameraToCenterDistance(He),u_rotate_symbol:+m,u_aspect_ratio:ut.width/ut.height,u_fade_change:T.options.fadeDuration?T.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:+j,u_texsize:ee,u_texsize_icon:de,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:OP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:OP,u_up_vector:[0,-1,0],u_color_adj_mat:bt,u_icon_transition:ft||0,u_gamma_scale:j?T.transform.getCameraToCenterDistance(He)*Math.cos(T.terrain?0:T.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:yt||1,u_ground_shadow_factor:tt,u_inv_matrix:i.bl(i.bC(),D),u_normal_scale:Ge,u_lutTexture:Tl.LUT};return He.name==="globe"&&(lt.u_tile_id=[ue.canonical.x,ue.canonical.y,1<({u_matrix:b,u_emissive_strength:d,u_opacity:m,u_color:j}),Gm=(b,d,m,j,T,O,D,B,H)=>Object.assign(function(Y,ee,de,ce,ue,we){const{width:ve,height:De}=ce.imageManager.getPixelSize(ee),Ie=Math.pow(2,we.tileID.overscaledZ),He=we.tileSize*Math.pow(2,ce.transform.tileZoom)/Ie,tt=He*(we.tileID.canonical.x+we.tileID.wrap*Ie),Ge=He*we.tileID.canonical.y;return{u_image:0,u_pattern_tl:de.tl,u_pattern_br:de.br,u_texsize:[ve,De],u_pattern_size:de.displaySize,u_pattern_units_to_pixels:ue?[ce.transform.width,-1*ce.transform.height]:[1/i.ay(we,1,ce.transform.tileZoom),1/i.ay(we,1,ce.transform.tileZoom)],u_pixel_coord_upper:[tt>>16,Ge>>16],u_pixel_coord_lower:[65535&tt,65535&Ge]}}(0,O,D,j,B,H),{u_matrix:b,u_emissive_strength:d,u_opacity:m}),s0=new Float32Array(i.bA([])),ox=(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue=[0,0,0],we,ve,De)=>{const Ie=T.style.light,He=Ie.properties.get("position"),tt=[-He.x,-He.y,He.z],Ge=i.dO();Ie.properties.get("anchor")==="viewport"&&(i.dP(Ge,-T.transform.angle),i.dQ(tt,tt,Ge));const bt=ee.alphaMode==="MASK",ft=Ie.properties.get("color").toNonPremultipliedRenderColor(null),yt=ce.paint.get("model-ambient-occlusion-intensity"),ut=ce.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return ut.a=ce.paint.get("model-color-mix-intensity").constantOr(0),De&&(ut.r=De[0],ut.g=De[1],ut.b=De[2],ut.a=De[3]),ve&&(ut.r=ve.color.r,ut.g=ve.color.g,ut.b=ve.color.b,ut.a=ve.colorMix,de=ve.emissionStrength,O*=ve.opacity),{u_matrix:b,u_lighting_matrix:d,u_normal_matrix:m,u_node_matrix:j||s0,u_lightpos:tt,u_lightintensity:Ie.properties.get("intensity"),u_lightcolor:[ft.r,ft.g,ft.b],u_camera_pos:ue,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+bt,u_alphaCutoff:ee.alphaCutoff,u_baseColorFactor:D.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:H,u_roughnessFactor:Y,u_baseColorTexture:Tl.BaseColor,u_metallicRoughnessTexture:Tl.MetallicRoughness,u_normalTexture:Tl.Normal,u_occlusionTexture:Tl.Occlusion,u_emissionTexture:Tl.Emission,u_lutTexture:Tl.LUT,u_color_mix:ut.toArray01(),u_aoIntensity:yt,u_emissive_strength:de,u_occlusionTextureTransform:we||[0,0,0,0]}},y5=(b,d=s0,m=s0)=>({u_matrix:b,u_instance:d,u_node_matrix:m}),iN={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 Bh{constructor(d,m,j,T){this.id=Bh.uniqueIdxCounter,Bh.uniqueIdxCounter++,this.context=d;const O=d.gl;this.buffer=O.createBuffer(),this.dynamicDraw=!!j,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||T||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Bh.uniqueIdxCounter,Bh.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)}}Bh.uniqueIdxCounter=0;const v5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class DP{constructor(d,m,j,T,O,D){this.length=m.length,this.attributes=j,this.itemSize=m.bytesPerElement,this.dynamicDraw=T,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 j=0;j0&&d.vertexAttribDivisor(O,j)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class RP{constructor(d,m,j,T,O){this.context=d,this.width=m,this.height=j;const D=this.framebuffer=d.gl.createFramebuffer();T>0&&(this.colorAttachment0=new Zk(d,D,0)),T>1&&(this.colorAttachment1=new Zk(d,D,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new e0(d,D):new Fv(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 j=this.context.gl;let T;m===0?(T=this.colorAttachment0.get(),this.colorAttachment0=void 0):m===1&&(T=this.colorAttachment1.get(),this.colorAttachment1=void 0),T&&j.deleteTexture(T)}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 a0{constructor(d,m){this.gl=d,this.clearColor=new gie(this),this.clearDepth=new gP(this),this.clearStencil=new t5(this),this.colorMask=new Vk(this),this.depthMask=new r5(this),this.stencilMask=new ax(this),this.stencilFunc=new Yy(this),this.stencilOp=new Dv(this),this.stencilTest=new Xy(this),this.depthRange=new xP(this),this.depthTest=new n5(this),this.depthFunc=new yP(this),this.blend=new Qy(this),this.blendFunc=new Hk(this),this.blendColor=new Wk(this),this.blendEquation=new s5(this),this.cullFace=new Gk(this),this.cullFaceSide=new Rv(this),this.frontFace=new vP(this),this.program=new _P(this),this.activeTexture=new bP(this),this.viewport=new Jy(this),this.bindFramebuffer=new wP(this),this.bindRenderbuffer=new xie(this),this.bindTexture=new yie(this),this.bindVertexBuffer=new vie(this),this.bindElementBuffer=new a5(this),this.bindVertexArrayOES=new i5(this),this.pixelStoreUnpack=new o5(this),this.pixelStoreUnpackPremultiplyAlpha=new l5(this),this.pixelStoreUnpackFlipY=new jP(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,j){return new Bh(this,d,m,j)}createVertexBuffer(d,m,j,T,O){return new DP(this,d,m,j,T,O)}createRenderbuffer(d,m,j){const T=this.gl,O=T.createRenderbuffer();return this.bindRenderbuffer.set(O),T.renderbufferStorage(T.RENDERBUFFER,d,m,j),this.bindRenderbuffer.set(null),O}createFramebuffer(d,m,j,T){return new RP(this,d,m,j,T)}clear({color:d,depth:m,stencil:j,colorMask:T}){const O=this.gl;let D=0;d&&(D|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(T||[!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)),j!==void 0&&(D|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(j),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,ls.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 lx;function Jr(b,d,m,j,T,O,D){const B=b.context,H=B.gl,Y=b.transform,ee=[i.aF(Y.center.lng),i.aJ(Y.center.lat)],de=m.layout.get("symbol-placement"),ce=m.layout.get("text-variable-anchor"),ue=m.layout.get("icon-rotation-alignment")==="map",we=m.layout.get("text-rotation-alignment")==="map",ve=de!=="point",De=[];let Ie=0,He=0;for(let lt=0;lt0){const $r=i.bC(),Gr=Nr;i.cP($r,Ot.placementInvProjMatrix,Y.glCoordMatrix),i.cP($r,$r,Ot.placementViewportMatrix),De.push({circleArray:on,circleOffset:He,transform:Gr,invTransform:$r,projection:Ot.getProjection()}),Ie+=on.length/4,He=Ie}if(!br)continue;b.terrain&&b.terrain.setupElevationDraw(Dt,Hr);const en=dr?[St.canonical.x,St.canonical.y,1<=0&&(ue[tt.associatedIconIndex]={x:Ot,y:Wt,z:Gt,angle:Jt})}else Rh(ft,de)}if(Y){ce.clear();const He=b.icon.placedSymbolArray;for(let tt=0;tt{let ea=[0,0,0];if(ba){const ds=b.style.directionalLight,ci=b.style.ambientLight;ds&&ci&&(ea=Np(b.style,ds,ci))}return ea},oa=ba=>{lt.depthOcclusionForSymbolsAndCircles&&(m.hasOcclusionOpacityProperties||b.terrain)&&(ba.push("DEPTH_D24"),ba.push("DEPTH_OCCLUSION"))},Kn=ba=>{m.lut&&!ft&&(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],yt.gl.RGBA8)),yt.activeTexture.set(yt.gl.TEXTURE0+Tl.LUT),m.lut.texture&&m.lut.texture.bind(yt.gl.LINEAR,yt.gl.CLAMP_TO_EDGE),ba.push("APPLY_LUT_ON_GPU"))},_a=()=>{const ba=St&&m.layout.get("symbol-placement")!=="point",ea=[];oa(ea),Kn(ea);const ds=ba||Qn,ci=br.elevationType==="road",ro=b.shadowRenderer,Ri=ci&&Ot&&!!ro&&ro.enabled,Ga=dn(Ri),ud=ci&&Ot&&!b.terrain?$t:_r,dc=m.paint.get("icon-image-cross-fade");b.terrainRenderModeElevated()&&Ot&&ea.push("PITCH_WITH_MAP_TERRAIN"),on&&(ea.push("PROJECTION_GLOBE_VIEW"),ds&&ea.push("PROJECTED_POS_ON_VIEWPORT")),dc>0&&br.hasAnySecondaryIcon&&ea.push("ICON_TRANSITION"),!br.icon.zOffsetVertexBuffer||ci&&b.terrain||ea.push("Z_OFFSET"),Ie===0&&He===0&&tt===0&&Ge===1||ea.push("COLOR_ADJUSTMENT"),br.sdfIcons&&ea.push("RENDER_SDF"),Ri&&ea.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ci&&Ot&&!b.terrain&&br.icon.orientationVertexBuffer&&ea.push("ELEVATED_ROADS");const Go=br.icon.programConfigurations.get(m.id),Cc=b.getOrCreateProgram("symbol",{config:Go,defines:ea}),Mc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Wl=br.iconSizeData,Eu=i.bK(Wl,lt.zoom),dh=Ot||!lt.isOrthographic,Dd=yl($r,Nr.tileID.canonical,Ot,St,lt,br.getProjection(),Gr),Ki=wp($r,Nr.tileID.canonical,Ot,St,lt,br.getProjection(),Gr),lo=b.translatePosMatrix(Ki,Nr,B,Y,!0),Ka=b.translatePosMatrix($r,Nr,B,Y),wo=ds?Vv:Dd,Vi=St&&!Ot&&!ba;let Fi=Ar;!Vt&&!lt.mercatorFromTransition||St||(Fi=Cp(lt));const uh=on?Fi:Ar,n_=m.getColorAdjustmentMatrix(Ie,He,tt,Ge),qh=aN(Wl.kind,Eu,Vi,Ot,b,Ka,wo,lo,bt,!1,Mc,[0,0],0,Hr,en,Tt,Fs,uh,br.getProjection(),Ga,pa,n_,dc,null),s_=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,p0=m.layout.get("icon-size").constantOr(0)!==1||br.iconsNeedLinear,Pf=br.sdfIcons||b.options.rotating||b.options.zooming||p0||dh?ut.LINEAR:ut.NEAREST,Dp=br.sdfIcons&&m.paint.get("icon-halo-width").constantOr(1)!==0,m0=b.terrain&&Ot&&ba?i.bl(i.bC(),Dd):Vv;if(ba&&br.icon){const Jm=i.bV.getAtTileOffsetFunc(Hr,lt.center.lat,lt.worldSize,br.getProjection()),Rp=bp($r,Nr.tileID.canonical,Ot,St,lt,br.getProjection(),Gr),Vh=m.layout.get("icon-size-scale-range"),Fp=i.aA(b.scaleFactor,Vh[0],Vh[1]);oP(br,$r,b,!1,Rp,Ki,Ot,ve,Jm,Hr,Fp)}return{program:Cc,buffers:br.icon,uniformValues:qh,atlasTexture:s_,atlasTextureIcon:null,atlasInterpolation:Pf,atlasInterpolationIcon:null,isSDF:br.sdfIcons,hasHalo:Dp,depthMode:ud,tile:Nr,renderWithShadows:Ri,labelPlaneMatrixInv:m0}},za=()=>{const ba=Dt&&m.layout.get("symbol-placement")!=="point",ea=[],ds=ba||Jt||Qn,ci=br.elevationType==="road",ro=b.shadowRenderer,Ri=ci&&Wt&&!!ro&&ro.enabled,Ga=dn(Ri),ud=ci&&Wt&&!b.terrain?$t:_r;b.terrainRenderModeElevated()&&Wt&&ea.push("PITCH_WITH_MAP_TERRAIN"),on&&(ea.push("PROJECTION_GLOBE_VIEW"),ds&&ea.push("PROJECTED_POS_ON_VIEWPORT")),!br.text.zOffsetVertexBuffer||ci&&b.terrain||ea.push("Z_OFFSET"),br.iconsInText&&ea.push("RENDER_TEXT_AND_SYMBOL"),ea.push("RENDER_SDF"),Ri&&ea.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ci&&Wt&&!b.terrain&&br.text.orientationVertexBuffer&&ea.push("ELEVATED_ROADS"),oa(ea);const dc=br.text.programConfigurations.get(m.id),Go=b.getOrCreateProgram("symbol",{config:dc,defines:ea});let Cc,Mc=[0,0],Wl=null;const Eu=br.textSizeData;br.iconsInText&&(Mc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Wl=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,Cc=Wt||!lt.isOrthographic||b.options.rotating||b.options.zooming||Eu.kind==="composite"||Eu.kind==="camera"?ut.LINEAR:ut.NEAREST);const dh=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture.size:[0,0],Dd=m.layout.get("text-size-scale-range"),Ki=i.aA(b.scaleFactor,Dd[0],Dd[1]),lo=i.bK(Eu,lt.zoom,Ki),Ka=yl($r,Nr.tileID.canonical,Wt,Dt,lt,br.getProjection(),Gr),wo=wp($r,Nr.tileID.canonical,Wt,Dt,lt,br.getProjection(),Gr),Vi=b.translatePosMatrix(wo,Nr,H,ee,!0),Fi=b.translatePosMatrix($r,Nr,H,ee),uh=ds?Vv:Ka,n_=Dt&&!Wt&&!ba;let qh=Ar;!Vt&&!lt.mercatorFromTransition||Dt||(qh=Cp(lt));const s_=aN(Eu.kind,lo,n_,Wt,b,Fi,uh,Vi,bt,!0,dh,Mc,0,Hr,en,Tt,Fs,on?qh:Ar,br.getProjection(),Ga,pa,null,null,Ki),p0=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture:null,Pf=ut.LINEAR,Dp=m.paint.get("text-halo-width").constantOr(1)!==0,m0=b.terrain&&Wt&&ba?i.bl(i.bC(),Ka):Vv;if(ba&&br.text){const Jm=i.bV.getAtTileOffsetFunc(Hr,lt.center.lat,lt.worldSize,br.getProjection()),Rp=bp($r,Nr.tileID.canonical,Wt,Dt,lt,br.getProjection(),Gr);oP(br,$r,b,!0,Rp,wo,Wt,De,Jm,Hr,Ki)}return{program:Go,buffers:br.text,uniformValues:s_,atlasTexture:p0,atlasTextureIcon:Wl,atlasInterpolation:Pf,atlasInterpolationIcon:Cc,isSDF:!0,hasHalo:Dp,depthMode:ud,tile:Nr,renderWithShadows:Ri,labelPlaneMatrixInv:m0}},Aa=br.icon.segments.get().length,ia=br.text.segments.get().length,cs=Aa&&!D.onlyText?_a():null,xa=ia&&!D.onlyIcons?za():null,qi=m.paint.get("icon-opacity").constantOr(1),yi=m.paint.get("text-opacity").constantOr(1);if(Gt&&br.canOverlap){sr=!0;const ba=qi&&!D.onlyText?br.icon.segments.get():[],ea=yi&&!D.onlyIcons?br.text.segments.get():[];for(const ds of ba)dr.push({segments:new i.bg([ds]),sortKey:ds.sortKey,state:cs});for(const ds of ea)dr.push({segments:new i.bg([ds]),sortKey:ds.sortKey,state:xa})}else D.onlyText||dr.push({segments:qi?br.icon.segments:new i.bg([]),sortKey:0,state:cs}),D.onlyIcons||dr.push({segments:yi?br.text.segments:new i.bg([]),sortKey:0,state:xa})}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:lt.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Nr.labelPlaneMatrixInv}):b.setupDepthForOcclusion(lt.depthOcclusionForSymbolsAndCircles,Nr.program),yt.activeTexture.set(ut.TEXTURE0),Nr.atlasTexture&&Nr.atlasTexture.bind(Nr.atlasInterpolation,ut.CLAMP_TO_EDGE,!0),Nr.atlasTextureIcon&&(yt.activeTexture.set(ut.TEXTURE1),Nr.atlasTextureIcon&&Nr.atlasTextureIcon.bind(Nr.atlasInterpolationIcon,ut.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,_5(Nr.buffers,Hr.segments,m,b,Nr.program,Nr.depthMode,T,O,br,2),br.u_is_halo=0}else{if(Nr.isSDF){const br=Nr.uniformValues;Nr.hasHalo&&(br.u_is_halo=1,_5(Nr.buffers,Hr.segments,m,b,Nr.program,Nr.depthMode,T,O,br,1)),br.u_is_halo=0}_5(Nr.buffers,Hr.segments,m,b,Nr.program,Nr.depthMode,T,O,Nr.uniformValues,1)}}}function _5(b,d,m,j,T,O,D,B,H,Y){const ee=[b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer,b.iconTransitioningVertexBuffer,b.globeExtVertexBuffer,b.zOffsetVertexBuffer,b.orientationVertexBuffer];T.draw(j,j.context.gl.TRIANGLES,O,D,B,zn.disabled,H,m.id,b.layoutVertexBuffer,b.indexBuffer,d,m.paint,j.transform.zoom,b.programConfigurations.get(m.id),ee,Y)}function FP(b,d){const m=1<=zh?1:ue.pitch/zh))),2*we}(b.transform),Y=b.transform.getFreeCameraOptions().position,ee="elevatedStructuresDepthReconstruct",de=b.getOrCreateProgram(ee,{defines:["DEPTH_RECONSTRUCTION"]}),ce=b.getOrCreateProgram(ee);for(const ue of j){const we=d.getTile(ue),ve=we.getBucket(m);if(!ve)continue;const De=ve.elevatedStructures;if(!De)continue;const Ie=ve.elevationBufferData.heightRange,He=FP(ue.toUnwrapped(),Y),tt=b.translatePosMatrix(ue.projMatrix,we,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));let Ge,bt,ft,yt;if(T==="initialize"){if(!Ie||Ie.min>=1||De.depthSegments.segments[0].primitiveLength===0)continue;Ge=ix(tt,He,H,1,0),bt=D,ft=De.depthSegments,yt=de}else if(T==="reset"){if(!Ie||Ie.min>=0||De.maskSegments.segments[0].primitiveLength===0)continue;Ge=ix(tt,He,0,0,1),bt=B,ft=De.maskSegments,yt=de}else if(T==="geometry"){if(De.depthSegments.segments[0].primitiveLength===0)continue;Ge=ix(tt,He,H,1,0),bt=D,ft=De.depthSegments,yt=ce}yt.draw(b,O.TRIANGLES,bt,Un.disabled,ls.disabled,zn.disabled,Ge,m.id,De.vertexBuffer,De.indexBuffer,ft,m.paint,b.transform.zoom)}}function lN(b,d,m,j){const{painter:T,sourceCache:O,layer:D,coords:B,colorMode:H,elevationType:Y,terrainEnabled:ee,pass:de}=b,ce=T.context.gl,ue=D.paint.get("fill-pattern"),we=D.paint.get("fill-pattern-cross-fade"),ve=ue.constantOr(null);let De=Y;Y!=="road"||d&&!ee||(De="none");const Ie=De==="road",He=b.painter.shadowRenderer,tt=Ie&&!!He&&He.enabled,Ge=new un(T.context.gl.LEQUAL,un.ReadOnly,T.depthRangeFor3D);let bt=[0,0,0];if(tt){const lt=T.style.directionalLight,St=T.style.ambientLight;lt&&St&&(bt=Np(T.style,lt,St))}const ft=ue&&ue.constantOr(1),yt=T.terrain&&T.terrain.renderingToTexture,ut=(lt,St)=>{let Dt,Ot,Wt,Gt,sr;St?(Dt=ft&&!D.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Wt=ce.LINES):(Dt=ft?"fillPattern":"fill",Wt=ce.TRIANGLES);for(const _r of B){const $t=O.getTile(_r);if(ft&&!$t.patternsLoaded())continue;const Tt=$t.getBucket(D);if(!Tt)continue;const Jt=d?Tt.elevationBufferData:Tt.bufferData;if(Jt.isEmpty())continue;T.prepareDrawTile();const Vt=Jt.programConfigurations.get(D.id),dr=T.isTileAffectedByFog(_r),Ar=[],Hr=[];Ie&&(Ar.push("ELEVATED_ROADS"),Hr.push(Jt.elevatedLayoutVertexBuffer)),tt&&Ar.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),yt&&m&&Ar.push("USE_MRT1"),ft&&(T.context.activeTexture.set(ce.TEXTURE0),$t.imageAtlasTexture&&$t.imageAtlasTexture.bind(ce.LINEAR,ce.CLAMP_TO_EDGE),Vt.updatePaintBuffers());let Nr=!1;if(ve&&$t.imageAtlas){const Gr=$t.imageAtlas,kn=i.e3.from(ve),Qn=kn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Fs=kn.getSecondary(),pa=Gr.patternPositions.get(Qn),dn=Fs?Gr.patternPositions.get(Fs.scaleSelf(i.o.devicePixelRatio).toString()):null;Nr=!!pa&&!!dn,pa&&Vt.setConstantPatternPositions(pa,dn)}we>0&&(Nr||Vt.getPatternTransitionVertexBuffer("fill-pattern"))&&Ar.push("FILL_PATTERN_TRANSITION");const br=T.getOrCreateProgram(Dt,{config:Vt,overrideFog:dr,defines:Ar}),on=T.translatePosMatrix(_r.projMatrix,$t,D.paint.get("fill-translate"),D.paint.get("fill-translate-anchor"));tt&&He.setupShadows($t.tileID.toUnwrapped(),br,"vector-tile");const en=D.paint.get("fill-emissive-strength");if(St){Gt=Jt.lineIndexBuffer,sr=Jt.lineSegments;const Gr=T.terrain&&T.terrain.renderingToTexture?T.terrain.drapeBufferSize:[ce.drawingBufferWidth,ce.drawingBufferHeight];Ot=Dt==="fillOutlinePattern"&&ft?g5(on,en,T,$t,Gr,bt,we):MP(on,en,Gr,bt)}else Gt=Jt.indexBuffer,sr=Jt.triangleSegments,Ot=ft?m5(on,en,T,$t,bt,we):p5(on,en,bt);T.uploadCommonUniforms(T.context,br,_r.toUnwrapped());let $r=lt;(Y==="road"&&!ee||Y==="offset")&&($r=Ge),br.draw(T,Wt,$r,j||T.stencilModeForClipping(_r),H,zn.disabled,Ot,D.id,Jt.layoutVertexBuffer,Gt,sr,D.paint,T.transform.zoom,Vt,Hr)}};T.renderPass===de&&ut(T.depthModeForSublayer(1,T.renderPass==="opaque"?un.ReadWrite:un.ReadOnly),!1),De==="none"&&T.renderPass==="translucent"&&D.paint.get("fill-antialias")&&ut(T.depthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,un.ReadOnly),!0)}function cN(b,d,m,j,T,O,D,B){m.resetLayerRenderingStats(b);const H=b.context,Y=H.gl,ee=b.transform,de=m.paint.get("fill-extrusion-pattern"),ce=m.paint.get("fill-extrusion-pattern-cross-fade"),ue=de.constantOr(null),we=de.constantOr(1),ve=m.paint.get("fill-extrusion-opacity"),De=b.style.enable3dLights(),Ie=m.paint.get(De&&!we?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),He=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Ie],tt=m.layout.get("fill-extrusion-edge-radius"),Ge=tt>0&&!m.paint.get("fill-extrusion-rounded-roof"),bt=Ge?0:tt,ft=ee.projection.name==="globe"?i.eb():0,yt=ee.projection.name==="globe",ut=yt?i.aj(ee.zoom):0,lt=[i.aF(ee.center.lng),i.aJ(ee.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),Ot=m.paint.get("fill-extrusion-flood-light-intensity"),Wt=m.paint.get("fill-extrusion-vertical-scale"),Gt=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=zm(b,m.paint.get("fill-extrusion-cutoff-fade-range")),Tt=[];let Jt;yt&&Tt.push("PROJECTION_GLOBE_VIEW"),He[0]>0&&Tt.push("FAUX_AO"),Ge&&Tt.push("ZERO_ROOF_RADIUS"),B&&Tt.push("HAS_CENTROID"),Ot>0&&Tt.push("FLOOD_LIGHT"),$t.shouldRenderCutoff&&Tt.push("RENDER_CUTOFF"),Gt&&Tt.push("RENDER_WALL_MODE");const Vt=b.renderPass==="shadow",dr=b.shadowRenderer,Ar=Vt&&!!dr,Hr=Vt?zn.disabled:zn.backCCW;b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!0);let Nr=[0,0,0];if(dr){const en=b.style.directionalLight,$r=b.style.ambientLight;en&&$r&&(Nr=Np(b.style,en,$r)),Vt||(Tt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),dr.useNormalOffset&&Tt.push("NORMAL_OFFSET")),Jt=Tt.concat(["SHADOWS_SINGLE_CASCADE"])}const br=Ar?"fillExtrusionDepth":we?"fillExtrusionPattern":"fillExtrusion",on=m.getLayerRenderingStats();for(const en of j){const $r=d.getTile(en),Gr=$r.getBucket(m);if(!Gr||Gr.projection.name!==ee.projection.name)continue;let kn=!1;dr&&(kn=dr.getMaxCascadeForTile(en.toUnwrapped())===0);const Qn=b.isTileAffectedByFog(en),Fs=Gr.programConfigurations.get(m.id);let pa=!1;if(ue&&$r.imageAtlas){const ia=$r.imageAtlas,cs=i.e3.from(ue),xa=cs.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),qi=cs.getSecondary(),yi=ia.patternPositions.get(xa),ba=qi?ia.patternPositions.get(qi.scaleSelf(i.o.devicePixelRatio).toString()):null;pa=!!yi&&!!ba,yi&&Fs.setConstantPatternPositions(yi,ba)}ce>0&&(pa||Fs.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Tt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const dn=b.getOrCreateProgram(br,{config:Fs,defines:kn?Jt:Tt,overrideFog:Qn});if(b.terrain&&b.terrain.setupElevationDraw($r,dn,{useMeterToDem:!0}),!Gr.centroidVertexBuffer){const ia=dn.getAttributeLocation(Y,"a_centroid_pos");ia!==-1&&Y.vertexAttrib2f(ia,0,0)}!Vt&&dr&&dr.setupShadows($r.tileID.toUnwrapped(),dn,"vector-tile"),we&&(b.context.activeTexture.set(Y.TEXTURE0),$r.imageAtlasTexture&&$r.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Fs.updatePaintBuffers());const oa=m.paint.get("fill-extrusion-vertical-gradient"),Kn=1/Gr.tileToMeter;let _a;if(Vt&&dr){if(Tp($r.tileID,Gr.maxHeight,b))continue;const ia=dr.calculateShadowPassMatrixFromTile($r.tileID.toUnwrapped());_a=f5(ia,bt,Kn,Wt,sr,_r)}else{const ia=b.translatePosMatrix(en.expandedProjMatrix,$r,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),cs=ee.projection.createInversionMatrix(ee,en.canonical);_a=we?CP(ia,b,oa,ve,He,bt,Kn,en,$r,ft,sr,_r,ut,lt,cs,Dt,Wt,ce):tN(ia,b,oa,ve,He,bt,Kn,en,ft,sr,_r,ut,lt,cs,Dt,Wt,Ot,Nr)}b.uploadCommonUniforms(H,dn,en.toUnwrapped(),null,$t);let za=Gr.segments;if(ee.projection.name==="mercator"&&!Vt&&(za=Gr.getVisibleSegments($r.tileID,b.terrain,b.transform.getFrustum(0)),!za.get().length))continue;if(on)if(Vt)for(const ia of za.get())on.numRenderedVerticesInShadowPass+=ia.primitiveLength;else for(const ia of za.get())on.numRenderedVerticesInTransparentPass+=ia.primitiveLength;const Aa=[];(b.terrain||B)&&Aa.push(Gr.centroidVertexBuffer),yt&&Aa.push(Gr.layoutVertexExtBuffer),Gt&&Aa.push(Gr.wallVertexBuffer),dn.draw(b,H.gl.TRIANGLES,T,O,D,Hr,_a,m.id,Gr.layoutVertexBuffer,Gr.indexBuffer,za,m.paint,b.transform.zoom,Fs,Aa)}b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!1)}class b5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Mp(b,d,m,j,T,O,D,B,H,Y,ee,de,ce,ue,we,ve,De,Ie,He,tt){const Ge=d.context,bt=Ge.gl,ft=d.transform,yt=d.transform.zoom,ut=[],lt=b.translate,St=b.translateAnchor,Dt=b.edgeRadius,Ot=zm(d,b.cutoffFadeRange);ee==="clear"?(ut.push("CLEAR_SUBPASS"),tt&&(ut.push("CLEAR_FROM_TEXTURE"),Ge.activeTexture.set(bt.TEXTURE0),tt.bind(bt.LINEAR,bt.CLAMP_TO_EDGE))):ee==="sdf"?ut.push("SDF_SUBPASS"):ee==="emissive"&&(ut.push("USE_MRT1"),Ge.activeTexture.set(bt.TEXTURE0),tt.bind(bt.LINEAR,bt.CLAMP_TO_EDGE)),Ie&&ut.push("HAS_CENTROID"),Ot.shouldRenderCutoff&&ut.push("RENDER_CUTOFF");const Wt=(Gt,sr,_r,$t,Tt)=>{let Jt=ut;sr.groundRadiusBuffer!=null&&(Jt=ut.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Vt=sr.programConfigurations.get(j.id),dr=d.isTileAffectedByFog(Gt),Ar=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Vt,defines:Jt,overrideFog:dr}),Hr=n0(d,$t,de,Y,Tt,[ce,ue*Tt],we,ve,De,yt>=17?0:Dt*Tt,tt?tt.size[0]:0),Nr=[];Ie&&Nr.push(sr.hiddenByLandmarkVertexBuffer),sr.groundRadiusBuffer!=null&&Nr.push(sr.groundRadiusBuffer),d.uploadCommonUniforms(Ge,Ar,Gt.toUnwrapped(),null,Ot),Ar.draw(d,Ge.gl.TRIANGLES,O,D,B,H,Hr,j.id,sr.vertexBuffer,sr.indexBuffer,_r,j.paint,yt,Vt,Nr)};for(const Gt of T){const sr=m.getTile(Gt),_r=sr.getBucket(j);if(!_r||_r.projection.name!==ft.projection.name||!_r.groundEffect||_r.groundEffect&&!_r.groundEffect.hasData())continue;const $t=_r.groundEffect,Tt=1/_r.tileToMeter;{const Jt=d.translatePosMatrix(Gt.projMatrix,sr,lt,St),Vt=$t.getDefaultSegment();Wt(Gt,$t,Vt,Jt,Tt)}if(He)for(let Jt=0;Jt<4;Jt++){const Vt=i.e9[Jt](Gt),dr=m.getTile(Vt);if(!dr)continue;const Ar=dr.getBucket(j);if(!Ar||Ar.projection.name!==ft.projection.name||!Ar.groundEffect||Ar.groundEffect&&!Ar.groundEffect.hasData())continue;const Hr=Ar.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 on=Hr.regionSegments[br];if(!on)continue;const en=new Float32Array(16);i.br(en,Gt.projMatrix,Nr),Wt(Gt,Hr,on,d.translatePosMatrix(en,sr,lt,St),Tt)}}}function Nie(b,d,m,j,T,O,D){j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const B=O?O.findDEMTileFor(m):null;if(!(B&&B.dem||D))return;O&&B&&B.dem&&j.selfDEMTileTimestamp!==B.dem._timestamp&&(j.borderDoneWithNeighborZ=[-1,-1,-1,-1],j.selfDEMTileTimestamp=B.dem._timestamp);const H=Ie=>new i.P(Math.ceil((Ie+i.ed)*i.ee),0),Y=Ie=>{const He=d.getSource().minzoom,tt=bt=>{const ft=d.getTileByID(bt);if(ft&&ft.hasData())return ft.getBucket(T)},Ge=[0,-1,1];for(const bt of Ge){if(Ie.overscaledZ+bt(ee[0]=Math.min(Ie.min.y,He.min.y),ee[1]=Math.max(Ie.max.y,He.max.y),ee[2]=i.al-He.min.x>Ie.max.x?He.min.x-i.al:Ie.max.x,ee),ce=(Ie,He)=>(ee[0]=Math.min(Ie.min.x,He.min.x),ee[1]=Math.max(Ie.max.x,He.max.x),ee[2]=i.al-He.min.y>Ie.max.y?He.min.y-i.al:Ie.max.y,ee),ue=[(Ie,He)=>de(Ie,He),(Ie,He)=>de(He,Ie),(Ie,He)=>ce(Ie,He),(Ie,He)=>ce(He,Ie)],we=(Ie,He,tt,Ge,bt,ft,yt)=>{if(!O)return 0;const ut=[[ft?tt:Ie,ft?Ie:tt,0],[ft?tt:He,ft?He:tt,0]],lt=yt<0?i.al+yt:yt,St=[ft?lt:(Ie+He)/2,ft?(Ie+He)/2:lt,0];return tt===0&&yt<0||tt!==0&&yt>0?O.getForTilePoints(bt,[St],!0,Ge):ut.push(St),O.getForTilePoints(m,ut,!0,B),Math.max(ut[0][2],ut[1][2],St[2])/O.exaggeration()};for(let Ie=0;Ie<4;Ie++){const He=j.borderFeatureIndices[Ie];if(He.length===0)continue;const tt=i.e9[Ie](m),Ge=Y(tt);if(!(Ge&&Ge instanceof i.ea))continue;const bt=O?O.findDEMTileFor(tt):null;if(!(bt&&bt.dem||D)||(O&&bt&&bt.dem&&j.borderDEMTileTimestamp[Ie]!==bt.dem._timestamp&&(j.borderDoneWithNeighborZ[Ie]=-1,j.borderDEMTileTimestamp[Ie]=bt.dem._timestamp),j.borderDoneWithNeighborZ[Ie]===Ge.canonical.z))continue;Ge.centroidVertexArray.length===0&&Ge.createCentroidsBuffer();const ft=(Ie<2?1:5)-Ie,yt=Ge.borderDoneWithNeighborZ[ft]!==j.canonical.z,ut=Ge.borderFeatureIndices[ft];let lt=0;if(j.canonical.z!==Ge.canonical.z){for(const St of He)j.showCentroid(j.featuresOnBorder[St]);if(yt)for(const St of ut)Ge.showCentroid(Ge.featuresOnBorder[St]);j.borderDoneWithNeighborZ[Ie]=Ge.canonical.z,Ge.borderDoneWithNeighborZ[ft]=j.canonical.z}for(const St of He){const Dt=j.featuresOnBorder[St],Ot=j.centroidData[Dt.centroidDataIndex],Wt=Dt.borders[Ie];let Gt;for(;ltWt[0]+3||sr[0]>Wt[0]-3)break;Ge.showCentroid(Gt),lt++}if(Gt&<Wt[1]-3)&&(_r++,++lt!==ut.length);)Gt=Ge.featuresOnBorder[ut[lt]];Gt=Ge.featuresOnBorder[ut[sr]];let $t=!1;if(_r>=1){const Vt=Gt.borders[ft];Math.abs(Wt[0]-Vt[0])<3&&Math.abs(Wt[1]-Vt[1])<3&&(_r=1,$t=!0,lt=sr+1)}else if(_r===0){j.showCentroid(Dt);continue}const Tt=Ge.centroidData[Gt.centroidDataIndex];D&&$t&&(((ve=Ot).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||Gt.intersectsCount()>1;if(_r>1)lt=sr,Ot.centroidXY=Tt.centroidXY=new i.P(0,0);else if(bt&&bt.dem&&!Jt){const Vt=ue[Ie](Ot,Tt),dr=Ie%2?i.al-1:0,Ar=we(Vt[0],Math.min(i.al-1,Vt[1]),dr,bt,tt,Ie<2,Vt[2]);Ot.centroidXY=Tt.centroidXY=H(Ar)}else Jt?Ot.centroidXY=Tt.centroidXY=new i.P(0,0):(Ot.centroidXY=j.encodeBorderCentroid(Dt),Tt.centroidXY=Ge.encodeBorderCentroid(Gt));j.writeCentroidToBuffer(Ot),Ge.writeCentroidToBuffer(Tt)}else j.showCentroid(Dt)}j.borderDoneWithNeighborZ[Ie]=Ge.canonical.z,Ge.borderDoneWithNeighborZ[ft]=j.canonical.z}var ve,De;(j.needsCentroidUpdate||!j.centroidVertexBuffer&&j.centroidVertexArray.length!==0)&&j.uploadCentroid(b)}const su=[1,0,0],w5=[0,1,0],cd=[0,0,1];function Tp(b,d,m){const j=m.transform,T=m.shadowRenderer;if(!T)return!0;const O=b.toUnwrapped(),D=j.tileSize*T._cascades[m.currentShadowCascade].scale;let B=d;if(j.elevation){const ve=j.elevation.getMinMaxForTile(b);ve&&(B+=ve.max)}const H=[...T.shadowDirection];H[2]=-H[2];const Y=T.computeSimplifiedTileShadowVolume(O,B,D,H);if(!Y)return!1;const ee=[su,w5,cd,H,[H[0],0,H[2]],[0,H[1],H[2]]],de=j.projection.name==="globe",ce=j.scaleZoom(D),ue=i.cB.fromInvProjectionMatrix(j.invProjMatrix,j.worldSize,ce,!de),we=T.getCurrentCascadeFrustum();return ue.intersectsPrecise(Y.vertices,Y.planes,ee)===0||we.intersectsPrecise(Y.vertices,Y.planes,ee)===0}function Wv(b){const{painter:d,source:m,layer:j,coords:T}=b;let O=b.defines;const D=d.context,B=d.renderPass==="shadow",H=d.renderPass==="light-beam",Y=d.shadowRenderer,ee=i.ef(d.transform.center.lat,d.transform.zoom),de=zm(d,j.paint.get("building-cutoff-fade-range"));de.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),b.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const ce of T){const ue=m.getTile(ce),we=ue.getBucket(j);if(!we)continue;Y&&Y.getMaxCascadeForTile(ce.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const ve=we.programConfigurations.get(j.id);let De,Ie,He,tt=d.translatePosMatrix(ce.expandedProjMatrix,ue,[0,0],"map");if(tt=i.cS(i.bC(),tt,[1,1,b.verticalScale]),B&&Y){if(Tp(ue.tileID,we.maxHeight*ee,d))continue;let bt=Y.calculateShadowPassMatrixFromTile(ue.tileID.toUnwrapped());bt=i.cS(i.bC(),bt,[1,1,b.verticalScale]),He=Wm(bt),De=Ie=d.getOrCreateProgram("buildingDepth",{config:ve,defines:O,overrideFog:!1})}else if(H)De=Ie=d.getOrCreateProgram("buildingBloom",{config:ve,defines:O,overrideFog:!1}),He=TP(tt);else{const bt=d.transform.calculatePosMatrix(ce.toUnwrapped(),d.transform.worldSize);i.cS(bt,bt,[1,1,b.verticalScale]);const ft=i.bC();i.cS(ft,bt,[1,-1,1/ee]),i.bl(ft,ft),i.eg(ft,ft);const yt=d.transform.getFreeCameraOptions().position,ut=1<{if(H){const yt=bt.entranceBloom;ft.draw(d,D.gl.TRIANGLES,b.depthMode,Un.disabled,b.blendMode,zn.disabled,He,j.id,yt.layoutVertexBuffer,yt.indexBuffer,yt.segmentsBucket,j.paint,d.transform.zoom,ve,[yt.layoutAttenuationBuffer,yt.layoutColorBuffer])}else{const yt=bt.segmentsBucket;let ut=[bt.layoutNormalBuffer,bt.layoutCentroidBuffer,bt.layoutColorBuffer,bt.layoutFloodLightDataBuffer];bt.layoutFacadePaintBuffer&&(ut=ut.concat([bt.layoutFacadeDataBuffer,bt.layoutFacadeVerticalRangeBuffer,bt.layoutFacadePaintBuffer])),ft.draw(d,D.gl.TRIANGLES,b.depthMode,Un.disabled,b.blendMode,B?zn.disabled:zn.backCW,He,j.id,bt.layoutVertexBuffer,bt.indexBuffer,yt,j.paint,d.transform.zoom,ve,ut)}};d.uploadCommonUniforms(D,Ie,ce.toUnwrapped(),null,de),we.buildingWithoutFacade&&Ge(we.buildingWithoutFacade,Ie),we.buildingWithFacade&&(De!==Ie&&d.uploadCommonUniforms(D,De,ce.toUnwrapped(),null,de),Ge(we.buildingWithFacade,De))}}function dN(b,d,m,j,T,O,D,B,H,Y,ee,de,ce){const ue=b.context.gl,we=b.depthModeForSublayer(1,un.ReadOnly,ue.LEQUAL,!0),ve=.1*(1-(De=ee))+3*De;var De;const Ie=b._showOverdrawInspector,He=de,tt=new b5;Ie||Mp(tt,b,d,m,j,we,new Un({func:ue.ALWAYS,mask:255},255,255,ue.KEEP,ue.KEEP,ue.REPLACE),new ls([ue.ONE,ue.ONE,ue.ONE,ue.ONE],i.ao.transparent,[!1,!1,!1,!0],ue.MIN),zn.disabled,T,"sdf",O,D,B,H,Y,ve,He,!1);{const Ge=Ie?Un.disabled:new Un({func:ue.EQUAL,mask:255},255,255,ue.KEEP,ue.DECR,ue.DECR),bt=Ie?b.colorModeForRenderPass():new ls([ue.ONE_MINUS_DST_ALPHA,ue.DST_ALPHA,ue.ONE,ue.ONE],i.ao.transparent,[!0,!0,!0,!0]);Mp(tt,b,d,m,j,we,Ge,bt,zn.disabled,T,"color",O,D,B,H,Y,ve,He,!1)}}function uN(b){return[b[0]*i.eh,b[1]*i.eh,b[2]*i.eh,0]}function Gv(b,d,m,j,T,O,D,B,H){const Y=j.getSource(),ee=m.globeSharedBuffers;if(!ee)return;let de,ce,ue;if(d&&(de=j.getTile(d)),Y instanceof i.aU?(ce=Y.texture,ue=i.dK(0,0,m.transform)):de&&d&&(ce=de.texture,ue=i.dK(d.canonical.z,d.canonical.x,m.transform)),!ce||!ue)return;b||(ue=i.cS(i.bC(),ue,[1,-1,1]));const we=m.context,ve=we.gl,De=T.paint.get("raster-resampling")==="nearest"?ve.NEAREST:ve.LINEAR,Ie=m.colorModeForDrapableLayerRenderPass(O),He=D.defines;He.push("GLOBE_POLES");const tt=new un(ve.LEQUAL,un.ReadWrite,m.depthRangeFor3D),Ge=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),ce.bind(De,ve.CLAMP_TO_EDGE),we.activeTexture.set(ve.TEXTURE1),ce.bind(De,ve.CLAMP_TO_EDGE),"useMipmap"in ce&&we.extTextureFilterAnisotropic&&m.transform.pitch>20&&ve.texParameterf(ve.TEXTURE_2D,we.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,we.extTextureFilterAnisotropicMax);const[ft,yt,ut,lt]=d?ee.getPoleBuffers(d.canonical.z,!1):ee.getPoleBuffers(0,!0),St=T.paint.get("raster-elevation");let Dt;b?(Dt=ft,m.renderDefaultNorthPole=St!==0):(Dt=yt,m.renderDefaultSouthPole=St!==0);const Ot=uN(D.mix),Wt=((sr,_r,$t,Tt,Jt,Vt,dr,Ar,Hr,Nr,br,on,en)=>IP(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],Ar,2,Nr,br,on,1,0,en))(Ge,bt,ue,i.aj(m.transform.zoom),0,T,0,St,0,Ot,D.offset,D.range,O),Gt=m.getOrCreateProgram("raster",{defines:He});m.uploadCommonUniforms(we,Gt,null),Gt.draw(m,ve.TRIANGLES,tt,H,Ie,B,Wt,T.id,Dt,ut,lt)}function zP(b){const d=b._nearZ,m=b.projection.farthestPixelDistance(b),j=m-d,T=.2*b.height,O=d+T;return[d,m,(O-T-d)/j,(O-d)/j]}function Ap(b,d,m,j){if(b)return d instanceof cc&&b instanceof _p?d.getTextureDescriptor(b,m,!0):{texture:b.texture,mix:uN(j.mix),offset:j.offset,buffer:0,tileSize:1}}var si=i.ei([{name:"a_index",type:"Int16",components:1}]);class hN{constructor(d,m,j,T){const O={width:j[0],height:j[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,T),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 j=this.context.gl,T=m.width*m.height;this.particleTexture0=new i.T(this.context,m,j.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,m,j.RGBA8,{premultiply:!1,useMipmap:!1});const O=new i.ej;O.reserve(T);for(let D=0;D0){const Ot=i.bj(m.canonical,H),Wt=i.el(Ot);ce=i.aB(new Float32Array(16),H.globeMatrix,Wt),i.aB(ce,H.projMatrix,ce)}const ue=i.bC();ue[12]+=2*T/(i.o.devicePixelRatio*H.width),ue[13]+=2*O/(i.o.devicePixelRatio*H.height),i.aB(ce,ue,ce);const we=b.getOrCreateProgram("debug",{defines:de}),ve=d.getTileByID(m.key);b.terrain&&b.terrain.setupElevationDraw(ve,we);const De=un.disabled,Ie=Un.disabled,He=b.colorModeForRenderPass(),tt="$debug";B.activeTexture.set(Y.TEXTURE0),b.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),ee?ve._makeGlobeTileDebugBuffers(b.context,H):ve._makeDebugTileBoundsBuffers(b.context,H.projection);const Ge=ve._tileDebugBuffer||b.debugBuffer,bt=ve._tileDebugIndexBuffer||b.debugIndexBuffer,ft=ve._tileDebugSegments||b.debugSegments;if(we.draw(b,Y.LINE_STRIP,De,Ie,He,zn.disabled,Uv(ce,j.toPremultipliedRenderColor(null)),tt,Ge,bt,ft,null,null,null,[ve._globeTileDebugBorderBuffer]),D){const Ot=ve.latestRawTileData,Wt=Math.floor((Ot&&Ot.byteLength||0)/1024);let Gt=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(Gt+=` => ${m.overscaledZ}`),Gt+=` ${ve.state}`,Gt+=` ${Wt}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,Gt)}const yt=d.getTile(m).tileSize,ut=512/Math.min(yt,512)*(m.overscaledZ/H.zoom)*.5,lt=ve._tileDebugTextBuffer||b.debugBuffer,St=ve._tileDebugTextIndexBuffer||b.quadTriangleIndexBuffer,Dt=ve._tileDebugTextSegments||b.debugSegments;we.draw(b,Y.TRIANGLES,De,Ie,ls.alphaBlended,zn.disabled,Uv(ce,i.ao.transparent.toPremultipliedRenderColor(null),ut),tt,lt,St,Dt,null,null,null,[ve._globeTileDebugTextBuffer])}function ux(b,d,m,j){Ft(b,0,d+m/2,b.transform.width,m,j)}function Gi(b,d,m,j){Ft(b,d-m/2,0,m,b.transform.height,j)}function Ft(b,d,m,j,T,O){const D=b.context,B=D.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*i.o.devicePixelRatio,m*i.o.devicePixelRatio,j*i.o.devicePixelRatio,T*i.o.devicePixelRatio),D.clear({color:O}),B.disable(B.SCISSOR_TEST)}const VP=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:fN}=VP;function Tf(b,d,m,j){b.emplaceBack(d,m,j)}class pN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,Tf(this.vertexArray,-1,-1,1),Tf(this.vertexArray,1,-1,1),Tf(this.vertexArray,-1,1,1),Tf(this.vertexArray,1,1,1),Tf(this.vertexArray,-1,-1,-1),Tf(this.vertexArray,1,-1,-1),Tf(this.vertexArray,-1,1,-1),Tf(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,fN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function hx(b,d,m,j,T,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"),ee=((de,ce,ue,we,ve)=>({u_matrix_3f:de,u_sun_direction:ce,u_sun_intensity:ue,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(),j),T,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,un.disabled,Un.disabled,ls.unblended,zn.frontCW,ee,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const HP=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class i0{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 j=new i.b0;j.emplaceBack(0,1,2),j.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(m,HP.members),this.indexBuffer=d.createIndexBuffer(j),this.segments=i.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Sie=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 Cie{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class WP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new ls([1,Nf,1,Nf],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ls([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new Cie,this.updateNeeded=!0}update(d){const m=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new i0(m);const j=this.params.sizeRange,T=this.params.intensityRange,O=function(ee){const de=i.eq(30),ce=[];for(let ue=0;ue{const ut=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];yt&&ut.push("ALPHA_PASS");const lt=d.getOrCreateProgram("globeAtmosphere",{defines:ut}),St=((Ot,Wt,Gt,sr,_r,$t,Tt,Jt,Vt,dr,Ar,Hr)=>({u_frustum_tl:Ot,u_frustum_tr:Wt,u_frustum_br:Gt,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:Ar,u_horizon_angle:Hr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,De,ee,ce,we,He,bt);d.uploadCommonUniforms(j,lt);const Dt=this.atmosphereBuffer;Dt&<.draw(d,T.TRIANGLES,D,Un.disabled,yt?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,zn.backCW,St,yt?"atmosphere_glow_alpha":"atmosphere_glow",Dt.vertexBuffer,Dt.indexBuffer,Dt.segments)};ft(!1),ft(!0)}drawStars(d,m){const j=i.aA(m.properties.get("star-intensity"),0,1);if(j===0)return;const T=d.context,O=T.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),ee=i.aB([],D.starsProjMatrix,Y),de=i.eo([],Y),ce=i.eu([],de),ue=[0,1,0];i.dQ(ue,ue,ce),i.c5(ue,ue,this.params.sizeMultiplier);const we=[1,0,0];i.dQ(we,we,ce),i.c5(we,we,this.params.sizeMultiplier);const ve=(De=ue,Ie=we,He=j,{u_matrix:Float32Array.from(ee),u_up:De,u_right:Ie,u_intensity_multiplier:He});var De,Ie,He;d.uploadCommonUniforms(T,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,un.disabled,Un.disabled,this.colorModeAlphaBlendedWriteRGB,zn.disabled,ve,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class mN{constructor(){this.visibleTiles=[]}updateBorders(d,m){const j=[],T=[],O=d._getRenderableCoordinates(!1,!0);for(const H of O){const Y=d.getTile(H);if(!Y.hasData())continue;const ee=Y.getBucket(m);ee&&(ee.isEmpty()||(j.push(H.key),T.push({bucket:ee,tileID:H.canonical})))}let D=j.length!==this.visibleTiles.length;if(!D){j.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 T){const Y=new Array,ee=new Array,de=H.bucket;for(const ce of de.featuresOnBorder)B.has(ce.featureId)?ee.push(ce.footprintIndex):(B.add(ce.featureId),Y.push(ce.footprintIndex));de.updateFootprintHiddenFlags(Y,i.ev,!1),de.updateFootprintHiddenFlags(ee,i.ev,!0)}}}function gN(b,d){const m=[...b],j=d.cameraWorldSizeForFog/d.worldSize,T=i.bA([]);return i.cS(T,T,[j,j,1]),i.aB(m,T,m),i.aB(m,d.worldToFogMatrix,m),m}function xN(b,d,m,j,T){const O=m.material,D=j.context,{baseColorTexture:B,metallicRoughnessTexture:H}=O.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:ee,emissionTexture:de}=O;function ce(we,ve,De){if(we&&(b.push(ve),D.activeTexture.set(D.gl.TEXTURE0+De),we.gfxTexture)){const{minFilter:Ie,magFilter:He,wrapS:tt,wrapT:Ge}=we.sampler;we.gfxTexture.bindExtraParam(Ie,He,tt,Ge)}}ce(B,"HAS_TEXTURE_u_baseColorTexture",Tl.BaseColor),ce(H,"HAS_TEXTURE_u_metallicRoughnessTexture",Tl.MetallicRoughness),ce(Y,"HAS_TEXTURE_u_normalTexture",Tl.Normal),ce(ee,"HAS_TEXTURE_u_occlusionTexture",Tl.Occlusion),ce(de,"HAS_TEXTURE_u_emissionTexture",Tl.Emission),T&&(T.texture||(T.texture=new i.d$(j.context,T.image,[T.image.height,T.image.height,T.image.height],D.gl.RGBA8)),D.activeTexture.set(D.gl.TEXTURE0+Tl.LUT),T.texture&&T.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 ue=j.shadowRenderer;ue&&(b.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ue.useNormalOffset&&b.push("NORMAL_OFFSET"))}function yN(b,d,m,j,T,O){const D=b.modelOpacity,B=d.context,H=new un(d.context.gl.LEQUAL,b.isLightMesh?un.ReadOnly:un.ReadWrite,d.depthRangeFor3D),Y=d.transform,ee=b.mesh,de=ee.material,ce=de.pbrMetallicRoughness,ue=d.style.fog;let we;we=d.transform.projection.zAxisUnit==="pixels"?[...b.nodeModelMatrix]:i.aB([],j.zScaleMatrix,b.nodeModelMatrix),i.aB(we,j.negCameraPosMatrix,we);const ve=i.bl([],we);i.eg(ve,ve);const De=m.paint.get("model-color-use-theme").constantOr("default")==="none",Ie=m.paint.get("model-emissive-strength").constantOr(0),He=ox(new Float32Array(b.worldViewProjection),new Float32Array(we),new Float32Array(ve),null,d,D,ce.baseColorFactor,de.emissiveFactor,ce.metallicFactor,ce.roughnessFactor,de,Ie,m,void 0,void 0,b.materialOverride,b.modelColor),tt={defines:[]},Ge=[],bt=d.shadowRenderer;bt&&(bt.useNormalOffset=!1),xN(tt.defines,Ge,ee,d,De?null:m.lut);let ft=null;if(ue){const lt=gN(b.nodeModelMatrix,d.transform);if(ft=new Float32Array(lt),Y.projection.name!=="globe"){const St=ee.aabb.min,Dt=ee.aabb.max,[Ot,Wt]=ue.getOpacityForBounds(lt,St[0],St[1],Dt[0],Dt[1]);tt.overrideFog=Ot>=ar||Wt>=ar}}const yt=zm(d,m.paint.get("model-cutoff-fade-range"));yt.shouldRenderCutoff&&tt.defines.push("RENDER_CUTOFF");const ut=d.getOrCreateProgram("model",tt);d.uploadCommonUniforms(B,ut,null,ft,yt),d.renderPass!=="shadow"&&bt&&bt.setupShadowsFromMatrix(b.nodeModelMatrix,ut),ut.draw(d,B.gl.TRIANGLES,H,T,O,ee.material.doubleSided?zn.disabled:zn.backCCW,He,m.id,ee.vertexBuffer,ee.indexBuffer,ee.segments,m.paint,d.transform.zoom,void 0,Ge)}function Kv(b,d){return b.style._importedAsBasemap?"basemap":d.scope}function fx(b,d,m,j,T,O,D,B,H,Y){const ee=b.transform,de=!!d.isGeometryBloom&&d.isGeometryBloom;if(de&&b.renderPass==="shadow")return;const ce=ee.projection.name==="globe"?i.eD(m,ee):[...m];i.aB(ce,ce,d.globalMatrix);const ue=i.aB([],j,ce);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:T,worldViewProjection:ue,nodeModelMatrix:ce,isLightMesh:de,materialOverride:ve,modelOpacity:H,modelColor:Y});continue}const De=i.af([],we.centroid,ue);!ee.isOrthographic&&De[2]<=0||O.push({mesh:we,depth:De[2],modelIndex:T,worldViewProjection:ue,nodeModelMatrix:ce,isLightMesh:de,materialOverride:ve,modelOpacity:H,modelColor:Y})}if(d.children)for(const we of d.children)fx(b,we,m,j,T,O,D,B,H,Y)}function $h(b,d,m,j){const T=m.shadowRenderer;if(!T)return;const O=T.getShadowPassDepthMode(),D=T.getShadowPassColorMode(),B=T.calculateShadowPassMatrixFromMatrix(d),H=y5(B);m.getOrCreateProgram("modelDepth",{defines:m._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(m,m.context.gl.TRIANGLES,O,Un.disabled,D,zn.disabled,H,j.id,b.vertexBuffer,b.indexBuffer,b.segments,j.paint,m.transform.zoom,void 0,void 0)}function GP(b,d,m,j,T,O){for(const D of T){const B=Object.assign({},j);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 KP(b,d,m,j,T,O){for(const D of T){const B=Object.assign({},j);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 ZP(b,d,m,j,T){let O=!1;for(const B of j)B.modelOpacity!==1&&(yN(B,b,d,T[B.modelIndex],Un.disabled,ls.disabled),O=!0);for(const B of j)yN(B,b,d,T[B.modelIndex],B.modelOpacity!==1?b.stencilModeFor3D():Un.disabled,b.colorModeForRenderPass());O&&b.resetStencilClippingMasks();const D=ls.additive;for(const B of m)yN(B,b,d,T[B.modelIndex],Un.disabled,B.isLightMesh?D:b.colorModeForRenderPass())}function YP(b,d,m){const j=d.updateZoomBasedPaintProperties(),T=function(O,D,B){let H,Y,ee,de=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&de>0){const ce=O.terrain,ue=ce.findDEMTileFor(B);ue&&ue.dem?H=i.eF.create(ce,B,ue):de=0}if(de===0&&(D.terrainElevationMin=0,D.terrainElevationMax=0),de===D.validForExaggeration&&(de===0||H&&H._demTile&&H._demTile.tileID===D.validForDEMTile.id&&H._dem._timestamp===D.validForDEMTile.timestamp))return!1;for(const ce in D.instancesPerModel){const ue=D.instancesPerModel[ce];for(let we=0;weY&&(Y=ue.max)}const ee=i.aA(j.x,O,D)-j.x,de=i.aA(j.y,B,H)-j.y,ce=i.cf(Y,d.center.lat)-j.z;return d._zoomFromMercatorZ(Math.sqrt(ee*ee+de*de+ce*ce))}function XP(b,d,m,j,T,O,D){const B=b.context,H=b.renderPass==="shadow",Y=b.shadowRenderer,ee=H&&Y?Y.getShadowPassDepthMode():new un(B.gl.LEQUAL,un.ReadWrite,b.depthRangeFor3D),de=b.isTileAffectedByFog(O),ce=b.transform.projection.name==="globe";if(m.meshes)for(const ue of m.meshes){const we=ce?[]:["MODEL_POSITION_ON_GPU"],ve=[];let De,Ie,He;const tt=!ce&&j.instancedDataArray.length>20;tt&&we.push("INSTANCED_ARRAYS");const Ge=zm(b,d.paint.get("model-cutoff-fade-range"));if(Ge.shouldRenderCutoff&&we.push("RENDER_CUTOFF"),H&&Y)De=b.getOrCreateProgram("modelDepth",{defines:we}),Ie=y5(D.shadowTileMatrix,D.shadowTileMatrix,Float32Array.from(m.globalMatrix)),He=Y.getShadowPassColorMode();else{xN(we,ve,ue,b,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),De=b.getOrCreateProgram("model",{defines:we,overrideFog:de});const ft=ue.material,yt=ft.pbrMetallicRoughness,ut=d.paint.get("model-opacity").constantOr(1),lt=d.paint.get("model-emissive-strength").constantOr(0);Ie=ox(O.expandedProjMatrix,Float32Array.from(m.globalMatrix),new Float32Array(16),null,b,ut,yt.baseColorFactor,ft.emissiveFactor,yt.metallicFactor,yt.roughnessFactor,ft,lt,d,T),Y&&(D.shadowUniformsInitialized?De.setShadowUniformValues(B,Y.getShadowUniformValues()):(Y.setupShadows(O.toUnwrapped(),De,"model-tile"),D.shadowUniformsInitialized=!0)),He=Ge.shouldRenderCutoff||ut<1||ft.alphaMode!=="OPAQUE"?ls.alphaBlended:ls.unblended}b.uploadCommonUniforms(B,De,O.toUnwrapped(),null,Ge);const bt=ue.material.doubleSided?zn.disabled:zn.backCCW;if(tt)ve.push(j.instancedDataBuffer),De.draw(b,B.gl.TRIANGLES,ee,Un.disabled,He,bt,Ie,d.id,ue.vertexBuffer,ue.indexBuffer,ue.segments,d.paint,b.transform.zoom,void 0,ve,j.instancedDataArray.length);else{const ft=H?"u_instance":"u_normal_matrix";for(let yt=0;ytH[1]?D:H,O[0]=m.max[0],D=i.aC(i.eG(),O,T),B=D[1]H[1]?D:H,O[1]=m.min[1],D=i.aC(i.eG(),O,T),B=D[1]H[1]?D:H;const Y=i.aA(j[0],0,1),ee=100*d.pixelsPerMeter*i.aA(j[1],0,1),de=i.aA(j[2],0,1),ce=i.eH(i.eG(),B,H,Y),ue=Math.tan(.5*d.fovX),we=-ce[2]*ue;if(ee===0)return ce[1]<-Math.abs(we)?de:1;const ve=(-Math.abs(we)-ce[1])/ee,De=(He,tt,Ge)=>(1-Ge)*He+Ge*tt,Ie=i.aA(De(1,de,ve),de,1);return De(1,Ie,i.aA((d.pitch-20)/20,0,1))}class QP{}class Zm{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,m,j){{const de=this._storage.get(m.id);if(de)return de.lastUsedFrameIdx=d,de.buf}const T=j.gl,O=T.getBufferParameter(T.ELEMENT_ARRAY_BUFFER,T.BUFFER_SIZE),D=new ArrayBuffer(O),B=new Int16Array(D);T.getBufferSubData(T.ELEMENT_ARRAY_BUFFER,0,new Int16Array(D));const H=new i.eJ;for(let de=0;de30&&(j.buf.destroy(),this._storage.delete(m))}destroy(){for(const[d,m]of this._storage)m.buf.destroy(),this._storage.delete(d)}}class o0{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const l0=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 Ep{constructor(d){this.revealStart=11,this.revealRange=2}}const k5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class N5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,m){const j=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,k5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const T=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,j);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};j.draw(d,d.context.gl.TRIANGLES,un.disabled,Un.disabled,ls.alphaBlended,zn.disabled,D,"vignette",this.vignetteVx,this.vignetteIdx,T)}var O}}class S5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,m){const j=d.getFreeCameraOptions().position,T=j.toAltitude(),O=j.toLngLat(),D=i.an(O.lng),B=i.an(O.lat),H=d.pixelsPerMeter/m,Y=D*i.eM,ee=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 de=-this._offsetYPrev+ee,ce=-this._elevationPrev+T;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*H,this._accumulatedOffsetY+=de*H,this._accumulatedElevation+=ce*H,this._offsetXPrev=Y,this._offsetYPrev=ee,this._elevationPrev=T}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function vN(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 Tu(b){const d=i.eq(1323123451230),m=[];for(let j=0;j 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 j=Tu(this.particlesCount),T=new i.eN,O=new i.b0;let D=0;const B=i.eq(1323123451230);for(let H=0;Hj)return;const T=Ld(0,1,m.revealStart,m.revealStart+m.revealRange,j);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*=T,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,ee=Y.gl,de=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},ee.RGBA8)),O.distortionStrength>0&&(Y.activeTexture.set(ee.TEXTURE0),this.screenTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),ee.copyTexSubImage2D(ee.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const ce=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,ce),Y.activeTexture.set(ee.TEXTURE0),this.screenTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE);const ue=[O.color.r,O.color.g,O.color.b,O.color.a],we=(ve,De)=>{const Ie=vN(this._movement.getPosition(),ve),He=O.dropletSizeX,tt=O.dropletSizeX*O.dropletSizeYScale,Ge=d.width/2,bt=d.height/2,ft=Ld(0,O.screenThinning.start,0,1,O.screenThinning.intensity),yt=Ld(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),ut=Ld(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),lt=(St={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Ie,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:ve,rainDropletSize:[He,tt],distortionStrength:O.distortionStrength,rainDirection:D,color:ue,screenSize:[de.width,de.height],thinningCenterPos:[Ge,bt],thinningShape:[ft,yt,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:ut,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),Ot=i.bg.simpleSegment(0,0,4*Dt,2*Dt);ce.draw(d,ee.TRIANGLES,un.disabled,Un.disabled,ls.alphaBlended,zn.disabled,lt,"rain_particles",this.particlesVx,this.particlesIdx,Ot)};O.distortionStrength>0&&we(O.boxSize,!0),we(O.boxSize,!1),this._vignette.draw(d,B)}}const C5=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 M5 extends px{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 Ep("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 j=Tu(this.particlesCount),T=new i.eO,O=new i.b0;let D=0;const B=i.eq(1323123451230);for(let H=0;HD)return;const B=Ld(0,1,O.revealStart,O.revealStart+O.revealRange,D);T.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),j=structuredClone(d.style.snow.state.direction),m.screenThinning.intensity=d.style.snow.state.centerThinning,m.billboardSize=2.79*d.style.snow.state.flakeSize,T.strength=1,T.color=structuredClone(d.style.snow.state.vignetteColor));const H=this.updateOnRender(d,m.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,ee=Y.gl,de=d.transform,ce=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,ce),((ue,we,ve)=>{const De=vN(this._movement.getPosition(),ue),Ie=de.width/2,He=de.height/2,tt=Ld(0,ve.screenThinning.start,0,1,ve.screenThinning.intensity),Ge=Ld(.001,ve.screenThinning.range,0,1,ve.screenThinning.intensity),bt=Ld(0,ve.screenThinning.particleOffset,0,1,ve.screenThinning.intensity),ft=(yt={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:De,velocityConeAperture:ve.velocityConeAperture,velocity:ve.velocity,horizontalOscillationRadius:ve.horizontalOscillationRadius,horizontalOscillationRate:ve.horizontalOscillationRate,boxSize:ue,billboardSize:1*ve.billboardSize,simpleShapeParameters:[ve.shapeFadeStart,ve.shapeFadePower],screenSize:[de.width,de.height],thinningCenterPos:[Ie,He],thinningShape:[tt,Ge,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:j},{u_modelview:Float32Array.from(yt.modelview),u_projection:Float32Array.from(yt.projection),u_time:yt.time,u_cam_pos:yt.camPos,u_velocityConeAperture:yt.velocityConeAperture,u_velocity:yt.velocity,u_horizontalOscillationRadius:yt.horizontalOscillationRadius,u_horizontalOscillationRate:yt.horizontalOscillationRate,u_boxSize:yt.boxSize,u_billboardSize:yt.billboardSize,u_simpleShapeParameters:yt.simpleShapeParameters,u_screenSize:yt.screenSize,u_thinningCenterPos:yt.thinningCenterPos,u_thinningShape:yt.thinningShape,u_thinningAffectedRatio:yt.thinningAffectedRatio,u_thinningParticleOffset:yt.thinningParticleOffset,u_particleColor:yt.color,u_direction:yt.direction});var yt;const ut=Math.round(ve.intensity*this.particlesCount),lt=i.bg.simpleSegment(0,0,4*ut,2*ut);this.particlesVx&&this.particlesIdx&&ce.draw(d,ee.TRIANGLES,un.disabled,Un.disabled,ls.alphaBlended,zn.disabled,ft,"snow_particles",this.particlesVx,this.particlesIdx,lt)})(m.boxSize,0,m),this._vignette.draw(d,T)}}const Ym={symbol:function(b,d,m,j,T){if(b.renderPass!=="translucent")return;const O=Un.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(ce,ue,we,ve,De,Ie,He,tt){const Ge=ue.transform,bt=De==="map",ft=Ie==="map";for(const yt of ce){const ut=ve.getTile(yt),lt=ut.getBucket(we);if(!lt||!lt.text||!lt.text.segments.get().length)continue;const St=i.bK(lt.textSizeData,Ge.zoom,tt),Dt=Wn(yt,lt.getProjection(),Ge),Ot=Ge.calculatePixelsToTileUnitsMatrix(ut),Wt=yl(Dt,ut.tileID.canonical,ft,bt,Ge,lt.getProjection(),Ot),Gt=lt.hasIconTextFit()&<.hasIconData();St&&An(lt,bt,ft,He,Ge,Wt,yt,Math.pow(2,Ge.zoom-ut.tileID.overscaledZ),St,Gt)}}(j,b,m,d,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),T,Y);const ee=m.paint.get("icon-opacity").constantOr(1)!==0,de=m.paint.get("text-opacity").constantOr(1)!==0;m.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(ee||de)?Hv(b,d,m,j,O,D):(ee&&Hv(b,d,m,j,O,D,{onlyIcons:!0}),de&&Hv(b,d,m,j,O,D,{onlyText:!0})),d.map.showCollisionBoxes&&(Jr(b,d,m,j,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),Jr(b,d,m,j,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(b,d,m,j){if(b.renderPass!=="translucent")return;const T=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(T.constantOr(1)===0&&(O.constantOr(1)===0||D.constantOr(1)===0))return;const Y=b.context,ee=Y.gl,de=b.transform,ce=!(!b.terrain||!b.terrain.enabled),ue=m.layout.get("circle-elevation-reference"),we=b.depthModeForSublayer(0,un.ReadOnly),ve=new un(b.context.gl.LEQUAL,un.ReadOnly,b.depthRangeFor3D),De=ue==="none"||ce?we:ve,Ie=Un.disabled,He=b.colorModeForDrapableLayerRenderPass(H),tt=de.projection.name==="globe",Ge=[i.aF(de.center.lng),i.aJ(de.center.lat)],bt=[];for(let yt=0;ytyt.sortKey-ut.sortKey);const ft={useDepthForOcclusion:de.depthOcclusionForSymbolsAndCircles};for(const yt of bt){const{programConfiguration:ut,program:lt,layoutVertexBuffer:St,dynamicBuffers:Dt,indexBuffer:Ot,uniformValues:Wt,tile:Gt}=yt.state,sr=yt.segments;b.terrain&&b.terrain.setupElevationDraw(Gt,lt,ft),b.uploadCommonUniforms(Y,lt,Gt.tileID.toUnwrapped()),lt.draw(b,ee.TRIANGLES,De,Ie,He,zn.disabled,Wt,m.id,St,Ot,sr,m.paint,de.zoom,ut,Dt)}},heatmap:function(b,d,m,j){if(m.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const T=b.context,O=T.gl,D=Un.disabled,B=new ls([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(ue,we,ve,De){const Ie=ue.gl,He=we.width*De,tt=we.height*De;ue.activeTexture.set(Ie.TEXTURE1),ue.viewport.set([0,0,He,tt]);let Ge=ve.heatmapFbo;if(!Ge||Ge&&(Ge.width!==He||Ge.height!==tt)){Ge&&Ge.destroy();const bt=Ie.createTexture();Ie.bindTexture(Ie.TEXTURE_2D,bt),Ie.texParameteri(Ie.TEXTURE_2D,Ie.TEXTURE_WRAP_S,Ie.CLAMP_TO_EDGE),Ie.texParameteri(Ie.TEXTURE_2D,Ie.TEXTURE_WRAP_T,Ie.CLAMP_TO_EDGE),Ie.texParameteri(Ie.TEXTURE_2D,Ie.TEXTURE_MIN_FILTER,Ie.LINEAR),Ie.texParameteri(Ie.TEXTURE_2D,Ie.TEXTURE_MAG_FILTER,Ie.LINEAR),Ge=ve.heatmapFbo=ue.createFramebuffer(He,tt,1,null),function(ft,yt,ut,lt,St,Dt){const Ot=ft.gl;Ot.texImage2D(Ot.TEXTURE_2D,0,ft.extRenderToTextureHalfFloat?Ot.RGBA16F:Ot.RGBA,St,Dt,0,Ot.RGBA,ft.extRenderToTextureHalfFloat?Ot.HALF_FLOAT:Ot.UNSIGNED_BYTE,null),lt.colorAttachment0.set(ut)}(ue,0,bt,Ge,He,tt)}else Ie.bindTexture(Ie.TEXTURE_2D,Ge.colorAttachment0.get()),ue.bindFramebuffer.set(Ge.framebuffer)})(T,b,m,b.transform.projection.name==="globe"?.5:.25),T.clear({color:i.ao.transparent});const H=b.transform,Y=H.projection.name==="globe",ee=Y?["PROJECTION_GLOBE_VIEW"]:[],de=Y?zn.frontCCW:zn.disabled,ce=[i.aF(H.center.lng),i.aJ(H.center.lat)];for(let ue=0;ue({u_image:0,u_color_ramp:1,u_opacity:de.paint.get("heatmap-opacity")}))(0,O),O.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,O.paint,T.transform.zoom)}(b,m))},line:function(b,d,m,j){if(b.renderPass!=="translucent")return;const T=m.paint.get("line-opacity"),O=m.paint.get("line-width");if(T.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"),ee=m.layout.get("line-width-unit")==="meters",de=Y==="sea",ce=!(!b.terrain||!b.terrain.enabled),ue=b.context,we=ue.gl;if(m.hasElevatedBuckets&&b.transform.projection.name==="globe")return;const ve=m.layout.get("line-cross-slope"),De=ve!==void 0,Ie=ve<1,He=b.colorModeForDrapableLayerRenderPass(D?B:null),tt=b.terrain&&b.terrain.renderingToTexture,Ge=tt?1:i.o.devicePixelRatio,bt=m.paint.get("line-dasharray"),ft=bt.constantOr(1),yt=m.layout.get("line-cap"),ut=bt.constantOr(null),lt=yt.constantOr(null),St=m.paint.get("line-pattern"),Dt=St.constantOr(1),Ot=m.paint.get("line-pattern-cross-fade"),Wt=St.constantOr(null),Gt=m.paint.get("line-opacity").constantOr(1);let sr=!Dt&&Gt!==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(tt&&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"),tt&&(b.emissiveMode!=="dual-source-blending"||D?b.emissiveMode==="mrt-fallback"&&Tt.push("USE_MRT1"):Tt.push("DUAL_SOURCE_BLENDING"));const Vt=(Hr,Nr,br,on,en,$r)=>{for(const Gr of Hr){const kn=d.getTile(Gr);if(Dt&&!kn.patternsLoaded())continue;const Qn=kn.getBucket(m);if(!Qn||Qn.elevationType!=="none"&&!en||Qn.elevationType==="none"&&en)continue;b.prepareDrawTile();const Fs=[...Nr],pa=b.shadowRenderer,dn=Qn.elevationType==="road"&&!!pa&&pa.enabled;let oa=[0,0,0];if(dn){const ds=b.style.directionalLight,ci=b.style.ambientLight;ds&&ci&&(oa=Np(b.style,ds,ci)),Fs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Kn=Qn.programConfigurations.get(m.id);let _a=!1;if(Wt&&kn.imageAtlas){const ds=i.e3.from(Wt),ci=ds.getPrimary().scaleSelf(Ge).toString(),ro=kn.imageAtlas.patternPositions.get(ci),Ri=ds.getSecondary(),Ga=Ri?kn.imageAtlas.patternPositions.get(Ri.scaleSelf(Ge).toString()):null;_a=!!ro&&!!Ga,ro&&Kn.setConstantPatternPositions(ro,Ga)}Ot>0&&(_a||Kn.getPatternTransitionVertexBuffer("line-pattern"))&&Fs.push("LINE_PATTERN_TRANSITION");const za=b.isTileAffectedByFog(Gr),Aa=b.getOrCreateProgram($t,{config:Kn,defines:Fs,overrideFog:za});if(!Dt&&ut&<&&kn.lineAtlas){const ds=kn.lineAtlas.getDash(ut,lt);ds&&Kn.setConstantPatternPositions(ds)}dn&&pa.setupShadows(kn.tileID.toUnwrapped(),Aa,"vector-tile");let[ia,cs]=m.paint.get("line-trim-offset");(lt==="round"||lt==="square")&&ia!==cs&&(ia===0&&(ia-=1),cs===1&&(cs+=1));const xa=tt?Gr.projMatrix:null,qi=ee?1/Qn.tileToMeter/i.ay(kn,1,b.transform.zoom):1,yi=ee?1/Qn.tileToMeter/i.ay(kn,1,Math.floor(b.transform.zoom)):1,ba=Dt?i.e4(b,kn,m,xa,Ge,qi,yi,[ia,cs],oa,Ot):i.e5(b,kn,m,xa,Qn.lineClipsArray.length,Ge,qi,yi,[ia,cs],oa);if(_r){const ds=Qn.gradients[m.id];let ci=ds.texture;if(m.gradientVersion!==ds.version){let ro=256;if(m.stepInterpolant){const Ri=d.getSource().maxzoom,Ga=Gr.canonical.z===Ri?Math.ceil(1<{Jt!=null&&(Jt.value=Gt*H),Aa.draw(b,we.TRIANGLES,br,ds,He,zn.disabled,ba,m.id,Qn.layoutVertexBuffer,Qn.indexBuffer,Qn.segments,m.paint,b.transform.zoom,Kn,[Qn.layoutVertexBuffer2,Qn.patternVertexBuffer,Qn.zOffsetVertexBuffer]),Jt!=null&&(Jt.value=Gt)};if(sr&&!en){const ds=b.stencilModeForClipping(Gr).ref;ds===0&&tt&&ue.clear({stencil:0});const ci={func:we.EQUAL,mask:255};ba.u_alpha_discard_threshold=.8,ea(new Un(ci,ds,255,we.KEEP,we.KEEP,we.INVERT)),ba.u_alpha_discard_threshold=0,ea(new Un(ci,ds,255,we.KEEP,we.KEEP,we.KEEP))}else ba.u_alpha_discard_threshold=sr&&en&&$r?.8:0,ea(en?on:b.stencilModeForClipping(Gr))}};let dr=b.depthModeForSublayer(0,un.ReadOnly);const Ar=new un(b.depthOcclusion?we.GREATER:we.LEQUAL,un.ReadOnly,b.depthRangeFor3D);if(m.hasNonElevatedBuckets){const Hr=!tt&&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(j,Tt,dr,Un.disabled,!1,!0)}if(m.hasElevatedBuckets){Y==="hd-road-markup"?ce||(dr=Ar,Tt.push("ELEVATED_ROADS")):(Tt.push("ELEVATED"),dr=Ar,De&&Tt.push(Ie?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),de&&Tt.push("ELEVATION_REFERENCE_SEA"));const Hr=sr?b.stencilModeFor3D():Un.disabled;b.forceTerrainMode=!0,Vt(j,Tt,dr,Hr,!0,!0),sr&&Vt(j,Tt,dr,Hr,!0,!1),b.forceTerrainMode=!1}sr&&(b.resetStencilClippingMasks(),tt&&ue.clear({stencil:0})),H===0||b.depthOcclusion||tt||b.layersWithOcclusionOpacity.push(b.currentLayer)},fill:function(b,d,m,j){const T=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)&&T.constantOr(i.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let ee="none";m.layout.get("fill-elevation-reference")!=="none"?ee="road":m.paint.get("fill-z-offset").constantOr(1)!==0&&(ee="offset");const de=!(!b.terrain||!b.terrain.enabled),ce={painter:b,sourceCache:d,layer:m,coords:j,colorMode:B,elevationType:ee,terrainEnabled:de,pass:Y};if(b.renderPass==="shadow")return void(b.shadowRenderer&&ee==="road"&&!de&&function(we){const{painter:ve,sourceCache:De,layer:Ie,coords:He}=we,tt=ve.context.gl,Ge=we.painter.shadowRenderer;for(const bt of He){const ft=De.getTile(bt),yt=ft.getBucket(Ie);if(!yt)continue;const ut=yt.elevatedStructures;if(!ut||!ut.shadowCasterSegments||ut.shadowCasterSegments.segments[0].primitiveLength===0)continue;ve.prepareDrawTile();const lt=yt.bufferData.programConfigurations.get(Ie.id),St=ve.isTileAffectedByFog(bt),Dt=ve.getOrCreateProgram("elevatedStructuresDepth",{config:lt,overrideFog:St}),Ot=Ge.calculateShadowPassMatrixFromTile(ft.tileID.toUnwrapped());ve.uploadCommonUniforms(ve.context,Dt,bt.toUnwrapped());const Wt={u_matrix:Ot,u_depth_bias:0};Dt.draw(ve,tt.TRIANGLES,Ge.getShadowPassDepthMode(),Un.disabled,Ge.getShadowPassColorMode(),zn.disabled,Wt,Ie.id,ut.vertexBuffer,ut.indexBuffer,ut.shadowCasterSegments,Ie.paint,ve.transform.zoom,lt)}}(ce));const ue=b.emissiveMode==="mrt-fallback";if(ee!=="offset"){if(lN(ce,!1,ue),ee==="road"){const we=!de&&b.renderPass==="translucent";we&&oN(b,d,m,j,"geometry"),lN(ce,!0,ue,Un.disabled),we&&function(ve){const{painter:De,sourceCache:Ie,layer:He,coords:tt,colorMode:Ge}=ve,bt=De.context.gl,ft=ve.painter.shadowRenderer,yt=!!ft&&ft.enabled,ut=new un(De.context.gl.LEQUAL,un.ReadOnly,De.depthRangeFor3D);let lt=[0,0,0];if(yt){const Dt=De.style.directionalLight,Ot=De.style.ambientLight;Dt&&Ot&&(lt=Np(De.style,Dt,Ot))}const St=Dt=>{for(const Ot of tt){const Wt=Ie.getTile(Ot),Gt=Wt.getBucket(He);if(!Gt)continue;const sr=Gt.elevatedStructures;if(!sr)continue;let _r,$t;if(Dt?(_r=sr.renderableBridgeSegments,$t=sr.bridgeProgramConfigurations.get(He.id)):(_r=sr.renderableTunnelSegments,$t=sr.tunnelProgramConfigurations.get(He.id)),!_r||_r.segments[0].primitiveLength===0)continue;$t.updatePaintBuffers(),De.prepareDrawTile();const Tt=De.isTileAffectedByFog(Ot),Jt=[];yt&&Jt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Vt=De.getOrCreateProgram("elevatedStructures",{config:$t,overrideFog:Tt,defines:Jt}),dr=De.translatePosMatrix(Ot.projMatrix,Wt,He.paint.get("fill-translate"),He.paint.get("fill-translate-anchor"));yt&&ft.setupShadows(Wt.tileID.toUnwrapped(),Vt,"vector-tile");const Ar=Hm(dr,lt);De.uploadCommonUniforms(De.context,Vt,Ot.toUnwrapped()),Vt.draw(De,bt.TRIANGLES,ut,Un.disabled,Ge,zn.backCCW,Ar,He.id,sr.vertexBuffer,sr.indexBuffer,_r,He.paint,De.transform.zoom,$t,[sr.vertexBufferNormal])}};St(!0),St(!1)}(ce)}}else lN(ce,!1,ue,b.stencilModeFor3D())},"fill-extrusion":function(b,d,m,j){const T=m.paint.get("fill-extrusion-opacity"),O=b.context,D=O.gl,B=b.terrain,H=B&&B.renderingToTexture;if(T===0)return;const Y=b.emissiveMode==="mrt-fallback",ee=b.conflationActive&&b.style.isLayerClipped(m,d.getSource()),de=b.style.order.indexOf(m.fqid);if(ee&&function(ce,ue,we,ve,De){for(const Ie of ve){const He=ue.getTile(Ie).getBucket(we);He&&(He.updateReplacement(Ie,ce.replacementSource,De),He.uploadCentroid(ce.context))}}(b,d,m,j,de),B||ee)for(const ce of j){const ue=d.getTile(ce).getBucket(m);ue&&Nie(b.context,d,ce,ue,m,B,ee)}if(b.renderPass==="shadow"&&b.shadowRenderer){const ce=b.shadowRenderer;if(B&&T<.65&&m._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const ue=ce.getShadowPassDepthMode(),we=ce.getShadowPassColorMode();cN(b,d,m,j,ue,Un.disabled,we,ee)}else if(b.renderPass==="translucent"){const ce=!m.paint.get("fill-extrusion-pattern").constantOr(1),ue=m.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!H&&ue.a!==0){const we=new un(b.context.gl.LEQUAL,un.ReadWrite,b.depthRangeFor3D);T===1&&ce?cN(b,d,m,j,we,Un.disabled,ls.unblended,ee):(cN(b,d,m,j,we,Un.disabled,ls.disabled,ee),cN(b,d,m,j,we,b.stencilModeFor3D(),b.colorModeForRenderPass(),ee),b.resetStencilClippingMasks())}if(b.style.enable3dLights()&&ce&&(!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"),Ie=m.paint.get("fill-extrusion-flood-light-intensity"),He=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",tt=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(He?null:m.lut).toArray01().slice(0,3),Ge=ve>0&&De>0,bt=Ie>0,ft=(lt,St,Dt)=>(1-Dt)*lt+Dt*St,yt=new b5;yt.translate=m.paint.get("fill-extrusion-translate"),yt.translateAnchor=m.paint.get("fill-extrusion-translate-anchor"),yt.edgeRadius=m.layout.get("fill-extrusion-edge-radius"),yt.cutoffFadeRange=m.paint.get("fill-extrusion-cutoff-fade-range");const ut=lt=>{const St=b.depthModeForSublayer(1,un.ReadOnly,D.LEQUAL,!0),Dt=m.paint.get(lt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ot=ft(.1,3,Dt),Wt=b._showOverdrawInspector;if(!Wt){const Gt=new Un({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),sr=new ls([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0],D.MIN);Mp(yt,b,d,m,j,St,Gt,sr,zn.disabled,lt,"sdf",we,ve,De,Ie,tt,Ot,ee,!1)}{const Gt=Wt?Un.disabled:new Un({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),sr=Wt?b.colorModeForRenderPass():new ls([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],i.ao.transparent,[!0,!0,!0,!0]);Mp(yt,b,d,m,j,St,Gt,sr,zn.disabled,lt,"color",we,ve,De,Ie,tt,Ot,ee,!1)}};if(H){const lt=()=>{const Dt=B.drapeBufferSize[0],Ot=B.drapeBufferSize[1];let Wt=B.framebufferCopyTexture;return Wt&&(!Wt||Wt.size[0]===Dt&&Wt.size[1]===Ot)||(Wt&&Wt.destroy(),Wt=B.framebufferCopyTexture=new i.T(O,new i.q({width:Dt,height:Ot}),D.RGBA8)),Wt.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,Dt,Ot),Wt},St=(Dt,Ot,Wt)=>{const Gt=b.depthModeForSublayer(1,un.ReadOnly,D.LEQUAL,!1),sr=m.paint.get(Dt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),_r=ft(.1,3,sr);{const $t=new ls([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0]);Mp(yt,b,d,m,j,Gt,Un.disabled,$t,zn.disabled,Dt,"clear",we,ve,De,Ie,tt,_r,ee,Ot)}{const $t=new Un({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),Tt=new ls([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0],D.MIN);Mp(yt,b,d,m,j,Gt,$t,Tt,zn.disabled,Dt,"sdf",we,ve,De,Ie,tt,_r,ee,Ot)}Y&&!Dt&&(Wt=lt());{const $t=Dt?D.ZERO:D.ONE_MINUS_DST_ALPHA,Tt=new Un({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),Jt=new ls([$t,D.DST_ALPHA,D.ONE_MINUS_DST_ALPHA,D.ZERO],i.ao.transparent,[!0,!0,!0,!0]);Mp(yt,b,d,m,j,Gt,Tt,Jt,zn.disabled,Dt,"color",we,ve,De,Ie,tt,_r,ee,Ot)}if(!Y||Dt){const $t=new ls([D.ONE,D.ONE,D.ONE,Dt?D.ZERO:D.ONE],i.ao.transparent,[!1,!1,!1,!0],Dt?D.FUNC_ADD:D.MAX);Mp(yt,b,d,m,j,Gt,Un.disabled,$t,zn.disabled,Dt,"clear",we,ve,De,Ie,tt,_r,ee,Ot,Wt)}else{D.drawBuffers([D.NONE,D.COLOR_ATTACHMENT1]);const $t=new Un({func:D.EQUAL,mask:255},254,255,D.KEEP,D.DECR,D.DECR),Tt=new ls([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!0,!1,!1,!1],D.MAX);Mp(yt,b,d,m,j,Gt,$t,Tt,zn.disabled,Dt,"emissive",we,ve,De,Ie,tt,_r,ee,Ot,Wt),D.drawBuffers([D.COLOR_ATTACHMENT0])}};if(Ge||bt){let Dt;b.prepareDrawTile(),Y&&!Ge||(Dt=lt()),Ge&&St(!0,!1,Dt),bt&&St(!1,!0,Dt)}}else Ge&&ut(!0),bt&&ut(!1),(Ge||bt)&&b.resetStencilClippingMasks()}}},building:function(b,d,m,j){b.currentLayer0&&O>0,Y=!0;const ee=m.paint.get("building-vertical-scale");if(ee<=0)return;b.shadowRenderer||(Y=!1);const de=b.conflationActive&&b.style.isLayerClipped(m,d.getSource()),ce=b.style.order.indexOf(m.fqid);if(function(ue,we,ve,De,Ie,He){for(const tt of He){const Ge=we.getTile(tt).getBucket(ve);Ge&&(Ie&&Ge.updateReplacement(tt,ue.replacementSource,De),Ge.uploadUpdatedIndexBuffer(ue.context))}}(b,d,m,ce,de,j),function(ue,we,ve,De){for(const Ie of De){const He=we.getTile(Ie).getBucket(ve);He&&He.needsEvaluation()&&He.uploadUpdatedColorBuffer(ue.context)}}(b,d,m,j),m.resetLayerRenderingStats(b),b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!0),b.renderPass==="shadow"&&b.shadowRenderer){const ue=b.shadowRenderer,we=[],ve=ue.getShadowPassDepthMode();Wv({painter:b,source:d,layer:m,coords:j,defines:we,blendMode:ue.getShadowPassColorMode(),depthMode:ve,opacity:B,verticalScale:ee,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(b.renderPass==="translucent"){let ue=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(ue=ue.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),b.shadowRenderer&&b.shadowRenderer.useNormalOffset&&(ue=ue.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"),Ie=m.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",He=m.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Ie?null:m.lut).toArray01().slice(0,3),tt=m.paint.get("building-flood-light-ground-attenuation"),Ge=De>0,bt=new un(b.context.gl.LEQUAL,un.ReadWrite,b.depthRangeFor3D);B<1&&Wv({painter:b,source:d,layer:m,coords:j,defines:ue,blendMode:ls.disabled,depthMode:bt,opacity:B,verticalScale:ee,facadeEmissiveChance:we,facadeAOIntensity:ve,floodLightIntensity:De,floodLightColor:He,depthOnly:!0});const ft=b.colorModeForRenderPass();Wv({painter:b,source:d,layer:m,coords:j,defines:ue,blendMode:ft,depthMode:bt,opacity:B,verticalScale:ee,facadeEmissiveChance:we,facadeAOIntensity:ve,floodLightIntensity:De,floodLightColor:He}),H&&dN(b,d,m,j,!0,B,T,O,De,He,D,de),Ge&&dN(b,d,m,j,!1,B,T,O,De,He,tt,de)}else if(b.renderPass==="light-beam"){const ue=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],we=new un(b.context.gl.LEQUAL,un.ReadOnly,b.depthRangeFor3D);Wv({painter:b,source:d,layer:m,coords:j,defines:ue,blendMode:ls.alphaBlended,depthMode:we,opacity:B,verticalScale:ee,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}b.shadowRenderer&&(b.shadowRenderer.useNormalOffset=!1),b.resetStencilClippingMasks()},hillshade:function(b,d,m,j){if(b.renderPass!=="offscreen"&&b.renderPass!=="translucent"||b.style.disableElevatedTerrain)return;const T=b.context,O=b.terrain&&b.terrain.renderingToTexture,[D,B]=b.renderPass!=="translucent"||O?[{},j]:b.stencilConfigForOverlap(j);for(const H of B){const Y=d.getTile(H);if(Y.needsHillshadePrepare&&b.renderPass==="offscreen")mie(b,Y,m);else if(b.renderPass==="translucent"){const ee=b.depthModeForSublayer(0,un.ReadOnly),de=m.paint.get("hillshade-emissive-strength"),ce=b.colorModeForDrapableLayerRenderPass(de),ue=O&&b.terrain?b.terrain.stencilModeForRTTOverlap(H):D[H.overscaledZ];pie(b,H,Y,m,ee,ue,ce)}}T.viewport.set([0,0,b.width,b.height]),b.resetStencilClippingMasks()},raster:function(b,d,m,j,T,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,ee=Y.gl,de=d.getSource(),ce=function(ft,yt,ut,lt,St){const Dt=yt.paint.get("raster-color"),Ot=ft.type==="raster-array",Wt=[],Gt=yt.paint.get("raster-resampling"),sr=yt.paint.get("raster-color-mix");let _r=yt.paint.get("raster-color-range");const $t=[sr[0],sr[1],sr[2],0],Tt=sr[3];let Jt=Gt==="nearest"?lt.NEAREST:lt.LINEAR;if(Ot&&(Wt.push("RASTER_ARRAY"),Dt||Wt.push("RASTER_COLOR"),Gt==="linear"&&Wt.push("RASTER_ARRAY_LINEAR"),Jt=lt.NEAREST,!_r&&ft.rasterLayers)){const Vt=ft.rasterLayers.find(({id:dr})=>dr===yt.sourceLayer);Vt&&Vt.fields&&Vt.fields.range&&(_r=Vt.fields.range)}if(_r=_r||[0,1],Dt){Wt.push("RASTER_COLOR"),ut.activeTexture.set(lt.TEXTURE2),yt.updateColorRamp(_r);let Vt=yt.colorRampTexture;Vt||(Vt=yt.colorRampTexture=new i.T(ut,yt.colorRamp,lt.RGBA8)),Vt.bind(lt.LINEAR,lt.CLAMP_TO_EDGE)}return St&&Wt.push("USE_MRT1"),{mix:$t,range:_r,offset:Tt,defines:Wt,resampling:Jt}}(de,m,Y,ee,b.terrain&&b.terrain.renderingToTexture&&b.emissiveMode==="mrt-fallback");if(de instanceof i.aU&&!j.length&&!D)return;const ue=m.paint.get("raster-emissive-strength"),we=b.colorModeForDrapableLayerRenderPass(ue),ve=b.terrain&&b.terrain.renderingToTexture,De=!b.options.moving,Ie=m.paint.get("raster-resampling")==="nearest"?ee.NEAREST:ee.LINEAR;if(de instanceof i.aU&&!j.length&&(de.onNorthPole||de.onSouthPole)){const ft=B?b.stencilModeFor3D():Un.disabled;return void Gv(!!de.onNorthPole,null,b,d,m,ue,ce,zn.disabled,ft)}if(!j.length)return;const[He,tt]=de instanceof i.aU||ve?[{},j]:b.stencilConfigForOverlap(j),Ge=tt[tt.length-1].overscaledZ;H&&ce.defines.push("PROJECTION_GLOBE_VIEW"),B&&ce.defines.push("RENDER_CUTOFF");const bt=(ft,yt,ut)=>{for(const lt of ft){const St=lt.toUnwrapped(),Dt=d.getTile(lt);if(ve&&(!Dt||!Dt.hasData()))continue;Y.activeTexture.set(ee.TEXTURE0);const Ot=Ap(Dt,de,m,ce);if(!Ot||!Ot.texture)continue;const{texture:Wt,mix:Gt,offset:sr,tileSize:_r,buffer:$t}=Ot;let Tt,Jt;ve?(Tt=un.disabled,Jt=lt.projMatrix):B?(Tt=new un(ee.LEQUAL,un.ReadWrite,b.depthRangeFor3D),Jt=D?Float32Array.from(b.transform.expandedFarZProjMatrix):b.transform.calculateProjMatrix(St,De)):(Tt=b.depthModeForSublayer(lt.overscaledZ-Ge,m.paint.get("raster-opacity")===1?un.ReadWrite:un.ReadOnly,ee.LESS),Jt=b.transform.calculateProjMatrix(St,De));const Vt=b.terrain&&ve?b.terrain.stencilModeForRTTOverlap(lt):He[lt.overscaledZ],dr=O?0:m.paint.get("raster-fade-duration");Dt.registerFadeDuration(dr);const Ar=d.findLoadedParent(lt,0),Hr=$v(Dt,Ar,d,b.transform,dr);let Nr,br;!Hr.isFading&&Dt.refreshedUponExpiration&&(Dt.refreshedUponExpiration=!1),b.terrain&&b.terrain.prepareDrawTile(),Y.activeTexture.set(ee.TEXTURE0),Wt.bind(Ie,ee.CLAMP_TO_EDGE),Y.activeTexture.set(ee.TEXTURE1),Ar?(Ar.texture&&Ar.texture.bind(Ie,ee.CLAMP_TO_EDGE),Nr=Math.pow(2,Ar.tileID.overscaledZ-Dt.tileID.overscaledZ),br=[Dt.tileID.canonical.x*Nr%1,Dt.tileID.canonical.y*Nr%1]):Wt.bind(Ie,ee.CLAMP_TO_EDGE),"useMipmap"in Wt&&Y.extTextureFilterAnisotropic&&b.transform.pitch>20&&ee.texParameterf(ee.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const on=b.transform;let en;const $r=B?zP(on):[0,0,0,0];let Gr,kn,Qn,Fs,pa,dn=0;if(H&&de instanceof i.aU&&de.coordinates.length>3)Gr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),kn=Float32Array.from(on.globeMatrix),Qn=Float32Array.from(i.dF(on)),Fs=[i.aF(on.center.lng),i.aJ(on.center.lat)],en=de.elevatedGlobePerspectiveTransform,pa=de.elevatedGlobeGridMatrix||new Float32Array(9);else if(H){const za=i.dG(lt.canonical);dn=i.dH(za.getCenter().lat),Gr=Float32Array.from(i.bk(i.dJ(lt.canonical))),kn=Float32Array.from(on.globeMatrix),Qn=Float32Array.from(i.dF(on)),Fs=[i.aF(on.center.lng),i.aJ(on.center.lat)],en=[0,0],pa=Float32Array.from(i.dI(lt.canonical,za,dn,on.worldSize/on._pixelsPerMercatorPixel))}else en=de instanceof i.aU?de.perspectiveTransform:[0,0],Gr=new Float32Array(16),kn=new Float32Array(9),Qn=new Float32Array(16),Fs=[0,0],pa=new Float32Array(9);const oa=IP(Jt,Gr,kn,Qn,pa,br||[0,0],i.aj(b.transform.zoom),Fs,$r,Nr||1,Hr,m,en,B?m.paint.get("raster-elevation"):0,2,Gt,sr,ce.range,_r,$t,ue),Kn=b.isTileAffectedByFog(lt),_a=b.getOrCreateProgram("raster",{defines:ce.defines,overrideFog:Kn});if(b.uploadCommonUniforms(Y,_a,St),de instanceof i.aU){const za=de.elevatedGlobeVertexBuffer,Aa=de.elevatedGlobeIndexBuffer;if(ve||!D)de.boundsBuffer&&de.boundsSegments&&_a.draw(b,ee.TRIANGLES,Tt,Un.disabled,we,zn.disabled,oa,m.id,de.boundsBuffer,b.quadTriangleIndexBuffer,de.boundsSegments);else if(za&&Aa){const ia=on.zoom<=i.c_?de.elevatedGlobeSegments:de.getSegmentsForLongitude(on.center.lng);ia&&_a.draw(b,ee.TRIANGLES,Tt,Un.disabled,we,yt,oa,m.id,za,Aa,ia)}}else if(H){Tt=new un(ee.LEQUAL,un.ReadOnly,b.depthRangeFor3D);const za=b.globeSharedBuffers;if(za){const[Aa,ia,cs]=za.getGridBuffers(dn,!1);_a.draw(b,ee.TRIANGLES,Tt,ut||Vt,b.colorModeForRenderPass(),yt,oa,m.id,Aa,ia,cs)}}else{const{tileBoundsBuffer:za,tileBoundsIndexBuffer:Aa,tileBoundsSegments:ia}=b.getTileBoundsBuffers(Dt);_a.draw(b,ee.TRIANGLES,Tt,Vt,we,zn.disabled,oa,m.id,za,Aa,ia)}}if(!(de instanceof i.aU)&&H)for(const lt of ft){const St=lt.canonical.y===(1<>>16,2654435769),((lt=Math.imul(lt^lt>>>16,2654435769))>>>0)/4294967296},ut=1/1.1;for(let lt=0;lti.e9[Vt](Wt));$t.push(Wt);const Tt=Wt.canonical.x,Jt=Wt.canonical.y;for(const Vt of $t){const dr=Ge.getTile(St?Vt.wrapped():Vt);if(!dr)continue;const Ar=dr.rasterParticleState;if(!Ar)continue;const Hr=Vt.canonical.x+(1<yt.tileID)),ue&&(Y.activeTexture.set(ee.TEXTURE0),b.imageManager.bind(b.context,m.scope));const ft=[];if(b.terrain&&b.terrain.renderingToTexture&&b.emissiveMode==="mrt-fallback"&&ft.push("USE_MRT1"),H){const yt=b.getOrCreateProgram(tt,{overrideFog:!1,overrideRtt:!0,defines:ft}),ut=new Float32Array(i.bA([])),lt=new i.aQ(0,0,0,0,0),St=ue?Gm(ut,B,D,b,0,m.scope,we,H,{tileID:lt,tileSize:ce}):qv(ut,B,D,T.toPremultipliedRenderColor(O?null:m.lut));yt.draw(b,ee.TRIANGLES,Ie,De,He,zn.disabled,St,m.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments)}else for(const yt of bt){const ut=b.isTileAffectedByFog(yt),lt=b.getOrCreateProgram(tt,{overrideFog:ut,defines:ft}),St=yt.toUnwrapped(),Dt=j?yt.projMatrix:b.transform.calculateProjMatrix(St);b.prepareDrawTile();const Ot=d?d.getTile(yt):Ge?Ge[yt.key]:new vp(yt,ce,de.zoom,b),Wt=ue?Gm(Dt,B,D,b,0,m.scope,we,H,{tileID:yt,tileSize:ce}):qv(Dt,B,D,T.toPremultipliedRenderColor(O?null:m.lut));b.uploadCommonUniforms(Y,lt,St);const{tileBoundsBuffer:Gt,tileBoundsIndexBuffer:sr,tileBoundsSegments:_r}=b.getTileBoundsBuffers(Ot);lt.draw(b,ee.TRIANGLES,Ie,De,He,zn.disabled,Wt,m.id,Gt,sr,_r)}},sky:function(b,d,m){const j=b._atmosphere?i.aj(b.transform.zoom):1,T=m.paint.get("sky-opacity")*j;if(T===0)return;const O=b.context,D=m.paint.get("sky-type"),B=new un(O.gl.LEQUAL,un.ReadOnly,[0,1]),H=b.frameCounter/1e3%1;D==="atmosphere"?b.renderPass==="offscreen"?m.needsSkyboxCapture(b)&&(function(Y,ee,de,ce){const ue=Y.context,we=ue.gl;let ve=ee.skyboxFbo;if(!ve){ve=ee.skyboxFbo=ue.createFramebuffer(32,32,1,null),ee.skyboxGeometry=new pN(ue),ee.skyboxTexture=ue.gl.createTexture(),we.bindTexture(we.TEXTURE_CUBE_MAP,ee.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 tt=0;tt<6;++tt)we.texImage2D(we.TEXTURE_CUBE_MAP_POSITIVE_X+tt,0,we.RGBA,32,32,0,we.RGBA,we.UNSIGNED_BYTE,null)}ue.bindFramebuffer.set(ve.framebuffer),ue.viewport.set([0,0,32,32]);const De=ee.getCenter(Y,!0),Ie=Y.getOrCreateProgram("skyboxCapture"),He=new Float64Array(16);i.bA(He),i.en(He,He,.5*-Math.PI),hx(Y,ee,Ie,He,De,0),i.bA(He),i.en(He,He,.5*Math.PI),hx(Y,ee,Ie,He,De,1),i.bA(He),i.cU(He,He,.5*-Math.PI),hx(Y,ee,Ie,He,De,2),i.bA(He),i.cU(He,He,.5*Math.PI),hx(Y,ee,Ie,He,De,3),i.bA(He),hx(Y,ee,Ie,He,De,4),i.bA(He),i.en(He,He,Math.PI),hx(Y,ee,Ie,He,De,5),ue.viewport.set([0,0,Y.width,Y.height])}(b,m),m.markSkyboxValid(b)):b.renderPass==="sky"&&function(Y,ee,de,ce,ue){const we=Y.context,ve=we.gl,De=Y.transform,Ie=Y.getOrCreateProgram("skybox");we.activeTexture.set(ve.TEXTURE0),ve.bindTexture(ve.TEXTURE_CUBE_MAP,ee.skyboxTexture);const He=((tt,Ge,bt,ft,yt)=>({u_matrix:tt,u_sun_direction:Ge,u_cubemap:0,u_opacity:ft,u_temporal_offset:yt}))(De.skyboxMatrix,ee.getCenter(Y,!1),0,ce,ue);Y.uploadCommonUniforms(we,Ie),Ie.draw(Y,ve.TRIANGLES,de,Un.disabled,Y.colorModeForRenderPass(),zn.backCW,He,"skybox",ee.skyboxGeometry.vertexBuffer,ee.skyboxGeometry.indexBuffer,ee.skyboxGeometry.segment)}(b,m,B,T,H):D==="gradient"&&b.renderPass==="sky"&&function(Y,ee,de,ce,ue){const we=Y.context,ve=we.gl,De=Y.transform,Ie=Y.getOrCreateProgram("skyboxGradient");ee.skyboxGeometry||(ee.skyboxGeometry=new pN(we)),we.activeTexture.set(ve.TEXTURE0);let He=ee.colorRampTexture;He||(He=ee.colorRampTexture=new i.T(we,ee.colorRamp,ve.RGBA8)),He.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const tt=((Ge,bt,ft,yt,ut)=>({u_matrix:Ge,u_color_ramp:0,u_center_direction:bt,u_radius:i.an(ft),u_opacity:yt,u_temporal_offset:ut}))(De.skyboxMatrix,ee.getCenter(Y,!1),ee.paint.get("sky-gradient-radius"),ce,ue);Y.uploadCommonUniforms(we,Ie),Ie.draw(Y,ve.TRIANGLES,de,Un.disabled,Y.colorModeForRenderPass(),zn.backCW,tt,"skyboxGradient",ee.skyboxGeometry.vertexBuffer,ee.skyboxGeometry.indexBuffer,ee.skyboxGeometry.segment)}(b,m,B,T,H)},custom:function(b,d,m,j){const T=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(),T.setColorMode(b.colorModeForRenderPass()),b.transform.projection.name==="globe"){const B=b.transform.pointMerc;D.call(O,T.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,T.gl,b.transform.customLayerMatrix());T.setDirty(),b.setBaseState()}}else if(b.renderPass==="translucent"){if(b.terrain&&b.terrain.renderingToTexture){const B=O.renderToTile;if(B){const H=j[0].canonical,Y={x:H.x+j[0].wrap*(O.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,ee||(Y.enabled=!0))},ce=d.getSource();if(b.renderPass==="light-beam"&&ce.type!=="batched-model")return;if(ce.type==="vector"||ce.type==="geojson")return function(Ge,bt,ft,yt,ut){const lt=Ge.transform,St=lt.projection.name==="globe",Dt=lt.getFreeCameraOptions().position;if(!Ge.modelManager)return;const Ot=Ge.modelManager;ft.modelManager=Ot;const Wt=Ge.shadowRenderer;if(!ft._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Gt=ft._unevaluatedLayout._values["model-id"],sr=Object.assign({},ft.layout.get("model-id").parameters),_r=Ge.style.order.indexOf(ft.fqid),$t=ft.paint.get("model-opacity").constantOr(1);for(const Tt of yt){const Jt=bt.getTile(Tt).getBucket(ft);if(!Jt||Jt.projection.name!==lt.projection.name)continue;const Vt=Jt.getModelUris();if(Vt&&!Jt.modelsRequested&&(Ot.addModelsFromBucket(Vt,ut),Jt.modelsRequested=!0),St)sr.zoom=Tt.overscaledZ;else{const $r=dd(Tt,lt);sr.zoom=$r}const dr=Gt.possiblyEvaluate(sr);if(YP(Ge,Jt,Tt),Af.shadowUniformsInitialized=!1,Af.useSingleShadowCascade=!!Wt&&Wt.getMaxCascadeForTile(Tt.toUnwrapped())===0,Ge.renderPass==="shadow"&&Wt){if(Ge.currentShadowCascade===1&&Jt.isInsideFirstShadowMapFrustum)continue;const $r=lt.calculatePosMatrix(Tt.toUnwrapped(),lt.worldSize);if(Af.tileMatrix.set($r),Af.shadowTileMatrix=Float32Array.from(Wt.calculateShadowPassMatrixFromMatrix($r)),Af.aabb.min=[0,0,0],Af.aabb.max[0]=Af.aabb.max[1]=i.al,Af.aabb.max[2]=0,Mie(Jt,Af,Ge,ft.scope))continue}const Ar=1<0&&Ge.style.isLayerClipped(ft,bt.getSource())&&Jt.updateReplacement(Tt,Ge.replacementSource,_r,ft.scope)&&(Jt.uploaded=!1,Jt.upload(Ge.context));let Nr=0;const br=new Array,on=new Array,en=new Array;for(let $r in Jt.instancesPerModel){const Gr=Jt.instancesPerModel[$r];Gr.features.length>0&&!St&&($r=dr.evaluate(Gr.features[0].feature,{}));const kn=Ot.getModel($r,ut);if(kn||Ot.hasURLBeenRequested($r)||Jt.modelUris.includes($r)||(Jt.modelUris.push($r),Jt.modelsRequested=!1),kn&&kn.uploaded)if(St){const Qn=i.c5([],[Dt.x,Dt.y,Dt.z],Ge.transform.worldSize);i.ew(Qn,Qn);for(let Fs=0;Fs0&&oa.elevationUpdate($r.terrain,Fs,dn,kn.source),oa.needsReEvaluation($r,pa,kn)&&oa.evaluate(kn))}})(Ge,bt,ft,yt),function(){let $r,Gr,kn;br?($r=yt.length-1,Gr=-1,kn=-1):($r=0,Gr=yt.length,kn=1);const Qn=new Float64Array(16),Fs=i.cA(),pa=new i.P(0,0);for(let dn=$r;dn!==Gr;dn+=kn){const oa=yt[dn],Kn=bt.getTile(oa).getBucket(ft);if(!Kn||!Kn.uploaded)continue;let _a=!1;Dt&&(_a=Dt.getMaxCascadeForTile(oa.toUnwrapped())===0);const za=lt.calculatePosMatrix(oa.toUnwrapped(),lt.worldSize),Aa=Kn.modelTraits;!Ar&&br&&(i.bl(Qn,za),i.af(Fs,Wt,Qn),pa.x=Fs[0],pa.y=Fs[1]);const ia=[];Kn.setFilter(ft.filter);for(const cs of Kn.getNodesInfo()){if(cs.hiddenByReplacement||!cs.node.meshes)continue;const xa=cs.node;let qi=0;Ge.terrain&&xa.elevation&&(qi=xa.elevation*Ge.terrain.exaggeration());const yi=(()=>{const Cc=cs.aabb;return dr.min=[...Cc.min],dr.max=[...Cc.max],dr.min[2]+=qi,dr.max[2]+=qi,i.af(dr.min,dr.min,za),i.af(dr.max,dr.max,za),dr})(),ba=cs.evaluatedScale;if(ba[0]<=1&&ba[1]<=1&&ba[2]<=1&&yi.intersects(Hr)===0)continue;if(!Ar&&br){const Cc=.16666666666666666;cs.cameraCollisionOpacity=Wt[0]>yi.min[0]&&Wt[0]yi.min[1]&&Wt[1]!br||cs.opacity===1&&xa.opacity===1?cs.depthxa.depth?-1:1);for(const cs of ia){const xa=cs.nodeInfo,qi=xa.node;let yi=i.aB([],$t,cs.tileModelMatrix);i.aB(yi,sr,yi);const ba=i.bl([],yi);i.eg(ba,ba),i.cS(ba,ba,Zv),yi=i.aB(yi,yi,qi.globalMatrix);const ea=Ge.renderPass==="light-beam",ds=ft.paint.get("model-color-use-theme").constantOr("default")==="none",ci=Aa&i.eI.HasMapboxMeshFeatures,ro=ci?0:xa.evaluatedRMEA[0][2];for(let Ri=0;Ri=ar||Fi>=ar}}const Wl=Ga.material;let Eu;Wl.occlusionTexture&&Wl.occlusionTexture.offsetScale&&(Eu=Wl.occlusionTexture.offsetScale,Go.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const dh=Ge.getOrCreateProgram("model",Go);!Ar&&Dt&&Dt.setupShadowsFromMatrix(cs.tileModelMatrix,dh,Dt.useNormalOffset),Ge.uploadCommonUniforms(ut,dh,null,Mc);const Dd=Wl.pbrMetallicRoughness;Dd.metallicFactor=.9,Dd.roughnessFactor=.5;const Ki=ox(new Float32Array(dc),new Float32Array(yi),new Float32Array(ba),new Float32Array(qi.globalMatrix),Ge,cs.opacity,Dd.baseColorFactor,Wl.emissiveFactor,Dd.metallicFactor,Dd.roughnessFactor,Wl,ro,ft,[0,0,0],Eu);!ud&&(xa.hasTranslucentParts||cs.opacity<1)&&dh.draw(Ge,ut.gl.TRIANGLES,Jt,Un.disabled,ls.disabled,zn.backCCW,Ki,ft.id,Ga.vertexBuffer,Ga.indexBuffer,Ga.segments,ft.paint,Ge.transform.zoom,void 0,Cc),dh.draw(Ge,ut.gl.TRIANGLES,ud?Vt:Jt,Un.disabled,ud||cs.opacity<1||xa.hasTranslucentParts?ls.alphaBlended:ls.unblended,zn.backCCW,Ki,ft.id,Ga.vertexBuffer,Ga.indexBuffer,Ga.segments,ft.paint,Ge.transform.zoom,void 0,Cc)}}}}()}(b,d,m,j),void de();if(ce.type!=="model")return;const ue=ce.getModels(),we=[],ve=b.transform.getFreeCameraOptions().position,De=i.c5([],[ve.x,ve.y,ve.z],b.transform.worldSize);i.ew(De,De);const Ie=[],He=[];let tt=0;for(const Ge of ue){const bt=d.getFeatureState("",Ge.id),ft={type:"Unknown",id:Ge.id,properties:Ge.featureProperties},yt=m.paint.get("model-rotation").evaluate(ft,bt),ut=m.paint.get("model-scale").evaluate(ft,bt),lt=m.paint.get("model-translation").evaluate(ft,bt),St=m.paint.get("model-opacity").evaluate(ft,bt);GP(m,Ge.id,bt,Ge.featureProperties,Ge.nodeOverrideNames,Ge.nodeOverrides),KP(m,Ge.id,bt,Ge.featureProperties,Ge.materialOverrideNames,Ge.materialOverrides),Ge.nodeOverrides.size>0&&Ge.computeBoundsAndApplyParent(),Ge.computeModelMatrix(b,yt,ut,lt,B,D,!1);const Dt=i.bA([]),Ot=i.ef(Ge.position.lat,b.transform.zoom),Wt=i.bq([],[1,1,1/Ot]);i.br(Dt,Dt,De),we.push({zScaleMatrix:Wt,negCameraPosMatrix:Dt});for(const Gt of Ge.nodes)fx(b,Gt,Ge.matrix,b.transform.expandedFarZProjMatrix,tt,Ie,He,Ge.materialOverrides,St);tt++}if(Ie.sort((Ge,bt)=>bt.depth-Ge.depth),b.renderPass!=="shadow")ZP(b,m,Ie,He,we),de();else{for(const Ge of He)$h(Ge.mesh,Ge.nodeModelMatrix,b,m);for(const Ge of Ie)$h(Ge.mesh,Ge.nodeModelMatrix,b,m);de()}}},bN={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 j=d.getVisibleCoordinates();for(const T of j){const O=d.getTile(T).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 j=d.getSource();if(!j.loaded())return;if(j.type==="vector"||j.type==="geojson")return void(m.modelManager&&m.modelManager.upload(m,Kv(m,b)));if(j.type==="batched-model"||j.type!=="model")return;const T=j.getModels();for(const O of T)O.upload(m.context)},raster:function(b,d,m){const j=d.getSource();if(!(j instanceof cc&&j.loaded()))return;const T=b.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!T)return;const O=b.paint.get("raster-array-band")||j.getInitialBand(T);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(b.id,O)&&j.prepareTile(B,T,b.id,O)},"raster-particle":function(b,d,m){const j=d.getSource();if(!(j instanceof cc&&j.loaded()))return;const T=b.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!T)return;const O=b.paint.get("raster-particle-array-band")||j.getInitialBand(T);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(b.id,O)&&j.prepareTile(B,T,b.id,O)}},Au={fill:oN},wN={fill:function(b,d,m,j){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const T=b.context.gl,O=new un(T.LEQUAL,un.ReadOnly,b.depthRangeFor3D),D=new Un({func:T.ALWAYS,mask:255},255,255,T.KEEP,T.KEEP,T.REPLACE),B=b.transform.getFreeCameraOptions().position,H=b.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of j){const ee=d.getTile(Y),de=ee.getBucket(m);if(!de)continue;const ce=de.elevatedStructures;if(!ce||ce.depthSegments.segments[0].primitiveLength===0)continue;const ue=FP(Y.toUnwrapped(),B),we=b.translatePosMatrix(Y.projMatrix,ee,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor")),ve=ix(we,ue,0,1,0);H.draw(b,T.TRIANGLES,O,D,ls.disabled,zn.disabled,ve,m.id,ce.vertexBuffer,ce.indexBuffer,ce.depthSegments,m.paint,b.transform.zoom)}}};class jN{constructor(d,m,j,T,O){this.context=new a0(d,m),this.transform=j,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 o0,this.setup(),this.numSublayers=ad.maxUnderzooming+ad.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 Gy(this),this._wireframeDebugCache=new Zm,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=T,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,m){const j=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(j||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new h5(this,d));const T=this._terrain;this.transform.elevation=j?T:null,T.update(d,this.transform,m),this.transform.elevation&&!T.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[j,T]=m.getFovAdjustedRange(this.transform._fov);if(j>T)return void(this.transform.fogCullDistSq=null);const O=j+.78*(T-j);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 h5(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 j of this.style.order)this.style._mergedLayers[j].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 j=new i.bd;j.emplaceBack(0,0),j.emplaceBack(i.al,0),j.emplaceBack(0,i.al),j.emplaceBack(i.al,i.al),this.debugBuffer=d.createVertexBuffer(j,i.bf.members),this.debugSegments=i.bg.simpleSegment(0,0,4,5);const T=new i.bd;T.emplaceBack(-1,-1),T.emplaceBack(1,-1),T.emplaceBack(-1,1),T.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(T,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 Un({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,un.disabled,this.stencilClearMode,ls.disabled,zn.disabled,Bv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,m,j){if(!m||this.currentStencilSource===m.id||!d.isTileClipped()||!j||j.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const H of j)if(this._tileClippingMaskIDs[H.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=m.id;const T=this.context,O=T.gl;this.nextStencilID+j.length>256&&this.clearStencil(),T.setColorMode(ls.disabled),T.setDepthMode(un.disabled);const D=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of j){const H=m.getTile(B),Y=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:ee,tileBoundsIndexBuffer:de,tileBoundsSegments:ce}=this.getTileBoundsBuffers(H);D.draw(this,O.TRIANGLES,un.disabled,new Un({func:O.ALWAYS,mask:0},Y,255,O.KEEP,O.KEEP,O.REPLACE),ls.disabled,zn.disabled,Bv(B.projMatrix),"$clipping",ee,de,ce)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,m=this.context.gl;return new Un({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 Un({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(d){const m=this.context.gl,j=d.sort((D,B)=>B.overscaledZ-D.overscaledZ),T=j[j.length-1].overscaledZ,O=j[0].overscaledZ-T+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 j=i.o.now();this._dt=j-this._timeStamp,this._timeStamp=j,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=m;const T=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),D=()=>this.style._getOrder(O).filter($t=>{const Tt=T[$t];return!(Tt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Tt.type]});let B=D(),H=!1,Y=!1,ee=null,de=0,ce=!1;for(const $t of B){const Tt=T[$t];Tt.visibility!=="none"&&(Tt.type==="circle"?H=!0:Tt.type==="building"?(ee=Tt,++de):Tt.type==="symbol"&&(Tt.hasOcclusionOpacityProperties?Y=!0:H=!0))}this.updateEmissiveMode();let ue=B.map($t=>T[$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&&++de)}let ve=!1;for(const $t of ue)$t.isHidden(this.transform.zoom)||($t.type==="clip"&&(ve=!0),this.prepareLayer($t));const De={},Ie={},He={},tt={},Ge={};for(const $t in we){const Tt=we[$t];De[$t]=Tt.getVisibleCoordinates(),Ie[$t]=De[$t].slice().reverse(),He[$t]=Tt.getVisibleCoordinates(!0).reverse(),tt[$t]=Tt.getShadowCasterCoordinates(),Ge[$t]=Tt.sortCoordinatesByDistance(De[$t])}const bt=$t=>{const Tt=this.style.getLayerSourceCache($t);return Tt&&Tt.used?Tt.getSource():null};if(de||ve||this._clippingActiveLastFrame){const $t=[],Tt=[];let Jt=0;for(const Vt of ue)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 Ar=$t[dr],Hr=Tt[dr],Nr=this.style.getLayerSourceCache(Ar);if(!Nr||!Nr.used||!Nr.getSource().usedInConflation&&Ar.type!=="clip"&&Ar.type!=="building")continue;let br=i.eQ,on=i.b_.None;const en=[];let $r=!0;if(Ar.type==="building")br=i.eS;else if(Ar.type==="clip"){br=Hr;for(const Gr of Ar.layout.get("clip-layer-types"))on|=Gr==="model"?i.b_.Model:Gr==="symbol"?i.b_.Symbol:i.b_.FillExtrusion;for(const Gr of Ar.layout.get("clip-layer-scope"))en.push(Gr);Ar.isHidden(this.transform.zoom)?$r=!1:ve=!0}$r&&Vt.push({layer:Ar.fqid,cache:Nr,order:br,clipMask:on,clipScope:en})}this.replacementSource.setSources(Vt),ce=!0}}this._clippingActiveLastFrame=ve,ce||this.replacementSource.clear(),this.conflationActive=ce,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 ft=this.style&&this.style.fog;ft?(this._fogVisible=ft.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ft.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(He),this.opaquePassCutoff=0,B=D(),ue=B.map($t=>T[$t]));const yt=this._shadowRenderer;if(yt){yt.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),yt.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 WP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ut=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),lt=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ut&&!this._snow&&(this._snow=new M5(this)),!ut&&this._snow&&(this._snow.destroy(),delete this._snow),lt&&!this._rain&&(this._rain=new _N(this)),!lt&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),ee){this.buildingTileBorderManager||(this.buildingTileBorderManager=new mN);const $t=this.style.getLayerSourceCache(ee);this.buildingTileBorderManager.updateBorders($t,ee)}if(!Le.has(this.context.gl))return;this.renderPass="offscreen";for(const $t of ue){const Tt=d.getLayerSourceCache($t);if(!$t.hasOffscreenPass()||$t.isHidden(this.transform.zoom))continue;const Jt=Tt?Ie[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-(ue.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,tt)),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=ue[this.currentLayer],Tt=d.getLayerSourceCache($t);if($t.isSky())continue;const Jt=Tt?($t.is3D(O)?Ge:Ie)[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()&&--Wt==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=ue[this.currentLayer],Ar=d.getLayerSourceCache(dr),Hr=Ar?Ie[Ar.id]:void 0;this.terrain||this._renderTileClippingMasks(dr,Ar,Ar?De[Ar.id]:void 0),this.renderLayer(this,Ar,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;ue.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,j){const T=j===void 0?this.terrain&&this.terrain.renderingToTexture:j,O=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(O.push("LIGHTING_3D_MODE"),O.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):T||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||T||m!==void 0&&!m||O.push("FOG","FOG_DITHERING"),T&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,m){this.cache=this.cache||{};const j=m&&m.defines||[],T=m&&m.config,O=this.currentGlobalDefines(d,m&&m.overrideFog,m&&m.overrideRtt).concat(j),D=NP.cacheKey(J3[d],d,O,T);return this.cache[D]||(this.cache[D]=new NP(this.context,d,J3[d],T,iN[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 j=this.style.directionalLight,T=this.style.ambientLight;if(j&&T){const O=((D,B,H)=>{const Y=D.properties.get("direction"),ee=D.properties.get("color-use-theme")==="none",de=D.properties.get("color").toNonPremultipliedRenderColor(ee?null:H.getLut(D.scope)).toArray01(),ce=D.properties.get("intensity"),ue=B.properties.get("color-use-theme")==="none",we=B.properties.get("color").toNonPremultipliedRenderColor(ue?null:H.getLut(B.scope)).toArray01(),ve=B.properties.get("intensity"),De=[Y.x,Y.y,Y.z],Ie=i.dN(we,ve),He=i.dN(de,ce);return{u_lighting_ambient_color:Ie,u_lighting_directional_dir:De,u_lighting_directional_color:He,u_ground_radiance:r0(De,He,Ie)}})(j,T,this.style);m.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,m,j,T,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,ee,de,ce,ue,we,ve,De,Ie,He,tt,Ge)=>{const bt=Y.transform,ft=ee.properties.get("color-use-theme")==="none",yt=ee.properties.get("color").toNonPremultipliedRenderColor(ft?null:Y.style.getLut(ee.scope)).toArray01();yt[3]=ce;const ut=Y.frameCounter/1e3%1,[lt,St]=ee.properties.get("vertical-range");return{u_fog_matrix:de?bt.calculateFogTileMatrix(de):Ge||Y.identityMat,u_fog_range:ee.getFovAdjustedRange(bt._fov),u_fog_color:yt,u_fog_horizon_blend:ee.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(lt,St),St],u_fog_temporal_offset:ut,u_frustum_tl:ue,u_frustum_tr:we,u_frustum_br:ve,u_frustum_bl:De,u_globe_pos:Ie,u_globe_radius:He,u_viewport:tt,u_globe_transition:i.aj(bt.zoom),u_is_globe:+(bt.projection.name==="globe")}})(this,D,j,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],T);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={},j=this.transform.coveringTiles({tileSize:512});for(const T of j)m[T.key]=d[T.key]||new vp(T,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,j){const T=this.context,O=T.gl,D=!!j;var B;j||(j={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}),T.activeTexture.set(O.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),j.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],j.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],j.u_occluder_half_size=.5*this.occlusionParams.occluderSize,j.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),T.activeTexture.set(O.TEXTURE0),D||m.setTerrainUniformValues(T,j)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function kN(b,d){let m=!1,j=null;const T=()=>{j=null,m&&(b(),j=setTimeout(T,d),m=!1)};return()=>(m=!0,j||T(),j)}class T5{constructor(d){this._hashName=d&&encodeURIComponent(d),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=kN(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=Ho(d);if(this._hashName){const j=this._hashName;let T=!1;const O=location.hash.slice(1).split("&").map(D=>{const B=D.split("=")[0];return B===j?(T=!0,`${B}=${m}`):D}).filter(D=>D);return T||O.push(`${j}=${m}`),`#${O.join("&")}`}return`#${m}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(m=j)}),(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(j=>isNaN(Number(j)))){const j=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(m[3]||0):d.getBearing();return d.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:j,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Ho(b,d){const m=b.getCenter(),j=Math.round(100*b.getZoom())/100,T=Math.ceil((j*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,T),D=Math.round(m.lng*O)/O,B=Math.round(m.lat*O)/O,H=b.getBearing(),Y=b.getPitch();let ee=d?`/${D}/${B}/${j}`:`${j}/${B}/${D}`;return(H||Y)&&(ee+="/"+Math.round(10*H)/10),Y&&(ee+=`/${Math.round(Y)}`),ee}const c0={linearity:.3,easing:i.eT(0,0,.3,1)},A5=Object.assign({deceleration:2500,maxSpeed:1400},c0),E5=Object.assign({deceleration:20,maxSpeed:1400},c0),mx=Object.assign({deceleration:1e3,maxSpeed:360},c0),I5=Object.assign({deceleration:1e3,maxSpeed:90},c0);class P5{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 j=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,T={};if(m.pan.mag()){const O=Ef(m.pan.mag(),j,Object.assign({},A5,d||{}));T.offset=m.pan.mult(O.amount/m.pan.mag()),T.center=this._map.transform.center,d0(T,O)}if(m.zoom){const O=Ef(m.zoom,j,E5);T.zoom=this._map.transform.zoom+O.amount,d0(T,O)}if(m.bearing){const O=Ef(m.bearing,j,mx);T.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),d0(T,O)}if(m.pitch){const O=Ef(m.pitch,j,I5);T.pitch=this._map.transform.pitch+O.amount,d0(T,O)}if(T.zoom||T.bearing){const O=m.pinchAround===void 0?m.around:m.pinchAround;T.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),T.noMoveStart=!0,T}}function d0(b,d){(!b.duration||b.durationm.unproject(H)),B=O.reduce((H,Y,ee,de)=>H.add(Y.div(de.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:D,lngLat:m.unproject(B),originalEvent:j}),this._defaultPrevented=!1}}class L5 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,m){super("wheel",{originalEvent:m}),this._defaultPrevented=!1}}class NN{constructor(d,m){this._map=d,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new L5(this._map,d))}mousedown(d,m){return this._mousedownPos=m,this._firePreventable(new Od(d.type,this._map,d))}mouseup(d){this._map.fire(new Od(d.type,this._map,d))}preclick(d){const m=new MouseEvent("preclick",d);this._map.fire(new Od(m.type,this._map,m))}click(d,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(d),this._map.fire(new Od(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new Od(d.type,this._map,d))}mouseover(d){this._map.fire(new Od(d.type,this._map,d))}mouseout(d){this._map.fire(new Od(d.type,this._map,d))}touchstart(d){return this._firePreventable(new Xm(d.type,this._map,d))}touchmove(d){this._map.fire(new Xm(d.type,this._map,d))}touchend(d){this._map.fire(new Xm(d.type,this._map,d))}touchcancel(d){this._map.fire(new Xm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class O5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new Od(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Od("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new Od(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class SN{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 j=m,T=this._startPos,O=this._lastPos;if(!T||!O||O.equals(j)||!this._box&&j.dist(T){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 j=this._startPos,T=m;if(j&&d.button===0){if(this.reset(),V(),j.x!==T.x||j.y!==T.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(j,T,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),R(),delete this._startPos,delete this._lastPos}_fireEvent(d,m){return this._map.fire(new i.z(d,{originalEvent:m}))}}function CN(b,d){const m={};for(let j=0;jthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),j.length===this.numTouches&&(this.centroid=function(T){const O=new i.P(0,0);for(const D of T)O._add(D);return O.div(T.length)}(m),this.touches=CN(j,m)))}touchmove(d,m,j){if(this.aborted||!this.centroid)return;const T=CN(j,m);for(const O in this.touches){const D=T[O];(!D||D.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,m,j){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),j.length===0){const T=!this.aborted&&this.centroid;if(this.reset(),T)return T}}}class MN{constructor(d){this.singleTap=new JP(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,j){this.singleTap.touchstart(d,m,j)}touchmove(d,m,j){this.singleTap.touchmove(d,m,j)}touchend(d,m,j){const T=this.singleTap.touchend(d,m,j);if(T){const O=d.timeStamp-this.lastTime<500,D=!this.lastTap||this.lastTap.dist(T)<30;if(O&&D||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=T,this.count===this.numTaps)return this.reset(),T}}}class e6{constructor(){this._zoomIn=new MN({numTouches:1,numTaps:2}),this._zoomOut=new MN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,m,j){this._zoomIn.touchstart(d,m,j),this._zoomOut.touchstart(d,m,j)}touchmove(d,m,j){this._zoomIn.touchmove(d,m,j),this._zoomOut.touchmove(d,m,j)}touchend(d,m,j){const T=this._zoomIn.touchend(d,m,j),O=this._zoomOut.touchend(d,m,j);return T?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()+1,around:D.unproject(T)},{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 t6={0:1,2:2},D5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class TN{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 j=J(d);this._correctButton(d,j)&&(this._lastPoint=m,this._eventButton=j)}mousemoveWindow(d,m){const j=this._lastPoint;if(j){if(d.preventDefault(),this._eventButton!=null&&function(T,O){const D=t6[O];return T.buttons===void 0||(T.buttons&D)!==D}(d,this._eventButton))this.reset();else if(this._moved||!(m.dist(j)0&&(this._active=!0);const T=CN(j,m),O=new i.P(0,0),D=new i.P(0,0);let B=0;for(const Y in T){const ee=T[Y],de=this._touches[Y];de&&(O._add(ee),D._add(ee.sub(de)),B++,T[Y]=ee)}if(this._touches=T,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class AN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,m,j){return{}}touchstart(d,m,j){this._firstTwoTouches||j.length<2||(this._firstTwoTouches=[j[0].identifier,j[1].identifier],this._start([m[0],m[1]]))}touchmove(d,m,j){const T=this._firstTwoTouches;if(!T)return;d.preventDefault();const[O,D]=T,B=Yv(j,m,O),H=Yv(j,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,j){if(!this._firstTwoTouches)return;const[T,O]=this._firstTwoTouches,D=Yv(j,m,T),B=Yv(j,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 Yv(b,d,m){for(let j=0;jMath.abs(b.x)}class Aie extends AN{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,EN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,m,j){const T=this._lastPoints;if(!T)return;const O=d[0].sub(T[0]),D=d[1].sub(T[1]);return this._map._cooperativeGestures&&!i.eU()&&j.touches.length<3||(this._valid=this.gestureBeginsVertically(O,D,j.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+D.y)/2*-.5})}gestureBeginsVertically(d,m,j){if(this._valid!==void 0)return this._valid;const T=d.mag()>=2,O=m.mag()>=2;if(!T&&!O)return;if(!T||!O)return this._firstMove==null&&(this._firstMove=j),j-this._firstMove<100&&void 0;const D=d.y>0==m.y>0;return EN(d)&&EN(m)&&D}}const Eie={panStep:100,bearingStep:15,pitchStep:10};class Iie{constructor(){const d=Eie;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,j=0,T=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?j=-1:(d.preventDefault(),O=-1);break;case 39:d.shiftKey?j=1:(d.preventDefault(),O=1);break;case 38:d.shiftKey?T=1:(d.preventDefault(),D=-1);break;case 40:d.shiftKey?T=-1:(d.preventDefault(),D=1);break;default:return}return this._rotationDisabled&&(j=0,T=0),{cameraAnimation:B=>{const H=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:Xv,zoom:m?Math.round(H)+m*(d.shiftKey?2:1):H,bearing:B.getBearing()+j*this._bearingStep,pitch:B.getPitch()+T*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 Xv(b){return b*(2-b)}const z5=4.000244140625,B5=1/450;class IN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._handler=m,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=B5,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 j=i.o.now(),T=j-(this._lastWheelEventTime||0);this._lastWheelEventTime=j,m!==0&&m%z5==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":T>400?(this._type=null,this._lastValue=m,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(T*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)>z5?this._wheelZoomRate:this._defaultZoomRate;let ee=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&ee!==0&&(ee=1/ee);const de=m(),ce=Math.pow(2,de),ue=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):ce;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(ue*ee))),this._type==="wheel"&&(this._startZoom=de,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const j=typeof this._targetZoom=="number"?this._targetZoom:m(),T=this._startZoom,O=this._easing;let D,B=!1;if(this._type==="wheel"&&T&&O){const Y=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),ee=O(Y);D=i.ak(T,j,ee),Y<1?this._frameId||(this._frameId=!0):B=!0}else D=j,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 j=this._prevEase,T=(i.o.now()-j.start)/j.duration,O=j.easing(T+.01)-j.easing(T),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 Ip{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 PN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,m){return d.preventDefault(),{cameraAnimation:j=>{j.easeTo({duration:300,zoom:j.getZoom()+(d.shiftKey?-1:1),around:j.unproject(m)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wo{constructor(){this._tap=new MN({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,j){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?j.length>0&&(this._swipePoint=m[0],this._swipeTouch=j[0].identifier):this._tap.touchstart(d,m,j))}touchmove(d,m,j){if(this._tapTime){if(this._swipePoint){if(j[0].identifier!==this._swipeTouch)return;const T=m[0],O=T.y-this._swipePoint.y;return this._swipePoint=T,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,m,j)}touchend(d,m,j){this._tapTime?this._swipePoint&&j.length===0&&this.reset():this._tap.touchend(d,m,j)&&(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 If{constructor(d,m,j){this._el=d,this._mousePan=m,this._touchPan=j}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,j){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=m,this._mousePitch=j}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 LN{constructor(d,m,j,T){this._el=d,this._touchZoom=m,this._touchRotate=j,this._tapDragZoom=T,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 Jv=b=>b.zoom||b.drag||b.pitch||b.rotate;class Pie extends i.z{}class e_{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,m){const j=i.av([],m,d);this.radius=i.ag(j[2]<0?i.eX([],j,this.constants):[j[0],j[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 j=i.c5([],[0,0,1],i.bJ(m,[0,0,1])),T=i.c5([],i.aw([],[m[0],m[1],0]),this.radius),O=i.d8([],m,i.c5([],i.av([],i.d8([],T,j),m),2));m[0]=O[0],m[1]=O[1]}return m}}function ON(b){return b.panDelta&&b.panDelta.mag()||b.zoomDelta||b.bearingDelta||b.pitchDelta}class Lie{constructor(d,m){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new P5(d),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new e_,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),i.aY(["handleEvent","handleWindowEvent"],this);const j=this._el;this._listeners=[[j,"touchstart",{passive:!0}],[j,"touchmove",{passive:!1}],[j,"touchend",void 0],[j,"touchcancel",void 0],[j,"mousedown",void 0],[j,"mousemove",void 0],[j,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[j,"mouseover",void 0],[j,"mouseout",void 0],[j,"dblclick",void 0],[j,"click",void 0],[j,"keydown",{capture:!1}],[j,"keyup",void 0],[j,"wheel",{passive:!1}],[j,"contextmenu",void 0],[window,"blur",void 0]];for(const[T,O,D]of this._listeners){const B=T===document?this.handleWindowEvent:this.handleEvent;T.addEventListener(O,B,D)}}destroy(){for(const[d,m,j]of this._listeners){const T=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(m,T,j)}}_addDefaultHandlers(d){const m=this._map,j=m.getCanvasContainer();this._add("mapEvent",new NN(m,d));const T=m.boxZoom=new SN(m,d);this._add("boxZoom",T);const O=new e6,D=new PN;m.doubleClickZoom=new Ip(D,O),this._add("tapZoom",O),this._add("clickZoom",D);const B=new Wo;this._add("tapDragZoom",B);const H=m.touchPitch=new Aie(m);this._add("touchPitch",H);const Y=new R5(d),ee=new F5(d);m.dragRotate=new Qv(d,Y,ee),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",ee,["mouseRotate"]);const de=new r6(d),ce=new n6(m,d);m.dragPan=new If(j,de,ce),this._add("mousePan",de),this._add("touchPan",ce,["touchZoom","touchRotate"]);const ue=new Di,we=new Tie;m.touchZoomRotate=new LN(j,we,ue,B),this._add("touchRotate",ue,["touchPan","touchZoom"]),this._add("touchZoom",we,["touchPan","touchRotate"]),this._add("blockableMapEvent",new O5(m));const ve=m.scrollZoom=new IN(m,this);this._add("scrollZoom",ve,["mousePan"]);const De=m.keyboard=new Iie;this._add("keyboard",De);for(const Ie of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Ie]&&m[Ie].enable(d[Ie])}_add(d,m,j){this._handlers.push({handlerName:d,handler:m,allowed:j}),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!!Jv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,m,j){for(const T in d)if(T!==j&&(!m||m.indexOf(T)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const m=[];for(const j of d)this._el.contains(j.target)&&m.push(j);return m}handleEvent(d,m){this._updatingCamera=!0;const j=d.type==="renderFrame",T=j?void 0:d,O={needsRenderFrame:!1},D={},B={},H=d.touches?this._getMapTouches(d.touches):void 0,Y=H?W(this._el,H):j?void 0:K(this._el,d);for(const{handlerName:ce,handler:ue,allowed:we}of this._handlers){if(!ue.isEnabled())continue;let ve;this._blockedByActive(B,we,ce)?ue.reset():ue[m||d.type]&&(ve=ue[m||d.type](d,Y,H),this.mergeHandlerResult(O,D,ve,ce,T),ve&&ve.needsRenderFrame&&this._triggerRenderFrame()),(ve||ue.isActive())&&(B[ce]=ue)}const ee={};for(const ce in this._previousActiveHandlers)B[ce]||(ee[ce]=T);this._previousActiveHandlers=B,(Object.keys(ee).length||ON(O))&&(this._changes.push([O,D,ee]),this._triggerRenderFrame()),(Object.keys(B).length||ON(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:de}=O;de&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],de(this._map))}mergeHandlerResult(d,m,j,T,O){if(!j)return;Object.assign(d,j);const D={handlerName:T,originalEvent:j.originalEvent||O};j.zoomDelta!==void 0&&(m.zoom=D),j.panDelta!==void 0&&(m.drag=D),j.pitchDelta!==void 0&&(m.pitch=D),j.bearingDelta!==void 0&&(m.rotate=D)}_applyChanges(){const d={},m={},j={};for(const[T,O,D]of this._changes)T.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(T.panDelta)),T.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+T.zoomDelta),T.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+T.bearingDelta),T.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+T.pitchDelta),T.around!==void 0&&(d.around=T.around),T.aroundCoord!==void 0&&(d.aroundCoord=T.aroundCoord),T.pinchAround!==void 0&&(d.pinchAround=T.pinchAround),T.noInertia&&(d.noInertia=T.noInertia),Object.assign(m,O),Object.assign(j,D);this._updateMapTransform(d,m,j),this._changes=[]}_updateMapTransform(d,m,j){const T=this._map,O=T.transform,D=He=>[He.x,He.y,He.z];if((He=>{const tt=this._eventsInProgress.drag;return tt&&!this._handlersById[tt.handlerName].isActive()})()&&!ON(d)){const He=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"),He!==O.zoom&&this._map._update(!0)}if(O._isCameraConstrained&&T._stop(!0),!ON(d))return void this._fireEvents(m,j,!0);let{panDelta:B,zoomDelta:H,bearingDelta:Y,pitchDelta:ee,around:de,aroundCoord:ce,pinchAround:ue}=d;O._isCameraConstrained&&(H>0&&(H=0),O._isCameraConstrained=!1),ue!==void 0&&(de=ue),(H||(He=>m[He]&&!this._eventsInProgress[He])("drag"))&&de&&(this._dragOrigin=D(O.pointCoordinate3D(de)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",T._stop(!0),de=de||T.transform.centerPoint,Y&&(O.bearing+=Y),ee&&(O.pitch+=ee),O._updateCameraState();const we=[0,0,0];if(B)if(O.projection.name==="mercator"){const He=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(de).dir),tt=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(de.sub(B)).dir);we[0]=tt[0]-He[0],we[1]=tt[1]-He[1]}else{const He=O.pointCoordinate(de);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const tt=O._pixelsPerMercatorPixel/O.worldSize;we[0]=-B.x*i.eW(i.a$(He.y))*tt,we[1]=-B.y*i.eW(O.center.lat)*tt}else{const tt=O.pointCoordinate(de.sub(B));He&&tt&&(we[0]=tt.x-He.x,we[1]=tt.y-He.y)}}const ve=O.zoom,De=[0,0,0];if(H){const He=D(ce||O.pointCoordinate3D(de)),tt={dir:i.aw([],i.av([],He,O._camera.position))};if(tt.dir[2]<0){const Ge=O.zoomDeltaToMovement(He,H);i.c5(De,tt.dir,Ge)}}const Ie=i.d8(we,we,De);O._translateCameraConstrained(Ie),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,j,!0)}_fireEvents(d,m,j){const T=Jv(this._eventsInProgress),O=Jv(d),D={};for(const ee in d){const{originalEvent:de}=d[ee];this._eventsInProgress[ee]||(D[`${ee}start`]=de),this._eventsInProgress[ee]=d[ee]}!T&&O&&this._fireEvent("movestart",O.originalEvent);for(const ee in D)this._fireEvent(ee,D[ee]);O&&this._fireEvent("move",O.originalEvent);for(const ee in d){const{originalEvent:de}=d[ee];this._fireEvent(ee,de)}const B={};let H;for(const ee in this._eventsInProgress){const{handlerName:de,originalEvent:ce}=this._eventsInProgress[ee];this._handlersById[de].isActive()||(delete this._eventsInProgress[ee],H=m[de]||ce,B[`${ee}end`]=H)}for(const ee in B)this._fireEvent(ee,B[ee]);const Y=Jv(this._eventsInProgress);if(j&&(T||O)&&!Y){this._updatingCamera=!0;const ee=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),de=ce=>ce!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new Pie("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const DN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class $5 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,j){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},m),j)}panTo(d,m,j){return this.easeTo(Object.assign({center:d},m),j)}getZoom(){return this.transform.zoom}setZoom(d,m){return this.jumpTo({zoom:d},m),this}zoomTo(d,m,j){return this.easeTo(Object.assign({zoom:d},m),j)}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,j){return this.easeTo(Object.assign({bearing:d},m),j)}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?j/(2*Math.tan(.5*d.fovX)*d.aspect):T/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,m,j,T,O,D){const B=d.clone(),H=this._extendCameraOptions(D);B.bearing=T,B.pitch=O;const Y=i.aT.convert(m),ee=i.aT.convert(j),de=.5*(Y.lat+ee.lat),ce=.5*(Y.lng+ee.lng),ue=i.eZ(de,ce),we=i.aw([],ue),ve=i.aw([],i.bI([],we,[0,1,0])),De=i.bI([],ve,we),Ie=[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],He=[ue,i.eZ(Y.lat,Y.lng),i.eZ(ee.lat,Y.lng),i.eZ(ee.lat,ee.lng),i.eZ(Y.lat,ee.lng),i.eZ(de,Y.lng),i.eZ(de,ee.lng),i.eZ(Y.lat,ce),i.eZ(ee.lat,ce)];let tt=i.d9.fromPoints(He.map(Vt=>[i.bJ(ve,Vt),i.bJ(De,Vt),i.bJ(we,Vt)]));const Ge=i.af([],tt.center,Ie);i.e_(Ge)===0&&i.e$(Ge,0,0,1),i.aw(Ge,Ge),i.c5(Ge,Ge,i.aD),B.center=i.f0(Ge);const bt=B.getWorldToCameraMatrix(),ft=i.bl(new Float64Array(16),bt);tt=i.d9.applyTransform(tt,i.aB([],bt,Ie));const yt=this._extendAABB(tt,B,H,T);if(!yt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");tt=yt,i.af(Ge,Ge,bt);const ut=.5*(tt.max[2]-tt.min[2]),lt=this._minimumAABBFrustumDistance(B,tt),St=i.c5([],[0,0,1],ut),Dt=i.d8(St,Ge,St),Ot=lt+(B.pitch===0?0:i.bG(Ge,Dt)),Wt=B.globeCenterInViewSpace,Gt=i.av([],Ge,[Wt[0],Wt[1],Wt[2]]);i.aw(Gt,Gt),i.c5(Gt,Gt,Ot);const sr=i.d8([],Ge,Gt);i.af(sr,sr,ft);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,j,T,O,D)):{center:B.center,zoom:Jt,bearing:T,pitch:O}}_extendAABB(d,m,j,T){const O=.5*((j.padding.left||0)+(j.padding.right||0)),D=.5*((j.padding.top||0)+(j.padding.bottom||0)),B=D,H=O,Y=O,ee=D,de=m.width-(H+Y),ce=m.height-(B+ee),ue=i.av([],d.max,d.min),we=Math.min(de/ue[0],ce/ue[1]),ve=Math.min(m.scaleZoom(m.scale*we),j.maxZoom);if(isNaN(ve))return null;const De=m.scale/m.zoomScale(ve),Ie=new i.d9([d.min[0]-H*De,d.min[1]-ee*De,d.min[2]],[d.max[0]+Y*De,d.max[1]+B*De,d.max[2]]),He=(typeof j.offset.x=="number"&&typeof j.offset.y=="number"?new i.P(j.offset.x,j.offset.y):i.P.convert(j.offset)).rotate(-i.an(T));return Ie.center[0]-=He.x*De,Ie.center[1]+=He.y*De,Ie}queryTerrainElevation(d,m){const j=this.transform.elevation;return j?(m=Object.assign({},{exaggerated:!0},m),j.getAtPoint(i.ae.fromLngLat(d),null,m.exaggerated)):null}_cameraForBounds(d,m,j,T,O,D){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,m,j,T,O,D);const B=d.clone(),H=this._extendCameraOptions(D);B.bearing=T,B.pitch=O;const Y=i.aT.convert(m),ee=i.aT.convert(j),de=new i.aT(Y.lng,ee.lat),ce=new i.aT(ee.lng,Y.lat),ue=B.project(Y),we=B.project(ee),ve=this.queryTerrainElevation(Y),De=this.queryTerrainElevation(ee),Ie=this.queryTerrainElevation(de),He=this.queryTerrainElevation(ce),tt=[[ue.x,ue.y,Math.min(ve||0,De||0,Ie||0,He||0)],[we.x,we.y,Math.max(ve||0,De||0,Ie||0,He||0)]];let Ge=i.d9.fromPoints(tt);const bt=B.getWorldToCameraMatrix(),ft=i.bl(new Float64Array(16),bt);Ge=i.d9.applyTransform(Ge,bt);const yt=this._extendAABB(Ge,B,H,T);if(!yt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ge=yt;const ut=.5*i.av([],Ge.max,Ge.min)[2],lt=this._minimumAABBFrustumDistance(B,Ge),St=[0,0,1,0];i.aC(St,St,bt),i.f1(St,St);const Dt=i.c5([],St,lt+ut),Ot=i.d8([],Ge.center,Dt);i.af(Ge.center,Ge.center,ft),i.af(Ot,Ot,ft);const Wt=B.unproject(new i.P(Ge.center[0],Ge.center[1])),Gt=i.f2(B.projection,Wt),sr=Math.pow(2,Gt),_r=Math.min(B._zoomFromMercatorZ(Ot[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,j,T,O,D)):{center:Wt,zoom:_r,bearing:T,pitch:O}}fitBounds(d,m,j){const T=this.cameraForBounds(d,m);return this._fitInternal(T,m,j)}fitScreenCoordinates(d,m,j,T,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 ee=this.transform.pointLocation3D(H),de=this.transform.pointLocation3D(Y),ce=this.transform.pointLocation3D(new i.P(H.x,Y.y)),ue=this.transform.pointLocation3D(new i.P(Y.x,H.y)),we=[Math.min(ee.lng,de.lng,ce.lng,ue.lng),Math.min(ee.lat,de.lat,ce.lat,ue.lat)],ve=[Math.max(ee.lng,de.lng,ce.lng,ue.lng),Math.max(ee.lat,de.lat,ce.lat,ue.lat)],De=T&&T.pitch?T.pitch:this.getPitch(),Ie=this._cameraForBounds(this.transform,we,ve,j,De,T);return this._fitInternal(Ie,T,O)}_fitInternal(d,m,j){return d?(m=Object.assign(d,m)).linear?this.easeTo(m,j):this.flyTo(m,j):this}jumpTo(d,m){this.stop();const j=d.preloadOnly?this.transform.clone():this.transform;let T=!1,O=!1,D=!1;"zoom"in d&&j.zoom!==+d.zoom&&(T=!0,j.zoom=+d.zoom),d.center!==void 0&&(j.center=i.aT.convert(d.center)),"bearing"in d&&j.bearing!==+d.bearing&&(O=!0,j.bearing=+d.bearing),"pitch"in d&&j.pitch!==+d.pitch&&(D=!0,j.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!j.isPaddingEqual(B))if(d.retainPadding===!1){const H=j.clone();H.padding=B,j.setLocationAtPoint(j.center,H.centerPoint)}else j.padding=B;return d.preloadOnly?(this._preloadTiles(j),this):(this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),T&&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(DN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,m){const j=this.transform;if(!j.projection.supportsFreeCamera)return i.w(DN),this;this.stop();const T=j.zoom,O=j.pitch,D=j.bearing;j.setFreeCameraOptions(d);const B=T!==j.zoom,H=O!==j.pitch,Y=D!==j.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 j=this.transform,T=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),H="zoom"in d?+d.zoom:T,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,ee="pitch"in d?+d.pitch:D,de=this._extendPadding(d.padding),ce=i.P.convert(d.offset);let ue,we,ve;if(j.projection.name==="globe"){const St=i.ae.fromLngLat(j.center),Dt=ce.rotate(-j.angle);St.x+=Dt.x/j.worldSize,St.y+=Dt.y/j.worldSize;const Ot=St.toLngLat(),Wt=i.aT.convert(d.center||Ot);this._normalizeCenter(Wt),ue=j.centerPoint.add(Dt),we=new i.P(St.x,St.y).mult(j.worldSize),ve=new i.P(i.aF(Wt.lng),i.aJ(Wt.lat)).mult(j.worldSize).sub(we)}else{ue=j.centerPoint.add(ce);const St=j.pointLocation(ue),Dt=i.aT.convert(d.center||St);this._normalizeCenter(Dt),we=j.project(St),ve=j.project(Dt).sub(we)}const De=j.zoomScale(H-T);let Ie,He;d.around&&(Ie=i.aT.convert(d.around),He=j.locationPoint(Ie));const tt=this._zooming||H!==T,Ge=this._rotating||O!==Y,bt=this._pitching||ee!==D,ft=!j.isPaddingEqual(de),yt=d.retainPadding===!1?j.clone():j,ut=St=>Dt=>{if(tt&&(St.zoom=i.ak(T,H,Dt)),Ge&&(St.bearing=i.ak(O,Y,Dt)),bt&&(St.pitch=i.ak(D,ee,Dt)),ft&&(yt.interpolatePadding(B,de,Dt),ue=yt.centerPoint.add(ce)),Ie)St.setLocationAtPoint(Ie,He);else{const Ot=St.zoomScale(St.zoom-T),Wt=H>T?Math.min(2,De):Math.max(.5,De),Gt=Math.pow(Wt,1-Dt),sr=St.unproject(we.add(ve.mult(Dt*Gt)).mult(Ot));St.setLocationAtPoint(St.renderWorldCopies?sr.wrap():sr,ue)}return d.preloadOnly||this._fireMoveEvents(m),St};if(d.preloadOnly){const St=this._emulate(ut,d.duration,j);return this._preloadTiles(St),this}const lt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=tt,this._rotating=Ge,this._pitching=bt,this._padding=ft,this._easeId=d.easeId,this._prepareEase(m,d.noMoveStart,lt),this._ease(ut(j),St=>{j.cameraElevationReference==="sea"&&j.recenterOnTerrain(),this._afterEase(m,St)},d),this}_prepareEase(d,m,j={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),m||j.moving||this.fire(new i.z("movestart",d)),this._zooming&&!j.zooming&&this.fire(new i.z("zoomstart",d)),this._rotating&&!j.rotating&&this.fire(new i.z("rotatestart",d)),this._pitching&&!j.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 j=this._zooming,T=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,j&&this.fire(new i.z("zoomend",d)),T&&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 j=this.transform,T=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),H="zoom"in d?i.aA(+d.zoom,j.minZoom,j.maxZoom):T,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,ee="pitch"in d?+d.pitch:D,de=this._extendPadding(d.padding),ce=j.zoomScale(H-T),ue=i.P.convert(d.offset);let we=j.centerPoint.add(ue);const ve=j.pointLocation(we),De=i.aT.convert(d.center||ve);this._normalizeCenter(De);const Ie=j.project(ve),He=j.project(De).sub(Ie);let tt=d.curve;const Ge=Math.max(j.width,j.height),bt=Ge/ce,ft=He.mag();if("minZoom"in d){const Vt=i.aA(Math.min(d.minZoom,T,H),j.minZoom,j.maxZoom),dr=Ge/j.zoomScale(Vt-T);tt=Math.sqrt(dr/ft*2)}const yt=tt*tt;function ut(Vt){const dr=(bt*bt-Ge*Ge+(Vt?-1:1)*yt*yt*ft*ft)/(2*(Vt?bt:Ge)*yt*ft);return Math.log(Math.sqrt(dr*dr+1)-dr)}function lt(Vt){return(Math.exp(Vt)-Math.exp(-Vt))/2}function St(Vt){return(Math.exp(Vt)+Math.exp(-Vt))/2}const Dt=ut(0);let Ot=function(Vt){return St(Dt)/St(Dt+tt*Vt)},Wt=function(Vt){return Ge*((St(Dt)*(lt(dr=Dt+tt*Vt)/St(dr))-lt(Dt))/yt)/ft;var dr},Gt=(ut(1)-Dt)/tt;if(Math.abs(ft)<1e-6||!isFinite(Gt)){if(Math.abs(Ge-bt)<1e-6)return this.easeTo(d,m);const Vt=btd.maxDuration&&(d.duration=0);const sr=O!==Y,_r=ee!==D,$t=!j.isPaddingEqual(de),Tt=d.retainPadding===!1?j.clone():j,Jt=Vt=>dr=>{const Ar=dr*Gt,Hr=1/Ot(Ar);Vt.zoom=dr===1?H:T+Vt.scaleZoom(Hr),sr&&(Vt.bearing=i.ak(O,Y,dr)),_r&&(Vt.pitch=i.ak(D,ee,dr)),$t&&(Tt.interpolatePadding(B,de,dr),we=Tt.centerPoint.add(ue));const Nr=dr===1?De:Vt.unproject(Ie.add(He.mult(Wt(Ar))).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,j);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(j),()=>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 j=this._onEaseEnd;this._onEaseEnd=void 0,j.call(this,m)}if(!d){const j=this.handlers;j&&j.stop(!1)}return this}_ease(d,m,j){j.animate===!1||j.duration===0?(d(1),m()):(this._easeStart=i.o.now(),this._easeOptions=j,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 j=Math.abs(d-m);return Math.abs(d-360-m)180?-360:j<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,m,j){const T=Math.ceil(15*m/1e3),O=[],D=d(j.clone());for(let B=0;B<=T;B++){const H=D(B/T);O.push(H.clone())}return O}_preloadTiles(d,m){}}class t_{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,j=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",j);const T=N("span","mapboxgl-ctrl-icon",this._compactButton);return T.setAttribute("aria-hidden","true"),T.setAttribute("title",j),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 j=m.reduce((T,O,D)=>(O.value&&(T+=`${O.key}=${O.value}${DT.length-O.length),d=d.filter((T,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 j=d.map(T=>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 ee=D.createElement("a");ee.href=Y,ee.textContent=H,ee.rel="noopener nofollow";const de=B.getAttribute("class");de&&(ee.className=de),B.replaceWith(ee)}),D.body.innerHTML}(T)).join(" | ");j!==this._attribHTML&&(this._attribHTML=j,d.length?(this._innerContainer.innerHTML=j,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 r_{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 j=d[m].getSource();if(j.hasOwnProperty("mapbox_logo")&&!j.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 u0{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 j=N("button",d,this._container);return j.type="button",j.addEventListener("click",m),j}_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(j=>j.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 j=0;j{this._map._selectIndoorFloor(T.id)});this._setButtonTitle(O,T.zIndex.toString()),this._model&&T.id===this._model.selectedFloorId&&m&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),j=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,j){this._start=this.getValue(m),this._end=d,this._startTime=m,this._endTime=m+j}}const Op={"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 Qm extends i.z{constructor(d,m,j,T){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=j,this.feature=T}}class Uh{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 j=m.filter;let T=m.type;j&&this.filters.set(d,i.b6(j)),T==="mouseover"&&(T="mouseenter"),T==="mouseout"&&(T="mouseleave");const O=this.interactionsByType.get(T)||new Map;T==="mouseenter"||T==="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(T,this.handleType),O.size===0&&this.interactionsByType.set(T,O),O.set(d,m),this.typeById.set(d,T)}get(d){const m=this.typeById.get(d);if(!m)return;const j=this.interactionsByType.get(m);return j?j.get(d):void 0}remove(d){const m=this.typeById.get(d);if(!m)return;this.typeById.delete(d),this.filters.delete(d);const j=this.interactionsByType.get(m);j&&(j.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))):j.size===0&&this.map.off(m,this.handleType))}queryTargets(d,m){const j=[];for(const[T,O]of m)O.target&&j.push({targetId:T,target:O.target,filter:this.filters.get(T)});return this.map.style.queryRenderedTargets(d,j,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 j=new Map;for(const[T,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(T)||j.set(O.id,O);j.size&&(d.type="mouseleave",this.handleType(d,Array.from(j.values())))}handleOut(d){const m=Array.from(this.hoveredFeatures.values()).map(({feature:j})=>j);m.length&&(d.type="mouseleave",this.handleType(d,m)),this.hoveredFeatures.clear()}handleType(d,m){const j=d.type==="mouseenter";if(j&&!this.interactionsByType.has(d.type))return void i.w("mouseenter interaction required for mouseleave to work.");const T=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!m;m=m||this.queryTargets(d.point,T);let D=!1;const B=new Set;for(const H of m){for(const[Y,ee]of T){if(!ee.target)continue;const de=H.variants?H.variants[Y]:null;if(de){for(const ce of de){if(Rm(ce,H,B,Y))continue;const ue=new i.dx(H,ce),we=yp(ce,H,Y);O&&ue.id!==void 0&&(ue.state=this.map.getFeatureState(ue));const ve=j?this.prevHoveredFeatures.get(we):null,De=new Qm(d,Y,ee,ue),Ie=ve?ve.stop:ee.handler(De);if(j&&this.hoveredFeatures.set(we,{feature:H,stop:Ie}),Ie!==!1){D=!0;break}}if(D)break}}if(D)break}if(!D)for(const[H,Y]of T){const{handler:ee,target:de}=Y;if(!de&&ee(new Qm(d,H,Y,null))!==!1)break}}}function Oie(b,d){if(Array.isArray(b)&&Array.isArray(d)){const m=new Set(b),j=new Set(d);return m.size===j.size&&b.every(T=>j.has(T))}return i.by(b,d)}const Die={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"},Rie={showCompass:!0,showZoom:!0,visualizePitch:!1};class Fie{constructor(d,m,j=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new R5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,j&&(this.mousePitch=new F5({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 j=this.map,T=this.mouseRotate.mousemoveWindow(d,m),O=T&&T.bearingDelta;if(O&&j.setBearing(j.getBearing()+O),this.mousePitch){const D=this.mousePitch.mousemoveWindow(d,m),B=D&&D.pitchDelta;B&&j.setPitch(j.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(){R(),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=W(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=W(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(j).distSqr(d)180;){const j=m.locationPoint3D(b);if(j.x>=0&&j.y>=0&&j.x<=m.width&&j.y<=m.height)break;b.lng>m.center.lng?b.lng-=360:b.lng+=360}return b}const Sc={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%)"},oh={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class RN 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:j="center",color:T="#3FB1CE",scale:O=1,draggable:D=!1,clickTolerance:B=0,rotation:H=oh.rotation,rotationAlignment:Y=oh.rotationAlignment,pitchAlignment:ee=oh.pitchAlignment,occludedOpacity:de=oh.occludedOpacity,altitude:ce=oh.altitude}=d||{};this._anchor=j,this._color=T,this._scale=O,this._draggable=D,this._clickTolerance=B,this._rotation=H,this._rotationAlignment=Y,this._pitchAlignment=ee,this._occludedOpacity=de,this._altitude=ce,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 ue=this._element.classList;for(const ve in Sc)ue.remove(`mapboxgl-marker-anchor-${ve}`);ue.add(`mapboxgl-marker-anchor-${this._anchor}`);const we=d&&d.className?d.className.trim().split(/\s+/):[];ue.add(...we),this._popup=null}_createDefaultMarker(){const d=N("div"),m=M("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const j=M("radialGradient",{id:"shadowGradient"},M("defs",{},m));M("stop",{offset:"10%","stop-opacity":.4},j),M("stop",{offset:"100%","stop-opacity":.05},j),M("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},m)}return M("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),M("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),M("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||oh.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 T=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":[T,-1*(38.1-13.5+T)],"bottom-right":[-T,-1*(38.1-13.5+T)],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,j=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&j!==32&&j!==13||this.togglePopup()}_onMapClick(d){const m=d.originalEvent.target,j=this._element;this._popup&&(m===j||j.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 j=d.unproject(m,this._altitude),T=d.getFreeCameraOptions();if(!T.position)return!1;const O=T.position.toLngLat();return O.distanceTo(j)<.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 j=d.unproject(m,this._altitude);let T;d._showingGlobe()&&i.f5(d.transform,this._lngLat)?T=0:(T=1-d._queryFogOpacity(j),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(T*=this._occludedOpacity)),this._element.style.opacity=`${T}`,this._element.style.pointerEvents=T>0?"auto":"none",this._popup&&this._popup._setOpacity(T),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) ${Sc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${m.x}px,${m.y}px) `}_calculateXYTransform(){const d=this._pos,m=this._map,j=this.getPitchAlignment();if(!m||!d||j!=="map")return"";if(!m._showingGlobe()){const H=m.getPitch();return H?`rotateX(${H}deg)`:""}const T=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=T/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 j=0;const T=this.getRotationAlignment();if(T==="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);j=i.cX(Math.atan2(D.y,D.x))-90}else j=-m.getBearing();else if(T==="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));j=(H>90?H-270:H+90)*(1-O)}return j+=this._rotation,j?`rotateZ(${j}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=U5(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 j=this._pointerdownPos,T=this._positionDelta;if(j&&T){if(!this._isDragging){const O=this._clickTolerance||m._clickTolerance;if(d.point.dist(j)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 W3(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 Pp,this._domRenderTaskQueue=new Pp,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},Op,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 Lp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=b.scaleFactor,this._requestManager=new ie(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 Lie(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 T5(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 t_({customAttribution:b.customAttribution})),this._logoControl=new r_,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 Uh(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 j=this._controlPositions[d];return d.indexOf("bottom")!==-1?j.insertBefore(m,j.firstChild):j.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 j=this.transform.getProjection().name==="mercator"&&m!==this.transform.mercatorFromTransition;return(d||j)&&(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 j=T=>{let O=[];if(Array.isArray(d)){const D=d.filter(B=>this.getLayer(B));O=D.length?this.queryRenderedFeatures(T,{layers:D}):[]}else O=this.queryRenderedFeatures(T,{target:d});return O};if(b==="mouseenter"||b==="mouseover"){let T=!1;return{listener:m,targets:d,delegates:{mousemove:D=>{const B=j(D.point);B.length?T||(T=!0,m.call(this,new Od(b,this,D.originalEvent,{features:B}))):T=!1},mouseout:()=>{T=!1}}}}if(b==="mouseleave"||b==="mouseout"){let T=!1;return{listener:m,targets:d,delegates:{mousemove:B=>{j(B.point).length?T=!0:T&&(T=!1,m.call(this,new Od(b,this,B.originalEvent)))},mouseout:B=>{T&&(T=!1,m.call(this,new Od(b,this,B.originalEvent)))}}}}{const T=O=>{const D=j(O.point);D.length&&(O.features=D,m.call(this,O),delete O.features)};return{listener:m,targets:d,delegates:{[b]:T}}}}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 j=this._createDelegatedListener(b,d,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[b]=this._delegatedListeners[b]||[],this._delegatedListeners[b].push(j);for(const T in j.delegates)this.on(T,j.delegates[T]);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 j=this._createDelegatedListener(b,d,m);for(const T in j.delegates)this.once(T,j.delegates[T]);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 j=this._delegatedListeners?this._delegatedListeners[b]:void 0;return j&&(T=>{for(let O=0;O{if(m){const T=typeof m=="string"?m:m instanceof Error?m.message:m.error;i.w(`Unable to perform style diff: ${T}. Rebuilding the style from scratch.`),this._updateStyle(b,d)}else j&&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 ih(this,m).load(b),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new ih(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:j=!1,stretchX:T,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:ee}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:H,height:Y},ee),pixelRatio:m,stretchX:T,stretchY:O,content:D,sdf:j,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,ee=d;this.style.addImage(B,{data:new i.q({width:H,height:Y},new Uint8Array(ee.data)),pixelRatio:m,stretchX:T,stretchY:O,content:D,sdf:j,usvg:!1,version:0,userImage:ee}),ee.onAdd&&ee.onAdd(this,b)}}updateImage(b,d){this._lazyInitEmptyStyle();const m=i.I.from(b),j=this.style.getImage(m);if(!j)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 T=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?i.o.getImageData(d):d,{width:O,height:D,data:B}=T;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!==(j.usvg?j.icon.usvg_tree.width:j.data.width)||D!==(j.usvg?j.icon.usvg_tree.height:j.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 (${j.data.width}, ${j.data.height})`)));const H=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;j.usvg?(j.data=new i.q({width:O,height:D},new Uint8Array(B)),j.usvg=!1,j.icon=void 0,Y=!0):j.data.replace(B,H),this.style.updateImage(m,j,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,j)=>{d(m,j instanceof HTMLImageElement?i.o.getImageData(j):j)})}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,j={}){return this._isValidId(b)?(this.style.setPaintProperty(b,d,m,j),this._update(!0)):this}getPaintProperty(b,d){return this._isValidId(b)?this.style.getPaintProperty(b,d):null}setLayoutProperty(b,d,m,j={}){return this._isValidId(b)?(this.style.setLayoutProperty(b,d,m,j),this._update(!0)):this}getLayoutProperty(b,d){return this._isValidId(b)?this.style.getLayoutProperty(b,d):null}setLayerProperty(b,d,m,j={}){return this._isValidId(b)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(b,d,m,j),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 u0),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,j,T,O=this._container;for(;O&&(!j||!T);){const D=window.getComputedStyle(O).transform;D&&D!=="none"&&(m=D.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(j=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(T=m[3])),O=O.parentElement}this._containerWidth=j?Math.abs(b/j):b,this._containerHeight=T?Math.abs(d/T):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 fP(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),j=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(T=>{j[T]=N("div",`mapboxgl-ctrl-${T}`,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({},S.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",b);d?(We(d,!0),this.painter=new jN(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,j=i.o.now(),T=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=T.createQuery(),T.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,ee=this.transform.pitch,de=i.o.now(),ce=new i.ac(Y,{now:de,fadeDuration:O,pitch:ee,transition:this.style.transition,worldview:this._worldview});this.style.update(ce)}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(j),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):D=this._updateAverageElevation(j);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()-j;T.endQuery(m.TIME_ELAPSED_EXT),setTimeout(()=>{const ee=T.getQueryParameter(d,T.QUERY_RESULT)/1e6;T.deleteQuery(d),this.fire(new i.z("gpu-timing-frame",{cpuTime:Y,gpuTime:ee}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const ee=this.painter.queryGpuTimers(Y);this.fire(new i.z("gpu-timing-layer",{layerTimes:ee}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const ee=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new i.z("gpu-timing-deferred-render",{gpuTime:ee}))},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(j,!0)),D)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new i.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const ee=this._calculateSpeedIndex();this.fire(new i.z("speedindexcompleted",{speedIndex:ee})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||H||(this._fullyLoaded=!0,x.mark(p.fullLoad),this._performanceMetricsCollection&&Qe(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=T=>(this.transform.averageElevation=T,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);const j=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(j||(d||b-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(b)){const T=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(T-O);if(D>1){if(this._isInitialLoad||j)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(){Ve(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,b=>{if(b&&(b.message===xe||b.status===401)){const d=this.painter.context.gl;We(d,!1),this._logoControl instanceof r_&&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/")))}}),Te(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ue(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Be(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){ht(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,j=m.createFramebuffer();function T(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,j),this._canvasPixelComparison(T(b),d.canvasCopies.map(T),d.timeStamps)}_canvasPixelComparison(b,d,m){let j=m[1]-m[0];const T=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,j)=>m._preloadTiles(b,j),()=>{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 u}},NavigationControl:class{constructor(b={}){this.options=Object.assign({},Rie,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(),j=d===b.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=j,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",j.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 Fie(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},zie,b),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=kN(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,j=this._map.getBearing(),T=Object.assign({bearing:j},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(m),T,{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 RN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=N("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new RN({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:t_,ScaleControl:class{constructor(b={}){this.options=Object.assign({},h0,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,j=d._containerWidth/2-b/2,T=d.unproject([j,m]),O=d.unproject([j+b,m]),D=T.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 j=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),T=j/d;this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:m}).format(j):`${j} ${q5[m]}`,this._container.style.width=b*T+"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:u0,Popup:class extends i.E{constructor(b){super(),this.options=Object.assign(Object.create(lh),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 j;for(m.innerHTML=b;j=m.firstChild,j;)d.appendChild(j);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,j=this._pos;if(!d||!m||!j)return"bottom";const T=m.offsetWidth,O=m.offsetHeight,D=j.xd.transform.width-T/2;if(j.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 j=this._container;if(j||(j=this._container=N("div","mapboxgl-popup",d.getContainer()),this._tip=N("div","mapboxgl-popup-tip",j),j.appendChild(m)),this.options.maxWidth&&j.style.maxWidth!==this.options.maxWidth&&(j.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=U5(this._lngLat,this._pos,d.transform)),!this._trackPointer||b){const T=this._pos=this._trackPointer&&b instanceof i.P?b:d.project(this._lngLat,this._altitude),O=gx(this.options.offset),D=this._anchor=this._getAnchor(O.y),B=gx(this.options.offset,D),H=T.add(B).round();d._requestDomTask(()=>{this._container&&D&&(this._container.style.transform=`${Sc[D]} translate(${H.x}px,${H.y}px)`)})}if(!this._marker&&d._showingGlobe()){const T=i.f5(d.transform,this._lngLat)?0:1;this._setOpacity(T)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const b=this._container.querySelector(ch);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:RN,Style:ih,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:ld,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})})(vLe);var Xit=vLe.exports;const tc=Wi(Xit);function Ir({className:t,...e}){return r.jsx("div",{className:zt("animate-pulse rounded-md bg-muted",t),...e})}const Wje={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 Qit(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function Jit({listings:t,isLoading:e}){const n=Gn(),s=I.useRef(null),a=I.useRef(null),o=I.useRef([]),[l,i]=I.useState(""),[u,p]=I.useState(!0);return I.useEffect(()=>{(async()=>{p(!0);try{const{data:_}=await Q.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;tc.accessToken=l;const y=t.filter(S=>S.latitude!=null&&S.longitude!=null);let _=[-98.5795,39.8283],w=4;if(y.length>0){const S=y.reduce((M,E)=>M+E.longitude,0)/y.length,N=y.reduce((M,E)=>M+E.latitude,0)/y.length;_=[S,N],w=y.length===1?12:10}return a.current=new tc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:w,center:_}),a.current.addControl(new tc.NavigationControl,"top-right"),()=>{var S;(S=a.current)==null||S.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,R,U;const w=Wje[_.status]||"#10B981",S=((z=_.photos)==null?void 0:z.find(V=>V.is_primary))||((R=_.photos)==null?void 0:R[0]),M=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 A=new tc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${S!=null&&S.photo_url?``:""}
${Qit(_.price)}
${_.property_address||""}
${_.city}, ${_.state}
${Gje[_.status]||_.status} ${_.bedrooms?`${_.bedrooms} bed`:""} ${_.bathrooms?`${_.bathrooms} bath`:""}
${(U=_.agent)!=null&&U.name?`
Listed by ${_.agent.name}
`:""}
Click to view details →
`),P=new tc.Marker(E).setLngLat([_.longitude,_.latitude]).setPopup(A).addTo(a.current);o.current.push(P)}),y.length>1){const _=new tc.LngLatBounds;y.forEach(w=>_.extend([w.longitude,w.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]),u||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(Wje).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 gE(t,[e,n]){return Math.min(n,Math.max(e,t))}function zI(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 eot=[" ","Enter","ArrowUp","ArrowDown"],tot=[" ","Enter"],Xj="Select",[dse,use,rot]=jI(Xj),[_3]=lc(Xj,[rot,Wg]),hse=Wg(),[not,mv]=_3(Xj),[sot,aot]=_3(Xj),bLe=t=>{const{__scopeSelect:e,children:n,open:s,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:u,dir:p,name:x,autoComplete:y,disabled:_,required:w,form:S}=t,N=hse(e),[M,E]=I.useState(null),[A,P]=I.useState(null),[z,R]=I.useState(!1),U=xk(p),[V,K]=Ku({prop:s,defaultProp:a??!1,onChange:o,caller:Xj}),[W,J]=Ku({prop:l,defaultProp:i,onChange:u,caller:Xj}),ae=I.useRef(null),oe=M?S||!!M.closest("form"):!0,[xe,ie]=I.useState(new Set),pe=Array.from(xe).map(se=>se.props.value).join(";");return r.jsx(CI,{...N,children:r.jsxs(not,{required:w,scope:e,trigger:M,onTriggerChange:E,valueNode:A,onValueNodeChange:P,valueNodeHasChildren:z,onValueNodeHasChildrenChange:R,contentId:Qc(),value:W,onValueChange:J,open:V,onOpenChange:K,dir:U,triggerPointerDownPosRef:ae,disabled:_,children:[r.jsx(dse.Provider,{scope:e,children:r.jsx(sot,{scope:t.__scopeSelect,onNativeOptionAdd:I.useCallback(se=>{ie(fe=>new Set(fe).add(se))},[]),onNativeOptionRemove:I.useCallback(se=>{ie(fe=>{const he=new Set(fe);return he.delete(se),he})},[]),children:n})}),oe?r.jsxs(HLe,{"aria-hidden":!0,required:w,tabIndex:-1,name:x,autoComplete:y,value:W,onChange:se=>J(se.target.value),disabled:_,form:S,children:[W===void 0?r.jsx("option",{value:""}):null,Array.from(xe)]},pe):null]})})};bLe.displayName=Xj;var wLe="SelectTrigger",jLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:s=!1,...a}=t,o=hse(n),l=mv(wLe,n),i=l.disabled||s,u=ra(e,l.onTriggerChange),p=use(n),x=I.useRef("touch"),[y,_,w]=GLe(N=>{const M=p().filter(P=>!P.disabled),E=M.find(P=>P.value===l.value),A=KLe(M,N,E);A!==void 0&&l.onValueChange(A.value)}),S=N=>{i||(l.onOpenChange(!0),w()),N&&(l.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return r.jsx(d3,{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":WLe(l.value)?"":void 0,...a,ref:u,onClick:cn(a.onClick,N=>{N.currentTarget.focus(),x.current!=="mouse"&&S(N)}),onPointerDown:cn(a.onPointerDown,N=>{x.current=N.pointerType;const M=N.target;M.hasPointerCapture(N.pointerId)&&M.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(S(N),N.preventDefault())}),onKeyDown:cn(a.onKeyDown,N=>{const M=y.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&_(N.key),!(M&&N.key===" ")&&eot.includes(N.key)&&(S(),N.preventDefault())})})})});jLe.displayName=wLe;var kLe="SelectValue",NLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:a,children:o,placeholder:l="",...i}=t,u=mv(kLe,n),{onValueNodeHasChildrenChange:p}=u,x=o!==void 0,y=ra(e,u.onValueNodeChange);return ic(()=>{p(x)},[p,x]),r.jsx(Rn.span,{...i,ref:y,style:{pointerEvents:"none"},children:WLe(u.value)?r.jsx(r.Fragment,{children:l}):o})});NLe.displayName=kLe;var iot="SelectIcon",SLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,children:s,...a}=t;return r.jsx(Rn.span,{"aria-hidden":!0,...a,ref:e,children:s||"▼"})});SLe.displayName=iot;var oot="SelectPortal",CLe=t=>r.jsx(a3,{asChild:!0,...t});CLe.displayName=oot;var Qj="SelectContent",MLe=I.forwardRef((t,e)=>{const n=mv(Qj,t.__scopeSelect),[s,a]=I.useState();if(ic(()=>{a(new DocumentFragment)},[]),!n.open){const o=s;return o?Iy.createPortal(r.jsx(TLe,{scope:t.__scopeSelect,children:r.jsx(dse.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),o):null}return r.jsx(ALe,{...t,ref:e})});MLe.displayName=Qj;var Qp=10,[TLe,gv]=_3(Qj),lot="SelectContentImpl",cot=ev("SelectContent.RemoveScroll"),ALe=I.forwardRef((t,e)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:u,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:_,collisionPadding:w,sticky:S,hideWhenDetached:N,avoidCollisions:M,...E}=t,A=mv(Qj,n),[P,z]=I.useState(null),[R,U]=I.useState(null),V=ra(e,Ue=>z(Ue)),[K,W]=I.useState(null),[J,ae]=I.useState(null),oe=use(n),[xe,ie]=I.useState(!1),pe=I.useRef(!1);I.useEffect(()=>{if(P)return tse(P)},[P]),ese();const se=I.useCallback(Ue=>{const[Re,...Be]=oe().map(Me=>Me.ref.current),[Ye]=Be.slice(-1),ht=document.activeElement;for(const Me of Ue)if(Me===ht||(Me==null||Me.scrollIntoView({block:"nearest"}),Me===Re&&R&&(R.scrollTop=0),Me===Ye&&R&&(R.scrollTop=R.scrollHeight),Me==null||Me.focus(),document.activeElement!==ht))return},[oe,R]),fe=I.useCallback(()=>se([K,P]),[se,K,P]);I.useEffect(()=>{xe&&fe()},[xe,fe]);const{onOpenChange:he,triggerPointerDownPosRef:ye}=A;I.useEffect(()=>{if(P){let Ue={x:0,y:0};const Re=Ye=>{var ht,Me;Ue={x:Math.abs(Math.round(Ye.pageX)-(((ht=ye.current)==null?void 0:ht.x)??0)),y:Math.abs(Math.round(Ye.pageY)-(((Me=ye.current)==null?void 0:Me.y)??0))}},Be=Ye=>{Ue.x<=10&&Ue.y<=10?Ye.preventDefault():P.contains(Ye.target)||he(!1),document.removeEventListener("pointermove",Re),ye.current=null};return ye.current!==null&&(document.addEventListener("pointermove",Re),document.addEventListener("pointerup",Be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Re),document.removeEventListener("pointerup",Be,{capture:!0})}}},[P,he,ye]),I.useEffect(()=>{const Ue=()=>he(!1);return window.addEventListener("blur",Ue),window.addEventListener("resize",Ue),()=>{window.removeEventListener("blur",Ue),window.removeEventListener("resize",Ue)}},[he]);const[Ce,Se]=GLe(Ue=>{const Re=oe().filter(ht=>!ht.disabled),Be=Re.find(ht=>ht.ref.current===document.activeElement),Ye=KLe(Re,Ue,Be);Ye&&setTimeout(()=>Ye.ref.current.focus())}),Ne=I.useCallback((Ue,Re,Be)=>{const Ye=!pe.current&&!Be;(A.value!==void 0&&A.value===Re||Ye)&&(W(Ue),Ye&&(pe.current=!0))},[A.value]),be=I.useCallback(()=>P==null?void 0:P.focus(),[P]),rt=I.useCallback((Ue,Re,Be)=>{const Ye=!pe.current&&!Be;(A.value!==void 0&&A.value===Re||Ye)&&ae(Ue)},[A.value]),Te=s==="popper"?whe:ELe,Pe=Te===whe?{side:i,sideOffset:u,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:_,collisionPadding:w,sticky:S,hideWhenDetached:N,avoidCollisions:M}:{};return r.jsx(TLe,{scope:n,content:P,viewport:R,onViewportChange:U,itemRefCallback:Ne,selectedItem:K,onItemLeave:be,itemTextRefCallback:rt,focusSelectedItem:fe,selectedItemText:J,position:s,isPositioned:xe,searchRef:Ce,children:r.jsx(LI,{as:cot,allowPinchZoom:!0,children:r.jsx(II,{asChild:!0,trapped:A.open,onMountAutoFocus:Ue=>{Ue.preventDefault()},onUnmountAutoFocus:cn(a,Ue=>{var Re;(Re=A.trigger)==null||Re.focus({preventScroll:!0}),Ue.preventDefault()}),children:r.jsx(uv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ue=>Ue.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:r.jsx(Te,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:Ue=>Ue.preventDefault(),...E,...Pe,onPlaced:()=>ie(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:cn(E.onKeyDown,Ue=>{const Re=Ue.ctrlKey||Ue.altKey||Ue.metaKey;if(Ue.key==="Tab"&&Ue.preventDefault(),!Re&&Ue.key.length===1&&Se(Ue.key),["ArrowUp","ArrowDown","Home","End"].includes(Ue.key)){let Ye=oe().filter(ht=>!ht.disabled).map(ht=>ht.ref.current);if(["ArrowUp","End"].includes(Ue.key)&&(Ye=Ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ue.key)){const ht=Ue.target,Me=Ye.indexOf(ht);Ye=Ye.slice(Me+1)}setTimeout(()=>se(Ye)),Ue.preventDefault()}})})})})})})});ALe.displayName=lot;var dot="SelectItemAlignedPosition",ELe=I.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:s,...a}=t,o=mv(Qj,n),l=gv(Qj,n),[i,u]=I.useState(null),[p,x]=I.useState(null),y=ra(e,V=>x(V)),_=use(n),w=I.useRef(!1),S=I.useRef(!0),{viewport:N,selectedItem:M,selectedItemText:E,focusSelectedItem:A}=l,P=I.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&p&&N&&M&&E){const V=o.trigger.getBoundingClientRect(),K=p.getBoundingClientRect(),W=o.valueNode.getBoundingClientRect(),J=E.getBoundingClientRect();if(o.dir!=="rtl"){const ht=J.left-K.left,Me=W.left-ht,Qe=V.left-Me,le=V.width+Qe,Ve=Math.max(le,K.width),Le=window.innerWidth-Qp,We=gE(Me,[Qp,Math.max(Qp,Le-Ve)]);i.style.minWidth=le+"px",i.style.left=We+"px"}else{const ht=K.right-J.right,Me=window.innerWidth-W.right-ht,Qe=window.innerWidth-V.right-Me,le=V.width+Qe,Ve=Math.max(le,K.width),Le=window.innerWidth-Qp,We=gE(Me,[Qp,Math.max(Qp,Le-Ve)]);i.style.minWidth=le+"px",i.style.right=We+"px"}const ae=_(),oe=window.innerHeight-Qp*2,xe=N.scrollHeight,ie=window.getComputedStyle(p),pe=parseInt(ie.borderTopWidth,10),se=parseInt(ie.paddingTop,10),fe=parseInt(ie.borderBottomWidth,10),he=parseInt(ie.paddingBottom,10),ye=pe+se+xe+he+fe,Ce=Math.min(M.offsetHeight*5,ye),Se=window.getComputedStyle(N),Ne=parseInt(Se.paddingTop,10),be=parseInt(Se.paddingBottom,10),rt=V.top+V.height/2-Qp,Te=oe-rt,Pe=M.offsetHeight/2,Ue=M.offsetTop+Pe,Re=pe+se+Ue,Be=ye-Re;if(Re<=rt){const ht=ae.length>0&&M===ae[ae.length-1].ref.current;i.style.bottom="0px";const Me=p.clientHeight-N.offsetTop-N.offsetHeight,Qe=Math.max(Te,Pe+(ht?be:0)+Me+fe),le=Re+Qe;i.style.height=le+"px"}else{const ht=ae.length>0&&M===ae[0].ref.current;i.style.top="0px";const Qe=Math.max(rt,pe+N.offsetTop+(ht?Ne:0)+Pe)+Be;i.style.height=Qe+"px",N.scrollTop=Re-rt+N.offsetTop}i.style.margin=`${Qp}px 0`,i.style.minHeight=Ce+"px",i.style.maxHeight=oe+"px",s==null||s(),requestAnimationFrame(()=>w.current=!0)}},[_,o.trigger,o.valueNode,i,p,N,M,E,o.dir,s]);ic(()=>P(),[P]);const[z,R]=I.useState();ic(()=>{p&&R(window.getComputedStyle(p).zIndex)},[p]);const U=I.useCallback(V=>{V&&S.current===!0&&(P(),A==null||A(),S.current=!1)},[P,A]);return r.jsx(hot,{scope:n,contentWrapper:i,shouldExpandOnScrollRef:w,onScrollButtonChange:U,children:r.jsx("div",{ref:u,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}})})})});ELe.displayName=dot;var uot="SelectPopperPosition",whe=I.forwardRef((t,e)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=Qp,...o}=t,l=hse(n);return r.jsx(MI,{...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)"}})});whe.displayName=uot;var[hot,oxe]=_3(Qj,{}),jhe="SelectViewport",ILe=I.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:s,...a}=t,o=gv(jhe,n),l=oxe(jhe,n),i=ra(e,o.onViewportChange),u=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(dse.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:cn(a.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:_}=l;if(_!=null&&_.current&&y){const w=Math.abs(u.current-x.scrollTop);if(w>0){const S=window.innerHeight-Qp*2,N=parseFloat(y.style.minHeight),M=parseFloat(y.style.height),E=Math.max(N,M);if(E0?z:0,y.style.justifyContent="flex-end")}}}u.current=x.scrollTop})})})]})});ILe.displayName=jhe;var PLe="SelectGroup",[fot,pot]=_3(PLe),mot=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=Qc();return r.jsx(fot,{scope:n,id:a,children:r.jsx(Rn.div,{role:"group","aria-labelledby":a,...s,ref:e})})});mot.displayName=PLe;var LLe="SelectLabel",OLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=pot(LLe,n);return r.jsx(Rn.div,{id:a.id,...s,ref:e})});OLe.displayName=LLe;var xte="SelectItem",[got,DLe]=_3(xte),RLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:o,...l}=t,i=mv(xte,n),u=gv(xte,n),p=i.value===s,[x,y]=I.useState(o??""),[_,w]=I.useState(!1),S=ra(e,A=>{var P;return(P=u.itemRefCallback)==null?void 0:P.call(u,A,s,a)}),N=Qc(),M=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(got,{scope:n,value:s,disabled:a,textId:N,isSelected:p,onItemTextChange:I.useCallback(A=>{y(P=>P||((A==null?void 0:A.textContent)??"").trim())},[]),children:r.jsx(dse.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:S,onFocus:cn(l.onFocus,()=>w(!0)),onBlur:cn(l.onBlur,()=>w(!1)),onClick:cn(l.onClick,()=>{M.current!=="mouse"&&E()}),onPointerUp:cn(l.onPointerUp,()=>{M.current==="mouse"&&E()}),onPointerDown:cn(l.onPointerDown,A=>{M.current=A.pointerType}),onPointerMove:cn(l.onPointerMove,A=>{var P;M.current=A.pointerType,a?(P=u.onItemLeave)==null||P.call(u):M.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:cn(l.onPointerLeave,A=>{var P;A.currentTarget===document.activeElement&&((P=u.onItemLeave)==null||P.call(u))}),onKeyDown:cn(l.onKeyDown,A=>{var z;((z=u.searchRef)==null?void 0:z.current)!==""&&A.key===" "||(tot.includes(A.key)&&E(),A.key===" "&&A.preventDefault())})})})})});RLe.displayName=xte;var _T="SelectItemText",FLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:a,...o}=t,l=mv(_T,n),i=gv(_T,n),u=DLe(_T,n),p=aot(_T,n),[x,y]=I.useState(null),_=ra(e,E=>y(E),u.onItemTextChange,E=>{var A;return(A=i.itemTextRefCallback)==null?void 0:A.call(i,E,u.value,u.disabled)}),w=x==null?void 0:x.textContent,S=I.useMemo(()=>r.jsx("option",{value:u.value,disabled:u.disabled,children:w},u.value),[u.disabled,u.value,w]),{onNativeOptionAdd:N,onNativeOptionRemove:M}=p;return ic(()=>(N(S),()=>M(S)),[N,M,S]),r.jsxs(r.Fragment,{children:[r.jsx(Rn.span,{id:u.textId,...o,ref:_}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Iy.createPortal(o.children,l.valueNode):null]})});FLe.displayName=_T;var zLe="SelectItemIndicator",BLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return DLe(zLe,n).isSelected?r.jsx(Rn.span,{"aria-hidden":!0,...s,ref:e}):null});BLe.displayName=zLe;var khe="SelectScrollUpButton",$Le=I.forwardRef((t,e)=>{const n=gv(khe,t.__scopeSelect),s=oxe(khe,t.__scopeSelect),[a,o]=I.useState(!1),l=ra(e,s.onScrollButtonChange);return ic(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=u.scrollTop>0;o(p)};const u=n.viewport;return i(),u.addEventListener("scroll",i),()=>u.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(qLe,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop-u.offsetHeight)}}):null});$Le.displayName=khe;var Nhe="SelectScrollDownButton",ULe=I.forwardRef((t,e)=>{const n=gv(Nhe,t.__scopeSelect),s=oxe(Nhe,t.__scopeSelect),[a,o]=I.useState(!1),l=ra(e,s.onScrollButtonChange);return ic(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=u.scrollHeight-u.clientHeight,x=Math.ceil(u.scrollTop)u.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(qLe,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop+u.offsetHeight)}}):null});ULe.displayName=Nhe;var qLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=t,o=gv("SelectScrollButton",n),l=I.useRef(null),i=use(n),u=I.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return I.useEffect(()=>()=>u(),[u]),ic(()=>{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:cn(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:cn(a.onPointerMove,()=>{var p;(p=o.onItemLeave)==null||p.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:cn(a.onPointerLeave,()=>{u()})})}),xot="SelectSeparator",VLe=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return r.jsx(Rn.div,{"aria-hidden":!0,...s,ref:e})});VLe.displayName=xot;var She="SelectArrow",yot=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=hse(n),o=mv(She,n),l=gv(She,n);return o.open&&l.position==="popper"?r.jsx(TI,{...a,...s,ref:e}):null});yot.displayName=She;var vot="SelectBubbleInput",HLe=I.forwardRef(({__scopeSelect:t,value:e,...n},s)=>{const a=I.useRef(null),o=ra(s,a),l=zI(e);return I.useEffect(()=>{const i=a.current;if(!i)return;const u=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(u,"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:{...$Ae,...n.style},ref:o,defaultValue:e})});HLe.displayName=vot;function WLe(t){return t===""||t===void 0}function GLe(t){const e=nc(t),n=I.useRef(""),s=I.useRef(0),a=I.useCallback(l=>{const i=n.current+l;e(i),function u(p){n.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>u(""),1e3))}(i)},[e]),o=I.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,o]}function KLe(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=_ot(t,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const u=l.find(p=>p.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function _ot(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var bot=bLe,ZLe=jLe,wot=NLe,jot=SLe,kot=CLe,YLe=MLe,Not=ILe,XLe=OLe,QLe=RLe,Sot=FLe,Cot=BLe,JLe=$Le,eOe=ULe,tOe=VLe;const xn=bot,vn=wot,fn=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(ZLe,{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(jot,{asChild:!0,children:r.jsx(Qd,{className:"h-4 w-4 opacity-50"})})]}));fn.displayName=ZLe.displayName;const rOe=I.forwardRef(({className:t,...e},n)=>r.jsx(JLe,{ref:n,className:zt("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(T1,{className:"h-4 w-4"})}));rOe.displayName=JLe.displayName;const nOe=I.forwardRef(({className:t,...e},n)=>r.jsx(eOe,{ref:n,className:zt("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(Qd,{className:"h-4 w-4"})}));nOe.displayName=eOe.displayName;const pn=I.forwardRef(({className:t,children:e,position:n="popper",...s},a)=>r.jsx(kot,{children:r.jsxs(YLe,{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(rOe,{}),r.jsx(Not,{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(nOe,{})]})}));pn.displayName=YLe.displayName;const Mot=I.forwardRef(({className:t,...e},n)=>r.jsx(XLe,{ref:n,className:zt("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Mot.displayName=XLe.displayName;const qt=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(QLe,{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(Cot,{children:r.jsx(_i,{className:"h-4 w-4"})})}),r.jsx(Sot,{children:e})]}));qt.displayName=QLe.displayName;const Tot=I.forwardRef(({className:t,...e},n)=>r.jsx(tOe,{ref:n,className:zt("-mx-1 my-1 h-px bg-muted",t),...e}));Tot.displayName=tOe.displayName;const Aot=t=>Kt({queryKey:["public-listings",t],queryFn:async()=>{let e=Q.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}}),sOe=t=>Kt({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=Q.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}),aOe=()=>or({mutationFn:async({listingId:t,agentId:e,firstName:n,lastName:s,email:a,phone:o,shareToken:l})=>{let i=null,u=null;if(l){const{data:_}=await Q.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",t).maybeSingle();_&&(i=_.id,u=_.sharing_agent_id)}const{data:p,error:x}=await Q.from("listing_leads").insert({listing_id:t,agent_id:u||e,first_name:n,last_name:s,email:a,phone:o,share_id:i,referred_by_agent_id:u}).select().single();if(x)throw x;const{error:y}=await Q.functions.invoke("process-listing-lead",{body:{leadId:p.id}});return y&&console.error("Error processing lead:",y),p}}),Eot=()=>or({mutationFn:async t=>{const{error:e}=await Q.rpc("increment_listing_share_click",{p_share_token:t});if(e)throw e}}),Iot={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Kje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Pot={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function iOe(){const[t,e]=I.useState(""),[n,s]=I.useState(!1),[a,o]=I.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=Aot({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}),u=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(Im,{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(Ji,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:yLe,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(${Yit})`},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(ya,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(ot,{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(te,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(ya,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(te,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(dA,{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(xn,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(vn,{placeholder:"Any status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"Any status"}),Object.entries(Kje).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(xn,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(vn,{placeholder:"Any type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"Any type"}),Object.entries(Pot).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(ot,{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(ot,{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(te,{variant:"ghost",size:"sm",onClick:p,className:"gap-1 text-gray-500",children:[r.jsx(gs,{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(Jit,{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,M,E;const _=((N=y.photos)==null?void 0:N.find(A=>A.is_primary))||((M=y.photos)==null?void 0:M[0]),S=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return r.jsx(Ji,{to:S,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(ua,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Lt,{className:`absolute top-2 left-2 ${Iot[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:Kje[y.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:A=>A.preventDefault(),children:r.jsx(fi,{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:u(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(ua,{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(te,{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:ixe,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 Ke=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}));Ke.displayName="Card";const Ht=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("flex flex-col space-y-1.5 p-6",t),...e}));Ht.displayName="CardHeader";const 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 Cn=I.forwardRef(({className:t,...e},n)=>r.jsx("p",{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Cn.displayName="CardDescription";const et=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("p-6 pt-0",t),...e}));et.displayName="CardContent";const _A=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("flex items-center p-6 pt-0",t),...e}));_A.displayName="CardFooter";var Lot="Label",oOe=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())}}));oOe.displayName=Lot;var lOe=oOe;const Oot=i3("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),qe=I.forwardRef(({className:t,...e},n)=>r.jsx(lOe,{ref:n,className:zt(Oot(),t),...e}));qe.displayName=lOe.displayName;const yte="/assets/levelup-logo-color-D3mY9gCJ.png";function Dot(){const t=Em(),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(iOe,{}):s.startsWith("public/")?null:r.jsx(Rot,{slug:s})}function Rot({slug:t}){return r.jsx(Bot,{slug:t})}const Fot={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},zot={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Zje={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Bot({slug:t}){var W,J;const{data:e,isLoading:n}=sOe(t),s=aOe(),[a,o]=I.useState(""),[l,i]=I.useState(""),[u,p]=I.useState(""),[x,y]=I.useState(""),[_,w]=I.useState(!1),[S,N]=I.useState(!1),[M,E]=I.useState(null),A=ae=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ae),P=async ae=>{if(ae.preventDefault(),!(!a.trim()||!u.trim()||!e)){w(!0);try{await s.mutateAsync({listingId:e.id,agentId:e.agent_id,firstName:a.trim(),lastName:l.trim(),email:u.trim(),phone:x.trim()}),N(!0),Oe.success("Thanks! The agent will be in touch soon.")}catch(oe){console.error("Lead submission error:",oe),Oe.error(`Failed to submit: ${oe.message||"Please try again"}`)}finally{w(!1)}}},z=(e==null?void 0:e.photos)||[],R=z.find(ae=>ae.is_primary)||z[0],U=()=>{M!==null&&E(M===0?z.length-1:M-1)},V=()=>{M!==null&&E(M===z.length-1?0:M+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:yte,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(ua,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(te,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const K=e.property_address?`${e.property_address} - ${e.city}, ${e.state}`:`${e.city}, ${e.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(Im,{children:[r.jsxs("title",{children:[K," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${A(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA ${e.square_footage?e.square_footage.toLocaleString()+" sqft":""} ${Zje[e.property_type]} in ${e.city}, ${e.state}. ${((W=e.description)==null?void 0:W.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:K}),r.jsx("meta",{property:"og:description",content:`${A(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA in ${e.city}, ${e.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),R&&r.jsx("meta",{property:"og:image",content:R.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:yte,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(io,{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:R==null?void 0:R.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((ae,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:ae.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"]})]},ae.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(Lt,{className:`${Fot[e.status]} text-white border-0`,children:zot[e.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:A(e.price)}),e.property_address&&r.jsx("p",{className:"text-xl font-medium",children:e.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(To,{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(M1,{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(C1,{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(Ag,{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(Ds,{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(Lt,{variant:"secondary",children:[r.jsx(li,{className:"h-3 w-3 mr-1"}),Zje[e.property_type]]}),e.lot_size&&r.jsxs(Lt,{variant:"secondary",children:["Lot: ",e.lot_size]}),e.has_hoa&&r.jsx(Lt,{variant:"secondary",children:"HOA"})]}),e.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.description})]}),e.agent_notes&&e.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.agent_notes})]}),e.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:e.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[e.agent&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ac,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:e.agent.name}),((J=e.agent.brokerage)==null?void 0:J.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.agent.brokerage.name})]})]}),r.jsxs(Ke,{className:"border-primary",children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{children:S?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(ws,{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(qe,{htmlFor:"firstName",children:"First Name *"}),r.jsx(ot,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:ae=>o(ae.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"lastName",children:"Last Name"}),r.jsx(ot,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ae=>i(ae.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"email",children:"Email *"}),r.jsx(ot,{id:"email",type:"email",placeholder:"you@example.com",value:u,onChange:ae=>p(ae.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ae=>y(ae.target.value)})]}),r.jsx(te,{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(Dr,{open:M!==null,onOpenChange:()=>E(null),children:r.jsxs(Or,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Br,{className:"sr-only",children:r.jsx(zr,{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(gs,{className:"h-5 w-5"})}),M!==null&&z[M]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:z[M].photo_url,alt:`Photo ${M+1}`,className:"w-full max-h-[80vh] object-contain"}),z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:U,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(vc,{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(Bi,{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:[M+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 fse({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 cOe=t=>Kt({queryKey:["agent-card-public",t],queryFn:async()=>{if(!t)throw new Error("No slug provided");const{data:e,error:n}=await Q.from("agent_cards").select("*").eq("slug",t).eq("is_published",!0).single();if(n)throw n;const{data:s}=await Q.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 Q.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 Q.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 Q.storage.from("avatars").list(`${e.user_id}`);if(i&&i.length>0){const{data:u}=Q.storage.from("avatars").getPublicUrl(`${e.user_id}/${i[0].name}`);o=`${u.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}),$ot=()=>Kt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:t,error:e}=await Q.from("agent_cards").select("*").order("created_at",{ascending:!1});if(e)throw e;return t}}),Uot=t=>Kt({queryKey:["agent-card",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await Q.from("agent_cards").select("*").eq("user_id",t).maybeSingle();if(n)throw n;return e},enabled:!!t}),dOe=()=>{const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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"]}),Oe.success("Agent card created")},onError:e=>Oe.error(e.message)})},uOe=()=>{const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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"]}),Oe.success("Agent card updated")},onError:e=>Oe.error(e.message)})},Ei=async(t,e,n,s)=>{const a=new URLSearchParams(window.location.search);await Q.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:{}})},qot=async(t,e)=>{const{error:n}=await Q.from("agent_card_leads").insert({card_id:t,...e});if(n)throw n},hOe=t=>Kt({queryKey:["agent-card-analytics",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await Q.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 Q.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(u=>u.interaction_type==="card_view").length)||0,l=(e==null?void 0:e.filter(u=>u.interaction_type==="button_click").length)||0,i=(e==null?void 0:e.filter(u=>u.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:i,leads:s||[],interactions:e||[]}},enabled:!!t});function pse({open:t,onOpenChange:e,cardId:n,type:s,agentName:a}){const[o,l]=I.useState(""),[i,u]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(""),[w,S]=I.useState(""),[N,M]=I.useState(!1),E=async A=>{if(A.preventDefault(),!o.trim()){Oe.error("Please enter your name");return}M(!0);try{await qot(n,{lead_type:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:w.trim()||void 0,intent:y||void 0}),Ei(n,"lead_submitted",s),Q.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:w.trim()||void 0,intent:y||void 0}}).catch(P=>console.error("Card lead notify failed:",P)),Oe.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(""),u(""),x(""),_(""),S("")}catch{Oe.error("Something went wrong. Please try again.")}finally{M(!1)}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Jn,{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(qe,{htmlFor:"lead-name",children:"Name *"}),r.jsx(ot,{id:"lead-name",value:o,onChange:A=>l(A.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"lead-phone",children:"Phone"}),r.jsx(ot,{id:"lead-phone",type:"tel",value:p,onChange:A=>x(A.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"lead-email",children:"Email"}),r.jsx(ot,{id:"lead-email",type:"email",value:i,onChange:A=>u(A.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(xn,{value:y,onValueChange:_,children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(ot,{id:"lead-message",value:w,onChange:A=>S(A.target.value),placeholder:s==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),r.jsx(te,{type:"submit",className:"w-full rounded-2xl",disabled:N,children:N?"Sending...":"Submit"})]})]})})}const Vot=t=>Kt({queryKey:["card-blocks",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.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}),Hot=t=>Kt({queryKey:["card-blocks-all",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.from("card_blocks").select("*").eq("card_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e||[]},enabled:!!t}),Wot=()=>{const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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]}),Oe.success("Block added")},onError:e=>Oe.error(e.message)})},Got=()=>{const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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"]}),Oe.success("Block updated")},onError:e=>Oe.error(e.message)})},Kot=()=>{const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("card_blocks").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),Oe.success("Block removed")},onError:e=>Oe.error(e.message)})};function Zot(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 Yot(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 Xot={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 Qot({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=Yot(n.video_url),o=s||!!a,l=s?Zot(n.video_url):a||n.video_url;return r.jsx("div",{className:Xot[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 Jot={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 elt({block:t,variant:e}){const s=t.config.testimonials||[],[a,o]=I.useState(0);if(s.length===0)return null;const l=Jot[e],i=s[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(sA,{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(u=>(u-1+s.length)%s.length),className:l.nav,children:r.jsx(vc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((u,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(u=>(u+1)%s.length),className:l.nav,children:r.jsx(Bi,{className:"h-4 w-4"})})]})]})}const tlt={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 rlt({block:t,variant:e}){const s=t.config.tags||[];if(s.length===0)return null;const a=tlt[e];return r.jsx("div",{className:a.container,children:s.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const nlt={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 slt({block:t,cardId:e,variant:n}){const a=t.config.links||[];if(a.length===0)return null;const o=nlt[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:()=>Ei(e,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Os,{className:`h-4 w-4 ${o.icon}`})]},i))})}const Che={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 alt({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 ilt={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 olt({block:t,cardId:e,variant:n}){const a=t.config.platforms||[],o=ilt[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 u=Che[l.platform.toLowerCase()];return!u||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ei(e,"button_click",`social_${l.platform}`),className:o.linkClass,title:u.label,children:r.jsx(alt,{path:u.icon,color:u.color})},i)})})]})}function mse({cardId:t,variant:e}){const{data:n}=Vot(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(Qot,{block:l,variant:e},l.id);case"testimonials":return r.jsx(elt,{block:l,variant:e},l.id);case"specialties":return r.jsx(rlt,{block:l,variant:e},l.id);case"custom_links":return r.jsx(slt,{block:l,cardId:t,variant:e},l.id);default:return null}}),o&&r.jsx(olt,{block:o,cardId:t,variant:e})]})}async function llt(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 clt(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 gse(t){const{first:e,last:n}=clt(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 llt(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),Oe.success("Contact saved!")}function dlt({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(A=>A[0]).join("").toUpperCase().slice(0,2),i=(A,P)=>{Ei(t.id,"button_click",A),P()},u=()=>i("call",()=>{var A;(A=t.profile)!=null&&A.phone?window.location.href=`tel:${t.profile.phone}`:Oe.error("Phone number not available")}),p=()=>i("text",()=>{var A;(A=t.profile)!=null&&A.phone?window.location.href=`sms:${t.profile.phone}`:Oe.error("Phone number not available")}),x=()=>i("email",()=>{var A;(A=t.profile)!=null&&A.email?window.location.href=`mailto:${t.profile.email}`:Oe.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ei(t.id,"button_click","book"))},_=()=>{var A,P;Ei(t.id,"contact_saved"),gse({name:o,phone:(A=t.profile)==null?void 0:A.phone,email:(P=t.profile)==null?void 0:P.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},w=async()=>{if(Ei(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),Oe.success("Link copied!")},S=()=>{a("referral"),n(!0),Ei(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ei(t.id,"button_click","connect")},M={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(Ys,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Pi,{src:t.avatar_url||void 0,alt:o}),r.jsx(Xs,{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(te,{onClick:u,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(ji,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(te,{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(Do,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(te,{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(ws,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(te,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(Ds,{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(_s,{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(fse,{card:t,variant:"standard"}),r.jsx(mse,{cardId:t.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[t.show_save_contact&&r.jsxs(te,{variant:"ghost",onClick:_,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(ao,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs(te,{variant:"ghost",onClick:()=>{Ei(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(_s,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),t.show_refer_friend&&r.jsxs(te,{variant:"ghost",onClick:S,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(te,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(hf,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(te,{variant:"ghost",onClick:w,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(_c,{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((A,P)=>r.jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ei(t.id,"button_click",`social_${A.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:M[A.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(pse,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function ult({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(A=>A[0]).join("").toUpperCase().slice(0,2),i=(A,P)=>{Ei(t.id,"button_click",A),P()},u=()=>i("call",()=>{var A;(A=t.profile)!=null&&A.phone?window.location.href=`tel:${t.profile.phone}`:Oe.error("Phone number not available")}),p=()=>i("text",()=>{var A;(A=t.profile)!=null&&A.phone?window.location.href=`sms:${t.profile.phone}`:Oe.error("Phone number not available")}),x=()=>i("email",()=>{var A;(A=t.profile)!=null&&A.email?window.location.href=`mailto:${t.profile.email}`:Oe.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ei(t.id,"button_click","book"))},_=()=>{var A,P;Ei(t.id,"contact_saved"),gse({name:o,phone:(A=t.profile)==null?void 0:A.phone,email:(P=t.profile)==null?void 0:P.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},w=async()=>{if(Ei(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),Oe.success("Link copied!")},S=()=>{a("referral"),n(!0),Ei(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ei(t.id,"button_click","connect")},M={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(Ys,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Pi,{src:t.avatar_url||void 0,alt:o}),r.jsx(Xs,{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:ji,label:"Call",handler:u},{icon:Do,label:"Text",handler:p},{icon:ws,label:"Email",handler:x}].map(({icon:A,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(A,{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(Ds,{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(_s,{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(fse,{card:t,variant:"luxury"}),r.jsx(mse,{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(ao,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ei(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(_s,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:S,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(hf,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),r.jsxs("button",{onClick:w,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(_c,{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((A,P)=>r.jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ei(t.id,"button_click",`social_${A.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:M[A.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx(pse,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function hlt({card:t}){var P,z,R,U;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:((R=t.bold_theme_colors)==null?void 0:R.dark)||"#1a1a2e",button:((U=t.bold_theme_colors)==null?void 0:U.button)||"#ff5722"},u=(V,K)=>{const W=parseInt(V.replace("#",""),16),J=Math.max(0,(W>>16)-K),ae=Math.max(0,(W>>8&255)-K),oe=Math.max(0,(W&255)-K);return`#${(J<<16|ae<<8|oe).toString(16).padStart(6,"0")}`};u(i.accent,25),u(i.dark,-20),u(i.button,25);const p=(V,K)=>{Ei(t.id,"button_click",V),K()},x=()=>p("call",()=>{var V;(V=t.profile)!=null&&V.phone?window.location.href=`tel:${t.profile.phone}`:Oe.error("Phone number not available")}),y=()=>p("text",()=>{var V;(V=t.profile)!=null&&V.phone?window.location.href=`sms:${t.profile.phone}`:Oe.error("Phone number not available")}),_=()=>p("email",()=>{var V;(V=t.profile)!=null&&V.email?window.location.href=`mailto:${t.profile.email}`:Oe.error("Email not available")}),w=()=>{t.booking_url?p("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ei(t.id,"button_click","book"))},S=()=>{var V,K;Ei(t.id,"contact_saved"),gse({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(Ei(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),Oe.success("Link copied!")},M=()=>{a("referral"),n(!0),Ei(t.id,"button_click","refer")},E=()=>{a("connect"),n(!0),Ei(t.id,"button_click","connect")},A={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(Ys,{className:"h-28 w-28 mx-auto mb-4 shadow-2xl",style:{boxShadow:`0 0 0 4px ${i.accent}`},children:[r.jsx(Pi,{src:t.avatar_url||void 0,alt:o}),r.jsx(Xs,{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:ji,label:"Call",handler:x},{icon:Do,label:"Text",handler:y},{icon:ws,label:"Email",handler:_}].map(({icon:V,label:K,handler:W})=>r.jsxs("button",{onClick:W,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:w,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(Ds,{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(_s,{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(fse,{card:t,variant:"bold"}),r.jsx(mse,{cardId:t.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:S,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(ao,{className:"h-4 w-4",style:{color:i.accent}})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ei(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(_s,{className:"h-4 w-4",style:{color:i.accent}})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:M,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(hf,{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(_c,{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:()=>Ei(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:A[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(pse,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function flt({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(A=>A[0]).join("").toUpperCase().slice(0,2),i=(A,P)=>{Ei(t.id,"button_click",A),P()},u=()=>i("call",()=>{var A;(A=t.profile)!=null&&A.phone?window.location.href=`tel:${t.profile.phone}`:Oe.error("Phone number not available")}),p=()=>i("text",()=>{var A;(A=t.profile)!=null&&A.phone?window.location.href=`sms:${t.profile.phone}`:Oe.error("Phone number not available")}),x=()=>i("email",()=>{var A;(A=t.profile)!=null&&A.email?window.location.href=`mailto:${t.profile.email}`:Oe.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ei(t.id,"button_click","book"))},_=()=>{var A,P;Ei(t.id,"contact_saved"),gse({name:o,phone:(A=t.profile)==null?void 0:A.phone,email:(P=t.profile)==null?void 0:P.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},w=async()=>{if(Ei(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),Oe.success("Link copied!")},S=()=>{a("referral"),n(!0),Ei(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ei(t.id,"button_click","connect")},M={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(Ys,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Pi,{src:t.avatar_url||void 0,alt:o}),r.jsx(Xs,{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:ji,label:"Call",handler:u},{icon:Do,label:"Text",handler:p},{icon:ws,label:"Email",handler:x}].map(({icon:A,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(A,{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(Ds,{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(_s,{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(fse,{card:t,variant:"classic"}),r.jsx(mse,{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(ao,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ei(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(_s,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:S,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(hf,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),r.jsxs("button",{onClick:w,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(_c,{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((A,P)=>r.jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ei(t.id,"button_click",`social_${A.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:M[A.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx(pse,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function lxe({card:t}){switch(t.theme){case"luxury":return r.jsx(ult,{card:t});case"bold":return r.jsx(hlt,{card:t});case"classic":return r.jsx(flt,{card:t});case"standard":default:return r.jsx(dlt,{card:t})}}function plt(){const t=Em();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(mlt,{slug:e})}function mlt({slug:t}){return r.jsx(glt,{slug:t})}function glt({slug:t}){var o;const{data:e,isLoading:n,error:s}=cOe(t);if(I.useEffect(()=>{e!=null&&e.id&&Ei(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(Im,{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(lxe,{card:e})]})}const Mhe="levelup_affiliate_ref",xlt=30,ylt=()=>{const[t]=rd();I.useEffect(()=>{const e=t.get("ref");if(e){const n={code:e.toUpperCase(),timestamp:Date.now()};localStorage.setItem(Mhe,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",e)}},[t])},vlt=()=>{try{const t=localStorage.getItem(Mhe);if(!t)return null;const e=JSON.parse(t),n=xlt*24*60*60*1e3;return Date.now()-e.timestamp>n?(localStorage.removeItem(Mhe),console.log("[Affiliate] Referral code expired"),null):e.code}catch{return null}},vte="/assets/levelup-logo-header-_ZX7DvlA.png",_lt="/assets/scale-your-team-ku4MPatU.png";function blt({open:t,onOpenChange:e}){return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Br,{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(li,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(zr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Jn,{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 fd={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"]}},wlt=[{icon:Gf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Rc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Ds,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Bl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:ka,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Zi,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],jlt=[{icon:Bn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:As,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:ji,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:of,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:To,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:gc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:fi,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Ig,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],klt=[{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."}],Nlt=()=>{const{user:t,loading:e}=Qr(),n=Gn(),[s]=rd();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),[u,p]=I.useState(!1),[x,y]=I.useState(""),[_,w]=I.useState(""),[S,N]=I.useState(""),[M,E]=I.useState(!1),[A,P]=I.useState(!1),z=(V,K=!1)=>{i({tier:V,skipTrial:K}),p(!0)};ylt(),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"&&Oe.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const R=async(V,K=!1)=>{if(!x){Oe.error("Please enter your email address");return}if(!_.trim()){Oe.error("Please enter your full name");return}E(!0),o(V+(K?"_direct":""));const W=vlt();try{const{data:J,error:ae}=await Q.functions.invoke("create-checkout",{body:{tier:V,email:x,name:_.trim(),couponCode:S.trim()||void 0,skipTrial:K,referralCode:W}});if(ae)throw ae;if(J!=null&&J.url)window.open(J.url,"_blank","noopener,noreferrer"),Oe.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(J){console.error("Checkout error:",J),Oe.error(J.message||"Failed to start checkout. Please try again.")}finally{E(!1),o(null),p(!1),i(null)}},U=()=>{l&&R(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:vte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(te,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(te,{size:"lg",onClick:()=>{var 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(Jo,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(te,{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(te,{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(li,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(te,{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(ac,{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:wlt.map((V,K)=>r.jsxs(Ke,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Ht,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(V.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:V.title})]}),r.jsx(et,{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(As,{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:jlt.map((V,K)=>r.jsxs(Ke,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(V.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Zt,{className:"text-lg font-semibold text-white",children:V.title})]}),r.jsx(et,{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(te,{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(Jo,{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(li,{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(_i,{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(te,{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(Bi,{className:"ml-2 w-5 h-5"})]}),r.jsxs(te,{size:"lg",variant:"outline",onClick:()=>P(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(Ds,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:_lt,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:klt.map((V,K)=>r.jsx(Ke,{className:"bg-muted/30 border-0",children:r.jsxs(et,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(W=>r.jsx(_s,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},W))}),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(te,{size:"lg",className:"px-12 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",onClick:()=>z("individual_agent"),children:["Start Free Trial",r.jsx(Jo,{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(Ke,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(ac,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:fd.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:fd.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:fd.individual_agent.period})]}),r.jsx(Cn,{className:"text-base mt-2",children:fd.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(Wa,{className:"w-4 h-4"}),fd.individual_agent.trial]})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:fd.individual_agent.features.map((V,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(_i,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},K))})}),r.jsxs(_A,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("individual_agent"),children:"Start Free Trial"}),r.jsx(te,{variant:"outline",className:"w-full rounded-full border-2 border-[#4a6b6d] text-[#4a6b6d] bg-white hover:bg-[#4a6b6d]/5 uppercase text-sm font-medium tracking-wide",onClick:()=>z("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(Ke,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[r.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 px-6 py-2 bg-[#4a6b6d] text-white text-sm font-semibold rounded-full shadow-lg",children:"Most Popular"}),r.jsxs(Ht,{className:"pb-4 pt-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(li,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-xl font-sans",children:fd.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:fd.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:fd.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:fd.brokerage_under_25.period})]}),r.jsx(Cn,{className:"text-base mt-2",children:fd.brokerage_under_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:fd.brokerage_under_25.features.map((V,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(_i,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},K))})}),r.jsx(_A,{className:"pt-4",children:r.jsx(te,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(Ke,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(li,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-xl font-sans",children:fd.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:fd.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:fd.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:fd.brokerage_over_25.period})]}),r.jsx(Cn,{className:"text-base mt-2",children:fd.brokerage_over_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:fd.brokerage_over_25.features.map((V,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(_i,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},K))})}),r.jsx(_A,{className:"pt-4",children:r.jsx(te,{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(te,{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(Jo,{className:"ml-2 w-5 h-5"})]}),r.jsx(te,{size:"lg",onClick:()=>n("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:vte,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(blt,{open:A,onOpenChange:P}),r.jsx(Dr,{open:u,onOpenChange:p,children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{children:[r.jsx(zr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Jn,{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(qe,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ot,{id:"dialog-name",type:"text",placeholder:"John Smith",value:_,onChange:V=>w(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(qe,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ot,{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(qe,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(ot,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:S,onChange:V=>N(V.target.value),className:"mt-1"})]})]}),r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:U,disabled:M,children:M?"Loading...":"Continue to Checkout"})]})})]})},Slt=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Im,{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"})]})]})]})]})})]}),Clt=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Im,{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"})]})]})]})]})})]}),Mlt=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Im,{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 so;(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})(so||(so={}));var Yje;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Yje||(Yje={}));const Ts=so.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),z0=t=>{switch(typeof t){case"undefined":return Ts.undefined;case"string":return Ts.string;case"number":return Number.isNaN(t)?Ts.nan:Ts.number;case"boolean":return Ts.boolean;case"function":return Ts.function;case"bigint":return Ts.bigint;case"symbol":return Ts.symbol;case"object":return Array.isArray(t)?Ts.array:t===null?Ts.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ts.promise:typeof Map<"u"&&t instanceof Map?Ts.map:typeof Set<"u"&&t instanceof Set?Ts.set:typeof Date<"u"&&t instanceof Date?Ts.date:Ts.object;default:return Ts.unknown}},On=so.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 Bg 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,u=0;for(;un.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()}}Bg.create=t=>new Bg(t);const The=(t,e)=>{let n;switch(t.code){case On.invalid_type:t.received===Ts.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case On.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,so.jsonStringifyReplacer)}`;break;case On.unrecognized_keys:n=`Unrecognized key(s) in object: ${so.joinValues(t.keys,", ")}`;break;case On.invalid_union:n="Invalid input";break;case On.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${so.joinValues(t.options)}`;break;case On.invalid_enum_value:n=`Invalid enum value. Expected ${so.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}"`:so.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,so.assertNever(t)}return{message:n}};let Tlt=The;function Alt(){return Tlt}const Elt=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 u=s.filter(p=>!!p).slice().reverse();for(const p of u)i=p(l,{data:e,defaultError:i}).message;return{...a,path:o,message:i}};function ps(t,e){const n=Alt(),s=Elt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===The?void 0:The].filter(a=>!!a)});t.common.issues.push(s)}class xf{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 Ya;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 xf.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 Ya;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 Ya=Object.freeze({status:"aborted"}),bT=t=>({status:"dirty",value:t}),fp=t=>({status:"valid",value:t}),Xje=t=>t.status==="aborted",Qje=t=>t.status==="dirty",vC=t=>t.status==="valid",_te=t=>typeof Promise<"u"&&t instanceof Promise;var Bs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Bs||(Bs={}));class nv{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 Jje=(t,e)=>{if(vC(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 Bg(t.common.issues);return this._error=n,this._error}}};function bi(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:u}=t;return l.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:u??n??i.defaultError}},description:a}}class to{get description(){return this._def.description}_getType(e){return z0(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:z0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xf,ctx:{common:e.parent.common,data:e.data,parsedType:z0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(_te(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:z0(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Jje(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:z0(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return vC(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=>vC(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:z0(e)},a=this._parse({data:e,path:s.path,parent:s}),o=await(_te(a)?a:Promise.resolve(a));return Jje(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(u=>u?!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 wC({schema:this,typeName:Xa.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 V1.create(this,this._def)}nullable(){return jC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dg.create(this)}promise(){return kte.create(this,this._def)}or(e){return wte.create([this,e],this._def)}and(e){return jte.create(this,e,this._def)}transform(e){return new wC({...bi(this._def),schema:this,typeName:Xa.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Phe({...bi(this._def),innerType:this,defaultValue:n,typeName:Xa.ZodDefault})}brand(){return new ect({typeName:Xa.ZodBranded,type:this,...bi(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Lhe({...bi(this._def),innerType:this,catchValue:n,typeName:Xa.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return cxe.create(this,e)}readonly(){return Ohe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ilt=/^c[^\s-]{8,}$/i,Plt=/^[0-9a-z]+$/,Llt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Olt=/^[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,Dlt=/^[a-z0-9_-]{21}$/i,Rlt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Flt=/^[-+]?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)?)??$/,zlt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Blt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let lce;const $lt=/^(?:(?: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])$/,Ult=/^(?:(?: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])$/,qlt=/^(([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]))$/,Vlt=/^(([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])$/,Hlt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wlt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fOe="((\\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])))",Glt=new RegExp(`^${fOe}$`);function pOe(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 Klt(t){return new RegExp(`^${pOe(t)}$`)}function Zlt(t){let e=`${fOe}T${pOe(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 Ylt(t,e){return!!((e==="v4"||!e)&&$lt.test(t)||(e==="v6"||!e)&&qlt.test(t))}function Xlt(t,e){if(!Rlt.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 Qlt(t,e){return!!((e==="v4"||!e)&&Ult.test(t)||(e==="v6"||!e)&&Vlt.test(t))}class p1 extends to{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ts.string){const o=this._getOrReturnCtx(e);return ps(o,{code:On.invalid_type,expected:Ts.string,received:o.parsedType}),Ya}const s=new xf;let a;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(a=this._getOrReturnCtx(e,a),ps(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,...Bs.errToObj(s)})}_addCheck(e){return new p1({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Bs.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Bs.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Bs.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Bs.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Bs.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Bs.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Bs.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Bs.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Bs.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Bs.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Bs.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Bs.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Bs.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,...Bs.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,...Bs.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Bs.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Bs.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Bs.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Bs.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Bs.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Bs.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Bs.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Bs.errToObj(n)})}nonempty(e){return this.min(1,Bs.errToObj(e))}trim(){return new p1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new p1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new p1({...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 p1({checks:[],typeName:Xa.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...bi(t)});function Jlt(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 _C extends to{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)!==Ts.number){const o=this._getOrReturnCtx(e);return ps(o,{code:On.invalid_type,expected:Ts.number,received:o.parsedType}),Ya}let s;const a=new xf;for(const o of this._def.checks)o.kind==="int"?so.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),ps(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),ps(s,{code:On.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Jlt(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),ps(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),ps(s,{code:On.not_finite,message:o.message}),a.dirty()):so.assertNever(o);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Bs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bs.toString(n))}setLimit(e,n,s,a){return new _C({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Bs.toString(a)}]})}_addCheck(e){return new _C({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Bs.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Bs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Bs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Bs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Bs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bs.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Bs.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Bs.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Bs.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"&&so.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 _C({checks:[],typeName:Xa.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...bi(t)});class xE extends to{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)!==Ts.bigint)return this._getInvalidInput(e);let s;const a=new xf;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),ps(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),ps(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):so.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ps(n,{code:On.invalid_type,expected:Ts.bigint,received:n.parsedType}),Ya}gte(e,n){return this.setLimit("min",e,!0,Bs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bs.toString(n))}setLimit(e,n,s,a){return new xE({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Bs.toString(a)}]})}_addCheck(e){return new xE({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Bs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Bs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Bs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Bs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bs.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 xE({checks:[],typeName:Xa.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...bi(t)});class Ahe extends to{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ts.boolean){const s=this._getOrReturnCtx(e);return ps(s,{code:On.invalid_type,expected:Ts.boolean,received:s.parsedType}),Ya}return fp(e.data)}}Ahe.create=t=>new Ahe({typeName:Xa.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...bi(t)});class bte extends to{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ts.date){const o=this._getOrReturnCtx(e);return ps(o,{code:On.invalid_type,expected:Ts.date,received:o.parsedType}),Ya}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return ps(o,{code:On.invalid_date}),Ya}const s=new xf;let a;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(a=this._getOrReturnCtx(e,a),ps(a,{code:On.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):so.assertNever(o);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bte({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Bs.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Bs.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 bte({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Xa.ZodDate,...bi(t)});class eke extends to{_parse(e){if(this._getType(e)!==Ts.symbol){const s=this._getOrReturnCtx(e);return ps(s,{code:On.invalid_type,expected:Ts.symbol,received:s.parsedType}),Ya}return fp(e.data)}}eke.create=t=>new eke({typeName:Xa.ZodSymbol,...bi(t)});class tke extends to{_parse(e){if(this._getType(e)!==Ts.undefined){const s=this._getOrReturnCtx(e);return ps(s,{code:On.invalid_type,expected:Ts.undefined,received:s.parsedType}),Ya}return fp(e.data)}}tke.create=t=>new tke({typeName:Xa.ZodUndefined,...bi(t)});class rke extends to{_parse(e){if(this._getType(e)!==Ts.null){const s=this._getOrReturnCtx(e);return ps(s,{code:On.invalid_type,expected:Ts.null,received:s.parsedType}),Ya}return fp(e.data)}}rke.create=t=>new rke({typeName:Xa.ZodNull,...bi(t)});class nke extends to{constructor(){super(...arguments),this._any=!0}_parse(e){return fp(e.data)}}nke.create=t=>new nke({typeName:Xa.ZodAny,...bi(t)});class ske extends to{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fp(e.data)}}ske.create=t=>new ske({typeName:Xa.ZodUnknown,...bi(t)});class sv extends to{_parse(e){const n=this._getOrReturnCtx(e);return ps(n,{code:On.invalid_type,expected:Ts.never,received:n.parsedType}),Ya}}sv.create=t=>new sv({typeName:Xa.ZodNever,...bi(t)});class ake extends to{_parse(e){if(this._getType(e)!==Ts.undefined){const s=this._getOrReturnCtx(e);return ps(s,{code:On.invalid_type,expected:Ts.void,received:s.parsedType}),Ya}return fp(e.data)}}ake.create=t=>new ake({typeName:Xa.ZodVoid,...bi(t)});class Dg extends to{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),a=this._def;if(n.parsedType!==Ts.array)return ps(n,{code:On.invalid_type,expected:Ts.array,received:n.parsedType}),Ya;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,i=n.data.lengtha.maxLength.value&&(ps(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 nv(n,l,n.path,i)))).then(l=>xf.mergeArray(s,l));const o=[...n.data].map((l,i)=>a.type._parseSync(new nv(n,l,n.path,i)));return xf.mergeArray(s,o)}get element(){return this._def.type}min(e,n){return new Dg({...this._def,minLength:{value:e,message:Bs.toString(n)}})}max(e,n){return new Dg({...this._def,maxLength:{value:e,message:Bs.toString(n)}})}length(e,n){return new Dg({...this._def,exactLength:{value:e,message:Bs.toString(n)}})}nonempty(e){return this.min(1,e)}}Dg.create=(t,e)=>new Dg({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Xa.ZodArray,...bi(e)});function T4(t){if(t instanceof Pc){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=V1.create(T4(s))}return new Pc({...t._def,shape:()=>e})}else return t instanceof Dg?new Dg({...t._def,type:T4(t.element)}):t instanceof V1?V1.create(T4(t.unwrap())):t instanceof jC?jC.create(T4(t.unwrap())):t instanceof Jj?Jj.create(t.items.map(e=>T4(e))):t}class Pc extends to{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=so.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ts.object){const p=this._getOrReturnCtx(e);return ps(p,{code:On.invalid_type,expected:Ts.object,received:p.parsedType}),Ya}const{status:s,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof sv&&this._def.unknownKeys==="strip"))for(const p in a.data)l.includes(p)||i.push(p);const u=[];for(const p of l){const x=o[p],y=a.data[p];u.push({key:{status:"valid",value:p},value:x._parse(new nv(a,y,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof sv){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of i)u.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(p==="strict")i.length>0&&(ps(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];u.push({key:{status:"valid",value:x},value:p._parse(new nv(a,y,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of u){const y=await x.key,_=await x.value;p.push({key:y,value:_,alwaysSet:x.alwaysSet})}return p}).then(p=>xf.mergeObjectSync(s,p)):xf.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return Bs.errToObj,new Pc({...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:Bs.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Pc({...this._def,unknownKeys:"strip"})}passthrough(){return new Pc({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pc({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pc({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Xa.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Pc({...this._def,catchall:e})}pick(e){const n={};for(const s of so.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Pc({...this._def,shape:()=>n})}omit(e){const n={};for(const s of so.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new Pc({...this._def,shape:()=>n})}deepPartial(){return T4(this)}partial(e){const n={};for(const s of so.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?n[s]=a:n[s]=a.optional()}return new Pc({...this._def,shape:()=>n})}required(e){const n={};for(const s of so.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof V1;)o=o._def.innerType;n[s]=o}return new Pc({...this._def,shape:()=>n})}keyof(){return mOe(so.objectKeys(this.shape))}}Pc.create=(t,e)=>new Pc({shape:()=>t,unknownKeys:"strip",catchall:sv.create(),typeName:Xa.ZodObject,...bi(e)});Pc.strictCreate=(t,e)=>new Pc({shape:()=>t,unknownKeys:"strict",catchall:sv.create(),typeName:Xa.ZodObject,...bi(e)});Pc.lazycreate=(t,e)=>new Pc({shape:t,unknownKeys:"strip",catchall:sv.create(),typeName:Xa.ZodObject,...bi(e)});class wte extends to{_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 Bg(i.ctx.common.issues));return ps(n,{code:On.invalid_union,unionErrors:l}),Ya}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 u of s){const p={...n,common:{...n.common,issues:[]},parent:null},x=u._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(u=>new Bg(u));return ps(n,{code:On.invalid_union,unionErrors:i}),Ya}}get options(){return this._def.options}}wte.create=(t,e)=>new wte({options:t,typeName:Xa.ZodUnion,...bi(e)});function Ehe(t,e){const n=z0(t),s=z0(e);if(t===e)return{valid:!0,data:t};if(n===Ts.object&&s===Ts.object){const a=so.objectKeys(e),o=so.objectKeys(t).filter(i=>a.indexOf(i)!==-1),l={...t,...e};for(const i of o){const u=Ehe(t[i],e[i]);if(!u.valid)return{valid:!1};l[i]=u.data}return{valid:!0,data:l}}else if(n===Ts.array&&s===Ts.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let o=0;o{if(Xje(o)||Xje(l))return Ya;const i=Ehe(o.value,l.value);return i.valid?((Qje(o)||Qje(l))&&n.dirty(),{status:n.value,value:i.data}):(ps(s,{code:On.invalid_intersection_types}),Ya)};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}))}}jte.create=(t,e,n)=>new jte({left:t,right:e,typeName:Xa.ZodIntersection,...bi(n)});class Jj extends to{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ts.array)return ps(s,{code:On.invalid_type,expected:Ts.array,received:s.parsedType}),Ya;if(s.data.lengththis._def.items.length&&(ps(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 u=this._def.items[i]||this._def.rest;return u?u._parse(new nv(s,l,s.path,i)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>xf.mergeArray(n,l)):xf.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Jj({...this._def,rest:e})}}Jj.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jj({items:t,typeName:Xa.ZodTuple,rest:null,...bi(e)})};class ike extends to{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!==Ts.map)return ps(s,{code:On.invalid_type,expected:Ts.map,received:s.parsedType}),Ya;const a=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([i,u],p)=>({key:a._parse(new nv(s,i,s.path,[p,"key"])),value:o._parse(new nv(s,u,s.path,[p,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const u of l){const p=await u.key,x=await u.value;if(p.status==="aborted"||x.status==="aborted")return Ya;(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 u of l){const p=u.key,x=u.value;if(p.status==="aborted"||x.status==="aborted")return Ya;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}}}}ike.create=(t,e,n)=>new ike({valueType:e,keyType:t,typeName:Xa.ZodMap,...bi(n)});class yE extends to{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ts.set)return ps(s,{code:On.invalid_type,expected:Ts.set,received:s.parsedType}),Ya;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(ps(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(u){const p=new Set;for(const x of u){if(x.status==="aborted")return Ya;x.status==="dirty"&&n.dirty(),p.add(x.value)}return{status:n.value,value:p}}const i=[...s.data.values()].map((u,p)=>o._parse(new nv(s,u,s.path,p)));return s.common.async?Promise.all(i).then(u=>l(u)):l(i)}min(e,n){return new yE({...this._def,minSize:{value:e,message:Bs.toString(n)}})}max(e,n){return new yE({...this._def,maxSize:{value:e,message:Bs.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}yE.create=(t,e)=>new yE({valueType:t,minSize:null,maxSize:null,typeName:Xa.ZodSet,...bi(e)});class oke extends to{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})}}oke.create=(t,e)=>new oke({getter:t,typeName:Xa.ZodLazy,...bi(e)});class Ihe extends to{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ps(n,{received:n.data,code:On.invalid_literal,expected:this._def.value}),Ya}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ihe.create=(t,e)=>new Ihe({value:t,typeName:Xa.ZodLiteral,...bi(e)});function mOe(t,e){return new bC({values:t,typeName:Xa.ZodEnum,...bi(e)})}class bC extends to{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return ps(n,{expected:so.joinValues(s),received:n.parsedType,code:On.invalid_type}),Ya}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 ps(n,{received:n.data,code:On.invalid_enum_value,options:s}),Ya}return fp(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 bC.create(e,{...this._def,...n})}exclude(e,n=this._def){return bC.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}}bC.create=mOe;class lke extends to{_parse(e){const n=so.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Ts.string&&s.parsedType!==Ts.number){const a=so.objectValues(n);return ps(s,{expected:so.joinValues(a),received:s.parsedType,code:On.invalid_type}),Ya}if(this._cache||(this._cache=new Set(so.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=so.objectValues(n);return ps(s,{received:s.data,code:On.invalid_enum_value,options:a}),Ya}return fp(e.data)}get enum(){return this._def.values}}lke.create=(t,e)=>new lke({values:t,typeName:Xa.ZodNativeEnum,...bi(e)});class kte extends to{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ts.promise&&n.common.async===!1)return ps(n,{code:On.invalid_type,expected:Ts.promise,received:n.parsedType}),Ya;const s=n.parsedType===Ts.promise?n.data:Promise.resolve(n.data);return fp(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}kte.create=(t,e)=>new kte({type:t,typeName:Xa.ZodPromise,...bi(e)});class wC extends to{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xa.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=>{ps(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 Ya;const u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?Ya:u.status==="dirty"||n.value==="dirty"?bT(u.value):u});{if(n.value==="aborted")return Ya;const i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?Ya:i.status==="dirty"||n.value==="dirty"?bT(i.value):i}}if(a.type==="refinement"){const l=i=>{const u=a.refinement(i,o);if(s.common.async)return Promise.resolve(u);if(u 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"?Ya:(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"?Ya:(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(!vC(l))return Ya;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=>vC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:n.value,value:i})):Ya);so.assertNever(a)}}wC.create=(t,e,n)=>new wC({schema:t,typeName:Xa.ZodEffects,effect:e,...bi(n)});wC.createWithPreprocess=(t,e,n)=>new wC({schema:e,effect:{type:"preprocess",transform:t},typeName:Xa.ZodEffects,...bi(n)});class V1 extends to{_parse(e){return this._getType(e)===Ts.undefined?fp(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V1.create=(t,e)=>new V1({innerType:t,typeName:Xa.ZodOptional,...bi(e)});class jC extends to{_parse(e){return this._getType(e)===Ts.null?fp(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}jC.create=(t,e)=>new jC({innerType:t,typeName:Xa.ZodNullable,...bi(e)});class Phe extends to{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===Ts.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Phe.create=(t,e)=>new Phe({innerType:t,typeName:Xa.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...bi(e)});class Lhe extends to{_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 _te(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Bg(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Bg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Lhe.create=(t,e)=>new Lhe({innerType:t,typeName:Xa.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...bi(e)});class cke extends to{_parse(e){if(this._getType(e)!==Ts.nan){const s=this._getOrReturnCtx(e);return ps(s,{code:On.invalid_type,expected:Ts.nan,received:s.parsedType}),Ya}return{status:"valid",value:e.data}}}cke.create=t=>new cke({typeName:Xa.ZodNaN,...bi(t)});class ect extends to{_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 cxe extends to{_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"?Ya:o.status==="dirty"?(n.dirty(),bT(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"?Ya: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 cxe({in:e,out:n,typeName:Xa.ZodPipeline})}}class Ohe extends to{_parse(e){const n=this._def.innerType._parse(e),s=a=>(vC(a)&&(a.value=Object.freeze(a.value)),a);return _te(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}Ohe.create=(t,e)=>new Ohe({innerType:t,typeName:Xa.ZodReadonly,...bi(e)});var Xa;(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"})(Xa||(Xa={}));const fc=p1.create,bA=_C.create,tct=Ahe.create;sv.create;Dg.create;const b3=Pc.create;wte.create;jte.create;Jj.create;const dke=Ihe.create,gOe=bC.create;kte.create;V1.create;jC.create;const rct=b3({email:fc().email("Invalid email address"),password:fc().min(6,"Password must be at least 6 characters")}),nct=()=>{const{signIn:t,user:e}=Qr(),n=Gn(),[s,a]=I.useState(!1),[o,l]=I.useState({}),[i,u]=I.useState(""),[p,x]=I.useState(!1),[y,_]=I.useState(!1);I.useEffect(()=>{e&&n("/dashboard")},[e,n]);const w=async N=>{N.preventDefault(),l({}),a(!0);const M=new FormData(N.currentTarget),E=M.get("email"),A=M.get("password");try{rct.parse({email:E,password:A}),await t(E,A)}catch(P){if(P instanceof Bg){const z={};P.errors.forEach(R=>{R.path[0]&&(z[R.path[0]]=R.message)}),l(z)}}finally{a(!1)}},S=async()=>{if(!i){Oe.error("Please enter your email address");return}x(!0);try{const{error:N}=await Q.functions.invoke("send-password-reset",{body:{email:i,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(N)throw N;Oe.success("Password reset email sent! Check your inbox."),_(!1),u("")}catch(N){Oe.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(Ji,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(io,{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:yLe,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ke,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Ht,{className:"space-y-1 text-center pb-4",children:[r.jsx(Zt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(Cn,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:w,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(ot,{id:"signin-email",name:"email",type:"email",placeholder:"your@email.com",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.email&&r.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(ot,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&r.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),r.jsx(te,{type:"submit",className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white font-semibold py-6 text-lg transition-all duration-200 shadow-lg hover:shadow-xl",disabled:s,children:s?"Signing in...":"Sign In"}),r.jsxs(Dr,{open:y,onOpenChange:_,children:[r.jsx(Uo,{asChild:!0,children:r.jsx(te,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Or,{className:"bg-white",children:[r.jsxs(Br,{children:[r.jsx(zr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Jn,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(ot,{id:"reset-email",type:"email",placeholder:"your@email.com",value:i,onChange:N=>u(N.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(te,{onClick:S,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(Ji,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},sct=()=>{const[t]=rd(),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(Ke,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:r.jsx(Ii,{className:"w-10 h-10 text-green-500"})}),r.jsx(Zt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(Cn,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(et,{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(ws,{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."})})]})]})})},xOe=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 Q.storage.from("avatars").list(`${t}`);if(i&&i.length>0){const{data:u}=Q.storage.from("avatars").getPublicUrl(`${t}/${i[0].name}`);n(`${u.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 Q.storage.from("avatars").list(`${t}`);if(l&&l.length>0){const{data:i}=Q.storage.from("avatars").getPublicUrl(`${t}/${l[0].name}`);n(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},yOe=async t=>{const e=new Map;return await Promise.all(t.map(async n=>{try{const{data:s}=await Q.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:a}=Q.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);e.set(n,a.publicUrl)}}catch{}})),e},act=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 Q.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(u=>({...u,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 u=new Date().getTime(),p=new Date(a.subscription_end_date).getTime(),x=Math.ceil((p-u)/(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 u=new Date().getTime(),p=new Date(a.trial_expires_at).getTime(),x=Math.ceil((p-u)/(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},vOe=()=>{const{data:t,isLoading:e}=Kt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:a}=await Q.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")}},uke="community_last_seen_post_at";function ict(){const{user:t}=Qr(),e=Em(),[n,s]=I.useState(0),[a,o]=I.useState(null);I.useEffect(()=>{if(!t)return;const i=localStorage.getItem(`${uke}_${t.id}`);o(i)},[t]),I.useEffect(()=>{if(!t)return;(async()=>{let u=Q.from("community_posts").select("id",{count:"exact",head:!0});a&&(u=u.gt("created_at",a));const{data:p}=await Q.from("profiles").select("brokerage_id").eq("id",t.id).single(),{count:x,error:y}=await u;!y&&x!==null&&s(x)})()},[t,a]),I.useEffect(()=>{if(!t)return;const i=Q.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async u=>{const p=u.new;if(p.user_id===t.id)return;const x=e.pathname==="/community";x||s(S=>S+1);const{data:y}=await Q.from("profiles").select("name").eq("id",p.user_id).single(),_=(y==null?void 0:y.name)||"Someone",w=p.content.length>50?p.content.substring(0,50)+"...":p.content;x||Oe("New Community Post",{description:`${_}: ${w}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{Q.removeChannel(i)}},[t,e.pathname]);const l=I.useCallback(()=>{if(!t)return;const i=new Date().toISOString();localStorage.setItem(`${uke}_${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 oct(){const{isAdmin:t}=Qr(),{data:e=0}=Kt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await Q.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 xse=ose,dxe=axe,lct=lse,_Oe=I.forwardRef(({className:t,...e},n)=>r.jsx(y3,{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}));_Oe.displayName=y3.displayName;const cct=i3("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"}}),BI=I.forwardRef(({side:t="right",className:e,children:n,...s},a)=>r.jsxs(lct,{children:[r.jsx(_Oe,{}),r.jsxs(v3,{ref:a,className:zt(cct({side:t}),e),...s,children:[n,r.jsxs(cse,{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(gs,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));BI.displayName=v3.displayName;const yse=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-2 text-center sm:text-left",t),...e});yse.displayName="SheetHeader";const vse=I.forwardRef(({className:t,...e},n)=>r.jsx(RI,{ref:n,className:zt("text-lg font-semibold text-foreground",t),...e}));vse.displayName=RI.displayName;const dct=I.forwardRef(({className:t,...e},n)=>r.jsx(FI,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));dct.displayName=FI.displayName;function uct(t,e){return I.useReducer((n,s)=>e[n][s]??n,t)}var uxe="ScrollArea",[bOe]=lc(uxe),[hct,pp]=bOe(uxe),wOe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:a,scrollHideDelay:o=600,...l}=t,[i,u]=I.useState(null),[p,x]=I.useState(null),[y,_]=I.useState(null),[w,S]=I.useState(null),[N,M]=I.useState(null),[E,A]=I.useState(0),[P,z]=I.useState(0),[R,U]=I.useState(!1),[V,K]=I.useState(!1),W=ra(e,ae=>u(ae)),J=xk(a);return r.jsx(hct,{scope:n,type:s,dir:J,scrollHideDelay:o,scrollArea:i,viewport:p,onViewportChange:x,content:y,onContentChange:_,scrollbarX:w,onScrollbarXChange:S,scrollbarXEnabled:R,onScrollbarXEnabledChange:U,scrollbarY:N,onScrollbarYChange:M,scrollbarYEnabled:V,onScrollbarYEnabledChange:K,onCornerWidthChange:A,onCornerHeightChange:z,children:r.jsx(Rn.div,{dir:J,...l,ref:W,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":P+"px",...t.style}})})});wOe.displayName=uxe;var jOe="ScrollAreaViewport",kOe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:a,...o}=t,l=pp(jOe,n),i=I.useRef(null),u=ra(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:u,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})})]})});kOe.displayName=jOe;var Kg="ScrollAreaScrollbar",hxe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=pp(Kg,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(fct,{...s,ref:e,forceMount:n}):a.type==="scroll"?r.jsx(pct,{...s,ref:e,forceMount:n}):a.type==="auto"?r.jsx(NOe,{...s,ref:e,forceMount:n}):a.type==="always"?r.jsx(fxe,{...s,ref:e}):null});hxe.displayName=Kg;var fct=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=pp(Kg,t.__scopeScrollArea),[o,l]=I.useState(!1);return I.useEffect(()=>{const i=a.scrollArea;let u=0;if(i){const p=()=>{window.clearTimeout(u),l(!0)},x=()=>{u=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",p),i.addEventListener("pointerleave",x),()=>{window.clearTimeout(u),i.removeEventListener("pointerenter",p),i.removeEventListener("pointerleave",x)}}},[a.scrollArea,a.scrollHideDelay]),r.jsx(jc,{present:n||o,children:r.jsx(NOe,{"data-state":o?"visible":"hidden",...s,ref:e})})}),pct=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=pp(Kg,t.__scopeScrollArea),o=t.orientation==="horizontal",l=bse(()=>u("SCROLL_END"),100),[i,u]=uct("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(()=>u("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(p)}},[i,a.scrollHideDelay,u]),I.useEffect(()=>{const p=a.viewport,x=o?"scrollLeft":"scrollTop";if(p){let y=p[x];const _=()=>{const w=p[x];y!==w&&(u("SCROLL"),l()),y=w};return p.addEventListener("scroll",_),()=>p.removeEventListener("scroll",_)}},[a.viewport,o,u,l]),r.jsx(jc,{present:n||i!=="hidden",children:r.jsx(fxe,{"data-state":i==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:cn(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:cn(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),NOe=I.forwardRef((t,e)=>{const n=pp(Kg,t.__scopeScrollArea),{forceMount:s,...a}=t,[o,l]=I.useState(!1),i=t.orientation==="horizontal",u=bse(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=t,a=pp(Kg,t.__scopeScrollArea),o=I.useRef(null),l=I.useRef(0),[i,u]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=AOe(i.viewport,i.content),x={...s,sizes:i,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:_=>o.current=_,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:_=>l.current=_};function y(_,w){return _ct(_,l.current,i,w)}return n==="horizontal"?r.jsx(mct,{...x,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const _=a.viewport.scrollLeft,w=hke(_,i,a.dir);o.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:_=>{a.viewport&&(a.viewport.scrollLeft=_)},onDragScroll:_=>{a.viewport&&(a.viewport.scrollLeft=y(_,a.dir))}}):n==="vertical"?r.jsx(gct,{...x,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const _=a.viewport.scrollTop,w=hke(_,i);o.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:_=>{a.viewport&&(a.viewport.scrollTop=_)},onDragScroll:_=>{a.viewport&&(a.viewport.scrollTop=y(_))}}):null}),mct=I.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...a}=t,o=pp(Kg,t.__scopeScrollArea),[l,i]=I.useState(),u=I.useRef(null),p=ra(e,u,o.onScrollbarXChange);return I.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(COe,{"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":_se(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(_),IOe(_,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Ste(l.paddingLeft),paddingEnd:Ste(l.paddingRight)}})}})}),gct=I.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...a}=t,o=pp(Kg,t.__scopeScrollArea),[l,i]=I.useState(),u=I.useRef(null),p=ra(e,u,o.onScrollbarYChange);return I.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(COe,{"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":_se(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(_),IOe(_,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Ste(l.paddingTop),paddingEnd:Ste(l.paddingBottom)}})}})}),[xct,SOe]=bOe(Kg),COe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:x,onResize:y,..._}=t,w=pp(Kg,n),[S,N]=I.useState(null),M=ra(e,W=>N(W)),E=I.useRef(null),A=I.useRef(""),P=w.viewport,z=s.content-s.viewport,R=nc(x),U=nc(u),V=bse(y,10);function K(W){if(E.current){const J=W.clientX-E.current.left,ae=W.clientY-E.current.top;p({x:J,y:ae})}}return I.useEffect(()=>{const W=J=>{const ae=J.target;(S==null?void 0:S.contains(ae))&&R(J,z)};return document.addEventListener("wheel",W,{passive:!1}),()=>document.removeEventListener("wheel",W,{passive:!1})},[P,S,z,R]),I.useEffect(U,[s,U]),kC(S,V),kC(w.content,V),r.jsx(xct,{scope:n,scrollbar:S,hasThumb:a,onThumbChange:nc(o),onThumbPointerUp:nc(l),onThumbPositionChange:U,onThumbPointerDown:nc(i),children:r.jsx(Rn.div,{..._,ref:M,style:{position:"absolute",..._.style},onPointerDown:cn(t.onPointerDown,W=>{W.button===0&&(W.target.setPointerCapture(W.pointerId),E.current=S.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),K(W))}),onPointerMove:cn(t.onPointerMove,K),onPointerUp:cn(t.onPointerUp,W=>{const J=W.target;J.hasPointerCapture(W.pointerId)&&J.releasePointerCapture(W.pointerId),document.body.style.webkitUserSelect=A.current,w.viewport&&(w.viewport.style.scrollBehavior=""),E.current=null})})})}),Nte="ScrollAreaThumb",MOe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=SOe(Nte,t.__scopeScrollArea);return r.jsx(jc,{present:n||a.hasThumb,children:r.jsx(yct,{ref:e,...s})})}),yct=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...a}=t,o=pp(Nte,n),l=SOe(Nte,n),{onThumbPositionChange:i}=l,u=ra(e,y=>l.onThumbChange(y)),p=I.useRef(void 0),x=bse(()=>{p.current&&(p.current(),p.current=void 0)},100);return I.useEffect(()=>{const y=o.viewport;if(y){const _=()=>{if(x(),!p.current){const w=bct(y,i);p.current=w,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:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:cn(t.onPointerDownCapture,y=>{const w=y.target.getBoundingClientRect(),S=y.clientX-w.left,N=y.clientY-w.top;l.onThumbPointerDown({x:S,y:N})}),onPointerUp:cn(t.onPointerUp,l.onThumbPointerUp)})});MOe.displayName=Nte;var pxe="ScrollAreaCorner",TOe=I.forwardRef((t,e)=>{const n=pp(pxe,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(vct,{...t,ref:e}):null});TOe.displayName=pxe;var vct=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,a=pp(pxe,n),[o,l]=I.useState(0),[i,u]=I.useState(0),p=!!(o&&i);return kC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),u(x)}),kC(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 Ste(t){return t?parseInt(t,10):0}function AOe(t,e){const n=t/e;return isNaN(n)?0:n}function _se(t){const e=AOe(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function _ct(t,e,n,s="ltr"){const a=_se(n),o=a/2,l=e||o,i=a-l,u=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 EOe([u,p],y)(t)}function hke(t,e,n="ltr"){const s=_se(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-a,l=e.content-e.viewport,i=o-s,u=n==="ltr"?[0,l]:[l*-1,0],p=gE(t,u);return EOe([0,l],[0,i])(p)}function EOe(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 IOe(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 bse(t,e){const n=nc(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 kC(t,e){const n=nc(e);ic(()=>{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 POe=wOe,wct=kOe,jct=TOe;const Ro=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(POe,{ref:s,className:zt("relative overflow-hidden",t),...n,children:[r.jsx(wct,{className:"h-full w-full rounded-[inherit]",children:e}),r.jsx(mxe,{}),r.jsx(jct,{})]}));Ro.displayName=POe.displayName;const mxe=I.forwardRef(({className:t,orientation:e="vertical",...n},s)=>r.jsx(hxe,{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(MOe,{className:"relative flex-1 rounded-full bg-border"})}));mxe.displayName=hxe.displayName;var wse="Collapsible",[kct]=lc(wse),[Nct,gxe]=kct(wse),LOe=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:o,onOpenChange:l,...i}=t,[u,p]=Ku({prop:s,defaultProp:a??!1,onChange:l,caller:wse});return r.jsx(Nct,{scope:n,disabled:o,contentId:Qc(),open:u,onOpenToggle:I.useCallback(()=>p(x=>!x),[p]),children:r.jsx(Rn.div,{"data-state":yxe(u),"data-disabled":o?"":void 0,...i,ref:e})})});LOe.displayName=wse;var OOe="CollapsibleTrigger",DOe=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,a=gxe(OOe,n);return r.jsx(Rn.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":yxe(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:e,onClick:cn(t.onClick,a.onOpenToggle)})});DOe.displayName=OOe;var xxe="CollapsibleContent",ROe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=gxe(xxe,t.__scopeCollapsible);return r.jsx(jc,{present:n||a.open,children:({present:o})=>r.jsx(Sct,{...s,ref:e,present:o})})});ROe.displayName=xxe;var Sct=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:a,...o}=t,l=gxe(xxe,n),[i,u]=I.useState(s),p=I.useRef(null),x=ra(e,p),y=I.useRef(0),_=y.current,w=I.useRef(0),S=w.current,N=l.open||i,M=I.useRef(N),E=I.useRef(void 0);return I.useEffect(()=>{const A=requestAnimationFrame(()=>M.current=!1);return()=>cancelAnimationFrame(A)},[]),ic(()=>{const A=p.current;if(A){E.current=E.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const P=A.getBoundingClientRect();y.current=P.height,w.current=P.width,M.current||(A.style.transitionDuration=E.current.transitionDuration,A.style.animationName=E.current.animationName),u(s)}},[l.open,s]),r.jsx(Rn.div,{"data-state":yxe(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":S?`${S}px`:void 0,...t.style},children:N&&a})});function yxe(t){return t?"open":"closed"}var Cct=LOe;const DS=Cct,RS=DOe,FS=ROe,fke="/assets/levelup-logo-Eif24dqY.png",Mct="/assets/levelup-logo-icon-C-7iromj.png";var $I=t=>t.type==="checkbox",Zw=t=>t instanceof Date,Bu=t=>t==null;const FOe=t=>typeof t=="object";var wc=t=>!Bu(t)&&!Array.isArray(t)&&FOe(t)&&!Zw(t),zOe=t=>wc(t)&&t.target?$I(t.target)?t.target.checked:t.target.value:t,Tct=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,BOe=(t,e)=>t.has(Tct(e)),Act=t=>{const e=t.constructor&&t.constructor.prototype;return wc(e)&&e.hasOwnProperty("isPrototypeOf")},vxe=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Gc(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(!(vxe&&(t instanceof Blob||s))&&(n||wc(t)))if(e=n?[]:{},!n&&!Act(t))e=t;else for(const a in t)t.hasOwnProperty(a)&&(e[a]=Gc(t[a]));else return t;return e}var jse=t=>/^\w*$/.test(t),pc=t=>t===void 0,_xe=t=>Array.isArray(t)?t.filter(Boolean):[],bxe=t=>_xe(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Yn=(t,e,n)=>{if(!e||!wc(t))return n;const s=(jse(e)?[e]:bxe(e)).reduce((a,o)=>Bu(a)?a:a[o],t);return pc(s)||s===t?pc(t[e])?n:t[e]:s},Yh=t=>typeof t=="boolean",jo=(t,e,n)=>{let s=-1;const a=jse(e)?[e]:bxe(e),o=a.length,l=o-1;for(;++sit.useContext(wxe),Ect=t=>{const{children:e,...n}=t;return it.createElement(wxe.Provider,{value:n},e)};var $Oe=(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]!==cm.all&&(e._proxyFormState[l]=!s||cm.all),n&&(n[l]=!0),t[l]}});return a};const jxe=typeof window<"u"?it.useLayoutEffect:it.useEffect;function Ict(t){const e=kse(),{control:n=e.control,disabled:s,name:a,exact:o}=t||{},[l,i]=it.useState(n._formState),u=it.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return jxe(()=>n._subscribe({name:a,formState:u.current,exact:o,callback:p=>{!s&&i({...n._formState,...p})}}),[a,s,o]),it.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),it.useMemo(()=>$Oe(l,n,u.current,!1),[l,n])}var xg=t=>typeof t=="string",UOe=(t,e,n,s,a)=>xg(t)?(s&&e.watch.add(t),Yn(n,t,a)):Array.isArray(t)?t.map(o=>(s&&e.watch.add(o),Yn(n,o))):(s&&(e.watchAll=!0),n),Dhe=t=>Bu(t)||!FOe(t);function Bx(t,e,n=new WeakSet){if(Dhe(t)||Dhe(e))return t===e;if(Zw(t)&&Zw(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(Zw(l)&&Zw(i)||wc(l)&&wc(i)||Array.isArray(l)&&Array.isArray(i)?!Bx(l,i,n):l!==i)return!1}}return!0}function Pct(t){const e=kse(),{control:n=e.control,name:s,defaultValue:a,disabled:o,exact:l,compute:i}=t||{},u=it.useRef(a),p=it.useRef(i),x=it.useRef(void 0);p.current=i;const y=it.useMemo(()=>n._getWatch(s,u.current),[n,s]),[_,w]=it.useState(p.current?p.current(y):y);return jxe(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:S=>{if(!o){const N=UOe(s,n._names,S.values||n._formValues,!1,u.current);if(p.current){const M=p.current(N);Bx(M,x.current)||(w(M),x.current=M)}else w(N)}}}),[n,o,s,l]),it.useEffect(()=>n._removeUnmounted()),_}function Lct(t){const e=kse(),{name:n,disabled:s,control:a=e.control,shouldUnregister:o,defaultValue:l}=t,i=BOe(a._names.array,n),u=it.useMemo(()=>Yn(a._formValues,n,Yn(a._defaultValues,n,l)),[a,n,l]),p=Pct({control:a,name:n,defaultValue:u,exact:!0}),x=Ict({control:a,name:n,exact:!0}),y=it.useRef(t),_=it.useRef(a.register(n,{...t.rules,value:p,...Yh(t.disabled)?{disabled:t.disabled}:{}}));y.current=t;const w=it.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Yn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Yn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Yn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Yn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Yn(x.errors,n)}}),[x,n]),S=it.useCallback(A=>_.current.onChange({target:{value:zOe(A),name:n},type:Cte.CHANGE}),[n]),N=it.useCallback(()=>_.current.onBlur({target:{value:Yn(a._formValues,n),name:n},type:Cte.BLUR}),[n,a._formValues]),M=it.useCallback(A=>{const P=Yn(a._fields,n);P&&A&&(P._f.ref={focus:()=>A.focus&&A.focus(),select:()=>A.select&&A.select(),setCustomValidity:z=>A.setCustomValidity(z),reportValidity:()=>A.reportValidity()})},[a._fields,n]),E=it.useMemo(()=>({name:n,value:p,...Yh(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:S,onBlur:N,ref:M}),[n,s,x.disabled,S,N,M,p]);return it.useEffect(()=>{const A=a._options.shouldUnregister||o;a.register(n,{...y.current.rules,...Yh(y.current.disabled)?{disabled:y.current.disabled}:{}});const P=(z,R)=>{const U=Yn(a._fields,z);U&&U._f&&(U._f.mount=R)};if(P(n,!0),A){const z=Gc(Yn(a._options.defaultValues,n));jo(a._defaultValues,n,z),pc(Yn(a._formValues,n))&&jo(a._formValues,n,z)}return!i&&a.register(n),()=>{(i?A&&!a._state.action:A)?a.unregister(n):P(n,!1)}},[n,a,i,o]),it.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),it.useMemo(()=>({field:E,formState:x,fieldState:w}),[E,x,w])}const Oct=t=>t.render(Lct(t));var qOe=(t,e,n,s,a)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[s]:a||!0}}:{},wA=t=>Array.isArray(t)?t:[t],pke=()=>{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=[]}}},ph=t=>wc(t)&&!Object.keys(t).length,kxe=t=>t.type==="file",dm=t=>typeof t=="function",Mte=t=>{if(!vxe)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},VOe=t=>t.type==="select-multiple",Nxe=t=>t.type==="radio",Dct=t=>Nxe(t)||$I(t),cce=t=>Mte(t)&&t.isConnected;function Rct(t,e){const n=e.slice(0,-1).length;let s=0;for(;s{for(const e in t)if(dm(t[e]))return!0;return!1};function Tte(t,e={}){const n=Array.isArray(t);if(wc(t)||n)for(const s in t)Array.isArray(t[s])||wc(t[s])&&!HOe(t[s])?(e[s]=Array.isArray(t[s])?[]:{},Tte(t[s],e[s])):Bu(t[s])||(e[s]=!0);return e}function WOe(t,e,n){const s=Array.isArray(t);if(wc(t)||s)for(const a in t)Array.isArray(t[a])||wc(t[a])&&!HOe(t[a])?pc(e)||Dhe(n[a])?n[a]=Array.isArray(t[a])?Tte(t[a],[]):{...Tte(t[a])}:WOe(t[a],Bu(e)?{}:e[a],n[a]):n[a]=!Bx(t[a],e[a]);return n}var HM=(t,e)=>WOe(t,e,Tte(e));const mke={value:!1,isValid:!1},gke={value:!0,isValid:!0};var GOe=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&&!pc(t[0].attributes.value)?pc(t[0].value)||t[0].value===""?gke:{value:t[0].value,isValid:!0}:gke:mke}return mke},KOe=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:s})=>pc(t)?t:e?t===""?NaN:t&&+t:n&&xg(t)?new Date(t):s?s(t):t;const xke={isValid:!1,value:null};var ZOe=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,xke):xke;function yke(t){const e=t.ref;return kxe(e)?e.files:Nxe(e)?ZOe(t.refs).value:VOe(e)?[...e.selectedOptions].map(({value:n})=>n):$I(e)?GOe(t.refs).value:KOe(pc(e.value)?t.ref.value:e.value,t)}var zct=(t,e,n,s)=>{const a={};for(const o of t){const l=Yn(e,o);l&&jo(a,o,l._f)}return{criteriaMode:n,names:[...t],fields:a,shouldUseNativeValidation:s}},Ate=t=>t instanceof RegExp,WM=t=>pc(t)?t:Ate(t)?t.source:wc(t)?Ate(t.value)?t.value.source:t.value:t,vke=t=>({isOnSubmit:!t||t===cm.onSubmit,isOnBlur:t===cm.onBlur,isOnChange:t===cm.onChange,isOnAll:t===cm.all,isOnTouch:t===cm.onTouched});const _ke="AsyncFunction";var Bct=t=>!!t&&!!t.validate&&!!(dm(t.validate)&&t.validate.constructor.name===_ke||wc(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===_ke)),$ct=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),bke=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const jA=(t,e,n,s)=>{for(const a of n||Object.keys(t)){const o=Yn(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(jA(i,e))break}else if(wc(i)&&jA(i,e))break}}};function wke(t,e,n){const s=Yn(t,n);if(s||jse(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),l=Yn(e,o),i=Yn(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 Uct=(t,e,n,s)=>{n(t);const{name:a,...o}=t;return ph(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(l=>e[l]===(!s||cm.all))},qct=(t,e,n)=>!t||!e||t===e||wA(t).some(s=>s&&(n?s===e:s.startsWith(e)||e.startsWith(s))),Vct=(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,Hct=(t,e)=>!_xe(Yn(t,e)).length&&Ac(t,e),Wct=(t,e,n)=>{const s=wA(Yn(t,n));return jo(s,"root",e[n]),jo(t,n,s),t},vee=t=>xg(t);function jke(t,e,n="validate"){if(vee(t)||Array.isArray(t)&&t.every(vee)||Yh(t)&&!t)return{type:n,message:vee(t)?t:"",ref:e}}var g4=t=>wc(t)&&!Ate(t)?t:{value:t,message:""},kke=async(t,e,n,s,a,o)=>{const{ref:l,refs:i,required:u,maxLength:p,minLength:x,min:y,max:_,pattern:w,validate:S,name:N,valueAsNumber:M,mount:E}=t._f,A=Yn(n,N);if(!E||e.has(N))return{};const P=i?i[0]:l,z=oe=>{a&&P.reportValidity&&(P.setCustomValidity(Yh(oe)?"":oe||""),P.reportValidity())},R={},U=Nxe(l),V=$I(l),K=U||V,W=(M||kxe(l))&&pc(l.value)&&pc(A)||Mte(l)&&l.value===""||A===""||Array.isArray(A)&&!A.length,J=qOe.bind(null,N,s,R),ae=(oe,xe,ie,pe=wx.maxLength,se=wx.minLength)=>{const fe=oe?xe:ie;R[N]={type:oe?pe:se,message:fe,ref:l,...J(oe?pe:se,fe)}};if(o?!Array.isArray(A)||!A.length:u&&(!K&&(W||Bu(A))||Yh(A)&&!A||V&&!GOe(i).isValid||U&&!ZOe(i).isValid)){const{value:oe,message:xe}=vee(u)?{value:!!u,message:u}:g4(u);if(oe&&(R[N]={type:wx.required,message:xe,ref:P,...J(wx.required,xe)},!s))return z(xe),R}if(!W&&(!Bu(y)||!Bu(_))){let oe,xe;const ie=g4(_),pe=g4(y);if(!Bu(A)&&!isNaN(A)){const se=l.valueAsNumber||A&&+A;Bu(ie.value)||(oe=se>ie.value),Bu(pe.value)||(xe=senew Date(new Date().toDateString()+" "+Ce),he=l.type=="time",ye=l.type=="week";xg(ie.value)&&A&&(oe=he?fe(A)>fe(ie.value):ye?A>ie.value:se>new Date(ie.value)),xg(pe.value)&&A&&(xe=he?fe(A)+oe.value,pe=!Bu(xe.value)&&A.length<+xe.value;if((ie||pe)&&(ae(ie,oe.message,xe.message),!s))return z(R[N].message),R}if(w&&!W&&xg(A)){const{value:oe,message:xe}=g4(w);if(Ate(oe)&&!A.match(oe)&&(R[N]={type:wx.pattern,message:xe,ref:l,...J(wx.pattern,xe)},!s))return z(xe),R}if(S){if(dm(S)){const oe=await S(A,n),xe=jke(oe,P);if(xe&&(R[N]={...xe,...J(wx.validate,xe.message)},!s))return z(xe.message),R}else if(wc(S)){let oe={};for(const xe in S){if(!ph(oe)&&!s)break;const ie=jke(await S[xe](A,n),P,xe);ie&&(oe={...ie,...J(xe,ie.message)},z(ie.message),s&&(R[N]=oe))}if(!ph(oe)&&(R[N]={ref:P,...oe},!s))return R}}return z(!0),R};const Gct={mode:cm.onSubmit,reValidateMode:cm.onChange,shouldFocusError:!0};function Kct(t={}){let e={...Gct,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:dm(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},a=wc(e.defaultValues)||wc(e.values)?Gc(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:Gc(a),l={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u,p=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const _={array:pke(),state:pke()},w=e.criteriaMode===cm.all,S=ze=>Ee=>{clearTimeout(p),p=setTimeout(ze,Ee)},N=async ze=>{if(!e.disabled&&(x.isValid||y.isValid||ze)){const Ee=e.resolver?ph((await V()).errors):await W(s,!0);Ee!==n.isValid&&_.state.next({isValid:Ee})}},M=(ze,Ee)=>{!e.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((ze||Array.from(i.mount)).forEach(Je=>{Je&&(Ee?jo(n.validatingFields,Je,Ee):Ac(n.validatingFields,Je))}),_.state.next({validatingFields:n.validatingFields,isValidating:!ph(n.validatingFields)}))},E=(ze,Ee=[],Je,at,pt=!0,gt=!0)=>{if(at&&Je&&!e.disabled){if(l.action=!0,gt&&Array.isArray(Yn(s,ze))){const Mt=Je(Yn(s,ze),at.argA,at.argB);pt&&jo(s,ze,Mt)}if(gt&&Array.isArray(Yn(n.errors,ze))){const Mt=Je(Yn(n.errors,ze),at.argA,at.argB);pt&&jo(n.errors,ze,Mt),Hct(n.errors,ze)}if((x.touchedFields||y.touchedFields)&>&&Array.isArray(Yn(n.touchedFields,ze))){const Mt=Je(Yn(n.touchedFields,ze),at.argA,at.argB);pt&&jo(n.touchedFields,ze,Mt)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=HM(a,o)),_.state.next({name:ze,isDirty:ae(ze,Ee),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else jo(o,ze,Ee)},A=(ze,Ee)=>{jo(n.errors,ze,Ee),_.state.next({errors:n.errors})},P=ze=>{n.errors=ze,_.state.next({errors:n.errors,isValid:!1})},z=(ze,Ee,Je,at)=>{const pt=Yn(s,ze);if(pt){const gt=Yn(o,ze,pc(Je)?Yn(a,ze):Je);pc(gt)||at&&at.defaultChecked||Ee?jo(o,ze,Ee?gt:yke(pt._f)):ie(ze,gt),l.mount&&N()}},R=(ze,Ee,Je,at,pt)=>{let gt=!1,Mt=!1;const wt={name:ze};if(!e.disabled){if(!Je||at){(x.isDirty||y.isDirty)&&(Mt=n.isDirty,n.isDirty=wt.isDirty=ae(),gt=Mt!==wt.isDirty);const Xt=Bx(Yn(a,ze),Ee);Mt=!!Yn(n.dirtyFields,ze),Xt?Ac(n.dirtyFields,ze):jo(n.dirtyFields,ze,!0),wt.dirtyFields=n.dirtyFields,gt=gt||(x.dirtyFields||y.dirtyFields)&&Mt!==!Xt}if(Je){const Xt=Yn(n.touchedFields,ze);Xt||(jo(n.touchedFields,ze,Je),wt.touchedFields=n.touchedFields,gt=gt||(x.touchedFields||y.touchedFields)&&Xt!==Je)}gt&&pt&&_.state.next(wt)}return gt?wt:{}},U=(ze,Ee,Je,at)=>{const pt=Yn(n.errors,ze),gt=(x.isValid||y.isValid)&&Yh(Ee)&&n.isValid!==Ee;if(e.delayError&&Je?(u=S(()=>A(ze,Je)),u(e.delayError)):(clearTimeout(p),u=null,Je?jo(n.errors,ze,Je):Ac(n.errors,ze)),(Je?!Bx(pt,Je):pt)||!ph(at)||gt){const Mt={...at,...gt&&Yh(Ee)?{isValid:Ee}:{},errors:n.errors,name:ze};n={...n,...Mt},_.state.next(Mt)}},V=async ze=>{M(ze,!0);const Ee=await e.resolver(o,e.context,zct(ze||i.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return M(ze),Ee},K=async ze=>{const{errors:Ee}=await V(ze);if(ze)for(const Je of ze){const at=Yn(Ee,Je);at?jo(n.errors,Je,at):Ac(n.errors,Je)}else n.errors=Ee;return Ee},W=async(ze,Ee,Je={valid:!0})=>{for(const at in ze){const pt=ze[at];if(pt){const{_f:gt,...Mt}=pt;if(gt){const wt=i.array.has(gt.name),Xt=pt._f&&Bct(pt._f);Xt&&x.validatingFields&&M([at],!0);const Sr=await kke(pt,i.disabled,o,w,e.shouldUseNativeValidation&&!Ee,wt);if(Xt&&x.validatingFields&&M([at]),Sr[gt.name]&&(Je.valid=!1,Ee))break;!Ee&&(Yn(Sr,gt.name)?wt?Wct(n.errors,Sr,gt.name):jo(n.errors,gt.name,Sr[gt.name]):Ac(n.errors,gt.name))}!ph(Mt)&&await W(Mt,Ee,Je)}}return Je.valid},J=()=>{for(const ze of i.unMount){const Ee=Yn(s,ze);Ee&&(Ee._f.refs?Ee._f.refs.every(Je=>!cce(Je)):!cce(Ee._f.ref))&&Ue(ze)}i.unMount=new Set},ae=(ze,Ee)=>!e.disabled&&(ze&&Ee&&jo(o,ze,Ee),!Bx(Ce(),a)),oe=(ze,Ee,Je)=>UOe(ze,i,{...l.mount?o:pc(Ee)?a:xg(ze)?{[ze]:Ee}:Ee},Je,Ee),xe=ze=>_xe(Yn(l.mount?o:a,ze,e.shouldUnregister?Yn(a,ze,[]):[])),ie=(ze,Ee,Je={})=>{const at=Yn(s,ze);let pt=Ee;if(at){const gt=at._f;gt&&(!gt.disabled&&jo(o,ze,KOe(Ee,gt)),pt=Mte(gt.ref)&&Bu(Ee)?"":Ee,VOe(gt.ref)?[...gt.ref.options].forEach(Mt=>Mt.selected=pt.includes(Mt.value)):gt.refs?$I(gt.ref)?gt.refs.forEach(Mt=>{(!Mt.defaultChecked||!Mt.disabled)&&(Array.isArray(pt)?Mt.checked=!!pt.find(wt=>wt===Mt.value):Mt.checked=pt===Mt.value||!!pt)}):gt.refs.forEach(Mt=>Mt.checked=Mt.value===pt):kxe(gt.ref)?gt.ref.value="":(gt.ref.value=pt,gt.ref.type||_.state.next({name:ze,values:Gc(o)})))}(Je.shouldDirty||Je.shouldTouch)&&R(ze,pt,Je.shouldTouch,Je.shouldDirty,!0),Je.shouldValidate&&ye(ze)},pe=(ze,Ee,Je)=>{for(const at in Ee){if(!Ee.hasOwnProperty(at))return;const pt=Ee[at],gt=ze+"."+at,Mt=Yn(s,gt);(i.array.has(ze)||wc(pt)||Mt&&!Mt._f)&&!Zw(pt)?pe(gt,pt,Je):ie(gt,pt,Je)}},se=(ze,Ee,Je={})=>{const at=Yn(s,ze),pt=i.array.has(ze),gt=Gc(Ee);jo(o,ze,gt),pt?(_.array.next({name:ze,values:Gc(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Je.shouldDirty&&_.state.next({name:ze,dirtyFields:HM(a,o),isDirty:ae(ze,gt)})):at&&!at._f&&!Bu(gt)?pe(ze,gt,Je):ie(ze,gt,Je),bke(ze,i)&&_.state.next({...n,name:ze}),_.state.next({name:l.mount?ze:void 0,values:Gc(o)})},fe=async ze=>{l.mount=!0;const Ee=ze.target;let Je=Ee.name,at=!0;const pt=Yn(s,Je),gt=Xt=>{at=Number.isNaN(Xt)||Zw(Xt)&&isNaN(Xt.getTime())||Bx(Xt,Yn(o,Je,Xt))},Mt=vke(e.mode),wt=vke(e.reValidateMode);if(pt){let Xt,Sr;const an=Ee.type?yke(pt._f):zOe(ze),wn=ze.type===Cte.BLUR||ze.type===Cte.FOCUS_OUT,Xr=!$ct(pt._f)&&!e.resolver&&!Yn(n.errors,Je)&&!pt._f.deps||Vct(wn,Yn(n.touchedFields,Je),n.isSubmitted,wt,Mt),Pn=bke(Je,i,wn);jo(o,Je,an),wn?(pt._f.onBlur&&pt._f.onBlur(ze),u&&u(0)):pt._f.onChange&&pt._f.onChange(ze);const Ns=R(Je,an,wn),hr=!ph(Ns)||Pn;if(!wn&&_.state.next({name:Je,type:ze.type,values:Gc(o)}),Xr)return(x.isValid||y.isValid)&&(e.mode==="onBlur"?wn&&N():wn||N()),hr&&_.state.next({name:Je,...Pn?{}:Ns});if(!wn&&Pn&&_.state.next({...n}),e.resolver){const{errors:ys}=await V([Je]);if(gt(an),at){const Ca=wke(n.errors,s,Je),va=wke(ys,s,Ca.name||Je);Xt=va.error,Je=va.name,Sr=ph(ys)}}else M([Je],!0),Xt=(await kke(pt,i.disabled,o,w,e.shouldUseNativeValidation))[Je],M([Je]),gt(an),at&&(Xt?Sr=!1:(x.isValid||y.isValid)&&(Sr=await W(s,!0)));at&&(pt._f.deps&&ye(pt._f.deps),U(Je,Sr,Xt,Ns))}},he=(ze,Ee)=>{if(Yn(n.errors,Ee)&&ze.focus)return ze.focus(),1},ye=async(ze,Ee={})=>{let Je,at;const pt=wA(ze);if(e.resolver){const gt=await K(pc(ze)?ze:pt);Je=ph(gt),at=ze?!pt.some(Mt=>Yn(gt,Mt)):Je}else ze?(at=(await Promise.all(pt.map(async gt=>{const Mt=Yn(s,gt);return await W(Mt&&Mt._f?{[gt]:Mt}:Mt)}))).every(Boolean),!(!at&&!n.isValid)&&N()):at=Je=await W(s);return _.state.next({...!xg(ze)||(x.isValid||y.isValid)&&Je!==n.isValid?{}:{name:ze},...e.resolver||!ze?{isValid:Je}:{},errors:n.errors}),Ee.shouldFocus&&!at&&jA(s,he,ze?pt:i.mount),at},Ce=ze=>{const Ee={...l.mount?o:a};return pc(ze)?Ee:xg(ze)?Yn(Ee,ze):ze.map(Je=>Yn(Ee,Je))},Se=(ze,Ee)=>({invalid:!!Yn((Ee||n).errors,ze),isDirty:!!Yn((Ee||n).dirtyFields,ze),error:Yn((Ee||n).errors,ze),isValidating:!!Yn(n.validatingFields,ze),isTouched:!!Yn((Ee||n).touchedFields,ze)}),Ne=ze=>{ze&&wA(ze).forEach(Ee=>Ac(n.errors,Ee)),_.state.next({errors:ze?n.errors:{}})},be=(ze,Ee,Je)=>{const at=(Yn(s,ze,{_f:{}})._f||{}).ref,pt=Yn(n.errors,ze)||{},{ref:gt,message:Mt,type:wt,...Xt}=pt;jo(n.errors,ze,{...Xt,...Ee,ref:at}),_.state.next({name:ze,errors:n.errors,isValid:!1}),Je&&Je.shouldFocus&&at&&at.focus&&at.focus()},rt=(ze,Ee)=>dm(ze)?_.state.subscribe({next:Je=>"values"in Je&&ze(oe(void 0,Ee),Je)}):oe(ze,Ee,!0),Te=ze=>_.state.subscribe({next:Ee=>{qct(ze.name,Ee.name,ze.exact)&&Uct(Ee,ze.formState||x,We,ze.reRenderRoot)&&ze.callback({values:{...o},...n,...Ee,defaultValues:a})}}).unsubscribe,Pe=ze=>(l.mount=!0,y={...y,...ze.formState},Te({...ze,formState:y})),Ue=(ze,Ee={})=>{for(const Je of ze?wA(ze):i.mount)i.mount.delete(Je),i.array.delete(Je),Ee.keepValue||(Ac(s,Je),Ac(o,Je)),!Ee.keepError&&Ac(n.errors,Je),!Ee.keepDirty&&Ac(n.dirtyFields,Je),!Ee.keepTouched&&Ac(n.touchedFields,Je),!Ee.keepIsValidating&&Ac(n.validatingFields,Je),!e.shouldUnregister&&!Ee.keepDefaultValue&&Ac(a,Je);_.state.next({values:Gc(o)}),_.state.next({...n,...Ee.keepDirty?{isDirty:ae()}:{}}),!Ee.keepIsValid&&N()},Re=({disabled:ze,name:Ee})=>{(Yh(ze)&&l.mount||ze||i.disabled.has(Ee))&&(ze?i.disabled.add(Ee):i.disabled.delete(Ee))},Be=(ze,Ee={})=>{let Je=Yn(s,ze);const at=Yh(Ee.disabled)||Yh(e.disabled);return jo(s,ze,{...Je||{},_f:{...Je&&Je._f?Je._f:{ref:{name:ze}},name:ze,mount:!0,...Ee}}),i.mount.add(ze),Je?Re({disabled:Yh(Ee.disabled)?Ee.disabled:e.disabled,name:ze}):z(ze,!0,Ee.value),{...at?{disabled:Ee.disabled||e.disabled}:{},...e.progressive?{required:!!Ee.required,min:WM(Ee.min),max:WM(Ee.max),minLength:WM(Ee.minLength),maxLength:WM(Ee.maxLength),pattern:WM(Ee.pattern)}:{},name:ze,onChange:fe,onBlur:fe,ref:pt=>{if(pt){Be(ze,Ee),Je=Yn(s,ze);const gt=pc(pt.value)&&pt.querySelectorAll&&pt.querySelectorAll("input,select,textarea")[0]||pt,Mt=Dct(gt),wt=Je._f.refs||[];if(Mt?wt.find(Xt=>Xt===gt):gt===Je._f.ref)return;jo(s,ze,{_f:{...Je._f,...Mt?{refs:[...wt.filter(cce),gt,...Array.isArray(Yn(a,ze))?[{}]:[]],ref:{type:gt.type,name:ze}}:{ref:gt}}}),z(ze,!1,void 0,gt)}else Je=Yn(s,ze,{}),Je._f&&(Je._f.mount=!1),(e.shouldUnregister||Ee.shouldUnregister)&&!(BOe(i.array,ze)&&l.action)&&i.unMount.add(ze)}}},Ye=()=>e.shouldFocusError&&jA(s,he,i.mount),ht=ze=>{Yh(ze)&&(_.state.next({disabled:ze}),jA(s,(Ee,Je)=>{const at=Yn(s,Je);at&&(Ee.disabled=at._f.disabled||ze,Array.isArray(at._f.refs)&&at._f.refs.forEach(pt=>{pt.disabled=at._f.disabled||ze}))},0,!1))},Me=(ze,Ee)=>async Je=>{let at;Je&&(Je.preventDefault&&Je.preventDefault(),Je.persist&&Je.persist());let pt=Gc(o);if(_.state.next({isSubmitting:!0}),e.resolver){const{errors:gt,values:Mt}=await V();n.errors=gt,pt=Gc(Mt)}else await W(s);if(i.disabled.size)for(const gt of i.disabled)Ac(pt,gt);if(Ac(n.errors,"root"),ph(n.errors)){_.state.next({errors:{}});try{await ze(pt,Je)}catch(gt){at=gt}}else Ee&&await Ee({...n.errors},Je),Ye(),setTimeout(Ye);if(_.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ph(n.errors)&&!at,submitCount:n.submitCount+1,errors:n.errors}),at)throw at},Qe=(ze,Ee={})=>{Yn(s,ze)&&(pc(Ee.defaultValue)?se(ze,Gc(Yn(a,ze))):(se(ze,Ee.defaultValue),jo(a,ze,Gc(Ee.defaultValue))),Ee.keepTouched||Ac(n.touchedFields,ze),Ee.keepDirty||(Ac(n.dirtyFields,ze),n.isDirty=Ee.defaultValue?ae(ze,Gc(Yn(a,ze))):ae()),Ee.keepError||(Ac(n.errors,ze),x.isValid&&N()),_.state.next({...n}))},le=(ze,Ee={})=>{const Je=ze?Gc(ze):a,at=Gc(Je),pt=ph(ze),gt=pt?a:at;if(Ee.keepDefaultValues||(a=Je),!Ee.keepValues){if(Ee.keepDirtyValues){const Mt=new Set([...i.mount,...Object.keys(HM(a,o))]);for(const wt of Array.from(Mt))Yn(n.dirtyFields,wt)?jo(gt,wt,Yn(o,wt)):se(wt,Yn(gt,wt))}else{if(vxe&&pc(ze))for(const Mt of i.mount){const wt=Yn(s,Mt);if(wt&&wt._f){const Xt=Array.isArray(wt._f.refs)?wt._f.refs[0]:wt._f.ref;if(Mte(Xt)){const Sr=Xt.closest("form");if(Sr){Sr.reset();break}}}}if(Ee.keepFieldsRef)for(const Mt of i.mount)se(Mt,Yn(gt,Mt));else s={}}o=e.shouldUnregister?Ee.keepDefaultValues?Gc(a):{}:Gc(gt),_.array.next({values:{...gt}}),_.state.next({values:{...gt}})}i={mount:Ee.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Ee.keepIsValid||!!Ee.keepDirtyValues,l.watch=!!e.shouldUnregister,_.state.next({submitCount:Ee.keepSubmitCount?n.submitCount:0,isDirty:pt?!1:Ee.keepDirty?n.isDirty:!!(Ee.keepDefaultValues&&!Bx(ze,a)),isSubmitted:Ee.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:pt?{}:Ee.keepDirtyValues?Ee.keepDefaultValues&&o?HM(a,o):n.dirtyFields:Ee.keepDefaultValues&&ze?HM(a,ze):Ee.keepDirty?n.dirtyFields:{},touchedFields:Ee.keepTouched?n.touchedFields:{},errors:Ee.keepErrors?n.errors:{},isSubmitSuccessful:Ee.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ve=(ze,Ee)=>le(dm(ze)?ze(o):ze,Ee),Le=(ze,Ee={})=>{const Je=Yn(s,ze),at=Je&&Je._f;if(at){const pt=at.refs?at.refs[0]:at.ref;pt.focus&&(pt.focus(),Ee.shouldSelect&&dm(pt.select)&&pt.select())}},We=ze=>{n={...n,...ze}},st={control:{register:Be,unregister:Ue,getFieldState:Se,handleSubmit:Me,setError:be,_subscribe:Te,_runSchema:V,_focusError:Ye,_getWatch:oe,_getDirty:ae,_setValid:N,_setFieldArray:E,_setDisabledField:Re,_setErrors:P,_getFieldArray:xe,_reset:le,_resetDefaultValues:()=>dm(e.defaultValues)&&e.defaultValues().then(ze=>{Ve(ze,e.resetOptions),_.state.next({isLoading:!1})}),_removeUnmounted:J,_disableForm:ht,_subjects:_,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state(ze){l=ze},get _defaultValues(){return a},get _names(){return i},set _names(ze){i=ze},get _formState(){return n},get _options(){return e},set _options(ze){e={...e,...ze}}},subscribe:Pe,trigger:ye,register:Be,handleSubmit:Me,watch:rt,setValue:se,getValues:Ce,reset:Ve,resetField:Qe,clearErrors:Ne,unregister:Ue,setError:be,setFocus:Le,getFieldState:Se};return{...st,formControl:st}}function Nse(t={}){const e=it.useRef(void 0),n=it.useRef(void 0),[s,a]=it.useState({isDirty:!1,isValidating:!1,isLoading:dm(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:dm(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!dm(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...i}=Kct(t);e.current={...i,formState:s}}const o=e.current.control;return o._options=t,jxe(()=>{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]),it.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),it.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),it.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),it.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),it.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),it.useEffect(()=>{t.values&&!Bx(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]),it.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=$Oe(s,o),e.current}const Nke=(t,e,n)=>{if(t&&"reportValidity"in t){const s=Yn(n,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},YOe=(t,e)=>{for(const n in e.fields){const s=e.fields[n];s&&s.ref&&"reportValidity"in s.ref?Nke(s.ref,n,t):s.refs&&s.refs.forEach(a=>Nke(a,n,t))}},Zct=(t,e)=>{e.shouldUseNativeValidation&&YOe(t,e);const n={};for(const s in t){const a=Yn(e.fields,s),o=Object.assign(t[s]||{},{ref:a&&a.ref});if(Yct(e.names||Object.keys(t),s)){const l=Object.assign({},Yn(n,s));jo(l,"root",o),jo(n,s,l)}else jo(n,s,o)}return n},Yct=(t,e)=>t.some(n=>n.startsWith(e+"."));var Xct=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 u=n[l].types,p=u&&u[s.code];n[l]=qOe(l,e,n,a,p?[].concat(p,s.message):s.message)}t.shift()}return n},Sse=function(t,e,n){return n===void 0&&(n={}),function(s,a,o){try{return Promise.resolve(function(l,i){try{var u=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(p){return o.shouldUseNativeValidation&&YOe({},o),{errors:{},values:n.raw?s:p}})}catch(p){return i(p)}return u&&u.then?u.then(void 0,i):u}(0,function(l){if(function(i){return Array.isArray(i==null?void 0:i.errors)}(l))return{values:{},errors:Zct(Xct(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const Cse=Ect,XOe=I.createContext({}),El=({...t})=>r.jsx(XOe.Provider,{value:{name:t.name},children:r.jsx(Oct,{...t})}),Mse=()=>{const t=I.useContext(XOe),e=I.useContext(QOe),{getFieldState:n,formState:s}=kse(),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}},QOe=I.createContext({}),jl=I.forwardRef(({className:t,...e},n)=>{const s=I.useId();return r.jsx(QOe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:zt("space-y-2",t),...e})})});jl.displayName="FormItem";const kl=I.forwardRef(({className:t,...e},n)=>{const{error:s,formItemId:a}=Mse();return r.jsx(qe,{ref:n,className:zt(s&&"text-destructive",t),htmlFor:a,...e})});kl.displayName="FormLabel";const Nl=I.forwardRef(({...t},e)=>{const{error:n,formItemId:s,formDescriptionId:a,formMessageId:o}=Mse();return r.jsx(cge,{ref:e,id:s,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...t})});Nl.displayName="FormControl";const _ee=I.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:s}=Mse();return r.jsx("p",{ref:n,id:s,className:zt("text-sm text-muted-foreground",t),...e})});_ee.displayName="FormDescription";const $u=I.forwardRef(({className:t,children:e,...n},s)=>{const{error:a,formMessageId:o}=Mse(),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});$u.displayName="FormMessage";const ss=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}));ss.displayName="Textarea";const Qct=b3({category:gOe(["general","technology","crm","marketing"]),subject:fc().min(5,"Subject must be at least 5 characters").max(200),description:fc().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Jct={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Rhe({trigger:t}){const[e,n]=I.useState(!1),[s,a]=I.useState(!1),{user:o}=Qr(),l=Nse({resolver:Sse(Qct),defaultValues:{category:"general",subject:"",description:""}}),i=async u=>{if(!o){Oe.error("You must be logged in to submit a ticket");return}a(!0);try{const{error:p}=await Q.from("support_tickets").insert({user_id:o.id,category:u.category,subject:u.subject,description:u.description});if(p)throw p;try{await Q.functions.invoke("support-ticket-notify",{body:{category:Jct[u.category],subject:u.subject}})}catch(x){console.log("Notification send attempted:",x)}Oe.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(p){console.error("Error submitting ticket:",p),Oe.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return r.jsxs(Dr,{open:e,onOpenChange:n,children:[r.jsx(Uo,{asChild:!0,children:t||r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(XT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Or,{className:"sm:max-w-[500px]",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Need Help?"}),r.jsx(Jn,{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(ji,{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(El,{control:l.control,name:"category",render:({field:u})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Category"}),r.jsxs(xn,{onValueChange:u.onChange,defaultValue:u.value,children:[r.jsx(Nl,{children:r.jsx(fn,{children:r.jsx(vn,{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($u,{})]})}),r.jsx(El,{control:l.control,name:"subject",render:({field:u})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Subject"}),r.jsx(Nl,{children:r.jsx(ot,{placeholder:"Brief description of your issue",...u})}),r.jsx($u,{})]})}),r.jsx(El,{control:l.control,name:"description",render:({field:u})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Description"}),r.jsx(Nl,{children:r.jsx(ss,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...u})}),r.jsx($u,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function ks(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 No(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function Xl(t,e){const n=ks(t);return isNaN(e)?No(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function Mh(t,e){const n=ks(t);if(isNaN(e))return No(t,NaN);if(!e)return n;const s=n.getDate(),a=No(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 JOe(t,e){const n=+ks(t);return No(t,n+e)}const Sxe=6048e5,edt=864e5,e8e=6e4,t8e=36e5,tdt=1e3,DL=43200,Ske=1440;function Cke(t,e){return JOe(t,e*t8e)}let rdt={};function xv(){return rdt}function yf(t,e){var i,u,p,x;const n=xv(),s=(e==null?void 0:e.weekStartsOn)??((u=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=ks(t),o=a.getDay(),l=(o=a.getTime()?n+1:e.getTime()>=l.getTime()?n:n-1}function vf(t){const e=ks(t);return e.setHours(0,0,0,0),e}function av(t){const e=ks(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 mm(t,e){const n=vf(t),s=vf(e),a=+n-av(n),o=+s-av(s);return Math.round((a-o)/edt)}function ndt(t){const e=r8e(t),n=No(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),vy(n)}function Mke(t,e){return JOe(t,e*e8e)}function Yw(t,e){const n=e*7;return Xl(t,n)}function sdt(t,e){return Mh(t,e*12)}function adt(t){let e;return t.forEach(function(n){const s=ks(n);(e===void 0||e{const s=ks(n);(!e||e>s||isNaN(+s))&&(e=s)}),e||new Date(NaN)}function bee(t,e){const n=ks(t),s=ks(e),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function odt(t){return No(t,Date.now())}function sc(t,e){const n=vf(t),s=vf(e);return+n==+s}function Cxe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Fhe(t){if(!Cxe(t)&&typeof t!="number")return!1;const e=ks(t);return!isNaN(Number(e))}function NC(t,e){const n=ks(t),s=ks(e),a=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return a*12+o}function ldt(t,e,n){const s=yf(t,n),a=yf(e,n),o=+s-av(s),l=+a-av(a);return Math.round((o-l)/Sxe)}function _y(t,e){const n=ks(t),s=ks(e),a=Tke(n,s),o=Math.abs(mm(n,s));n.setDate(n.getDate()-a*o);const l=+(Tke(n,s)===-a),i=a*(o-l);return i===0?0:i}function Tke(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 cdt(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function ddt(t,e){return+ks(t)-+ks(e)}function udt(t){const e=ks(t);return e.setHours(23,59,59,999),e}function Tse(t){const e=ks(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function hdt(t){const e=ks(t);return+udt(e)==+Tse(e)}function fdt(t,e){const n=ks(t),s=ks(e),a=bee(n,s),o=Math.abs(NC(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=bee(n,s)===-a;hdt(ks(t))&&o===1&&bee(t,s)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function pdt(t,e,n){const s=ddt(t,e)/1e3;return cdt(n==null?void 0:n.roundingMethod)(s)}function Sh(t){const e=ks(t);return e.setDate(1),e.setHours(0,0,0,0),e}function n8e(t){const e=ks(t),n=No(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Mxe(t,e){var i,u,p,x;const n=xv(),s=(e==null?void 0:e.weekStartsOn)??((u=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=ks(t),o=a.getDay(),l=(o{let s;const a=mdt[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 dce(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const xdt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ydt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vdt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_dt={date:dce({formats:xdt,defaultWidth:"full"}),time:dce({formats:ydt,defaultWidth:"full"}),dateTime:dce({formats:vdt,defaultWidth:"full"})},bdt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},wdt=(t,e,n,s)=>bdt[t];function GM(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 jdt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},kdt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ndt={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"]},Sdt={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"]},Cdt={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"}},Mdt={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"}},Tdt=(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"},Adt={ordinalNumber:Tdt,era:GM({values:jdt,defaultWidth:"wide"}),quarter:GM({values:kdt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:GM({values:Ndt,defaultWidth:"wide"}),day:GM({values:Sdt,defaultWidth:"wide"}),dayPeriod:GM({values:Cdt,defaultWidth:"wide",formattingValues:Mdt,defaultFormattingWidth:"wide"})};function KM(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],u=Array.isArray(i)?Idt(i,y=>y.test(l)):Edt(i,y=>y.test(l));let p;p=t.valueCallback?t.valueCallback(u):u,p=n.valueCallback?n.valueCallback(p):p;const x=e.slice(l.length);return{value:p,rest:x}}}function Edt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Idt(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 Ldt=/^(\d+)(th|st|nd|rd)?/i,Odt=/\d+/i,Ddt={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},Rdt={any:[/^b/i,/^(a|c)/i]},Fdt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zdt={any:[/1/i,/2/i,/3/i,/4/i]},Bdt={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},$dt={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]},Udt={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},qdt={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]},Vdt={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},Hdt={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}},Wdt={ordinalNumber:Pdt({matchPattern:Ldt,parsePattern:Odt,valueCallback:t=>parseInt(t,10)}),era:KM({matchPatterns:Ddt,defaultMatchWidth:"wide",parsePatterns:Rdt,defaultParseWidth:"any"}),quarter:KM({matchPatterns:Fdt,defaultMatchWidth:"wide",parsePatterns:zdt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:KM({matchPatterns:Bdt,defaultMatchWidth:"wide",parsePatterns:$dt,defaultParseWidth:"any"}),day:KM({matchPatterns:Udt,defaultMatchWidth:"wide",parsePatterns:qdt,defaultParseWidth:"any"}),dayPeriod:KM({matchPatterns:Vdt,defaultMatchWidth:"any",parsePatterns:Hdt,defaultParseWidth:"any"})},Ase={code:"en-US",formatDistance:gdt,formatLong:_dt,formatRelative:wdt,localize:Adt,match:Wdt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Gdt(t){const e=ks(t);return mm(e,n8e(e))+1}function Txe(t){const e=ks(t),n=+vy(e)-+ndt(e);return Math.round(n/Sxe)+1}function Axe(t,e){var x,y,_,w;const n=ks(t),s=n.getFullYear(),a=xv(),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??((w=(_=a.locale)==null?void 0:_.options)==null?void 0:w.firstWeekContainsDate)??1,l=No(t,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const i=yf(l,e),u=No(t,0);u.setFullYear(s,0,o),u.setHours(0,0,0,0);const p=yf(u,e);return n.getTime()>=i.getTime()?s+1:n.getTime()>=p.getTime()?s:s-1}function Kdt(t,e){var i,u,p,x;const n=xv(),s=(e==null?void 0:e.firstWeekContainsDate)??((u=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,a=Axe(t,e),o=No(t,0);return o.setFullYear(a,0,s),o.setHours(0,0,0,0),yf(o,e)}function Exe(t,e){const n=ks(t),s=+yf(n,e)-+Kdt(n,e);return Math.round(s/Sxe)+1}function ko(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const C0={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return ko(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):ko(n+1,2)},d(t,e){return ko(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 ko(t.getHours()%12||12,e.length)},H(t,e){return ko(t.getHours(),e.length)},m(t,e){return ko(t.getMinutes(),e.length)},s(t,e){return ko(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return ko(a,e.length)}},x4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ake={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 C0.y(t,e)},Y:function(t,e,n,s){const a=Axe(t,s),o=a>0?a:1-a;if(e==="YY"){const l=o%100;return ko(l,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):ko(o,e.length)},R:function(t,e){const n=r8e(t);return ko(n,e.length)},u:function(t,e){const n=t.getFullYear();return ko(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 ko(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 ko(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 C0.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 ko(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=Exe(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):ko(a,e.length)},I:function(t,e,n){const s=Txe(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):ko(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):C0.d(t,e)},D:function(t,e,n){const s=Gdt(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):ko(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 ko(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 ko(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 ko(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=x4.noon:s===0?a=x4.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=x4.evening:s>=12?a=x4.afternoon:s>=4?a=x4.morning:a=x4.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 C0.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):C0.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):ko(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):ko(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):C0.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):C0.s(t,e)},S:function(t,e){return C0.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return Ike(s);case"XXXX":case"XX":return Dw(s);case"XXXXX":case"XXX":default:return Dw(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return Ike(s);case"xxxx":case"xx":return Dw(s);case"xxxxx":case"xxx":default:return Dw(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"+Dw(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"+Dw(s,":")}},t:function(t,e,n){const s=Math.trunc(t.getTime()/1e3);return ko(s,e.length)},T:function(t,e,n){const s=t.getTime();return ko(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+ko(o,2)}function Ike(t,e){return t%60===0?(t>0?"-":"+")+ko(Math.abs(t)/60,2):Dw(t,e)}function Dw(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=ko(Math.trunc(s/60),2),o=ko(s%60,2);return n+a+e+o}const Pke=(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"})}},a8e=(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"})}},Zdt=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return Pke(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}}",Pke(s,e)).replace("{{time}}",a8e(a,e))},zhe={p:a8e,P:Zdt},Ydt=/^D+$/,Xdt=/^Y+$/,Qdt=["D","DD","YY","YYYY"];function i8e(t){return Ydt.test(t)}function o8e(t){return Xdt.test(t)}function Bhe(t,e,n){const s=Jdt(t,e,n);if(console.warn(s),Qdt.includes(t))throw new RangeError(s)}function Jdt(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 eut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tut=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rut=/^'([^]*?)'?$/,nut=/''/g,sut=/[a-zA-Z]/;function mn(t,e,n){var x,y,_,w,S,N,M,E;const s=xv(),a=(n==null?void 0:n.locale)??s.locale??Ase,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??((w=(_=s.locale)==null?void 0:_.options)==null?void 0:w.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((N=(S=n==null?void 0:n.locale)==null?void 0:S.options)==null?void 0:N.weekStartsOn)??s.weekStartsOn??((E=(M=s.locale)==null?void 0:M.options)==null?void 0:E.weekStartsOn)??0,i=ks(t);if(!Fhe(i))throw new RangeError("Invalid time value");let u=e.match(tut).map(A=>{const P=A[0];if(P==="p"||P==="P"){const z=zhe[P];return z(A,a.formatLong)}return A}).join("").match(eut).map(A=>{if(A==="''")return{isToken:!1,value:"'"};const P=A[0];if(P==="'")return{isToken:!1,value:aut(A)};if(Ake[P])return{isToken:!0,value:A};if(P.match(sut))throw new RangeError("Format string contains an unescaped latin alphabet character `"+P+"`");return{isToken:!1,value:A}});a.localize.preprocessor&&(u=a.localize.preprocessor(i,u));const p={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return u.map(A=>{if(!A.isToken)return A.value;const P=A.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&o8e(P)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&i8e(P))&&Bhe(P,e,String(t));const z=Ake[P[0]];return z(i,P,a.localize,p)}).join("")}function aut(t){const e=t.match(rut);return e?e[1].replace(nut,"'"):t}function iut(t,e,n){const s=xv(),a=(n==null?void 0:n.locale)??s.locale??Ase,o=2520,l=bee(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 u,p;l>0?(u=ks(e),p=ks(t)):(u=ks(t),p=ks(e));const x=pdt(p,u),y=(av(p)-av(u))/1e3,_=Math.round((x-y)/60);let w;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 Ese(t,e){const n=ks(t),s=ks(e);return+n<+s}function fut(t){return+ks(t)>Date.now()}function put(t,e){const n=e instanceof Date?No(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 mut=10;class l8e{constructor(){Zn(this,"subPriority",0)}validate(e,n){return!0}}class gut extends l8e{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 xut extends l8e{constructor(){super(...arguments);Zn(this,"priority",mut);Zn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:No(n,put(n,Date))}}class fo{run(e,n,s,a){const o=this.parse(e,n,s,a);return o?{setter:new gut(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,n,s){return!0}}class yut extends fo{constructor(){super(...arguments);Zn(this,"priority",140);Zn(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 xc={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}/},pg={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 yc(t,e){return t&&{value:e(t.value),rest:t.rest}}function Dl(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function mg(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*t8e+o*e8e+l*tdt),rest:e.slice(n[0].length)}}function c8e(t){return Dl(xc.anyDigitsSigned,t)}function oc(t,e){switch(t){case 1:return Dl(xc.singleDigit,e);case 2:return Dl(xc.twoDigits,e);case 3:return Dl(xc.threeDigits,e);case 4:return Dl(xc.fourDigits,e);default:return Dl(new RegExp("^\\d{1,"+t+"}"),e)}}function Ite(t,e){switch(t){case 1:return Dl(xc.singleDigitSigned,e);case 2:return Dl(xc.twoDigitsSigned,e);case 3:return Dl(xc.threeDigitsSigned,e);case 4:return Dl(xc.fourDigitsSigned,e);default:return Dl(new RegExp("^-?\\d{1,"+t+"}"),e)}}function Ixe(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 d8e(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 u8e(t){return t%400===0||t%4===0&&t%100!==0}class vut extends fo{constructor(){super(...arguments);Zn(this,"priority",130);Zn(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 yc(oc(4,n),o);case"yo":return yc(a.ordinalNumber(n,{unit:"year"}),o);default:return yc(oc(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=d8e(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 _ut extends fo{constructor(){super(...arguments);Zn(this,"priority",130);Zn(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 yc(oc(4,n),o);case"Yo":return yc(a.ordinalNumber(n,{unit:"year"}),o);default:return yc(oc(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,o){const l=Axe(n,o);if(a.isTwoDigitYear){const u=d8e(a.year,l);return n.setFullYear(u,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),yf(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),yf(n,o)}}class but extends fo{constructor(){super(...arguments);Zn(this,"priority",130);Zn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return Ite(s==="R"?4:s.length,n)}set(n,s,a){const o=No(n,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),vy(o)}}class wut extends fo{constructor(){super(...arguments);Zn(this,"priority",130);Zn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return Ite(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class jut extends fo{constructor(){super(...arguments);Zn(this,"priority",120);Zn(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 oc(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 kut extends fo{constructor(){super(...arguments);Zn(this,"priority",120);Zn(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 oc(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 Nut extends fo{constructor(){super(...arguments);Zn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Zn(this,"priority",110)}parse(n,s,a){const o=l=>l-1;switch(s){case"M":return yc(Dl(xc.month,n),o);case"MM":return yc(oc(2,n),o);case"Mo":return yc(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 Sut extends fo{constructor(){super(...arguments);Zn(this,"priority",110);Zn(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 yc(Dl(xc.month,n),o);case"LL":return yc(oc(2,n),o);case"Lo":return yc(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 Cut(t,e,n){const s=ks(t),a=Exe(s,n)-e;return s.setDate(s.getDate()-a*7),s}class Mut extends fo{constructor(){super(...arguments);Zn(this,"priority",100);Zn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return Dl(xc.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return oc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,o){return yf(Cut(n,a,o),o)}}function Tut(t,e){const n=ks(t),s=Txe(n)-e;return n.setDate(n.getDate()-s*7),n}class Aut extends fo{constructor(){super(...arguments);Zn(this,"priority",100);Zn(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 Dl(xc.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return oc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return vy(Tut(n,a))}}const Eut=[31,28,31,30,31,30,31,31,30,31,30,31],Iut=[31,29,31,30,31,30,31,31,30,31,30,31];class Put extends fo{constructor(){super(...arguments);Zn(this,"priority",90);Zn(this,"subPriority",1);Zn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return Dl(xc.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return oc(s.length,n)}}validate(n,s){const a=n.getFullYear(),o=u8e(a),l=n.getMonth();return o?s>=1&&s<=Iut[l]:s>=1&&s<=Eut[l]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class Lut extends fo{constructor(){super(...arguments);Zn(this,"priority",90);Zn(this,"subpriority",1);Zn(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 Dl(xc.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return oc(s.length,n)}}validate(n,s){const a=n.getFullYear();return u8e(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 Pxe(t,e,n){var y,_,w,S;const s=xv(),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??((S=(w=s.locale)==null?void 0:w.options)==null?void 0:S.weekStartsOn)??0,o=ks(t),l=o.getDay(),u=(e%7+7)%7,p=7-a,x=e<0||e>6?e-(l+p)%7:(u+p)%7-(l+p)%7;return Xl(o,x)}class Out extends fo{constructor(){super(...arguments);Zn(this,"priority",90);Zn(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=Pxe(n,a,o),n.setHours(0,0,0,0),n}}class Dut extends fo{constructor(){super(...arguments);Zn(this,"priority",90);Zn(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 u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(s){case"e":case"ee":return yc(oc(s.length,n),l);case"eo":return yc(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=Pxe(n,a,o),n.setHours(0,0,0,0),n}}class Rut extends fo{constructor(){super(...arguments);Zn(this,"priority",90);Zn(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 u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(s){case"c":case"cc":return yc(oc(s.length,n),l);case"co":return yc(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=Pxe(n,a,o),n.setHours(0,0,0,0),n}}function Fut(t,e){const n=ks(t),s=cut(n),a=e-s;return Xl(n,a)}class zut extends fo{constructor(){super(...arguments);Zn(this,"priority",90);Zn(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 oc(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return yc(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 yc(a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return yc(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return yc(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=Fut(n,a),n.setHours(0,0,0,0),n}}class But extends fo{constructor(){super(...arguments);Zn(this,"priority",80);Zn(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(Ixe(a),0,0,0),n}}class $ut extends fo{constructor(){super(...arguments);Zn(this,"priority",80);Zn(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(Ixe(a),0,0,0),n}}class Uut extends fo{constructor(){super(...arguments);Zn(this,"priority",80);Zn(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(Ixe(a),0,0,0),n}}class qut extends fo{constructor(){super(...arguments);Zn(this,"priority",70);Zn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return Dl(xc.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return oc(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 Vut extends fo{constructor(){super(...arguments);Zn(this,"priority",70);Zn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return Dl(xc.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return oc(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class Hut extends fo{constructor(){super(...arguments);Zn(this,"priority",70);Zn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return Dl(xc.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return oc(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 Wut extends fo{constructor(){super(...arguments);Zn(this,"priority",70);Zn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return Dl(xc.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return oc(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 Gut extends fo{constructor(){super(...arguments);Zn(this,"priority",60);Zn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return Dl(xc.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return oc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class Kut extends fo{constructor(){super(...arguments);Zn(this,"priority",50);Zn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return Dl(xc.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return oc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class Zut extends fo{constructor(){super(...arguments);Zn(this,"priority",30);Zn(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=o=>Math.trunc(o*Math.pow(10,-s.length+3));return yc(oc(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class Yut extends fo{constructor(){super(...arguments);Zn(this,"priority",10);Zn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return mg(pg.basicOptionalMinutes,n);case"XX":return mg(pg.basic,n);case"XXXX":return mg(pg.basicOptionalSeconds,n);case"XXXXX":return mg(pg.extendedOptionalSeconds,n);case"XXX":default:return mg(pg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:No(n,n.getTime()-av(n)-a)}}class Xut extends fo{constructor(){super(...arguments);Zn(this,"priority",10);Zn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return mg(pg.basicOptionalMinutes,n);case"xx":return mg(pg.basic,n);case"xxxx":return mg(pg.basicOptionalSeconds,n);case"xxxxx":return mg(pg.extendedOptionalSeconds,n);case"xxx":default:return mg(pg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:No(n,n.getTime()-av(n)-a)}}class Qut extends fo{constructor(){super(...arguments);Zn(this,"priority",40);Zn(this,"incompatibleTokens","*")}parse(n){return c8e(n)}set(n,s,a){return[No(n,a*1e3),{timestampIsSet:!0}]}}class Jut extends fo{constructor(){super(...arguments);Zn(this,"priority",20);Zn(this,"incompatibleTokens","*")}parse(n){return c8e(n)}set(n,s,a){return[No(n,a),{timestampIsSet:!0}]}}const eht={G:new yut,y:new vut,Y:new _ut,R:new but,u:new wut,Q:new jut,q:new kut,M:new Nut,L:new Sut,w:new Mut,I:new Aut,d:new Put,D:new Lut,E:new Out,e:new Dut,c:new Rut,i:new zut,a:new But,b:new $ut,B:new Uut,h:new qut,H:new Vut,K:new Hut,k:new Wut,m:new Gut,s:new Kut,S:new Zut,X:new Yut,x:new Xut,t:new Qut,T:new Jut},tht=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,rht=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nht=/^'([^]*?)'?$/,sht=/''/g,aht=/\S/,iht=/[a-zA-Z]/;function Lxe(t,e,n,s){var N,M,E,A;const a=lut(),o=a.locale??Ase,l=a.firstWeekContainsDate??((M=(N=a.locale)==null?void 0:N.options)==null?void 0:M.firstWeekContainsDate)??1,i=a.weekStartsOn??((A=(E=a.locale)==null?void 0:E.options)==null?void 0:A.weekStartsOn)??0;if(e==="")return t===""?ks(n):No(n,NaN);const u={firstWeekContainsDate:l,weekStartsOn:i,locale:o},p=[new xut],x=e.match(rht).map(P=>{const z=P[0];if(z in zhe){const R=zhe[z];return R(P,o.formatLong)}return P}).join("").match(tht),y=[];for(let P of x){o8e(P)&&Bhe(P,e,t),i8e(P)&&Bhe(P,e,t);const z=P[0],R=eht[z];if(R){const{incompatibleTokens:U}=R;if(Array.isArray(U)){const K=y.find(W=>U.includes(W.token)||W.token===z);if(K)throw new RangeError(`The format string mustn't contain \`${K.fullToken}\` and \`${P}\` at the same time`)}else if(R.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=R.run(t,P,o.match,u);if(!V)return No(n,NaN);p.push(V.setter),t=V.rest}else{if(z.match(iht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");if(P==="''"?P="'":z==="'"&&(P=oht(P)),t.indexOf(P)===0)t=t.slice(P.length);else return No(n,NaN)}}if(t.length>0&&aht.test(t))return No(n,NaN);const _=p.map(P=>P.priority).sort((P,z)=>z-P).filter((P,z,R)=>R.indexOf(P)===z).map(P=>p.filter(z=>z.priority===P).sort((z,R)=>R.subPriority-z.subPriority)).map(P=>P[0]);let w=ks(n);if(isNaN(w.getTime()))return No(n,NaN);const S={};for(const P of _){if(!P.validate(w,u))return No(n,NaN);const z=P.set(w,S,u);Array.isArray(z)?(w=z[0],Object.assign(S,z[1])):w=z}return No(n,w)}function oht(t){return t.match(nht)[1].replace(sht,"'")}function lht(t){return+ks(t)o-l);return n>=s&&n<=a}function uce(t,e){return Xl(t,-e)}function hce(t,e){const n=ks(t),s=n.getFullYear(),a=n.getDate(),o=No(t,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const l=out(o);return n.setMonth(e,Math.min(a,l)),n}function h8e(t,e){const n=ks(t);return n.setHours(e),n}function f8e(t,e){const n=ks(t);return n.setMinutes(e),n}function Pte(t,e){const n=ks(t);return isNaN(+n)?No(t,NaN):(n.setFullYear(e),n)}function dht(t,e){return Mh(t,-12)}const uht=()=>{const{user:t}=Qr(),e=Gn(),[n,s]=I.useState([]),[a,o]=I.useState(0),[l,i]=I.useState(!1),[u,p]=I.useState(null);I.useEffect(()=>{if(!t)return;const S=`notification_last_read_${t.id}`;let N=u;if(!N){const A=localStorage.getItem(S);A&&(N=A,p(A))}(async()=>{const{data:A,error:P}=await Q.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!P&&A){s(A);const z=N?new Date(N):null,R=A.filter(U=>z?new Date(U.created_at)>z:!0);o(R.length)}})();const E=Q.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},A=>{const P=A.new;s(R=>[P,...R].slice(0,20));const z=N?new Date(N):null;(!z||new Date(P.created_at)>z)&&o(R=>R+1),Notification.permission==="granted"&&new Notification(P.title,{body:P.body,icon:"/favicon.ico"})}).subscribe();return()=>{Q.removeChannel(E)}},[t,u]);const x=S=>{const N=S.toLowerCase();return N.includes("community")||N.includes("post")?Do:N.includes("academy")||N.includes("video")?Da:N.includes("template")?Rc:N.includes("event")?Ds:N.includes("newsletter")?ny:N.includes("brokerage")?Nh:N.includes("swag")||N.includes("social")?Zi:N.includes("toolbox")||N.includes("tool")?ay:N.includes("brief")?As:Do},y=S=>{i(!1),S.url&&S.url!=="/"&&e(S.url)},_=()=>{if(!t)return;const S=new Date().toISOString(),N=`notification_last_read_${t.id}`;localStorage.setItem(N,S),p(S),o(0)},w=S=>{i(S),S&&a>0&&_()};return r.jsxs(Th,{open:l,onOpenChange:w,children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(kg,{className:"h-5 w-5"}),a>0&&r.jsx(Lt,{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(eh,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(te,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:_,children:"Mark all read"})]}),r.jsx(Ro,{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(S=>{const N=x(S.title);return r.jsxs(ri,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(S),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:S.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:S.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:gu(new Date(S.created_at),{addSuffix:!0})})]})]},S.id)})})]})]})};var Dke=1,hht=.9,fht=.8,pht=.17,fce=.1,pce=.999,mht=.9999,ght=.99,xht=/[\\\/_+.#"@\[\(\{&]/,yht=/[\\\/_+.#"@\[\(\{&]/g,vht=/[\s-]/,p8e=/[\s-]/g;function $he(t,e,n,s,a,o,l){if(o===e.length)return a===t.length?Dke:ght;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var u=s.charAt(o),p=n.indexOf(u,a),x=0,y,_,w,S;p>=0;)y=$he(t,e,n,s,p+1,o+1,l),y>x&&(p===a?y*=Dke:xht.test(t.charAt(p-1))?(y*=fht,w=t.slice(a,p-1).match(yht),w&&a>0&&(y*=Math.pow(pce,w.length))):vht.test(t.charAt(p-1))?(y*=hht,S=t.slice(a,p-1).match(p8e),S&&a>0&&(y*=Math.pow(pce,S.length))):(y*=pht,a>0&&(y*=Math.pow(pce,p-a))),t.charAt(p)!==e.charAt(o)&&(y*=mht)),(yy&&(y=_*fce)),y>x&&(x=y),p=n.indexOf(u,p+1);return l[i]=x,x}function Rke(t){return t.toLowerCase().replace(p8e," ")}function _ht(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,$he(t,e,Rke(t),Rke(e),0,0,{})}var ZM='[cmdk-group=""]',mce='[cmdk-group-items=""]',bht='[cmdk-group-heading=""]',m8e='[cmdk-item=""]',Fke=`${m8e}:not([aria-disabled="true"])`,Uhe="cmdk-item-select",A4="data-value",wht=(t,e,n)=>_ht(t,e,n),g8e=I.createContext(void 0),UI=()=>I.useContext(g8e),x8e=I.createContext(void 0),Dxe=()=>I.useContext(x8e),y8e=I.createContext(void 0),v8e=I.forwardRef((t,e)=>{let n=E4(()=>{var Ne,be;return{search:"",value:(be=(Ne=t.value)!=null?Ne:t.defaultValue)!=null?be:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=E4(()=>new Set),a=E4(()=>new Map),o=E4(()=>new Map),l=E4(()=>new Set),i=_8e(t),{label:u,children:p,value:x,onValueChange:y,filter:_,shouldFilter:w,loop:S,disablePointerSelection:N=!1,vimBindings:M=!0,...E}=t,A=Qc(),P=Qc(),z=Qc(),R=I.useRef(null),U=Pht();ek(()=>{if(x!==void 0){let Ne=x.trim();n.current.value=Ne,V.emit()}},[x]),ek(()=>{U(6,xe)},[]);let V=I.useMemo(()=>({subscribe:Ne=>(l.current.add(Ne),()=>l.current.delete(Ne)),snapshot:()=>n.current,setState:(Ne,be,rt)=>{var Te,Pe,Ue,Re;if(!Object.is(n.current[Ne],be)){if(n.current[Ne]=be,Ne==="search")oe(),J(),U(1,ae);else if(Ne==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Be=document.getElementById(z);Be?Be.focus():(Te=document.getElementById(A))==null||Te.focus()}if(U(7,()=>{var Be;n.current.selectedItemId=(Be=ie())==null?void 0:Be.id,V.emit()}),rt||U(5,xe),((Pe=i.current)==null?void 0:Pe.value)!==void 0){let Be=be??"";(Re=(Ue=i.current).onValueChange)==null||Re.call(Ue,Be);return}}V.emit()}},emit:()=>{l.current.forEach(Ne=>Ne())}}),[]),K=I.useMemo(()=>({value:(Ne,be,rt)=>{var Te;be!==((Te=o.current.get(Ne))==null?void 0:Te.value)&&(o.current.set(Ne,{value:be,keywords:rt}),n.current.filtered.items.set(Ne,W(be,rt)),U(2,()=>{J(),V.emit()}))},item:(Ne,be)=>(s.current.add(Ne),be&&(a.current.has(be)?a.current.get(be).add(Ne):a.current.set(be,new Set([Ne]))),U(3,()=>{oe(),J(),n.current.value||ae(),V.emit()}),()=>{o.current.delete(Ne),s.current.delete(Ne),n.current.filtered.items.delete(Ne);let rt=ie();U(4,()=>{oe(),(rt==null?void 0:rt.getAttribute("id"))===Ne&&ae(),V.emit()})}),group:Ne=>(a.current.has(Ne)||a.current.set(Ne,new Set),()=>{o.current.delete(Ne),a.current.delete(Ne)}),filter:()=>i.current.shouldFilter,label:u||t["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:A,inputId:z,labelId:P,listInnerRef:R}),[]);function W(Ne,be){var rt,Te;let Pe=(Te=(rt=i.current)==null?void 0:rt.filter)!=null?Te:wht;return Ne?Pe(Ne,n.current.search,be):0}function J(){if(!n.current.search||i.current.shouldFilter===!1)return;let Ne=n.current.filtered.items,be=[];n.current.filtered.groups.forEach(Te=>{let Pe=a.current.get(Te),Ue=0;Pe.forEach(Re=>{let Be=Ne.get(Re);Ue=Math.max(Be,Ue)}),be.push([Te,Ue])});let rt=R.current;pe().sort((Te,Pe)=>{var Ue,Re;let Be=Te.getAttribute("id"),Ye=Pe.getAttribute("id");return((Ue=Ne.get(Ye))!=null?Ue:0)-((Re=Ne.get(Be))!=null?Re:0)}).forEach(Te=>{let Pe=Te.closest(mce);Pe?Pe.appendChild(Te.parentElement===Pe?Te:Te.closest(`${mce} > *`)):rt.appendChild(Te.parentElement===rt?Te:Te.closest(`${mce} > *`))}),be.sort((Te,Pe)=>Pe[1]-Te[1]).forEach(Te=>{var Pe;let Ue=(Pe=R.current)==null?void 0:Pe.querySelector(`${ZM}[${A4}="${encodeURIComponent(Te[0])}"]`);Ue==null||Ue.parentElement.appendChild(Ue)})}function ae(){let Ne=pe().find(rt=>rt.getAttribute("aria-disabled")!=="true"),be=Ne==null?void 0:Ne.getAttribute(A4);V.setState("value",be||void 0)}function oe(){var Ne,be,rt,Te;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Pe=0;for(let Ue of s.current){let Re=(be=(Ne=o.current.get(Ue))==null?void 0:Ne.value)!=null?be:"",Be=(Te=(rt=o.current.get(Ue))==null?void 0:rt.keywords)!=null?Te:[],Ye=W(Re,Be);n.current.filtered.items.set(Ue,Ye),Ye>0&&Pe++}for(let[Ue,Re]of a.current)for(let Be of Re)if(n.current.filtered.items.get(Be)>0){n.current.filtered.groups.add(Ue);break}n.current.filtered.count=Pe}function xe(){var Ne,be,rt;let Te=ie();Te&&(((Ne=Te.parentElement)==null?void 0:Ne.firstChild)===Te&&((rt=(be=Te.closest(ZM))==null?void 0:be.querySelector(bht))==null||rt.scrollIntoView({block:"nearest"})),Te.scrollIntoView({block:"nearest"}))}function ie(){var Ne;return(Ne=R.current)==null?void 0:Ne.querySelector(`${m8e}[aria-selected="true"]`)}function pe(){var Ne;return Array.from(((Ne=R.current)==null?void 0:Ne.querySelectorAll(Fke))||[])}function se(Ne){let be=pe()[Ne];be&&V.setState("value",be.getAttribute(A4))}function fe(Ne){var be;let rt=ie(),Te=pe(),Pe=Te.findIndex(Re=>Re===rt),Ue=Te[Pe+Ne];(be=i.current)!=null&&be.loop&&(Ue=Pe+Ne<0?Te[Te.length-1]:Pe+Ne===Te.length?Te[0]:Te[Pe+Ne]),Ue&&V.setState("value",Ue.getAttribute(A4))}function he(Ne){let be=ie(),rt=be==null?void 0:be.closest(ZM),Te;for(;rt&&!Te;)rt=Ne>0?Eht(rt,ZM):Iht(rt,ZM),Te=rt==null?void 0:rt.querySelector(Fke);Te?V.setState("value",Te.getAttribute(A4)):fe(Ne)}let ye=()=>se(pe().length-1),Ce=Ne=>{Ne.preventDefault(),Ne.metaKey?ye():Ne.altKey?he(1):fe(1)},Se=Ne=>{Ne.preventDefault(),Ne.metaKey?se(0):Ne.altKey?he(-1):fe(-1)};return I.createElement(Rn.div,{ref:e,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:Ne=>{var be;(be=E.onKeyDown)==null||be.call(E,Ne);let rt=Ne.nativeEvent.isComposing||Ne.keyCode===229;if(!(Ne.defaultPrevented||rt))switch(Ne.key){case"n":case"j":{M&&Ne.ctrlKey&&Ce(Ne);break}case"ArrowDown":{Ce(Ne);break}case"p":case"k":{M&&Ne.ctrlKey&&Se(Ne);break}case"ArrowUp":{Se(Ne);break}case"Home":{Ne.preventDefault(),se(0);break}case"End":{Ne.preventDefault(),ye();break}case"Enter":{Ne.preventDefault();let Te=ie();if(Te){let Pe=new Event(Uhe);Te.dispatchEvent(Pe)}}}}},I.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:Oht},u),Ise(t,Ne=>I.createElement(x8e.Provider,{value:V},I.createElement(g8e.Provider,{value:K},Ne))))}),jht=I.forwardRef((t,e)=>{var n,s;let a=Qc(),o=I.useRef(null),l=I.useContext(y8e),i=UI(),u=_8e(t),p=(s=(n=u.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;ek(()=>{if(!p)return i.item(a,l==null?void 0:l.id)},[p]);let x=b8e(a,o,[t.value,t.children,o],t.keywords),y=Dxe(),_=iv(U=>U.value&&U.value===x.current),w=iv(U=>p||i.filter()===!1?!0:U.search?U.filtered.items.get(a)>0:!0);I.useEffect(()=>{let U=o.current;if(!(!U||t.disabled))return U.addEventListener(Uhe,S),()=>U.removeEventListener(Uhe,S)},[w,t.onSelect,t.disabled]);function S(){var U,V;N(),(V=(U=u.current).onSelect)==null||V.call(U,x.current)}function N(){y.setState("value",x.current,!0)}if(!w)return null;let{disabled:M,value:E,onSelect:A,forceMount:P,keywords:z,...R}=t;return I.createElement(Rn.div,{ref:gy(o,e),...R,id:a,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!_,"data-disabled":!!M,"data-selected":!!_,onPointerMove:M||i.getDisablePointerSelection()?void 0:N,onClick:M?void 0:S},t.children)}),kht=I.forwardRef((t,e)=>{let{heading:n,children:s,forceMount:a,...o}=t,l=Qc(),i=I.useRef(null),u=I.useRef(null),p=Qc(),x=UI(),y=iv(w=>a||x.filter()===!1?!0:w.search?w.filtered.groups.has(l):!0);ek(()=>x.group(l),[]),b8e(l,i,[t.value,t.heading,u]);let _=I.useMemo(()=>({id:l,forceMount:a}),[a]);return I.createElement(Rn.div,{ref:gy(i,e),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&I.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:p},n),Ise(t,w=>I.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?p:void 0},I.createElement(y8e.Provider,{value:_},w))))}),Nht=I.forwardRef((t,e)=>{let{alwaysRender:n,...s}=t,a=I.useRef(null),o=iv(l=>!l.search);return!n&&!o?null:I.createElement(Rn.div,{ref:gy(a,e),...s,"cmdk-separator":"",role:"separator"})}),Sht=I.forwardRef((t,e)=>{let{onValueChange:n,...s}=t,a=t.value!=null,o=Dxe(),l=iv(p=>p.search),i=iv(p=>p.selectedItemId),u=UI();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":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":i,id:u.inputId,type:"text",value:a?t.value:l,onChange:p=>{a||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),Cht=I.forwardRef((t,e)=>{let{children:n,label:s="Suggestions",...a}=t,o=I.useRef(null),l=I.useRef(null),i=iv(p=>p.selectedItemId),u=UI();return I.useEffect(()=>{if(l.current&&o.current){let p=l.current,x=o.current,y,_=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let w=p.offsetHeight;x.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return _.observe(p),()=>{cancelAnimationFrame(y),_.unobserve(p)}}},[]),I.createElement(Rn.div,{ref:gy(o,e),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:u.listId},Ise(t,p=>I.createElement("div",{ref:gy(l,u.listInnerRef),"cmdk-list-sizer":""},p)))}),Mht=I.forwardRef((t,e)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:o,container:l,...i}=t;return I.createElement(ose,{open:n,onOpenChange:s},I.createElement(lse,{container:l},I.createElement(y3,{"cmdk-overlay":"",className:a}),I.createElement(v3,{"aria-label":t.label,"cmdk-dialog":"",className:o},I.createElement(v8e,{ref:e,...i}))))}),Tht=I.forwardRef((t,e)=>iv(n=>n.filtered.count===0)?I.createElement(Rn.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Aht=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},Ise(t,l=>I.createElement("div",{"aria-hidden":!0},l)))}),Eh=Object.assign(v8e,{List:Cht,Item:jht,Input:Sht,Group:kht,Separator:Nht,Dialog:Mht,Empty:Tht,Loading:Aht});function Eht(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Iht(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function _8e(t){let e=I.useRef(t);return ek(()=>{e.current=t}),e}var ek=typeof window>"u"?I.useEffect:I.useLayoutEffect;function E4(t){let e=I.useRef();return e.current===void 0&&(e.current=t()),e}function iv(t){let e=Dxe(),n=()=>t(e.snapshot());return I.useSyncExternalStore(e.subscribe,n,n)}function b8e(t,e,n,s=[]){let a=I.useRef(),o=UI();return ek(()=>{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}})(),u=s.map(p=>p.trim());o.value(t,i,u),(l=e.current)==null||l.setAttribute(A4,i),a.current=i}),a}var Pht=()=>{let[t,e]=I.useState(),n=E4(()=>new Map);return ek(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,a)=>{n.current.set(s,a),e({})}};function Lht(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Ise({asChild:t,children:e},n){return t&&I.isValidElement(e)?I.cloneElement(Lht(e),{ref:e.ref},n(e.props.children)):n(e)}var Oht={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const by=I.forwardRef(({className:t,...e},n)=>r.jsx(Eh,{ref:n,className:zt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));by.displayName=Eh.displayName;const Dht=({children:t,...e})=>r.jsx(Dr,{...e,children:r.jsx(Or,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(by,{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})})}),wy=I.forwardRef(({className:t,...e},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(ya,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Eh.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})]}));wy.displayName=Eh.Input.displayName;const jy=I.forwardRef(({className:t,...e},n)=>r.jsx(Eh.List,{ref:n,className:zt("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));jy.displayName=Eh.List.displayName;const ky=I.forwardRef((t,e)=>r.jsx(Eh.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));ky.displayName=Eh.Empty.displayName;const Ny=I.forwardRef(({className:t,...e},n)=>r.jsx(Eh.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}));Ny.displayName=Eh.Group.displayName;const Rht=I.forwardRef(({className:t,...e},n)=>r.jsx(Eh.Separator,{ref:n,className:zt("-mx-1 h-px bg-border",t),...e}));Rht.displayName=Eh.Separator.displayName;const Sy=I.forwardRef(({className:t,...e},n)=>r.jsx(Eh.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}));Sy.displayName=Eh.Item.displayName;const Fht={event:{label:"Events",icon:_m,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Rc,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:O1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:ay,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:As,color:"bg-fuchsia-500/10 text-fuchsia-600"}},zke=()=>{const[t,e]=I.useState(!1),[n,s]=I.useState(""),[a,o]=I.useState([]),[l,i]=I.useState(!1),u=Gn();I.useEffect(()=>{const _=w=>{w.key==="k"&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),e(S=>!S))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[]);const p=I.useCallback(async _=>{if(!_.trim()){o([]);return}i(!0);const w=`%${_}%`;try{const[S,N,M,E,A]=await Promise.all([Q.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${w},description.ilike.${w}`).limit(5),Q.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${w},description.ilike.${w}`).limit(5),Q.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${w},description.ilike.${w}`).limit(5),Q.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${w},description.ilike.${w}`).limit(5),Q.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${w},description.ilike.${w}`).limit(5)]),P=[];S.data&&S.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}`})}),M.data&&M.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}`})}),A.data&&A.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(S){console.error("Search error:",S)}finally{i(!1)}},[]);I.useEffect(()=>{const _=setTimeout(()=>{p(n)},300);return()=>clearTimeout(_)},[n,p]);const x=_=>{e(!1),s(""),u(_)},y=a.reduce((_,w)=>(_[w.type]||(_[w.type]=[]),_[w.type].push(w),_),{});return r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-9 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>e(!0),children:[r.jsx(ya,{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(Dht,{open:t,onOpenChange:e,children:[r.jsx(wy,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(jy,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&a.length===0&&r.jsxs(ky,{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(([_,w])=>{const S=Fht[_],N=S.icon;return r.jsx(Ny,{heading:S.label,children:w.map(M=>r.jsxs(Sy,{value:`${M.type}-${M.id}-${M.title}`,onSelect:()=>x(M.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${S.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:M.title}),M.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:M.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Lt,{variant:"secondary",className:"text-xs",children:S.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:gu(new Date(M.date),{addSuffix:!0})})]})]},`${M.type}-${M.id}`))},_)})]})]})]})},zht=({expiresAt:t,className:e,showUpgradeButton:n=!0})=>{const[s,a]=I.useState(null),o=Gn();if(I.useEffect(()=>{const p=()=>{const y=new Date().getTime(),w=new Date(t).getTime()-y;if(w<=0){a({days:0,hours:0,minutes:0});return}const S=Math.floor(w/(1e3*60*60*24)),N=Math.floor(w%(1e3*60*60*24)/(1e3*60*60)),M=Math.floor(w%(1e3*60*60)/(1e3*60));a({days:S,hours:N,minutes:M})};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,u=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(Xh,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),n&&r.jsxs(te,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(As,{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":u?"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(Wa,{className:zt("h-4 w-4",i?"text-destructive":u?"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":u?"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":u?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:zt("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:zt("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:zt("text-xs",i?"text-destructive/70":u?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(te,{size:"sm",onClick:()=>o("/subscription"),variant:i?"destructive":u?"default":"outline",className:zt("text-xs h-7 px-3",u&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Bht=()=>{const t=Gn();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(Ke,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:r.jsx(Xh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Zt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(Cn,{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(et,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(Ke,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(et,{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(te,{className:"w-full",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(Ke,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(et,{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(li,{className:"h-6 w-6 text-amber-600"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),r.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),r.jsxs(te,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(li,{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(ji,{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(ws,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},$ht=({hasUnseenBrief:t,onClick:e,className:n})=>r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"icon",onClick:e,className:zt("relative transition-colors",t&&"text-primary hover:text-primary",n),children:[r.jsx(jm,{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(Nm,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var Pse="Checkbox",[Uht]=lc(Pse),[qht,Rxe]=Uht(Pse);function Vht(t){const{__scopeCheckbox:e,checked:n,children:s,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:u,required:p,value:x="on",internal_do_not_use_render:y}=t,[_,w]=Ku({prop:n,defaultProp:a??!1,onChange:u,caller:Pse}),[S,N]=I.useState(null),[M,E]=I.useState(null),A=I.useRef(!1),P=S?!!l||!!S.closest("form"):!0,z={checked:_,disabled:o,setChecked:w,control:S,setControl:N,name:i,form:l,value:x,hasConsumerStoppedPropagationRef:A,required:p,defaultChecked:H1(a)?!1:a,isFormControl:P,bubbleInput:M,setBubbleInput:E};return r.jsx(qht,{scope:e,...z,children:Hht(y)?y(z):s})}var w8e="CheckboxTrigger",j8e=I.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...s},a)=>{const{control:o,value:l,disabled:i,checked:u,required:p,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:_,isFormControl:w,bubbleInput:S}=Rxe(w8e,t),N=ra(a,x),M=I.useRef(u);return I.useEffect(()=>{const E=o==null?void 0:o.form;if(E){const A=()=>y(M.current);return E.addEventListener("reset",A),()=>E.removeEventListener("reset",A)}},[o,y]),r.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":H1(u)?"mixed":u,"aria-required":p,"data-state":M8e(u),"data-disabled":i?"":void 0,disabled:i,value:l,...s,ref:N,onKeyDown:cn(e,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:cn(n,E=>{y(A=>H1(A)?!0:!A),S&&w&&(_.current=E.isPropagationStopped(),_.current||E.stopPropagation())})})});j8e.displayName=w8e;var Fxe=I.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:u,onCheckedChange:p,form:x,...y}=t;return r.jsx(Vht,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:p,name:s,form:x,value:u,internal_do_not_use_render:({isFormControl:_})=>r.jsxs(r.Fragment,{children:[r.jsx(j8e,{...y,ref:e,__scopeCheckbox:n}),_&&r.jsx(C8e,{__scopeCheckbox:n})]})})});Fxe.displayName=Pse;var k8e="CheckboxIndicator",N8e=I.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:s,...a}=t,o=Rxe(k8e,n);return r.jsx(jc,{present:s||H1(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{"data-state":M8e(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:e,style:{pointerEvents:"none",...t.style}})})});N8e.displayName=k8e;var S8e="CheckboxBubbleInput",C8e=I.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:u,name:p,value:x,form:y,bubbleInput:_,setBubbleInput:w}=Rxe(S8e,t),S=ra(n,w),N=zI(o),M=SI(s);I.useEffect(()=>{const A=_;if(!A)return;const P=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(P,"checked").set,U=!a.current;if(N!==o&&R){const V=new Event("click",{bubbles:U});A.indeterminate=H1(o),R.call(A,H1(o)?!1:o),A.dispatchEvent(V)}},[_,N,o,a]);const E=I.useRef(H1(o)?!1:o);return r.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??E.current,required:i,disabled:u,name:p,value:x,form:y,...e,tabIndex:-1,ref:S,style:{...e.style,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});C8e.displayName=S8e;function Hht(t){return typeof t=="function"}function H1(t){return t==="indeterminate"}function M8e(t){return H1(t)?"indeterminate":t?"checked":"unchecked"}const Fl=I.forwardRef(({className:t,...e},n)=>r.jsx(Fxe,{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(N8e,{className:zt("flex items-center justify-center text-current"),children:r.jsx(_i,{className:"h-4 w-4"})})}));Fl.displayName=Fxe.displayName;var zxe="Radio",[Wht,T8e]=lc(zxe),[Ght,Kht]=Wht(zxe),A8e=I.forwardRef((t,e)=>{const{__scopeRadio:n,name:s,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:u,form:p,...x}=t,[y,_]=I.useState(null),w=ra(e,M=>_(M)),S=I.useRef(!1),N=y?p||!!y.closest("form"):!0;return r.jsxs(Ght,{scope:n,checked:a,disabled:l,children:[r.jsx(Rn.button,{type:"button",role:"radio","aria-checked":a,"data-state":L8e(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:w,onClick:cn(t.onClick,M=>{a||u==null||u(),N&&(S.current=M.isPropagationStopped(),S.current||M.stopPropagation())})}),N&&r.jsx(P8e,{control:y,bubbles:!S.current,name:s,value:i,checked:a,required:o,disabled:l,form:p,style:{transform:"translateX(-100%)"}})]})});A8e.displayName=zxe;var E8e="RadioIndicator",I8e=I.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:s,...a}=t,o=Kht(E8e,n);return r.jsx(jc,{present:s||o.checked,children:r.jsx(Rn.span,{"data-state":L8e(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:e})})});I8e.displayName=E8e;var Zht="RadioBubbleInput",P8e=I.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:s=!0,...a},o)=>{const l=I.useRef(null),i=ra(l,o),u=zI(n),p=SI(e);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==n&&w){const S=new Event("click",{bubbles:s});w.call(x,n),x.dispatchEvent(S)}},[u,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}})});P8e.displayName=Zht;function L8e(t){return t?"checked":"unchecked"}var Yht=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Lse="RadioGroup",[Xht]=lc(Lse,[x3,T8e]),O8e=x3(),D8e=T8e(),[Qht,Jht]=Xht(Lse),R8e=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:s,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:u,dir:p,loop:x=!0,onValueChange:y,..._}=t,w=O8e(n),S=xk(p),[N,M]=Ku({prop:o,defaultProp:a??null,onChange:y,caller:Lse});return r.jsx(Qht,{scope:n,name:s,required:l,disabled:i,value:N,onValueChange:M,children:r.jsx(Wge,{asChild:!0,...w,orientation:u,dir:S,loop:x,children:r.jsx(Rn.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":i?"":void 0,dir:S,..._,ref:e})})})});R8e.displayName=Lse;var F8e="RadioGroupItem",z8e=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:s,...a}=t,o=Jht(F8e,n),l=o.disabled||s,i=O8e(n),u=D8e(n),p=I.useRef(null),x=ra(e,p),y=o.value===a.value,_=I.useRef(!1);return I.useEffect(()=>{const w=N=>{Yht.includes(N.key)&&(_.current=!0)},S=()=>_.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",S),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",S)}},[]),r.jsx(Gge,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(A8e,{disabled:l,required:o.required,checked:y,...u,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:cn(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:cn(a.onFocus,()=>{var w;_.current&&((w=p.current)==null||w.click())})})})});z8e.displayName=F8e;var eft="RadioGroupIndicator",B8e=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...s}=t,a=D8e(n);return r.jsx(I8e,{...a,...s,ref:e})});B8e.displayName=eft;var $8e=R8e,U8e=z8e,tft=B8e;const q8e=I.forwardRef(({className:t,...e},n)=>r.jsx($8e,{className:zt("grid gap-2",t),...e,ref:n}));q8e.displayName=$8e.displayName;const V8e=I.forwardRef(({className:t,...e},n)=>r.jsx(U8e,{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(tft,{className:"flex items-center justify-center",children:r.jsx(Gu,{className:"h-2.5 w-2.5 fill-current text-current"})})}));V8e.displayName=U8e.displayName;const rft=({brief:t,open:e,onClose:n,onDismiss:s})=>{const{user:a}=Qr(),[o,l]=I.useState({}),[i,u]=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 M=t.polls.map(A=>A.id),{data:E}=await Q.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",M);if(E){const A={};E.forEach(P=>{A[P.poll_id]||(A[P.poll_id]=[]),A[P.poll_id].push(P.option_id)}),u(A)}},_=(M,E)=>{l(A=>({...A,[M]:E}))},w=(M,E,A)=>{l(P=>{const z=P[M]||[];return A?{...P,[M]:[...z,E]}:{...P,[M]:z.filter(R=>R!==E)}})},S=async M=>{if(!a)return;const E=o[M];if(!E||Array.isArray(E)&&E.length===0){Oe.error("Please select an option");return}x(A=>[...A,M]);try{await Q.from("levelup_brief_poll_responses").delete().eq("poll_id",M).eq("user_id",a.id);const A=Array.isArray(E)?E:[E],P=A.map(R=>({poll_id:M,option_id:R,user_id:a.id})),{error:z}=await Q.from("levelup_brief_poll_responses").insert(P);if(z)throw z;u(R=>({...R,[M]:A})),Oe.success("Response submitted!")}catch(A){console.error("Error submitting poll response:",A),Oe.error("Failed to submit response")}finally{x(A=>A.filter(P=>P!==M))}},N=M=>(M.includes("mediadelivery.net")||M.includes("bunny"),M);return r.jsx(Dr,{open:e,onOpenChange:M=>!M&&n(),children:r.jsxs(Or,{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(gs,{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(jm,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Lt,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(zr,{className:"text-xl font-bold text-white",children:t.brief.title})]})]})]}),r.jsx(Ro,{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(M=>r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>window.open(M.url,"_blank"),className:"gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),M.title]},M.id))})]}),t.polls.map(M=>{var P,z;const E=((P=i[M.id])==null?void 0:P.length)>0,A=p.includes(M.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:M.question}),E&&r.jsxs(Lt,{variant:"secondary",className:"gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),"Responded"]})]}),M.poll_type==="single"?r.jsx(q8e,{value:o[M.id]||((z=i[M.id])==null?void 0:z[0])||"",onValueChange:R=>_(M.id,R),className:"space-y-2",children:M.options.map(R=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(V8e,{value:R.id,id:R.id}),r.jsx(qe,{htmlFor:R.id,className:"cursor-pointer",children:R.option_text})]},R.id))}):r.jsx("div",{className:"space-y-2",children:M.options.map(R=>{const V=(o[M.id]||i[M.id]||[]).includes(R.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Fl,{id:R.id,checked:V,onCheckedChange:K=>w(M.id,R.id,K)}),r.jsx(qe,{htmlFor:R.id,className:"cursor-pointer",children:R.option_text})]},R.id)})}),r.jsx(te,{size:"sm",onClick:()=>S(M.id),disabled:A,children:A?"Submitting...":E?"Update Response":"Submit"})]},M.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(te,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(te,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},nft=()=>{const{user:t}=Qr(),[e,n]=I.useState(null),[s,a]=I.useState(!1),[o,l]=I.useState(!0),[i,u]=I.useState(!1),p=I.useCallback(async()=>{if(!t){l(!1);return}try{const{data:S,error:N}=await Q.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(N||!S){l(!1);return}const{data:M}=await Q.from("levelup_brief_views").select("*").eq("brief_id",S.id).eq("user_id",t.id).maybeSingle(),[E,A]=await Promise.all([Q.from("levelup_brief_links").select("*").eq("brief_id",S.id).order("sort_order"),Q.from("levelup_brief_polls").select("*").eq("brief_id",S.id).order("sort_order")]),P=[];if(A.data)for(const V of A.data){const{data:K}=await Q.from("levelup_brief_poll_options").select("*").eq("poll_id",V.id).order("sort_order");P.push({...V,options:K||[]})}const z={brief:S,links:E.data||[],polls:P};n(z);const R=!!M,U=(M==null?void 0:M.dismissed_at)!==null;if(!R)a(!0),u(!0);else if(S.show_frequency==="every_login"&&!U)a(!0),u(!0);else if(S.show_frequency==="daily"){const V=new Date(M.viewed_at);(new Date().getTime()-V.getTime())/(1e3*60*60)>=24&&!U&&(a(!0),u(!0))}else u(!U)}catch(S){console.error("Error fetching brief:",S)}finally{l(!1)}},[t]);I.useEffect(()=>{p()},[p]);const x=async()=>{if(!(!t||!e))try{const{data:S}=await Q.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();S?await Q.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",S.id):await Q.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id})}catch(S){console.error("Error marking brief as viewed:",S)}};return{currentBrief:e,shouldShowPopup:s,hasUnseenBrief:i,loading:o,openBrief:()=>{a(!0)},closeBrief:()=>{a(!1),x()},dismissBrief:async()=>{if(!(!t||!e))try{const{data:S}=await Q.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();S?await Q.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",S.id):await Q.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id,dismissed_at:new Date().toISOString()}),a(!1),u(!1)}catch(S){console.error("Error dismissing brief:",S)}},refetch:p}};function sft(){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 _=w=>{w.preventDefault(),o(w)};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:u}=await a.userChoice;u==="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(ao,{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(lA,{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(te,{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(gs,{className:"h-4 w-4"})})]})]})}):null}const aft=({children:t,onRefresh:e})=>{const[n,s]=I.useState(!1),[a,o]=I.useState(0),[l,i]=I.useState(!1),u=I.useRef(null),p=I.useRef(0),x=qr(),y=80,_=120,w=I.useCallback(A=>{const P=u.current;P&&P.scrollTop<=0&&(p.current=A.touches[0].clientY,s(!0))},[]),S=I.useCallback(A=>{if(!n||l)return;const P=u.current;if(!P||P.scrollTop>0){s(!1),o(0);return}const R=A.touches[0].clientY-p.current;if(R>0){const V=Math.min(R*.5,_);o(V),V>10&&A.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(A){console.error("Refresh failed:",A)}finally{i(!1),o(0)}}else o(0)},[n,a,l,e,x]),M=Math.min(a/y,1),E=M*180;return r.jsxs("div",{ref:u,className:"h-full overflow-auto",onTouchStart:w,onTouchMove:S,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:M},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(Ll,{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})]})},H8e=()=>{const{user:t}=Qr(),[e,n]=I.useState(!1),[s,a]=I.useState(!1),[o,l]=I.useState(0),[i,u]=I.useState(!0);I.useEffect(()=>{(async()=>{if(!t){u(!1);return}try{const{data:w}=await Q.from("membership_reviews").select("id").eq("user_id",t.id).maybeSingle();if(w){a(!0),n(!1),u(!1);return}const{data:S}=await Q.from("profiles").select("login_count").eq("id",t.id).single(),N=(S==null?void 0:S.login_count)||0;l(N);const M=sessionStorage.getItem("review-prompt-dismissed");n(N>=4&&!M)}catch(w){console.error("Error checking review eligibility:",w)}finally{u(!1)}})()},[t]);const p=I.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=I.useCallback(async(_,w)=>{if(!t)return{success:!1,error:"Not authenticated"};try{const{error:S}=await Q.from("membership_reviews").insert({user_id:t.id,rating:_,review_text:w});if(S)throw S;return a(!0),n(!1),{success:!0,pointsAwarded:25}}catch(S){return console.error("Error submitting review:",S),{success:!1,error:S.message}}},[t]),y=I.useCallback(async()=>{if(t)try{await Q.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}},ift="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",oft=()=>{const{shouldShowPrompt:t,isLoading:e,dismissPrompt:n,submitReview:s,markPostedToGoogle:a}=H8e(),[o,l]=I.useState(!1),[i,u]=I.useState("review"),[p,x]=I.useState(0),[y,_]=I.useState(0),[w,S]=I.useState(""),[N,M]=I.useState(!1),[E,A]=I.useState(!1);if(e||!t&&!E)return null;const P=async()=>{if(p===0){ga({title:"Please select a rating",variant:"destructive"});return}M(!0);const U=await s(p,w);M(!1),U.success?(A(!0),ga({title:"Thank you for your feedback!",description:"Your review helps us improve."}),u("google")):ga({title:"Error submitting review",description:U.error,variant:"destructive"})},z=async U=>{U&&(await navigator.clipboard.writeText(w||`${p} star rating for LevelUp!`),ga({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(ift,"_blank")),l(!1),n()},R=()=>{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(_s,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Dr,{open:o,onOpenChange:R,children:r.jsx(Or,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(Br,{children:[r.jsx(zr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Jn,{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(U=>r.jsx("button",{type:"button",onClick:()=>x(U),onMouseEnter:()=>_(U),onMouseLeave:()=>_(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(_s,{className:zt("h-8 w-8 transition-colors",(y||p)>=U?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},U))}),r.jsx(ss,{placeholder:"Tell us about your experience (optional)",value:w,onChange:U=>S(U.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",onClick:R,className:"flex-1",children:"Maybe Later"}),r.jsx(te,{onClick:P,disabled:N||p===0,className:"flex-1",children:N?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Br,{children:[r.jsx(zr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Jn,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>z(!1),className:"flex-1",children:"No Thanks"}),r.jsx(te,{onClick:()=>z(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function lft(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:M}=await Q.functions.invoke("get-vapid-public-key",{body:{}});if(M)throw M;const E=N==null?void 0:N.vapidPublicKey;if(!E)throw new Error("Missing VAPID public key");x(E);const A=await navigator.serviceWorker.register("/push-sw.js");u(A),n(Notification.permission);const P=await A.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 Oe.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const S=await i.pushManager.getSubscription();if(S){try{await S.unsubscribe()}catch(z){console.warn("Failed to unsubscribe existing push subscription:",z)}const{error:P}=await Q.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"?Oe.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):Oe.error("Notification permission was dismissed. Please try again."),!1}const N=lft(p);let M;try{M=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")?Oe.error("Push permission denied. Check your browser notification settings."):z.includes("key")||z.includes("VAPID")?Oe.error("Push configuration error. Please contact support."):z.includes("AbortError")?Oe.error("Push subscription was cancelled. Please try again."):Oe.error(`Failed to subscribe: ${z}`),!1}const E=M.toJSON(),{error:A}=await Q.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(A)throw console.error("Error saving subscription:",A),Oe.error("Failed to save notification preferences. Please try again."),A;return a(!0),Oe.success("Push notifications enabled!"),!0}catch(S){if(console.error("Error subscribing to push notifications:",S),!(S instanceof Error&&S.message.includes("toast"))){const N=S instanceof Error?S.message:"Unknown error";Oe.error("Failed to enable push notifications: "+N)}return!1}finally{l(!1)}},[y,i,t,p]),w=I.useCallback(async()=>{if(!i||!t)return!1;try{l(!0);const S=await i.pushManager.getSubscription();return S&&await S.unsubscribe(),await Q.from("push_subscriptions").delete().eq("user_id",t.id),a(!1),Oe.success("Push notifications disabled"),!0}catch(S){console.error("Error unsubscribing:",S);const N=S instanceof Error?S.message:"Unknown error";return Oe.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:w}}const Bke="push_notification_prompt_dismissed",cft=()=>{const{user:t}=Qr(),{isSupported:e,isSubscribed:n,isLoading:s,subscribe:a}=W8e(),[o,l]=I.useState(!1),[i,u]=I.useState(!1);I.useEffect(()=>{if(!t||!e||n||s||localStorage.getItem(`${Bke}_${t.id}`))return;const _=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(_)},[t,e,n,s]);const p=async()=>{u(!0);const y=await a();u(!1),y&&l(!1)},x=()=>{t&&localStorage.setItem(`${Bke}_${t.id}`,"true"),l(!1)};return!e||n?null:r.jsx(Dr,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{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(kg,{className:"h-6 w-6 text-primary"})}),r.jsx(zr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Jn,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),r.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(te,{onClick:p,disabled:i,className:"w-full",children:i?"Enabling...":"Enable Notifications"}),r.jsx(te,{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."})]})})},$ke=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(w=>w(e,_))}},a=()=>e,i={setState:s,getState:a,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p))},u=e=t(s,a,i);return i},dft=t=>t?$ke(t):$ke,uft=t=>t;function hft(t,e=uft){const n=it.useSyncExternalStore(t.subscribe,it.useCallback(()=>e(t.getState()),[t,e]),it.useCallback(()=>e(t.getInitialState()),[t,e]));return it.useDebugValue(n),n}const fft=t=>{const e=dft(t),n=s=>hft(e,s);return Object.assign(n,e),n},pft=t=>fft;function mft(t,e){let n;try{n=t()}catch{return}return{getItem:a=>{var o;const l=u=>u===null?null:JSON.parse(u,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 qhe=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return qhe(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return qhe(s)(n)}}}},gft=(t,e)=>(n,s,a)=>{let o={storage:mft(()=>localStorage),partialize:N=>N,version:0,merge:(N,M)=>({...M,...N}),...e},l=!1;const i=new Set,u=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,M)=>(y(N,M),x());const _=t((...N)=>(n(...N),x()),s,a);a.getInitialState=()=>_;let w;const S=()=>{var N,M;if(!p)return;l=!1,i.forEach(A=>{var P;return A((P=s())!=null?P:_)});const E=((M=o.onRehydrateStorage)==null?void 0:M.call(o,(N=s())!=null?N:_))||void 0;return qhe(p.getItem.bind(p))(o.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==o.version){if(o.migrate){const P=o.migrate(A.state,A.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,A.state];return[!1,void 0]}).then(A=>{var P;const[z,R]=A;if(w=o.merge(R,(P=s())!=null?P:_),n(w,!0),z)return x()}).then(()=>{E==null||E(w,void 0),w=s(),l=!0,u.forEach(A=>A(w))}).catch(A=>{E==null||E(void 0,A)})};return a.persist={setOptions:N=>{o={...o,...N},N.storage&&(p=N.storage)},clearStorage:()=>{p==null||p.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:N=>(i.add(N),()=>{i.delete(N)}),onFinishHydration:N=>(u.add(N),()=>{u.delete(N)})},o.skipHydration||S(),w||_},xft=gft,Ose=pft()(xft((t,e)=>({cartItems:[],addToCart:(n,s,a=1,o)=>{t(l=>{const i=l.cartItems.findIndex(u=>{var p;return u.product.id===n.id&&((p=u.variant)==null?void 0:p.id)===(s==null?void 0:s.id)});if(i>=0){const u=[...l.cartItems];return u[i].quantity+=a,o&&(u[i].artworkUrl=o),{cartItems:u}}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})})),G8e=I.createContext({onlineUsers:[],totalOnline:0}),yft=async t=>{try{const{data:e}=await Q.storage.from("avatars").list(`${t}`);if(e&&e.length>0){const{data:n}=Q.storage.from("avatars").getPublicUrl(`${t}/${e[0].name}`);return n.publicUrl}}catch{}},vft=({children:t})=>{const{user:e,brokerageId:n,isAdmin:s}=Qr(),[a,o]=I.useState([]),[l,i]=I.useState(null);I.useEffect(()=>{if(!e)return;const p=Q.channel("app-presence",{config:{presence:{key:e.id}}});return p.on("presence",{event:"sync"},()=>{const x=p.presenceState(),y=[];Object.entries(x).forEach(([_,w])=>{if(w&&w.length>0){const S=w[0];y.push({id:_,name:S.name||"Unknown",avatarUrl:S.avatarUrl,brokerageId:S.brokerageId,onlineSince:S.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var y;if(x==="SUBSCRIBED"){const{data:_}=await Q.from("profiles").select("name, brokerage_id").eq("id",e.id).single(),w=await yft(e.id);await p.track({name:(_==null?void 0:_.name)||((y=e.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:w,brokerageId:_==null?void 0:_.brokerage_id,onlineSince:new Date().toISOString()})}}),i(p),()=>{p.unsubscribe()}},[e]);const u=a.filter(p=>p.id===(e==null?void 0:e.id)?!1:!!(s||n&&p.brokerageId===n||!n&&!p.brokerageId));return r.jsx(G8e.Provider,{value:{onlineUsers:u,totalOnline:a.length},children:t})},K8e=()=>I.useContext(G8e),Uke="dashboard-sidebar-collapsed",Lr=({children:t,title:e})=>{var be,rt,Te;const{user:n,signOut:s,isAdmin:a,isBrokerageManager:o,brokerageId:l}=Qr(),{isAssistant:i,actingAsAgent:u}=Vge(),x=i&&!!u?40:0,{avatarUrl:y}=xOe(n==null?void 0:n.id),{isTrial:_,isExpired:w,expiresAt:S}=act(n==null?void 0:n.id),{isMarketplaceEnabled:N}=vOe(),{currentBrief:M,shouldShowPopup:E,hasUnseenBrief:A,openBrief:P,closeBrief:z,dismissBrief:R}=nft(),{unreadCount:U}=ict(),{openCount:V}=oct(),W=Ose(Pe=>Pe.cartItems).reduce((Pe,Ue)=>Pe+Ue.quantity,0),J=Gn(),ae=Em(),[oe,xe]=I.useState(()=>typeof window<"u"?localStorage.getItem(Uke)==="true":!1);I.useEffect(()=>{localStorage.setItem(Uke,String(oe))},[oe]);const[ie,pe]=I.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),se=Pe=>{pe(Ue=>({...Ue,[Pe]:!Ue[Pe]}))},fe=Pe=>Pe.split(" ").map(Ue=>Ue[0]).join("").toUpperCase().slice(0,2),he=Pe=>ae.pathname===Pe,ye=Pe=>Pe.some(Ue=>ae.pathname===Ue),Ce=({path:Pe,icon:Ue,label:Re,badgeCount:Be})=>{const Ye=r.jsxs(te,{variant:"ghost",size:"sm",className:zt("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",he(Pe)&&"bg-sidebar-accent text-sidebar-accent-foreground",oe?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>J(Pe),children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ue,{className:"h-4 w-4 shrink-0"}),oe&&Be!=null&&Be>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!oe&&Re,!oe&&Be!=null&&Be>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:Be>9?"9+":Be})]});return oe?r.jsxs(Lg,{delayDuration:0,children:[r.jsx(Og,{asChild:!0,children:Ye}),r.jsxs(Nm,{side:"right",className:"flex items-center gap-2",children:[Re,Be!=null&&Be>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Be>9?"9+":Be})]})]}):Ye},Se=({id:Pe,label:Ue,icon:Re,children:Be,activePaths:Ye,showBetaBadge:ht,defaultPath:Me,badgeCount:Qe})=>{if(oe){const le=Me||Ye[0];return r.jsxs(Lg,{delayDuration:0,children:[r.jsx(Og,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"sm",className:zt("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ye(Ye)&&"text-primary"),onClick:()=>J(le),children:r.jsxs("div",{className:"relative",children:[r.jsx(Re,{className:"h-4 w-4"}),Qe!=null&&Qe>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(Nm,{side:"right",className:"flex items-center gap-2",children:[Ue,ht&&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"}),Qe!=null&&Qe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Qe>9?"9+":Qe})]})]})}return r.jsxs(DS,{open:ie[Pe],onOpenChange:()=>se(Pe),children:[r.jsx(RS,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye(Ye)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(Re,{className:"h-4 w-4"}),Ue,ht&&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:[Qe!=null&&Qe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Qe>9?"9+":Qe}),r.jsx(Qd,{className:zt("h-4 w-4 transition-transform duration-200",ie[Pe]&&"rotate-180")})]})]})}),r.jsx(FS,{className:"pl-4 space-y-1 mt-1",children:Be})]})},Ne=({isMobile:Pe=!1})=>{const Ue=Pe?!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",Ue?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[Ue?r.jsx("img",{src:Mct,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:fke,alt:"LevelUp",className:"h-8 w-auto"}),!Pe&&r.jsxs(Lg,{delayDuration:0,children:[r.jsx(Og,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>xe(!Ue),children:r.jsx(vc,{className:zt("h-4 w-4 transition-transform duration-300",Ue&&"rotate-180")})})}),r.jsx(Nm,{side:"right",children:Ue?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Ro,{className:"flex-1",children:r.jsxs("nav",{className:zt("p-3 space-y-1",Ue&&"flex flex-col items-center"),children:[r.jsx(Ce,{path:"/dashboard",icon:Sj,label:"Dashboard"}),r.jsx(Ce,{path:"/events",icon:_m,label:"Events"}),r.jsxs(Se,{id:"agentos",label:"Agent OS",icon:uS,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(Ce,{path:"/mission-control",icon:fi,label:"Mission Control"}),r.jsx(Ce,{path:"/mission-control/contacts",icon:Bn,label:"Contacts"}),r.jsx(Ce,{path:"/mission-control/plans",icon:_m,label:"TouchPlans"}),r.jsx(Ce,{path:"/mission-control/pipeline",icon:ty,label:"Deal Pipeline"}),r.jsx(Ce,{path:"/mission-control/popbys",icon:Zi,label:"Popbys"}),r.jsx(Ce,{path:"/mission-control/video-library",icon:Da,label:"Video Library"}),r.jsx(Ce,{path:"/mission-control/scorecard",icon:gc,label:"Scorecard"}),r.jsx(Ce,{path:"/mission-control/listings",icon:li,label:"Listing Exchange"})]}),r.jsxs(Se,{id:"tools",label:"Tools",icon:Gh,activePaths:["/apps","/ai-toolkit","/mission-control/my-card"],defaultPath:"/apps",children:[r.jsx(Ce,{path:"/apps",icon:Gh,label:"Apps"}),!Ue&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",he("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/mission-control/my-card"),children:[r.jsx(bm,{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"})]}),Ue&&r.jsx(Ce,{path:"/mission-control/my-card",icon:bm,label:"Digital Card"})]}),r.jsxs(Se,{id:"marketing",label:"Marketing",icon:jm,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(Ce,{path:"/templates",icon:Rc,label:"Templates"}),!Ue&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",he("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/social-swag-2"),children:[r.jsx(Tg,{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"})]}),Ue&&r.jsx(Ce,{path:"/social-swag-2",icon:Tg,label:"Social Swag"}),r.jsx(Ce,{path:"/newsletters",icon:ny,label:"Newsletters"})]}),r.jsxs(Se,{id:"learning",label:"Learning",icon:zT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(Ce,{path:"/academy",icon:O1,label:"Academy"}),r.jsx(Ce,{path:"/toolbox",icon:ay,label:"Toolbox"})]}),r.jsxs(Se,{id:"community",label:"Community",icon:Do,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:U,children:[r.jsx(Ce,{path:"/community",icon:Bn,label:"Community",badgeCount:U}),r.jsx(Ce,{path:"/wishlist",icon:R1,label:"Wishlist",badgeCount:V}),!Ue&&r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>window.open("https://www.facebook.com/share/g/1CC6thti2V/","_blank"),children:[r.jsx(Os,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(Se,{id:"goods",label:"The Goods",icon:_h,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[N&&!Ue&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ae.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/marketplace"),children:[r.jsx(_h,{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&&Ue&&r.jsx(Ce,{path:"/marketplace",icon:_h,label:"Marketplace"}),r.jsx(Ce,{path:"/reward-store",icon:Yi,label:"Reward Store"})]}),r.jsxs(Se,{id:"help",label:"Help & Services",icon:Dx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(Ce,{path:"/support",icon:yS,label:"Support"}),r.jsx(Ce,{path:"/additional-services",icon:As,label:"Additional Services"})]}),a&&r.jsxs(r.Fragment,{children:[!Ue&&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"})}),Ue?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(Ce,{path:"/admin",icon:np,label:"Admin Dashboard"})}):r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ae.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/admin"),children:[r.jsx(np,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&r.jsxs(r.Fragment,{children:[!Ue&&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"})}),Ue?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(Ce,{path:"/my-brokerage",icon:li,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(Ce,{path:"/brokerage/dashboard",icon:jd,label:"Manage Brokerages"}),r.jsx(Ce,{path:"/brokerage-resources",icon:Nh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",he("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/my-brokerage"),children:[r.jsx(li,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",he("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/brokerage/dashboard"),children:[r.jsx(jd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",he("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/brokerage-resources"),children:[r.jsx(Nh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",he("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>J("/profile"),children:[r.jsx(ac,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(bS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(vft,{children:r.jsx(AI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[_&&w&&r.jsx(Bht,{}),typeof document<"u"&&Iy.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(Ne,{})}),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(xse,{children:[r.jsx(dxe,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(YT,{className:"h-5 w-5"})})}),r.jsx(BI,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(Ne,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:fke,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(zke,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[_&&!w&&S&&r.jsx(zht,{expiresAt:S,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(zke,{})}),M&&r.jsx($ht,{hasUnseenBrief:A,onClick:P}),N&&r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",onClick:()=>J("/marketplace/cart"),children:[r.jsx(_h,{className:"h-5 w-5"}),W>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:W>99?"99+":W})]}),r.jsx(uht,{}),r.jsx(Rhe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((rt=(be=n==null?void 0:n.user_metadata)==null?void 0:be.name)==null?void 0:rt.split(" ")[0])||"User","!"]}),r.jsxs(Th,{children:[r.jsx(Ah,{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(Ys,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Pi,{src:y||void 0}),r.jsx(Xs,{className:"bg-primary text-primary-foreground font-medium text-sm",children:fe(((Te=n==null?void 0:n.user_metadata)==null?void 0:Te.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(eh,{align:"end",className:"w-48",children:[r.jsxs(ri,{onClick:()=>J("/profile"),className:"cursor-pointer",children:[r.jsx(ac,{className:"h-4 w-4 mr-2"}),"Profile"]}),a&&r.jsxs(ri,{onClick:()=>J("/mission-control/integrations"),className:"cursor-pointer",children:[r.jsx(rA,{className:"h-4 w-4 mr-2"}),"Integrations"]}),r.jsx(Zj,{}),r.jsxs(ri,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(bS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(aft,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:t})}),M&&r.jsx(rft,{brief:M,open:E,onClose:z,onDismiss:R}),r.jsx(sft,{}),r.jsx(oft,{}),r.jsx(cft,{})]})]})})})},_ft=()=>{const{user:t}=Qr(),[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState(""),i=async y=>{var _;if(!(t!=null&&t.email)){Oe.error("Please sign in to upgrade");return}n(!0),a(y);try{const{data:w,error:S}=await Q.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(S)throw S;if(w!=null&&w.url)window.open(w.url,"_blank","noopener,noreferrer"),Oe.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(w){console.error("Checkout error:",w),Oe.error(w.message||"Failed to start checkout. Please try again.")}finally{n(!1),a(null)}},u=["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(qe,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(ot,{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(Ke,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[r.jsx("div",{className:"absolute top-0 right-0 bg-primary text-primary-foreground text-xs px-3 py-1 rounded-bl-lg font-medium",children:"Popular"}),r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Bn,{className:"h-7 w-7 text-primary"})}),r.jsx(Zt,{className:"text-xl",children:"Individual Agent"}),r.jsx(Cn,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(et,{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:u.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(_i,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(te,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:e,children:[e&&s==="individual_agent"?r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(As,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ke,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(li,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Zt,{className:"text-xl",children:"Brokerage"}),r.jsx(Cn,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(et,{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(_i,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(te,{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(Yr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(li,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ke,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:r.jsx(li,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Zt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(Cn,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(et,{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(_i,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(te,{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(Yr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(li,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(Ke,{className:"bg-muted/50",children:r.jsxs(et,{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(ji,{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(ws,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},bft=()=>{const{user:t,loading:e,isBrokerageManager:n,brokerageId:s}=Qr(),a=Gn(),[o,l]=I.useState(""),[i,u]=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()){Oe.error("Please enter a brokerage name");return}const{data:_}=await Q.auth.getSession(),w=_.session;if(!t||!w){Oe.error("Please sign in again to create your brokerage."),a("/auth");return}u(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!t,hasSession:!!w,userId:t==null?void 0:t.id});const{data:S,error:N}=await Q.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:S,error:N}),N)throw N;if(!(S!=null&&S.ok))throw new Error((S==null?void 0:S.error)||"Failed to create brokerage");u(!1),x(!0),Oe.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(S){console.error("Error creating brokerage:",S),Oe.error(S.message||"Failed to create brokerage"),u(!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(Ke,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(Yr,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Zt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(Cn,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(Ii,{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(Yr,{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(Ke,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(li,{className:"w-10 h-10 text-primary"})}),r.jsx(Zt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(Cn,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(ot,{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(Ii,{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(Ii,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Ii,{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(Ii,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(te,{onClick:y,className:"w-full",disabled:i||!o.trim(),children:[i?"Creating...":"Create Brokerage",r.jsx(Jo,{className:"w-4 h-4 ml-2"})]})]})]})})},qke=()=>{const t=Gn(),[e,n]=I.useState("verifying"),[s,a]=I.useState("");I.useEffect(()=>{(async()=>{try{const{data:{session:i},error:u}=await Q.auth.getSession();if(u)throw u;if(i!=null&&i.user){const{data:p}=await Q.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 Q.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(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"space-y-1 text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[e==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),e==="success"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e==="already_claimed"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(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(Cn,{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(et,{children:r.jsx(te,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},wft=()=>{const t=Gn(),[e]=rd(),[n,s]=I.useState(e.get("code")||""),[a,o]=I.useState(""),[l,i]=I.useState(""),[u,p]=I.useState(""),[x,y]=I.useState(!1),[_,w]=I.useState(!1),[S,N]=I.useState(!1),[M,E]=I.useState(!1),[A,P]=I.useState(null),[z,R]=I.useState(null),[U,V]=I.useState(null),[K,W]=I.useState(null);I.useEffect(()=>{const xe=e.get("code");xe&&(s(xe),J(xe))},[e]);const J=async xe=>{N(!0);const{data:ie,error:pe}=await Q.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",xe.toUpperCase().trim()).single();if(pe||!ie){Oe.error("Invalid invite code"),N(!1);return}if(!ie.is_active){Oe.error("This invite code is no longer active"),N(!1);return}if(ie.max_uses&&ie.uses_count>=ie.max_uses){Oe.error("This invite code has reached its maximum uses"),N(!1);return}if(ie.expires_at&&new Date(ie.expires_at){xe.preventDefault(),J(n)},oe=async xe=>{var ie;if(xe.preventDefault(),!u.trim()){Oe.error("Please enter your name");return}if(l.length<6){Oe.error("Password must be at least 6 characters");return}w(!0);try{const pe=`${window.location.origin}/`,{data:se,error:fe}=await Q.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:pe,data:{name:u.trim()}}});if(fe){fe.message.includes("already registered")?Oe.error("This email is already registered. Please sign in instead."):Oe.error(fe.message);return}se.user&&(await Q.rpc("add_default_signup_tag",{user_id:se.user.id}),z?await Q.functions.invoke("assign-brokerage",{body:{userId:se.user.id,brokerageId:z}}):K?await Q.functions.invoke("assign-brokerage",{body:{userId:se.user.id,trialDays:K}}):await Q.functions.invoke("assign-brokerage",{body:{userId:se.user.id,grandfathered:!0}}),A&&await Q.from("invite_codes").update({uses_count:((ie=(await Q.from("invite_codes").select("uses_count").eq("id",A).single()).data)==null?void 0:ie.uses_count)+1}).eq("id",A),Oe.success("Account created! You can now access the dashboard."),t("/dashboard"))}catch(pe){console.error("Signup error:",pe),Oe.error("An unexpected error occurred")}finally{w(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx(Zt,{className:"text-2xl font-bold text-primary",children:U?`Join ${U}`:"Join LevelUp"}),r.jsx(Cn,{children:M?U?`Create your account to join ${U}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(et,{children:M?r.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Full Name"}),r.jsx(ot,{id:"name",type:"text",placeholder:"John Doe",value:u,onChange:xe=>p(xe.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:xe=>o(xe.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(ot,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:xe=>i(xe.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(E1,{className:"h-4 w-4"}):r.jsx($o,{className:"h-4 w-4"})})]})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:_,children:_?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(ot,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:xe=>s(xe.target.value),required:!0,autoFocus:!0})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:S,children:S?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},jft="/assets/testimonial-avatar-1-BsCQFauB.jpg",kft="/assets/testimonial-avatar-2-B6VPVc2t.jpg",Nft="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Sft="/assets/testimonial-avatar-4-98iKMtkB.jpg",Cft="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Mft=[jft,kft,Nft,Sft,Cft],Tft=b3({name:fc().trim().min(2,"Name must be at least 2 characters").max(100),email:fc().trim().email("Please enter a valid email address").max(255),phone:fc().trim().min(10,"Please enter a valid phone number").max(20).optional().or(dke("")),brokerage:fc().trim().max(200).optional().or(dke(""))}),Aft=[{icon:Gf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Rc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Ds,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Bl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:ka,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Zi,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Eft=[{icon:Bn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:As,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:ji,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:of,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:To,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:gc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:fi,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Ig,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Ift=[{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."}],Pft=()=>{const t=Gn(),[e,n]=I.useState(!1),[s,a]=I.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=I.useState({}),i=async u=>{var x,y;u.preventDefault(),l({});const p=Tft.safeParse(s);if(!p.success){const _={};p.error.errors.forEach(w=>{w.path[0]&&(_[w.path[0]]=w.message)}),l(_);return}n(!0);try{const{data:_,error:w}=await Q.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(w){console.error("Trial signup error:",w),Oe.error(w.message||"Something went wrong. Please try again.");return}if(_!=null&&_.error){Oe.error(_.error);return}Oe.success("🎉 Welcome aboard! Check your email to claim your account."),t("/trial/success")}catch(_){console.error("Trial signup error:",_),Oe.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(Im,{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:vte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var u;return(u=document.getElementById("features"))==null?void 0:u.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(te,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[r.jsx("div",{className:"flex justify-center lg:justify-start",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium",children:[r.jsx(As,{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:Mft.map((u,p)=>r.jsx("img",{src:u,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(u=>r.jsx(_s,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},u))}),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(Ke,{className:"bg-white shadow-2xl border-0",children:r.jsxs(et,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx(Cg,{className:"h-8 w-8 text-white"})}),r.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),r.jsxs("form",{onSubmit:i,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Full Name *"}),r.jsx(ot,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:u=>a({...s,name:u.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"email",children:"Email Address *"}),r.jsx(ot,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:u=>a({...s,email:u.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"phone",children:"Phone Number"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:u=>a({...s,phone:u.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(ot,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:u=>a({...s,brokerage:u.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(te,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:e,children:e?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(Jo,{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:Aft.map((u,p)=>r.jsxs(Ke,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Ht,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(u.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:u.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:u.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(As,{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:Eft.map((u,p)=>r.jsxs(Ke,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(u.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Zt,{className:"text-lg font-semibold text-white",children:u.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:u.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:Ift.map((u,p)=>r.jsx(Ke,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(et,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(_s,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',u.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:u.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:u.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(uf,{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(Ig,{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(Ke,{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(et,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(te,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),size:"lg",className:"h-14 px-8 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 rounded-full",children:["Start Your Free Trial Now",r.jsx(Jo,{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:ixe,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."})]})})})]})]})},Lft=()=>{const t=Gn();return r.jsxs(r.Fragment,{children:[r.jsx(Im,{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:vte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(te,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),r.jsxs("section",{className:"relative pt-24 pb-12 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden flex-1 flex items-center",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(Ke,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(et,{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(Fc,{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(ws,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),r.jsx("p",{className:"text-muted-foreground",children:"We just sent you a magic link to claim your account and set up your password. Click the link in your email to get started!"})]}),r.jsxs("div",{className:"text-left space-y-3 mb-8",children:[r.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),r.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),r.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),r.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",r.jsx("button",{onClick:()=>t("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(te,{onClick:()=>t("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(Jo,{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:ixe,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Oft=b3({viewerName:fc().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:fc().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:fc().max(20,"Phone must be less than 20 characters").optional(),message:fc().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Dft({shareToken:t,agentName:e,hasContact:n}){const[s,a]=I.useState(!1),[o,l]=I.useState(!1),[i,u]=I.useState(null),p=Nse({resolver:Sse(Oft),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{a(!0),u(null);try{const{data:_,error:w}=await Q.functions.invoke("video-reply-notify",{body:{shareToken:t,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(w)throw new Error(w.message);if(!(_!=null&&_.success))throw new Error((_==null?void 0:_.error)||"Failed to send reply");l(!0)}catch(_){console.error("Failed to submit reply:",_),u(_.message||"Something went wrong. Please try again.")}finally{a(!1)}};return o?r.jsx(Ke,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Bl,{className:"h-5 w-5 text-primary"}),r.jsx(Zt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(Cn,{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(et,{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(El,{control:p.control,name:"viewerName",render:({field:y})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Your Name *"}),r.jsx(Nl,{children:r.jsx(ot,{placeholder:"John Smith",...y})}),r.jsx($u,{})]})}),r.jsx(El,{control:p.control,name:"viewerEmail",render:({field:y})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Email *"}),r.jsx(Nl,{children:r.jsx(ot,{type:"email",placeholder:"john@example.com",...y})}),r.jsx($u,{})]})})]}),!n&&r.jsx(El,{control:p.control,name:"viewerPhone",render:({field:y})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Phone (optional)"}),r.jsx(Nl,{children:r.jsx(ot,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx($u,{})]})}),r.jsx(El,{control:p.control,name:"message",render:({field:y})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Message *"}),r.jsx(Nl,{children:r.jsx(ss,{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($u,{})]})}),i&&r.jsx("p",{className:"text-sm text-destructive",children:i}),r.jsx(te,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(eo,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Rft=()=>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(_s,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(_s,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(_s,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(_s,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(_s,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(Jx,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Fft=()=>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(As,{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(_s,{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(As,{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(_s,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(_s,{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(Jx,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),zft=()=>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(fm,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(fm,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(fm,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(fm,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(fi,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(fi,{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(fi,{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"})]}),Bft=()=>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(Rl,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(_s,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Rl,{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(_s,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(_s,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),$ft=()=>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(fm,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(fm,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(hS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),Uft=()=>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(kj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(kj,{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(As,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(As,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),qft=()=>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($1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx($1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx($1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(h1,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(h1,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(h1,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(h1,{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(_s,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),Vft=()=>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(fi,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(fi,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Hft=()=>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(_s,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(_s,{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(_s,{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(_s,{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(As,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Fc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Fc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),Wft=()=>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(_s,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(As,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(As,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Gft=()=>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(Vx,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Vx,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Vx,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Vx,{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"})]})]})]}),Kft=()=>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(_s,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(_s,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Rl,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Rl,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(Jx,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Zft=()=>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(of,{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(Fc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(Zi,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),Yft=()=>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(fi,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(fi,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(fi,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(fi,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(fi,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(fi,{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(fi,{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(fi,{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"})]}),Xft=()=>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(B1,{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(B1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(As,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(B1,{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"})]}),Qft=()=>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(ua,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(ua,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(cf,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(cf,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(fi,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(fi,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(As,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Fc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Jft=()=>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(Fc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Fc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(cf,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(ua,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(As,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(As,{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"})]}),ept=()=>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(cf,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(cf,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(cf,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(ua,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Fc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(As,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(_s,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),tpt=()=>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(ua,{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(cf,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(fi,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(As,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(wj,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),Vke=()=>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"})]}),rpt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(fi,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(fi,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(fi,{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(fi,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),npt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(wj,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(As,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(ua,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),spt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(bj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(wS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(bj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),YM=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(As,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Fc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(As,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),Hke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(ua,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(As,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(ua,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Vhe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(As,{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(fi,{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(rpt,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx($T,{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(YM,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(bj,{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(spt,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(gc,{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(YM,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Rl,{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(Vke,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(To,{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(Hke,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(wS,{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(YM,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(of,{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(Zft,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(fi,{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(Yft,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(B1,{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(Xft,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(_s,{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(Hft,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(hS,{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($ft,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(fm,{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(zft,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Rl,{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(Bft,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(Jx,{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(Rft,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(lf,{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(Fft,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Rl,{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(Kft,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(kj,{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(Uft,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(fi,{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(Vft,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx($1,{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(qft,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(As,{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(Wft,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Vx,{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(Gft,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(ua,{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(Qft,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Fc,{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(Jft,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(Ds,{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(Hke,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(wd,{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(YM,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(Ij,{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(wj,{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(npt,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(cf,{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(ept,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(ua,{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(tpt,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(kd,{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(YM,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Rl,{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(Vke,{})}],apt=[{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 ipt(t){return Vhe.filter(e=>e.category===t)}function zS(t){return Vhe.find(e=>e.id===t)||Vhe[0]}function opt(){const{shareToken:t}=td(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,u]=I.useState(!0),[p,x]=I.useState(null),[y,_]=I.useState(!0);I.useEffect(()=>{const U=()=>{['[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(J=>{document.querySelectorAll(J).forEach(ae=>{ae.style.display="none"})})};U();const V=[setTimeout(U,500),setTimeout(U,1500),setTimeout(U,3e3)],K=new MutationObserver(U);return K.observe(document.body,{childList:!0,subtree:!0}),()=>{V.forEach(clearTimeout),K.disconnect()}},[]),I.useEffect(()=>{(async()=>{if(!t){x("Invalid share link"),u(!1);return}const{data:V,error:K}=await Q.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"),u(!1);return}n(V);try{await Q.rpc("log_video_view",{p_video_id:V.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(W){console.warn("Failed to log video view:",W)}if(V.owner_user_id){const{data:W}=await Q.from("profiles").select("id, name, email, phone").eq("id",V.owner_user_id).single();if(W){a(W);try{const{data:J}=await Q.storage.from("avatars").list(`${V.owner_user_id}`);if(J&&J.length>0){const{data:ae}=Q.storage.from("avatars").getPublicUrl(`${V.owner_user_id}/${J[0].name}`);l(ae.publicUrl)}}catch{}}}u(!1)})()},[t]);const w=U=>{if(!U)return"0:00";const V=Math.floor(U/60),K=U%60;return`${V}:${K.toString().padStart(2,"0")}`},S=U=>U.includes("iframe.mediadelivery.net/play/")?U.replace("/play/","/embed/")+"?autoplay=true&responsive=true":U,N=U=>{if(!U)return"?";const V=U.split(" ");return V.length>=2?`${V[0][0]}${V[1][0]}`.toUpperCase():U.substring(0,2).toUpperCase()},M=zS((e==null?void 0:e.page_template)||"default"),E=(e==null?void 0:e.recipient_name)||null,A=M.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(Yr,{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(Ke,{className:"max-w-md w-full",children:r.jsxs(et,{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:"Video Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:p||"This video is no longer available."})]})})});const R=M.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(Im,{children:[r.jsx("title",{children:A}),r.jsx("meta",{name:"description",content:M.subText}),r.jsx("meta",{property:"og:title",content:A}),r.jsx("meta",{property:"og:description",content:M.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:A}),r.jsx("meta",{name:"twitter:description",content:M.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",M.gradientClasses),children:[R&&M.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[R&&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",M.accentColor==="primary"&&"bg-primary/10 text-primary",M.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",M.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",M.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",M.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",M.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",M.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",M.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",M.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",M.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",M.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",M.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",M.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:M.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:A}),r.jsx("p",{className:"text-muted-foreground",children:M.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(Ys,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Pi,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(Xs,{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:R?"A special video from":"A personal video from"}),r.jsx("h2",{className:"text-lg font-semibold truncate",children:s.name||"Your Agent"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[s.phone&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${s.phone}`,"aria-label":"Call agent",children:r.jsx(ji,{className:"h-4 w-4"})})}),s.email&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${s.email}`,"aria-label":"Email agent",children:r.jsx(ws,{className:"h-4 w-4"})})})]})]}),r.jsx(Ke,{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:S(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:U=>{var K;U.currentTarget.style.display="none";const V=(K=U.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(Da,{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(Ul,{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:w(e.duration_seconds)})]})}),!R&&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(te,{size:"lg",onClick:()=>_(!0),className:"gap-2",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Dft,{shareToken:t,agentName:(s==null?void 0:s.name)||null,hasContact:!!e.contact_id})]})]})]})}function lpt(){return I.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(Ret,{})}function cpt(){const{token:t}=td();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(Yr,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const dpt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},upt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},y4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function hpt(){var ie,pe,se,fe;const{slugOrId:t}=td(),[e]=rd(),{data:n,isLoading:s}=sOe(t||""),a=aOe(),o=Eot(),l=e.get("ref"),[i,u]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(""),[w,S]=I.useState(""),[N,M]=I.useState(!1),[E,A]=I.useState(!1),[P,z]=I.useState(null),[R,U]=I.useState(!1);I.useEffect(()=>{l&&o.mutate(l)},[l]);const V=he=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(he),K=async he=>{if(he.preventDefault(),!(!i.trim()||!y.trim()||!n)){M(!0);try{await a.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:i.trim(),lastName:p.trim(),email:y.trim(),phone:w.trim(),shareToken:l}),A(!0),Oe.success("Thanks! The agent will be in touch soon.")}catch(ye){console.error("Lead submission error:",ye),Oe.error(`Failed to submit: ${ye.message||"Please try again"}`)}finally{M(!1)}}},W=(n==null?void 0:n.photos)||[],J=W.find(he=>he.is_primary)||W[0],ae=()=>{P!==null&&z(P===0?W.length-1:P-1)},oe=()=>{P!==null&&z(P===W.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(Ji,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:yte,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(ua,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(te,{asChild:!0,children:r.jsx(Ji,{to:"/public/listings",children:"Browse All Listings"})})]})]});const xe=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(Im,{children:[r.jsxs("title",{children:[xe," | 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":""} ${y4[n.property_type]} in ${n.city}, ${n.state}. ${((ie=n.description)==null?void 0:ie.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:xe}),r.jsx("meta",{property:"og:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${y4[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}`}),J&&r.jsx("meta",{property:"og:image",content:J.photo_url}),J&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${y4[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:xe}),r.jsx("meta",{name:"twitter:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),J&&r.jsx("meta",{name:"twitter:image",content:J.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||`${y4[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:W.map(he=>he.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(Ji,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:yte,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(Ji,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),W.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:J==null?void 0:J.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${y4[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:W.slice(1,5).map((he,ye)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>z(ye+1),children:[r.jsx("img",{src:he.photo_url,alt:`${n.property_address||n.city} - Photo ${ye+2} of ${W.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ye===3&&W.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",W.length-5," more"]})]},he.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Lt,{className:`${dpt[n.status]} text-white border-0`,children:upt[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(To,{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(M1,{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(C1,{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(Ag,{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(Ds,{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(Lt,{variant:"secondary",children:[r.jsx(li,{className:"h-3 w-3 mr-1"}),y4[n.property_type]]}),n.lot_size&&r.jsxs(Lt,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Lt,{variant:"secondary",children:"HOA"})]}),n.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Os,{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(Ke,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(et,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>U(!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(Da,{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(Ul,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(te,{onClick:()=>U(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(Ul,{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(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ac,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{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(Ke,{className:"border-primary",children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{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(ws,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:K,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"firstName",children:"First Name *"}),r.jsx(ot,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:he=>u(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"lastName",children:"Last Name"}),r.jsx(ot,{id:"lastName",type:"text",placeholder:"Doe",value:p,onChange:he=>x(he.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"email",children:"Email *"}),r.jsx(ot,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:he=>_(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:w,onChange:he=>S(he.target.value)})]}),r.jsx(te,{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(Dr,{open:P!==null,onOpenChange:()=>z(null),children:r.jsxs(Or,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Br,{className:"sr-only",children:r.jsx(zr,{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(gs,{className:"h-5 w-5"})}),P!==null&&W[P]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:W[P].photo_url,alt:`Photo ${P+1}`,className:"w-full max-h-[80vh] object-contain"}),W.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:ae,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(vc,{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(Bi,{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," / ",W.length]})]})]})]})}),r.jsx(Dr,{open:R,onOpenChange:U,children:r.jsxs(Or,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(Br,{className:"sr-only",children:r.jsx(zr,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>U(!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(gs,{className:"h-5 w-5"})}),((fe=n==null?void 0:n.video)==null?void 0:fe.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 fpt(){var o;const{slug:t}=td(),{data:e,isLoading:n,error:s}=cOe(t);if(I.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),I.useEffect(()=>{e!=null&&e.id&&Ei(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(Im,{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(lxe,{card:e})]})}function XM({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]),u=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(te,{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(te,{variant:"ghost",size:"icon",className:zt("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:u,children:r.jsx(vc,{className:"h-6 w-6"})}),r.jsx(te,{variant:"ghost",size:"icon",className:zt("absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:i,children:r.jsx(Bi,{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 ppt(t){return"EST"}function vE(t){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(t),s=ppt();return`${n} ${s}`}function BS(t){const e=new Date,n=new Date(t),s=Mke(n,-15),a=Mke(n,30);return e>a?"ended":Oke(e,{start:n,end:a})?"live":Oke(e,{start:s,end:n})?"starting_soon":"upcoming"}function Bxe(t){const e=BS(t);return e==="starting_soon"||e==="live"}const Wke=Bxe,mpt=({events:t,registrations:e,onNavigateToEvents:n})=>{const[s,a]=I.useState(new Date);I.useEffect(()=>{const w=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(w)},[]);const o=t.filter(w=>Bxe(w.event_date));if(o.length===0)return null;const l=o[0],i=BS(l.event_date),u=e.find(w=>w.event_id===l.id),p=(u==null?void 0:u.zoom_join_url)||l.zoom_link,x=!!u,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(Ej,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Wa,{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 ${vE(new Date(l.event_date))}`:`Starts at ${vE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(te,{onClick:()=>window.open(p,"_blank"),className:`${_.button} text-white gap-2`,children:[r.jsx(Os,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(te,{variant:"outline",onClick:n,className:`${_.outlineButton} gap-2`,children:[r.jsx(Bn,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var $xe="Progress",Uxe=100,[gpt]=lc($xe),[xpt,ypt]=gpt($xe),Z8e=I.forwardRef((t,e)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:o=vpt,...l}=t;(a||a===0)&&!Gke(a)&&console.error(_pt(`${a}`,"Progress"));const i=Gke(a)?a:Uxe;s!==null&&!Kke(s,i)&&console.error(bpt(`${s}`,"Progress"));const u=Kke(s,i)?s:null,p=Lte(u)?o(u,i):void 0;return r.jsx(xpt,{scope:n,value:u,max:i,children:r.jsx(Rn.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":Lte(u)?u:void 0,"aria-valuetext":p,role:"progressbar","data-state":Q8e(u,i),"data-value":u??void 0,"data-max":i,...l,ref:e})})});Z8e.displayName=$xe;var Y8e="ProgressIndicator",X8e=I.forwardRef((t,e)=>{const{__scopeProgress:n,...s}=t,a=ypt(Y8e,n);return r.jsx(Rn.div,{"data-state":Q8e(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:e})});X8e.displayName=Y8e;function vpt(t,e){return`${Math.round(t/e*100)}%`}function Q8e(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Lte(t){return typeof t=="number"}function Gke(t){return Lte(t)&&!isNaN(t)&&t>0}function Kke(t,e){return Lte(t)&&!isNaN(t)&&t<=e&&t>=0}function _pt(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Uxe}\`.`}function bpt(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 ${Uxe} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var J8e=Z8e,wpt=X8e;const Jc=I.forwardRef(({className:t,value:e,...n},s)=>r.jsx(J8e,{ref:s,className:zt("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:r.jsx(wpt,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Jc.displayName=J8e.displayName;function jpt(){const{user:t,isBrokerageManager:e}=Qr(),[n,s]=I.useState([]),[a,o]=I.useState([]),[l,i]=I.useState(!1),[u,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:R}=await Q.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(R)throw R;const{data:U,error:V}=await Q.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",t.id);if(V)throw V;const{data:K,error:W}=await Q.from("onboarding_checklist_dismissed").select("id").eq("user_id",t.id).maybeSingle();if(W)throw W;s(z||[]),o(U||[]),i(!!K),z&&z.length>0&&await _(z,U||[])}catch(z){console.error("Error fetching checklist data:",z)}finally{p(!1)}},_=async(z,R)=>{var Re,Be;if(!(t!=null&&t.id))return;const U=R.map(Ye=>Ye.item_id),V=z.filter(Ye=>!U.includes(Ye.id));if(V.length===0)return;const[K,W,J,ae,oe,xe,ie,pe,se,fe,he,ye,Ce,Se,Ne]=await Promise.all([Q.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle(),Q.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",t.id),Q.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",t.id),Q.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",t.id),Q.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","template"),Q.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","academy_video"),Q.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","toolbox"),Q.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),Q.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Q.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Q.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Q.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Q.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",t.id),Q.from("innercircle_contacts").select("id").eq("owner_user_id",t.id),Q.from("deal_pipeline").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id)]),be={},rt=(Re=K.data)==null?void 0:Re.brokerage_id;be.share_resource=(W.count||0)>0,be.post_community=(J.count||0)>0,be.register_event=(ae.count||0)>0,be.view_template=(oe.count||0)>0,be.watch_academy=(xe.count||0)>0,be.use_toolbox=(ie.count||0)>0,be.launch_app=(pe.count||0)>0,be.add_contact=(se.count||0)>0,be.create_video=(fe.count||0)>0,be.complete_touch=(he.count||0)>0,be.add_transaction=(ye.count||0)>0,be.add_listing=(Ce.count||0)>0,be.add_deal=(Ne.count||0)>0;const Te=((Be=Se.data)==null?void 0:Be.map(Ye=>Ye.id))||[],Pe=[];rt?Pe.push(Q.from("profiles").select("id").eq("brokerage_id",rt).neq("id",t.id).then(Ye=>{var ht;be.add_agent=(((ht=Ye.data)==null?void 0:ht.length)||0)>0})):be.add_agent=!1,Te.length>0?(Pe.push(Q.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Te).then(Ye=>{be.add_plan=(Ye.count||0)>0})),Pe.push(Q.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Te).then(Ye=>{be.schedule_popby=(Ye.count||0)>0}))):(be.add_plan=!1,be.schedule_popby=!1),await Promise.all(Pe);const Ue=V.filter(Ye=>be[Ye.action_type]);if(Ue.length>0){const Ye=Ue.map(Me=>({user_id:t.id,item_id:Me.id})),{error:ht}=await Q.from("onboarding_checklist_progress").upsert(Ye,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!ht){const Me=Ue.map(Qe=>({item_id:Qe.id,completed_at:new Date().toISOString()}));o(Qe=>[...Qe,...Me])}}},w=async z=>{if(t!=null&&t.id)try{const{error:R}=await Q.from("onboarding_checklist_progress").insert({user_id:t.id,item_id:z});if(R)throw R;o(U=>[...U,{item_id:z,completed_at:new Date().toISOString()}])}catch(R){console.error("Error marking item complete:",R)}},S=async()=>{if(t!=null&&t.id)try{const{error:z}=await Q.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,M=n.length,E=M>0&&N>=M,A=M>0?N/M*100:0;return{items:n,progress:a,isDismissed:l,loading:u,completedCount:N,totalCount:M,isComplete:E,progressPercentage:A,isItemComplete:z=>a.some(R=>R.item_id===z),markComplete:w,dismiss:S,refetch:y}}const kpt={add_agent:r.jsx(Bn,{className:"h-4 w-4"}),share_resource:r.jsx(_c,{className:"h-4 w-4"}),post_community:r.jsx(Do,{className:"h-4 w-4"}),register_event:r.jsx(Ds,{className:"h-4 w-4"}),view_template:r.jsx(O0,{className:"h-4 w-4"}),watch_academy:r.jsx(O1,{className:"h-4 w-4"}),use_toolbox:r.jsx(ay,{className:"h-4 w-4"}),launch_app:r.jsx(FT,{className:"h-4 w-4"}),add_deal:r.jsx(ty,{className:"h-4 w-4"}),add_listing:r.jsx(ua,{className:"h-4 w-4"})},Npt={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function Spt(){const{items:t,isDismissed:e,loading:n,completedCount:s,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:u,dismiss:p}=jpt(),x=Gn(),[y,_]=I.useState(!0);return n||e||a===0||o?null:r.jsxs(Ke,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Cg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(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(te,{variant:"ghost",size:"sm",onClick:()=>_(!y),className:"h-8 w-8 p-0",children:y?r.jsx(T1,{className:"h-4 w-4"}):r.jsx(Qd,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(gs,{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(Jc,{value:l,className:"h-2"})]})]}),y&&r.jsx(et,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:t.map(w=>{const S=i(w.id);return r.jsxs("div",{className:zt("flex items-start gap-3 p-3 rounded-lg transition-colors",S?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>{if(S)return;const N=Npt[w.action_type];N?x(N):u(w.id)},children:[r.jsx("div",{className:"mt-0.5",children:S?r.jsx(Xi,{className:"h-5 w-5 text-primary"}):r.jsx(Gu,{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:kpt[w.action_type]||r.jsx(Gu,{className:"h-4 w-4"})}),r.jsx("span",{className:zt("font-medium",S&&"line-through text-muted-foreground"),children:w.title})]}),w.description&&r.jsx("p",{className:zt("text-sm text-muted-foreground mt-1",S&&"line-through"),children:w.description})]})]},w.id)})})})]})}const Lm=()=>Kt({queryKey:["relationship-types"],queryFn:async()=>{const{data:t,error:e}=await Q.from("relationship_types").select("*").order("sort_order");if(e)throw e;return t}}),mp=t=>{const e=Bc(),n=1e3,s=async a=>{const o=[];let l=0;for(;;){const{data:i,error:u}=await a.range(l,l+n-1);if(u)throw u;const p=i??[];if(o.push(...p),p.length{let a=Q.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})},Cpt=t=>Kt({queryKey:["innercircle-contact",t],queryFn:async()=>{const{data:e,error:n}=await Q.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}),eDe=()=>{const t=Bc();return Kt({queryKey:["innercircle-contact-counts",t],queryFn:async()=>{const{data:e,error:n}=await Q.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})},qxe=()=>{const t=qr(),e=Bc();return or({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 Q.from("innercircle_contacts").insert(o).select().single();if(i)throw i;if(s&&s.length>0){const{error:u}=await Q.from("innercircle_contact_tags").insert(s.map(p=>({contact_id:l.id,relationship_type_id:p})));if(u)throw u}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ga({title:"Contact created successfully"})},onError:n=>{ga({title:"Error creating contact",description:n.message,variant:"destructive"})}})},tDe=()=>{const t=qr();return or({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:u}=await Q.from("innercircle_contacts").update(l).eq("id",e).select().single();if(u)throw u;if(s!==void 0&&(await Q.from("innercircle_contact_tags").delete().eq("contact_id",e),s.length>0)){const{error:p}=await Q.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"]}),ga({title:"Contact updated successfully"})},onError:e=>{ga({title:"Error updating contact",description:e.message,variant:"destructive"})}})},Vxe=()=>{const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("innercircle_contacts").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ga({title:"Contact deleted successfully"})},onError:e=>{ga({title:"Error deleting contact",description:e.message,variant:"destructive"})}})},Hxe=()=>Kt({queryKey:["action-types"],queryFn:async()=>{const{data:t,error:e}=await Q.from("action_types").select("*").order("sort_order");if(e)throw e;return t}}),Mpt=t=>Kt({queryKey:["action-scripts",t],queryFn:async()=>{let e=Q.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await e;if(s)throw s;return n}}),Tpt=()=>Kt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:t,error:e}=await Q.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(e)throw e;return t}}),Apt=()=>{const t=qr(),e=Bc();return or({mutationFn:async({name:n,description:s})=>{const{data:a,error:o}=await Q.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"]}),ga({title:"Plan created successfully"})},onError:n=>{ga({title:"Error creating plan",description:n.message,variant:"destructive"})}})},Ept=()=>{const t=qr(),e=Bc();return or({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:a,error:o}=await Q.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 Q.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 u=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 Q.from("touchpoint_plan_items").insert(u);if(p)throw p}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ga({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{ga({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},Ipt=()=>{const t=qr();return or({mutationFn:async({id:e,name:n,description:s})=>{const{data:a,error:o}=await Q.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"]}),ga({title:"Plan updated successfully"})}})},Ppt=()=>{const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("touchpoint_plans").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ga({title:"Plan deleted successfully"})}})},Lpt=()=>{const t=qr();return or({mutationFn:async({planId:e,items:n})=>{if(await Q.from("touchpoint_plan_items").delete().eq("plan_id",e),n.length>0){const{error:s}=await Q.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"]}),ga({title:"Plan schedule updated"})}})},Opt=()=>{const t=qr();return or({mutationFn:async({actionTypeId:e,title:n,scriptBody:s,emailSubject:a,tone:o})=>{const{data:l,error:i}=await Q.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"]}),ga({title:"Script created successfully"})},onError:e=>{ga({title:"Error creating script",description:e.message,variant:"destructive"})}})},Dpt=()=>{const t=Bc();return Kt({queryKey:["user-plan-enrollments",t],queryFn:async()=>{const{data:e,error:n}=await Q.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return e},enabled:!!t})},Rpt=()=>{const t=qr(),e=Bc();return or({mutationFn:async({planId:n,relationshipTypeId:s,active:a})=>{const{data:o}=await Q.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await Q.from("user_plan_enrollments").update({active:a}).eq("id",o.id);if(l)throw l}else if(a){const{error:l}=await Q.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"]}),ga({title:"Plan enrollment updated"})}})},Dse=(t=7)=>{const e=Bc();return Kt({queryKey:["contact-touch-logs",e,t],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-t);const{data:s,error:a}=await Q.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})},rDe=()=>{const t=Bc();return Kt({queryKey:["contacts-last-touch",t],queryFn:async()=>{const{data:e,error:n}=await Q.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})},Fpt=(t=90)=>{const{data:e}=mp(),{data:n}=rDe();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=qr(),e=Bc();return or({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await Q.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"]}),ga({title:"Action completed!"})}})},sDe="agentos_weekly_touch_goal",Zke=20,Ote=()=>{if(typeof window>"u")return Zke;const t=localStorage.getItem(sDe);if(t){const e=parseInt(t,10);if(!isNaN(e)&&e>0)return e}return Zke},aDe=t=>{localStorage.setItem(sDe,t.toString())},iDe=()=>{const{data:t}=Dse(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(u=>new Date(u.completed_at).toDateString()));let i=new Date(e);for(;l.has(i.toDateString());)a++,i.setDate(i.getDate()-1)}const o=Ote();return{actionsThisWeek:s,weeklyGoal:o,streak:a,progress:Math.min(s/o*100,100)}},zpt=()=>{const t=Bc();return Kt({queryKey:["contact-plan-cycles",t],queryFn:async()=>{const{data:e,error:n}=await Q.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})},Bpt=()=>{const t=qr();return Bc(),or({mutationFn:async()=>{const{data:e}=await Q.from("user_plan_enrollments").select("*").eq("active",!0);if(!e||e.length===0)return;const{data:n}=await Q.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!n)return;const{data:s}=await Q.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 u=e.find(p=>p.relationship_type_id===i.relationship_type_id);u&&!a.has(`${l.id}-${u.plan_id}`)&&o.push({contact_id:l.id,plan_id:u.plan_id,relationship_type_id:i.relationship_type_id})}if(o.length>0){const{error:l}=await Q.from("contact_plan_cycles").insert(o);if(l)throw l}return o.length},onSuccess:e=>{t.invalidateQueries({queryKey:["contact-plan-cycles"]}),e&&e>0&&ga({title:`${e} contact(s) enrolled in plans`})}})},oDe=()=>{const t=Bc(),{data:e}=zpt(),{data:n}=Dse(30);return Kt({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(w=>new Date(w.completed_at)>=o).map(w=>`${w.contact_id}-${w.action_type_id}`))||[]);for(const w of e){if(!((_=w.plan)!=null&&_.items)||w.plan.items.length===0||!w.contact)continue;const S=new Date(w.cycle_start_date),M=Math.floor((s.getTime()-S.getTime())/(30.44*24*60*60*1e3))%12+1,E=w.plan.items.find(A=>A.month_number===M);if(E&&E.action_type){const A=`${w.contact_id}-${E.action_type_id}`;if(!l.has(A)){const{data:P}=await Q.from("relationship_types").select("name").eq("id",w.relationship_type_id).single();a.push({contact:w.contact,actionType:E.action_type,script:E.default_script||void 0,planName:w.plan.name,relationshipTypeName:(P==null?void 0:P.name)||"",monthNumber:M})}}}const i=5,u=s.getDate(),p=a.sort((w,S)=>w.contact.first_name.localeCompare(S.contact.first_name)),x=(u-1)%Math.max(1,p.length);return[...p.slice(x),...p.slice(0,x)].slice(0,i)},enabled:!!t&&!!e})};function $pt(){const t=Gn(),{data:e,isLoading:n}=oDe(),{data:s}=mp(),a=iDe(),[o,l]=I.useState(Ote()),[i,u]=I.useState(""),[p,x]=I.useState(!1);I.useEffect(()=>{l(Ote())},[]);const y=()=>{const U=parseInt(i,10);if(isNaN(U)||U<1){ga({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(U),aDe(U),x(!1),ga({title:"Goal updated",description:`Weekly touch goal set to ${U}`})},_=()=>{u(o.toString()),x(!0)},w=vf(new Date),S=Xl(w,7),N=U=>{if(!U)return null;const V=new Date(U);return new Date(w.getFullYear(),V.getMonth(),V.getDate())},M=(s==null?void 0:s.map(U=>{const V=N(U.birthday),K=N(U.home_anniversary),W=[];return V&&V>=w&&V<=S&&W.push({contact:U,type:"birthday",date:V,isToday:sc(V,w)}),K&&K>=w&&K<=S&&W.push({contact:U,type:"anniversary",date:K,isToday:sc(K,w)}),W}).flat().sort((U,V)=>U.date.getTime()-V.date.getTime()).slice(0,3))||[],E=(s==null?void 0:s.filter(U=>{const V=N(U.birthday),K=N(U.home_anniversary);return V&&sc(V,w)||K&&sc(K,w)}).length)||0,A=(e==null?void 0:e.length)||0,P=E+A,z=(a==null?void 0:a.actionsThisWeek)||0,R=(a==null?void 0:a.streak)||0;return n?r.jsx(Ke,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{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(Ke,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(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:R>0&&r.jsxs(Lt,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(lf,{className:"h-3 w-3"}),R," 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(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),t("/mission-control/contacts?new=true")},children:[r.jsx(hf,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),t("/mission-control")},children:[r.jsx(ji,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:U=>{U.stopPropagation(),t("/mission-control/video/record")},children:[r.jsx(Da,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),t("/mission-control/popbys")},children:[r.jsx(To,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:U=>{U.stopPropagation(),t("/mission-control/pipeline")},children:[r.jsx(ty,{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(sy,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Dr,{open:p,onOpenChange:x,children:[r.jsx(Uo,{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(jd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Or,{className:"sm:max-w-[360px]",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Set Weekly Goal"}),r.jsx(Jn,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(ot,{id:"weekly-goal",type:"number",min:"1",value:i,onChange:U=>u(U.target.value),placeholder:"20",onKeyDown:U=>{U.key==="Enter"&&y()}})]}),r.jsx(te,{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(Jc,{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"]})]}),M.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(of,{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:M.map((U,V)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${U.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:K=>{K.stopPropagation(),t(`/mission-control/contacts/${U.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[U.type==="birthday"?r.jsx(of,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(ua,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[U.contact.first_name," ",U.contact.last_name]}),U.isToday&&r.jsx(Lt,{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:U.isToday?U.type==="birthday"?"🎂":"🏠":mn(U.date,"EEE, MMM d")}),r.jsx(Bi,{className:"h-3 w-3"})]})]},`${U.contact.id}-${U.type}-${V}`))})]}),r.jsxs(te,{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(Jo,{className:"h-4 w-4"})]})]})]})}const lDe=()=>Kt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:t,error:e}=await Q.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(e)throw e;return(t==null?void 0:t.enabled)??!1}}),cDe=t=>{const{user:e,brokerageId:n}=Qr();return Kt({queryKey:["listings",t,n],queryFn:async()=>{let s=Q.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 Q.from("profiles").select("id").eq("brokerage_id",n);if(i&&i.length>0){const u=i.map(y=>y.id);let p=Q.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",u);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(w=>w.id)),_=x.filter(w=>!y.has(w.id));l=[...l,..._]}}}switch(t==null?void 0:t.sortBy){case"updated":l.sort((i,u)=>new Date(u.updated_at).getTime()-new Date(i.updated_at).getTime());break;case"price_asc":l.sort((i,u)=>i.price-u.price);break;case"price_desc":l.sort((i,u)=>u.price-i.price);break;default:l.sort((i,u)=>new Date(u.created_at).getTime()-new Date(i.created_at).getTime())}return l}})},dDe=()=>{const{user:t}=Qr();return Kt({queryKey:["my-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})},uDe=t=>{const{user:e}=Qr();return Kt({queryKey:["listing",t],queryFn:async()=>{const{data:n,error:s}=await Q.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 Q.from("listing_views").insert({listing_id:t,viewer_id:e.id}),n},enabled:!!t})},Upt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:a}=await Q.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"]})}})},qpt=()=>{const t=qr();return or({mutationFn:async({agentId:e,...n})=>{const{data:s,error:a}=await Q.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"]})}})},Vpt=()=>{const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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]})}})},hDe=()=>{const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("listings").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Hpt=()=>{const t=qr();return or({mutationFn:async({listingId:e,photoUrl:n,isPrimary:s=!1})=>{const{data:a,error:o}=await Q.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"]})}})},Wpt=()=>{const t=qr();return or({mutationFn:async({photoId:e,listingId:n})=>{const{error:s}=await Q.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"]})}})},Gpt=()=>{const{user:t}=Qr();return Kt({queryKey:["saved-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.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})},fDe=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await Q.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await Q.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await Q.from("listing_saves").insert({listing_id:n,agent_id:e.id}),{saved:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["saved-listings"]}),t.invalidateQueries({queryKey:["listings"]})}})},pDe=t=>{const{user:e}=Qr();return Kt({queryKey:["listing-saved",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await Q.from("listing_saves").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Kpt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await Q.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await Q.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await Q.from("listing_follows").insert({listing_id:n,agent_id:e.id}),{following:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-following"]})}})},Zpt=t=>{const{user:e}=Qr();return Kt({queryKey:["listing-following",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await Q.from("listing_follows").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Ypt=()=>{const{user:t}=Qr();return or({mutationFn:async({listingId:e,shareType:n})=>{if(!t)throw new Error("Not authenticated");const{error:s}=await Q.from("listing_shares").insert({listing_id:e,sharing_agent_id:t.id,share_type:n});if(s)throw s}})},Xpt=()=>{const{user:t}=Qr();return Kt({queryKey:["my-referrals",t==null?void 0:t.id],queryFn:async()=>{if(!t)return{sent:[],received:[]};const[e,n]=await Promise.all([Q.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",t.id).order("created_at",{ascending:!1}),Q.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})},Qpt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async({listingId:n,listingAgentId:s,buyerName:a,buyerType:o,notes:l})=>{if(!e)throw new Error("Not authenticated");const{data:i,error:u}=await Q.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(u)throw u;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["my-referrals"]})}})},Jpt=()=>Kt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:t}=await Q.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 u=e.get(i);u?u.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 Q.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 u;const i=a.get(l.agent_id);i?i.count++:a.set(l.agent_id,{name:((u=l.agent)==null?void 0:u.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}}}),emt=()=>{const{user:t,brokerageId:e}=Qr();return Kt({queryKey:["brokerage-listings",e],queryFn:async()=>{if(!t||!e)return[];const{data:n}=await Q.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 Q.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})},tmt=({className:t,variant:e="default"})=>r.jsx(Lt,{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"}),rmt={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"},nmt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function smt(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function amt(){const t=Gn(),{data:e,isLoading:n}=lDe(),{data:s,isLoading:a}=cDe({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),u=[...l,...i].slice(0,6),p=n||a;return!p&&!e?null:p?r.jsx(Ke,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(et,{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(tmt,{})]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),u.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(ua,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),r.jsx(te,{variant:"link",size:"sm",onClick:()=>t("/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:u.map(x=>{var _,w;const y=((_=x.photos)==null?void 0:_.find(S=>S.is_primary))||((w=x.photos)==null?void 0:w[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(ua,{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(Lt,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(_s,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Lt,{className:`text-[10px] px-1.5 py-0.5 ${rmt[x.status]}`,children:nmt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:smt(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 mDe(t=10,e){return Kt({queryKey:["event-leaderboard",t,e],queryFn:async()=>{const{data:n}=await Q.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 Q.from("profiles").select("id").eq("brokerage_id",e);a=new Set((_==null?void 0:_.map(w=>w.id))||[])}const{data:o,error:l}=await Q.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 u=i.slice(0,t),p=u.map(_=>_.user_id),{data:x}=await Q.from("profiles").select("id, name").in("id",p),y=new Map((x==null?void 0:x.map(_=>[_.id,{name:_.name}]))||[]);return u.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 gDe(t){return Kt({queryKey:["user-attendance-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await Q.from("agent_attendance_stats").select("*").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return e},enabled:!!t})}function xDe(t){return Kt({queryKey:["user-badges",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.from("agent_badges").select("*").eq("user_id",t).order("earned_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function yDe(t,e){return Kt({queryKey:["user-rank",t,e],queryFn:async()=>{if(!t)return null;const{data:n}=await Q.from("agent_attendance_stats").select("total_points").eq("user_id",t).single();if(!n)return null;const{data:s}=await Q.from("user_roles").select("user_id").eq("role","admin"),a=new Set((s==null?void 0:s.map(u=>u.user_id))||[]),{data:o,error:l}=await Q.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(u=>!a.has(u.user_id)))||[];if(e){const{data:u}=await Q.from("profiles").select("id").eq("brokerage_id",e),p=new Set((u==null?void 0:u.map(x=>x.id))||[]);i=i.filter(x=>p.has(x.user_id))}return i.length+1},enabled:!!t})}function imt(){const{user:t,brokerageId:e,isAdmin:n}=Qr();Gn();const s=!!e,[a,o]=I.useState("brokerage"),l=()=>{if(n)return null;if(s)return a==="global"?null:e},{data:i,isLoading:u}=mDe(5,l()),{data:p}=gDe(t==null?void 0:t.id),{data:x}=yDe(t==null?void 0:t.id,l()),{data:y}=xDe(t==null?void 0:t.id),_=n||s,w=()=>n?"Agent Leaderboard":s?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(u)return r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Yi,{className:"h-4 w-4 text-yellow-500"}),w()]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-2",children:[...Array(_?5:3)].map((N,M)=>r.jsx(Ir,{className:"h-10 w-full"},M))})})]});const S=N=>N===0?r.jsx(Yi,{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(Ke,{children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Yi,{className:"h-4 w-4 text-yellow-500"}),w()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(te,{variant:a==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(te,{variant:a==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(et,{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((M,E)=>{var A,P,z;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${M.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:S(E)}),r.jsx(Ys,{className:"h-6 w-6",children:r.jsx(Xs,{className:"text-xs",children:((P=(A=M.profile)==null?void 0:A.name)==null?void 0:P.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((z=M.profile)==null?void 0:z.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:M.total_points})]},M.user_id)}),N.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(Ji,{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(Zi,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Bi,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Yi,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(et,{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(lf,{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(Rl,{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(Ji,{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(Zi,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Bi,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(_s,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(Ji,{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(Zi,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Bi,{className:"h-4 w-4"})]})]})})]})}const Rse=()=>Kt({queryKey:["lead-sources"],queryFn:async()=>{const{data:t,error:e}=await Q.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}}),omt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{data:s,error:a}=await Q.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"]}),Oe.success("Lead source added")},onError:n=>{Oe.error("Failed to add lead source"),console.error(n)}})},Wxe=(t,e)=>{const{user:n,isAdmin:s}=Qr(),a=s&&e?e:n==null?void 0:n.id;return Kt({queryKey:["scorecard-transactions",t,a],queryFn:async()=>{let o=Q.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})},vDe=t=>{const{user:e,isAdmin:n}=Qr(),s=n&&t?t:e==null?void 0:e.id;return Kt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:a,error:o}=await Q.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})},Fse=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{data:s,error:a}=await Q.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"]}),Oe.success("Transaction added")},onError:n=>{Oe.error("Failed to add transaction"),console.error(n)}})},lmt=()=>{const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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"]}),Oe.success("Transaction updated")},onError:e=>{Oe.error("Failed to update transaction"),console.error(e)}})},cmt=()=>{const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("scorecard_transactions").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Oe.success("Transaction deleted")},onError:e=>{Oe.error("Failed to delete transaction"),console.error(e)}})},_De=(t,e)=>{const{user:n,isAdmin:s}=Qr(),a=s&&e?e:n==null?void 0:n.id;return Kt({queryKey:["scorecard-goals",t,a],queryFn:async()=>{const{data:o,error:l}=await Q.from("scorecard_goals").select("*").eq("owner_user_id",a).eq("year",t).maybeSingle();if(l)throw l;return o},enabled:!!a})},dmt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{data:s,error:a}=await Q.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]}),Oe.success("Goals saved")},onError:n=>{Oe.error("Failed to save goals"),console.error(n)}})},zse=()=>{const{user:t}=Qr();return Kt({queryKey:["scorecard-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.from("scorecard_settings").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e},enabled:!!(t!=null&&t.id)})},umt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{data:s,error:a}=await Q.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"]}),Oe.success("Settings saved")},onError:n=>{Oe.error("Failed to save settings"),console.error(n)}})},bDe=(t,e)=>{const{data:n,isLoading:s}=Wxe(t,e),{data:a,isLoading:o}=vDe(e),{data:l}=zse(),i=(l==null?void 0:l.show_commission)??!0,u=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,R)=>z+Number(R.sale_price),0),w=p.reduce((z,R)=>z+(Number(R.commission_amount)||0),0),S={};p.forEach(z=>{var U;const R=((U=z.lead_source)==null?void 0:U.name)||"Unknown";S[R]=(S[R]||0)+1});const N=Object.entries(S).map(([z,R])=>({name:z,count:R})).sort((z,R)=>R.count-z.count),M=N[0]||null,E={};p.forEach(z=>{const R=new Date(z.close_date).toLocaleString("default",{month:"short"});E[R]=(E[R]||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?w:0,topLeadSource:M,transactionsByMonth:P,leadSourceBreakdown:N}};return{yearStats:u(n),lifetimeStats:u(a),isLoading:s||o,showCommission:i}},hmt=()=>{const{isAdmin:t}=Qr();return Kt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:e,error:n}=await Q.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 Q.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return a},enabled:t})},B0={recency:40,touchpoints:30,transactions:20},Yke={warm:70,cooling:40};function fmt(t){return t===null?0:t<=14?B0.recency:t<=30?B0.recency*.85:t<=60?B0.recency*.65:t<=90?B0.recency*.4:t<=180?B0.recency*.2:B0.recency*.05}function pmt(t){const e=Math.min(t/12,1);return Math.round(B0.touchpoints*e)}function mmt(t){return t?B0.transactions:0}function gmt(){return 0}function xmt(t){return t>=Yke.warm?"warm":t>=Yke.cooling?"cooling":"at-risk"}function Gxe(){const{data:t,isLoading:e}=mp(),{data:n}=rDe(),{data:s}=Dse(365),{data:a}=vDe(),o=I.useMemo(()=>{if(!t)return[];const i=new Date,u=dht(i),p={};s==null||s.forEach(y=>{new Date(y.completed_at)>=u&&(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,w=_?_y(i,new Date(_)):null,S=p[y.id]||0,N=x.has(y.id),M=fmt(w),E=pmt(S),A=mmt(N),P=gmt(),z=Math.round(M+E+A+P),R={score:z,status:xmt(z),breakdown:{recency:Math.round(M),touchpoints:Math.round(E),transactions:Math.round(A),referrals:Math.round(P)},lastTouchDate:_,daysSinceTouch:w,touchCountLast12Months:S,hasTransaction:N};return{...y,relationshipScore:R}})},[t,n,s,a]),l=I.useMemo(()=>{const i=o.filter(_=>_.relationshipScore.status==="warm").length,u=o.filter(_=>_.relationshipScore.status==="cooling").length,p=o.filter(_=>_.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((_,w)=>_+w.relationshipScore.score,0)/x):0;return{warm:i,cooling:u,atRisk:p,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:e}}function wDe(){const t=Gn(),{stats:e,contactsWithScores:n,isLoading:s}=Gxe();if(s)return r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Ir,{className:"h-5 w-40"})}),r.jsxs(et,{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(Ke,{children:[r.jsx(Ht,{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(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(te,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>t("/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(u=>u.relationshipScore.status==="at-risk").sort((u,p)=>u.relationshipScore.score-p.relationshipScore.score).slice(0,3);return r.jsxs(Ke,{children:[r.jsxs(Ht,{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(ap,{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(et,{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(Jc,{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(Jc,{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(Jc,{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(Ij,{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(u=>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/${u.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:[u.first_name," ",u.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:u.relationshipScore.daysSinceTouch===null?"Never":`${u.relationshipScore.daysSinceTouch}d`}),r.jsx(Bi,{className:"h-3 w-3"})]})]},u.id))})]}),r.jsxs(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Bi,{className:"h-4 w-4 ml-1"})]})]})]})}const ymt=()=>{var ie,pe;const{user:t,isAdmin:e}=Qr(),n=Gn(),[s,a]=I.useState([]),[o,l]=I.useState([]),[i,u]=I.useState([]),[p,x]=I.useState([]),[y,_]=I.useState([]),[w,S]=I.useState([]),[N,M]=I.useState(new Set),[E,A]=I.useState([]),[P,z]=I.useState([]),[R,U]=I.useState([]),[V,K]=I.useState(!0);I.useEffect(()=>{W()},[t]);const W=async()=>{var se,fe,he,ye;try{const[Ce,Se,Ne,be,rt,Te,Pe,Ue,Re,Be]=await Promise.all([Q.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),Q.from("app_tiles").select("*").order("name"),Q.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),Q.from("events").select("*").order("event_date",{ascending:!0}),Q.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t==null?void 0:t.id),Q.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),Q.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Q.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Q.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),Q.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),Ye=((se=Ce.data)==null?void 0:se.map(Le=>Le.tag))||[],ht=new Set(((fe=Ne.data)==null?void 0:fe.map(Le=>Le.app_id))||[]);M(ht);const Qe=(((he=Se.data)==null?void 0:he.filter(Le=>!Le.required_tags||Le.required_tags.length===0?!0:Le.required_tags.some(We=>Ye.includes(We))))||[]).sort((Le,We)=>Le.name==="LevelUp Members Portal"?-1:We.name==="LevelUp Members Portal"?1:0);a(Qe.slice(0,6));const le=((ye=be.data)==null?void 0:ye.filter(Le=>BS(Le.event_date)!=="ended"))||[];l(le.slice(0,4)),A(rt.data||[]),u(Te.data||[]),x(Pe.data||[]),_(Ue.data||[]),S(Re.data||[]);const Ve=Be.data||[];z(Ve.filter(Le=>Le.placement==="top")),U(Ve.filter(Le=>Le.placement==="between"))}catch(Ce){console.error("Error loading dashboard:",Ce),Oe.error("Failed to load dashboard data")}finally{K(!1)}},J=async se=>{var he;const fe=window.open("about:blank","_blank");try{await Q.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:ye,error:Ce}=await Q.functions.invoke("sso-launch",{body:{app_id:se.app_id}});if(Ce)throw Ce;ye!=null&&ye.redirect_url?fe&&!fe.closed?(fe.location.href=ye.redirect_url,(he=fe.focus)==null||he.call(fe)):window.location.assign(ye.redirect_url):(fe==null||fe.close(),Oe.error("Launch link unavailable"))}catch(ye){fe==null||fe.close(),console.error("Error launching app:",ye),Oe.error("Failed to launch app")}},ae=se=>E==null?void 0:E.some(fe=>fe.event_id===se),oe=se=>{const fe=E==null?void 0:E.find(he=>he.event_id===se);return fe==null?void 0:fe.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 xe=se=>R.filter(fe=>fe.section_after===se);return r.jsxs(Lr,{title:"Dashboard",children:[r.jsx(mpt,{events:o,registrations:E,onNavigateToEvents:()=>n("/events")}),P.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(XM,{banners:P})}),r.jsx(Spt,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((pe=(ie=t==null?void 0:t.user_metadata)==null?void 0:ie.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($pt,{}),r.jsx(wDe,{}),r.jsx(imt,{})]}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ds,{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 fe=ae(se.id),he=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 ${Wke(se.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[Wke(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(Ej,{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 ",vE(new Date(se.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:fe?r.jsxs(te,{size:"sm",variant:"default",className:"gap-1",onClick:ye=>{ye.stopPropagation(),window.open(he,"_blank")},children:[r.jsx(Os,{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(Bi,{className:"h-4 w-4"})]})})]},se.id)})})]}),xe("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(XM,{banners:xe("events")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Gf,{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(Gf,{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))})]}),xe("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(XM,{banners:xe("academy")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),p.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Sg,{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(Sg,{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))})]}),xe("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(XM,{banners:xe("toolbox")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),i.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(I1,{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(I1,{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))})]}),xe("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(XM,{banners:xe("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(amt,{})}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(vm,{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 fe=N.has(se.id);return r.jsxs("div",{onClick:()=>J(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})]}),fe&&r.jsx(vm,{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(te,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Jo,{className:"h-4 w-4"})]})]}),w.length===0?r.jsx(Ke,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(As,{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:w.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(As,{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 Bse="Switch",[vmt]=lc(Bse),[_mt,bmt]=vmt(Bse),jDe=I.forwardRef((t,e)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:u="on",onCheckedChange:p,form:x,...y}=t,[_,w]=I.useState(null),S=ra(e,P=>w(P)),N=I.useRef(!1),M=_?x||!!_.closest("form"):!0,[E,A]=Ku({prop:a,defaultProp:o??!1,onChange:p,caller:Bse});return r.jsxs(_mt,{scope:n,checked:E,disabled:i,children:[r.jsx(Rn.button,{type:"button",role:"switch","aria-checked":E,"aria-required":l,"data-state":CDe(E),"data-disabled":i?"":void 0,disabled:i,value:u,...y,ref:S,onClick:cn(t.onClick,P=>{A(z=>!z),M&&(N.current=P.isPropagationStopped(),N.current||P.stopPropagation())})}),M&&r.jsx(SDe,{control:_,bubbles:!N.current,name:s,value:u,checked:E,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});jDe.displayName=Bse;var kDe="SwitchThumb",NDe=I.forwardRef((t,e)=>{const{__scopeSwitch:n,...s}=t,a=bmt(kDe,n);return r.jsx(Rn.span,{"data-state":CDe(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:e})});NDe.displayName=kDe;var wmt="SwitchBubbleInput",SDe=I.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:s=!0,...a},o)=>{const l=I.useRef(null),i=ra(l,o),u=zI(n),p=SI(e);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==n&&w){const S=new Event("click",{bubbles:s});w.call(x,n),x.dispatchEvent(S)}},[u,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}})});SDe.displayName=wmt;function CDe(t){return t?"checked":"unchecked"}var MDe=jDe,jmt=NDe;const Ss=I.forwardRef(({className:t,...e},n)=>r.jsx(MDe,{className:zt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...e,ref:n,children:r.jsx(jmt,{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")})}));Ss.displayName=MDe.displayName;var TDe="AlertDialog",[kmt]=lc(TDe,[tLe]),Py=tLe(),ADe=t=>{const{__scopeAlertDialog:e,...n}=t,s=Py(e);return r.jsx(ose,{...s,...n,modal:!0})};ADe.displayName=TDe;var Nmt="AlertDialogTrigger",EDe=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=Py(n);return r.jsx(axe,{...a,...s,ref:e})});EDe.displayName=Nmt;var Smt="AlertDialogPortal",IDe=t=>{const{__scopeAlertDialog:e,...n}=t,s=Py(e);return r.jsx(lse,{...s,...n})};IDe.displayName=Smt;var Cmt="AlertDialogOverlay",PDe=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=Py(n);return r.jsx(y3,{...a,...s,ref:e})});PDe.displayName=Cmt;var $S="AlertDialogContent",[Mmt,Tmt]=kmt($S),Amt=RAe("AlertDialogContent"),LDe=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:s,...a}=t,o=Py(n),l=I.useRef(null),i=ra(e,l),u=I.useRef(null);return r.jsx(qit,{contentName:$S,titleName:ODe,docsSlug:"alert-dialog",children:r.jsx(Mmt,{scope:n,cancelRef:u,children:r.jsxs(v3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:cn(a.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=u.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[r.jsx(Amt,{children:s}),r.jsx(Imt,{contentRef:l})]})})})});LDe.displayName=$S;var ODe="AlertDialogTitle",DDe=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=Py(n);return r.jsx(RI,{...a,...s,ref:e})});DDe.displayName=ODe;var RDe="AlertDialogDescription",FDe=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=Py(n);return r.jsx(FI,{...a,...s,ref:e})});FDe.displayName=RDe;var Emt="AlertDialogAction",zDe=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=Py(n);return r.jsx(cse,{...a,...s,ref:e})});zDe.displayName=Emt;var BDe="AlertDialogCancel",$De=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,{cancelRef:a}=Tmt(BDe,n),o=Py(n),l=ra(e,a);return r.jsx(cse,{...o,...s,ref:l})});$De.displayName=BDe;var Imt=({contentRef:t})=>{const e=`\`${$S}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${$S}\` by passing a \`${RDe}\` 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 \`${$S}\`. 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},Pmt=ADe,Lmt=EDe,Omt=IDe,UDe=PDe,qDe=LDe,VDe=zDe,HDe=$De,WDe=DDe,GDe=FDe;const pu=Pmt,Hx=Lmt,Dmt=Omt,KDe=I.forwardRef(({className:t,...e},n)=>r.jsx(UDe,{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}));KDe.displayName=UDe.displayName;const Hd=I.forwardRef(({className:t,...e},n)=>r.jsxs(Dmt,{children:[r.jsx(KDe,{}),r.jsx(qDe,{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})]}));Hd.displayName=qDe.displayName;const Wd=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-2 text-center sm:text-left",t),...e});Wd.displayName="AlertDialogHeader";const Gd=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Gd.displayName="AlertDialogFooter";const Kd=I.forwardRef(({className:t,...e},n)=>r.jsx(WDe,{ref:n,className:zt("text-lg font-semibold",t),...e}));Kd.displayName=WDe.displayName;const Zd=I.forwardRef(({className:t,...e},n)=>r.jsx(GDe,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Zd.displayName=GDe.displayName;const yd=I.forwardRef(({className:t,...e},n)=>r.jsx(VDe,{ref:n,className:zt(fE(),t),...e}));yd.displayName=VDe.displayName;const Yd=I.forwardRef(({className:t,...e},n)=>r.jsx(HDe,{ref:n,className:zt(fE({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Yd.displayName=HDe.displayName;const Rmt=[{key:"contacts",label:"Contacts",icon:ji,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:Sj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:Da,description:"View and upload videos"},{key:"listings",label:"Listings",icon:ua,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:VT,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:To,description:"View and log pop-bys"}];function Fmt(){var R;const{user:t}=Qr(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,u]=I.useState(!1),[p,x]=I.useState(null),[y,_]=I.useState({email:"",name:"",password:""}),[w,S]=I.useState(!1),[N,M]=I.useState(null);I.useEffect(()=>{t&&E()},[t]);const E=async()=>{if(t){a(!0);try{const{data:U,error:V}=await Q.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",t.id);if(V)throw V;if(U&&U.length>0){const K=U.map(ae=>ae.assistant_id),{data:W}=await Q.from("profiles").select("id, name, email").in("id",K),J=U.map(ae=>{const oe=W==null?void 0:W.find(xe=>xe.id===ae.assistant_id);return{...ae,permissions:ae.permissions,assistant_profile:oe?{name:oe.name||"",email:oe.email||""}:void 0}});n(J)}else n([])}catch(U){console.error("Error loading assistants:",U)}finally{a(!1)}}},A=async()=>{if(!t||!y.email.trim()||!y.name.trim()||!y.password.trim()){Oe.error("Please fill in all fields");return}if(y.password.length<6){Oe.error("Password must be at least 6 characters");return}if(e.length>=1){Oe.error("You can only have 1 assistant");return}S(!0);try{const{data:{session:U}}=await Q.auth.getSession();if(!U)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 ${U.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 W=K.userId||K.id;if(!W)throw new Error("No user ID returned");const J=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({userId:W,role:"assistant",action:"add",agentId:t.id})}),ae=await J.json();if(!J.ok)throw new Error(ae.error||"Failed to assign assistant role");const{error:oe}=await Q.from("agent_assistant_assignments").insert({agent_id:t.id,assistant_id:W,permissions:{contacts:!0,pipeline:!0,videos:!1,listings:!1,scorecard:!1,popbys:!1}});if(oe)throw oe;Oe.success(`Assistant account created for ${y.name.trim()}`),l(!1),_({email:"",name:"",password:""}),E()}catch(U){console.error("Error adding assistant:",U),Oe.error(U.message||"Failed to add assistant")}finally{S(!1)}},P=async()=>{if(!(!p||!t))try{const{data:{session:U}}=await Q.auth.getSession();if(!U)throw new Error("Not authenticated");const{error:V}=await Q.from("agent_assistant_assignments").delete().eq("id",p.id);if(V)throw V;const{data:K}=await Q.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 ${U.access_token}`},body:JSON.stringify({userId:p.assistant_id,role:"assistant",action:"remove"})}),Oe.success("Assistant removed"),u(!1),x(null),E()}catch(U){console.error("Error removing assistant:",U),Oe.error(U.message||"Failed to remove assistant")}},z=async(U,V,K)=>{M(U);try{const W=e.find(oe=>oe.id===U);if(!W)return;const J={...W.permissions,[V]:K},{error:ae}=await Q.from("agent_assistant_assignments").update({permissions:J}).eq("id",U);if(ae)throw ae;n(oe=>oe.map(xe=>xe.id===U?{...xe,permissions:J}:xe))}catch(W){console.error("Error updating permissions:",W),Oe.error("Failed to update permissions")}finally{M(null)}};return s?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ht,{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(Cn,{children:"Add an assistant to help manage your Agent OS"})]}),e.length===0&&r.jsxs(te,{size:"sm",onClick:()=>l(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),r.jsx(et,{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(U=>{var V,K,W,J;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(Ys,{className:"h-10 w-10",children:r.jsx(Xs,{children:((K=(V=U.assistant_profile)==null?void 0:V.name)==null?void 0:K.split(" ").map(ae=>ae[0]).join("").toUpperCase())||"A"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((W=U.assistant_profile)==null?void 0:W.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((J=U.assistant_profile)==null?void 0:J.email)||""})]}),r.jsxs(Lt,{variant:"secondary",className:"ml-2",children:[r.jsx(uf,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),r.jsx(te,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{x(U),u(!0)},children:r.jsx($n,{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:Rmt.map(ae=>{const oe=ae.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:ae.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ae.description})]})]}),r.jsx(Ss,{checked:U.permissions[ae.key]||!1,onCheckedChange:xe=>z(U.id,ae.key,xe),disabled:N===U.id})]},ae.key)})})]})]},U.id)})})})]}),r.jsx(Dr,{open:o,onOpenChange:l,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Add Assistant"}),r.jsx(Jn,{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(qe,{htmlFor:"assistant-name",children:"Name"}),r.jsx(ot,{id:"assistant-name",value:y.name,onChange:U=>_({...y,name:U.target.value}),placeholder:"Assistant's full name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"assistant-email",children:"Email"}),r.jsx(ot,{id:"assistant-email",type:"email",value:y.email,onChange:U=>_({...y,email:U.target.value}),placeholder:"assistant@email.com"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"assistant-password",children:"Temporary Password"}),r.jsx(ot,{id:"assistant-password",type:"password",value:y.password,onChange:U=>_({...y,password:U.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(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(te,{onClick:A,disabled:w,children:[w&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(pu,{open:i,onOpenChange:u,children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Remove Assistant?"}),r.jsxs(Zd,{children:["This will remove ",(R=p==null?void 0:p.assistant_profile)==null?void 0:R.name,"'s access to your Agent OS. Their account will remain active but they won't be able to manage your data."]})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}function Bd(t){this.content=t}Bd.prototype={constructor:Bd,find:function(t){for(var e=0;e>1}};Bd.from=function(t){if(t instanceof Bd)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Bd(e)};function ZDe(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=ZDe(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function YDe(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),u=l.nodeSize;if(l==i){n-=u,s-=u;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(u,a+i,o||null,l)!==!1&&u.content.size){let x=i+1;u.nodesBetween(Math.max(0,e-x),Math.min(u.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,u)=>{let p=i.isText?i.text.slice(Math.max(e,u)-u,n-u):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=u}return new ln(s,a)}cutByIndex(e,n){return e==n?ln.empty:e==0&&n==this.content.length?this:new ln(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 ln(a,o)}addToStart(e){return new ln([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ln(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?RL(n+1,o):RL(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 ln.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ln(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ln.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}};zo.none=[];class Rte extends Error{}class Hn{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=QDe(this.content,e+this.openStart,n);return s&&new Hn(s,this.openStart,this.openEnd)}removeBetween(e,n){return new Hn(XDe(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 Hn.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 Hn(ln.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 Hn(e,s,a)}}Hn.empty=new Hn(ln.empty,0,0);function XDe(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(XDe(o.content,e-a-1,n-a-1)))}function QDe(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=QDe(l.content,e-o-1,n,l);return i&&t.replaceChild(a,l.copy(i))}function zmt(t,e,n){if(n.openStart>t.depth)throw new Rte("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Rte("Inconsistent open depths");return JDe(t,e,n,0)}function JDe(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 kA(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&&(Lj(t.nodeAfter,s),o++));for(let i=o;ia&&Whe(t,e,a+1),l=s.depth>a&&Whe(n,s,a+1),i=[];return kA(null,t,a,i),o&&l&&e.index(a)==n.index(a)?(eRe(o,l),Lj(Oj(o,tRe(t,e,n,s,a+1)),i)):(o&&Lj(Oj(o,Fte(t,e,a+1)),i),kA(e,n,a,i),l&&Lj(Oj(l,Fte(n,s,a+1)),i)),kA(s,null,a,i),new ln(i)}function Fte(t,e,n){let s=[];if(kA(null,t,n,s),t.depth>n){let a=Whe(t,e,n+1);Lj(Oj(a,Fte(t,e,n+1)),s)}return kA(e,null,n,s),new ln(s)}function Bmt(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(ln.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class _E{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 zte(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:u}=l.content.findIndex(o),p=o-u;if(s.push(l,i,a+u),!p||(l=l.child(i),l.isText))break;o=p-1,a+=u+1}return new _E(n,s,o)}static resolveCached(e,n){let s=Xke.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()+")"),rRe(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=ln.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 u=a;un.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=ln.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};W1.prototype.text=void 0;class Bte extends W1{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):rRe(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 Bte(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Bte(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 rRe(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class tk{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let s=new Vmt(e,n);if(s.next==null)return tk.empty;let a=nRe(s);s.next&&s.err("Unexpected trailing text");let o=Xmt(Ymt(a));return Qmt(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(` `)}}tk.empty=new tk(!0);class Vmt{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 nRe(t){let e=[];do e.push(Hmt(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Hmt(t){let e=[];do e.push(Wmt(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wmt(t){let e=Zmt(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=Gmt(t,e);else break;return e}function Qke(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Gmt(t,e){let n=Qke(t),s=n;return t.eat(",")&&(t.next!="}"?s=Qke(t):s=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:e}}function Kmt(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 Zmt(t){if(t.eat("(")){let e=nRe(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=Kmt(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 Ymt(t){let e=[[]];return a(o(t,0),n()),e;function n(){return e.push([])-1}function s(l,i,u){let p={term:u,to:i};return e[l].push(p),p}function a(l,i){l.forEach(u=>u.to=i)}function o(l,i){if(l.type=="choice")return l.exprs.reduce((u,p)=>u.concat(o(p,i)),[]);if(l.type=="seq")for(let u=0;;u++){let p=o(l.exprs[u],i);if(u==l.exprs.length-1)return p;a(p,i=n())}else if(l.type=="star"){let u=n();return s(i,u),a(o(l.expr,u),u),[s(u)]}else if(l.type=="plus"){let u=n();return a(o(l.expr,i),u),a(o(l.expr,u),u),[s(u)]}else{if(l.type=="opt")return[s(i)].concat(o(l.expr,i));if(l.type=="range"){let u=i;for(let p=0;p{t[l].forEach(({term:i,to:u})=>{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 tk(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:iRe(this.attrs,e)}create(e=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new W1(this,this.computeAttrs(e),ln.from(n),zo.setFrom(s))}createChecked(e=null,n,s){return n=ln.from(n),this.checkContent(n),new W1(this,this.computeAttrs(e),n,zo.setFrom(s))}createAndFill(e=null,n,s){if(e=this.computeAttrs(e),n=ln.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(ln.empty,!0);return o?new W1(this,e,n.append(o),zo.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 cRe(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 Jmt(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 egt{constructor(e,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Jmt(e,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class $se{constructor(e,n,s,a){this.name=e,this.rank=n,this.schema=s,this.spec=a,this.attrs=lRe(e,a.attrs),this.excluded=null;let o=aRe(this.attrs);this.instance=o?new zo(this,o):null}create(e=null){return!e&&this.instance?this.instance:new zo(this,iRe(this.attrs,e))}static compile(e,n){let s=Object.create(null),a=0;return e.forEach((o,l)=>s[o]=new $se(o,a++,n,l)),s}removeFromSet(e){for(var n=0;n-1}}class dRe{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=Bd.from(e.nodes),n.marks=Bd.from(e.marks||{}),this.nodes=eNe.compile(this.spec.nodes,this),this.marks=$se.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]=tk.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?tNe(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==""?[]:tNe(this,l.split(" "))}this.nodeFromJSON=a=>W1.fromJSON(this,a),this.markFromJSON=a=>zo.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 eNe){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 Bte(s,s.defaultAttrs,e,zo.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 tNe(t,e){let n=[];for(let s=0;s-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return n}function tgt(t){return t.tag!=null}function rgt(t){return t.style!=null}let NA=class Khe{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(tgt(a))this.tags.push(a);else if(rgt(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 nNe(this,n,!1);return s.addAll(e,zo.none,n.from,n.to),s.finish()}parseSlice(e,n={}){let s=new nNe(this,n,!0);return s.addAll(e,zo.none,n.from,n.to),Hn.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 u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||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=sNe(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=sNe(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Khe(e,Khe.schemaRules(e)))}};const uRe={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},ngt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hRe={ol:!0,ul:!0},bE=1,Zhe=2,SA=4;function rNe(t,e,n){return e!=null?(e?bE:0)|(e==="full"?Zhe:0):t&&t.whitespace=="pre"?bE|Zhe:n&~SA}class FL{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=zo.none,this.match=o||(l&SA?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ln.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&bE)){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=ln.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ln.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&&!uRe.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class nNe{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=rNe(null,n.preserveWhitespace,0)|(s?SA:0);a?o=new FL(a.type,a.attrs,zo.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new FL(null,null,zo.none,!0,null,l):o=new FL(e.schema.topNodeType,null,zo.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&Zhe?"full":this.localPreserveWS||(a.options&bE)>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 u=0;u!u.clearMark(p)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)i=u;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 u=this.enter(l,n.attrs||null,s,n.preserveWhitespace);u&&(o=!0,s=u)}else{let u=this.parser.schema.marks[n.mark];s=s.concat(u.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(u=>this.insertNode(u,s,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,s),this.findAround(e,u,!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 u=this.nodes[l],p=u.findWrapping(e);if(p&&(!a||a.length>p.length+i)&&(a=p,o=u,!p.length))break;if(u.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):aNe(p.type,e))?(u=p.addToSet(u),!1):!0),this.nodes.push(new FL(e,n,u,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|=bE)}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,u)=>{for(;i>=0;i--){let p=n[i];if(p==""){if(i==n.length-1||i==0)continue;for(;u>=o;u--)if(l(i-1,u))return!0;return!1}else{let x=u>0||u==0&&a?this.nodes[u].type:s&&u>=o?s.node(u-o).type:null;if(!x||x.name!=p&&!x.isInGroup(p))return!1;u--}}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 sgt(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&hRe.hasOwnProperty(s)&&n?(n.appendChild(e),e=n):s=="li"?n=e:s&&(n=null)}}function agt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function sNe(t){let e={};for(let n in t)e[n]=t[n];return e}function aNe(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 u=0;u{if(o.length||l.marks.length){let i=0,u=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&&wee(xce(s),a(e,n),null,e.attrs)}static renderSpec(e,n,s=null,a){return wee(e,n,s,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new _k(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=iNe(e.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(e){return iNe(e.marks)}}function iNe(t){let e={};for(let n in t){let s=t[n].spec.toDOM;s&&(e[n]=s)}return e}function xce(t){return t.document||window.document}const oNe=new WeakMap;function igt(t){let e=oNe.get(t);return e===void 0&&oNe.set(t,e=ogt(t)),e}function ogt(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,u=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?u.setAttributeNS(y.slice(0,_),y.slice(_+1),p[y]):y=="style"&&u.style?u.style.cssText=p[y]:u.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:u,contentDOM:u}}else{let{dom:w,contentDOM:S}=wee(t,_,n,s);if(u.appendChild(w),S){if(i)throw new RangeError("Multiple content holes");i=S}}}return{dom:u,contentDOM:i}}const fRe=65535,pRe=Math.pow(2,16);function lgt(t,e){return t+e*pRe}function lNe(t){return t&fRe}function cgt(t){return(t-(t&fRe))/pRe}const mRe=1,gRe=2,jee=4,xRe=8;class Yhe{constructor(e,n,s){this.pos=e,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&xRe)>0}get deletedBefore(){return(this.delInfo&(mRe|jee))>0}get deletedAfter(){return(this.delInfo&(gRe|jee))>0}get deletedAcross(){return(this.delInfo&jee)>0}}class tf{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&tf.empty)return tf.empty}recover(e){let n=0,s=lNe(e);if(!this.inverted)for(let a=0;ae)break;let p=this.ranges[i+o],x=this.ranges[i+l],y=u+p;if(e<=y){let _=p?e==u?-1:e==y?1:n:n,w=u+a+(_<0?0:x);if(s)return w;let S=e==(n<0?u:y)?null:lgt(i/3,e-u),N=e==u?gRe:e==y?mRe:jee;return(n<0?e!=u:e!=y)&&(N|=xRe),new Yhe(w,N,S)}a+=x-p}return s?e+a:new Yhe(e+a,0,null)}touches(e,n){let s=0,a=lNe(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let i=0;ie)break;let p=this.ranges[i+o],x=u+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 wE;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let s=this.from;so&&u!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),n.openStart,n.openEnd);return Dc.fromReplace(e,this.from,this.to,o)}invert(){return new yg(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 m1(n.pos,s.pos,this.mark)}merge(e){return e instanceof m1&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new m1(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 m1(n.from,n.to,e.markFromJSON(n.mark))}}_u.jsonID("addMark",m1);class yg extends _u{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 Hn(Kxe(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Dc.fromReplace(e,this.from,this.to,s)}invert(){return new m1(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 yg(n.pos,s.pos,this.mark)}merge(e){return e instanceof yg&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yg(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 yg(n.from,n.to,e.markFromJSON(n.mark))}}_u.jsonID("removeMark",yg);class g1 extends _u{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Dc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Dc.fromReplace(e,this.pos,this.pos+1,new Hn(ln.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 Nd(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 Nd(n.from,n.to,n.gapFrom,n.gapTo,Hn.fromJSON(e,n.slice),n.insert,!!n.structure)}}_u.jsonID("replaceAround",Nd);function Xhe(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 dgt(t,e,n,s){let a=[],o=[],l,i;t.doc.nodesBetween(e,n,(u,p,x)=>{if(!u.isInline)return;let y=u.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let _=Math.max(p,e),w=Math.min(p+u.nodeSize,n),S=s.addToSet(y);for(let N=0;Nt.step(u)),o.forEach(u=>t.step(u))}function ugt(t,e,n,s){let a=[],o=0;t.doc.nodesBetween(e,n,(l,i)=>{if(!l.isInline)return;o++;let u=null;if(s instanceof $se){let p=l.marks,x;for(;x=s.isInSet(p);)(u||(u=[])).push(x),p=x.removeFromSet(p)}else s?s.isInSet(l.marks)&&(u=[s]):u=l.marks;if(u&&u.length){let p=Math.min(i+l.nodeSize,n);for(let x=0;xt.step(new yg(l.from,l.to,l.style)))}function Zxe(t,e,n,s=n.contentMatch,a=!0){let o=t.doc.nodeAt(e),l=[],i=e+1;for(let u=0;u=0;u--)t.step(l[u])}function hgt(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function w3(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,u=t.$to.indexAfter(s)-o;if(sn;S--)N||s.index(S)>0?(N=!0,x=ln.from(s.node(S).copy(x)),y++):u--;let _=ln.empty,w=0;for(let S=o,N=!1;S>n;S--)N||a.after(S+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=ln.from(n[l].type.create(n[l].attrs,s))}let a=e.start,o=e.end;t.step(new Nd(a,o,a,o,new Hn(s,0,0),n.length,!0))}function xgt(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 u=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(s,u)&&ygt(t.doc,t.mapping.slice(o).map(i),s)){let p=null;if(s.schema.linebreakReplacement){let w=s.whitespace=="pre",S=!!s.contentMatch.matchType(s.schema.linebreakReplacement);w&&!S?p=!1:!w&&S&&(p=!0)}p===!1&&vRe(t,l,i,o),Zxe(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 Nd(y,_,y+1,_-1,new Hn(ln.from(s.create(u,null,l.marks)),0,0),1,!0)),p===!0&&yRe(t,l,i,o),!1}})}function yRe(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 u=t.mapping.slice(s).map(n+1+o+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function vRe(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 ygt(t,e,n){let s=t.resolve(e),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function vgt(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 Nd(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new Hn(ln.from(l),0,0),1,!0))}function iy(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 w=y.content.cutByIndex(_,y.childCount),S=s&&s[x+1];S&&(w=w.replaceChild(0,S.type.create(S.attrs)));let N=s&&s[x]||y;if(!y.canReplace(_+1,y.childCount)||!N.type.validContent(w))return!1}let i=a.indexAfter(o),u=s&&s[0];return a.node(o).canReplaceWith(i,i,u?u.type:a.node(o+1).type)}function _gt(t,e,n=1,s){let a=t.doc.resolve(e),o=ln.empty,l=ln.empty;for(let i=a.depth,u=a.depth-n,p=n-1;i>u;i--,p--){o=ln.from(a.node(i).copy(o));let x=s&&s[p];l=ln.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}t.step(new gd(e,e,new Hn(o.append(l),n,n),!0))}function yv(t,e){let n=t.resolve(e),s=n.index();return _Re(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function bgt(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&&_Re(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 wgt(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);vRe(t,x.node(),x.before(),i)}l.inlineContent&&Zxe(t,e+n-1,l,o.node().contentMatchAt(o.index()),s==null);let u=t.mapping.slice(i),p=u.map(e-n);if(t.step(new gd(p,u.map(e+n,-1),Hn.empty,!0)),s===!0){let x=t.doc.resolve(p);yRe(t,x.node(),x.before(),t.steps.length)}return t}function jgt(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,u=s.index(l)+(i>0?1:0),p=s.node(l),x=!1;if(o==1)x=p.canReplace(u,u,a);else{let y=p.contentMatchAt(u).findWrapping(a.firstChild.type);x=y&&p.canReplaceWith(u,u,y[0])}if(x)return i==0?s.pos:i<0?s.before(l+1):s.after(l+1)}return null}function qse(t,e,n=e,s=Hn.empty){if(e==n&&!s.size)return null;let a=t.resolve(e),o=t.resolve(n);return wRe(a,o,s)?new gd(e,n,s):new kgt(a,o,s).fit()}function wRe(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class kgt{constructor(e,n,s){this.$from=e,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=ln.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=ln.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 u=new Hn(o,l,i);return e>-1?new Nd(s.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||s.pos!=this.$to.pos?new gd(s.pos,a.pos,u):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=vce(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:u,match:p}=this.frontier[i],x,y=null;if(n==1&&(l?p.matchType(l.type)||(y=p.fillBefore(ln.from(l),!1)):o&&u.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=vce(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Hn(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=vce(e,n);if(a.childCount<=1&&n>0){let o=e.size-n<=n+a.size;this.unplaced=new Hn(wT(e,n-1,1),n-1,o?n-1:s)}else this.unplaced=new Hn(wT(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||u==0||N.content.size)&&(y=M,x.push(jRe(N.mark(_.allowedMarks(N.marks)),p==1?u:0,p==i.childCount?w:-1)))}let S=p==i.childCount;S||(w=-1),this.placed=jT(this.placed,n,ln.from(x)),this.frontier[n].match=y,S&&w<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,M=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:u,type:p}=this.frontier[i],x=_ce(e,i,p,u,!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=jT(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=jT(this.placed,this.depth,ln.from(e.create(n,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ln.empty,!0);n.childCount&&(this.placed=jT(this.placed,this.frontier.length,n))}}function wT(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(wT(t.firstChild.content,e-1,n)))}function jT(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(jT(t.lastChild.content,e-1,n)))}function vce(t,e){for(let n=0;n1&&(s=s.replaceChild(0,jRe(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(ln.empty,!0)))),t.copy(s)}function _ce(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&&!Ngt(n,o.content,l)?i:null}function Ngt(t,e,n){for(let s=n;s0;_--,w--){let S=a.node(_).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;l.indexOf(_)>-1?i=_:a.before(_)==w&&l.splice(1,0,-_)}let u=l.indexOf(i),p=[],x=s.openStart;for(let _=s.content,w=0;;w++){let S=_.firstChild;if(p.push(S),w==s.openStart)break;_=S.content}for(let _=x-1;_>=0;_--){let w=p[_],S=Sgt(w.type);if(S&&!w.sameMarkup(a.node(Math.abs(i)-1)))x=_;else if(S||!w.type.isTextblock)break}for(let _=s.openStart;_>=0;_--){let w=(_+x+1)%(s.openStart+1),S=p[w];if(S)for(let N=0;N=0&&(t.replace(e,n,s),!(t.steps.length>y));_--){let w=l[_];w<0||(e=a.before(w),n=o.after(w))}}function kRe(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(ln.empty,!0))}return t}function Mgt(t,e,n,s){if(!s.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=jgt(t.doc,e,s.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Hn(ln.from(s),0,0))}function Tgt(t,e,n){let s=t.doc.resolve(e),a=t.doc.resolve(n),o=NRe(s,a);for(let l=0;l0&&(u||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 NRe(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 US extends _u{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 Dc.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 Dc.fromReplace(e,this.pos,this.pos+1,new Hn(ln.from(a),0,n.isLeaf?0:1))}getMap(){return tf.empty}invert(e){return new US(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 US(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 US(n.pos,n.attr,n.value)}}_u.jsonID("attr",US);class jE extends _u{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 Dc.ok(s)}getMap(){return tf.empty}invert(e){return new jE(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 jE(n.attr,n.value)}}_u.jsonID("docAttr",jE);let SC=class extends Error{};SC=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};SC.prototype=Object.create(Error.prototype);SC.prototype.constructor=SC;SC.prototype.name="TransformError";class Xxe{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wE}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new SC(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=Hn.empty){let a=qse(this.doc,e,n,s);return a&&this.step(a),this}replaceWith(e,n,s){return this.replace(e,n,new Hn(ln.from(s),0,0))}delete(e,n){return this.replace(e,n,Hn.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,s){return Cgt(this,e,n,s),this}replaceRangeWith(e,n,s){return Mgt(this,e,n,s),this}deleteRange(e,n){return Tgt(this,e,n),this}lift(e,n){return fgt(this,e,n),this}join(e,n=1){return wgt(this,e,n),this}wrap(e,n){return ggt(this,e,n),this}setBlockType(e,n=e,s,a=null){return xgt(this,e,n,s,a),this}setNodeMarkup(e,n,s=null,a){return vgt(this,e,n,s,a),this}setNodeAttribute(e,n,s){return this.step(new US(e,n,s)),this}setDocAttribute(e,n){return this.step(new jE(e,n)),this}addNodeMark(e,n){return this.step(new g1(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 zo)n.isInSet(s.marks)&&this.step(new rk(e,n));else{let a=s.marks,o,l=[];for(;o=n.isInSet(a);)l.push(new rk(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 _gt(this,e,n,s),this}addMark(e,n,s){return dgt(this,e,n,s),this}removeMark(e,n,s){return ugt(this,e,n,s),this}clearIncompatible(e,n,s){return Zxe(this,e,n,s),this}}const bce=Object.create(null);class Sa{constructor(e,n,s){this.$anchor=e,this.$head=n,this.ranges=s||[new SRe(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?I4(e.node(0),e.node(o),e.before(o+1),e.index(o),n,s):I4(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 pf(e.node(0))}static atStart(e){return I4(e,e,0,0,1)||new pf(e)}static atEnd(e){return I4(e,e,e.content.size,e.childCount,-1)||new pf(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=bce[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 bce)throw new RangeError("Duplicate use of selection JSON ID "+e);return bce[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ha.between(this.$anchor,this.$head).getBookmark()}}Sa.prototype.visible=!0;class SRe{constructor(e,n){this.$from=e,this.$to=n}}let dNe=!1;function uNe(t){!dNe&&!t.parent.inlineContent&&(dNe=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ha extends Sa{constructor(e,n=e){uNe(e),uNe(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 Sa.near(s);let a=e.resolve(n.map(this.anchor));return new ha(a.parent.inlineContent?a:s,s)}replace(e,n=Hn.empty){if(super.replace(e,n),n==Hn.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof ha&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vse(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 ha(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=Sa.findFrom(n,s,!0)||Sa.findFrom(n,-s,!0);if(o)n=o.$head;else return Sa.near(n,s)}return e.parent.inlineContent||(a==0?e=n:(e=(Sa.findFrom(e,-s,!0)||Sa.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 u=I4(t,i,n+a,a<0?i.childCount:0,a,o);if(u)return u}n+=i.nodeSize*a}return null}function hNe(t,e,n){let s=t.steps.length-1;if(s{l==null&&(l=x)}),t.setSelection(Sa.near(t.doc.resolve(l),n))}const fNe=1,zL=2,pNe=4;class Egt extends Xxe{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|=zL,this}ensureMarks(e){return zo.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&zL)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~zL,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)||zo.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(Sa.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|=pNe,this}get scrolledIntoView(){return(this.updated&pNe)>0}}function mNe(t,e){return!e||!t?t:t.bind(e)}class kT{constructor(e,n,s){this.name=e,this.init=mNe(n.init,s),this.apply=mNe(n.apply,s)}}const Igt=[new kT("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new kT("selection",{init(t,e){return t.selection||Sa.atStart(e.doc)},apply(t){return t.selection}}),new kT("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,s){return s.selection.$cursor?t.storedMarks:null}}),new kT("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class wce{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Igt.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 kT(s.key,s.spec.state,s))})}}class G4{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 wce(e.schema,e.plugins),o=new G4(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=W1.fromJSON(e.schema,n.doc);else if(l.name=="selection")o.selection=Sa.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 u=s[i],p=u.spec.state;if(u.key==l.name&&p&&p.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){o[l.name]=p.fromJSON.call(u,e,n[i],o);return}}o[l.name]=l.init(e,o)}}),o}}function CRe(t,e,n){for(let s in t){let a=t[s];a instanceof Function?a=a.bind(e):s=="handleDOMEvents"&&(a=CRe(a,e,{})),n[s]=a}return n}class nd{constructor(e){this.spec=e,this.props={},e.props&&CRe(e.props,this,this.props),this.key=e.key?e.key.key:MRe("plugin")}getState(e){return e[this.key]}}const jce=Object.create(null);function MRe(t){return t in jce?t+"$"+ ++jce[t]:(jce[t]=0,t+"$")}class bu{constructor(e="key"){this.key=MRe(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qd=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},CC=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Qhe=null;const Px=function(t,e,n){let s=Qhe||(Qhe=document.createRange());return s.setEnd(t,n??t.nodeValue.length),s.setStart(t,e||0),s},Pgt=function(){Qhe=null},nk=function(t,e,n,s){return n&&(gNe(t,e,n,s,-1)||gNe(t,e,n,s,1))},Lgt=/^(img|br|input|textarea|hr)$/i;function gNe(t,e,n,s,a){for(var o;;){if(t==n&&e==s)return!0;if(e==(a<0?0:Zf(t))){let l=t.parentNode;if(!l||l.nodeType!=1||qI(t)||Lgt.test(t.nodeName)||t.contentEditable=="false")return!1;e=qd(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?Zf(t):0}else return!1}}function Zf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ogt(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=Zf(t)}else if(t.parentNode&&!qI(t))e=qd(t),t=t.parentNode;else return null}}function Dgt(t,e){for(;;){if(t.nodeType==3&&e2),Vf=MC||($g?/Mac/.test($g.platform):!1),ERe=$g?/Win/.test($g.platform):!1,Wx=/Android \d/.test(vv),VI=!!xNe&&"webkitFontSmoothing"in xNe.documentElement.style,Bgt=VI?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $gt(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 jx(t,e){return typeof t=="number"?t:t[e]}function Ugt(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 yNe(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=CC(l);continue}let i=l,u=i==o.body,p=u?$gt(o):Ugt(i),x=0,y=0;if(e.topp.bottom-jx(s,"bottom")&&(y=e.bottom-e.top>p.bottom-p.top?e.top+jx(a,"top")-p.top:e.bottom-p.bottom+jx(a,"bottom")),e.leftp.right-jx(s,"right")&&(x=e.right-p.right+jx(a,"right")),x||y)if(u)o.defaultView.scrollBy(x,y);else{let w=i.scrollLeft,S=i.scrollTop;y&&(i.scrollTop+=y),x&&(i.scrollLeft+=x);let N=i.scrollLeft-w,M=i.scrollTop-S;e={left:e.left-N,top:e.top-M,right:e.right-N,bottom:e.bottom-M}}let _=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(_))break;l=_=="absolute"?l.offsetParent:CC(l)}}function qgt(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=u.top;break}}return{refDOM:s,refTop:a,stack:IRe(t.dom)}}function IRe(t){let e=[],n=t.ownerDocument;for(let s=t;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),t!=n);s=CC(s));return e}function Vgt({refDOM:t,refTop:e,stack:n}){let s=t?t.getBoundingClientRect().top:0;PRe(n,s==0?0:s-e)}function PRe(t,e){for(let n=0;n=i){l=Math.max(S.bottom,l),i=Math.min(S.top,i);let N=S.left>e.left?S.left-e.left:S.right=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!u&&S.left<=e.left&&S.right>=e.left&&(u=x,p={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(o=y+1)}}return!n&&u&&(n=u,a=p,s=0),n&&n.nodeType==3?Wgt(n,a):!n||s&&n.nodeType==1?{node:t,offset:o}:LRe(n,a)}function Wgt(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 Jxe(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ggt(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 Zgt(t,e,n,s){let a=-1;for(let o=e,l=!1;o!=t.dom;){let i=t.docView.nearestDesc(o,!0),u;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((u=i.dom.getBoundingClientRect()).width||u.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!l&&u.left>s.left||u.top>s.top?a=i.posBefore:(!l&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function ORe(t,e,n){let s=t.childNodes.length;if(s&&n.tope.top&&a++}let p;VI&&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=Zgt(t,s,a,e))}i==null&&(i=Kgt(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}function vNe(t){return t.top=0&&a==s.nodeValue.length?(u--,x=1):n<0?u--:p++,QM(E0(Px(s,u,p),x),x<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==Zf(s))){let u=s.childNodes[a-1];if(u.nodeType==1)return kce(u.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(n<0||a==Zf(s))){let u=s.childNodes[a-1],p=u.nodeType==3?Px(u,Zf(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(p)return QM(E0(p,1),!1)}if(o==null&&a=0)}function QM(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 kce(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 RRe(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 Qgt(t,e,n){let s=e.selection,a=n=="up"?s.$from:s.$to;return RRe(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=DRe(t,a.pos,1);for(let i=o.firstChild;i;i=i.nextSibling){let u;if(i.nodeType==1)u=i.getClientRects();else if(i.nodeType==3)u=Px(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 Jgt=/[\u0590-\u08ac]/;function ext(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?!Jgt.test(s.parent.textContent)||!i.modify?n=="left"||n=="backward"?o:l:RRe(t,e,()=>{let{focusNode:u,focusOffset:p,anchorNode:x,anchorOffset:y}=t.domSelectionRange(),_=i.caretBidiLevel;i.modify("move",n,"character");let w=s.depth?t.docView.domAfterPos(s.before()):t.dom,{focusNode:S,focusOffset:N}=t.domSelectionRange(),M=S&&!w.contains(S.nodeType==1?S:S.parentNode)||u==S&&p==N;try{i.collapse(x,y),u&&(u!=x||p!=y)&&i.extend&&i.extend(u,p)}catch{}return _!=null&&(i.caretBidiLevel=_),M}):s.pos==s.start()||s.pos==s.end()}let _Ne=null,bNe=null,wNe=!1;function txt(t,e,n){return _Ne==e&&bNe==n?wNe:(_Ne=e,bNe=n,wNe=n=="up"||n=="down"?Qgt(t,e,n):ext(t,e,n))}const lp=0,jNe=1,Xw=2,Ug=3;class HI{constructor(e,n,s,a){this.parent=e,this.children=n,this.dom=s,this.contentDOM=a,this.dirty=lp,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;nqd(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 zRe){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 FRe&&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?qd(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=p-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.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=qd(_.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;xS&&ln){let S=i;i=u,u=S}let w=document.createRange();w.setEnd(u.node,u.offset),w.setStart(i.node,i.offset),p.removeAllRanges(),p.addRange(w)}}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,u=l-o.border;if(e>=i&&n<=u){this.dirty=e==s||n==l?Xw:jNe,e==i&&n==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ug:o.markDirty(e-i,n-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Xw:Ug}s=l}this.dirty=Xw}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let s=e==1?Xw:jNe;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==lp&&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 rxt extends HI{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 sk extends HI{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=_k.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new sk(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Ug||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ug&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=lp){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=nfe(o,0,e,s));for(let i=0;i{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},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}=_k.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=URe(x,s,n),p?u=new nxt(e,n,s,a,x,y||null,_,p,o,l+1):n.isText?new Wse(e,n,s,a,x,_,o):new K1(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=()=>ln.empty)}return e}matchesNode(e,n,s){return this.dirty==lp&&e.eq(this.node)&&$te(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,u=new axt(this,l&&l.node,e);lxt(this.node,this.innerDeco,(p,x,y)=>{p.spec.marks?u.syncToMarks(p.spec.marks,s,e):p.type.side>=0&&!y&&u.syncToMarks(x==this.node.childCount?zo.none:this.node.child(x).marks,s,e),u.placeWidget(p,e,a)},(p,x,y,_)=>{u.syncToMarks(p.marks,s,e);let w;u.findNodeMatch(p,x,y,_)||i&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(p,x,y,w,e)||u.updateNextNode(p,x,y,e,_,a)||u.addNode(p,x,y,e,a),a+=p.nodeSize}),u.syncToMarks([],s,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Xw)&&(l&&this.protectLocalComposition(e,l),BRe(this.contentDOM,this.children,e),MC&&cxt(this.dom))}localCompositionInfo(e,n){let{from:s,to:a}=e.state.selection;if(!(e.state.selection instanceof ha)||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=dxt(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 rxt(this,o,n,a);e.input.compositionNodes.push(l),this.children=nfe(this.children,s,s+a.length,e,l)}update(e,n,s,a){return this.dirty==Ug||!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=lp}updateOuterDeco(e){if($te(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=$Re(this.dom,this.nodeDOM,rfe(this.outerDeco,this.node,n),rfe(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 kNe(t,e,n,s,a){URe(s,e,t);let o=new K1(void 0,t,e,n,s,s,s,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class Wse extends K1{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==Ug||this.dirty!=lp&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=lp||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=lp,!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 Wse(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=Ug)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zRe extends HI{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==lp&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class nxt extends K1{constructor(e,n,s,a,o,l,i,u,p,x){super(e,n,s,a,o,l,i,p,x),this.spec=u}update(e,n,s,a){if(this.dirty==Ug)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 BRe(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 u=sk.create(this.top,e[o],n,s);this.top.children.splice(this.index,0,u),this.top=u,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,u=Math.min(this.top.children.length,i+5);i0;){let i;for(;;)if(s){let p=n.children[s-1];if(p instanceof sk)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 u=i.node;if(u){if(u!=t.child(a-1))break;--a,o.set(i,a),l.push(i)}}return{index:a,matched:o,matches:l.reverse()}}function oxt(t,e){return t.type.side-e.type.side}function lxt(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 S=o+_.nodeSize;if(_.isText){let M=S;l!M.inline):i.slice();s(_,N,e.forChild(o,_),w),o=S}}function cxt(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 dxt(t,e,n,s){for(let a=0,o=0;a=n){if(o>=s&&u.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&&u.length>=s+e.length-i&&u.slice(s-i,s-i+e.length)==e)return s}}return-1}function nfe(t,e,n,s,a){let o=[];for(let l=0,i=0;l=n||x<=e?o.push(u):(pn&&o.push(u.slice(n-p,u.size,s)))}return o}function eye(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),u,p;if(Hse(n)){for(u=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&aa.isSelectable(y)&&a.parent&&!(y.isInline&&Rgt(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 w=0;w{(n.anchorNode!=s||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!qRe(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function hxt(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,s=n.nodeName=="IMG";s?e.collapse(n.parentNode,qd(n)+1):e.collapse(n,0),!s&&!t.state.selection.visible&&Ch&&G1<=11&&(n.disabled=!0,n.disabled=!1)}function VRe(t,e){if(e instanceof aa){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(TNe(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else TNe(t)}function TNe(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function tye(t,e,n,s){return t.someProp("createSelectionBetween",a=>a(t,e,n))||ha.between(e,n,s)}function ANe(t){return t.editable&&!t.hasFocus()?!1:HRe(t)}function HRe(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 fxt(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return nk(e.node,e.offset,n.anchorNode,n.anchorOffset)}function sfe(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&&Sa.findFrom(o,e)}function $0(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ENe(t,e,n){let s=t.state.selection;if(s instanceof ha)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 $0(t,new ha(s.$anchor,l))}else if(s.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=sfe(t.state,e);return a&&a instanceof aa?$0(t,a):!1}else if(!(Vf&&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)?$0(t,new aa(e<0?t.state.doc.resolve(a.pos-o.nodeSize):a)):VI?$0(t,new ha(t.state.doc.resolve(e<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof aa&&s.node.isInline)return $0(t,new ha(e>0?s.$to:s.$from));{let a=sfe(t.state,e);return a?$0(t,a):!1}}}function Ute(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 _4(t,e){return e<0?pxt(t):mxt(t)}function pxt(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a,o,l=!1;for(op&&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(WRe(n))break;{let i=n.previousSibling;for(;i&&MA(i,-1);)a=n.parentNode,o=qd(i),i=i.previousSibling;if(i)n=i,s=Ute(n);else{if(n=n.parentNode,n==t.dom)break;s=0}}}l?afe(t,n,s):a&&afe(t,a,o)}function mxt(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a=Ute(n),o,l;for(;;)if(s{t.state==a&&oy(t)},50)}function INe(t,e){let n=t.state.doc.resolve(e);if(!(vd||ERe)&&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 ha&&!s.empty||n.indexOf("s")>-1||Vf&&n.indexOf("m")>-1)return!1;let{$from:a,$to:o}=s;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=sfe(t.state,e);if(l&&l instanceof aa)return $0(t,l)}if(!a.parent.inlineContent){let l=e<0?a:o,i=s instanceof pf?Sa.near(l,e):Sa.findFrom(l,e);return i?$0(t,i):!1}return!1}function LNe(t,e){if(!(t.state.selection instanceof ha))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 ONe(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function yxt(t){if(!yu||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;ONe(t,s,"true"),setTimeout(()=>ONe(t,s,"false"),20)}return!1}function vxt(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function _xt(t,e){let n=e.keyCode,s=vxt(e);if(n==8||Vf&&n==72&&s=="c")return LNe(t,-1)||_4(t,-1);if(n==46&&!e.shiftKey||Vf&&n==68&&s=="c")return LNe(t,1)||_4(t,1);if(n==13||n==27)return!0;if(n==37||Vf&&n==66&&s=="c"){let a=n==37?INe(t,t.state.selection.from)=="ltr"?-1:1:-1;return ENe(t,a,s)||_4(t,a)}else if(n==39||Vf&&n==70&&s=="c"){let a=n==39?INe(t,t.state.selection.from)=="ltr"?1:-1:1;return ENe(t,a,s)||_4(t,a)}else{if(n==38||Vf&&n==80&&s=="c")return PNe(t,-1,s)||_4(t,-1);if(n==40||Vf&&n==78&&s=="c")return yxt(t)||PNe(t,1,s)||_4(t,1);if(s==(Vf?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function rye(t,e){t.someProp("transformCopied",w=>{e=w(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 w=s.firstChild;n.push(w.type.name,w.attrs!=w.type.defaultAttrs?w.attrs:null),s=w.content}let l=t.someProp("clipboardSerializer")||_k.fromSchema(t.state.schema),i=QRe(),u=i.createElement("div");u.appendChild(l.serializeFragment(s,{document:i}));let p=u.firstChild,x,y=0;for(;p&&p.nodeType==1&&(x=XRe[p.nodeName.toLowerCase()]);){for(let w=x.length-1;w>=0;w--){let S=i.createElement(x[w]);for(;u.firstChild;)S.appendChild(u.firstChild);u.appendChild(S),y++}p=u.firstChild}p&&p.nodeType==1&&p.setAttribute("data-pm-slice",`${a} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let _=t.someProp("clipboardTextSerializer",w=>w(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:u,text:_,slice:e}}function GRe(t,e,n,s,a){let o=a.parent.type.spec.code,l,i;if(!n&&!e)return null;let u=!!e&&(s||o||!n);if(u){if(t.someProp("transformPastedText",_=>{e=_(e,o||s,t)}),o)return i=new Hn(ln.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:w}=t.state,S=_k.fromSchema(w);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let M=l.appendChild(document.createElement("p"));N&&M.appendChild(S.serializeNode(w.text(N,_)))})}}else t.someProp("transformPastedHTML",y=>{n=y(n,t)}),l=kxt(n),VI&&Nxt(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")||NA.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||x),context:a,ruleFromNode(_){return _.nodeName=="BR"&&!_.nextSibling&&_.parentNode&&!bxt.test(_.parentNode.nodeName)?{ignore:!0}:null}})),x)i=Sxt(DNe(i,+x[1],+x[2]),x[4]);else if(i=Hn.maxOpen(wxt(i.content,a),!0),i.openStart||i.openEnd){let y=0,_=0;for(let w=i.content.firstChild;y{i=y(i,t,u)}),i}const bxt=/^(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 wxt(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 u=a.findWrapping(i.type),p;if(!u)return l=null;if(p=l.length&&o.length&&ZRe(u,o,i,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=YRe(l[l.length-1],o.length));let x=KRe(i,u);l.push(x),a=a.matchType(x.type),o=u}}),l)return ln.from(l)}return t}function KRe(t,e,n=0){for(let s=e.length-1;s>=n;s--)t=e[s].create(null,ln.from(t));return t}function ZRe(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(ln.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(i))}function DNe(t,e,n){return en})),Sce.createHTML(t)):t}function kxt(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=QRe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(t),a;if((a=s&&XRe[s[1].toLowerCase()])&&(t=a.map(o=>"<"+o+">").join("")+t+a.map(o=>"").reverse().join("")),n.innerHTML=jxt(t),a)for(let o=0;o=0;i-=2){let u=n.nodes[s[i]];if(!u||u.hasRequiredAttrs())break;a=ln.from(u.create(s[i+1],a)),o++,l++}return new Hn(a,o,l)}const Zu={},Yu={},Cxt={touchstart:!0,touchmove:!0};class Mxt{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 Txt(t){for(let e in Zu){let n=Zu[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=s=>{Ext(t,s)&&!nye(t,s)&&(t.editable||!(s.type in Yu))&&n(t,s)},Cxt[e]?{passive:!0}:void 0)}yu&&t.dom.addEventListener("input",()=>null),ofe(t)}function x1(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Axt(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 ofe(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=s=>nye(t,s))})}function nye(t,e){return t.someProp("handleDOMEvents",n=>{let s=n[e.type];return s?s(t,e)||e.defaultPrevented:!1})}function Ext(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 Ixt(t,e){!nye(t,e)&&Zu[e.type]&&(t.editable||!(e.type in Yu))&&Zu[e.type](t,e)}Yu.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!eFe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Wx&&vd&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),MC&&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,Uw(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",s=>s(t,n))||_xt(t,n)?n.preventDefault():x1(t,"key")};Yu.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Yu.keypress=(t,e)=>{let n=e;if(eFe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vf&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let s=t.state.selection;if(!(s instanceof ha)||!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 Gse(t){return{left:t.clientX,top:t.clientY}}function Pxt(t,e){let n=e.x-t.clientX,s=e.y-t.clientY;return n*n+s*s<100}function sye(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 qS(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 Lxt(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),s=n.nodeAfter;return s&&s.isAtom&&aa.isSelectable(s)?(qS(t,new aa(n)),!0):!1}function Oxt(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?(qS(t,aa.create(t.state.doc,a)),!0):!1}function Dxt(t,e,n,s,a){return sye(t,"handleClickOn",e,n,s)||t.someProp("handleClick",o=>o(t,e,s))||(a?Oxt(t,n):Lxt(t,n))}function Rxt(t,e,n,s){return sye(t,"handleDoubleClickOn",e,n,s)||t.someProp("handleDoubleClick",a=>a(t,e,s))}function Fxt(t,e,n,s){return sye(t,"handleTripleClickOn",e,n,s)||t.someProp("handleTripleClick",a=>a(t,e,s))||zxt(t,n,s)}function zxt(t,e,n){if(n.button!=0)return!1;let s=t.state.doc;if(e==-1)return s.inlineContent?(qS(t,ha.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)qS(t,ha.create(s,i+1,i+1+l.content.size));else if(aa.isSelectable(l))qS(t,aa.create(s,i));else continue;return!0}}function aye(t){return qte(t)}const JRe=Vf?"metaKey":"ctrlKey";Zu.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let s=aye(t),a=Date.now(),o="singleClick";a-t.input.lastClick.time<500&&Pxt(n,t.input.lastClick)&&!n[JRe]&&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(Gse(n));l&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Bxt(t,l,n,!!s)):(o=="doubleClick"?Rxt:Fxt)(t,l.pos,l.inside,n)?n.preventDefault():x1(t,"pointer"))};class Bxt{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[JRe],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,u=i?e.docView.nearestDesc(i,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.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&&op&&!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)),x1(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(()=>oy(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(Gse(e))),this.updateAllowDefault(e),this.allowDefault||!n?x1(this.view,"pointer"):Dxt(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||yu&&this.mightDrag&&!this.mightDrag.node.isAtom||vd&&!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)?(qS(this.view,Sa.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):x1(this.view,"pointer")}move(e){this.updateAllowDefault(e),x1(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)}}Zu.touchstart=t=>{t.input.lastTouch=Date.now(),aye(t),x1(t,"pointer")};Zu.touchmove=t=>{t.input.lastTouch=Date.now(),x1(t,"pointer")};Zu.contextmenu=t=>aye(t);function eFe(t,e){return t.composing?!0:yu&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const $xt=Wx?5e3:-1;Yu.compositionstart=Yu.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ha&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||vd&&ERe&&Uxt(t)))t.markCursor=t.state.storedMarks||n.marks(),qte(t,!0),t.markCursor=null;else if(qte(t,!e.selection.empty),op&&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}tFe(t,$xt)};function Uxt(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"}Yu.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++,tFe(t,20))};function tFe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qte(t),e))}function rFe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Vxt());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function qxt(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Ogt(e.focusNode,e.focusOffset),s=Dgt(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 Vxt(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qte(t,e=!1){if(!(Wx&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),rFe(t),e||t.docView&&t.docView.dirty){let n=eye(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 Hxt(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 kE=Ch&&G1<15||MC&&Bgt<604;Zu.copy=Yu.cut=(t,e)=>{let n=e,s=t.state.selection,a=n.type=="cut";if(s.empty)return;let o=kE?null:n.clipboardData,l=s.content(),{dom:i,text:u}=rye(t,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",u)):Hxt(t,i),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Wxt(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Gxt(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?NE(t,s.value,null,a,e):NE(t,s.textContent,s.innerHTML,a,e)},50)}function NE(t,e,n,s,a){let o=GRe(t,e,n,s,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,o||Hn.empty)))return!0;if(!o)return!1;let l=Wxt(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 nFe(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," "):""}Yu.paste=(t,e)=>{let n=e;if(t.composing&&!Wx)return;let s=kE?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;s&&NE(t,nFe(s),s.getData("text/html"),a,n)?n.preventDefault():Gxt(t,n)};class sFe{constructor(e,n,s){this.slice=e,this.move=n,this.node=s}}const Kxt=Vf?"altKey":"ctrlKey";function aFe(t,e){let n=t.someProp("dragCopies",s=>!s(e));return n??!e[Kxt]}Zu.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(Gse(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:u,text:p,slice:x}=rye(t,i);(!n.dataTransfer.files.length||!vd||ARe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(kE?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",kE||n.dataTransfer.setData("text/plain",p),t.dragging=new sFe(x,aFe(t,n),l)};Zu.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Yu.dragover=Yu.dragenter=(t,e)=>e.preventDefault();Yu.drop=(t,e)=>{try{Zxt(t,e,t.dragging)}finally{t.dragging=null}};function Zxt(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(Gse(e));if(!s)return;let a=t.state.doc.resolve(s.pos),o=n&&n.slice;o?t.someProp("transformPasted",w=>{o=w(o,t,!1)}):o=GRe(t,nFe(e.dataTransfer),kE?null:e.dataTransfer.getData("text/html"),!1,a);let l=!!(n&&aFe(t,e));if(t.someProp("handleDrop",w=>w(t,e,o||Hn.empty,l))){e.preventDefault();return}if(!o)return;e.preventDefault();let i=o?bRe(t.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let u=t.state.tr;if(l){let{node:w}=n;w?w.replace(u):u.deleteSelection()}let p=u.mapping.map(i),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=u.doc;if(x?u.replaceRangeWith(p,p,o.content.firstChild):u.replaceRange(p,p,o),u.doc.eq(y))return;let _=u.doc.resolve(p);if(x&&aa.isSelectable(o.content.firstChild)&&_.nodeAfter&&_.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new aa(_));else{let w=u.mapping.map(i);u.mapping.maps[u.mapping.maps.length-1].forEach((S,N,M,E)=>w=E),u.setSelection(tye(t,_,u.doc.resolve(w)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Zu.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())&&oy(t)},20))};Zu.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)};Zu.beforeinput=(t,e)=>{if(vd&&Wx&&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,Uw(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 Yu)Zu[t]=Yu[t];function SE(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 Vte{constructor(e,n){this.toDOM=e,this.spec=n||Dj,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 Uu(o-s,o-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Vte&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&SE(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Z1{constructor(e,n){this.attrs=e,this.spec=n||Dj}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 Uu(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==cu||e.maps.length==0?this:this.mapInner(e,n,0,0,s||Dj)}mapInner(e,n,s,a,o){let l;for(let i=0;i{let p=u+s,x;if(x=oFe(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&&u.type instanceof Z1){let p=Math.max(o,u.from)-o,x=Math.min(l,u.to)-o;pa.map(e,n,Dj));return Y0.from(s)}forChild(e,n){if(n.isLeaf)return Jl.empty;let s=[];for(let a=0;an instanceof Jl)?e:e.reduce((n,s)=>n.concat(s instanceof Jl?s:s.members),[]))}}forEachSet(e){for(let n=0;n{let M=N-S-(w-_);for(let E=0;EA+x-y)continue;let P=i[E]+x-y;w>=P?i[E+1]=_<=P?-2:-1:_>=x&&M&&(i[E]+=M,i[E+1]+=M)}y+=M}),x=n.maps[p].map(x,-1)}let u=!1;for(let p=0;p=s.content.size){u=!0;continue}let _=n.map(t[p+1]+o,-1),w=_-a,{index:S,offset:N}=s.content.findIndex(y),M=s.maybeChild(S);if(M&&N==y&&N+M.nodeSize==w){let E=i[p+2].mapInner(n,M,x+1,t[p]+o+1,l);E!=cu?(i[p]=y,i[p+1]=w,i[p+2]=E):(i[p+1]=-2,u=!0)}else u=!0}if(u){let p=Xxt(i,t,e,n,a,o,l),x=Hte(p,s,0,l);e=x.local;for(let y=0;yn&&l.to{let p=oFe(t,i,u+n);if(p){o=!0;let x=Hte(p,i,n+u+1,s);x!=cu&&a.push(u,u+i.nodeSize,x)}});let l=iFe(o?lFe(t):t,-n).sort(Rj);for(let i=0;i0;)e++;t.splice(e,0,n)}function Cce(t){let e=[];return t.someProp("decorations",n=>{let s=n(t.state);s&&s!=cu&&e.push(s)}),t.cursorWrapper&&e.push(Jl.create(t.state.doc,[t.cursorWrapper.deco])),Y0.from(e)}const Qxt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Jxt=Ch&&G1<=11;class eyt{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 tyt{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new eyt,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()}),Jxt&&(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,Qxt)),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(ANe(this.view)){if(this.suppressingSelectionUpdates)return oy(this.view);if(Ch&&G1<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&nk(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=CC(o))n.add(o);for(let o=e.anchorNode;o;o=CC(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)&&ANe(e)&&!this.ignoreSelectionChange(s),o=-1,l=-1,i=!1,u=[];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 w=_.parentNode;w&&w.nodeName=="LI"&&(!y||syt(e,y)!=w)&&_.remove()}}}else if((vd||yu)&&u.some(x=>x.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let x of u)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),ryt(e)),this.handleDOMChange(o,l,i,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||oy(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;M--){let E=s.childNodes[M-1],A=E.pmViewDesc;if(E.nodeName=="BR"&&!A){o=M;break}if(!A||A.size)break}let y=t.state.doc,_=t.someProp("domParser")||NA.fromSchema(t.state.schema),w=y.resolve(l),S=null,N=_.parse(s,{topNode:w.parent,topMatch:w.parent.contentMatchAt(w.index()),topOpen:!0,from:a,to:o,preserveWhitespace:w.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:iyt,context:w});if(p&&p[0].pos!=null){let M=p[0].pos,E=p[1]&&p[1].pos;E==null&&(E=M),S={anchor:M+l,head:E+l}}return{doc:N,sel:S,from:l,to:i}}function iyt(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(yu&&/^(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||yu&&/^(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 oyt=/^(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 lyt(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=eye(t,V);if(K&&!t.state.selection.eq(K)){if(vd&&Wx&&t.input.lastKeyCode===13&&Date.now()-100J(t,Uw(13,"Enter"))))return;let W=t.state.tr.setSelection(K);V=="pointer"?W.setMeta("pointer",!0):V=="key"&&W.scrollIntoView(),o&&W.setMeta("composition",o),t.dispatch(W)}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 u=t.state.selection,p=ayt(t,e,n),x=t.state.doc,y=x.slice(p.from,p.to),_,w;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Wx)&&a.some(V=>V.nodeType==1&&!oyt.test(V.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",V=>V(t,Uw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(s&&u instanceof ha&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))S={start:u.from,endA:u.to,endB:u.to};else{if(p.sel){let V=UNe(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&&S.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?S.start=t.state.selection.from:S.endA=t.state.selection.to-2&&t.state.selection.to<=p.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),Ch&&G1<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>p.from&&p.doc.textBetween(S.start-p.from-1,S.start-p.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let N=p.doc.resolveNoCache(S.start-p.from),M=p.doc.resolveNoCache(S.endB-p.from),E=x.resolve(S.start),A=N.sameParent(M)&&N.parent.inlineContent&&E.end()>=S.endA;if((MC&&t.input.lastIOSEnter>Date.now()-225&&(!A||a.some(V=>V.nodeName=="DIV"||V.nodeName=="P"))||!A&&N.posV(t,Uw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&dyt(x,S.start,S.endA,N,M)&&t.someProp("handleKeyDown",V=>V(t,Uw(8,"Backspace")))){Wx&&vd&&t.domObserver.suppressSelectionUpdates();return}vd&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),Wx&&!A&&N.start()!=M.start()&&M.parentOffset==0&&N.depth==M.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==S.endA&&(S.endB-=2,M=p.doc.resolveNoCache(S.endB-p.from),setTimeout(()=>{t.someProp("handleKeyDown",function(V){return V(t,Uw(13,"Enter"))})},20));let P=S.start,z=S.endA,R=V=>{let K=V||t.state.tr.replace(P,z,p.doc.slice(S.start-p.from,S.endB-p.from));if(p.sel){let W=UNe(t,K.doc,p.sel);W&&!(vd&&t.composing&&W.empty&&(S.start!=S.endB||t.input.lastChromeDeleteoy(t),20));let V=R(t.state.tr.delete(P,z)),K=x.resolve(S.start).marksAcross(x.resolve(S.endA));K&&V.ensureMarks(K),t.dispatch(V)}else if(S.endA==S.endB&&(U=cyt(N.parent.content.cut(N.parentOffset,M.parentOffset),E.parent.content.cut(E.parentOffset,S.endA-E.start())))){let V=R(t.state.tr);U.type=="add"?V.addMark(P,z,U.mark):V.removeMark(P,z,U.mark),t.dispatch(V)}else if(N.parent.child(N.index()).isText&&N.index()==M.index()-(M.textOffset?0:1)){let V=N.parent.textBetween(N.parentOffset,M.parentOffset),K=()=>R(t.state.tr.insertText(V,P,z));t.someProp("handleTextInput",W=>W(t,P,z,V,K))||t.dispatch(K())}else t.dispatch(R());else t.dispatch(R())}function UNe(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:tye(t,e.resolve(n.anchor),e.resolve(n.head))}function cyt(t,e){let n=t.firstChild.marks,s=e.firstChild.marks,a=n,o=s,l,i,u;for(let x=0;xx.mark(i.addToSet(x.marks));else if(a.length==0&&o.length==1)i=o[0],l="remove",u=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 uyt(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 u=Math.max(0,o-Math.min(l,i));s-=l+u-o}if(l=l?o-s:0;o-=u,o&&o=i?o-s:0;o-=u,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class cFe{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 Mxt,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(KNe),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=WNe(this),HNe(this),this.nodeViews=GNe(this),this.docView=kNe(this.state.doc,VNe(this),Cce(this),this.dom,this),this.domObserver=new tyt(this,(s,a,o,l)=>lyt(this,s,a,o,l)),this.domObserver.start(),Txt(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&&ofe(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(KNe),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&&(rFe(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 w=GNe(this);fyt(w,this.nodeViews)&&(this.nodeViews=w,o=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&ofe(this),this.editable=WNe(this),HNe(this);let u=Cce(this),p=VNe(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,u);(y||!e.selection.eq(a.selection))&&(l=!0);let _=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&qgt(this);if(l){this.domObserver.stop();let w=y&&(Ch||vd)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&hyt(a.selection,e.selection);if(y){let S=vd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=qxt(this)),(o||!this.docView.update(e.doc,p,u,this))&&(this.docView.updateOuterDeco(p),this.docView.destroy(),this.docView=kNe(e.doc,p,u,this.dom,this)),S&&!this.trackWrites&&(w=!0)}w||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&fxt(this))?oy(this,w):(VRe(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():_&&Vgt(_)}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&&yNe(this,n.getBoundingClientRect(),e)}else yNe(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 sFe(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 Ygt(this,e)}coordsAtPos(e,n=1){return DRe(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 txt(this,n||this.state,e)}pasteHTML(e,n){return NE(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return NE(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return rye(this,e)}destroy(){this.docView&&(Axt(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Cce(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Pgt())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ixt(this,e)}domSelectionRange(){let e=this.domSelection();return e?yu&&this.root.nodeType===11&&Fgt(this.dom.ownerDocument)==this.dom&&nyt(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}cFe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function VNe(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"),[Uu.node(0,t.state.doc.content.size,e)]}function HNe(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:Uu.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function WNe(t){return!t.someProp("editable",e=>e(t.state)===!1)}function hyt(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 GNe(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 fyt(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 KNe(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 ov={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:"'"},Wte={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pyt=typeof navigator<"u"&&/Mac/.test(navigator.platform),myt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Vd=0;Vd<10;Vd++)ov[48+Vd]=ov[96+Vd]=String(Vd);for(var Vd=1;Vd<=24;Vd++)ov[Vd+111]="F"+Vd;for(var Vd=65;Vd<=90;Vd++)ov[Vd]=String.fromCharCode(Vd+32),Wte[Vd]=String.fromCharCode(Vd);for(var Tce in ov)Wte.hasOwnProperty(Tce)||(Wte[Tce]=ov[Tce]);function gyt(t){var e=pyt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||myt&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wte:ov)[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 xyt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),yyt=typeof navigator<"u"&&/Win/.test(navigator.platform);function vyt(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 dFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const uFe=(t,e,n)=>{let s=dFe(t,n);if(!s)return!1;let a=dye(s);if(!a){let l=s.blockRange(),i=l&&w3(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&&(TC(o,"end")||aa.isSelectable(o)))for(let l=s.depth;;l--){let i=qse(t.doc,s.before(l),s.after(l),Hn.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},wyt=(t,e,n)=>{let s=dFe(t,n);if(!s)return!1;let a=dye(s);return a?hFe(t,a,e):!1},jyt=(t,e,n)=>{let s=pFe(t,n);if(!s)return!1;let a=uye(s);return a?hFe(t,a,e):!1};function hFe(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,u=e.pos+1;for(;!i.isTextblock;u++){if(i.type.spec.isolating)return!1;let x=i.firstChild;if(!x)return!1;i=x}let p=qse(t.doc,o,u,Hn.empty);if(!p||p.from!=o||p instanceof gd&&p.slice.size>=u-o)return!1;if(n){let x=t.tr.step(p);x.setSelection(ha.create(x.doc,o)),n(x.scrollIntoView())}return!0}function TC(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 fFe=(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=dye(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 dye(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 pFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let s=pFe(t,n);if(!s)return!1;let a=uye(s);if(!a)return!1;let o=a.nodeAfter;if(_Fe(t,a,e,1))return!0;if(s.parent.content.size==0&&(TC(o,"start")||aa.isSelectable(o))){let l=qse(t.doc,s.before(),s.after(),Hn.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||!yv(t.doc,n.from))return!1;a=n.from}else if(a=Use(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},Nyt=(t,e)=>{let n=t.selection,s;if(n instanceof aa){if(n.node.isTextblock||!yv(t.doc,n.to))return!1;s=n.to}else if(s=Use(t.doc,n.to,1),s==null)return!1;return e&&e(t.tr.join(s).scrollIntoView()),!0},Syt=(t,e)=>{let{$from:n,$to:s}=t.selection,a=n.blockRange(s),o=a&&w3(a);return o==null?!1:(e&&e(t.tr.lift(a,o).scrollIntoView()),!0)},xFe=(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 hye(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=hye(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(e){let i=n.after(),u=t.tr.replaceWith(i,i,l.createAndFill());u.setSelection(Sa.near(u.doc.resolve(i),1)),e(u.scrollIntoView())}return!0},yFe=(t,e)=>{let n=t.selection,{$from:s,$to:a}=n;if(n instanceof pf||s.parent.inlineContent||a.parent.inlineContent)return!1;let o=hye(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(iy(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),a=s&&w3(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)};function Myt(t){return(e,n)=>{let{$from:s,$to:a}=e.selection;if(e.selection instanceof aa&&e.selection.node.isBlock)return!s.parentOffset||!iy(e.doc,s.pos)?!1:(n&&n(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,i,u=!1,p=!1;for(let w=s.depth;;w--)if(s.node(w).isBlock){u=s.end(w)==s.pos+(s.depth-w),p=s.start(w)==s.pos-(s.depth-w),i=hye(s.node(w-1).contentMatchAt(s.indexAfter(w-1))),o.unshift(u&&i?{type:i}:null),l=w;break}else{if(w==1)return!1;o.unshift(null)}let x=e.tr;(e.selection instanceof ha||e.selection instanceof pf)&&x.deleteSelection();let y=x.mapping.map(s.pos),_=iy(x.doc,y,o.length,o);if(_||(o[0]=i?{type:i}:null,_=iy(x.doc,y,o.length,o)),!_)return!1;if(x.split(y,o.length,o),!u&&p&&s.node(l).type!=i){let w=x.mapping.map(s.before(l)),S=x.doc.resolve(w);i&&s.node(l-1).canReplaceWith(S.index(),S.index()+1,i)&&x.setNodeMarkup(x.mapping.map(s.before(l)),i)}return n&&n(x.scrollIntoView()),!0}}const Tyt=Myt(),Ayt=(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 Eyt(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||yv(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,u=a.type.spec.isolating||o.type.spec.isolating;if(!u&&Eyt(t,e,n))return!0;let p=!u&&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 w=e.pos+o.nodeSize,S=ln.empty;for(let E=l.length-1;E>=0;E--)S=ln.from(l[E].create(null,S));S=ln.from(a.copy(S));let N=t.tr.step(new Nd(e.pos-1,w,e.pos,w,new Hn(S,1,0),l.length,!0)),M=N.doc.resolve(w+2*l.length);M.nodeAfter&&M.nodeAfter.type==a.type&&yv(N.doc,M.pos)&&N.join(M.pos),n(N.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&u?null:Sa.findFrom(e,1),y=x&&x.$from.blockRange(x.$to),_=y&&w3(y);if(_!=null&&_>=e.depth)return n&&n(t.tr.lift(y,_).scrollIntoView()),!0;if(p&&TC(o,"start",!0)&&TC(a,"end")){let w=a,S=[];for(;S.push(w),!w.isTextblock;)w=w.lastChild;let N=o,M=1;for(;!N.isTextblock;N=N.firstChild)M++;if(w.canReplace(w.childCount,w.childCount,N.content)){if(n){let E=ln.empty;for(let P=S.length-1;P>=0;P--)E=ln.from(S[P].copy(E));let A=t.tr.step(new Nd(e.pos-S.length,e.pos+o.nodeSize,e.pos+M,e.pos+o.nodeSize-M,new Hn(E,S.length,0),0,!0));n(A.scrollIntoView())}return!0}}return!1}function bFe(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(ha.create(e.doc,t<0?a.start(o):a.end(o)))),!0):!1}}const Iyt=bFe(-1),Pyt=bFe(1);function Lyt(t,e=null){return function(n,s){let{$from:a,$to:o}=n.selection,l=a.blockRange(o),i=l&&Yxe(l,t,e);return i?(s&&s(n.tr.wrap(l,i).scrollIntoView()),!0):!1}}function ZNe(t,e=null){return function(n,s){let a=!1;for(let o=0;o{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.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 u=l.resolve(e.start-2);o=new zte(u,u,e.depth),e.endIndex=0;x--)o=ln.from(n[x].type.create(n[x].attrs,o));t.step(new Nd(e.start-(s?2:0),e.end,e.start,e.end,new Hn(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?zyt(e,n,t,o):Byt(e,n,o):!0:!1}}function zyt(t,e,n,s){let a=t.tr,o=s.end,l=s.$to.end(s.depth);oN;S--)w-=a.child(S).nodeSize,s.delete(w-1,w+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,u=n.endIndex==a.childCount,p=o.node(-1),x=o.index(-1);if(!p.canReplace(x+(i?0:1),x+1,l.content.append(u?ln.empty:ln.from(a))))return!1;let y=o.pos,_=y+l.nodeSize;return s.step(new Nd(y-(i?1:0),_+(u?1:0),y+1,_-1,new Hn((i?ln.empty:ln.from(a.copy(ln.empty))).append(u?ln.empty:ln.from(a.copy(ln.empty))),i?0:1,u?0:1),i?0:1)),e(s.scrollIntoView()),!0}function $yt(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,u=i.child(l-1);if(u.type!=t)return!1;if(n){let p=u.lastChild&&u.lastChild.type==i.type,x=ln.from(p?t.create():null),y=new Hn(ln.from(t.create(null,ln.from(i.type.create(null,x)))),p?3:1,0),_=o.start,w=o.end;n(e.tr.step(new Nd(_-(p?3:1),w,_,w,y,1,!0)).scrollIntoView())}return!0}}function Kse(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 Zse{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,u])=>[i,(...x)=>{const y=u(...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=[],u=!!e,p=e||o.tr,x=()=>(!u&&n&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(p),i.every(_=>_===!0)),y={...Object.fromEntries(Object.entries(s).map(([_,w])=>[_,(...N)=>{const M=this.buildProps(p,n),E=w(...N)(M);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(([u,p])=>[u,(...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:Kse({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(([u,p])=>[u,(...x)=>p(...x)(i)]))}};return i}}let Uyt=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 js(t,e,n){return t.config[e]===void 0&&t.parent?js(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?js(t.parent,e,n):null}):t.config[e]}function Yse(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 wFe(t){const e=[],{nodeExtensions:n,markExtensions:s}=Yse(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},u=js(l,"addGlobalAttributes",i);if(!u)return;u().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([_,w])=>{e.push({type:y,name:_,attribute:{...o,...w}})})})})}),a.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage},u=js(l,"addAttributes",i);if(!u)return;const p=u();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 Td(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 Vl(...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(" "):[],u=s[a]?s[a].split(" "):[],p=i.filter(x=>!u.includes(x));s[a]=[...u,...p].join(" ")}else if(a==="style"){const i=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],u=s[a]?s[a].split(";").map(x=>x.trim()).filter(Boolean):[],p=new Map;u.forEach(x=>{const[y,_]=x.split(":").map(w=>w.trim());p.set(y,_)}),i.forEach(x=>{const[y,_]=x.split(":").map(w=>w.trim());p.set(y,_)}),s[a]=Array.from(p.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[a]=o}),s},{})}function lfe(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)=>Vl(n,s),{})}function jFe(t){return typeof t=="function"}function hi(t,e=void 0,...n){return jFe(t)?e?t.bind(e)(...n):t(...n):t}function qyt(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Vyt(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function YNe(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):Vyt(n.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...s,...a}}}}function XNe(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&qyt(n)?!1:n!=null))}function Hyt(t,e){var n;const s=wFe(t),{nodeExtensions:a,markExtensions:o}=Yse(t),l=(n=a.find(p=>js(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,A)=>{const P=js(A,"extendNodeSchema",y);return{...E,...P?P(p):{}}},{}),w=XNe({..._,content:hi(js(p,"content",y)),marks:hi(js(p,"marks",y)),group:hi(js(p,"group",y)),inline:hi(js(p,"inline",y)),atom:hi(js(p,"atom",y)),selectable:hi(js(p,"selectable",y)),draggable:hi(js(p,"draggable",y)),code:hi(js(p,"code",y)),whitespace:hi(js(p,"whitespace",y)),linebreakReplacement:hi(js(p,"linebreakReplacement",y)),defining:hi(js(p,"defining",y)),isolating:hi(js(p,"isolating",y)),attrs:Object.fromEntries(x.map(E=>{var A;return[E.name,{default:(A=E==null?void 0:E.attribute)===null||A===void 0?void 0:A.default}]}))}),S=hi(js(p,"parseHTML",y));S&&(w.parseDOM=S.map(E=>YNe(E,x)));const N=js(p,"renderHTML",y);N&&(w.toDOM=E=>N({node:E,HTMLAttributes:lfe(E,x)}));const M=js(p,"renderText",y);return M&&(w.toText=M),[p.name,w]})),u=Object.fromEntries(o.map(p=>{const x=s.filter(M=>M.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:e},_=t.reduce((M,E)=>{const A=js(E,"extendMarkSchema",y);return{...M,...A?A(p):{}}},{}),w=XNe({..._,inclusive:hi(js(p,"inclusive",y)),excludes:hi(js(p,"excludes",y)),group:hi(js(p,"group",y)),spanning:hi(js(p,"spanning",y)),code:hi(js(p,"code",y)),attrs:Object.fromEntries(x.map(M=>{var E;return[M.name,{default:(E=M==null?void 0:M.attribute)===null||E===void 0?void 0:E.default}]}))}),S=hi(js(p,"parseHTML",y));S&&(w.parseDOM=S.map(M=>YNe(M,x)));const N=js(p,"renderHTML",y);return N&&(w.toDOM=M=>N({mark:M,HTMLAttributes:lfe(M,x)})),[p.name,w]}));return new dRe({topNode:l,nodes:i,marks:u})}function Ece(t,e){return e.nodes[t]||e.marks[t]||null}function QNe(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function pye(t,e){const n=_k.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}const Wyt=(t,e=500)=>{let n="";const s=t.parentOffset;return t.parent.nodesBetween(Math.max(0,s-e),s,(a,o,l,i)=>{var u,p;const x=((p=(u=a.type.spec).toText)===null||p===void 0?void 0:p.call(u,{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 mye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Xse{constructor(e){this.find=e.find,this.handler=e.handler}}const Gyt=(t,e)=>{if(mye(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 BL(t){var e;const{editor:n,from:s,to:a,text:o,rules:l,plugin:i}=t,{view:u}=n;if(u.composing)return!1;const p=u.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=Wyt(p)+o;return l.forEach(_=>{if(x)return;const w=Gyt(y,_.find);if(!w)return;const S=u.state.tr,N=Kse({state:u.state,transaction:S}),M={from:s-(w[0].length-o.length),to:a},{commands:E,chain:A,can:P}=new Zse({editor:n,state:N});_.handler({state:N,range:M,match:w,commands:E,chain:A,can:P})===null||!S.steps.length||(S.setMeta(i,{transform:S,from:s,to:a,text:o}),u.dispatch(S),x=!0)}),x}function Kyt(t){const{editor:e,rules:n}=t,s=new nd({state:{init(){return null},apply(a,o,l){const i=a.getMeta(s);if(i)return i;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:x}=u;typeof x=="string"?x=x:x=pye(ln.from(x),l.schema);const{from:y}=u,_=y+x.length;BL({editor:e,from:y,to:_,text:x,rules:n,plugin:s})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return BL({editor:e,from:o,to:l,text:i,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&BL({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?BL({editor:e,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function Zyt(t){return Object.prototype.toString.call(t).slice(8,-1)}function $L(t){return Zyt(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Qse(t,e){const n={...t};return $L(t)&&$L(e)&&Object.keys(e).forEach(s=>{$L(e[s])&&$L(t[s])?n[s]=Qse(t[s],e[s]):n[s]=e[s]}),n}class qg{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(js(this,"addOptions",{name:this.name}))),this.storage=hi(js(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new qg(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Qse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new qg(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(js(n,"addOptions",{name:n.name})),n.storage=hi(js(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 u=l.find(p=>(p==null?void 0:p.type.name)===n.name);return u&&s.removeStoredMark(u),s.insertText(" ",a.pos),e.view.dispatch(s),!0}return!1}}function Yyt(t){return typeof t=="number"}class Xyt{constructor(e){this.find=e.find,this.handler=e.handler}}const Qyt=(t,e,n)=>{if(mye(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 Jyt(t){const{editor:e,state:n,from:s,to:a,rule:o,pasteEvent:l,dropEvent:i}=t,{commands:u,chain:p,can:x}=new Zse({editor:e,state:n}),y=[];return n.doc.nodesBetween(s,a,(w,S)=>{if(!w.isTextblock||w.type.spec.code)return;const N=Math.max(s,S),M=Math.min(a,S+w.content.size),E=w.textBetween(N-S,M-S,void 0,"");Qyt(E,o.find,l).forEach(P=>{if(P.index===void 0)return;const z=N+P.index+1,R=z+P[0].length,U={from:n.tr.mapping.map(z),to:n.tr.mapping.map(R)},V=o.handler({state:n,range:U,match:P,commands:u,chain:p,can:x,pasteEvent:l,dropEvent:i});y.push(V)})}),y.every(w=>w!==null)}let UL=null;const e0t=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 t0t(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 u=({state:x,from:y,to:_,rule:w,pasteEvt:S})=>{const N=x.tr,M=Kse({state:x,transaction:N});if(!(!Jyt({editor:e,state:M,from:Math.max(y-1,0),to:_.b-1,rule:w,pasteEvent:S,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 nd({view(y){const _=S=>{var N;s=!((N=y.dom.parentElement)===null||N===void 0)&&N.contains(S.target)?y.dom.parentElement:null,s&&(UL=e)},w=()=>{UL&&(UL=null)};return window.addEventListener("dragstart",_),window.addEventListener("dragend",w),{destroy(){window.removeEventListener("dragstart",_),window.removeEventListener("dragend",w)}}},props:{handleDOMEvents:{drop:(y,_)=>{if(o=s===y.dom.parentElement,i=_,!o){const w=UL;w!=null&&w.isEditable&&setTimeout(()=>{const S=w.state.selection;S&&w.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(y,_)=>{var w;const S=(w=_.clipboardData)===null||w===void 0?void 0:w.getData("text/html");return l=_,a=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(y,_,w)=>{const S=y[0],N=S.getMeta("uiEvent")==="paste"&&!a,M=S.getMeta("uiEvent")==="drop"&&!o,E=S.getMeta("applyPasteRules"),A=!!E;if(!N&&!M&&!A)return;if(A){let{text:R}=E;typeof R=="string"?R=R:R=pye(ln.from(R),w.schema);const{from:U}=E,V=U+R.length,K=e0t(R);return u({rule:x,state:w,from:U,to:{b:V},pasteEvt:K})}const P=_.doc.content.findDiffStart(w.doc.content),z=_.doc.content.findDiffEnd(w.doc.content);if(!(!Yyt(P)||!z||P===z.b))return u({rule:x,state:w,from:P,to:z,pasteEvt:l})}}))}function r0t(t){const e=t.filter((n,s)=>t.indexOf(n)!==s);return Array.from(new Set(e))}class K4{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=K4.resolve(e),this.schema=Hyt(this.extensions,n),this.setupExtensions()}static resolve(e){const n=K4.sort(K4.flatten(e)),s=r0t(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=js(n,"addExtensions",s);return a?[n,...this.flatten(a())]:n}).flat(10)}static sort(e){return e.sort((s,a)=>{const o=js(s,"priority")||100,l=js(a,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Ece(n.name,this.schema)},a=js(n,"addCommands",s);return a?{...e,...a()}:e},{})}get plugins(){const{editor:e}=this,n=K4.sort([...this.extensions].reverse()),s=[],a=[],o=n.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:e,type:Ece(l.name,this.schema)},u=[],p=js(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&js(l,"exitable",i)&&(x.ArrowRight=()=>qg.handleExit({editor:e,mark:l})),p){const N=Object.fromEntries(Object.entries(p()).map(([M,E])=>[M,()=>E({editor:e})]));x={...x,...N}}const y=byt(x);u.push(y);const _=js(l,"addInputRules",i);QNe(l,e.options.enableInputRules)&&_&&s.push(..._());const w=js(l,"addPasteRules",i);QNe(l,e.options.enablePasteRules)&&w&&a.push(...w());const S=js(l,"addProseMirrorPlugins",i);if(S){const N=S();u.push(...N)}return u}).flat();return[Kyt({editor:e,rules:s}),...t0t({editor:e,rules:a}),...o]}get attributes(){return wFe(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Yse(this.extensions);return Object.fromEntries(n.filter(s=>!!js(s,"addNodeView")).map(s=>{const a=this.attributes.filter(u=>u.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:e,type:Td(s.name,this.schema)},l=js(s,"addNodeView",o);if(!l)return[];const i=(u,p,x,y,_)=>{const w=lfe(u,a);return l()({node:u,view:p,getPos:x,decorations:y,innerDecorations:_,editor:e,extension:s,HTMLAttributes:w})};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:Ece(e.name,this.schema)};e.type==="mark"&&(!((n=hi(js(e,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const a=js(e,"onBeforeCreate",s),o=js(e,"onCreate",s),l=js(e,"onUpdate",s),i=js(e,"onSelectionUpdate",s),u=js(e,"onTransaction",s),p=js(e,"onFocus",s),x=js(e,"onBlur",s),y=js(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),u&&this.editor.on("transaction",u),p&&this.editor.on("focus",p),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class tu{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(js(this,"addOptions",{name:this.name}))),this.storage=hi(js(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new tu(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Qse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new tu({...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(js(n,"addOptions",{name:n.name})),n.storage=hi(js(n,"addStorage",{name:n.name,options:n.options})),n}}function kFe(t,e,n){const{from:s,to:a}=e,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let i="";return t.nodesBetween(s,a,(u,p,x,y)=>{var _;u.isBlock&&p>s&&(i+=o);const w=l==null?void 0:l[u.type.name];if(w)return x&&(i+=w({node:u,pos:p,parent:x,index:y,range:e})),!1;u.isText&&(i+=(_=u==null?void 0:u.text)===null||_===void 0?void 0:_.slice(Math.max(s,p)-p,a-p))}),i}function NFe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const n0t=tu.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new nd({key:new bu("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)),u=NFe(n);return kFe(s,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),s0t=()=>({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),a0t=(t=!1)=>({commands:e})=>e.setContent("",t),i0t=()=>({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,u)=>{if(i.type.isText)return;const{doc:p,mapping:x}=e,y=p.resolve(x.map(u)),_=p.resolve(x.map(u+i.nodeSize)),w=y.blockRange(_);if(!w)return;const S=w3(w);if(i.type.isTextblock){const{defaultType:N}=y.parent.contentMatchAt(y.index());e.setNodeMarkup(w.start,N)}(S||S===0)&&e.lift(w,S)})}),!0},o0t=t=>e=>t(e),l0t=()=>({state:t,dispatch:e})=>yFe(t,e),c0t=(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 ha(s.doc.resolve(Math.max(l-1,0)))),!0},d0t=()=>({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),u=a.after(o);t.delete(i,u).scrollIntoView()}return!0}return!1},u0t=t=>({tr:e,state:n,dispatch:s})=>{const a=Td(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 u=o.before(l),p=o.after(l);e.delete(u,p).scrollIntoView()}return!0}return!1},h0t=t=>({tr:e,dispatch:n})=>{const{from:s,to:a}=t;return n&&e.delete(s,a),!0},f0t=()=>({state:t,dispatch:e})=>cye(t,e),p0t=()=>({commands:t})=>t.keyboardShortcut("Enter"),m0t=()=>({state:t,dispatch:e})=>Cyt(t,e);function Gte(t,e,n={strict:!0}){const s=Object.keys(e);return s.length?s.every(a=>n.strict?e[a]===t[a]:mye(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function SFe(t,e,n={}){return t.find(s=>s.type===e&&Gte(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function JNe(t,e,n={}){return!!SFe(t,e,n)}function gye(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),!SFe([...a.node.marks],e,n)))return;let l=a.index,i=t.start()+a.offset,u=l+1,p=i+a.node.nodeSize;for(;l>0&&JNe([...t.parent.child(l-1).marks],e,n);)l-=1,i-=t.parent.child(l).nodeSize;for(;u({tr:n,state:s,dispatch:a})=>{const o=_v(t,s.schema),{doc:l,selection:i}=n,{$from:u,from:p,to:x}=i;if(a){const y=gye(u,o,e);if(y&&y.from<=p&&y.to>=x){const _=ha.create(l,y.from,y.to);n.setSelection(_)}}return!0},x0t=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=()=>{(xye()||y0t())&&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&&!CFe(n.state.selection))return l(),!0;const i=MFe(a.doc,t)||n.state.selection,u=n.state.selection.eq(i);return o&&(u||a.setSelection(i),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},_0t=(t,e)=>n=>t.every((s,a)=>e(s,{...n,index:a})),b0t=(t,e)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),TFe=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&&TFe(s)}return t};function qL(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return TFe(n)}function CE(t,e,n){if(t instanceof W1||t instanceof ln)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 ln.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),CE("",e,n)}if(a){if(n.errorOnInvalidContent){let l=!1,i="";const u=new dRe({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?NA.fromSchema(u).parseSlice(qL(t),n.parseOptions):NA.fromSchema(u).parse(qL(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=NA.fromSchema(e);return n.slice?o.parseSlice(qL(t),n.parseOptions).content:o.parse(qL(t),n.parseOptions)}return CE("",e,n)}function w0t(t,e,n){const s=t.steps.length-1;if(s{l===0&&(l=x)}),t.setSelection(Sa.near(t.doc.resolve(l),n))}const j0t=t=>!("type"in t),k0t=(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 u=M=>{o.emit("contentError",{editor:o,error:M,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{CE(e,o.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(M){u(M)}try{i=CE(e,o.schema,{parseOptions:p,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(M){return u(M),!1}let{from:x,to:y}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},_=!0,w=!0;if((j0t(i)?i:[i]).forEach(M=>{M.check(),_=_?M.isText&&M.marks.length===0:!1,w=w?M.isBlock:!1}),x===y&&w){const{parent:M}=s.doc.resolve(x);M.isTextblock&&!M.type.spec.code&&!M.childCount&&(x-=1,y+=1)}let N;if(_){if(Array.isArray(e))N=e.map(M=>M.text||"").join("");else if(e instanceof ln){let M="";e.forEach(E=>{E.text&&(M+=E.text)}),N=M}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&&w0t(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},N0t=()=>({state:t,dispatch:e})=>kyt(t,e),S0t=()=>({state:t,dispatch:e})=>Nyt(t,e),C0t=()=>({state:t,dispatch:e})=>uFe(t,e),M0t=()=>({state:t,dispatch:e})=>mFe(t,e),T0t=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Use(t.doc,t.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},A0t=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Use(t.doc,t.selection.$from.pos,1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},E0t=()=>({state:t,dispatch:e})=>wyt(t,e),I0t=()=>({state:t,dispatch:e})=>jyt(t,e);function AFe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function P0t(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=P0t(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}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",p=>p(n,i))});return u==null||u.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?Td(e,t.schema):null,i=[];t.doc.nodesBetween(s,a,(y,_)=>{if(y.isText)return;const w=Math.max(s,_),S=Math.min(a,_+y.nodeSize);i.push({node:y,from:w,to:S})});const u=a-s,p=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>Gte(y.node.attrs,n,{strict:!1}));return o?!!p.length:p.reduce((y,_)=>y+_.to-_.from,0)>=u}const O0t=(t,e={})=>({state:n,dispatch:s})=>{const a=Td(t,n.schema);return ME(n,a,e)?Syt(n,s):!1},D0t=()=>({state:t,dispatch:e})=>vFe(t,e),R0t=t=>({state:e,dispatch:n})=>{const s=Td(t,e.schema);return Fyt(s)(e,n)},F0t=()=>({state:t,dispatch:e})=>xFe(t,e);function Jse(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function e4e(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 z0t=(t,e)=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Jse(typeof t=="string"?t:t.name,s.schema);return i?(i==="node"&&(o=Td(t,s.schema)),i==="mark"&&(l=_v(t,s.schema)),a&&n.selection.ranges.forEach(u=>{s.doc.nodesBetween(u.$from.pos,u.$to.pos,(p,x)=>{o&&o===p.type&&n.setNodeMarkup(x,void 0,e4e(p.attrs,e)),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&n.addMark(x,x+p.nodeSize,l.create(e4e(y.attrs,e)))})})}),!0):!1},B0t=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),$0t=()=>({tr:t,dispatch:e})=>{if(e){const n=new pf(t.doc);t.setSelection(n)}return!0},U0t=()=>({state:t,dispatch:e})=>fFe(t,e),q0t=()=>({state:t,dispatch:e})=>gFe(t,e),V0t=()=>({state:t,dispatch:e})=>Ayt(t,e),H0t=()=>({state:t,dispatch:e})=>Pyt(t,e),W0t=()=>({state:t,dispatch:e})=>Iyt(t,e);function cfe(t,e,n={},s={}){return CE(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const G0t=(t,e=!1,n={},s={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var u,p;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=cfe(t,a.schema,n,{errorOnInvalidContent:(u=s.errorOnInvalidContent)!==null&&u!==void 0?u: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 EFe(t,e){const n=_v(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,u=>{l.push(...u.marks)});const i=l.find(u=>u.type.name===n.name);return i?{...i.attrs}:{}}function K0t(t,e){const n=new Xxe(t);return e.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function Z0t(t){for(let e=0;e{n(a)&&s.push({node:a,pos:o})}),s}function IFe(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 yye(t){return e=>IFe(e.$from,t)}function X0t(t,e){const n={from:0,to:t.content.size};return kFe(t,n,e)}function Q0t(t,e){const n=Td(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 PFe(t,e){const n=Jse(typeof e=="string"?e:e.name,t.schema);return n==="node"?Q0t(t,e):n==="mark"?EFe(t,e):{}}function J0t(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 e1t(t){const e=J0t(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 t1t(t){const{mapping:e,steps:n}=t,s=[];return e.maps.forEach((a,o)=>{const l=[];if(a.ranges.length)a.forEach((i,u)=>{l.push({from:i,to:u})});else{const{from:i,to:u}=n[o];if(i===void 0||u===void 0)return;l.push({from:i,to:u})}l.forEach(({from:i,to:u})=>{const p=e.slice(o).map(i,-1),x=e.slice(o).map(u),y=e.invert().map(p,-1),_=e.invert().map(x);s.push({oldRange:{from:y,to:_},newRange:{from:p,to:x}})})}),e1t(s)}function vye(t,e,n){const s=[];return t===e?n.resolve(t).marks().forEach(a=>{const o=n.resolve(t),l=gye(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 kee(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 dfe(t,e,n={}){const{empty:s,ranges:a}=t.selection,o=e?_v(e,t.schema):null;if(s)return!!(t.storedMarks||t.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>Gte(y.attrs,n,{strict:!1}));let l=0;const i=[];if(a.forEach(({$from:y,$to:_})=>{const w=y.pos,S=_.pos;t.doc.nodesBetween(w,S,(N,M)=>{if(!N.isText&&!N.marks.length)return;const E=Math.max(w,M),A=Math.min(S,M+N.nodeSize),P=A-E;l+=P,i.push(...N.marks.map(z=>({mark:z,from:E,to:A})))})}),l===0)return!1;const u=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>Gte(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(u>0?u+p:u)>=l}function r1t(t,e,n={}){if(!e)return ME(t,null,n)||dfe(t,null,n);const s=Jse(e,t.schema);return s==="node"?ME(t,e,n):s==="mark"?dfe(t,e,n):!1}function t4e(t,e){const{nodeExtensions:n}=Yse(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(js(s,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function _ye(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&&(_ye(o,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function n1t(t){return t instanceof aa}function s1t(t,e,n){var s;const{selection:a}=e;let o=null;if(CFe(a)&&(o=a.$cursor),o){const i=(s=t.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(i)||!i.some(u=>u.type.excludes(n))}const{ranges:l}=a;return l.some(({$from:i,$to:u})=>{let p=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(i.pos,u.pos,(x,y,_)=>{if(p)return!1;if(x.isInline){const w=!_||_.type.allowsMarkType(n),S=!!n.isInSet(x.marks)||!x.marks.some(N=>N.type.excludes(n));p=w&&S}return!p}),p})}const a1t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{const{selection:o}=n,{empty:l,ranges:i}=o,u=_v(t,s.schema);if(a)if(l){const p=EFe(s,u);n.addStoredMark(u.create({...p,...e}))}else i.forEach(p=>{const x=p.$from.pos,y=p.$to.pos;s.doc.nodesBetween(x,y,(_,w)=>{const S=Math.max(w,x),N=Math.min(w+_.nodeSize,y);_.marks.find(E=>E.type===u)?_.marks.forEach(E=>{u===E.type&&n.addMark(S,N,u.create({...E.attrs,...e}))}):n.addMark(S,N,u.create(e))})});return s1t(s,n,u)},i1t=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),o1t=(t,e={})=>({state:n,dispatch:s,chain:a})=>{const o=Td(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})=>ZNe(o,{...l,...e})(n)?!0:i.clearNodes()).command(({state:i})=>ZNe(o,{...l,...e})(i,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},l1t=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,a=Jw(t,0,s.content.size),o=aa.create(s,a);e.setSelection(o)}return!0},c1t=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,{from:a,to:o}=typeof t=="number"?{from:t,to:t}:t,l=ha.atStart(s).from,i=ha.atEnd(s).to,u=Jw(a,l,i),p=Jw(o,l,i),x=ha.create(s,u,p);e.setSelection(x)}return!0},d1t=t=>({state:e,dispatch:n})=>{const s=Td(t,e.schema);return $yt(s)(e,n)};function r4e(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 u1t=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:s,editor:a})=>{const{selection:o,doc:l}=e,{$from:i,$to:u}=o,p=a.extensionManager.attributes,x=kee(p,i.node().type.name,i.node().attrs);if(o instanceof aa&&o.node.isBlock)return!i.parentOffset||!iy(l,i.pos)?!1:(s&&(t&&r4e(n,a.extensionManager.splittableMarks),e.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const y=u.parentOffset===u.parent.content.size,_=i.depth===0?void 0:Z0t(i.node(-1).contentMatchAt(i.indexAfter(-1)));let w=y&&_?[{type:_,attrs:x}]:void 0,S=iy(e.doc,e.mapping.map(i.pos),1,w);if(!w&&!S&&iy(e.doc,e.mapping.map(i.pos),1,_?[{type:_}]:void 0)&&(S=!0,w=_?[{type:_,attrs:x}]:void 0),s){if(S&&(o instanceof ha&&e.deleteSelection(),e.split(e.mapping.map(i.pos),1,w),_&&!y&&!i.parentOffset&&i.parent.type!==_)){const N=e.mapping.map(i.before()),M=e.doc.resolve(N);i.node(-1).canReplaceWith(M.index(),M.index()+1,_)&&e.setNodeMarkup(e.mapping.map(i.before()),_)}t&&r4e(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return S},h1t=(t,e={})=>({tr:n,state:s,dispatch:a,editor:o})=>{var l;const i=Td(t,s.schema),{$from:u,$to:p}=s.selection,x=s.selection.node;if(x&&x.isBlock||u.depth<2||!u.sameParent(p))return!1;const y=u.node(-1);if(y.type!==i)return!1;const _=o.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==i||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let E=ln.empty;const A=u.index(-1)?1:u.index(-2)?2:3;for(let K=u.depth-A;K>=u.depth-3;K-=1)E=ln.from(u.node(K).copy(E));const P=u.indexAfter(-1){if(V>-1)return!1;K.isTextblock&&K.content.size===0&&(V=W+1)}),V>-1&&n.setSelection(ha.near(n.doc.resolve(V))),n.scrollIntoView()}return!0}const w=p.pos===u.end()?y.contentMatchAt(0).defaultType:null,S={...kee(_,y.type.name,y.attrs),...e},N={...kee(_,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,p.pos);const M=w?[{type:i,attrs:S},{type:w,attrs:N}]:[{type:i,attrs:S}];if(!iy(n.doc,u.pos,2))return!1;if(a){const{selection:E,storedMarks:A}=s,{splittableMarks:P}=o.extensionManager,z=A||E.$to.parentOffset&&E.$from.marks();if(n.split(u.pos,2,M).scrollIntoView(),!z||!a)return!0;const R=z.filter(U=>P.includes(U.type.name));n.ensureMarks(R)}return!0},Ice=(t,e)=>{const n=yye(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)&&yv(t.doc,n.pos)&&t.join(n.pos),!0},Pce=(t,e)=>{const n=yye(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)&&yv(t.doc,s)&&t.join(s),!0},f1t=(t,e,n,s={})=>({editor:a,tr:o,state:l,dispatch:i,chain:u,commands:p,can:x})=>{const{extensions:y,splittableMarks:_}=a.extensionManager,w=Td(t,l.schema),S=Td(e,l.schema),{selection:N,storedMarks:M}=l,{$from:E,$to:A}=N,P=E.blockRange(A),z=M||N.$to.parentOffset&&N.$from.marks();if(!P)return!1;const R=yye(U=>t4e(U.type.name,y))(N);if(P.depth>=1&&R&&P.depth-R.depth<=1){if(R.node.type===w)return p.liftListItem(S);if(t4e(R.node.type.name,y)&&w.validContent(R.node.content)&&i)return u().command(()=>(o.setNodeMarkup(R.pos,w),!0)).command(()=>Ice(o,w)).command(()=>Pce(o,w)).run()}return!n||!z||!i?u().command(()=>x().wrapInList(w,s)?!0:p.clearNodes()).wrapInList(w,s).command(()=>Ice(o,w)).command(()=>Pce(o,w)).run():u().command(()=>{const U=x().wrapInList(w,s),V=z.filter(K=>_.includes(K.type.name));return o.ensureMarks(V),U?!0:p.clearNodes()}).wrapInList(w,s).command(()=>Ice(o,w)).command(()=>Pce(o,w)).run()},p1t=(t,e={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:o=!1}=n,l=_v(t,s.schema);return dfe(s,l,e)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,e)},m1t=(t,e,n={})=>({state:s,commands:a})=>{const o=Td(t,s.schema),l=Td(e,s.schema),i=ME(s,o,n);let u;return s.selection.$anchor.sameParent(s.selection.$head)&&(u=s.selection.$anchor.parent.attrs),i?a.setNode(l,u):a.setNode(o,{...u,...n})},g1t=(t,e={})=>({state:n,commands:s})=>{const a=Td(t,n.schema);return ME(n,a,e)?s.lift(a):s.wrapIn(a,e)},x1t=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let s=0;s=0;u-=1)l.step(i.steps[u].invert(i.docs[u]));if(o.text){const u=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,t.schema.text(o.text,u))}else l.delete(o.from,o.to)}return!0}}return!1},y1t=()=>({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},v1t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=e,{selection:i}=n,u=_v(t,s.schema),{$from:p,empty:x,ranges:y}=i;if(!a)return!0;if(x&&l){let{from:_,to:w}=i;const S=(o=p.marks().find(M=>M.type===u))===null||o===void 0?void 0:o.attrs,N=gye(p,u,S);N&&(_=N.from,w=N.to),n.removeMark(_,w,u)}else y.forEach(_=>{n.removeMark(_.$from.pos,_.$to.pos,u)});return n.removeStoredMark(u),!0},_1t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Jse(typeof t=="string"?t:t.name,s.schema);return i?(i==="node"&&(o=Td(t,s.schema)),i==="mark"&&(l=_v(t,s.schema)),a&&n.selection.ranges.forEach(u=>{const p=u.$from.pos,x=u.$to.pos;let y,_,w,S;n.selection.empty?s.doc.nodesBetween(p,x,(N,M)=>{o&&o===N.type&&(w=Math.max(M,p),S=Math.min(M+N.nodeSize,x),y=M,_=N)}):s.doc.nodesBetween(p,x,(N,M)=>{M=p&&M<=x&&(o&&o===N.type&&n.setNodeMarkup(M,void 0,{...N.attrs,...e}),l&&N.marks.length&&N.marks.forEach(E=>{if(l===E.type){const A=Math.max(M,p),P=Math.min(M+N.nodeSize,x);n.addMark(A,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(w,S,l.create({...N.attrs,...e}))}))}),!0):!1},b1t=(t,e={})=>({state:n,dispatch:s})=>{const a=Td(t,n.schema);return Lyt(a,e)(n,s)},w1t=(t,e={})=>({state:n,dispatch:s})=>{const a=Td(t,n.schema);return Oyt(a,e)(n,s)};var j1t=Object.freeze({__proto__:null,blur:s0t,clearContent:a0t,clearNodes:i0t,command:o0t,createParagraphNear:l0t,cut:c0t,deleteCurrentNode:d0t,deleteNode:u0t,deleteRange:h0t,deleteSelection:f0t,enter:p0t,exitCode:m0t,extendMarkRange:g0t,first:x0t,focus:v0t,forEach:_0t,insertContent:b0t,insertContentAt:k0t,joinBackward:C0t,joinDown:S0t,joinForward:M0t,joinItemBackward:T0t,joinItemForward:A0t,joinTextblockBackward:E0t,joinTextblockForward:I0t,joinUp:N0t,keyboardShortcut:L0t,lift:O0t,liftEmptyBlock:D0t,liftListItem:R0t,newlineInCode:F0t,resetAttributes:z0t,scrollIntoView:B0t,selectAll:$0t,selectNodeBackward:U0t,selectNodeForward:q0t,selectParentNode:V0t,selectTextblockEnd:H0t,selectTextblockStart:W0t,setContent:G0t,setMark:a1t,setMeta:i1t,setNode:o1t,setNodeSelection:l1t,setTextSelection:c1t,sinkListItem:d1t,splitBlock:u1t,splitListItem:h1t,toggleList:f1t,toggleMark:p1t,toggleNode:m1t,toggleWrap:g1t,undoInputRule:x1t,unsetAllMarks:y1t,unsetMark:v1t,updateAttributes:_1t,wrapIn:b1t,wrapInList:w1t});const k1t=tu.create({name:"commands",addCommands(){return{...j1t}}}),N1t=tu.create({name:"drop",addProseMirrorPlugins(){return[new nd({key:new bu("tiptapDrop"),props:{handleDrop:(t,e,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:s})}}})]}}),S1t=tu.create({name:"editable",addProseMirrorPlugins(){return[new nd({key:new bu("editable"),props:{editable:()=>this.editor.options.editable}})]}}),C1t=new bu("focusEvents"),M1t=tu.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new nd({key:C1t,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}}}})]}}),T1t=tu.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:i})=>{const{selection:u,doc:p}=i,{empty:x,$anchor:y}=u,{pos:_,parent:w}=y,S=y.parent.isTextblock&&_>0?i.doc.resolve(_-1):y,N=S.parent.type.spec.isolating,M=y.pos-y.parentOffset,E=N&&S.parent.childCount===1?M===y.pos:Sa.atStart(p).from===_;return!x||!w.type.isTextblock||w.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 xye()||AFe()?o:a},addProseMirrorPlugins(){return[new nd({key:new bu("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,u=Sa.atStart(e.doc).from,p=Sa.atEnd(e.doc).to;if(o||!(l===u&&i===p)||!_ye(n.doc))return;const _=n.tr,w=Kse({state:n,transaction:_}),{commands:S}=new Zse({editor:this.editor,state:w});if(S.clearNodes(),!!_.steps.length)return _}})]}}),A1t=tu.create({name:"paste",addProseMirrorPlugins(){return[new nd({key:new bu("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),E1t=tu.create({name:"tabindex",addProseMirrorPlugins(){return[new nd({key:new bu("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class qw{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 qw(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 qw(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 qw(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 u=new qw(i,this.editor,a,a?n:null);a&&(u.actualDepth=this.depth+1),e.push(new qw(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(u=>n[u]===l.node.attrs[u])&&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 I1t=`.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 P1t(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 L1t extends Uyt{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=P1t(I1t,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=jFe(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?[S1t,n0t.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),k1t,M1t,T1t,E1t,N1t,A1t].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 K4(a,this)}createCommandManager(){this.commandManager=new Zse({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=cfe(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=cfe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=MFe(n,this.options.autofocus);this.view=new cFe(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:G4.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 PFe(this.state,e)}isActive(e,n){const s=typeof e=="string"?e:null,a=typeof e=="string"?n:e;return r1t(this.state,s,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return pye(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` `,textSerializers:s={}}=e||{};return X0t(this.state.doc,{blockSeparator:n,textSerializers:{...NFe(this.schema),...s}})}get isEmpty(){return _ye(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 qw(n,this)}get $doc(){return this.$pos(0)}}function AC(t){return new Xse({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 u=i.search(/\S/),p=n.from+i.indexOf(l),x=p+l.length;if(vye(n.from,n.to,e.doc).filter(w=>w.mark.type.excluded.find(N=>N===t.type&&N!==w.mark.type)).filter(w=>w.to>p).length)return null;xn.from&&o.delete(n.from+u,p);const _=n.from+u+l.length;o.addMark(n.from+u,_,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}function LFe(t){return new Xse({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 u=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,u)}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 ufe(t){return new Xse({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 TE(t){return new Xse({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),u=l.doc.resolve(n.from).blockRange(),p=u&&Yxe(u,t.type,o);if(!p)return null;if(l.wrap(u,p),t.keepMarks&&t.editor){const{selection:y,storedMarks:_}=e,{splittableMarks:w}=t.editor.extensionManager,S=_||y.$to.parentOffset&&y.$from.marks();if(S){const N=S.filter(M=>w.includes(M.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&&yv(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(s,x))&&l.join(n.from-1)}})}let wu=class hfe{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(js(this,"addOptions",{name:this.name}))),this.storage=hi(js(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new hfe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Qse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new hfe(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(js(n,"addOptions",{name:n.name})),n.storage=hi(js(n,"addStorage",{name:n.name,options:n.options})),n}};function ak(t){return new Xyt({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],u=s[0];let p=n.to;if(i){const x=u.search(/\S/),y=n.from+u.indexOf(i),_=y+i.length;if(vye(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(M=>M===t.type&&M!==S.mark.type)).filter(S=>S.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 O1t(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 D1t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var OFe={exports:{}},Lce={};/** * @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 n4e;function R1t(){if(n4e)return Lce;n4e=1;var t=it;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 w=_(),S=s({inst:{value:w,getSnapshot:_}}),N=S[0].inst,M=S[1];return o(function(){N.value=w,N.getSnapshot=_,u(N)&&M({inst:N})},[y,w,_]),a(function(){return u(N)&&M({inst:N}),y(function(){u(N)&&M({inst:N})})},[y]),l(w),w}function u(y){var _=y.getSnapshot;y=y.value;try{var w=_();return!n(y,w)}catch{return!0}}function p(y,_){return _()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:i;return Lce.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:x,Lce}OFe.exports=R1t();var bye=OFe.exports;const F1t=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},z1t=({contentComponent:t})=>{const e=bye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return it.createElement(it.Fragment,null,Object.values(e))};function B1t(){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]:lge.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 $1t extends it.Component{constructor(e){var n;super(e),this.editorContentRef=it.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=B1t(),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 it.createElement(it.Fragment,null,it.createElement("div",{ref:F1t(n,this.editorContentRef),...s}),(e==null?void 0:e.contentComponent)&&it.createElement(z1t,{contentComponent:e.contentComponent}))}}const U1t=I.forwardRef((t,e)=>{const n=it.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return it.createElement($1t,{key:n,innerRef:e,...t})}),DFe=it.memo(U1t);var q1t=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},V1t=D1t(q1t),RFe={exports:{}},Oce={};/** * @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 s4e;function H1t(){if(s4e)return Oce;s4e=1;var t=it,e=bye;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,u=t.useDebugValue;return Oce.useSyncExternalStoreWithSelector=function(p,x,y,_,w){var S=o(null);if(S.current===null){var N={hasValue:!1,value:null};S.current=N}else N=S.current;S=i(function(){function E(U){if(!A){if(A=!0,P=U,U=_(U),w!==void 0&&N.hasValue){var V=N.value;if(w(V,U))return z=V}return z=U}if(V=z,s(P,U))return V;var K=_(U);return w!==void 0&&w(V,K)?V:(P=U,z=K)}var A=!1,P,z,R=y===void 0?null:y;return[function(){return E(x())},R===null?void 0:function(){return E(R())}]},[x,y,_,w]);var M=a(p,S[0],S[1]);return l(function(){N.hasValue=!0,N.value=M},[M]),u(M),M},Oce}RFe.exports=H1t();var W1t=RFe.exports;const G1t=typeof window<"u"?I.useLayoutEffect:I.useEffect;class K1t{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 Z1t(t){var e;const[n]=I.useState(()=>new K1t(t.editor)),s=W1t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:V1t);return G1t(()=>n.watch(t.editor),[t.editor,n]),I.useDebugValue(s),s}const Y1t=!1,ffe=typeof window>"u",X1t=ffe||!!(typeof window<"u"&&window.next);class wye{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?ffe||X1t?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 L1t(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?wye.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 FFe(t={},e=[]){const n=I.useRef(t);n.current=t;const[s]=I.useState(()=>new wye(n)),a=bye.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return I.useDebugValue(a),I.useEffect(s.onRender(e)),Z1t({editor:a,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),a}const Q1t=I.createContext({editor:null});Q1t.Consumer;const J1t=I.createContext({onDragStart:void 0}),evt=()=>I.useContext(J1t);it.forwardRef((t,e)=>{const{onDragStart:n}=evt(),s=t.as||"div";return it.createElement(s,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const tvt=/^\s*>\s$/,rvt=wu.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Vl(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[TE({find:tvt,type:this.type})]}}),nvt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,svt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,avt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ivt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ovt=qg.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",Vl(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[AC({find:nvt,type:this.type}),AC({find:avt,type:this.type})]},addPasteRules(){return[ak({find:svt,type:this.type}),ak({find:ivt,type:this.type})]}}),lvt="listItem",a4e="textStyle",i4e=/^\s*([-+*])\s$/,cvt=wu.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",Vl(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(lvt,this.editor.getAttributes(a4e)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=TE({find:i4e,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=TE({find:i4e,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(a4e),editor:this.editor})),[t]}}),dvt=/(^|[^`])`([^`]+)`(?!`)/,uvt=/(^|[^`])`([^`]+)`(?!`)/g,hvt=qg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Vl(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[AC({find:dvt,type:this.type})]},addPasteRules(){return[ak({find:uvt,type:this.type})]}}),fvt=/^```([a-z]+)?[\s\n]$/,pvt=/^~~~([a-z]+)?[\s\n]$/,mvt=wu.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",Vl(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(Sa.near(s.resolve(i))),!0)):t.commands.exitCode()}}},addInputRules(){return[ufe({find:fvt,type:this.type,getAttributes:t=>({language:t[1]})}),ufe({find:pvt,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new nd({key:new bu("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,u=i.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(ha.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),gvt=wu.create({name:"doc",topNode:!0,content:"block+"});function xvt(t={}){return new nd({view(e){return new yvt(e,t)}})}class yvt{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 w=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(w){let S=w.getBoundingClientRect(),N=y?S.bottom:S.top;y&&_&&(N=(N+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*i;s={left:S.left,right:S.right,top:N-M,bottom:N+M}}}}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 u=this.editorView.dom.offsetParent;this.element||(this.element=u.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(!u||u==document.body&&getComputedStyle(u).position=="static")p=-pageXOffset,x=-pageYOffset;else{let y=u.getBoundingClientRect(),_=y.width/u.offsetWidth,w=y.height/u.offsetHeight;p=y.left-u.scrollLeft*_,x=y.top-u.scrollTop*w}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=bRe(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 vvt=tu.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[xvt(this.options)]}});class ec extends Sa{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return ec.valid(s)?new ec(s):Sa.near(s)}content(){return Hn.empty}eq(e){return e instanceof ec&&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 ec(e.resolve(n.pos))}getBookmark(){return new jye(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!_vt(e)||!bvt(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&&ec.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 u=e.doc.resolve(a);if(ec.valid(u))return u}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(ec.valid(i))return i}return null}}}ec.prototype.visible=!1;ec.findFrom=ec.findGapCursorFrom;Sa.jsonID("gapcursor",ec);class jye{constructor(e){this.pos=e}map(e){return new jye(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ec.valid(n)?new ec(n):Sa.near(n)}}function zFe(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function _vt(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||zFe(a.type))return!0;if(a.inlineContent)return!1}}return!0}function bvt(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||zFe(a.type))return!0;if(a.inlineContent)return!1}}return!0}function wvt(){return new nd({props:{decorations:Svt,createSelectionBetween(t,e,n){return e.pos==n.pos&&ec.valid(n)?new ec(n):null},handleClick:kvt,handleKeyDown:jvt,handleDOMEvents:{beforeinput:Nvt}}})}const jvt=lye({ArrowLeft:VL("horiz",-1),ArrowRight:VL("horiz",1),ArrowUp:VL("vert",-1),ArrowDown:VL("vert",1)});function VL(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,u=l.empty;if(l instanceof ha){if(!o.endOfTextblock(n)||i.depth==0)return!1;u=!1,i=s.doc.resolve(e>0?i.after():i.before())}let p=ec.findGapCursorFrom(i,e,u);return p?(a&&a(s.tr.setSelection(new ec(p))),!0):!1}}function kvt(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!ec.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 ec(s))),!0)}function Nvt(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ec))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=ln.empty;for(let l=s.length-1;l>=0;l--)a=ln.from(s[l].createAndFill(null,a));let o=t.state.tr.replace(n.pos,n.pos,new Hn(a,0,0));return o.setSelection(ha.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Svt(t){if(!(t.selection instanceof ec))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Jl.create(t.doc,[Uu.widget(t.selection.head,e,{key:"gapcursor"})])}const Cvt=tu.create({name:"gapCursor",addProseMirrorPlugins(){return[wvt()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=hi(js(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),Mvt=wu.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",Vl(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,u=o||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:p,dispatch:x})=>{if(x&&u&&l){const y=u.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()}}}),Tvt=wu.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]}`,Vl(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=>ufe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Kte=200,Sd=function(){};Sd.prototype.append=function(e){return e.length?(e=Sd.from(e),!this.length&&e||e.length=n?Sd.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Sd.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Sd.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)};Sd.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};Sd.from=function(e){return e instanceof Sd?e:e&&e.length?new BFe(e):Sd.empty};var BFe=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 u=o;u=l;u--)if(a(this.values[u],i+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=Kte)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Kte)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}(Sd);Sd.empty=new BFe([]);var Avt=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}(Sd);const Evt=500;class um{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,u,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 ig(y.map));let w=y.step.map(a.slice(o)),S;w&&l.maybeStep(w).doc&&(S=l.mapping.maps[l.mapping.maps.length-1],p.push(new ig(S,void 0,void 0,p.length+x.length))),o--,S&&a.appendMap(S,o)}else l.maybeStep(y.step);if(y.selection)return i=a?y.selection.map(a.slice(o)):y.selection,u=new um(this.items.slice(0,s).append(x.reverse().concat(p)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:i}}addTransform(e,n,s,a){let o=[],l=this.eventCount,i=this.items,u=!a&&i.length?i.get(i.length-1):null;for(let x=0;xPvt&&(i=Ivt(i,p),l-=p),new um(i.append(o),l)}remapping(e,n){let s=new wE;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 um(this.items.append(e.map(n=>new ig(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 u=n;this.items.forEach(_=>{let w=o.getMirror(--u);if(w==null)return;l=Math.min(l,w);let S=o.maps[w];if(_.step){let N=e.steps[w].invert(e.docs[w]),M=_.selection&&_.selection.map(o.slice(u+1,w));M&&i++,s.push(new ig(S,N,M))}else s.push(new ig(S))},a);let p=[];for(let _=n;_Evt&&(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 u=l.step.map(n.slice(s)),p=u&&u.getMap();if(s--,p&&n.appendMap(p,s),u){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new ig(p.invert(),u,x),_,w=a.length-1;(_=a.length&&a[w].merge(y))?a[w]=_:a.push(y)}}else l.map&&s--},this.items.length,0),new um(Sd.from(a.reverse()),o)}}um.empty=new um(Sd.empty,0);function Ivt(t,e){let n;return t.forEach((s,a)=>{if(s.selection&&e--==0)return n=a,!1}),t.slice(n)}class ig{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 ig(n.getMap().invert(),n,this.selection)}}}class U0{constructor(e,n,s,a,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=a,this.prevComposition=o}}const Pvt=20;function Lvt(t,e,n,s){let a=n.getMeta(Fj),o;if(a)return a.historyState;n.getMeta(Rvt)&&(t=new U0(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(Fj))return l.getMeta(Fj).redo?new U0(t.done.addTransform(n,void 0,s,Nee(e)),t.undone,o4e(n.mapping.maps),t.prevTime,t.prevComposition):new U0(t.done,t.undone.addTransform(n,void 0,s,Nee(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=n.getMeta("composition"),u=t.prevTime==0||!l&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-s.newGroupDelay||!Ovt(n,t.prevRanges)),p=l?Dce(t.prevRanges,n.mapping):o4e(n.mapping.maps);return new U0(t.done.addTransform(n,u?e.selection.getBookmark():void 0,s,Nee(e)),um.empty,p,n.time,i??t.prevComposition)}else return(o=n.getMeta("rebased"))?new U0(t.done.rebased(n,o),t.undone.rebased(n,o),Dce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new U0(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Dce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Ovt(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 o4e(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 Dce(t,e){if(!t)return null;let n=[];for(let s=0;s{let a=Fj.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(s){let o=Dvt(a,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const UFe=$Fe(!1,!0),qFe=$Fe(!0,!0),zvt=tu.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>UFe(t,e),redo:()=>({state:t,dispatch:e})=>qFe(t,e)}},addProseMirrorPlugins(){return[Fvt(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()}}}),Bvt=wu.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Vl(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!O1t(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}):n1t(n)?o.insertContentAt(a.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:i})=>{var u;if(i){const{$to:p}=l.selection,x=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(ha.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(aa.create(l.doc,p.pos)):l.setSelection(ha.create(l.doc,p.pos));else{const y=(u=p.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();y&&(l.insert(x,y),l.setSelection(ha.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[LFe({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),$vt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Uvt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,qvt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Vvt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Hvt=qg.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",Vl(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[AC({find:$vt,type:this.type}),AC({find:qvt,type:this.type})]},addPasteRules(){return[ak({find:Uvt,type:this.type}),ak({find:Vvt,type:this.type})]}}),Wvt=wu.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Vl(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)}}}),Gvt="listItem",c4e="textStyle",d4e=/^(\d+)\.\s$/,Kvt=wu.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",Vl(this.options.HTMLAttributes,n),0]:["ol",Vl(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(Gvt,this.editor.getAttributes(c4e)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=TE({find:d4e,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=TE({find:d4e,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(c4e)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Zvt=wu.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Vl(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Yvt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Xvt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qvt=qg.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",Vl(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[AC({find:Yvt,type:this.type})]},addPasteRules(){return[ak({find:Xvt,type:this.type})]}}),Jvt=wu.create({name:"text",group:"inline"}),VFe=tu.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(ovt.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(rvt.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(cvt.configure(this.options.bulletList)),this.options.code!==!1&&t.push(hvt.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(mvt.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(gvt.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(vvt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(Cvt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(Mvt.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Tvt.configure(this.options.heading)),this.options.history!==!1&&t.push(zvt.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(Bvt.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Hvt.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Wvt.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Kvt.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Zvt.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Qvt.configure(this.options.strike)),this.options.text!==!1&&t.push(Jvt.configure(this.options.text)),t}}),e_t="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",t_t="ελ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",pfe="numeric",mfe="ascii",gfe="alpha",TA="asciinumeric",NT="alphanumeric",xfe="domain",HFe="emoji",r_t="scheme",n_t="slashscheme",Fce="whitespace";function s_t(t,e){return t in e||(e[t]=[]),e[t]}function ej(t,e,n){e[pfe]&&(e[TA]=!0,e[NT]=!0),e[mfe]&&(e[TA]=!0,e[gfe]=!0),e[TA]&&(e[NT]=!0),e[gfe]&&(e[NT]=!0),e[NT]&&(e[xfe]=!0),e[HFe]&&(e[xfe]=!0);for(const s in e){const a=s_t(s,n);a.indexOf(t)<0&&a.push(t)}}function a_t(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function yh(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}yh.groups={};yh.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),Gl=(t,e,n,s,a)=>t.tr(e,n,s,a),u4e=(t,e,n,s,a)=>t.ts(e,n,s,a),Mn=(t,e,n,s,a)=>t.tt(e,n,s,a),Tx="WORD",yfe="UWORD",WFe="ASCIINUMERICAL",GFe="ALPHANUMERICAL",AE="LOCALHOST",vfe="TLD",_fe="UTLD",See="SCHEME",L4="SLASH_SCHEME",kye="NUM",bfe="WS",Nye="NL",AA="OPENBRACE",EA="CLOSEBRACE",Zte="OPENBRACKET",Yte="CLOSEBRACKET",Xte="OPENPAREN",Qte="CLOSEPAREN",Jte="OPENANGLEBRACKET",ere="CLOSEANGLEBRACKET",tre="FULLWIDTHLEFTPAREN",rre="FULLWIDTHRIGHTPAREN",nre="LEFTCORNERBRACKET",sre="RIGHTCORNERBRACKET",are="LEFTWHITECORNERBRACKET",ire="RIGHTWHITECORNERBRACKET",ore="FULLWIDTHLESSTHAN",lre="FULLWIDTHGREATERTHAN",cre="AMPERSAND",dre="APOSTROPHE",ure="ASTERISK",q0="AT",hre="BACKSLASH",fre="BACKTICK",pre="CARET",X0="COLON",Sye="COMMA",mre="DOLLAR",og="DOT",gre="EQUALS",Cye="EXCLAMATION",Bf="HYPHEN",IA="PERCENT",xre="PIPE",yre="PLUS",vre="POUND",PA="QUERY",Mye="QUOTE",KFe="FULLWIDTHMIDDLEDOT",Tye="SEMI",lg="SLASH",LA="TILDE",_re="UNDERSCORE",ZFe="EMOJI",bre="SYM";var YFe=Object.freeze({__proto__:null,ALPHANUMERICAL:GFe,AMPERSAND:cre,APOSTROPHE:dre,ASCIINUMERICAL:WFe,ASTERISK:ure,AT:q0,BACKSLASH:hre,BACKTICK:fre,CARET:pre,CLOSEANGLEBRACKET:ere,CLOSEBRACE:EA,CLOSEBRACKET:Yte,CLOSEPAREN:Qte,COLON:X0,COMMA:Sye,DOLLAR:mre,DOT:og,EMOJI:ZFe,EQUALS:gre,EXCLAMATION:Cye,FULLWIDTHGREATERTHAN:lre,FULLWIDTHLEFTPAREN:tre,FULLWIDTHLESSTHAN:ore,FULLWIDTHMIDDLEDOT:KFe,FULLWIDTHRIGHTPAREN:rre,HYPHEN:Bf,LEFTCORNERBRACKET:nre,LEFTWHITECORNERBRACKET:are,LOCALHOST:AE,NL:Nye,NUM:kye,OPENANGLEBRACKET:Jte,OPENBRACE:AA,OPENBRACKET:Zte,OPENPAREN:Xte,PERCENT:IA,PIPE:xre,PLUS:yre,POUND:vre,QUERY:PA,QUOTE:Mye,RIGHTCORNERBRACKET:sre,RIGHTWHITECORNERBRACKET:ire,SCHEME:See,SEMI:Tye,SLASH:lg,SLASH_SCHEME:L4,SYM:bre,TILDE:LA,TLD:vfe,UNDERSCORE:_re,UTLD:_fe,UWORD:yfe,WORD:Tx,WS:bfe});const kx=/[a-z]/,JM=new RegExp("\\p{L}","u"),zce=new RegExp("\\p{Emoji}","u"),Nx=/\d/,Bce=/\s/,h4e="\r",$ce=` `,i_t="️",o_t="‍",Uce="";let HL=null,WL=null;function l_t(t=[]){const e={};yh.groups=e;const n=new yh;HL==null&&(HL=f4e(e_t)),WL==null&&(WL=f4e(t_t)),Mn(n,"'",dre),Mn(n,"{",AA),Mn(n,"}",EA),Mn(n,"[",Zte),Mn(n,"]",Yte),Mn(n,"(",Xte),Mn(n,")",Qte),Mn(n,"<",Jte),Mn(n,">",ere),Mn(n,"(",tre),Mn(n,")",rre),Mn(n,"「",nre),Mn(n,"」",sre),Mn(n,"『",are),Mn(n,"』",ire),Mn(n,"<",ore),Mn(n,">",lre),Mn(n,"&",cre),Mn(n,"*",ure),Mn(n,"@",q0),Mn(n,"`",fre),Mn(n,"^",pre),Mn(n,":",X0),Mn(n,",",Sye),Mn(n,"$",mre),Mn(n,".",og),Mn(n,"=",gre),Mn(n,"!",Cye),Mn(n,"-",Bf),Mn(n,"%",IA),Mn(n,"|",xre),Mn(n,"+",yre),Mn(n,"#",vre),Mn(n,"?",PA),Mn(n,'"',Mye),Mn(n,"/",lg),Mn(n,";",Tye),Mn(n,"~",LA),Mn(n,"_",_re),Mn(n,"\\",hre),Mn(n,"・",KFe);const s=Gl(n,Nx,kye,{[pfe]:!0});Gl(s,Nx,s);const a=Gl(s,kx,WFe,{[TA]:!0}),o=Gl(s,JM,GFe,{[NT]:!0}),l=Gl(n,kx,Tx,{[mfe]:!0});Gl(l,Nx,a),Gl(l,kx,l),Gl(a,Nx,a),Gl(a,kx,a);const i=Gl(n,JM,yfe,{[gfe]:!0});Gl(i,kx),Gl(i,Nx,o),Gl(i,JM,i),Gl(o,Nx,o),Gl(o,kx),Gl(o,JM,o);const u=Mn(n,$ce,Nye,{[Fce]:!0}),p=Mn(n,h4e,bfe,{[Fce]:!0}),x=Gl(n,Bce,bfe,{[Fce]:!0});Mn(n,Uce,x),Mn(p,$ce,u),Mn(p,Uce,x),Gl(p,Bce,x),Mn(x,h4e),Mn(x,$ce),Gl(x,Bce,x),Mn(x,Uce,x);const y=Gl(n,zce,ZFe,{[HFe]:!0});Mn(y,"#"),Gl(y,zce,y),Mn(y,i_t,y);const _=Mn(y,o_t);Mn(_,"#"),Gl(_,zce,y);const w=[[kx,l],[Nx,a]],S=[[kx,null],[JM,i],[Nx,o]];for(let N=0;NN[0]>M[0]?1:-1);for(let N=0;N=0?A[xfe]=!0:kx.test(M)?Nx.test(M)?A[TA]=!0:A[mfe]=!0:A[pfe]=!0,u4e(n,M,M,A)}return u4e(n,"localhost",AE,{ascii:!0}),n.jd=new yh(bre),{start:n,tokens:Object.assign({groups:e},YFe)}}function XFe(t,e){const n=c_t(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 c_t(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 M0(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 EE={defaultProtocol:"http",events:null,format:p4e,formatHref:p4e,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Aye(t,e=null){let n=Object.assign({},EE);t&&(n=Object.assign(n,t instanceof Aye?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=EE.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),u=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),u&&(l.target=u),p&&(l.rel=p),x&&Object.assign(l,x),{tagName:a,attributes:l,content:o,eventListeners:y}}};function eae(t,e){class n extends QFe{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 m4e=eae("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),g4e=eae("text"),d_t=eae("nl"),GL=eae("url",{isLink:!0,toHref(t=EE.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==AE&&t[1].t===X0}}),Df=t=>new yh(t);function u_t({groups:t}){const e=t.domain.concat([cre,ure,q0,hre,fre,pre,mre,gre,Bf,kye,IA,xre,yre,vre,lg,bre,LA,_re]),n=[dre,X0,Sye,og,Cye,IA,PA,Mye,Tye,Jte,ere,AA,EA,Yte,Zte,Xte,Qte,tre,rre,nre,sre,are,ire,ore,lre],s=[cre,dre,ure,hre,fre,pre,mre,gre,Bf,AA,EA,IA,xre,yre,vre,PA,lg,bre,LA,_re],a=Df(),o=Mn(a,LA);ui(o,s,o),ui(o,t.domain,o);const l=Df(),i=Df(),u=Df();ui(a,t.domain,l),ui(a,t.scheme,i),ui(a,t.slashscheme,u),ui(l,s,o),ui(l,t.domain,l);const p=Mn(l,q0);Mn(o,q0,p),Mn(i,q0,p),Mn(u,q0,p);const x=Mn(o,og);ui(x,s,o),ui(x,t.domain,o);const y=Df();ui(p,t.domain,y),ui(y,t.domain,y);const _=Mn(y,og);ui(_,t.domain,y);const w=Df(m4e);ui(_,t.tld,w),ui(_,t.utld,w),Mn(p,AE,w);const S=Mn(y,Bf);Mn(S,Bf,S),ui(S,t.domain,y),ui(w,t.domain,y),Mn(w,og,_),Mn(w,Bf,S);const N=Mn(w,X0);ui(N,t.numeric,m4e);const M=Mn(l,Bf),E=Mn(l,og);Mn(M,Bf,M),ui(M,t.domain,l),ui(E,s,o),ui(E,t.domain,l);const A=Df(GL);ui(E,t.tld,A),ui(E,t.utld,A),ui(A,t.domain,l),ui(A,s,o),Mn(A,og,E),Mn(A,Bf,M),Mn(A,q0,p);const P=Mn(A,X0),z=Df(GL);ui(P,t.numeric,z);const R=Df(GL),U=Df();ui(R,e,R),ui(R,n,U),ui(U,e,R),ui(U,n,U),Mn(A,lg,R),Mn(z,lg,R);const V=Mn(i,X0),K=Mn(u,X0),W=Mn(K,lg),J=Mn(W,lg);ui(i,t.domain,l),Mn(i,og,E),Mn(i,Bf,M),ui(u,t.domain,l),Mn(u,og,E),Mn(u,Bf,M),ui(V,t.domain,R),Mn(V,lg,R),Mn(V,PA,R),ui(J,t.domain,R),ui(J,e,R),Mn(J,lg,R);const ae=[[AA,EA],[Zte,Yte],[Xte,Qte],[Jte,ere],[tre,rre],[nre,sre],[are,ire],[ore,lre]];for(let oe=0;oe=0&&_++,a++,x++;if(_<0)a-=x,a0&&(o.push(qce(g4e,e,l)),l=[]),a-=_,x-=_;const w=y.t,S=n.slice(a-x,a);o.push(qce(w,e,S))}}return l.length>0&&o.push(qce(g4e,e,l)),o}function qce(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 f_t=typeof console<"u"&&console&&console.warn||(()=>{}),p_t="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",hl={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function m_t(){return yh.groups={},hl.scanner=null,hl.parser=null,hl.tokenQueue=[],hl.pluginQueue=[],hl.customSchemes=[],hl.initialized=!1,hl}function x4e(t,e=!1){if(hl.initialized&&f_t(`linkifyjs: already initialized - will not register custom scheme "${t}" ${p_t}`),!/^[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`);hl.customSchemes.push([t,e])}function g_t(){hl.scanner=l_t(hl.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=K0t(n.doc,[...e]);if(t1t(i).forEach(({newRange:p})=>{const x=Y0t(s.doc,p,w=>w.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 w=s.doc.textBetween(p.from,p.to," "," ");if(!y_t.test(w))return;y=x[0],_=s.doc.textBetween(y.pos,p.to,void 0," ")}if(y&&_){const w=_.split(x_t).filter(Boolean);if(w.length<=0)return!1;const S=w[w.length-1],N=y.pos+_.lastIndexOf(S);if(!S)return!1;const M=Eye(S).map(E=>E.toObject(t.defaultProtocol));if(!__t(M))return!1;M.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=>{vye(E.from,E.to,s.doc).some(A=>A.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function w_t(t){return new nd({key:new bu("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 u=PFe(e.state,t.type.name),p=s.target,x=(a=p==null?void 0:p.href)!==null&&a!==void 0?a:u.href,y=(o=p==null?void 0:p.target)!==null&&o!==void 0?o:u.target;return p&&x?(window.open(x,y),!0):!1}}})}function j_t(t){return new nd({key:new bu("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 u=JFe(i,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===i);return!i||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function x_(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(v_t,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const eze=qg.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"){x4e(t);return}x4e(t.scheme,t.optionalSlashes)})},onDestroy(){m_t()},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)=>!!x_(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=>!!x_(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=>!!x_(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Vl(this.options.HTMLAttributes,t),0]:["a",Vl(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!x_(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=>!!x_(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[ak({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,a=JFe(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!x_(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(b_t({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:a=>!!x_(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(w_t({type:this.type})),this.options.linkOnPaste&&t.push(j_t({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),tze=tu.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")}}}),k_t=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}`)})},rze=qg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&k_t(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Vl(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}}}}),N_t=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,S_t=wu.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Vl(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[LFe({find:N_t,type:this.type,getAttributes:t=>{const[,,e,n,s]=t;return{src:n,alt:e,title:s}}})]}});let wfe,jfe;if(typeof WeakMap<"u"){let t=new WeakMap;wfe=e=>t.get(e),jfe=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;wfe=s=>{for(let a=0;a(n==10&&(n=0),t[n++]=s,t[n++]=a)}var rc=class{constructor(t,e,n,s){this.width=t,this.height=e,this.map=n,this.problems=s}findCell(t){for(let e=0;e=n){(o||(o=[])).push({type:"overlong_rowspan",pos:x,n:E-P});break}const z=a+P*e;for(let R=0;Rs&&(o+=p.attrs.colspan)}}for(let l=0;l1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function T_t(t,e,n){t.problems||(t.problems=[]);const s={};for(let a=0;a0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function E_t(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Om(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function tae(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=j3(e.$head)||I_t(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function I_t(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const s=e.type.spec.tableRole;if(s=="cell"||s=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const s=e.type.spec.tableRole;if(s=="cell"||s=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function kfe(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function P_t(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Pye(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function nze(t,e,n){const s=t.node(-1),a=rc.get(s),o=t.start(-1),l=a.nextCell(t.pos-o,e,n);return l==null?null:t.node(0).resolve(o+l)}function ik(t,e,n=1){const s={...t,colspan:t.colspan-n};return s.colwidth&&(s.colwidth=s.colwidth.slice(),s.colwidth.splice(e,n),s.colwidth.some(a=>a>0)||(s.colwidth=null)),s}function sze(t,e,n=1){const s={...t,colspan:t.colspan+n};if(s.colwidth){s.colwidth=s.colwidth.slice();for(let a=0;ax!=n.pos-o);u.unshift(n.pos-o);const p=u.map(x=>{const y=s.nodeAt(x);if(!y)throw new RangeError(`No cell with offset ${x} found`);const _=o+x+1;return new SRe(i.resolve(_),i.resolve(_+y.content.size))});super(p[0].$from,p[0].$to,p),this.$anchorCell=e,this.$headCell=n}map(e,n){const s=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(kfe(s)&&kfe(a)&&Pye(s,a)){const o=this.$anchorCell.node(-1)!=s.node(-1);return o&&this.isRowSelection()?Ax.rowSelection(s,a):o&&this.isColSelection()?Ax.colSelection(s,a):new Ax(s,a)}return ha.between(s,a)}content(){const e=this.$anchorCell.node(-1),n=rc.get(e),s=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s),o={},l=[];for(let u=a.top;u0||M>0){let E=S.attrs;if(N>0&&(E=ik(E,0,N)),M>0&&(E=ik(E,E.colspan-M,M)),w.lefta.bottom){const E={...S.attrs,rowspan:Math.min(w.bottom,a.bottom)-Math.max(w.top,a.top)};w.top0)return!1;const s=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(s,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const s=e.node(-1),a=rc.get(s),o=e.start(-1),l=a.findCell(e.pos-o),i=a.findCell(n.pos-o),u=e.node(0);return l.top<=i.top?(l.top>0&&(e=u.resolve(o+a.map[l.left])),i.bottom0&&(n=u.resolve(o+a.map[i.left])),l.bottom0)return!1;const l=a+this.$anchorCell.nodeAfter.attrs.colspan,i=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,i)==n.width}eq(e){return e instanceof Ax&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const s=e.node(-1),a=rc.get(s),o=e.start(-1),l=a.findCell(e.pos-o),i=a.findCell(n.pos-o),u=e.node(0);return l.left<=i.left?(l.left>0&&(e=u.resolve(o+a.map[l.top*a.width])),i.right0&&(n=u.resolve(o+a.map[i.top*a.width])),l.right{e.push(Uu.node(s,s+n.nodeSize,{class:"selectedCell"}))}),Jl.create(t.doc,e)}function R_t({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(a+1)=0&&!(e.before(o+1)>e.start(o));o--,s--);return n==s&&/row|table/.test(t.node(a).type.spec.tableRole)}function F_t({$from:t,$to:e}){let n,s;for(let a=t.depth;a>0;a--){const o=t.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let a=e.depth;a>0;a--){const o=e.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){s=o;break}}return n!==s&&e.parentOffset===0}function z_t(t,e,n){const s=(e||t).selection,a=(e||t).doc;let o,l;if(s instanceof aa&&(l=s.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")o=nl.create(a,s.from);else if(l=="row"){const i=a.resolve(s.from+1);o=nl.rowSelection(i,i)}else if(!n){const i=rc.get(s.node),u=s.from+1,p=u+i.map[i.width*i.height-1];o=nl.create(a,u+1,p)}}else s instanceof ha&&R_t(s)?o=ha.create(a,s.from):s instanceof ha&&F_t(s)&&(o=ha.create(a,s.$from.start(),s.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}const B_t=new bu("fix-tables");function ize(t,e,n,s){const a=t.childCount,o=e.childCount;e:for(let l=0,i=0;l{a.type.spec.tableRole=="table"&&(n=$_t(t,a,o,n))};return e?e.doc!=t.doc&&ize(e.doc,t.doc,0,s):t.doc.descendants(s),n}function $_t(t,e,n,s){const a=rc.get(e);if(!a.problems)return s;s||(s=t.tr);const o=[];for(let u=0;u0){let w="cell";x.firstChild&&(w=x.firstChild.type.spec.tableRole);const S=[];for(let M=0;M<_;M++){const E=vu(t.schema)[w].createAndFill();E&&S.push(E)}const N=(u==0||l==u-1)&&i==u?p+1:y-1;s.insert(s.mapping.map(N),S)}p=y}return s.setMeta(B_t,{fixTables:!0})}function Zg(t){const e=t.selection,n=tae(t),s=n.node(-1),a=n.start(-1),o=rc.get(s);return{...e instanceof nl?o.rectBetween(e.$anchorCell.pos-a,e.$headCell.pos-a):o.findCell(n.pos-a),tableStart:a,map:o,table:s}}function lze(t,{map:e,tableStart:n,table:s},a){let o=a>0?-1:0;L_t(e,s,a+o)&&(o=a==0||a==e.width?null:0);for(let l=0;l0&&a0&&e.map[i-1]==u||a0?-1:0;W_t(e,s,a+i)&&(i=a==0||a==e.height?null:0);for(let p=0,x=e.width*a;p0&&a0&&y==e.map[x-e.width]){const _=n.nodeAt(y).attrs;t.setNodeMarkup(t.mapping.slice(i).map(y+s),null,{..._,rowspan:_.rowspan-1}),p+=_.colspan-1}else if(a0&&n[o]==n[o-1]||s.right0&&n[a]==n[a-t]||s.bottom0){const x=u+1+p.content.size,y=y4e(p)?u+1:x;o.replaceWith(y+s.tableStart,x+s.tableStart,i)}o.setSelection(new nl(o.doc.resolve(u+s.tableStart))),e(o)}return!0}function _4e(t,e){const n=vu(t.schema);return Q_t(({node:s})=>n[s.type.spec.tableRole])(t,e)}function Q_t(t){return(e,n)=>{const s=e.selection;let a,o;if(s instanceof nl){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;a=s.$anchorCell.nodeAfter,o=s.$anchorCell.pos}else{var l;if(a=E_t(s.$from),!a)return!1;o=(l=j3(s.$from))===null||l===void 0?void 0:l.pos}if(a==null||o==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let i=a.attrs;const u=[],p=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const x=Zg(e),y=e.tr;for(let w=0;w{l.attrs[t]!==e&&o.setNodeMarkup(i,null,{...l.attrs,[t]:e})}):o.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:e}),s(o)}return!0}}function e2t(t){return function(e,n){if(!Om(e))return!1;if(n){const s=vu(e.schema),a=Zg(e),o=e.tr,l=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),i=l.map(u=>a.table.nodeAt(u));for(let u=0;u{const w=_+o.tableStart,S=l.doc.nodeAt(w);S&&l.setNodeMarkup(w,y,S.attrs)}),s(l)}return!0}}IE("row",{useDeprecatedLogic:!0});IE("column",{useDeprecatedLogic:!0});const t2t=IE("cell",{useDeprecatedLogic:!0});function r2t(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let s=t.index(-1)-1,a=t.before();s>=0;s--){const o=t.node(-1).child(s),l=o.lastChild;if(l)return a-1-l.nodeSize;a-=o.nodeSize}}else{if(t.index()0;s--)if(n.node(s).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(s),n.after(s)).scrollIntoView()),!0;return!1}function KL(t,e){const n=t.selection;if(!(n instanceof nl))return!1;if(e){const s=t.tr,a=vu(t.schema).cell.createAndFill().content;n.forEachCell((o,l)=>{o.content.eq(a)||s.replace(s.mapping.map(l+1),s.mapping.map(l+o.nodeSize-1),new Hn(a,0,0))}),s.docChanged&&e(s)}return!0}function s2t(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:s}=t;for(;e.childCount==1&&(n>0&&s>0||e.child(0).type.spec.tableRole=="table");)n--,s--,e=e.child(0).content;const a=e.child(0),o=a.type.spec.tableRole,l=a.type.schema,i=[];if(o=="row")for(let u=0;u=0;l--){const{rowspan:i,colspan:u}=o.child(l).attrs;for(let p=a;p=e.length&&e.push(ln.empty),n[a]s&&(_=_.type.createChecked(ik(_.attrs,_.attrs.colspan,x+_.attrs.colspan-s),_.content)),p.push(_),x+=_.attrs.colspan;for(let w=1;w<_.attrs.rowspan;w++)o[i+w]=(o[i+w]||0)+_.attrs.colspan}l.push(ln.from(p))}n=l,t=s}if(e!=a){const o=[];for(let l=0,i=0;la&&(y=y.type.create({...y.attrs,rowspan:Math.max(1,a-y.attrs.rowspan)},y.content)),u.push(y)}o.push(ln.from(u))}n=o,e=a}return{width:t,height:e,rows:n}}function o2t(t,e,n,s,a,o,l){const i=t.doc.type.schema,u=vu(i);let p,x;if(a>e.width)for(let y=0,_=0;ye.height){const y=[];for(let S=0,N=(e.height-1)*e.width;S=e.width?!1:n.nodeAt(e.map[N+S]).type==u.header_cell;y.push(M?x||(x=u.header_cell.createAndFill()):p||(p=u.cell.createAndFill()))}const _=u.row.create(null,ln.from(y)),w=[];for(let S=e.height;S{if(!a)return!1;const o=n.selection;if(o instanceof nl)return Cee(n,s,Sa.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const l=dze(a,t,e);if(l==null)return!1;if(t=="horiz")return Cee(n,s,Sa.near(n.doc.resolve(o.head+e),e));{const i=n.doc.resolve(l),u=nze(i,t,e);let p;return u?p=Sa.near(u,1):e<0?p=Sa.near(n.doc.resolve(i.before(-1)),-1):p=Sa.near(n.doc.resolve(i.after(-1)),1),Cee(n,s,p)}}}function YL(t,e){return(n,s,a)=>{if(!a)return!1;const o=n.selection;let l;if(o instanceof nl)l=o;else{const u=dze(a,t,e);if(u==null)return!1;l=new nl(n.doc.resolve(u))}const i=nze(l.$headCell,t,e);return i?Cee(n,s,new nl(l.$anchorCell,i)):!1}}function c2t(t,e){const n=t.state.doc,s=j3(n.resolve(e));return s?(t.dispatch(t.state.tr.setSelection(new nl(s))),!0):!1}function d2t(t,e,n){if(!Om(t.state))return!1;let s=s2t(n);const a=t.state.selection;if(a instanceof nl){s||(s={width:1,height:1,rows:[ln.from(Nfe(vu(t.state.schema).cell,n))]});const o=a.$anchorCell.node(-1),l=a.$anchorCell.start(-1),i=rc.get(o).rectBetween(a.$anchorCell.pos-l,a.$headCell.pos-l);return s=i2t(s,i.right-i.left,i.bottom-i.top),N4e(t.state,t.dispatch,l,i,s),!0}else if(s){const o=tae(t.state),l=o.start(-1);return N4e(t.state,t.dispatch,l,rc.get(o.node(-1)).findCell(o.pos-l),s),!0}else return!1}function u2t(t,e){var n;if(e.ctrlKey||e.metaKey)return;const s=S4e(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof nl)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&s&&(a=j3(t.state.selection.$anchor))!=null&&((n=Vce(t,e))===null||n===void 0?void 0:n.pos)!=a.pos)o(a,e),e.preventDefault();else if(!s)return;function o(u,p){let x=Vce(t,p);const y=Q0.getState(t.state)==null;if(!x||!Pye(u,x))if(y)x=u;else return;const _=new nl(u,x);if(y||!t.state.selection.eq(_)){const w=t.state.tr.setSelection(_);y&&w.setMeta(Q0,u.pos),t.dispatch(w)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",i),Q0.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Q0,-1))}function i(u){const p=u,x=Q0.getState(t.state);let y;if(x!=null)y=t.state.doc.resolve(x);else if(S4e(t,p.target)!=s&&(y=Vce(t,e),!y))return l();y&&o(y,p)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",i)}function dze(t,e,n){if(!(t.state.selection instanceof ha))return null;const{$head:s}=t.state.selection;for(let a=s.depth-1;a>=0;a--){const o=s.node(a);if((n<0?s.index(a):s.indexAfter(a))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=s.before(a),i=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(i)?l:null}}return null}function S4e(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Vce(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;const s=n.inside>=0?n.inside:n.pos;return j3(t.state.doc.resolve(s))}var h2t=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Sfe(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Sfe(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Sfe(t,e,n,s,a,o){let l=0,i=!0,u=e.firstChild;const p=t.firstChild;if(p){for(let y=0,_=0;ynew s(y,n,_)),new p2t(-1,!1)},apply(l,i){return i.apply(l)}},props:{attributes:l=>{const i=rf.getState(l);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,i)=>{m2t(l,i,t,a)},mouseleave:l=>{g2t(l)},mousedown:(l,i)=>{x2t(l,i,e,n)}},decorations:l=>{const i=rf.getState(l);if(i&&i.activeHandle>-1)return w2t(l,i.activeHandle)},nodeViews:{}}});return o}var p2t=class Mee{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,s=e.getMeta(rf);if(s&&s.setHandle!=null)return new Mee(s.setHandle,!1);if(s&&s.setDragging!==void 0)return new Mee(n.activeHandle,s.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return kfe(e.doc.resolve(a))||(a=-1),new Mee(a,n.dragging)}return n}};function m2t(t,e,n,s){if(!t.editable)return;const a=rf.getState(t.state);if(a&&!a.dragging){const o=v2t(e.target);let l=-1;if(o){const{left:i,right:u}=o.getBoundingClientRect();e.clientX-i<=n?l=C4e(t,e,"left",n):u-e.clientX<=n&&(l=C4e(t,e,"right",n))}if(l!=a.activeHandle){if(!s&&l!==-1){const i=t.state.doc.resolve(l),u=i.node(-1),p=rc.get(u),x=i.start(-1);if(p.colCount(i.pos-x)+i.nodeAfter.attrs.colspan-1==p.width-1)return}uze(t,l)}}}function g2t(t){if(!t.editable)return;const e=rf.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&uze(t,-1)}function x2t(t,e,n,s){var a;if(!t.editable)return!1;const o=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,l=rf.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const i=t.state.doc.nodeAt(l.activeHandle),u=y2t(t,l.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(rf,{setDragging:{startX:e.clientX,startWidth:u}}));function p(y){o.removeEventListener("mouseup",p),o.removeEventListener("mousemove",x);const _=rf.getState(t.state);_!=null&&_.dragging&&(_2t(t,_.activeHandle,M4e(_.dragging,y,n)),t.dispatch(t.state.tr.setMeta(rf,{setDragging:null})))}function x(y){if(!y.which)return p(y);const _=rf.getState(t.state);if(_&&_.dragging){const w=M4e(_.dragging,y,n);T4e(t,_.activeHandle,w,s)}}return T4e(t,l.activeHandle,u,s),o.addEventListener("mouseup",p),o.addEventListener("mousemove",x),e.preventDefault(),!0}function y2t(t,e,{colspan:n,colwidth:s}){const a=s&&s[s.length-1];if(a)return a;const o=t.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,i=n;if(s)for(let u=0;u{const s=t.nodes[n];s.spec.tableRole&&(e[s.spec.tableRole]=s)}),t.cached.tableNodeTypes=e,e}function C2t(t,e,n,s,a){const o=S2t(t),l=[],i=[];for(let p=0;p{const{selection:e}=t.state;if(!M2t(e))return!1;let n=0;const s=IFe(e.ranges[0].$from,o=>o.type.name==="table");return s==null||s.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},T2t=wu.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:k2t,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:s,tableMinWidth:a}=N2t(t,this.options.cellMinWidth),o=["table",Vl(this.options.HTMLAttributes,e,{style:s?`width: ${s}`:`min-width: ${a}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:s,dispatch:a,editor:o})=>{const l=C2t(o.schema,t,e,n);if(a){const i=s.selection.from+1;s.replaceSelectionWith(l).scrollIntoView().setSelection(ha.near(s.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>U_t(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>q_t(t,e),deleteColumn:()=>({state:t,dispatch:e})=>H_t(t,e),addRowBefore:()=>({state:t,dispatch:e})=>G_t(t,e),addRowAfter:()=>({state:t,dispatch:e})=>K_t(t,e),deleteRow:()=>({state:t,dispatch:e})=>Y_t(t,e),deleteTable:()=>({state:t,dispatch:e})=>n2t(t,e),mergeCells:()=>({state:t,dispatch:e})=>v4e(t,e),splitCell:()=>({state:t,dispatch:e})=>_4e(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>IE("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>IE("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>t2t(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>v4e(t,e)?!0:_4e(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:s})=>J_t(t,e)(n,s),goToNextCell:()=>({state:t,dispatch:e})=>w4e(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>w4e(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&oze(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const s=nl.create(e.doc,t.anchorCell,t.headCell);e.setSelection(s)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:XL,"Mod-Backspace":XL,Delete:XL,"Mod-Delete":XL}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[f2t({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],j2t({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:hi(js(t,"tableRole",e))}}}),A2t=wu.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Vl(this.options.HTMLAttributes,t),0]}}),E2t=wu.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(s=>parseInt(s,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Vl(this.options.HTMLAttributes,t),0]}}),I2t=wu.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(s=>parseInt(s,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Vl(this.options.HTMLAttributes,t),0]}});function Yg({content:t,onChange:e,placeholder:n="Enter content...",minHeight:s="150px",compact:a=!1}){const[o,l]=I.useState(!1),[i,u]=I.useState(""),[p,x]=I.useState(!0),y=FFe({extensions:[VFe,eze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),tze.configure({types:["heading","paragraph"]}),rze,S_t.extend({addAttributes(){var N;return{...(N=this.parent)==null?void 0:N.call(this),width:{default:null},height:{default:null},style:{default:null}}}}).configure({inline:!0,allowBase64:!0}),T2t.extend({addAttributes(){var N;return{...(N=this.parent)==null?void 0:N.call(this),style:{default:null},width:{default:null},cellpadding:{default:null},cellspacing:{default:null},border:{default:null}}}}).configure({resizable:!1}),A2t.extend({addAttributes(){var N;return{...(N=this.parent)==null?void 0:N.call(this),style:{default:null}}}}),E2t.extend({addAttributes(){var N;return{...(N=this.parent)==null?void 0:N.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1},valign:{default:null}}}}),I2t.extend({addAttributes(){var N;return{...(N=this.parent)==null?void 0:N.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1}}}})],content:t,onUpdate:({editor:N})=>{e(N.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n},handlePaste:(N,M)=>{var A;const E=(A=M.clipboardData)==null?void 0:A.items;if(!E)return!1;for(const P of Array.from(E))if(P.type.startsWith("image/")){M.preventDefault();const z=P.getAsFile();if(!z)continue;const R=new FileReader;return R.onload=U=>{var K;const V=(K=U.target)==null?void 0:K.result;N.dispatch(N.state.tr.replaceSelectionWith(N.state.schema.nodes.image.create({src:V})))},R.readAsDataURL(z),!0}return!1}}});I.useEffect(()=>{y&&t!==y.getHTML()&&y.commands.setContent(t)},[t,y]);const _=()=>{if(!y)return;const N=y.getAttributes("link").href||"",M=y.getAttributes("link").target;u(N),x(M==="_blank"),l(!0)},w=()=>{y&&(i===""?y.chain().focus().extendMarkRange("link").unsetLink().run():y.chain().focus().extendMarkRange("link").setLink({href:i,target:p?"_blank":null,rel:p?"noopener noreferrer nofollow":null}).run(),l(!1),u(""))},S=()=>{y&&y.chain().focus().extendMarkRange("link").unsetLink().run()};return y?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),className:y.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(WT,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),className:y.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(GT,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBold().run(),className:y.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(dS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleItalic().run(),className:y.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(gS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBulletList().run(),className:y.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(rp,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleOrderedList().run(),className:y.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(vS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("left").run(),className:y.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(lS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("center").run(),className:y.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(oS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("right").run(),className:y.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(cS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:_,className:y.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(Mo,{className:"h-4 w-4"})}),y.isActive("link")&&r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:S,title:"Remove Link",children:r.jsx(Mo,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo(),title:"Undo",children:r.jsx(CS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo(),title:"Redo",children:r.jsx(kS,{className:"h-4 w-4"})})]}),r.jsx(DFe,{editor:y,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror_img]:max-w-none [&_.ProseMirror_table]:border-none [&_.ProseMirror_table]:border-collapse [&_.ProseMirror_td]:border-none [&_.ProseMirror_td]:p-0 [&_.ProseMirror_td]:align-top [&_.ProseMirror_th]:border-none [&_.ProseMirror_th]:p-0 [&_.ProseMirror_tr]:border-none",style:{minHeight:s}})]}),r.jsx(Dr,{open:o,onOpenChange:l,children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsx(Br,{children:r.jsx(zr,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"link-url",children:"URL"}),r.jsx(ot,{id:"link-url",value:i,onChange:N=>u(N.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ss,{id:"link-new-tab",checked:p,onCheckedChange:x}),r.jsx(qe,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(te,{type:"button",onClick:w,children:i?"Apply Link":"Remove Link"})]})]})})]}):null}var P2t=Object.defineProperty,L2t=(t,e,n)=>e in t?P2t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wl=(t,e,n)=>L2t(t,typeof e!="symbol"?e+"":e,n);const wre={x:0,y:0,width:0,height:0,unit:"px"},b4=(t,e,n)=>Math.min(Math.max(t,e),n),O2t=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),I4e=(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 D2t(t,e,n,s){const a=cg(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==="%"?V0(a,n,s):a}function R2t(t,e,n){const s=cg(t,e,n);return s.x=(e-s.width)/2,s.y=(n-s.height)/2,t.unit==="%"?V0(s,e,n):s}function V0(t,e,n){return t.unit==="%"?{...wre,...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 cg(t,e,n){return t.unit?t.unit==="px"?{...wre,...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}:{...wre,...t,unit:"px"}}function P4e(t,e,n,s,a,o=0,l=0,i=s,u=a){const p={...t};let x=Math.min(o,s),y=Math.min(l,a),_=Math.min(i,s),w=Math.min(u,a);e&&(e>1?(x=l?l*e:x,y=x/e,_=i*e):(y=o?o/e:y,x=y*e,w=u/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 S=s-(p.x+p.width);S<0&&(p.x=Math.min(p.x,s-x),p.width+=S);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>w&&((n==="nw"||n=="ne")&&(p.y-=w-p.height),p.height=w),e){const M=p.width/p.height;if(Me){const E=Math.max(p.height*e,x);(n==="sw"||n=="nw")&&(p.x-=E-p.width),p.width=E}}return p}function F2t(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 w4={capture:!0,passive:!1};let z2t=0;const I0=class Xp extends I.PureComponent{constructor(){super(...arguments),wl(this,"docMoveBound",!1),wl(this,"mouseDownOnCrop",!1),wl(this,"dragStarted",!1),wl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),wl(this,"componentRef",I.createRef()),wl(this,"mediaRef",I.createRef()),wl(this,"resizeObserver"),wl(this,"initChangeCalled",!1),wl(this,"instanceId",`rc-${z2t++}`),wl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),wl(this,"onCropPointerDown",e=>{const{crop:n,disabled:s}=this.props,a=this.getBox();if(!n)return;const o=cg(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 u=e.clientX,p=e.clientY,x=o.x,y=o.y;if(l){const _=e.clientX-a.x,w=e.clientY-a.y;let S=0,N=0;l==="ne"||l=="e"?(S=_-(o.x+o.width),N=w-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(S=_-(o.x+o.width),N=w-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(S=_-o.x,N=w-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(S=_-o.x,N=w-o.y,x=o.x+o.width,y=o.y+o.height),u=x+a.x+S,p=y+a.y+N}this.evData={startClientX:u,startClientY:p,startCropX:x,startCropY:y,clientX:e.clientX,clientY:e.clientY,isResize:i,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),wl(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 u=e.clientX-i.x,p=e.clientY-i.y,x={unit:"px",x:u,y:p,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:u,startCropY:p,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(cg(x,i.width,i.height),V0(x,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),wl(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 u;i.isResize?u=this.resizeCrop():u=this.dragCrop(),I4e(n,u)||a(cg(u,l.width,l.height),V0(u,l.width,l.height))}),wl(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 u=this.getBox(),p=this.makePixelCrop(u),x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Xp.nudgeStepLarge:e.shiftKey?Xp.nudgeStepMedium:Xp.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=b4(p.x,0,u.width-p.width),p.y=b4(p.y,0,u.height-p.height);const y=cg(p,u.width,u.height),_=V0(p,u.width,u.height);a(y,_),o&&o(y,_)}}),wl(this,"onHandlerKeyDown",(e,n)=>{const{aspect:s=0,crop:a,disabled:o,minWidth:l=0,minHeight:i=0,maxWidth:u,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 w=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Xp.nudgeStepLarge:e.shiftKey?Xp.nudgeStepMedium:Xp.nudgeStep,S=cg(a,_.width,_.height),N=F2t(S,e.key,w,n),M=P4e(N,s,n,_.width,_.height,l,i,u,p);if(!I4e(a,M)){const E=V0(M,_.width,_.height);x(M,E),y&&y(M,E)}}),wl(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(cg(n,l.width,l.height),V0(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),wl(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(cg(n,a,o),V0(n,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,w4),this.document.addEventListener("pointerup",this.onDocPointerDone,w4),this.document.addEventListener("pointercancel",this.onDocPointerDone,w4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,w4),this.document.removeEventListener("pointerup",this.onDocPointerDone,w4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,w4),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=b4(e.startCropX+a,0,n.width-s.width),s.y=b4(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 u;a&&n?u=n==="nw"||n==="n"||n==="ne":u=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 u=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 w={unit:"px",x:0,y:0,width:0,height:0};p==="ne"?(w.x=e.startCropX,w.width=y,n?(w.height=w.width/n,w.y=e.startCropY-w.height):(w.height=Math.abs(_),w.y=e.startCropY-w.height)):p==="se"?(w.x=e.startCropX,w.y=e.startCropY,w.width=y,n?w.height=w.width/n:w.height=_):p==="sw"?(w.x=e.startCropX+y,w.y=e.startCropY,w.width=Math.abs(y),n?w.height=w.width/n:w.height=_):p==="nw"&&(w.x=e.startCropX+y,w.width=Math.abs(y),n?(w.height=w.width/n,w.y=e.startCropY-w.height):(w.height=Math.abs(_),w.y=e.startCropY+_));const S=P4e(w,n,p,o.width,o.height,l,i,s,a);return n||Xp.xyOrds.indexOf(x)>-1?u=S:Xp.xOrds.indexOf(x)>-1?(u.x=S.x,u.width=S.width):Xp.yOrds.indexOf(x)>-1&&(u.y=S.y,u.height=S.height),u.x=b4(u.x,0,o.width-u.width),u.y=b4(u.y,0,o.height-u.height),u}renderCropSelection(){const{ariaLabels:e=Xp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return it.createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&&it.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},it.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),it.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),it.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),it.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"nw"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"n"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"ne"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"e"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"se"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"s"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"sw"),role:"button"}),it.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"w"),role:"button"})),a&&it.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:u=>u.stopPropagation()},a(this.state)),o&&it.createElement(it.Fragment,null,it.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),it.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){const n={...wre,...this.props.crop||{}};return cg(n,e.width,e.height)}render(){const{aspect:e,children:n,circularCrop:s,className:a,crop:o,disabled:l,locked:i,style:u,ruleOfThirds:p}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,_=o?this.renderCropSelection():null,w=O2t("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 it.createElement("div",{ref:this.componentRef,className:w,style:u},it.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?it.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},it.createElement("defs",null,it.createElement("mask",{id:`hole-${this.instanceId}`},it.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?it.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"}):it.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),it.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,_)}};wl(I0,"xOrds",["e","w"]),wl(I0,"yOrds",["n","s"]),wl(I0,"xyOrds",["nw","ne","se","sw"]),wl(I0,"nudgeStep",1),wl(I0,"nudgeStepMedium",10),wl(I0,"nudgeStepLarge",100),wl(I0,"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 B2t=I0;var hze=["PageUp","PageDown"],fze=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pze={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},k3="Slider",[Mfe,$2t,U2t]=jI(k3),[mze]=lc(k3,[U2t]),[q2t,rae]=mze(k3),gze=I.forwardRef((t,e)=>{const{name:n,min:s=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:u=0,defaultValue:p=[s],value:x,onValueChange:y=()=>{},onValueCommit:_=()=>{},inverted:w=!1,form:S,...N}=t,M=I.useRef(new Set),E=I.useRef(0),P=l==="horizontal"?V2t:H2t,[z=[],R]=Ku({prop:x,defaultProp:p,onChange:ae=>{var xe;(xe=[...M.current][E.current])==null||xe.focus(),y(ae)}}),U=I.useRef(z);function V(ae){const oe=Y2t(z,ae);J(ae,oe)}function K(ae){J(ae,E.current)}function W(){const ae=U.current[E.current];z[E.current]!==ae&&_(z)}function J(ae,oe,{commit:xe}={commit:!1}){const ie=ebt(o),pe=tbt(Math.round((ae-s)/o)*o+s,ie),se=gE(pe,[s,a]);R((fe=[])=>{const he=K2t(fe,se,oe);if(J2t(he,u*o)){E.current=he.indexOf(se);const ye=String(he)!==String(fe);return ye&&xe&&_(he),ye?he:fe}else return fe})}return r.jsx(q2t,{scope:t.__scopeSlider,name:n,disabled:i,min:s,max:a,valueIndexToChangeRef:E,thumbs:M.current,values:z,orientation:l,form:S,children:r.jsx(Mfe.Provider,{scope:t.__scopeSlider,children:r.jsx(Mfe.Slot,{scope:t.__scopeSlider,children:r.jsx(P,{"aria-disabled":i,"data-disabled":i?"":void 0,...N,ref:e,onPointerDown:cn(N.onPointerDown,()=>{i||(U.current=z)}),min:s,max:a,inverted:w,onSlideStart:i?void 0:V,onSlideMove:i?void 0:K,onSlideEnd:i?void 0:W,onHomeKeyDown:()=>!i&&J(s,0,{commit:!0}),onEndKeyDown:()=>!i&&J(a,z.length-1,{commit:!0}),onStepKeyDown:({event:ae,direction:oe})=>{if(!i){const pe=hze.includes(ae.key)||ae.shiftKey&&fze.includes(ae.key)?10:1,se=E.current,fe=z[se],he=o*pe*oe;J(fe+he,se,{commit:!0})}}})})})})});gze.displayName=k3;var[xze,yze]=mze(k3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),V2t=I.forwardRef((t,e)=>{const{min:n,max:s,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:u,onStepKeyDown:p,...x}=t,[y,_]=I.useState(null),w=ra(e,P=>_(P)),S=I.useRef(void 0),N=xk(a),M=N==="ltr",E=M&&!o||!M&&o;function A(P){const z=S.current||y.getBoundingClientRect(),R=[0,z.width],V=Lye(R,E?[n,s]:[s,n]);return S.current=z,V(P-z.left)}return r.jsx(xze,{scope:t.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:r.jsx(vze,{dir:N,"data-orientation":"horizontal",...x,ref:w,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:P=>{const z=A(P.clientX);l==null||l(z)},onSlideMove:P=>{const z=A(P.clientX);i==null||i(z)},onSlideEnd:()=>{S.current=void 0,u==null||u()},onStepKeyDown:P=>{const R=pze[E?"from-left":"from-right"].includes(P.key);p==null||p({event:P,direction:R?-1:1})}})})}),H2t=I.forwardRef((t,e)=>{const{min:n,max:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:u,...p}=t,x=I.useRef(null),y=ra(e,x),_=I.useRef(void 0),w=!a;function S(N){const M=_.current||x.current.getBoundingClientRect(),E=[0,M.height],P=Lye(E,w?[s,n]:[n,s]);return _.current=M,P(N-M.top)}return r.jsx(xze,{scope:t.__scopeSlider,startEdge:w?"bottom":"top",endEdge:w?"top":"bottom",size:"height",direction:w?1:-1,children:r.jsx(vze,{"data-orientation":"vertical",...p,ref:y,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const M=S(N.clientY);o==null||o(M)},onSlideMove:N=>{const M=S(N.clientY);l==null||l(M)},onSlideEnd:()=>{_.current=void 0,i==null||i()},onStepKeyDown:N=>{const E=pze[w?"from-bottom":"from-top"].includes(N.key);u==null||u({event:N,direction:E?-1:1})}})})}),vze=I.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:u,...p}=t,x=rae(k3,n);return r.jsx(Rn.span,{...p,ref:e,onKeyDown:cn(t.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):hze.concat(fze).includes(y.key)&&(u(y),y.preventDefault())}),onPointerDown:cn(t.onPointerDown,y=>{const _=y.target;_.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(_)?_.focus():s(y)}),onPointerMove:cn(t.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:cn(t.onPointerUp,y=>{const _=y.target;_.hasPointerCapture(y.pointerId)&&(_.releasePointerCapture(y.pointerId),o(y))})})}),_ze="SliderTrack",bze=I.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=rae(_ze,n);return r.jsx(Rn.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:e})});bze.displayName=_ze;var Tfe="SliderRange",wze=I.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=rae(Tfe,n),o=yze(Tfe,n),l=I.useRef(null),i=ra(e,l),u=a.values.length,p=a.values.map(_=>Nze(_,a.min,a.max)),x=u>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+"%"}})});wze.displayName=Tfe;var Afe="SliderThumb",jze=I.forwardRef((t,e)=>{const n=$2t(t.__scopeSlider),[s,a]=I.useState(null),o=ra(e,i=>a(i)),l=I.useMemo(()=>s?n().findIndex(i=>i.ref.current===s):-1,[n,s]);return r.jsx(W2t,{...t,ref:o,index:l})}),W2t=I.forwardRef((t,e)=>{const{__scopeSlider:n,index:s,name:a,...o}=t,l=rae(Afe,n),i=yze(Afe,n),[u,p]=I.useState(null),x=ra(e,A=>p(A)),y=u?l.form||!!u.closest("form"):!0,_=SI(u),w=l.values[s],S=w===void 0?0:Nze(w,l.min,l.max),N=Z2t(s,l.values.length),M=_==null?void 0:_[i.size],E=M?X2t(M,S,i.direction):0;return I.useEffect(()=>{if(u)return l.thumbs.add(u),()=>{l.thumbs.delete(u)}},[u,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${S}% + ${E}px)`},children:[r.jsx(Mfe.ItemSlot,{scope:t.__scopeSlider,children:r.jsx(Rn.span,{role:"slider","aria-label":t["aria-label"]||N,"aria-valuemin":l.min,"aria-valuenow":w,"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:w===void 0?{display:"none"}:t.style,onFocus:cn(t.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(kze,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:w},s)]})});jze.displayName=Afe;var G2t="RadioBubbleInput",kze=I.forwardRef(({__scopeSlider:t,value:e,...n},s)=>{const a=I.useRef(null),o=ra(a,s),l=zI(e);return I.useEffect(()=>{const i=a.current;if(!i)return;const u=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(u,"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})});kze.displayName=G2t;function K2t(t=[],e,n){const s=[...t];return s[n]=e,s.sort((a,o)=>a-o)}function Nze(t,e,n){const o=100/(n-e)*(t-e);return gE(o,[0,100])}function Z2t(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Y2t(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 X2t(t,e,n){const s=t/2,o=Lye([0,50],[0,s]);return(s-o(e)*n)*n}function Q2t(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function J2t(t,e){if(e>0){const n=Q2t(t);return Math.min(...n)>=e}return!0}function Lye(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 ebt(t){return(String(t).split(".")[1]||"").length}function tbt(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var Sze=gze,rbt=bze,nbt=wze,sbt=jze;const gm=I.forwardRef(({className:t,...e},n)=>r.jsxs(Sze,{ref:n,className:zt("relative flex w-full touch-none select-none items-center",t),...e,children:[r.jsx(rbt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(nbt,{className:"absolute h-full bg-primary"})}),r.jsx(sbt,{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"})]}));gm.displayName=Sze.displayName;function abt(t,e,n){return R2t(D2t({unit:"%",width:90},n,t,e),t,e)}const Oye=({open:t,onClose:e,imageSrc:n,onCropComplete:s,aspectRatio:a=1})=>{const o=I.useRef(null),[l,i]=I.useState(),[u,p]=I.useState(),[x,y]=I.useState(1),[_,w]=I.useState(0),S=I.useCallback(E=>{const{width:A,height:P}=E.currentTarget;i(abt(A,P,a))},[a]),N=I.useCallback(async()=>{const E=o.current;if(!E||!u)return;const A=document.createElement("canvas"),P=A.getContext("2d");if(!P)return;const z=E.naturalWidth/E.width,R=E.naturalHeight/E.height,U=400;A.width=U,A.height=U,P.imageSmoothingQuality="high";const V=u.x*z,K=u.y*R,W=u.width*z,J=u.height*R,ae=_*Math.PI/180,oe=A.width/2,xe=A.height/2;return P.save(),P.translate(oe,xe),P.rotate(ae),P.scale(x,x),P.translate(-oe,-xe),P.drawImage(E,V,K,W,J,0,0,U,U),P.restore(),new Promise((ie,pe)=>{A.toBlob(se=>{se?ie(se):pe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[u,x,_]),M=async()=>{try{const E=await N();E&&(s(E),e())}catch(E){console.error("Error cropping image:",E)}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsx(Br,{children:r.jsx(zr,{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(B2t,{crop:l,onChange:(E,A)=>i(A),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:S})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(TS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(gm,{value:[x],min:.5,max:3,step:.1,onValueChange:([E])=>y(E),className:"flex-1"}),r.jsx(MS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(oA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(gm,{value:[_],min:-180,max:180,step:1,onValueChange:([E])=>w(E),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[_,"°"]})]})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:e,children:"Cancel"}),r.jsx(te,{onClick:M,children:"Save Photo"})]})]})})},ibt=()=>{const{user:t}=Qr(),{toast:e}=mi(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(null);I.useEffect(()=>{t&&u()},[t]);const u=async()=>{s(!0);try{const{data:y}=await Q.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 Q.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:_,error:w}=await Q.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(w)throw w;_!=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(Lt,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Lt,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Lt,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Lt,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Lt,{variant:"secondary",children:"Canceled"});default:return r.jsx(Lt,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(bm,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(bm,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(Cn,{children:"Manage your subscription and billing"})]}),r.jsxs(et,{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(te,{onClick:p,variant:"outline",disabled:a,children:[a?r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Os,{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."})]})]})},obt=()=>{const{user:t}=Qr(),e=Gn(),{toast:n}=mi(),[s]=rd(),a=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:u,subscribe:p,unsubscribe:x}=W8e(),[y,_]=I.useState(!1),[w,S]=I.useState(""),[N,M]=I.useState(!1),[E,A]=I.useState(!1),[P,z]=I.useState(""),[R,U]=I.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}),[V,K]=I.useState(!1),[W,J]=I.useState(!1),[ae,oe]=I.useState({newPassword:"",confirmPassword:""});I.useEffect(()=>{t&&xe()},[t]),I.useEffect(()=>{o&&t&&setTimeout(()=>{var he;(he=document.getElementById("change-password-section"))==null||he.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,t]);const xe=async()=>{var he,ye,Ce;if(!(t!=null&&t.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",t.id);const{data:Se,error:Ne}=await Q.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url, email_signature, use_email_signature").eq("id",t.id).maybeSingle();if(Ne)throw console.error("Profile query error:",Ne),Ne;Se?(console.log("Profile loaded successfully:",Se),U({name:Se.name||"",email:Se.email||"",title:Se.title||"",bio:Se.bio||"",areas_served:Se.areas_served||"",years_experience:((he=Se.years_experience)==null?void 0:he.toString())||"",instagram_url:Se.instagram_url||"",facebook_url:Se.facebook_url||"",linkedin_url:Se.linkedin_url||"",email_signature:Se.email_signature||"",use_email_signature:Se.use_email_signature||!1}),K(Se.digest_opt_out||!1)):(console.warn("No profile found for user"),U({name:((ye=t.user_metadata)==null?void 0:ye.name)||((Ce=t.email)==null?void 0:Ce.split("@")[0])||"",email:t.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}));const{data:be}=await Q.storage.from("avatars").list(`${t.id}`);if(be&&be.length>0){const{data:rt}=Q.storage.from("avatars").getPublicUrl(`${t.id}/${be[0].name}`);S(rt.publicUrl)}}catch(Se){console.error("Error loading profile:",Se),n({title:"Error",description:Se.message||"Failed to load profile",variant:"destructive"})}},ie=he=>{var Se;const ye=(Se=he.target.files)==null?void 0:Se[0];if(!ye)return;const Ce=new FileReader;Ce.onloadend=()=>{z(Ce.result),A(!0)},Ce.readAsDataURL(ye),he.target.value=""},pe=async he=>{if(t){M(!0);try{const{data:ye}=await Q.storage.from("avatars").list(`${t.id}`);ye&&ye.length>0&&await Q.storage.from("avatars").remove(ye.map(rt=>`${t.id}/${rt.name}`));const Se=`${t.id}/avatar.jpg`,{error:Ne}=await Q.storage.from("avatars").upload(Se,he,{upsert:!0,contentType:"image/jpeg"});if(Ne)throw Ne;const{data:be}=Q.storage.from("avatars").getPublicUrl(Se);S(`${be.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(ye){console.error("Error uploading avatar:",ye),n({title:"Error",description:ye.message||"Failed to upload photo",variant:"destructive"})}finally{M(!1)}}},se=async()=>{if(!R.name.trim()||!R.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}_(!0);try{const{error:he}=await Q.from("profiles").update({name:R.name.trim(),email:R.email.trim(),title:R.title.trim()||null,bio:R.bio.trim()||null,areas_served:R.areas_served.trim()||null,years_experience:R.years_experience?parseInt(R.years_experience):null,instagram_url:R.instagram_url.trim()||null,facebook_url:R.facebook_url.trim()||null,linkedin_url:R.linkedin_url.trim()||null,email_signature:R.email_signature||"",use_email_signature:R.use_email_signature}).eq("id",t==null?void 0:t.id);if(he)throw he;n({title:"Success",description:"Profile updated successfully"})}catch(he){console.error("Error updating profile:",he),n({title:"Error",description:he.message||"Failed to update profile",variant:"destructive"})}finally{_(!1)}},fe=async()=>{if(!ae.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ae.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ae.newPassword!==ae.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}_(!0);try{const{error:he}=await Q.auth.updateUser({password:ae.newPassword});if(he)throw he;n({title:"Success",description:"Password updated successfully"}),oe({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>e("/dashboard"),1e3)}catch(he){console.error("Error updating password:",he),n({title:"Error",description:he.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(te,{variant:"outline",onClick:()=>{var he;(he=document.getElementById("change-password-section"))==null||he.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(Nj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Profile Photo"}),r.jsx(Cn,{children:"Upload a professional photo for your profile"})]}),r.jsxs(et,{className:"flex items-center gap-6",children:[r.jsxs(Ys,{className:"h-24 w-24",children:[r.jsx(Pi,{src:w}),r.jsx(Xs,{className:"text-2xl",children:R.name.split(" ").map(he=>he[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ie,disabled:N}),r.jsxs(te,{variant:"outline",onClick:()=>{var he;return(he=document.getElementById("avatar-upload"))==null?void 0:he.click()},disabled:N,children:[r.jsx(ho,{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(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Personal Information"}),r.jsx(Cn,{children:"Update your profile details"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",value:R.name,onChange:he=>U({...R,name:he.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:R.email,onChange:he=>U({...R,email:he.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Job Title"}),r.jsx(ot,{id:"title",value:R.title,onChange:he=>U({...R,title:he.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"bio",children:"Bio"}),r.jsx(ot,{id:"bio",value:R.bio,onChange:he=>U({...R,bio:he.target.value}),placeholder:"A short description about yourself",maxLength:500})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(ot,{id:"areas_served",value:R.areas_served,onChange:he=>U({...R,areas_served:he.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(ot,{id:"years_experience",type:"number",min:"0",value:R.years_experience,onChange:he=>U({...R,years_experience:he.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(ot,{value:R.linkedin_url,onChange:he=>U({...R,linkedin_url:he.target.value}),placeholder:"LinkedIn URL"}),r.jsx(ot,{value:R.instagram_url,onChange:he=>U({...R,instagram_url:he.target.value}),placeholder:"Instagram URL"}),r.jsx(ot,{value:R.facebook_url,onChange:he=>U({...R,facebook_url:he.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(te,{onClick:se,disabled:y,children:[r.jsx(km,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(D0,{className:"h-5 w-5"}),"Email Signature"]}),r.jsx(Cn,{children:"Add a signature that will be appended to emails sent via Gmail"})]}),r.jsxs(et,{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:"Use email signature in all emails"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:R.use_email_signature?"Your signature will be added to every email sent via Gmail":"Signature is currently disabled"})]}),r.jsx(Ss,{checked:R.use_email_signature,onCheckedChange:he=>U({...R,use_email_signature:he})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Signature"}),r.jsx(Yg,{content:R.email_signature,onChange:he=>U({...R,email_signature:he}),placeholder:"Paste your Gmail signature here or create one...",minHeight:"120px",compact:!0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Tip: Copy your signature from Gmail Settings and paste it here — images and formatting will be preserved."})]}),r.jsxs(te,{onClick:se,disabled:y,children:[r.jsx(km,{className:"mr-2 h-4 w-4"}),"Save Signature"]})]})]}),r.jsxs(Ke,{id:"change-password-section",children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:a?"Set Your Password":"Change Password"}),r.jsx(Cn,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"newPassword",children:"New Password"}),r.jsx(ot,{id:"newPassword",type:"password",value:ae.newPassword,onChange:he=>oe({...ae,newPassword:he.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(ot,{id:"confirmPassword",type:"password",value:ae.confirmPassword,onChange:he=>oe({...ae,confirmPassword:he.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(te,{onClick:fe,disabled:y,children:[r.jsx(km,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&r.jsx(te,{variant:"outline",onClick:()=>e("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[i?r.jsx(kg,{className:"h-5 w-5"}):r.jsx(xj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(Cn,{children:"Receive browser notifications when new content is added"})]}),r.jsx(et,{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(Ss,{checked:i,onCheckedChange:he=>{he?p():x()},disabled:u})]}):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(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[V?r.jsx(ZT,{className:"h-5 w-5"}):r.jsx(ws,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(Cn,{children:"Manage your email subscription settings"})]}),r.jsx(et,{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(Ss,{checked:!V,onCheckedChange:async he=>{J(!0);try{const{error:ye}=await Q.from("profiles").update({digest_opt_out:!he}).eq("id",t==null?void 0:t.id);if(ye)throw ye;K(!he),n({title:he?"Subscribed":"Unsubscribed",description:he?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(ye){n({title:"Error",description:ye.message||"Failed to update preference",variant:"destructive"})}finally{J(!1)}},disabled:W})]})})]}),r.jsx(Fmt,{}),r.jsx(ibt,{})]}),r.jsx(Oye,{open:E,onClose:()=>A(!1),imageSrc:P,onCropComplete:pe,aspectRatio:1})]})})};var lbt="AspectRatio",Cze=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}})})});Cze.displayName=lbt;var cbt=Cze;const dbt=cbt;function ubt(){const{user:t}=Qr(),e=qr(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),{data:l,isLoading:i}=Kt({queryKey:["calendar-token",t==null?void 0:t.id],queryFn:async()=>{const{data:S,error:N}=await Q.from("profiles").select("calendar_token").eq("id",t==null?void 0:t.id).single();if(N)throw N;return S},enabled:!!t&&a}),u=or({mutationFn:async()=>{const S=new Uint8Array(12);crypto.getRandomValues(S);const N=btoa(String.fromCharCode(...S)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:M}=await Q.from("profiles").update({calendar_token:N}).eq("id",t==null?void 0:t.id);if(M)throw M;return N},onSuccess:()=>{e.invalidateQueries({queryKey:["calendar-token",t==null?void 0:t.id]}),Oe.success("Calendar subscription URL generated!")},onError:S=>{Oe.error("Failed to generate calendar URL: "+S.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),Oe.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{p&&(window.location.href=p.replace("https://","webcal://"))},_=()=>{if(p){const S=p.replace("https://","webcal://"),N=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(S)}`;window.open(N,"_blank")}},w=()=>{if(p){const S=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(p)}&name=Level%20Up%20Events`;window.open(S,"_blank")}};return r.jsxs(Dr,{open:a,onOpenChange:o,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"gap-2",children:[r.jsx(Ds,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Jn,{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(Yr,{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(ot,{value:p,readOnly:!0,className:"text-xs font-mono"}),r.jsx(te,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(_i,{className:"h-4 w-4 text-green-500"}):r.jsx(tl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick: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(Os,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(te,{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(Os,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:w,children:[r.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(Os,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Events sync automatically. If your membership expires, the calendar will show as empty."})]}):r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),r.jsx(te,{onClick:()=>u.mutate(),disabled:u.isPending,className:"w-full",children:u.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ds,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var nae="Tabs",[hbt]=lc(nae,[x3]),Mze=x3(),[fbt,Dye]=hbt(nae),Tze=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:u="automatic",...p}=t,x=xk(i),[y,_]=Ku({prop:s,onChange:a,defaultProp:o??"",caller:nae});return r.jsx(fbt,{scope:n,baseId:Qc(),value:y,onValueChange:_,orientation:l,dir:x,activationMode:u,children:r.jsx(Rn.div,{dir:x,"data-orientation":l,...p,ref:e})})});Tze.displayName=nae;var Aze="TabsList",Eze=I.forwardRef((t,e)=>{const{__scopeTabs:n,loop:s=!0,...a}=t,o=Dye(Aze,n),l=Mze(n);return r.jsx(Wge,{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})})});Eze.displayName=Aze;var Ize="TabsTrigger",Pze=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...o}=t,l=Dye(Ize,n),i=Mze(n),u=Dze(l.baseId,s),p=Rze(l.baseId,s),x=s===l.value;return r.jsx(Gge,{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:u,...o,ref:e,onMouseDown:cn(t.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:cn(t.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:cn(t.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(s)})})})});Pze.displayName=Ize;var Lze="TabsContent",Oze=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,forceMount:a,children:o,...l}=t,i=Dye(Lze,n),u=Dze(i.baseId,s),p=Rze(i.baseId,s),x=s===i.value,y=I.useRef(x);return I.useEffect(()=>{const _=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(_)},[]),r.jsx(jc,{present:a||x,children:({present:_})=>r.jsx(Rn.div,{"data-state":x?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":u,hidden:!_,id:p,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:y.current?"0s":void 0},children:_&&o})})});Oze.displayName=Lze;function Dze(t,e){return`${t}-trigger-${e}`}function Rze(t,e){return`${t}-content-${e}`}var pbt=Tze,Fze=Eze,zze=Pze,Bze=Oze;const ki=pbt,pi=I.forwardRef(({className:t,...e},n)=>r.jsx(Fze,{ref:n,className:zt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));pi.displayName=Fze.displayName;const rn=I.forwardRef(({className:t,...e},n)=>r.jsx(zze,{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}));rn.displayName=zze.displayName;const Sn=I.forwardRef(({className:t,...e},n)=>r.jsx(Bze,{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=Bze.displayName;const mbt={first_timer:_s,regular:ry,dedicated:Rl,veteran:Yi,streak_master:lf,century:Yi},gbt={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 L4e(t){return t===1?r.jsx(Yi,{className:"h-5 w-5 text-yellow-500"}):t===2?r.jsx(ry,{className:"h-5 w-5 text-gray-400"}):t===3?r.jsx(Rl,{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 $ze({showUserStats:t=!0,compact:e=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:a}=Qr(),{data:o,isLoading:l}=mDe(e?5:10,n),{data:i}=gDe(a==null?void 0:a.id),{data:u}=yDe(a==null?void 0:a.id),{data:p}=xDe(a==null?void 0:a.id);return l?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(et,{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(Ke,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(et,{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"}),u&&r.jsxs(Lt,{variant:"secondary",className:"text-xs",children:["Rank #",u]})]}),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(lf,{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=mbt[x.badge_type]||_s;return r.jsxs(Lt,{variant:"outline",className:`text-xs ${gbt[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(Lt,{variant:"outline",className:"text-xs",children:["+",p.length-4," more"]})]})]}),r.jsxs(ki,{defaultValue:"points",className:"w-full",children:[r.jsxs(pi,{className:"w-full mb-3",children:[r.jsx(rn,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(rn,{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 _,w,S;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:L4e(y+1)}),r.jsx(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{className:"text-xs",children:((w=(_=x.profile)==null?void 0:_.name)==null?void 0:w.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((S=x.profile)==null?void 0:S.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 _,w,S;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:L4e(y+1)}),r.jsx(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{className:"text-xs",children:((w=(_=x.profile)==null?void 0:_.name)==null?void 0:w.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((S=x.profile)==null?void 0:S.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 xbt(){const t=Gn(),{user:e,isAdmin:n}=Qr(),s=qr(),{data:a,isLoading:o}=Kt({queryKey:["public-events"],queryFn:async()=>{const{data:N,error:M}=await Q.from("events").select("*").order("event_date",{ascending:!0});if(M)throw M;return N}}),{data:l}=Kt({queryKey:["my-registrations"],queryFn:async()=>{if(!e)return[];const{data:N,error:M}=await Q.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e.id);if(M)throw M;return N},enabled:!!e}),{data:i}=Kt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:N,error:M}=await Q.from("event_registrations").select("event_id");if(M)throw M;const E={};return N.forEach(A=>{E[A.event_id]=(E[A.event_id]||0)+1}),E}}),u=or({mutationFn:async N=>{const{data:M,error:E}=await Q.functions.invoke("zoom-register",{body:{event_id:N}});if(E)throw E;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:N=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),N!=null&&N.join_url?Oe.success("Successfully registered! You'll receive a Zoom confirmation email."):Oe.success("Successfully registered for the event!")},onError:N=>{Oe.error("Failed to register: "+N.message)}}),p=or({mutationFn:async N=>{const{data:M,error:E}=await Q.functions.invoke("zoom-unregister",{body:{event_id:N}});if(E)throw E;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),Oe.success("Registration cancelled and removed from Zoom")},onError:N=>{Oe.error("Failed to cancel: "+N.message)}}),x=N=>l==null?void 0:l.some(M=>M.event_id===N),y=N=>{const M=l==null?void 0:l.find(E=>E.event_id===N);return M==null?void 0:M.zoom_join_url},_=N=>N.capacity?((i==null?void 0:i[N.id])||0)>=N.capacity:!1,w=(a==null?void 0:a.filter(N=>BS(N.event_date)!=="ended"))||[],S=(a==null?void 0:a.filter(N=>BS(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(ubt,{}),n&&r.jsx(te,{variant:"outline",onClick:()=>t("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${n?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:n?"lg:col-span-2":"",children:[o?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):w.length===0?r.jsx(Ke,{className:"text-center py-12",children:r.jsx(et,{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:w.map(N=>{const M=BS(N.event_date),E=Bxe(N.event_date),A=M==="live",P=M==="starting_soon";return r.jsxs(Ke,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${A?"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:`${A?"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"})]}),A?r.jsxs(r.Fragment,{children:[r.jsx(Ej,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Wa,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),N.image_url&&r.jsx(dbt,{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(Ht,{children:[r.jsx(Zt,{className:"line-clamp-2",children:N.title}),N.description&&r.jsx(Cn,{className:"line-clamp-2",children:N.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(et,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ds,{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(Wa,{className:"h-4 w-4"}),vE(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(_A,{className:"flex gap-2",onClick:z=>z.stopPropagation(),children:x(N.id)?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>p.mutate(N.id),disabled:p.isPending,children:[r.jsx(gs,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(te,{className:"flex-1",onClick:()=>window.open(y(N.id)||N.zoom_link,"_blank"),children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(te,{className:"w-full",onClick:()=>u.mutate(N.id),disabled:u.isPending||_(N),children:_(N)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(_i,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},N.id)})}),S.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:S.map(N=>r.jsx(Ke,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t(`/events/${N.id}`),children:r.jsxs(Ht,{children:[r.jsx(Zt,{className:"text-base line-clamp-1",children:N.title}),r.jsx(Cn,{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($ze,{showUserStats:!0})})]})]})})}const Hce=[{value:"all",label:"All Roles",icon:Bn},{value:"brokerage_manager",label:"Brokerage Managers",icon:mA},{value:"admin",label:"Admins",icon:uf}];function ybt({open:t,onOpenChange:e,resourceType:n,resourceId:s,resourceTitle:a}){var Ye,ht;const{user:o,isAdmin:l,isBrokerageManager:i}=Qr(),[u,p]=I.useState([]),[x,y]=I.useState([]),[_,w]=I.useState([]),[S,N]=I.useState([]),[M,E]=I.useState(""),[A,P]=I.useState(""),[z,R]=I.useState(""),[U,V]=I.useState(!1),[K,W]=I.useState(!1),[J,ae]=I.useState("agents"),[oe,xe]=I.useState("all"),[ie,pe]=I.useState({}),se=l||i;I.useEffect(()=>{t&&o&&(l?fe():he())},[t,o,l]),I.useEffect(()=>{t||(w([]),N([]),E(""),P(""),R(""),ae("agents"),xe("all"))},[t]);const fe=async()=>{if(o){V(!0);try{const{data:Me,error:Qe}=await Q.from("brokerages").select("id, name").order("name");if(Qe)throw Qe;const le=1e3,Ve={};let Le=0,We=!0;for(;We;){const{data:ze,error:Ee}=await Q.from("profiles").select("brokerage_id").range(Le*le,(Le+1)*le-1);if(Ee)throw Ee;ze==null||ze.forEach(Je=>{Je.brokerage_id&&(Ve[Je.brokerage_id]=(Ve[Je.brokerage_id]||0)+1)}),We=(ze==null?void 0:ze.length)===le,Le++}y((Me==null?void 0:Me.map(ze=>({...ze,agent_count:Ve[ze.id]||0})))||[]);const _e=[];for(Le=0,We=!0;We;){const{data:ze,error:Ee}=await Q.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(Le*le,(Le+1)*le-1);if(Ee)throw Ee;ze&&_e.push(...ze),We=(ze==null?void 0:ze.length)===le,Le++}const st={};for(Le=0,We=!0;We;){const{data:ze,error:Ee}=await Q.from("user_roles").select("user_id, role").range(Le*le,(Le+1)*le-1);if(Ee)throw Ee;ze==null||ze.forEach(Je=>{st[Je.user_id]||(st[Je.user_id]=[]),st[Je.user_id].push(Je.role)}),We=(ze==null?void 0:ze.length)===le,Le++}pe(st),p(_e.map(ze=>{var Ee;return{id:ze.id,name:ze.name,email:ze.email,brokerage_name:((Ee=ze.brokerages)==null?void 0:Ee.name)||"No Brokerage",roles:st[ze.id]||[]}}))}catch(Me){console.error("Error loading data:",Me),Oe.error("Failed to load agents and brokerages")}finally{V(!1)}}},he=async()=>{if(o){V(!0);try{const{data:Me}=await Q.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Me!=null&&Me.brokerage_id)){Oe.error("You must be part of a brokerage to share resources"),e(!1);return}const{data:Qe,error:le}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",Me.brokerage_id).neq("id",o.id).order("name");if(le)throw le;p(Qe||[])}catch(Me){console.error("Error loading agents:",Me),Oe.error("Failed to load agents")}finally{V(!1)}}},ye=u.filter(Me=>{var le;const Qe=Me.name.toLowerCase().includes(M.toLowerCase())||Me.email.toLowerCase().includes(M.toLowerCase())||((le=Me.brokerage_name)==null?void 0:le.toLowerCase().includes(M.toLowerCase()));if(l&&oe!=="all"){const Ve=ie[Me.id]||[];return Qe&&Ve.includes(oe)}return Qe}),Ce=x.filter(Me=>Me.name.toLowerCase().includes(A.toLowerCase())),Se=()=>{_.length===ye.length?w([]):w(ye.map(Me=>Me.id))},Ne=()=>{S.length===Ce.length?N([]):N(Ce.map(Me=>Me.id))},be=Me=>{if(!se){w([Me]);return}w(Qe=>Qe.includes(Me)?Qe.filter(le=>le!==Me):[...Qe,Me])},rt=Me=>{N(Qe=>Qe.includes(Me)?Qe.filter(le=>le!==Me):[...Qe,Me])},Te=async()=>{if(!(_.length>0||S.length>0)){Oe.error("Please select at least one agent or brokerage to share with");return}W(!0);try{const{data:Qe,error:le}=await Q.functions.invoke("send-share-notification",{body:{recipientIds:_,brokerageIds:S,resourceType:n,resourceId:s,resourceTitle:a,message:z.trim()||void 0}});if(le)throw le;const Ve=(Qe==null?void 0:Qe.sharesCreated)||_.length;Oe.success(`Shared with ${Ve} agent${Ve!==1?"s":""}`),e(!1)}catch(Qe){console.error("Error sharing resource:",Qe),Oe.error("Failed to share resource")}finally{W(!1)}},Pe=Me=>Me.split(" ").map(Qe=>Qe[0]).join("").toUpperCase().slice(0,2),Ue=Me=>{const Qe=ie[Me]||[];return Qe.includes("admin")?r.jsx(Lt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Qe.includes("brokerage_manager")?r.jsx(Lt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Re=_.length+S.length,Be=oe!=="all"?ye.length:null;return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(Br,{className:"flex-shrink-0",children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(eo,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Jn,{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(ki,{value:J,onValueChange:ae,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(pi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(rn,{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(Lt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:_.length})]}),r.jsxs(rn,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),S.length>0&&r.jsx(Lt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:S.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or brokerage...",value:M,onChange:Me=>E(Me.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:oe,onValueChange:xe,children:[r.jsxs(fn,{className:"w-[180px]",children:[r.jsx(L1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(vn,{placeholder:"Filter by role"})]}),r.jsx(pn,{children:Hce.map(Me=>r.jsx(qt,{value:Me.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Me.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Me.label})]})},Me.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:ye.length===0,children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1.5"}),_.length===ye.length&&ye.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Be!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Be," ",(Ye=Hce.find(Me=>Me.value===oe))==null?void 0:Ye.label]}),r.jsxs("span",{className:"font-medium",children:[_.length," selected"]})]})]}),r.jsx(Ro,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ye.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 ${(ht=Hce.find(Me=>Me.value===oe))==null?void 0:ht.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ye.map(Me=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${_.includes(Me.id)?"bg-accent":""}`,onClick:()=>be(Me.id),children:[r.jsx(Fl,{checked:_.includes(Me.id),onCheckedChange:()=>be(Me.id),className:"flex-shrink-0"}),r.jsx(Ys,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Xs,{className:"text-xs bg-primary/10 text-primary",children:Pe(Me.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:Me.name}),Ue(Me.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Me.email,Me.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Me.brokerage_name]})]})]})]},Me.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search brokerages...",value:A,onChange:Me=>P(Me.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Ne,className:"text-xs h-8",disabled:Ce.length===0,children:[r.jsx(li,{className:"h-3.5 w-3.5 mr-1.5"}),S.length===Ce.length&&Ce.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[S.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(Ro,{className:"h-[250px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ce.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(li,{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:Ce.map(Me=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${S.includes(Me.id)?"bg-accent":""}`,onClick:()=>rt(Me.id),children:[r.jsx(Fl,{checked:S.includes(Me.id),onCheckedChange:()=>rt(Me.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(li,{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:Me.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Me.agent_count," agent",Me.agent_count!==1?"s":""]})]})]},Me.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:M,onChange:Me=>E(Me.target.value),className:"pl-9"})]}),se&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:ye.length===0,children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1.5"}),_.length===ye.length&&ye.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[_.length," selected"]})]}),r.jsx(Ro,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ye.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:ye.map(Me=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${_.includes(Me.id)?"bg-accent":""}`,onClick:()=>be(Me.id),children:[r.jsx(Fl,{checked:_.includes(Me.id),onCheckedChange:()=>be(Me.id),className:"flex-shrink-0"}),r.jsx(Ys,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Xs,{className:"text-xs bg-primary/10 text-primary",children:Pe(Me.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Me.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Me.email})]})]},Me.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(qe,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(ss,{id:"message",placeholder:"I thought you might find this useful...",value:z,onChange:Me=>R(Me.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:Te,disabled:Re===0||K,children:K?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(eo,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function N3({resourceType:t,resourceId:e,resourceTitle:n,variant:s="outline",size:a="sm",className:o=""}){const[l,i]=I.useState(!1),{user:u}=Qr();return u?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:s,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(_c,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(ybt,{open:l,onOpenChange:i,resourceType:t,resourceId:e,resourceTitle:n})]}):null}function vbt(){const{eventId:t}=td(),e=Gn(),{user:n}=Qr(),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,u]=I.useState(0),[p,x]=I.useState(!0),[y,_]=I.useState(!1);I.useEffect(()=>{t&&w()},[t,n]);const w=async()=>{try{const{data:P,error:z}=await Q.from("events").select("*").eq("id",t).single();if(z)throw z;a(P);const{count:R}=await Q.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",t);if(u(R||0),n){const{data:U}=await Q.from("event_registrations").select("id, zoom_join_url").eq("event_id",t).eq("user_id",n.id).maybeSingle();l(U)}}catch(P){console.error("Error loading event:",P),Oe.error("Failed to load event"),e("/events")}finally{x(!1)}},S=async()=>{if(!(!n||!s)){_(!0);try{if(o){const{error:P}=await Q.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(P)throw P;Oe.success("Successfully cancelled registration"),l(null),u(z=>z-1)}else{const{data:P,error:z}=await Q.functions.invoke("zoom-register",{body:{event_id:s.id}});if(z)throw z;Oe.success("Successfully registered for event!"),l({id:P.registration_id,zoom_join_url:P.zoom_join_url}),u(R=>R+1)}}catch(P){console.error("Registration error:",P),Oe.error(o?"Failed to cancel registration":"Failed to register for event")}finally{_(!1)}}},N=P=>{var z,R,U;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]:(R=P.split("v=")[1])==null?void 0:R.split("&")[0];if(V)return`https://www.youtube.com/embed/${V}`}if(P.includes("vimeo.com")){const V=(U=P.split("vimeo.com/")[1])==null?void 0:U.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(te,{onClick:()=>e("/events"),className:"mt-4",children:"Back to Events"})]})});const M=lht(new Date(s.event_date)),E=s.capacity&&i>=s.capacity,A=(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(te,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>e("/events"),children:[r.jsx(io,{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"}),M&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Lt,{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(N3,{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(Gf,{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(Ke,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Ds,{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:vE(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(Ii,{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:[!M&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(te,{className:"w-full gap-2",onClick:()=>window.open(A,"_blank"),children:[r.jsx(Os,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:S,disabled:y,children:[y?r.jsx(Yr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(te,{className:"w-full gap-2",onClick:S,disabled:y||(E??!1),children:y?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):E?"Event Full":"Register Now"})}),M&&o&&r.jsxs(te,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Os,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const _bt=()=>{const{user:t,isAdmin:e}=Qr(),n=Gn(),[s,a]=I.useState([]),[o,l]=I.useState(!0),[i,u]=I.useState(""),[p,x]=I.useState("all"),[y,_]=I.useState(new Set);I.useEffect(()=>{w()},[t]);const w=async()=>{try{const{data:A}=await Q.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),P=(A==null?void 0:A.map(J=>J.tag))||[],{data:z,error:R}=await Q.from("app_tiles").select("*").order("name");if(R)throw R;const{data:U}=await Q.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),V=new Set((U==null?void 0:U.map(J=>J.app_id))||[]);_(V);const W=((z==null?void 0:z.filter(J=>!J.required_tags||J.required_tags.length===0?!0:J.required_tags.some(ae=>P.includes(ae))))||[]).sort((J,ae)=>J.name==="LevelUp Members Portal"?-1:ae.name==="LevelUp Members Portal"?1:0);a(W)}catch(A){console.error("Error loading apps:",A),Oe.error("Failed to load apps")}finally{l(!1)}},S=async A=>{var z;const P=window.open("about:blank","_blank");try{const{data:R,error:U}=await Q.auth.getSession();if(U||!R.session){P==null||P.close(),Oe.error("Session expired. Please refresh the page and try again.");return}const V=R.session.access_token;await Q.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:A.app_id,app_name:A.name,user_agent:navigator.userAgent});const{data:K,error:W}=await Q.functions.invoke("sso-launch",{body:{app_id:A.app_id},headers:{Authorization:`Bearer ${V}`}});if(W)throw W;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(),Oe.error("Launch link unavailable"))}catch(R){P==null||P.close(),console.error("Error launching app:",R),Oe.error("Failed to launch app. Please try again.")}},N=async(A,P)=>{A.stopPropagation();const z=y.has(P);try{if(z){const{error:R}=await Q.from("user_favorites").delete().eq("user_id",t==null?void 0:t.id).eq("app_id",P);if(R)throw R;_(U=>{const V=new Set(U);return V.delete(P),V}),Oe.success("Removed from favorites")}else{const{error:R}=await Q.from("user_favorites").insert({user_id:t==null?void 0:t.id,app_id:P});if(R)throw R;_(U=>new Set(U).add(P)),Oe.success("Added to favorites")}}catch(R){console.error("Error toggling favorite:",R),Oe.error("Failed to update favorites")}},M=s.filter(A=>{var z;const P=A.name.toLowerCase().includes(i.toLowerCase())||((z=A.description)==null?void 0:z.toLowerCase().includes(i.toLowerCase()));return p==="favorites"?P&&y.has(A.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:i,onChange:A=>u(A.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:E.map(A=>r.jsxs("button",{onClick:()=>x(A.id),className:zt("pb-3 text-sm font-medium transition-colors relative",p===A.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[A.label,p===A.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},A.id))}),M.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(vm,{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(np,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:e?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),e&&r.jsx(te,{className:"mt-4",onClick:()=>n("/admin/apps"),children:"Add Apps"})]})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:M.map(A=>{const P=y.has(A.id),z=A.name.toLowerCase().includes("agent review")||A.app_id==="agent_review";return r.jsxs("div",{className:"group flex flex-col p-5 bg-card rounded-xl border border-border transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>S(A),children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:A.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:A.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:A.description})]}),r.jsx("button",{className:zt("flex-shrink-0 p-1 transition-colors",P?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:R=>N(R,A.id),children:r.jsx(vm,{className:zt("h-5 w-5",P&&"fill-current")})})]}),z&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:R=>R.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},A.id)})})]})},bbt=()=>{const t=Gn(),[e,n]=I.useState(""),[s,a]=I.useState("all"),[o,l]=I.useState("all"),[i,u]=I.useState("grid"),{data:p=[]}=Kt({queryKey:["template-categories"],queryFn:async()=>{const{data:E,error:A}=await Q.from("template_categories").select("*").order("name");if(A)throw A;return E}}),{data:x=[]}=Kt({queryKey:["template-types"],queryFn:async()=>{const{data:E,error:A}=await Q.from("template_types").select("*").order("name");if(A)throw A;return E}}),{data:y=[],isLoading:_}=Kt({queryKey:["canva-templates"],queryFn:async()=>{const{data:E,error:A}=await Q.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(A)throw A;const{data:P,error:z}=await Q.from("template_links").select("*").order("sort_order");if(z)throw z;const{data:R}=await Q.from("template_likes").select("template_id"),{data:U}=await Q.from("template_comments").select("template_id"),V=new Map;R==null||R.forEach(J=>{V.set(J.template_id,(V.get(J.template_id)||0)+1)});const K=new Map;return U==null||U.forEach(J=>{K.set(J.template_id,(K.get(J.template_id)||0)+1)}),(E||[]).map(J=>({...J,links:(P||[]).filter(ae=>ae.template_id===J.id)||[],likesCount:V.get(J.id)||0,commentsCount:K.get(J.id)||0}))}}),w=y.filter(E=>{var R;const A=E.name.toLowerCase().includes(e.toLowerCase())||((R=E.description)==null?void 0:R.toLowerCase().includes(e.toLowerCase())),P=s==="all"||E.category_id===s,z=o==="all"||E.type_id===o;return A&&P&&z}),S=()=>{n(""),a("all"),l("all")},N=e||s!=="all"||o!=="all",M=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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search templates...",value:e,onChange:E=>n(E.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:s,onValueChange:a,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(vn,{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(xn,{value:o,onValueChange:l,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(vn,{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(te,{variant:"outline",size:"sm",onClick:S,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>u("grid"),className:"rounded-full",children:r.jsx(tp,{className:"h-4 w-4"})}),r.jsx(te,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>u("list"),className:"rounded-full",children:r.jsx(rp,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[w.length," template",w.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,A)=>r.jsx(Ke,{children:r.jsxs(et,{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"})]})]})},A))}),!_&&w.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(te,{variant:"outline",onClick:S,children:"Clear Filters"})]}),!_&&w.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:w.map(E=>r.jsxs(Ke,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>M(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(Lt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(Mo,{className:"h-3 w-3"}),E.links.length]})})]}),r.jsxs(et,{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:Vne(E.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[E.category&&r.jsx(Lt,{variant:"secondary",className:"text-xs",children:E.category.name}),E.type&&r.jsx(Lt,{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(kd,{className:"h-3.5 w-3.5"}),E.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bl,{className:"h-3.5 w-3.5"}),E.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:A=>{A.stopPropagation(),M(E.id)},children:[r.jsx(Os,{className:"h-4 w-4"}),"View Template"]})]})]},E.id))})]})})};var wbt="Separator",O4e="horizontal",jbt=["horizontal","vertical"],Uze=I.forwardRef((t,e)=>{const{decorative:n,orientation:s=O4e,...a}=t,o=kbt(s)?s:O4e,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})});Uze.displayName=wbt;function kbt(t){return jbt.includes(t)}var qze=Uze;const _d=I.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...s},a)=>r.jsx(qze,{ref:a,decorative:n,orientation:e,className:zt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));_d.displayName=qze.displayName;const WI=()=>({trackEngagement:I.useCallback(async(e,n,s,a="view")=>{try{const{data:{user:o}}=await Q.auth.getUser();if(!o)return;await Q.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)}},[])}),Nbt=()=>{const{templateId:t}=td(),{user:e,isAdmin:n}=Qr(),{toast:s}=mi(),a=qr(),{trackEngagement:o}=WI(),[l,i]=I.useState(""),{data:u,isLoading:p}=Kt({queryKey:["template-detail",t],queryFn:async()=>{const{data:A,error:P}=await Q.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 Q.from("template_links").select("*").eq("template_id",t).order("sort_order"),{data:R}=await Q.from("template_guides").select("*").eq("template_id",t).order("sort_order");return{...A,links:z||[],guides:R||[]}},enabled:!!t});I.useEffect(()=>{u&&o("template",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({queryKey:["template-likes",t],queryFn:async()=>{const{data:A,error:P}=await Q.from("template_likes").select("*").eq("template_id",t);if(P)throw P;return A},enabled:!!t}),{data:y=[]}=Kt({queryKey:["template-comments",t],queryFn:async()=>{const{data:A,error:P}=await Q.from("template_comments").select("*").eq("template_id",t).order("created_at",{ascending:!1});if(P)throw P;const z=[...new Set(A.map(V=>V.user_id))],{data:R}=await Q.from("profiles").select("id, name").in("id",z),U=new Map((R==null?void 0:R.map(V=>[V.id,V.name]))||[]);return A.map(V=>({...V,user_name:U.get(V.user_id)||"Unknown User"}))},enabled:!!t}),_=or({mutationFn:async A=>{const{error:P}=await Q.from("template_comments").insert({template_id:t,user_id:e.id,content:A});if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),i(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error adding comment",description:A.message,variant:"destructive"})}}),w=or({mutationFn:async A=>{const{error:P}=await Q.from("template_comments").delete().eq("id",A);if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),s({title:"Comment deleted"})}}),S=or({mutationFn:async()=>{const A=x.find(P=>P.user_id===(e==null?void 0:e.id));if(A){const{error:P}=await Q.from("template_likes").delete().eq("id",A.id);if(P)throw P}else{const{error:P}=await Q.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(A=>A.user_id===(e==null?void 0:e.id)),M=A=>A.split(" ").map(P=>P[0]).join("").toUpperCase().slice(0,2),E=A=>{A.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"})})}):u?r.jsx(Lr,{title:u.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(Ji,{to:"/templates",children:[r.jsx(io,{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:u.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.category&&r.jsx(Lt,{variant:"secondary",children:u.category.name}),u.type&&r.jsx(Lt,{variant:"outline",children:u.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(Ji,{to:`/admin/templates?edit=${u.id}`,children:[r.jsx(ni,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(N3,{resourceType:"template",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(te,{variant:N?"default":"outline",className:"gap-2 rounded-full",onClick:()=>S.mutate(),disabled:!e||S.isPending,children:[r.jsx(kd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.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:u.description}})]}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Mo,{className:"h-4 w-4"}),u.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:u.links.map(A=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",u.id,u.name,"click_canva"),window.open(A.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:A.title}),r.jsx(Os,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),u.video_url&&r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:u.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),u.guides&&u.guides.length>0&&r.jsx(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ka,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:u.guides.map(A=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",u.id,u.name,"click_pdf"),window.open(A.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:A.name}),A.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(A.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(ao,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),r.jsx(_d,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Bl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ss,{placeholder:"Add a comment...",value:l,onChange:A=>i(A.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(eo,{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(Ke,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(A=>r.jsx(Ke,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ys,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Xs,{className:"text-sm",children:M(A.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:A.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:gu(new Date(A.created_at),{addSuffix:!0})}),A.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(A.id),children:r.jsx($n,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content})]})]})})},A.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(Mo,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(Ji,{to:"/templates",children:"Back to Templates"})})]})})},Sbt=()=>{const{user:t}=Qr(),[e,n]=I.useState(""),[s,a]=I.useState("all"),{data:o=[]}=Kt({queryKey:["academy-categories"],queryFn:async()=>{const{data:_,error:w}=await Q.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(w)throw w;return _}}),{data:l=[],isLoading:i}=Kt({queryKey:["academy-videos"],queryFn:async()=>{const{data:_,error:w}=await Q.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(w)throw w;const{data:S,error:N}=await Q.from("academy_resources").select("*").order("sort_order");if(N)throw N;return _.map(E=>({...E,resources:(S==null?void 0:S.filter(A=>A.video_id===E.id))||[]}))}}),{data:u=[]}=Kt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:_,error:w}=await Q.from("academy_video_likes").select("video_id, user_id");if(w)throw w;return _}}),p=l.filter(_=>{var N;const w=e===""||_.title.toLowerCase().includes(e.toLowerCase())||((N=_.description)==null?void 0:N.toLowerCase().includes(e.toLowerCase())),S=s==="all"||_.category_id===s;return w&&S}),x=_=>u.filter(w=>w.video_id===_).length,y=_=>u.some(w=>w.video_id===_&&w.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search videos...",value:e,onChange:_=>n(_.target.value),className:"pl-10"})]})}),r.jsx(ki,{value:s,onValueChange:a,children:r.jsxs(pi,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(rn,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(_=>r.jsx(rn,{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(Ke,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Da,{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(Ji,{to:`/academy/${_.id}`,children:r.jsxs(Ke,{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(Da,{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(Ul,{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(Wa,{className:"h-3 w-3"}),_.duration]})]}),r.jsxs(Ht,{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(Lt,{variant:"secondary",className:"w-fit",children:_.category.name})]}),r.jsxs(et,{className:"pt-0",children:[_.description&&r.jsx(Cn,{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(kd,{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(ka,{className:"h-4 w-4"}),_.resources.length]})]})]})]})},_.id))})]})})};function Vze({resourceType:t,resourceId:e}){const{data:n=[]}=Kt({queryKey:["linked-templates",t,e],queryFn:async()=>{if(t==="academy_video"){const{data:s,error:a}=await Q.from("academy_video_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("video_id",e);if(a)throw a;return(s||[]).map(o=>o.canva_templates).filter(Boolean)}else{const{data:s,error:a}=await Q.from("resource_kit_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("kit_id",e);if(a)throw a;return(s||[]).map(o=>o.canva_templates).filter(Boolean)}},enabled:!!e});return n.length===0?null:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-sm",children:[r.jsx(Rc,{className:"h-4 w-4"}),"Related Templates"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(s=>r.jsx(Ji,{to:`/templates/${s.id}`,children:r.jsxs(Lt,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 transition-colors gap-1.5 px-3 py-1.5 text-xs font-medium rounded-full",children:[r.jsx(Rc,{className:"h-3 w-3"}),s.name]})},s.id))})]})}const Cbt=(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},Mbt=()=>{const{videoId:t}=td();Gn();const{user:e,isAdmin:n}=Qr(),{toast:s}=mi(),a=qr(),{trackEngagement:o}=WI(),[l,i]=I.useState(""),{data:u,isLoading:p}=Kt({queryKey:["academy-video",t],queryFn:async()=>{const{data:P,error:z}=await Q.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",t).eq("is_published",!0).single();if(z)throw z;const{data:R}=await Q.from("academy_resources").select("*").eq("video_id",t).order("sort_order");return{...P,resources:R||[]}},enabled:!!t});I.useEffect(()=>{u&&o("academy_video",u.id,u.title,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({queryKey:["academy-video-likes",t],queryFn:async()=>{const{data:P,error:z}=await Q.from("academy_video_likes").select("*").eq("video_id",t);if(z)throw z;return P},enabled:!!t}),{data:y=[]}=Kt({queryKey:["academy-video-comments",t],queryFn:async()=>{const{data:P,error:z}=await Q.from("academy_video_comments").select("*").eq("video_id",t).order("created_at",{ascending:!1});if(z)throw z;const R=[...new Set(P.map(K=>K.user_id))],{data:U}=await Q.from("profiles").select("id, name").in("id",R),V=new Map((U==null?void 0:U.map(K=>[K.id,K.name]))||[]);return P.map(K=>({...K,user_name:V.get(K.user_id)||"Unknown User"}))},enabled:!!t}),_=or({mutationFn:async P=>{const{error:z}=await Q.from("academy_video_comments").insert({video_id:t,user_id:e.id,content:P});if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",t]}),i(""),s({title:"Comment added!"})},onError:P=>{s({title:"Error adding comment",description:P.message,variant:"destructive"})}}),w=or({mutationFn:async P=>{const{error:z}=await Q.from("academy_video_comments").delete().eq("id",P);if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",t]}),s({title:"Comment deleted"})}}),S=or({mutationFn:async()=>{const P=x.find(z=>z.user_id===(e==null?void 0:e.id));if(P){const{error:z}=await Q.from("academy_video_likes").delete().eq("id",P.id);if(z)throw z}else{const{error:z}=await Q.from("academy_video_likes").insert({video_id:t,user_id:e.id});if(z)throw z}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-likes",t]})}}),N=x.some(P=>P.user_id===(e==null?void 0:e.id)),M=P=>{switch(P==null?void 0:P.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},E=P=>P.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),A=P=>{P.preventDefault(),!(!l.trim()||!e)&&_.mutate(l.trim())};return p?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"})})}):u?r.jsx(Lr,{title:u.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(Ji,{to:"/academy",children:[r.jsx(io,{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(u.video_type)?r.jsx("iframe",{src:Cbt(u.video_url,u.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(Da,{className:"h-16 w-16 opacity-50"}),r.jsx(te,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:u.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Os,{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:u.title}),u.category&&r.jsx(Lt,{variant:"secondary",children:u.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(Ji,{to:`/admin/academy?edit=${u.id}`,children:[r.jsx(ni,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(N3,{resourceType:"academy_video",resourceId:u.id,resourceTitle:u.title}),r.jsxs(te,{variant:N?"default":"outline",className:"gap-2 w-fit",onClick:()=>S.mutate(),disabled:!e||S.isPending,children:[r.jsx(kd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:u.description}})]}),u.resources&&u.resources.length>0&&r.jsx(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ka,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:u.resources.map(P=>r.jsxs("a",{href:P.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:M(P.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:P.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:P.file_type})]}),r.jsx(ao,{className:"h-4 w-4 text-muted-foreground"})]},P.id))})]})}),r.jsx(Vze,{resourceType:"academy_video",resourceId:u.id}),r.jsx(_d,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Bl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ss,{placeholder:"Add a comment...",value:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(eo,{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(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ys,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Xs,{className:"text-sm",children:E(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:gu(new Date(P.created_at),{addSuffix:!0})}),P.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(P.id),children:r.jsx($n,{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:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Da,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(Ji,{to:"/academy",children:"Back to Academy"})})]})})};function Tbt(){const t=Gn(),[e,n]=I.useState(""),{data:s,isLoading:a}=Kt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:w,error:S}=await Q.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(S)throw S;return w}}),{data:o}=Kt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:w,error:S}=await Q.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(S)throw S;return w}}),{data:l}=Kt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:w,error:S}=await Q.from("resource_kit_likes").select("kit_id");if(S)throw S;return w}}),{data:i}=Kt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:w,error:S}=await Q.from("resource_kit_comments").select("kit_id");if(S)throw S;return w}}),u=s==null?void 0:s.filter(w=>{var S;return w.name.toLowerCase().includes(e.toLowerCase())||((S=w.description)==null?void 0:S.toLowerCase().includes(e.toLowerCase()))}),p=w=>(o==null?void 0:o.filter(S=>S.kit_id===w))||[],x=w=>(l==null?void 0:l.filter(S=>S.kit_id===w).length)||0,y=w=>(i==null?void 0:i.filter(S=>S.kit_id===w).length)||0,_=w=>{t(`/toolbox/${w}`)};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(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search resource kits...",value:e,onChange:w=>n(w.target.value),className:"pl-10"})]}),!a&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(u==null?void 0:u.length)||0," resource kit",(u==null?void 0:u.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((w,S)=>r.jsx(Ke,{children:r.jsxs(et,{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"})]})},S))}):(u==null?void 0:u.length)===0?r.jsxs(Ke,{className:"p-12 text-center",children:[r.jsx($l,{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:u==null?void 0:u.map(w=>{const S=p(w.id).length,N=x(w.id),M=y(w.id);return r.jsxs(Ke,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>_(w.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:w.featured_image_url?r.jsx("img",{src:w.featured_image_url,alt:w.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($l,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:w.name}),w.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:Vne(w.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(ka,{className:"h-4 w-4"}),S," file",S!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(kd,{className:"h-3.5 w-3.5"}),N]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bl,{className:"h-3.5 w-3.5"}),M]})]})]})]})]},w.id)})})]})})}const Abt=()=>{const{kitId:t}=td(),{user:e,isAdmin:n}=Qr(),{toast:s}=mi(),a=qr(),{trackEngagement:o}=WI(),[l,i]=I.useState(""),{data:u,isLoading:p}=Kt({queryKey:["resource-kit-detail",t],queryFn:async()=>{const{data:P,error:z}=await Q.from("resource_kits").select("*").eq("id",t).eq("is_published",!0).single();if(z)throw z;const{data:R}=await Q.from("resource_kit_files").select("*").eq("kit_id",t).order("sort_order"),{data:U}=await Q.from("resource_kit_links").select("*").eq("kit_id",t).order("sort_order");return{...P,files:R||[],links:U||[]}},enabled:!!t});I.useEffect(()=>{u&&o("toolbox",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({queryKey:["resource-kit-likes",t],queryFn:async()=>{const{data:P,error:z}=await Q.from("resource_kit_likes").select("*").eq("kit_id",t);if(z)throw z;return P},enabled:!!t}),{data:y=[]}=Kt({queryKey:["resource-kit-comments",t],queryFn:async()=>{const{data:P,error:z}=await Q.from("resource_kit_comments").select("*").eq("kit_id",t).order("created_at",{ascending:!1});if(z)throw z;const R=[...new Set(P.map(K=>K.user_id))],{data:U}=await Q.from("profiles").select("id, name").in("id",R),V=new Map((U==null?void 0:U.map(K=>[K.id,K.name]))||[]);return P.map(K=>({...K,user_name:V.get(K.user_id)||"Unknown User"}))},enabled:!!t}),_=or({mutationFn:async P=>{const{error:z}=await Q.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"})}}),w=or({mutationFn:async P=>{const{error:z}=await Q.from("resource_kit_comments").delete().eq("id",P);if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),s({title:"Comment deleted"})}}),S=or({mutationFn:async()=>{const P=x.find(z=>z.user_id===(e==null?void 0:e.id));if(P){const{error:z}=await Q.from("resource_kit_likes").delete().eq("id",P.id);if(z)throw z}else{const{error:z}=await Q.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)),M=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":"",A=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"})})}):u?r.jsx(Lr,{title:u.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(Ji,{to:"/toolbox",children:[r.jsx(io,{className:"h-4 w-4"}),"Back to Toolbox"]})}),u.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:u.featured_image_url,alt:u.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:u.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(Ji,{to:`/admin/toolbox?edit=${u.id}`,children:[r.jsx(ni,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(N3,{resourceType:"resource_kit",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(te,{variant:N?"default":"outline",className:"gap-2 rounded-full",onClick:()=>S.mutate(),disabled:!e||S.isPending,children:[r.jsx(kd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:u.description}})]}),u.files&&u.files.length>0&&r.jsx(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ka,{className:"h-4 w-4"}),"Included Resources (",u.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:u.files.map(P=>r.jsxs("a",{href:P.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",u.id,u.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(ka,{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(ao,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},P.id))})]})}),u.links&&u.links.length>0&&r.jsx(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Os,{className:"h-4 w-4"}),"Canva Templates (",u.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:u.links.map(P=>r.jsxs("a",{href:P.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",u.id,u.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(Os,{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(Vze,{resourceType:"resource_kit",resourceId:u.id}),r.jsx(_d,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Bl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ss,{placeholder:"Add a comment...",value:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(eo,{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(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ys,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Xs,{className:"text-sm",children:M(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:gu(new Date(P.created_at),{addSuffix:!0})}),P.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(P.id),children:r.jsx($n,{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($l,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(Ji,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Ebt=()=>{const t=Gn(),[e,n]=I.useState(""),[s,a]=I.useState("grid"),{data:o=[],isLoading:l}=Kt({queryKey:["social-swag"],queryFn:async()=>{const{data:p,error:x}=await Q.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:_}=await Q.from("social_swag_links").select("*").order("sort_order");if(_)throw _;const{data:w}=await Q.from("social_swag_likes").select("swag_id"),{data:S}=await Q.from("social_swag_comments").select("swag_id"),N=new Map;w==null||w.forEach(A=>{N.set(A.swag_id,(N.get(A.swag_id)||0)+1)});const M=new Map;return S==null||S.forEach(A=>{M.set(A.swag_id,(M.get(A.swag_id)||0)+1)}),(p||[]).map(A=>({...A,links:(y||[]).filter(P=>P.swag_id===A.id)||[],likesCount:N.get(A.id)||0,commentsCount:M.get(A.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()))}),u=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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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(te,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(tp,{className:"h-4 w-4"})}),r.jsx(te,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(rp,{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(Ke,{children:r.jsxs(et,{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(te,{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(Ke,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>u(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(Lt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(Mo,{className:"h-3 w-3"}),p.links.length]})})]}),r.jsxs(et,{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(kd,{className:"h-3.5 w-3.5"}),p.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bl,{className:"h-3.5 w-3.5"}),p.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),u(p.id)},children:[r.jsx(Os,{className:"h-4 w-4"}),"View Details"]})]})]},p.id))})]})})};var La=function(){return La=Object.assign||function(e){for(var n,s=1,a=arguments.length;s1&&(u||!p),y=e>1&&(p||!u),_=function(){s&&o(s)},w=function(){a&&o(a)};return r.jsx(dwt,{displayMonth:t.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:s,onPreviousClick:_,onNextClick:w})}function uwt(t){var e,n=sl(),s=n.classNames,a=n.disableNavigation,o=n.styles,l=n.captionLayout,i=n.components,u=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:Gze,p;return a?p=r.jsx(u,{id:t.id,displayMonth:t.displayMonth}):l==="dropdown"?p=r.jsx(D4e,{displayMonth:t.displayMonth,id:t.id}):l==="dropdown-buttons"?p=r.jsxs(r.Fragment,{children:[r.jsx(D4e,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),r.jsx(R4e,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):p=r.jsxs(r.Fragment,{children:[r.jsx(u,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(R4e,{displayMonth:t.displayMonth,id:t.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:p})}function hwt(t){var e=sl(),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 fwt(t,e,n){for(var s=n?vy(new Date):yf(new Date,{locale:t,weekStartsOn:e}),a=[],o=0;o<7;o++){var l=Xl(s,o);a.push(l)}return a}function pwt(){var t=sl(),e=t.classNames,n=t.styles,s=t.showWeekNumber,a=t.locale,o=t.weekStartsOn,l=t.ISOWeek,i=t.formatters.formatWeekdayName,u=t.labels.labelWeekday,p=fwt(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":u(x,{locale:a}),children:i(x,{locale:a})},y)})]})}function mwt(){var t,e=sl(),n=e.classNames,s=e.styles,a=e.components,o=(t=a==null?void 0:a.HeadRow)!==null&&t!==void 0?t:pwt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function gwt(t){var e=sl(),n=e.locale,s=e.formatters.formatDay;return r.jsx(r.Fragment,{children:s(t.date,{locale:n})})}var Rye=I.createContext(void 0);function xwt(t){if(!GI(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return r.jsx(Rye.Provider,{value:e,children:t.children})}return r.jsx(ywt,{initialProps:t.initialProps,children:t.children})}function ywt(t){var e=t.initialProps,n=t.children,s=e.selected,a=e.min,o=e.max,l=function(p,x,y){var _,w;(_=e.onDayClick)===null||_===void 0||_.call(e,p,x,y);var S=!!(x.selected&&a&&(s==null?void 0:s.length)===a);if(!S){var N=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!N){var M=s?Hze([],s):[];if(x.selected){var E=M.findIndex(function(A){return sc(p,A)});M.splice(E,1)}else M.push(p);(w=e.onSelect)===null||w===void 0||w.call(e,M,p,x,y)}}},i={disabled:[]};s&&i.disabled.push(function(p){var x=o&&s.length>o-1,y=s.some(function(_){return sc(_,p)});return!!(x&&!y)});var u={selected:s,onDayClick:l,modifiers:i};return r.jsx(Rye.Provider,{value:u,children:n})}function Fye(){var t=I.useContext(Rye);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function vwt(t,e){var n=e||{},s=n.from,a=n.to;return s&&a?sc(a,t)&&sc(s,t)?void 0:sc(a,t)?{from:a,to:void 0}:sc(s,t)?void 0:Ete(s,t)?{from:t,to:a}:{from:s,to:t}:a?Ete(t,a)?{from:a,to:t}:{from:t,to:a}:s?Ese(t,s)?{from:t,to:s}:{from:s,to:t}:{from:t,to:void 0}}var zye=I.createContext(void 0);function _wt(t){if(!KI(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(zye.Provider,{value:e,children:t.children})}return r.jsx(bwt,{initialProps:t.initialProps,children:t.children})}function bwt(t){var e=t.initialProps,n=t.children,s=e.selected,a=s||{},o=a.from,l=a.to,i=e.min,u=e.max,p=function(w,S,N){var M,E;(M=e.onDayClick)===null||M===void 0||M.call(e,w,S,N);var A=vwt(w,s);(E=e.onSelect)===null||E===void 0||E.call(e,A,w,S,N)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],sc(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:uce(o,i-1),before:Xl(o,i-1)}),o&&l&&x.disabled.push({after:o,before:Xl(o,i-1)}),!o&&l&&x.disabled.push({after:uce(l,i-1),before:Xl(l,i-1)})),u){if(o&&!l&&(x.disabled.push({before:Xl(o,-u+1)}),x.disabled.push({after:Xl(o,u-1)})),o&&l){var y=mm(l,o)+1,_=u-y;x.disabled.push({before:uce(o,_)}),x.disabled.push({after:Xl(l,_)})}!o&&l&&(x.disabled.push({before:Xl(l,-u+1)}),x.disabled.push({after:Xl(l,u-1)}))}return r.jsx(zye.Provider,{value:{selected:s,onDayClick:p,modifiers:x},children:n})}function Bye(){var t=I.useContext(zye);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function Tee(t){return Array.isArray(t)?Hze([],t):t!==void 0?[t]:[]}function wwt(t){var e={};return Object.entries(t).forEach(function(n){var s=n[0],a=n[1];e[s]=Tee(a)}),e}var Am;(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"})(Am||(Am={}));var jwt=Am.Selected,Sx=Am.Disabled,kwt=Am.Hidden,Nwt=Am.Today,Wce=Am.RangeEnd,Gce=Am.RangeMiddle,Kce=Am.RangeStart,Swt=Am.Outside;function Cwt(t,e,n){var s,a=(s={},s[jwt]=Tee(t.selected),s[Sx]=Tee(t.disabled),s[kwt]=Tee(t.hidden),s[Nwt]=[t.today],s[Wce]=[],s[Gce]=[],s[Kce]=[],s[Swt]=[],s);return t.fromDate&&a[Sx].push({before:t.fromDate}),t.toDate&&a[Sx].push({after:t.toDate}),GI(t)?a[Sx]=a[Sx].concat(e.modifiers[Sx]):KI(t)&&(a[Sx]=a[Sx].concat(n.modifiers[Sx]),a[Kce]=n.modifiers[Kce],a[Gce]=n.modifiers[Gce],a[Wce]=n.modifiers[Wce]),a}var Yze=I.createContext(void 0);function Mwt(t){var e=sl(),n=Fye(),s=Bye(),a=Cwt(e,n,s),o=wwt(e.modifiers),l=La(La({},a),o);return r.jsx(Yze.Provider,{value:l,children:t.children})}function Xze(){var t=I.useContext(Yze);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function Twt(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Awt(t){return!!(t&&typeof t=="object"&&"from"in t)}function Ewt(t){return!!(t&&typeof t=="object"&&"after"in t)}function Iwt(t){return!!(t&&typeof t=="object"&&"before"in t)}function Pwt(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Lwt(t,e){var n,s=e.from,a=e.to;if(s&&a){var o=mm(a,s)<0;o&&(n=[a,s],s=n[0],a=n[1]);var l=mm(t,s)>=0&&mm(a,t)>=0;return l}return a?sc(a,t):s?sc(s,t):!1}function Owt(t){return Cxe(t)}function Dwt(t){return Array.isArray(t)&&t.every(Cxe)}function Rwt(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(Owt(n))return sc(t,n);if(Dwt(n))return n.includes(t);if(Awt(n))return Lwt(t,n);if(Pwt(n))return n.dayOfWeek.includes(t.getDay());if(Twt(n)){var s=mm(n.before,t),a=mm(n.after,t),o=s>0,l=a<0,i=Ete(n.before,n.after);return i?l&&o:o||l}return Ewt(n)?mm(t,n.after)>0:Iwt(n)?mm(n.before,t)>0:typeof n=="function"?n(t):!1})}function $ye(t,e,n){var s=Object.keys(e).reduce(function(o,l){var i=e[l];return Rwt(t,i)&&o.push(l),o},[]),a={};return s.forEach(function(o){return a[o]=!0}),n&&!Oxe(t,n)&&(a.outside=!0),a}function Fwt(t,e){for(var n=Sh(t[0]),s=Tse(t[t.length-1]),a,o,l=n;l<=s;){var i=$ye(l,e),u=!i.disabled&&!i.hidden;if(!u){l=Xl(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=Xl(l,1)}return o||a}var zwt=365;function Qze(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,u=a.weekStartsOn,p=a.fromDate,x=a.toDate,y=a.locale,_={day:Xl,week:Yw,month:Mh,year:sdt,startOfWeek:function(M){return a.ISOWeek?vy(M):yf(M,{locale:y,weekStartsOn:u})},endOfWeek:function(M){return a.ISOWeek?s8e(M):Mxe(M,{locale:y,weekStartsOn:u})}},w=_[n](t,s==="after"?1:-1);s==="before"&&p?w=adt([p,w]):s==="after"&&x&&(w=idt([x,w]));var S=!0;if(o){var N=$ye(w,o);S=!N.disabled&&!N.hidden}return S?w:i.count>zwt?i.lastFocused:Qze(w,{moveBy:n,direction:s,context:a,modifiers:o,retry:La(La({},i),{count:i.count+1})})}var Jze=I.createContext(void 0);function Bwt(t){var e=ZI(),n=Xze(),s=I.useState(),a=s[0],o=s[1],l=I.useState(),i=l[0],u=l[1],p=Fwt(e.displayMonths,n),x=a??(i&&e.isDateDisplayed(i))?i:p,y=function(){u(a),o(void 0)},_=function(M){o(M)},w=sl(),S=function(M,E){if(a){var A=Qze(a,{moveBy:M,direction:E,context:w,modifiers:n});sc(a,A)||(e.goToDate(A,a),_(A))}},N={focusedDay:a,focusTarget:x,blur:y,focus:_,focusDayAfter:function(){return S("day","after")},focusDayBefore:function(){return S("day","before")},focusWeekAfter:function(){return S("week","after")},focusWeekBefore:function(){return S("week","before")},focusMonthBefore:function(){return S("month","before")},focusMonthAfter:function(){return S("month","after")},focusYearBefore:function(){return S("year","before")},focusYearAfter:function(){return S("year","after")},focusStartOfWeek:function(){return S("startOfWeek","before")},focusEndOfWeek:function(){return S("endOfWeek","after")}};return r.jsx(Jze.Provider,{value:N,children:t.children})}function Uye(){var t=I.useContext(Jze);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function $wt(t,e){var n=Xze(),s=$ye(t,n,e);return s}var qye=I.createContext(void 0);function Uwt(t){if(!sae(t.initialProps)){var e={selected:void 0};return r.jsx(qye.Provider,{value:e,children:t.children})}return r.jsx(qwt,{initialProps:t.initialProps,children:t.children})}function qwt(t){var e=t.initialProps,n=t.children,s=function(o,l,i){var u,p,x;if((u=e.onDayClick)===null||u===void 0||u.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(qye.Provider,{value:a,children:n})}function e7e(){var t=I.useContext(qye);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function Vwt(t,e){var n=sl(),s=e7e(),a=Fye(),o=Bye(),l=Uye(),i=l.focusDayAfter,u=l.focusDayBefore,p=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,_=l.focus,w=l.focusMonthBefore,S=l.focusMonthAfter,N=l.focusYearBefore,M=l.focusYearAfter,E=l.focusStartOfWeek,A=l.focusEndOfWeek,P=function(fe){var he,ye,Ce,Se;sae(n)?(he=s.onDayClick)===null||he===void 0||he.call(s,t,e,fe):GI(n)?(ye=a.onDayClick)===null||ye===void 0||ye.call(a,t,e,fe):KI(n)?(Ce=o.onDayClick)===null||Ce===void 0||Ce.call(o,t,e,fe):(Se=n.onDayClick)===null||Se===void 0||Se.call(n,t,e,fe)},z=function(fe){var he;_(t),(he=n.onDayFocus)===null||he===void 0||he.call(n,t,e,fe)},R=function(fe){var he;y(),(he=n.onDayBlur)===null||he===void 0||he.call(n,t,e,fe)},U=function(fe){var he;(he=n.onDayMouseEnter)===null||he===void 0||he.call(n,t,e,fe)},V=function(fe){var he;(he=n.onDayMouseLeave)===null||he===void 0||he.call(n,t,e,fe)},K=function(fe){var he;(he=n.onDayPointerEnter)===null||he===void 0||he.call(n,t,e,fe)},W=function(fe){var he;(he=n.onDayPointerLeave)===null||he===void 0||he.call(n,t,e,fe)},J=function(fe){var he;(he=n.onDayTouchCancel)===null||he===void 0||he.call(n,t,e,fe)},ae=function(fe){var he;(he=n.onDayTouchEnd)===null||he===void 0||he.call(n,t,e,fe)},oe=function(fe){var he;(he=n.onDayTouchMove)===null||he===void 0||he.call(n,t,e,fe)},xe=function(fe){var he;(he=n.onDayTouchStart)===null||he===void 0||he.call(n,t,e,fe)},ie=function(fe){var he;(he=n.onDayKeyUp)===null||he===void 0||he.call(n,t,e,fe)},pe=function(fe){var he;switch(fe.key){case"ArrowLeft":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?i():u();break;case"ArrowRight":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?u():i();break;case"ArrowDown":fe.preventDefault(),fe.stopPropagation(),p();break;case"ArrowUp":fe.preventDefault(),fe.stopPropagation(),x();break;case"PageUp":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?N():w();break;case"PageDown":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?M():S();break;case"Home":fe.preventDefault(),fe.stopPropagation(),E();break;case"End":fe.preventDefault(),fe.stopPropagation(),A();break}(he=n.onDayKeyDown)===null||he===void 0||he.call(n,t,e,fe)},se={onClick:P,onFocus:z,onBlur:R,onKeyDown:pe,onKeyUp:ie,onMouseEnter:U,onMouseLeave:V,onPointerEnter:K,onPointerLeave:W,onTouchCancel:J,onTouchEnd:ae,onTouchMove:oe,onTouchStart:xe};return se}function Hwt(){var t=sl(),e=e7e(),n=Fye(),s=Bye(),a=sae(t)?e.selected:GI(t)?n.selected:KI(t)?s.selected:void 0;return a}function Wwt(t){return Object.values(Am).includes(t)}function Gwt(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(Wwt(s)){var o=t.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Kwt(t,e){var n=La({},t.styles.day);return Object.keys(e).forEach(function(s){var a;n=La(La({},n),(a=t.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function Zwt(t,e,n){var s,a,o,l=sl(),i=Uye(),u=$wt(t,e),p=Vwt(t,u),x=Hwt(),y=!!(l.onDayClick||l.mode!=="default");I.useEffect(function(){var U;u.outside||i.focusedDay&&y&&sc(i.focusedDay,t)&&((U=n.current)===null||U===void 0||U.focus())},[i.focusedDay,t,n,y,u.outside]);var _=Gwt(l,u).join(" "),w=Kwt(l,u),S=!!(u.outside&&!l.showOutsideDays||u.hidden),N=(o=(a=l.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:gwt,M=r.jsx(N,{date:t,displayMonth:e,activeModifiers:u}),E={style:w,className:_,children:M,role:"gridcell"},A=i.focusTarget&&sc(i.focusTarget,t)&&!u.outside,P=i.focusedDay&&sc(i.focusedDay,t),z=La(La(La({},E),(s={disabled:u.disabled,role:"gridcell"},s["aria-selected"]=u.selected,s.tabIndex=P||A?0:-1,s)),p),R={isButton:y,isHidden:S,activeModifiers:u,selectedDays:x,buttonProps:z,divProps:E};return R}function Ywt(t){var e=I.useRef(null),n=Zwt(t.date,t.displayMonth,e);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(jre,La({name:"day",ref:e},n.buttonProps)):r.jsx("div",La({},n.divProps))}function Xwt(t){var e=t.number,n=t.dates,s=sl(),a=s.onWeekNumberClick,o=s.styles,l=s.classNames,i=s.locale,u=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=u(Number(e),{locale:i}),_=function(w){a(e,n,w)};return r.jsx(jre,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:_,children:x})}function Qwt(t){var e,n,s=sl(),a=s.styles,o=s.classNames,l=s.showWeekNumber,i=s.components,u=(e=i==null?void 0:i.Day)!==null&&e!==void 0?e:Ywt,p=(n=i==null?void 0:i.WeekNumber)!==null&&n!==void 0?n:Xwt,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(u,{displayMonth:t.displayMonth,date:y})},dut(y))})]})}function F4e(t,e,n){for(var s=n!=null&&n.ISOWeek?s8e(e):Mxe(e,n),a=n!=null&&n.ISOWeek?vy(t):yf(t,n),o=mm(s,a),l=[],i=0;i<=o;i++)l.push(Xl(a,i));var u=l.reduce(function(p,x){var y=n!=null&&n.ISOWeek?Txe(x):Exe(x,n),_=p.find(function(w){return w.weekNumber===y});return _?(_.dates.push(x),p):(p.push({weekNumber:y,dates:[x]}),p)},[]);return u}function Jwt(t,e){var n=F4e(Sh(t),Tse(t),e);if(e!=null&&e.useFixedWeeks){var s=hut(t,e);if(s<6){var a=n[n.length-1],o=a.dates[a.dates.length-1],l=Yw(o,6-s),i=F4e(Yw(o,1),l,e);n.push.apply(n,i)}}return n}function ejt(t){var e,n,s,a=sl(),o=a.locale,l=a.classNames,i=a.styles,u=a.hideHead,p=a.fixedWeeks,x=a.components,y=a.weekStartsOn,_=a.firstWeekContainsDate,w=a.ISOWeek,S=Jwt(t.displayMonth,{useFixedWeeks:!!p,ISOWeek:w,locale:o,weekStartsOn:y,firstWeekContainsDate:_}),N=(e=x==null?void 0:x.Head)!==null&&e!==void 0?e:mwt,M=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Qwt,E=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:hwt;return r.jsxs("table",{id:t.id,className:l.table,style:i.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!u&&r.jsx(N,{}),r.jsx("tbody",{className:l.tbody,style:i.tbody,children:S.map(function(A){return r.jsx(M,{displayMonth:t.displayMonth,dates:A.dates,weekNumber:A.weekNumber},A.weekNumber)})}),r.jsx(E,{displayMonth:t.displayMonth})]})}function tjt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var rjt=tjt()?I.useLayoutEffect:I.useEffect,Zce=!1,njt=0;function z4e(){return"react-day-picker-".concat(++njt)}function sjt(t){var e,n=t??(Zce?z4e():null),s=I.useState(n),a=s[0],o=s[1];return rjt(function(){a===null&&o(z4e())},[]),I.useEffect(function(){Zce===!1&&(Zce=!0)},[]),(e=t??a)!==null&&e!==void 0?e:void 0}function ajt(t){var e,n,s=sl(),a=s.dir,o=s.classNames,l=s.styles,i=s.components,u=ZI().displayMonths,p=sjt(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,w=t.displayIndex===0,S=t.displayIndex===u.length-1,N=!w&&!S;a==="rtl"&&(e=[w,S],S=e[0],w=e[1]),w&&(y.push(o.caption_start),_=La(La({},_),l.caption_start)),S&&(y.push(o.caption_end),_=La(La({},_),l.caption_end)),N&&(y.push(o.caption_between),_=La(La({},_),l.caption_between));var M=(n=i==null?void 0:i.Caption)!==null&&n!==void 0?n:uwt;return r.jsxs("div",{className:y.join(" "),style:_,children:[r.jsx(M,{id:p,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(ejt,{id:x,"aria-labelledby":p,displayMonth:t.displayMonth})]},t.displayIndex)}function ijt(t){var e=sl(),n=e.classNames,s=e.styles;return r.jsx("div",{className:n.months,style:s.months,children:t.children})}function ojt(t){var e,n,s=t.initialProps,a=sl(),o=Uye(),l=ZI(),i=I.useState(!1),u=i[0],p=i[1];I.useEffect(function(){a.initialFocus&&o.focusTarget&&(u||(o.focus(o.focusTarget),p(!0)))},[a.initialFocus,u,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=La(La({},a.styles.root),a.style),_=Object.keys(s).filter(function(S){return S.startsWith("data-")}).reduce(function(S,N){var M;return La(La({},S),(M={},M[N]=s[N],M))},{}),w=(n=(e=s.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:ijt;return r.jsx("div",La({className:x.join(" "),style:y,dir:a.dir,id:a.id,nonce:s.nonce,title:s.title,lang:s.lang},_,{children:r.jsx(w,{children:l.displayMonths.map(function(S,N){return r.jsx(ajt,{displayIndex:N,displayMonth:S},N)})})}))}function ljt(t){var e=t.children,n=Ibt(t,["children"]);return r.jsx(Xbt,{initialProps:n,children:r.jsx(owt,{children:r.jsx(Uwt,{initialProps:n,children:r.jsx(xwt,{initialProps:n,children:r.jsx(_wt,{initialProps:n,children:r.jsx(Mwt,{children:r.jsx(Bwt,{children:e})})})})})})})}function cjt(t){return r.jsx(ljt,La({},t,{children:r.jsx(ojt,{initialProps:t})}))}function ly({className:t,classNames:e,showOutsideDays:n=!0,...s}){return r.jsx(cjt,{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(fE({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(fE({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(vc,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(Bi,{className:"h-4 w-4"})},...s})}ly.displayName="Calendar";var aae="Popover",[t7e]=lc(aae,[Wg]),YI=Wg(),[djt,bv]=t7e(aae),r7e=t=>{const{__scopePopover:e,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!1}=t,i=YI(e),u=I.useRef(null),[p,x]=I.useState(!1),[y,_]=Ku({prop:s,defaultProp:a??!1,onChange:o,caller:aae});return r.jsx(CI,{...i,children:r.jsx(djt,{scope:e,contentId:Qc(),triggerRef:u,open:y,onOpenChange:_,onOpenToggle:I.useCallback(()=>_(w=>!w),[_]),hasCustomAnchor:p,onCustomAnchorAdd:I.useCallback(()=>x(!0),[]),onCustomAnchorRemove:I.useCallback(()=>x(!1),[]),modal:l,children:n})})};r7e.displayName=aae;var n7e="PopoverAnchor",ujt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=bv(n7e,n),o=YI(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return I.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(d3,{...o,...s,ref:e})});ujt.displayName=n7e;var s7e="PopoverTrigger",a7e=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=bv(s7e,n),o=YI(n),l=ra(e,a.triggerRef),i=r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":d7e(a.open),...s,ref:l,onClick:cn(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(d3,{asChild:!0,...o,children:i})});a7e.displayName=s7e;var Vye="PopoverPortal",[hjt,fjt]=t7e(Vye,{forceMount:void 0}),i7e=t=>{const{__scopePopover:e,forceMount:n,children:s,container:a}=t,o=bv(Vye,e);return r.jsx(hjt,{scope:e,forceMount:n,children:r.jsx(jc,{present:n||o.open,children:r.jsx(a3,{asChild:!0,container:a,children:s})})})};i7e.displayName=Vye;var EC="PopoverContent",o7e=I.forwardRef((t,e)=>{const n=fjt(EC,t.__scopePopover),{forceMount:s=n.forceMount,...a}=t,o=bv(EC,t.__scopePopover);return r.jsx(jc,{present:s||o.open,children:o.modal?r.jsx(mjt,{...a,ref:e}):r.jsx(gjt,{...a,ref:e})})});o7e.displayName=EC;var pjt=ev("PopoverContent.RemoveScroll"),mjt=I.forwardRef((t,e)=>{const n=bv(EC,t.__scopePopover),s=I.useRef(null),a=ra(e,s),o=I.useRef(!1);return I.useEffect(()=>{const l=s.current;if(l)return tse(l)},[]),r.jsx(LI,{as:pjt,allowPinchZoom:!0,children:r.jsx(l7e,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cn(t.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:cn(t.onPointerDownOutside,l=>{const i=l.detail.originalEvent,u=i.button===0&&i.ctrlKey===!0,p=i.button===2||u;o.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:cn(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),gjt=I.forwardRef((t,e)=>{const n=bv(EC,t.__scopePopover),s=I.useRef(!1),a=I.useRef(!1);return r.jsx(l7e,{...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 u,p;(u=t.onInteractOutside)==null||u.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()}})}),l7e=I.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:x,...y}=t,_=bv(EC,n),w=YI(n);return ese(),r.jsx(II,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(uv,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:p,onDismiss:()=>_.onOpenChange(!1),children:r.jsx(MI,{"data-state":d7e(_.open),role:"dialog",id:_.contentId,...w,...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)"}})})})}),c7e="PopoverClose",xjt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=bv(c7e,n);return r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:cn(t.onClick,()=>a.onOpenChange(!1))})});xjt.displayName=c7e;var yjt="PopoverArrow",vjt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=YI(n);return r.jsx(TI,{...a,...s,ref:e})});vjt.displayName=yjt;function d7e(t){return t?"open":"closed"}var _jt=r7e,bjt=a7e,wjt=i7e,u7e=o7e;const Cd=_jt,Md=bjt,ed=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},a)=>r.jsx(wjt,{children:r.jsx(u7e,{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})}));ed.displayName=u7e.displayName;const jjt=i3("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"}}),Hye=I.forwardRef(({className:t,variant:e,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:zt(jjt({variant:e}),t),...n}));Hye.displayName="Alert";const kjt=I.forwardRef(({className:t,...e},n)=>r.jsx("h5",{ref:n,className:zt("mb-1 font-medium leading-none tracking-tight",t),...e}));kjt.displayName="AlertTitle";const Wye=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("text-sm [&_p]:leading-relaxed",t),...e}));Wye.displayName="AlertDescription";function Njt({open:t,onOpenChange:e,imageUrl:n,imageId:s,defaultCaption:a="",swagItemId:o,reelId:l}){const i=qr(),[u,p]=I.useState(a),[x,y]=I.useState([]),[_,w]=I.useState(null),[S,N]=I.useState("now"),[M,E]=I.useState(Cke(Lke(new Date),1)),[A,P]=I.useState("12"),[z,R]=I.useState("00"),[U,V]=I.useState("PM");I.useEffect(()=>{if(t){p(a),N("now"),y([]);const be=Cke(Lke(new Date),1);E(be);const rt=be.getHours();P(String(rt>12?rt-12:rt===0?12:rt)),R("00"),V(rt>=12?"PM":"AM")}},[t,a]);const K=()=>{if(!M)return null;let be=parseInt(A);const rt=parseInt(z);return U==="PM"&&be!==12&&(be+=12),U==="AM"&&be===12&&(be=0),f8e(h8e(M,be),rt)},{data:W,isLoading:J}=Kt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:be}}=await Q.auth.getUser();if(!be)return[];const{data:rt,error:Te}=await Q.from("social_accounts").select("*").eq("user_id",be.id).eq("is_active",!0).order("platform",{ascending:!0});if(Te)throw Te;return console.log("Fetched social accounts for posting:",rt),rt},enabled:t,staleTime:0}),ae=or({mutationFn:async({accountId:be,platform:rt})=>{w(be);const{data:Te,error:Pe}=await Q.functions.invoke("social-post",{body:{platform:rt,accountId:be,imageUrl:n,caption:u}});if(Pe)throw Pe;if(Te!=null&&Te.error)throw new Error(Te.error);return Te},onSuccess:be=>{const rt=be.platform==="facebook"?"Facebook":be.platform==="instagram"?"Instagram":be.platform==="linkedin"?"LinkedIn":"Google Business";Oe.success(`Posted to ${rt}!`)},onError:be=>{Oe.error(`Failed to post: ${be.message}`)},onSettled:()=>{w(null)}}),oe=or({mutationFn:async({accountId:be,platform:rt,scheduledFor:Te})=>{const{data:{user:Pe}}=await Q.auth.getUser();if(!Pe)throw new Error("Not authenticated");const{error:Ue}=await Q.from("scheduled_posts").insert({user_id:Pe.id,social_account_id:be,platform:rt,image_url:n,caption:u,swag_item_id:o||null,reel_id:l||null,scheduled_for:Te.toISOString(),status:"scheduled"});if(Ue)throw Ue;return{platform:rt}},onSuccess:be=>{const rt=be.platform==="facebook"?"Facebook":be.platform==="instagram"?"Instagram":"LinkedIn";Oe.success(`Post scheduled for ${rt}!`)},onError:be=>{Oe.error(`Failed to schedule: ${be.message}`)}}),xe=async()=>{if(x.length===0){Oe.error("Please select at least one account");return}if(S==="schedule"){const be=K();if(!be||be<=new Date){Oe.error("Please select a future date and time");return}for(const rt of x){const Te=W==null?void 0:W.find(Pe=>Pe.id===rt);Te&&await oe.mutateAsync({accountId:rt,platform:Te.platform,scheduledFor:be})}i.invalidateQueries({queryKey:["scheduled-posts"]}),Oe.success(`${x.length} post(s) scheduled for ${mn(be,"PPp")}`)}else for(const be of x){const rt=W==null?void 0:W.find(Te=>Te.id===be);rt&&await ae.mutateAsync({accountId:be,platform:rt.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),p(""),y([]),e(!1)},ie=be=>{y(rt=>rt.includes(be)?rt.filter(Te=>Te!==be):[...rt,be])},pe=(W==null?void 0:W.filter(be=>be.platform==="facebook"))||[],se=(W==null?void 0:W.filter(be=>be.platform==="instagram"))||[],fe=(W==null?void 0:W.filter(be=>be.platform==="linkedin"))||[],he=(W==null?void 0:W.filter(be=>be.platform==="google_business"))||[],ye=((W==null?void 0:W.length)||0)>0,Ce=ae.isPending||oe.isPending,Se=Array.from({length:12},(be,rt)=>String(rt+1)),Ne=["00","15","30","45"];return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create Social Post"}),r.jsx(Jn,{children:"Share this image to your connected social accounts"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:n,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"caption",children:"Caption"}),r.jsx(ss,{id:"caption",placeholder:"Write a caption for your post...",value:u,onChange:be=>p(be.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[u.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{children:"Publish Time"}),r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[r.jsx("button",{type:"button",onClick:()=>N("now"),className:zt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",S==="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",S==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),S==="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(Wa,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("justify-start text-left font-normal flex-1",!M&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),M?mn(M,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:M,onSelect:E,disabled:be=>ber.jsx(qt,{value:be,children:be},be))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(xn,{value:z,onValueChange:R,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(vn,{})}),r.jsx(pn,{children:Ne.map(be=>r.jsx(qt,{value:be,children:be},be))})]}),r.jsxs(xn,{value:U,onValueChange:be=>V(be),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(vn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"AM",children:"AM"}),r.jsx(qt,{value:"PM",children:"PM"})]})]})]})]}),M&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",mn(K()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{children:"Post to"}),J&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin"})}),!J&&!ye&&r.jsxs(Hye,{children:[r.jsx(pl,{className:"h-4 w-4"}),r.jsxs(Wye,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(Ji,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(jd,{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(Jd,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),pe.map(be=>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(Fl,{checked:x.includes(be.id),onCheckedChange:()=>ie(be.id),disabled:_===be.id}),r.jsxs(Ys,{className:"h-8 w-8",children:[r.jsx(Pi,{src:be.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(Jd,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:be.page_name||be.platform_username}),_===be.id&&r.jsx(Yr,{className:"h-4 w-4 animate-spin"})]},be.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(mu,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),se.map(be=>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(Fl,{checked:x.includes(be.id),onCheckedChange:()=>ie(be.id),disabled:_===be.id}),r.jsxs(Ys,{className:"h-8 w-8",children:[r.jsx(Pi,{src:be.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(mu,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",be.platform_username]}),_===be.id&&r.jsx(Yr,{className:"h-4 w-4 animate-spin"})]},be.id))]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(wm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),fe.map(be=>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(Fl,{checked:x.includes(be.id),onCheckedChange:()=>ie(be.id),disabled:_===be.id}),r.jsxs(Ys,{className:"h-8 w-8",children:[r.jsx(Pi,{src:be.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(wm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:be.platform_username}),_===be.id&&r.jsx(Yr,{className:"h-4 w-4 animate-spin"})]},be.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(To,{className:"h-4 w-4 text-red-600"})," Google Business"]}),he.map(be=>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(Fl,{checked:x.includes(be.id),onCheckedChange:()=>ie(be.id),disabled:_===be.id}),r.jsxs(Ys,{className:"h-8 w-8",children:[r.jsx(Pi,{src:be.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(To,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:be.page_name||be.platform_username}),_===be.id&&r.jsx(Yr,{className:"h-4 w-4 animate-spin"})]},be.id))]})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{onClick:xe,disabled:x.length===0||Ce,className:"gap-2",children:[Ce?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):S==="schedule"?r.jsx(Ds,{className:"h-4 w-4"}):r.jsx(eo,{className:"h-4 w-4"}),S==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}function Sjt(){const t=qr(),[e,n]=I.useState(void 0),[s,a]=I.useState("all"),[o,l]=I.useState(null),[i,u]=I.useState(""),[p,x]=I.useState(void 0),[y,_]=I.useState("12"),[w,S]=I.useState("00"),[N,M]=I.useState("PM"),{data:E=[],isLoading:A}=Kt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:he,error:ye}=await Q.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(ye)throw ye;return he}}),P=E.filter(he=>{if(s!=="all"&&he.status!==s)return!1;if(e&&he.scheduled_for){const ye=new Date(he.scheduled_for);if(!sc(ye,e))return!1}return!0}),z=E.filter(he=>he.scheduled_for).map(he=>vf(new Date(he.scheduled_for))),R=or({mutationFn:async he=>{const{error:ye}=await Q.from("scheduled_posts").update({caption:he.caption,scheduled_for:he.scheduled_for}).eq("id",he.id);if(ye)throw ye},onSuccess:()=>{Oe.success("Post updated!"),t.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:he=>{Oe.error(`Failed to update: ${he.message}`)}}),U=or({mutationFn:async he=>{const{error:ye}=await Q.from("scheduled_posts").update({status:"cancelled"}).eq("id",he);if(ye)throw ye},onSuccess:()=>{Oe.success("Post cancelled"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Oe.error(`Failed to cancel: ${he.message}`)}}),V=or({mutationFn:async he=>{const{error:ye}=await Q.from("scheduled_posts").delete().eq("id",he);if(ye)throw ye},onSuccess:()=>{Oe.success("Post deleted"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Oe.error(`Failed to delete: ${he.message}`)}}),K=or({mutationFn:async he=>{const{data:ye,error:Ce}=await Q.functions.invoke("social-post",{body:{platform:he.platform,accountId:he.social_account_id,imageUrl:he.image_url,caption:he.caption}});if(Ce)throw Ce;if(ye!=null&&ye.error)throw new Error(ye.error);return await Q.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:ye.postId}).eq("id",he.id),ye},onSuccess:he=>{const ye=he.platform==="facebook"?"Facebook":he.platform==="instagram"?"Instagram":"LinkedIn";Oe.success(`Posted to ${ye}!`),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Oe.error(`Failed to post: ${he.message}`)}}),W=he=>{if(l(he),u(he.caption||""),he.scheduled_for){const ye=new Date(he.scheduled_for);x(ye);const Ce=ye.getHours();_(String(Ce>12?Ce-12:Ce===0?12:Ce)),S(String(ye.getMinutes()).padStart(2,"0")),M(Ce>=12?"PM":"AM")}},J=()=>{if(!o||!p)return;let he=parseInt(y);const ye=parseInt(w);N==="PM"&&he!==12&&(he+=12),N==="AM"&&he===12&&(he=0);const Ce=f8e(h8e(p,he),ye);R.mutate({id:o.id,caption:i,scheduled_for:Ce.toISOString()})},ae=he=>{switch(he){case"facebook":return r.jsx(Jd,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(mu,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(wm,{className:"h-4 w-4 text-blue-700"});default:return null}},oe=he=>{switch(he){case"scheduled":return r.jsxs(Lt,{variant:"secondary",className:"gap-1",children:[r.jsx(Wa,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Lt,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(Ii,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Lt,{variant:"destructive",className:"gap-1",children:[r.jsx(Lc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Lt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(pl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Lt,{variant:"outline",children:he})}},xe=Array.from({length:12},(he,ye)=>String(ye+1)),ie=["00","15","30","45"],pe=E.filter(he=>he.status==="scheduled").length,se=E.filter(he=>he.status==="posted").length,fe=E.filter(he=>he.status==="scheduled"&&he.scheduled_for&&fut(new Date(he.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(Ke,{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(Ke,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:fe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(Ke,{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(Ke,{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(Ke,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(_m,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(ly,{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(te,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(L1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(he=>r.jsx(te,{variant:s===he?"default":"outline",size:"sm",onClick:()=>a(he),className:"capitalize",children:he},he))})]}),A&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!A&&P.length===0&&r.jsxs(Ke,{className:"p-8 text-center",children:[r.jsx(Ds,{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 ${mn(e,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:P.map(he=>{var ye,Ce;return r.jsx(Ke,{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:he.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(et,{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:[ae(he.platform),r.jsx("span",{className:"font-medium",children:((ye=he.social_accounts)==null?void 0:ye.page_name)||((Ce=he.social_accounts)==null?void 0:Ce.platform_username)||"Unknown"}),oe(he.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[he.status==="scheduled"&&r.jsxs(AI,{children:[r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>W(he),children:r.jsx(ni,{className:"h-4 w-4"})})}),r.jsx(Nm,{children:"Edit post"})]}),r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>K.mutate(he),disabled:K.isPending,children:K.isPending?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(eo,{className:"h-4 w-4"})})}),r.jsx(Nm,{children:"Post now"})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Cancel this scheduled post?"}),r.jsx(Zd,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Keep"}),r.jsx(yd,{onClick:()=>U.mutate(he.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(yd,{onClick:()=>V.mutate(he.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(he.status==="posted"||he.status==="cancelled"||he.status==="failed")&&r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Delete this post?"}),r.jsx(Zd,{children:"This will permanently remove this post from your history."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:()=>V.mutate(he.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),he.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:he.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Wa,{className:"h-3 w-3"}),he.status==="posted"&&he.posted_at?`Posted ${mn(new Date(he.posted_at),"PPp")}`:he.scheduled_for?`Scheduled for ${mn(new Date(he.scheduled_for),"PPp")}`:"Not scheduled"]}),he.status==="failed"&&he.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",he.error_message]})]})]})},he.id)})})]})]}),r.jsx(Dr,{open:!!o,onOpenChange:he=>!he&&l(null),children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Edit Scheduled Post"}),r.jsx(Jn,{children:"Update the caption or reschedule this post"})]}),o&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Caption"}),r.jsx(ss,{value:i,onChange:he=>u(he.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(qe,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("justify-start text-left font-normal flex-1",!p&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),p?mn(p,"PPP"):"Pick a date"]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:p,onSelect:x,disabled:he=>her.jsx(qt,{value:he,children:he},he))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(xn,{value:w,onValueChange:S,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(vn,{})}),r.jsx(pn,{children:ie.map(he=>r.jsx(qt,{value:he,children:he},he))})]}),r.jsxs(xn,{value:N,onValueChange:he=>M(he),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(vn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"AM",children:"AM"}),r.jsx(qt,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(te,{onClick:J,disabled:R.isPending,children:[R.isPending?r.jsx(Yr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function QL(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 h7e={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 QL=="function"&&QL;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 w=a[p]={exports:{}};s[p][0].call(w.exports,function(S){var N=s[p][1][S];return l(N||S)},w,w.exports,n,s,a,o)}return a[p].exports}for(var i=typeof QL=="function"&&QL,u=0;u>2,w=(3&p)<<4|x>>4,S=1>6:64,N=2>4,x=(15&_)<<4|(w=i.indexOf(u.charAt(N++)))>>2,y=(3&w)<<6|(S=i.indexOf(u.charAt(N++))),A[M++]=p,w!==64&&(A[M++]=x),S!==64&&(A[M++]=y);return A}},{"./support":30,"./utils":32}],2:[function(n,s,a){var o=n("./external"),l=n("./stream/DataWorker"),i=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function p(x,y,_,w,S){this.compressedSize=x,this.uncompressedSize=y,this.crc32=_,this.compression=w,this.compressedContent=S}p.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("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 u("uncompressedSize")).pipe(y.compressWorker(_)).pipe(new u("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,u=[],p=0;p<256;p++){i=p;for(var x=0;x<8;x++)i=1&i?3988292384^i>>>1:i>>>1;u[p]=i}return u}();s.exports=function(i,u){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(p,x,y,_){var w=l,S=_+y;p^=-1;for(var N=_;N>>8^w[255&(p^x[N])];return-1^p}(0|u,i,i.length,0):function(p,x,y,_){var w=l,S=_+y;p^=-1;for(var N=_;N>>8^w[255&(p^x.charCodeAt(N))];return-1^p}(0|u,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"),u=n("./stream/GenericWorker"),p=o?"uint8array":"array";function x(y,_){u.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=_,this.meta={}}a.magic="\b\0",i.inherits(x,u),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(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){u.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(w,S){var N,M="";for(N=0;N>>=8;return M}function l(w,S,N,M,E,A){var P,z,R=w.file,U=w.compression,V=A!==p.utf8encode,K=i.transformTo("string",A(R.name)),W=i.transformTo("string",p.utf8encode(R.name)),J=R.comment,ae=i.transformTo("string",A(J)),oe=i.transformTo("string",p.utf8encode(J)),xe=W.length!==R.name.length,ie=oe.length!==J.length,pe="",se="",fe="",he=R.dir,ye=R.date,Ce={crc32:0,compressedSize:0,uncompressedSize:0};S&&!N||(Ce.crc32=w.crc32,Ce.compressedSize=w.compressedSize,Ce.uncompressedSize=w.uncompressedSize);var Se=0;S&&(Se|=8),V||!xe&&!ie||(Se|=2048);var Ne=0,be=0;he&&(Ne|=16),E==="UNIX"?(be=798,Ne|=function(Te,Pe){var Ue=Te;return Te||(Ue=Pe?16893:33204),(65535&Ue)<<16}(R.unixPermissions,he)):(be=20,Ne|=function(Te){return 63&(Te||0)}(R.dosPermissions)),P=ye.getUTCHours(),P<<=6,P|=ye.getUTCMinutes(),P<<=5,P|=ye.getUTCSeconds()/2,z=ye.getUTCFullYear()-1980,z<<=4,z|=ye.getUTCMonth()+1,z<<=5,z|=ye.getUTCDate(),xe&&(se=o(1,1)+o(x(K),4)+W,pe+="up"+o(se.length,2)+se),ie&&(fe=o(1,1)+o(x(ae),4)+oe,pe+="uc"+o(fe.length,2)+fe);var rt="";return rt+=` \0`,rt+=o(Se,2),rt+=U.magic,rt+=o(P,2),rt+=o(z,2),rt+=o(Ce.crc32,4),rt+=o(Ce.compressedSize,4),rt+=o(Ce.uncompressedSize,4),rt+=o(K.length,2),rt+=o(pe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+rt+K+pe,dirRecord:y.CENTRAL_FILE_HEADER+o(be,2)+rt+o(ae.length,2)+"\0\0\0\0"+o(Ne,4)+o(M,4)+K+pe+ae}}var i=n("../utils"),u=n("../stream/GenericWorker"),p=n("../utf8"),x=n("../crc32"),y=n("../signature");function _(w,S,N,M){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=N,this.encodeFileName=M,this.streamFiles=w,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(_,u),_.prototype.push=function(w){var S=w.meta.percent||0,N=this.entriesCount,M=this._sources.length;this.accumulate?this.contentBuffer.push(w):(this.bytesWritten+=w.data.length,u.prototype.push.call(this,{data:w.data,meta:{currentFile:this.currentFile,percent:N?(S+100*(N-M-1))/N:100}}))},_.prototype.openedSource=function(w){this.currentSourceOffset=this.bytesWritten,this.currentFile=w.file.name;var S=this.streamFiles&&!w.file.dir;if(S){var N=l(w,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:N.fileRecord,meta:{percent:0}})}else this.accumulate=!0},_.prototype.closedSource=function(w){this.accumulate=!1;var S=this.streamFiles&&!w.file.dir,N=l(w,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(N.dirRecord),S)this.push({data:function(M){return y.DATA_DESCRIPTOR+o(M.crc32,4)+o(M.compressedSize,4)+o(M.uncompressedSize,4)}(w),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 w=this.bytesWritten,S=0;S=this.index;u--)p=(p<<8)+this.byteAt(u);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 u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},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 u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},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 u=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,a){var o=n("../utils"),l=n("../support"),i=n("./ArrayReader"),u=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 u(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(u){o.call(this,"ConvertWorker to "+u),this.destType=u}l.inherits(i,o),i.prototype.processChunk=function(u){this.push({data:l.transformTo(this.destType,u.data),meta:u.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(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},s.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(u){l.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(i,l),i.prototype.processChunk=function(u){if(u){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+u.data.length}l.prototype.processChunk.call(this,u)},s.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(u){l.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.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 u=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,p);break;case"uint8array":u=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":u=this.data.slice(this.index,p)}return this.index=p,this.push({data:u,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 u=0;u "+l:l}},s.exports=o},{}],29:[function(n,s,a){var o=n("../utils"),l=n("./ConvertWorker"),i=n("./GenericWorker"),u=n("../base64"),p=n("../support"),x=n("../external"),y=null;if(p.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function _(S,N){return new x.Promise(function(M,E){var A=[],P=S._internalType,z=S._outputType,R=S._mimeType;S.on("data",function(U,V){A.push(U),N&&N(V)}).on("error",function(U){A=[],E(U)}).on("end",function(){try{var U=function(V,K,W){switch(V){case"blob":return o.newBlob(o.transformTo("arraybuffer",K),W);case"base64":return u.encode(K);default:return o.transformTo(V,K)}}(z,function(V,K){var W,J=0,ae=null,oe=0;for(W=0;W"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"),u=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(){u.call(this,"utf-8 decode"),this.leftOver=null}function _(){u.call(this,"utf-8 encode")}a.utf8encode=function(w){return l.nodebuffer?i.newBufferFrom(w,"utf-8"):function(S){var N,M,E,A,P,z=S.length,R=0;for(A=0;A>>6:(M<65536?N[P++]=224|M>>>12:(N[P++]=240|M>>>18,N[P++]=128|M>>>12&63),N[P++]=128|M>>>6&63),N[P++]=128|63&M);return N}(w)},a.utf8decode=function(w){return l.nodebuffer?o.transformTo("nodebuffer",w).toString("utf-8"):function(S){var N,M,E,A,P=S.length,z=new Array(2*P);for(N=M=0;N>10&1023,z[M++]=56320|1023&E)}return z.length!==M&&(z.subarray?z=z.subarray(0,M):z.length=M),o.applyFromCharCode(z)}(w=o.transformTo(l.uint8array?"uint8array":"array",w))},o.inherits(y,u),y.prototype.processChunk=function(w){var S=o.transformTo(l.uint8array?"uint8array":"array",w.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var N=S;(S=new Uint8Array(N.length+this.leftOver.length)).set(this.leftOver,0),S.set(N,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var M=function(A,P){var z;for((P=P||A.length)>A.length&&(P=A.length),z=P-1;0<=z&&(192&A[z])==128;)z--;return z<0||z===0?P:z+p[A[z]]>P?z:P}(S),E=S;M!==S.length&&(l.uint8array?(E=S.subarray(0,M),this.leftOver=S.subarray(M,S.length)):(E=S.slice(0,M),this.leftOver=S.slice(M,S.length))),this.push({data:a.utf8decode(E),meta:w.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(_,u),_.prototype.processChunk=function(w){this.push({data:a.utf8encode(w.data),meta:w.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"),u=n("./external");function p(N){return N}function x(N,M){for(var E=0;E>8;this.dir=!!(16&this.externalFileAttributes),w==0&&(this.dosPermissions=63&this.externalFileAttributes),w==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var w=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=w.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=w.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=w.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=w.readInt(4))}},readExtraFields:function(w){var S,N,M,E=w.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});w.index+4>>6:(w<65536?_[M++]=224|w>>>12:(_[M++]=240|w>>>18,_[M++]=128|w>>>12&63),_[M++]=128|w>>>6&63),_[M++]=128|63&w);return _},a.buf2binstring=function(y){return x(y,y.length)},a.binstring2buf=function(y){for(var _=new o.Buf8(y.length),w=0,S=_.length;w>10&1023,A[S++]=56320|1023&N)}return x(A,S)},a.utf8border=function(y,_){var w;for((_=_||y.length)>y.length&&(_=y.length),w=_-1;0<=w&&(192&y[w])==128;)w--;return w<0||w===0?_:w+u[y[w]]>_?w:_}},{"./common":41}],43:[function(n,s,a){s.exports=function(o,l,i,u){for(var p=65535&o|0,x=o>>>16&65535|0,y=0;i!==0;){for(i-=y=2e3>>1:l>>>1;i[u]=l}return i}();s.exports=function(l,i,u,p){var x=o,y=p+u;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"),u=n("./adler32"),p=n("./crc32"),x=n("./messages"),y=0,_=4,w=0,S=-2,N=-1,M=4,E=2,A=8,P=9,z=286,R=30,U=19,V=2*z+1,K=15,W=3,J=258,ae=J+W+1,oe=42,xe=113,ie=1,pe=2,se=3,fe=4;function he(le,Ve){return le.msg=x[Ve],Ve}function ye(le){return(le<<1)-(4le.avail_out&&(Le=le.avail_out),Le!==0&&(l.arraySet(le.output,Ve.pending_buf,Ve.pending_out,Le,le.next_out),le.next_out+=Le,Ve.pending_out+=Le,le.total_out+=Le,le.avail_out-=Le,Ve.pending-=Le,Ve.pending===0&&(Ve.pending_out=0))}function Ne(le,Ve){i._tr_flush_block(le,0<=le.block_start?le.block_start:-1,le.strstart-le.block_start,Ve),le.block_start=le.strstart,Se(le.strm)}function be(le,Ve){le.pending_buf[le.pending++]=Ve}function rt(le,Ve){le.pending_buf[le.pending++]=Ve>>>8&255,le.pending_buf[le.pending++]=255&Ve}function Te(le,Ve){var Le,We,_e=le.max_chain_length,st=le.strstart,ze=le.prev_length,Ee=le.nice_match,Je=le.strstart>le.w_size-ae?le.strstart-(le.w_size-ae):0,at=le.window,pt=le.w_mask,gt=le.prev,Mt=le.strstart+J,wt=at[st+ze-1],Xt=at[st+ze];le.prev_length>=le.good_match&&(_e>>=2),Ee>le.lookahead&&(Ee=le.lookahead);do if(at[(Le=Ve)+ze]===Xt&&at[Le+ze-1]===wt&&at[Le]===at[st]&&at[++Le]===at[st+1]){st+=2,Le++;do;while(at[++st]===at[++Le]&&at[++st]===at[++Le]&&at[++st]===at[++Le]&&at[++st]===at[++Le]&&at[++st]===at[++Le]&&at[++st]===at[++Le]&&at[++st]===at[++Le]&&at[++st]===at[++Le]&&stJe&&--_e!=0);return ze<=le.lookahead?ze:le.lookahead}function Pe(le){var Ve,Le,We,_e,st,ze,Ee,Je,at,pt,gt=le.w_size;do{if(_e=le.window_size-le.lookahead-le.strstart,le.strstart>=gt+(gt-ae)){for(l.arraySet(le.window,le.window,gt,gt,0),le.match_start-=gt,le.strstart-=gt,le.block_start-=gt,Ve=Le=le.hash_size;We=le.head[--Ve],le.head[Ve]=gt<=We?We-gt:0,--Le;);for(Ve=Le=gt;We=le.prev[--Ve],le.prev[Ve]=gt<=We?We-gt:0,--Le;);_e+=gt}if(le.strm.avail_in===0)break;if(ze=le.strm,Ee=le.window,Je=le.strstart+le.lookahead,at=_e,pt=void 0,pt=ze.avail_in,at=W)for(st=le.strstart-le.insert,le.ins_h=le.window[st],le.ins_h=(le.ins_h<=W&&(le.ins_h=(le.ins_h<=W)if(We=i._tr_tally(le,le.strstart-le.match_start,le.match_length-W),le.lookahead-=le.match_length,le.match_length<=le.max_lazy_match&&le.lookahead>=W){for(le.match_length--;le.strstart++,le.ins_h=(le.ins_h<=W&&(le.ins_h=(le.ins_h<=W&&le.match_length<=le.prev_length){for(_e=le.strstart+le.lookahead-W,We=i._tr_tally(le,le.strstart-1-le.prev_match,le.prev_length-W),le.lookahead-=le.prev_length-1,le.prev_length-=2;++le.strstart<=_e&&(le.ins_h=(le.ins_h<le.pending_buf_size-5&&(Le=le.pending_buf_size-5);;){if(le.lookahead<=1){if(Pe(le),le.lookahead===0&&Ve===y)return ie;if(le.lookahead===0)break}le.strstart+=le.lookahead,le.lookahead=0;var We=le.block_start+Le;if((le.strstart===0||le.strstart>=We)&&(le.lookahead=le.strstart-We,le.strstart=We,Ne(le,!1),le.strm.avail_out===0)||le.strstart-le.block_start>=le.w_size-ae&&(Ne(le,!1),le.strm.avail_out===0))return ie}return le.insert=0,Ve===_?(Ne(le,!0),le.strm.avail_out===0?se:fe):(le.strstart>le.block_start&&(Ne(le,!1),le.strm.avail_out),ie)}),new Be(4,4,8,4,Ue),new Be(4,5,16,8,Ue),new Be(4,6,32,32,Ue),new Be(4,4,16,16,Re),new Be(8,16,32,32,Re),new Be(8,16,128,128,Re),new Be(8,32,128,256,Re),new Be(32,128,258,1024,Re),new Be(32,258,258,4096,Re)],a.deflateInit=function(le,Ve){return Qe(le,Ve,A,15,8,0)},a.deflateInit2=Qe,a.deflateReset=Me,a.deflateResetKeep=ht,a.deflateSetHeader=function(le,Ve){return le&&le.state?le.state.wrap!==2?S:(le.state.gzhead=Ve,w):S},a.deflate=function(le,Ve){var Le,We,_e,st;if(!le||!le.state||5>8&255),be(We,We.gzhead.time>>16&255),be(We,We.gzhead.time>>24&255),be(We,We.level===9?2:2<=We.strategy||We.level<2?4:0),be(We,255&We.gzhead.os),We.gzhead.extra&&We.gzhead.extra.length&&(be(We,255&We.gzhead.extra.length),be(We,We.gzhead.extra.length>>8&255)),We.gzhead.hcrc&&(le.adler=p(le.adler,We.pending_buf,We.pending,0)),We.gzindex=0,We.status=69):(be(We,0),be(We,0),be(We,0),be(We,0),be(We,0),be(We,We.level===9?2:2<=We.strategy||We.level<2?4:0),be(We,3),We.status=xe);else{var ze=A+(We.w_bits-8<<4)<<8;ze|=(2<=We.strategy||We.level<2?0:We.level<6?1:We.level===6?2:3)<<6,We.strstart!==0&&(ze|=32),ze+=31-ze%31,We.status=xe,rt(We,ze),We.strstart!==0&&(rt(We,le.adler>>>16),rt(We,65535&le.adler)),le.adler=1}if(We.status===69)if(We.gzhead.extra){for(_e=We.pending;We.gzindex<(65535&We.gzhead.extra.length)&&(We.pending!==We.pending_buf_size||(We.gzhead.hcrc&&We.pending>_e&&(le.adler=p(le.adler,We.pending_buf,We.pending-_e,_e)),Se(le),_e=We.pending,We.pending!==We.pending_buf_size));)be(We,255&We.gzhead.extra[We.gzindex]),We.gzindex++;We.gzhead.hcrc&&We.pending>_e&&(le.adler=p(le.adler,We.pending_buf,We.pending-_e,_e)),We.gzindex===We.gzhead.extra.length&&(We.gzindex=0,We.status=73)}else We.status=73;if(We.status===73)if(We.gzhead.name){_e=We.pending;do{if(We.pending===We.pending_buf_size&&(We.gzhead.hcrc&&We.pending>_e&&(le.adler=p(le.adler,We.pending_buf,We.pending-_e,_e)),Se(le),_e=We.pending,We.pending===We.pending_buf_size)){st=1;break}st=We.gzindex_e&&(le.adler=p(le.adler,We.pending_buf,We.pending-_e,_e)),st===0&&(We.gzindex=0,We.status=91)}else We.status=91;if(We.status===91)if(We.gzhead.comment){_e=We.pending;do{if(We.pending===We.pending_buf_size&&(We.gzhead.hcrc&&We.pending>_e&&(le.adler=p(le.adler,We.pending_buf,We.pending-_e,_e)),Se(le),_e=We.pending,We.pending===We.pending_buf_size)){st=1;break}st=We.gzindex_e&&(le.adler=p(le.adler,We.pending_buf,We.pending-_e,_e)),st===0&&(We.status=103)}else We.status=103;if(We.status===103&&(We.gzhead.hcrc?(We.pending+2>We.pending_buf_size&&Se(le),We.pending+2<=We.pending_buf_size&&(be(We,255&le.adler),be(We,le.adler>>8&255),le.adler=0,We.status=xe)):We.status=xe),We.pending!==0){if(Se(le),le.avail_out===0)return We.last_flush=-1,w}else if(le.avail_in===0&&ye(Ve)<=ye(Le)&&Ve!==_)return he(le,-5);if(We.status===666&&le.avail_in!==0)return he(le,-5);if(le.avail_in!==0||We.lookahead!==0||Ve!==y&&We.status!==666){var Ee=We.strategy===2?function(Je,at){for(var pt;;){if(Je.lookahead===0&&(Pe(Je),Je.lookahead===0)){if(at===y)return ie;break}if(Je.match_length=0,pt=i._tr_tally(Je,0,Je.window[Je.strstart]),Je.lookahead--,Je.strstart++,pt&&(Ne(Je,!1),Je.strm.avail_out===0))return ie}return Je.insert=0,at===_?(Ne(Je,!0),Je.strm.avail_out===0?se:fe):Je.last_lit&&(Ne(Je,!1),Je.strm.avail_out===0)?ie:pe}(We,Ve):We.strategy===3?function(Je,at){for(var pt,gt,Mt,wt,Xt=Je.window;;){if(Je.lookahead<=J){if(Pe(Je),Je.lookahead<=J&&at===y)return ie;if(Je.lookahead===0)break}if(Je.match_length=0,Je.lookahead>=W&&0Je.lookahead&&(Je.match_length=Je.lookahead)}if(Je.match_length>=W?(pt=i._tr_tally(Je,1,Je.match_length-W),Je.lookahead-=Je.match_length,Je.strstart+=Je.match_length,Je.match_length=0):(pt=i._tr_tally(Je,0,Je.window[Je.strstart]),Je.lookahead--,Je.strstart++),pt&&(Ne(Je,!1),Je.strm.avail_out===0))return ie}return Je.insert=0,at===_?(Ne(Je,!0),Je.strm.avail_out===0?se:fe):Je.last_lit&&(Ne(Je,!1),Je.strm.avail_out===0)?ie:pe}(We,Ve):o[We.level].func(We,Ve);if(Ee!==se&&Ee!==fe||(We.status=666),Ee===ie||Ee===se)return le.avail_out===0&&(We.last_flush=-1),w;if(Ee===pe&&(Ve===1?i._tr_align(We):Ve!==5&&(i._tr_stored_block(We,0,0,!1),Ve===3&&(Ce(We.head),We.lookahead===0&&(We.strstart=0,We.block_start=0,We.insert=0))),Se(le),le.avail_out===0))return We.last_flush=-1,w}return Ve!==_?w:We.wrap<=0?1:(We.wrap===2?(be(We,255&le.adler),be(We,le.adler>>8&255),be(We,le.adler>>16&255),be(We,le.adler>>24&255),be(We,255&le.total_in),be(We,le.total_in>>8&255),be(We,le.total_in>>16&255),be(We,le.total_in>>24&255)):(rt(We,le.adler>>>16),rt(We,65535&le.adler)),Se(le),0=Le.w_size&&(st===0&&(Ce(Le.head),Le.strstart=0,Le.block_start=0,Le.insert=0),at=new l.Buf8(Le.w_size),l.arraySet(at,Ve,pt-Le.w_size,Le.w_size,0),Ve=at,pt=Le.w_size),ze=le.avail_in,Ee=le.next_in,Je=le.input,le.avail_in=pt,le.next_in=0,le.input=Ve,Pe(Le);Le.lookahead>=W;){for(We=Le.strstart,_e=Le.lookahead-(W-1);Le.ins_h=(Le.ins_h<>>=W=K>>>24,P-=W,(W=K>>>16&255)===0)pe[x++]=65535&K;else{if(!(16&W)){if(!(64&W)){K=z[(65535&K)+(A&(1<>>=W,P-=W),P<15&&(A+=ie[u++]<>>=W=K>>>24,P-=W,!(16&(W=K>>>16&255))){if(!(64&W)){K=R[(65535&K)+(A&(1<>>=W,P-=W,(W=x-y)>3,A&=(1<<(P-=J<<3))-1,o.next_in=u,o.next_out=x,o.avail_in=u>>24&255)+(oe>>>8&65280)+((65280&oe)<<8)+((255&oe)<<24)}function A(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function P(oe){var xe;return oe&&oe.state?(xe=oe.state,oe.total_in=oe.total_out=xe.total=0,oe.msg="",xe.wrap&&(oe.adler=1&xe.wrap),xe.mode=S,xe.last=0,xe.havedict=0,xe.dmax=32768,xe.head=null,xe.hold=0,xe.bits=0,xe.lencode=xe.lendyn=new o.Buf32(N),xe.distcode=xe.distdyn=new o.Buf32(M),xe.sane=1,xe.back=-1,_):w}function z(oe){var xe;return oe&&oe.state?((xe=oe.state).wsize=0,xe.whave=0,xe.wnext=0,P(oe)):w}function R(oe,xe){var ie,pe;return oe&&oe.state?(pe=oe.state,xe<0?(ie=0,xe=-xe):(ie=1+(xe>>4),xe<48&&(xe&=15)),xe&&(xe<8||15=fe.wsize?(o.arraySet(fe.window,xe,ie-fe.wsize,fe.wsize,0),fe.wnext=0,fe.whave=fe.wsize):(pe<(se=fe.wsize-fe.wnext)&&(se=pe),o.arraySet(fe.window,xe,ie-pe,se,fe.wnext),(pe-=se)?(o.arraySet(fe.window,xe,ie-pe,pe,0),fe.wnext=pe,fe.whave=fe.wsize):(fe.wnext+=se,fe.wnext===fe.wsize&&(fe.wnext=0),fe.whave>>8&255,ie.check=i(ie.check,st,2,0),Ne=Se=0,ie.mode=2;break}if(ie.flags=0,ie.head&&(ie.head.done=!1),!(1&ie.wrap)||(((255&Se)<<8)+(Se>>8))%31){oe.msg="incorrect header check",ie.mode=30;break}if((15&Se)!=8){oe.msg="unknown compression method",ie.mode=30;break}if(Ne-=4,le=8+(15&(Se>>>=4)),ie.wbits===0)ie.wbits=le;else if(le>ie.wbits){oe.msg="invalid window size",ie.mode=30;break}ie.dmax=1<>8&1),512&ie.flags&&(st[0]=255&Se,st[1]=Se>>>8&255,ie.check=i(ie.check,st,2,0)),Ne=Se=0,ie.mode=3;case 3:for(;Ne<32;){if(ye===0)break e;ye--,Se+=pe[fe++]<>>8&255,st[2]=Se>>>16&255,st[3]=Se>>>24&255,ie.check=i(ie.check,st,4,0)),Ne=Se=0,ie.mode=4;case 4:for(;Ne<16;){if(ye===0)break e;ye--,Se+=pe[fe++]<>8),512&ie.flags&&(st[0]=255&Se,st[1]=Se>>>8&255,ie.check=i(ie.check,st,2,0)),Ne=Se=0,ie.mode=5;case 5:if(1024&ie.flags){for(;Ne<16;){if(ye===0)break e;ye--,Se+=pe[fe++]<>>8&255,ie.check=i(ie.check,st,2,0)),Ne=Se=0}else ie.head&&(ie.head.extra=null);ie.mode=6;case 6:if(1024&ie.flags&&(ye<(Te=ie.length)&&(Te=ye),Te&&(ie.head&&(le=ie.head.extra_len-ie.length,ie.head.extra||(ie.head.extra=new Array(ie.head.extra_len)),o.arraySet(ie.head.extra,pe,fe,Te,le)),512&ie.flags&&(ie.check=i(ie.check,pe,Te,fe)),ye-=Te,fe+=Te,ie.length-=Te),ie.length))break e;ie.length=0,ie.mode=7;case 7:if(2048&ie.flags){if(ye===0)break e;for(Te=0;le=pe[fe+Te++],ie.head&&le&&ie.length<65536&&(ie.head.name+=String.fromCharCode(le)),le&&Te>9&1,ie.head.done=!0),oe.adler=ie.check=0,ie.mode=12;break;case 10:for(;Ne<32;){if(ye===0)break e;ye--,Se+=pe[fe++]<>>=7&Ne,Ne-=7&Ne,ie.mode=27;break}for(;Ne<3;){if(ye===0)break e;ye--,Se+=pe[fe++]<>>=1)){case 0:ie.mode=14;break;case 1:if(J(ie),ie.mode=20,xe!==6)break;Se>>>=2,Ne-=2;break e;case 2:ie.mode=17;break;case 3:oe.msg="invalid block type",ie.mode=30}Se>>>=2,Ne-=2;break;case 14:for(Se>>>=7&Ne,Ne-=7&Ne;Ne<32;){if(ye===0)break e;ye--,Se+=pe[fe++]<>>16^65535)){oe.msg="invalid stored block lengths",ie.mode=30;break}if(ie.length=65535&Se,Ne=Se=0,ie.mode=15,xe===6)break e;case 15:ie.mode=16;case 16:if(Te=ie.length){if(ye>>=5,Ne-=5,ie.ndist=1+(31&Se),Se>>>=5,Ne-=5,ie.ncode=4+(15&Se),Se>>>=4,Ne-=4,286>>=3,Ne-=3}for(;ie.have<19;)ie.lens[ze[ie.have++]]=0;if(ie.lencode=ie.lendyn,ie.lenbits=7,Le={bits:ie.lenbits},Ve=p(0,ie.lens,0,19,ie.lencode,0,ie.work,Le),ie.lenbits=Le.bits,Ve){oe.msg="invalid code lengths set",ie.mode=30;break}ie.have=0,ie.mode=19;case 19:for(;ie.have>>16&255,Ye=65535&_e,!((Re=_e>>>24)<=Ne);){if(ye===0)break e;ye--,Se+=pe[fe++]<>>=Re,Ne-=Re,ie.lens[ie.have++]=Ye;else{if(Ye===16){for(We=Re+2;Ne>>=Re,Ne-=Re,ie.have===0){oe.msg="invalid bit length repeat",ie.mode=30;break}le=ie.lens[ie.have-1],Te=3+(3&Se),Se>>>=2,Ne-=2}else if(Ye===17){for(We=Re+3;Ne>>=Re)),Se>>>=3,Ne-=3}else{for(We=Re+7;Ne>>=Re)),Se>>>=7,Ne-=7}if(ie.have+Te>ie.nlen+ie.ndist){oe.msg="invalid bit length repeat",ie.mode=30;break}for(;Te--;)ie.lens[ie.have++]=le}}if(ie.mode===30)break;if(ie.lens[256]===0){oe.msg="invalid code -- missing end-of-block",ie.mode=30;break}if(ie.lenbits=9,Le={bits:ie.lenbits},Ve=p(x,ie.lens,0,ie.nlen,ie.lencode,0,ie.work,Le),ie.lenbits=Le.bits,Ve){oe.msg="invalid literal/lengths set",ie.mode=30;break}if(ie.distbits=6,ie.distcode=ie.distdyn,Le={bits:ie.distbits},Ve=p(y,ie.lens,ie.nlen,ie.ndist,ie.distcode,0,ie.work,Le),ie.distbits=Le.bits,Ve){oe.msg="invalid distances set",ie.mode=30;break}if(ie.mode=20,xe===6)break e;case 20:ie.mode=21;case 21:if(6<=ye&&258<=Ce){oe.next_out=he,oe.avail_out=Ce,oe.next_in=fe,oe.avail_in=ye,ie.hold=Se,ie.bits=Ne,u(oe,rt),he=oe.next_out,se=oe.output,Ce=oe.avail_out,fe=oe.next_in,pe=oe.input,ye=oe.avail_in,Se=ie.hold,Ne=ie.bits,ie.mode===12&&(ie.back=-1);break}for(ie.back=0;Be=(_e=ie.lencode[Se&(1<>>16&255,Ye=65535&_e,!((Re=_e>>>24)<=Ne);){if(ye===0)break e;ye--,Se+=pe[fe++]<>ht)])>>>16&255,Ye=65535&_e,!(ht+(Re=_e>>>24)<=Ne);){if(ye===0)break e;ye--,Se+=pe[fe++]<>>=ht,Ne-=ht,ie.back+=ht}if(Se>>>=Re,Ne-=Re,ie.back+=Re,ie.length=Ye,Be===0){ie.mode=26;break}if(32&Be){ie.back=-1,ie.mode=12;break}if(64&Be){oe.msg="invalid literal/length code",ie.mode=30;break}ie.extra=15&Be,ie.mode=22;case 22:if(ie.extra){for(We=ie.extra;Ne>>=ie.extra,Ne-=ie.extra,ie.back+=ie.extra}ie.was=ie.length,ie.mode=23;case 23:for(;Be=(_e=ie.distcode[Se&(1<>>16&255,Ye=65535&_e,!((Re=_e>>>24)<=Ne);){if(ye===0)break e;ye--,Se+=pe[fe++]<>ht)])>>>16&255,Ye=65535&_e,!(ht+(Re=_e>>>24)<=Ne);){if(ye===0)break e;ye--,Se+=pe[fe++]<>>=ht,Ne-=ht,ie.back+=ht}if(Se>>>=Re,Ne-=Re,ie.back+=Re,64&Be){oe.msg="invalid distance code",ie.mode=30;break}ie.offset=Ye,ie.extra=15&Be,ie.mode=24;case 24:if(ie.extra){for(We=ie.extra;Ne>>=ie.extra,Ne-=ie.extra,ie.back+=ie.extra}if(ie.offset>ie.dmax){oe.msg="invalid distance too far back",ie.mode=30;break}ie.mode=25;case 25:if(Ce===0)break e;if(Te=rt-Ce,ie.offset>Te){if((Te=ie.offset-Te)>ie.whave&&ie.sane){oe.msg="invalid distance too far back",ie.mode=30;break}Pe=Te>ie.wnext?(Te-=ie.wnext,ie.wsize-Te):ie.wnext-Te,Te>ie.length&&(Te=ie.length),Ue=ie.window}else Ue=se,Pe=he-ie.offset,Te=ie.length;for(CeV?(W=Pe[Ue+M[xe]],Ne[be+M[xe]]):(W=96,0),A=1<>he)+(P-=A)]=K<<24|W<<16|J|0,P!==0;);for(A=1<>=1;if(A!==0?(Se&=A-1,Se+=A):Se=0,xe++,--rt[oe]==0){if(oe===pe)break;oe=y[_+M[xe]]}if(se>>7)]}function be(_e,st){_e.pending_buf[_e.pending++]=255&st,_e.pending_buf[_e.pending++]=st>>>8&255}function rt(_e,st,ze){_e.bi_valid>E-ze?(_e.bi_buf|=st<<_e.bi_valid&65535,be(_e,_e.bi_buf),_e.bi_buf=st>>E-_e.bi_valid,_e.bi_valid+=ze-E):(_e.bi_buf|=st<<_e.bi_valid&65535,_e.bi_valid+=ze)}function Te(_e,st,ze){rt(_e,ze[2*st],ze[2*st+1])}function Pe(_e,st){for(var ze=0;ze|=1&_e,_e>>>=1,ze<<=1,0<--st;);return ze>>>1}function Ue(_e,st,ze){var Ee,Je,at=new Array(M+1),pt=0;for(Ee=1;Ee<=M;Ee++)at[Ee]=pt=pt+ze[Ee-1]<<1;for(Je=0;Je<=st;Je++){var gt=_e[2*Je+1];gt!==0&&(_e[2*Je]=Pe(at[gt]++,gt))}}function Re(_e){var st;for(st=0;st<_;st++)_e.dyn_ltree[2*st]=0;for(st=0;st>1;1<=ze;ze--)ht(_e,at,ze);for(Je=Mt;ze=_e.heap[1],_e.heap[1]=_e.heap[_e.heap_len--],ht(_e,at,1),Ee=_e.heap[1],_e.heap[--_e.heap_max]=ze,_e.heap[--_e.heap_max]=Ee,at[2*Je]=at[2*ze]+at[2*Ee],_e.depth[Je]=(_e.depth[ze]>=_e.depth[Ee]?_e.depth[ze]:_e.depth[Ee])+1,at[2*ze+1]=at[2*Ee+1]=Je,_e.heap[1]=Je++,ht(_e,at,1),2<=_e.heap_len;);_e.heap[--_e.heap_max]=_e.heap[1],function(Xt,Sr){var an,wn,Xr,Pn,Ns,hr,ys=Sr.dyn_tree,Ca=Sr.max_code,va=Sr.stat_desc.static_tree,$i=Sr.stat_desc.has_stree,Ui=Sr.stat_desc.extra_bits,al=Sr.stat_desc.extra_base,yo=Sr.stat_desc.max_length,Gs=0;for(Pn=0;Pn<=M;Pn++)Xt.bl_count[Pn]=0;for(ys[2*Xt.heap[Xt.heap_max]+1]=0,an=Xt.heap_max+1;an>=7;Je>>=1)if(1&wt&>.dyn_ltree[2*Mt]!==0)return l;if(gt.dyn_ltree[18]!==0||gt.dyn_ltree[20]!==0||gt.dyn_ltree[26]!==0)return i;for(Mt=32;Mt>>3,(at=_e.static_len+3+7>>>3)<=Je&&(Je=at)):Je=at=ze+5,ze+4<=Je&&st!==-1?We(_e,st,ze,Ee):_e.strategy===4||at===Je?(rt(_e,2+(Ee?1:0),3),Me(_e,ae,oe)):(rt(_e,4+(Ee?1:0),3),function(gt,Mt,wt,Xt){var Sr;for(rt(gt,Mt-257,5),rt(gt,wt-1,5),rt(gt,Xt-4,4),Sr=0;Sr>>8&255,_e.pending_buf[_e.d_buf+2*_e.last_lit+1]=255&st,_e.pending_buf[_e.l_buf+_e.last_lit]=255&ze,_e.last_lit++,st===0?_e.dyn_ltree[2*ze]++:(_e.matches++,st--,_e.dyn_ltree[2*(ie[ze]+y+1)]++,_e.dyn_dtree[2*Ne(st)]++),_e.last_lit===_e.lit_bufsize-1},a._tr_align=function(_e){rt(_e,2,3),Te(_e,P,ae),function(st){st.bi_valid===16?(be(st,st.bi_buf),st.bi_buf=0,st.bi_valid=0):8<=st.bi_valid&&(st.pending_buf[st.pending++]=255&st.bi_buf,st.bi_buf>>=8,st.bi_valid-=8)}(_e)}},{"../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 u,p,x,y,_=1,w={},S=!1,N=l.document,M=Object.getPrototypeOf&&Object.getPrototypeOf(l);M=M&&M.setTimeout?M:l,u={}.toString.call(l.process)==="[object process]"?function(z){process.nextTick(function(){A(z)})}:function(){if(l.postMessage&&!l.importScripts){var z=!0,R=l.onmessage;return l.onmessage=function(){z=!1},l.postMessage("","*"),l.onmessage=R,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){A(z.data)},function(z){x.port2.postMessage(z)}):N&&"onreadystatechange"in N.createElement("script")?(p=N.documentElement,function(z){var R=N.createElement("script");R.onreadystatechange=function(){A(z),R.onreadystatechange=null,p.removeChild(R),R=null},p.appendChild(R)}):function(z){setTimeout(A,0,z)},M.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var R=new Array(arguments.length-1),U=0;U"u"?o===void 0?this:o:self)}).call(this,typeof $x<"u"?$x:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(h7e);var Cjt=h7e.exports;const Mjt=Wi(Cjt),Tjt=()=>{const{isAdmin:t}=Qr(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState("all"),[i,u]=I.useState(new Set),[p,x]=I.useState(!1),[y,_]=I.useState(!1),[w,S]=I.useState("images"),[N,M]=I.useState(null),{data:E=[],isLoading:A}=Kt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:ye,error:Ce}=await Q.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ce)throw Ce;return ye}}),{data:P=[]}=Kt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:ye,error:Ce}=await Q.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ce)throw Ce;return ye}}),{data:z=[]}=Kt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:ye,error:Ce}=await Q.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ce)throw Ce;return ye}}),{data:R=[]}=Kt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:ye,error:Ce}=await Q.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ce)throw Ce;return ye||[]}}),U=R.length>0,V=I.useMemo(()=>o==="all"?null:z.find(ye=>ye.month===o)||null,[o,z]),K=I.useMemo(()=>[...new Set(E.map(Ce=>Ce.month))].sort((Ce,Se)=>Se.localeCompare(Ce)),[E]);I.useEffect(()=>{K.length>0&&o==="all"&&l(K[0])},[K,o]);const W=ye=>{try{const Ce=Lxe(ye,"yyyy-MM",new Date);return mn(Ce,"MMMM yyyy")}catch{return ye}},J=I.useMemo(()=>o==="all"?E:E.filter(ye=>ye.month===o),[o,E]),ae=I.useMemo(()=>{var ye;return o==="all"?null:((ye=P.find(Ce=>Ce.month===o))==null?void 0:ye.canva_link)||null},[o,P]),oe=async ye=>{try{await navigator.clipboard.writeText(ye),Oe.success("Caption copied to clipboard!")}catch{Oe.error("Failed to copy caption")}},xe=async(ye,Ce)=>{try{const Ne=await(await fetch(ye)).blob(),be=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),rt=navigator.canShare&&navigator.canShare({files:[new File([Ne],"test.jpg",{type:"image/jpeg"})]});if(be&&rt){const Te=new File([Ne],`social-swag-${Ce}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Te],title:"Social Swag Image"}),Oe.success("Image ready to save!")}else{const Te=window.URL.createObjectURL(Ne),Pe=document.createElement("a");Pe.href=Te,Pe.download=`social-swag-${Ce}.jpg`,document.body.appendChild(Pe),Pe.click(),document.body.removeChild(Pe),window.URL.revokeObjectURL(Te),Oe.success("Image downloaded!")}}catch(Se){Se.name!=="AbortError"&&Oe.error("Failed to download image")}},ie=ye=>{u(Ce=>{const Se=new Set(Ce);return Se.has(ye)?Se.delete(ye):Se.add(ye),Se})},pe=()=>{u(new Set(J.map(ye=>ye.id)))},se=()=>{u(new Set),x(!1)},fe=async()=>{const ye=J.filter(Ce=>i.has(Ce.id));if(ye.length===0){Oe.error("No images selected");return}_(!0),Oe.info(`Preparing ${ye.length} images for download...`);try{const Ce=new Mjt,Se=[...ye].sort((Pe,Ue)=>Pe.sort_order-Ue.sort_order);for(let Pe=0;Pe{p?ie(ye.id):n(ye)};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(Lt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Lt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ol,{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(ki,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(pi,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(rn,{value:"gallery",className:"gap-2",children:[r.jsx(Ol,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(rn,{value:"scheduled",className:"gap-2",children:[r.jsx(_m,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Sn,{value:"gallery",className:"space-y-6",children:[t?U?r.jsx(Ke,{className:"border rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(Ji,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(Ke,{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(et,{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(Jd,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(mu,{className:"h-5 w-5 text-pink-600"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),r.jsx(te,{asChild:!0,className:"gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600",children:r.jsxs(Ji,{to:"/social-connections",children:[r.jsx(df,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(Ke,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{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(Wa,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Jd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(mu,{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(Lt,{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(ye=>r.jsx("button",{onClick:()=>l(ye),className:zt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ye?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:W(ye)},ye))}),o!=="all"&&(ae?r.jsxs("a",{href:ae,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 ",W(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 ",W(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:()=>{S("images"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",w==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Ol,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{S("reels"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",w==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx($d,{className:"h-4 w-4"}),"Reels"]})]}),w==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",J.length,")"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(gs,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(te,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(ao,{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(te,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(_i,{className:"h-4 w-4"}),"Select Images"]})})]}),A&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!A&&w==="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:J.map(ye=>{const Ce=i.has(ye.id);return r.jsx(Ke,{className:zt("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ce&&"ring-2 ring-primary ring-offset-2"),onClick:()=>he(ye),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ye.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",Ce?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ce&&r.jsx(_i,{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"})})]})},ye.id)})}),J.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!A&&w==="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(Ke,{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(Lt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx($d,{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($d,{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(Dr,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Or,{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(Ds,{className:"h-4 w-4"}),mn(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[t&&r.jsxs(te,{onClick:()=>{M({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(eo,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(te,{variant:"outline",onClick:()=>oe(e.caption),className:"flex-1 gap-2",children:[r.jsx(tl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(te,{variant:"outline",onClick:()=>xe(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(ao,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Dr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Or,{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($d,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(te,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(tl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(te,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(Njt,{open:!!N,onOpenChange:ye=>!ye&&M(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(Sjt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{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(Wa,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Jd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(mu,{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(Lt,{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(ye=>r.jsx("button",{onClick:()=>l(ye),className:zt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ye?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:W(ye)},ye))}),o!=="all"&&(ae?r.jsxs("a",{href:ae,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 ",W(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 ",W(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:()=>{S("images"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",w==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Ol,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{S("reels"),se()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",w==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx($d,{className:"h-4 w-4"}),"Reels"]})]}),w==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",J.length,")"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(gs,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(te,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(ao,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]})]}):r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(_i,{className:"h-4 w-4"}),"Select Images"]})})]}),A&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!A&&w==="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:J.map(ye=>{const Ce=i.has(ye.id);return r.jsx(Ke,{className:zt("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ce&&"ring-2 ring-primary ring-offset-2"),onClick:()=>he(ye),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ye.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",Ce?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ce&&r.jsx(_i,{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"})})]})},ye.id)})}),J.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!A&&w==="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(Ke,{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(Lt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx($d,{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($d,{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(Dr,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Or,{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(Ds,{className:"h-4 w-4"}),mn(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(te,{variant:"outline",onClick:()=>oe(e.caption),className:"flex-1 gap-2",children:[r.jsx(tl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(te,{variant:"outline",onClick:()=>xe(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(ao,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Dr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Or,{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($d,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(te,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(tl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(te,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Os,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},Ajt=()=>{const{swagId:t}=td(),{user:e}=Qr(),{toast:n}=mi(),s=qr(),{trackEngagement:a}=WI(),[o,l]=I.useState(""),{data:i,isLoading:u}=Kt({queryKey:["social-swag-detail",t],queryFn:async()=>{const{data:E,error:A}=await Q.from("social_swag").select("*").eq("id",t).single();if(A)throw A;const{data:P}=await Q.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=[]}=Kt({queryKey:["social-swag-likes",t],queryFn:async()=>{const{data:E,error:A}=await Q.from("social_swag_likes").select("*").eq("swag_id",t);if(A)throw A;return E},enabled:!!t}),{data:x=[]}=Kt({queryKey:["social-swag-comments",t],queryFn:async()=>{const{data:E,error:A}=await Q.from("social_swag_comments").select("*").eq("swag_id",t).order("created_at",{ascending:!1});if(A)throw A;const P=[...new Set(E.map(U=>U.user_id))],{data:z}=await Q.from("profiles").select("id, name").in("id",P),R=new Map((z==null?void 0:z.map(U=>[U.id,U.name]))||[]);return E.map(U=>({...U,user_name:R.get(U.user_id)||"Unknown User"}))},enabled:!!t}),y=or({mutationFn:async E=>{const{error:A}=await Q.from("social_swag_comments").insert({swag_id:t,user_id:e.id,content:E});if(A)throw A},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"})}}),_=or({mutationFn:async E=>{const{error:A}=await Q.from("social_swag_comments").delete().eq("id",E);if(A)throw A},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),n({title:"Comment deleted"})}}),w=or({mutationFn:async()=>{const E=p.find(A=>A.user_id===(e==null?void 0:e.id));if(E){const{error:A}=await Q.from("social_swag_likes").delete().eq("id",E.id);if(A)throw A}else{const{error:A}=await Q.from("social_swag_likes").insert({swag_id:t,user_id:e.id});if(A)throw A}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",t]})}}),S=p.some(E=>E.user_id===(e==null?void 0:e.id)),N=E=>E.split(" ").map(A=>A[0]).join("").toUpperCase().slice(0,2),M=E=>{E.preventDefault(),!(!o.trim()||!e)&&y.mutate(o.trim())};return u?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(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(Ji,{to:"/social-swag",children:[r.jsx(io,{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(N3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),r.jsxs(te,{variant:S?"default":"outline",className:"gap-2 w-fit",onClick:()=>w.mutate(),disabled:!e||w.isPending,children:[r.jsx(kd,{className:`h-4 w-4 ${S?"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(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Mo,{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(te,{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(Os,{className:"h-4 w-4 text-muted-foreground"})]},E.id))})]})}),r.jsx(_d,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Bl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:M,className:"flex gap-2",children:[r.jsx(ss,{placeholder:"Add a comment...",value:o,onChange:E=>l(E.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(eo,{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(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ys,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Xs,{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:gu(new Date(E.created_at),{addSuffix:!0})}),E.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>_.mutate(E.id),children:r.jsx($n,{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(Mo,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(Ji,{to:"/social-swag",children:"Back to Social Swag"})})]})})},Ejt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=I.useState(!0),[i,u]=I.useState(!0),[p,x]=I.useState(!0),y=_=>_.split(" ").map(w=>w[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(te,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(fS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(DS,{open:o,onOpenChange:l,children:[r.jsx(RS,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?r.jsx(Qd,{className:"h-4 w-4"}):r.jsx(Bi,{className:"h-4 w-4"})]})}),r.jsx(FS,{className:"space-y-1 pl-2",children:t.map(_=>r.jsxs(te,{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(DS,{open:i,onOpenChange:u,children:[r.jsx(RS,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(np,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(Qd,{className:"h-4 w-4"}):r.jsx(Bi,{className:"h-4 w-4"})]})}),r.jsx(FS,{className:"space-y-1 pl-2",children:e.map(_=>r.jsxs(te,{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(DS,{open:p,onOpenChange:x,children:[r.jsx(RS,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(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(Qd,{className:"h-4 w-4"}):r.jsx(Bi,{className:"h-4 w-4"})]})}),r.jsx(FS,{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(Ys,{className:"h-7 w-7",children:[r.jsx(Pi,{src:_.avatarUrl}),r.jsx(Xs,{className:"text-xs",children:y(_.name)})]}),r.jsx(Gu,{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))})]})]})})})},Ijt=({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),u=()=>{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(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:u()}),r.jsx(Qd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(eh,{className:"w-56 bg-background border",children:[r.jsxs(ri,{onClick:()=>s("all"),children:[r.jsx(fS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(Zj,{}),r.jsx(bhe,{className:"text-xs text-muted-foreground",children:"Categories"}),t.map(p=>r.jsxs(ri,{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(Zj,{}),r.jsxs(bhe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(np,{className:"h-3 w-3"}),"Your Groups"]}),e.map(p=>r.jsxs(ri,{onClick:()=>s(`group:${p.id}`),children:[r.jsx("span",{className:"mr-2",children:p.icon||"🔒"}),p.name]},p.id))]})]})]}),r.jsxs(xse,{open:o,onOpenChange:l,children:[r.jsx(dxe,{asChild:!0,children:r.jsxs(te,{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(BI,{children:[r.jsx(yse,{children:r.jsxs(vse,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(Ro,{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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:p.avatarUrl}),r.jsx(Xs,{children:i(p.name)})]}),r.jsx(Gu,{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 Yce,iae="HoverCard",[f7e]=lc(iae,[Wg]),oae=Wg(),[Pjt,Gye]=f7e(iae),p7e=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=t,u=oae(e),p=I.useRef(0),x=I.useRef(0),y=I.useRef(!1),_=I.useRef(!1),[w,S]=Ku({prop:s,defaultProp:a??!1,onChange:o,caller:iae}),N=I.useCallback(()=>{clearTimeout(x.current),p.current=window.setTimeout(()=>S(!0),l)},[l,S]),M=I.useCallback(()=>{clearTimeout(p.current),!y.current&&!_.current&&(x.current=window.setTimeout(()=>S(!1),i))},[i,S]),E=I.useCallback(()=>S(!1),[S]);return I.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(x.current)},[]),r.jsx(Pjt,{scope:e,open:w,onOpenChange:S,onOpen:N,onClose:M,onDismiss:E,hasSelectionRef:y,isPointerDownOnContentRef:_,children:r.jsx(CI,{...u,children:n})})};p7e.displayName=iae;var m7e="HoverCardTrigger",g7e=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,a=Gye(m7e,n),o=oae(n);return r.jsx(d3,{asChild:!0,...o,children:r.jsx(Rn.a,{"data-state":a.open?"open":"closed",...s,ref:e,onPointerEnter:cn(t.onPointerEnter,Nre(a.onOpen)),onPointerLeave:cn(t.onPointerLeave,Nre(a.onClose)),onFocus:cn(t.onFocus,a.onOpen),onBlur:cn(t.onBlur,a.onClose),onTouchStart:cn(t.onTouchStart,l=>l.preventDefault())})})});g7e.displayName=m7e;var Ljt="HoverCardPortal",[iXt,Ojt]=f7e(Ljt,{forceMount:void 0}),kre="HoverCardContent",x7e=I.forwardRef((t,e)=>{const n=Ojt(kre,t.__scopeHoverCard),{forceMount:s=n.forceMount,...a}=t,o=Gye(kre,t.__scopeHoverCard);return r.jsx(jc,{present:s||o.open,children:r.jsx(Djt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:cn(t.onPointerEnter,Nre(o.onOpen)),onPointerLeave:cn(t.onPointerLeave,Nre(o.onClose)),ref:e})})});x7e.displayName=kre;var Djt=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=t,u=Gye(kre,n),p=oae(n),x=I.useRef(null),y=ra(e,x),[_,w]=I.useState(!1);return I.useEffect(()=>{if(_){const S=document.body;return Yce=S.style.userSelect||S.style.webkitUserSelect,S.style.userSelect="none",S.style.webkitUserSelect="none",()=>{S.style.userSelect=Yce,S.style.webkitUserSelect=Yce}}},[_]),I.useEffect(()=>{if(x.current){const S=()=>{w(!1),u.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var M;((M=document.getSelection())==null?void 0:M.toString())!==""&&(u.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",S),()=>{document.removeEventListener("pointerup",S),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!1}}},[u.isPointerDownOnContentRef,u.hasSelectionRef]),I.useEffect(()=>{x.current&&zjt(x.current).forEach(N=>N.setAttribute("tabindex","-1"))}),r.jsx(uv,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:cn(o,S=>{S.preventDefault()}),onDismiss:u.onDismiss,children:r.jsx(MI,{...p,...i,onPointerDown:cn(i.onPointerDown,S=>{S.currentTarget.contains(S.target)&&w(!0),u.hasSelectionRef.current=!1,u.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)"}})})}),Rjt="HoverCardArrow",Fjt=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,a=oae(n);return r.jsx(TI,{...a,...s,ref:e})});Fjt.displayName=Rjt;function Nre(t){return e=>e.pointerType==="touch"?void 0:t()}function zjt(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 Bjt=p7e,$jt=g7e,y7e=x7e;const Ujt=Bjt,qjt=$jt,v7e=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},a)=>r.jsx(y7e,{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}));v7e.displayName=y7e.displayName;const Vjt=[{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"}],Hjt=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),_7e=({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(Ujt,{openDelay:200,closeDelay:100,children:[r.jsx(qjt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:e})}),r.jsx(v7e,{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=Vjt.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(Ys,{className:"h-6 w-6",children:[r.jsx(Pi,{src:l.user_avatar||void 0}),r.jsx(Xs,{className:"text-[10px]",children:Hjt(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 Wjt({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 u=()=>{o(_=>_>0?_-1:t.length-1),i(!1)},p=()=>{o(_=>_{n&&(_.key==="ArrowLeft"&&u(),_.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(Dr,{open:n,onOpenChange:s,children:r.jsxs(Or,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>s(!1),children:r.jsx(gs,{className:"h-6 w-6"})}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:u,children:r.jsx(vc,{className:"h-8 w-8"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:p,children:r.jsx(Bi,{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(te,{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(TS,{className:"h-5 w-5"}):r.jsx(MS,{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((_,w)=>r.jsx("button",{onClick:()=>{o(w),i(!1)},className:zt("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",a===w?"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"})},w))})]})})}const JL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],Gjt=({commentId:t,reactions:e,currentUserId:n})=>{var p,x;const s=qr(),[a,o]=I.useState(!1),l=e.find(y=>y.user_id===n),i=or({mutationFn:async y=>{l?l.reaction_type===y?await Q.from("community_comment_reactions").delete().eq("id",l.id):await Q.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await Q.from("community_comment_reactions").insert({comment_id:t,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),u={};return e.forEach(y=>{u[y.reaction_type]=(u[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.length>0&&r.jsx(_7e,{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(u).slice(0,2).map(y=>{var _;return r.jsx("span",{className:"text-sm",children:(_=JL.find(w=>w.type===y))==null?void 0:_.emoji},y)})}),r.jsx("span",{children:e.length})]})}),n&&r.jsxs(Cd,{open:a,onOpenChange:o,children:[r.jsx(Md,{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=JL.find(y=>y.type===l.reaction_type))==null?void 0:p.emoji," ",(x=JL.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(ed,{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:JL.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 Kye({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],u=o[2],p=o[3],x=i==="#";s.push(r.jsx(Ji,{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?u:`@${u}`},`mention-${l++}`))}else if(o[4]){const i=o[4],u=i.replace(/[.,;:!?)]+$/,""),p=i.slice(u.length);let x;try{const y=new URL(u);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=u.length>40?u.slice(0,40)+"...":u}s.push(r.jsx("a",{href:u,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},u))})}function Sre({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:u="encoded",enableTemplateMentions:p=!1}){const x=I.useRef(null),y=I.useRef(null),[_,w]=I.useState(!1),[S,N]=I.useState("user"),[M,E]=I.useState(""),[A,P]=I.useState(null),[z,R]=I.useState(0),[U,V]=I.useState({top:0,left:0,width:0}),K=I.useRef(new Map),W=I.useRef(new Map),J=Ne=>{if(u==="plain"){const Pe=[];return K.current.forEach((Re,Be)=>{Ne.includes(`@${Be}`)&&Pe.push(Re)}),[...new Set(Pe)]}const be=/@\[([^\]]+)\]\(([^)]+)\)/g,rt=[];let Te;for(;(Te=be.exec(Ne))!==null;)rt.push(Te[2]);return[...new Set(rt)]},ae=Ne=>{if(u==="plain"){const Pe=[];return W.current.forEach((Re,Be)=>{Ne.includes(`#${Be}`)&&Pe.push(Re)}),[...new Set(Pe)]}const be=/#\[([^\]]+)\]\(([^)]+)\)/g,rt=[];let Te;for(;(Te=be.exec(Ne))!==null;)rt.push(Te[2]);return[...new Set(rt)]};I.useEffect(()=>{if(o){const Ne=J(t);o(Ne)}if(l){const Ne=ae(t);l(Ne)}},[t,o,l,u]);const{data:oe=[],isLoading:xe}=Kt({queryKey:["mention-users",M],queryFn:async()=>{const Ne=Q.from("profiles").select("id, name").limit(8),be=M.length>=1?Ne.ilike("name",`%${M}%`):Ne.order("name"),{data:rt,error:Te}=await be;if(Te)throw Te;const Pe=rt.map(Re=>Re.id),Ue=await yOe(Pe);return rt.map(Re=>({id:Re.id,name:Re.name||"Unknown",avatar_url:Ue.get(Re.id)}))},enabled:_&&S==="user",staleTime:3e4}),{data:ie=[],isLoading:pe}=Kt({queryKey:["mention-templates",M],queryFn:async()=>{let Ne=Q.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);M.length>=1&&(Ne=Ne.ilike("name",`%${M}%`));const{data:be,error:rt}=await Ne;if(rt)throw rt;return be||[]},enabled:_&&S==="template"&&p,staleTime:3e4}),se=S==="user"?xe:pe,fe=S==="user"?oe:ie,he=Ne=>Ne.split(" ").map(be=>be[0]).join("").toUpperCase().slice(0,2),ye=Ne=>{const be=Ne.target.value,rt=Ne.target.selectionStart;e(be);const Te=be.substring(0,rt),Pe=Te.lastIndexOf("@"),Ue=p?Te.lastIndexOf("#"):-1;let Re=-1,Be="user";if(Pe>Ue?(Re=Pe,Be="user"):Ue>Pe&&p&&(Re=Ue,Be="template"),Re!==-1){const Ye=Te.substring(Re+1),ht=Ye.includes(" "),Me=Ye.includes(` `);if(!ht&&!Me&&Ye.length<=30){P(Re),E(Ye),N(Be),w(!0),R(0);return}}w(!1),P(null)},Ce=Ne=>{if(A===null)return;const be=t.substring(0,A),rt=t.substring(A+M.length+1),Te=S==="user"?"@":"#",Pe=u==="plain"?`${Te}${Ne.name} `:`${Te}[${Ne.name}](${Ne.id}) `;u==="plain"&&(S==="user"?K.current.set(Ne.name,Ne.id):W.current.set(Ne.name,Ne.id));const Ue=be+Pe+rt;e(Ue),w(!1),P(null),E(""),setTimeout(()=>{if(x.current){const Re=be.length+Pe.length;x.current.focus(),x.current.setSelectionRange(Re,Re)}},0)},Se=Ne=>{if(!(!_||fe.length===0))switch(Ne.key){case"ArrowDown":Ne.preventDefault(),R(be=>(be+1)%fe.length);break;case"ArrowUp":Ne.preventDefault(),R(be=>(be-1+fe.length)%fe.length);break;case"Enter":fe[z]&&(Ne.preventDefault(),Ce(fe[z]));break;case"Escape":Ne.preventDefault(),w(!1);break;case"Tab":fe[z]&&(Ne.preventDefault(),Ce(fe[z]));break}};return I.useEffect(()=>{const Ne=be=>{y.current&&!y.current.contains(be.target)&&x.current&&!x.current.contains(be.target)&&w(!1)};return document.addEventListener("mousedown",Ne),()=>document.removeEventListener("mousedown",Ne)},[]),I.useEffect(()=>{if(!_)return;const Ne=()=>{const be=x.current;if(!be)return;const rt=be.getBoundingClientRect();V({top:rt.bottom+4,left:rt.left,width:rt.width})};return Ne(),window.addEventListener("resize",Ne),window.addEventListener("scroll",Ne,!0),()=>{window.removeEventListener("resize",Ne),window.removeEventListener("scroll",Ne,!0)}},[_,t]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ss,{ref:x,value:t,onChange:ye,onKeyDown:Ne=>{Se(Ne),Ne.defaultPrevented||i==null||i(Ne)},placeholder:n,className:zt("resize-none",s),style:{minHeight:a}}),_&&Iy.createPortal(r.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:U.top,left:U.left,width:U.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:S==="user"?"👤 Mention a person":"📋 Link a template"}),se?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):fe.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:M.length<1?`Type to search ${S==="user"?"people":"templates"}...`:`No ${S==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:fe.map((Ne,be)=>r.jsx("li",{className:zt("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",be===z?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ce(Ne),onMouseEnter:()=>R(be),children:S==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Ys,{className:"h-6 w-6",children:[r.jsx(Pi,{src:Ne.avatar_url}),r.jsx(Xs,{className:"text-xs",children:he(Ne.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:Ne.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:Ne.preview_image_url?r.jsx("img",{src:Ne.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(Rc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:Ne.name})]})},Ne.id))})]}),document.body)]})}function Kjt(t){const e=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=e.exec(t))!==null;)n.push(s[2]);return[...new Set(n)]}const B4e=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2);function b7e({comment:t,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l=0}){const i=qr(),[u,p]=I.useState(!1),[x,y]=I.useState(""),[_,w]=I.useState([]),S=or({mutationFn:async({content:A,parentCommentId:P})=>{const{data:z,error:R}=await Q.from("community_comments").insert({post_id:e,user_id:n,content:A,parent_comment_id:P}).select("id").single();if(R)throw R;const U=_;if(U.length>0&&z){const V=U.filter(K=>K!==n).map(K=>({comment_id:z.id,mentioned_user_id:K,mentioned_by_user_id:n}));V.length>0&&await Q.from("community_comment_mentions").insert(V)}},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),y(""),w([]),p(!1)}}),N=or({mutationFn:async A=>{const{error:P}=await Q.from("community_comments").delete().eq("id",A);if(P)throw P},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),M=()=>{x.trim()&&S.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(Ys,{className:"h-8 w-8 shrink-0",children:[r.jsx(Pi,{src:t.user_avatar||void 0}),r.jsx(Xs,{className:"text-xs",children:B4e(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(Kye,{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:gu(new Date(t.created_at),{addSuffix:!0})}),r.jsx(Gjt,{commentId:t.id,reactions:t.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>p(!u),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(iA,{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"})]}),u&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Ys,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Pi,{src:s||void 0}),r.jsx(Xs,{className:"text-xs",children:B4e((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(Sre,{placeholder:`Reply to ${t.user_name}...`,value:x,onChange:y,onMentionsChange:w,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(te,{size:"sm",variant:"ghost",onClick:M,disabled:!x.trim()||S.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(eo,{className:"h-3 w-3"})})]})]})]})]}),t.replies&&t.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:t.replies.map(A=>r.jsx(b7e,{comment:A,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l+1},A.id))})]})}const eO=[{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"}],Zjt=()=>{const{user:t,isBrokerageManager:e,managedBrokerages:n,isAdmin:s}=Qr(),{avatarUrl:a}=xOe(t==null?void 0:t.id),{onlineUsers:o}=K8e(),{toast:l}=mi(),i=qr(),u=I.useRef(null),[p,x]=I.useState("all"),[y,_]=I.useState(""),[w,S]=I.useState(""),[N,M]=I.useState(""),[E,A]=I.useState([]),[P,z]=I.useState([]),[R,U]=I.useState(""),[V,K]=I.useState(!1),[W,J]=I.useState(null),[ae,oe]=I.useState(""),[xe,ie]=I.useState(new Set),[pe,se]=I.useState({}),[fe,he]=I.useState({}),[ye,Ce]=I.useState([]),[Se,Ne]=I.useState([]),[be,rt]=I.useState({open:!1,images:[],index:0});I.useEffect(()=>{if(p.startsWith("group:")){const wt=p.replace("group:","");M(wt),S("")}else p!=="all"?(S(p),M("")):(S(""),M(""))},[p]);const{data:Te=[]}=Kt({queryKey:["community-categories"],queryFn:async()=>{const{data:wt,error:Xt}=await Q.from("community_categories").select("*").order("sort_order");if(Xt)throw Xt;return wt}}),{data:Pe=[]}=Kt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:wt,error:Xt}=await Q.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(Xt)throw Xt;return wt}}),Ue=20,{data:Re,isLoading:Be,hasNextPage:Ye,fetchNextPage:ht,isFetchingNextPage:Me}=qJe({queryKey:["community-posts",p],initialPageParam:0,queryFn:async({pageParam:wt})=>{var Ae;const Xt=wt*Ue,Sr=Xt+Ue;let an=Q.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(Xt,Sr);if(p.startsWith("group:")){const Ze=p.replace("group:","");an=an.eq("private_group_id",Ze)}else p==="all"||(an=an.eq("category_id",p).is("private_group_id",null));const{data:wn,error:Xr}=await an;if(Xr)throw Xr;const Pn=((wn==null?void 0:wn.length)||0)>Ue,Ns=(wn||[]).slice(0,Ue);if(Ns.length===0)return{posts:[],hasMore:!1,nextPage:wt+1};const hr=Ns.map(Ze=>Ze.id),ys=[...new Set(Ns.filter(Ze=>Ze.category_id).map(Ze=>Ze.category_id))].filter(Boolean),[Ca,va,$i,Ui,al]=await Promise.all([ys.length?Q.from("community_categories").select("*").in("id",ys):Promise.resolve({data:[]}),Q.from("community_post_media").select("*").in("post_id",hr).order("sort_order"),Q.from("community_reactions").select("*").in("post_id",hr),Q.from("community_comments").select("*").in("post_id",hr).order("created_at",{ascending:!0}),Q.from("community_post_resources").select("*").in("post_id",hr)]),yo=Ca==null?void 0:Ca.data,Gs=va==null?void 0:va.data,Qa=$i==null?void 0:$i.data,Cs=Ui==null?void 0:Ui.data,Ba=al==null?void 0:al.data,Ra=(Cs||[]).map(Ze=>Ze.id),[Fo,ir]=await Promise.all([Ra.length?Q.from("community_comment_reactions").select("*").in("comment_id",Ra):Promise.resolve({data:[]}),(()=>{const Ze=(Ba||[]).filter(Nt=>Nt.resource_type==="template").map(Nt=>Nt.resource_id);return Ze.length===0?Promise.resolve({data:[]}):Q.from("canva_templates").select("id, name, preview_image_url").in("id",Ze)})()]),po=(Fo==null?void 0:Fo.data)||[],gl=(ir==null?void 0:ir.data)||[],Eo=new Map(gl.map(Ze=>[Ze.id,{name:Ze.name,preview_image_url:Ze.preview_image_url}])),is=Array.from(new Set([...Ns.map(Ze=>Ze.user_id),...(Qa||[]).map(Ze=>Ze.user_id),...(Cs||[]).map(Ze=>Ze.user_id),...po.map(Ze=>Ze.user_id)])),[vo,ku]=await Promise.all([is.length?Q.from("profiles").select("id, name").in("id",is):Promise.resolve({data:[]}),yOe(is)]),Hl=new Map(((Ae=vo==null?void 0:vo.data)==null?void 0:Ae.map(Ze=>[Ze.id,Ze.name]))||[]),Nu=new Map((yo||[]).map(Ze=>[Ze.id,Ze])),nt=Ze=>{const Nt=new Map,vt=[];return Ze.forEach(At=>{Nt.set(At.id,{...At,user_name:Hl.get(At.user_id)||"Unknown User",user_avatar:ku.get(At.user_id),reactions:po.filter(Bt=>Bt.comment_id===At.id).map(Bt=>({...Bt,user_name:Hl.get(Bt.user_id)||"Unknown User",user_avatar:ku.get(Bt.user_id)})),replies:[]})}),Ze.forEach(At=>{const Bt=Nt.get(At.id);if(At.parent_comment_id&&Nt.has(At.parent_comment_id)){const Pt=Nt.get(At.parent_comment_id);Pt.replies=Pt.replies||[],Pt.replies.push(Bt)}else vt.push(Bt)}),vt};return{posts:Ns.map(Ze=>{const Nt=(Ba||[]).filter(vt=>vt.post_id===Ze.id).map(vt=>{let At="",Bt=null;if(vt.resource_type==="template"){const Pt=Eo.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{...Ze,user_name:Hl.get(Ze.user_id)||"Unknown User",user_avatar:ku.get(Ze.user_id),category:Ze.category_id?Nu.get(Ze.category_id):null,media:(Gs||[]).filter(vt=>vt.post_id===Ze.id),reactions:((Qa||[]).filter(vt=>vt.post_id===Ze.id)||[]).map(vt=>({...vt,user_name:Hl.get(vt.user_id)||"Unknown User",user_avatar:ku.get(vt.user_id)})),comments:nt((Cs||[]).filter(vt=>vt.post_id===Ze.id)),resources:Nt}}),hasMore:Pn,nextPage:wt+1}},getNextPageParam:wt=>wt.hasMore?wt.nextPage:void 0}),Qe=I.useMemo(()=>(Re==null?void 0:Re.pages.flatMap(wt=>wt.posts))??[],[Re]),le=or({mutationFn:async()=>{K(!0);const{data:wt,error:Xt}=await Q.from("community_posts").insert({user_id:t.id,category_id:N?null:w||null,private_group_id:N||null,content:y,link_url:R||null}).select().single();if(Xt)throw Xt;for(let an=0;an0){const an=ye.filter(wn=>wn!==t.id).map(wn=>({post_id:wt.id,mentioned_user_id:wn,mentioned_by_user_id:t.id}));an.length>0&&await Q.from("community_post_mentions").insert(an)}const Sr=Kjt(y);if(Sr.length>0){const an=Sr.map(wn=>({post_id:wt.id,resource_type:"template",resource_id:wn}));await Q.from("community_post_resources").insert(an)}return wt},onSuccess:async wt=>{var Xt;i.invalidateQueries({queryKey:["community-posts"]}),_(""),Ce([]),Ne([]),S(""),M(""),A([]),z([]),U(""),l({title:"Post created!"});try{const Sr=((Xt=t==null?void 0:t.user_metadata)==null?void 0:Xt.name)||"Someone",an=y.length>50?y.substring(0,50)+"...":y;await Q.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Sr}: ${an}`,url:"/community"}})}catch(Sr){console.error("Failed to send push notification:",Sr)}},onError:wt=>{l({title:"Error creating post",description:wt.message,variant:"destructive"})},onSettled:()=>K(!1)}),Ve=or({mutationFn:async({postId:wt,content:Xt})=>{const{error:Sr}=await Q.from("community_posts").update({content:Xt}).eq("id",wt);if(Sr)throw Sr},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),J(null),oe(""),l({title:"Post updated!"})}}),Le=or({mutationFn:async wt=>{const{error:Xt}=await Q.from("community_posts").delete().eq("id",wt);if(Xt)throw Xt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),We=or({mutationFn:async({postId:wt,isPinned:Xt})=>{const{error:Sr}=await Q.from("community_posts").update({is_pinned:!Xt,pinned_at:Xt?null:new Date().toISOString(),pinned_by:Xt?null:t==null?void 0:t.id}).eq("id",wt);if(Sr)throw Sr},onSuccess:(wt,{isPinned:Xt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:Xt?"Post unpinned":"Post pinned to top"})}}),_e=or({mutationFn:async({postId:wt,reactionType:Xt})=>{var an;const Sr=(an=Qe.find(wn=>wn.id===wt))==null?void 0:an.reactions.find(wn=>wn.user_id===(t==null?void 0:t.id));Sr?Sr.reaction_type===Xt?await Q.from("community_reactions").delete().eq("id",Sr.id):await Q.from("community_reactions").update({reaction_type:Xt}).eq("id",Sr.id):await Q.from("community_reactions").insert({post_id:wt,user_id:t.id,reaction_type:Xt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),st=or({mutationFn:async({postId:wt,content:Xt})=>{const{data:Sr,error:an}=await Q.from("community_comments").insert({post_id:wt,user_id:t.id,content:Xt}).select("id").single();if(an)throw an;const wn=fe[wt]||[];if(wn.length>0&&Sr){const Xr=wn.filter(Pn=>Pn!==t.id).map(Pn=>({comment_id:Sr.id,mentioned_user_id:Pn,mentioned_by_user_id:t.id}));Xr.length>0&&await Q.from("community_comment_mentions").insert(Xr)}},onSuccess:(wt,{postId:Xt})=>{i.invalidateQueries({queryKey:["community-posts"]}),se(Sr=>({...Sr,[Xt]:""})),he(Sr=>({...Sr,[Xt]:[]}))}});or({mutationFn:async wt=>{const{error:Xt}=await Q.from("community_comments").delete().eq("id",wt);if(Xt)throw Xt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const ze=wt=>{const Xt=Array.from(wt.target.files||[]);if(Xt.length+E.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}A(Sr=>[...Sr,...Xt]),Xt.forEach(Sr=>{const an=new FileReader;an.onloadend=()=>{z(wn=>[...wn,an.result])},an.readAsDataURL(Sr)})},Ee=wt=>{A(Xt=>Xt.filter((Sr,an)=>an!==wt)),z(Xt=>Xt.filter((Sr,an)=>an!==wt))},Je=wt=>wt.split(" ").map(Xt=>Xt[0]).join("").toUpperCase().slice(0,2),at=wt=>{const Xt={};return wt.forEach(Sr=>{Xt[Sr.reaction_type]=(Xt[Sr.reaction_type]||0)+1}),Xt},pt=wt=>{var Xt;return(Xt=wt.find(Sr=>Sr.user_id===(t==null?void 0:t.id)))==null?void 0:Xt.reaction_type},gt=wt=>wt.reduce((Xt,Sr)=>Xt+1+(Sr.replies?gt(Sr.replies):0),0),Mt=wt=>{if(s)return!0;if(!e||!wt.private_group_id)return!1;const Xt=Pe.find(Sr=>Sr.id===wt.private_group_id);return Xt!=null&&Xt.brokerage_id?n.some(Sr=>Sr.id===Xt.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(Ejt,{categories:Te,privateGroups:Pe,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(Ijt,{categories:Te,privateGroups:Pe,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:a||void 0}),r.jsx(Xs,{children:t!=null&&t.email?Je(t.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(Sre,{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:Ce,onTemplatesChange:Ne,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),P.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:P.map((wt,Xt)=>{var Sr;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Sr=E[Xt])!=null&&Sr.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(te,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Ee(Xt),children:r.jsx(gs,{className:"h-3 w-3"})})]},Xt)})}),R&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:R,onChange:wt=>U(wt.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>U(""),children:r.jsx(gs,{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:u,onChange:ze,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>{var wt;return(wt=u.current)==null?void 0:wt.click()},children:[r.jsx(Ol,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>{var wt;return(wt=u.current)==null?void 0:wt.click()},children:[r.jsx(Da,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>U("https://"),children:[r.jsx(Mo,{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:[Pe.length>0?r.jsxs(xn,{value:N||w||"none",onValueChange:wt=>{wt==="none"?(S(""),M("")):wt.startsWith("group:")?(M(wt.replace("group:","")),S("")):(S(wt),M(""))},children:[r.jsx(fn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(vn,{placeholder:"Select..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No category"}),Te.map(wt=>r.jsxs(qt,{value:wt.id,children:[wt.icon," ",wt.name]},wt.id)),Pe.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"}),Pe.map(wt=>r.jsxs(qt,{value:`group:${wt.id}`,children:[wt.icon||"🔒"," ",wt.name]},wt.id))]})]})]}):r.jsxs(xn,{value:w,onValueChange:S,children:[r.jsx(fn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(vn,{placeholder:"Category"})}),r.jsx(pn,{children:Te.map(wt=>r.jsxs(qt,{value:wt.id,children:[wt.icon," ",wt.name]},wt.id))})]}),r.jsxs(te,{size:"sm",onClick:()=>le.mutate(),disabled:!y.trim()||V,children:[r.jsx(eo,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Be?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((wt,Xt)=>r.jsx(Ke,{children:r.jsx(et,{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"})]})]})})},Xt))}):Qe.length===0?r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Bl,{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:[Qe.map(wt=>{var Xt,Sr,an,wn;return r.jsx(Ke,{children:r.jsxs(et,{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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:wt.user_avatar||void 0}),r.jsx(Xs,{children:Je(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:gu(new Date(wt.created_at),{addSuffix:!0})}),wt.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Lt,{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(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(lm,{className:"h-4 w-4"})})}),r.jsxs(eh,{align:"end",children:[Mt(wt)&&wt.private_group_id&&r.jsx(ri,{onClick:()=>We.mutate({postId:wt.id,isPinned:wt.is_pinned}),children:wt.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(tA,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(z1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),wt.user_id===(t==null?void 0:t.id)&&r.jsxs(ri,{onClick:()=>{J(wt),oe(wt.content)},children:[r.jsx(ni,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(ri,{className:"text-destructive",onClick:()=>Le.mutate(wt.id),children:[r.jsx($n,{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(z1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(Kye,{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((Xr,Pn)=>{const Ns=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:()=>rt({open:!0,images:wt.media.map(ys=>({url:ys.media_url,type:ys.media_type==="video"?"video":"image"})),index:Pn}),children:[Xr.media_type==="video"?r.jsx("video",{src:Xr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Xr.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"})})})}),Ns&&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]})})]},Xr.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:Xr=>{Xr.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(Mo,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:wt.link_url})]})})]}),wt.reactions.length>0&&r.jsx(_7e,{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(at(wt.reactions)).slice(0,3).map(([Xr])=>{var Pn;return r.jsx("span",{className:"text-base",children:(Pn=eO.find(Ns=>Ns.type===Xr))==null?void 0:Pn.emoji},Xr)})}),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(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"sm",className:"flex-1",children:[pt(wt.reactions)?r.jsx("span",{className:"mr-1",children:(Xt=eO.find(Xr=>Xr.type===pt(wt.reactions)))==null?void 0:Xt.emoji}):r.jsx(kd,{className:"h-4 w-4 mr-1"}),pt(wt.reactions)?(Sr=eO.find(Xr=>Xr.type===pt(wt.reactions)))==null?void 0:Sr.label:"Like"]})}),r.jsx(ed,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:eO.map(Xr=>r.jsx("button",{onClick:()=>_e.mutate({postId:wt.id,reactionType:Xr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Xr.label,children:Xr.emoji},Xr.type))})})]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ie(Xr=>{const Pn=new Set(Xr);return Pn.has(wt.id)?Pn.delete(wt.id):Pn.add(wt.id),Pn}),children:[r.jsx(Bl,{className:"h-4 w-4 mr-1"}),(()=>{const Xr=gt(wt.comments);return Xr>0?`Comment (${Xr})`:"Comment"})()]})]}),xe.has(wt.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[wt.comments.map(Xr=>r.jsx(b7e,{comment:Xr,postId:wt.id,currentUserId:t==null?void 0:t.id,currentUserAvatar:a,currentUserEmail:t==null?void 0:t.email,canModerate:Mt(wt)},Xr.id)),t&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Ys,{className:"h-8 w-8",children:[r.jsx(Pi,{src:a||void 0}),r.jsx(Xs,{className:"text-xs",children:Je(((an=t.email)==null?void 0:an.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(Sre,{placeholder:"Write a comment... (use @ to mention)",value:pe[wt.id]||"",onChange:Xr=>se(Pn=>({...Pn,[wt.id]:Xr})),onMentionsChange:Xr=>he(Pn=>({...Pn,[wt.id]:Xr})),mentionFormat:"plain",onKeyDown:Xr=>{var Pn;Xr.defaultPrevented||Xr.key==="Enter"&&!Xr.shiftKey&&((Pn=pe[wt.id])!=null&&Pn.trim())&&(Xr.preventDefault(),st.mutate({postId:wt.id,content:pe[wt.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{var Xr;(Xr=pe[wt.id])!=null&&Xr.trim()&&st.mutate({postId:wt.id,content:pe[wt.id]})},disabled:!((wn=pe[wt.id])!=null&&wn.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(eo,{className:"h-4 w-4"})})]})]})]})]})},wt.id)}),Ye&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(te,{variant:"outline",onClick:()=>ht(),disabled:Me,children:Me?"Loading…":"Load more posts"})})]}),r.jsx(Dr,{open:!!W,onOpenChange:()=>J(null),children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:"Edit Post"})}),r.jsx(ss,{value:ae,onChange:wt=>oe(wt.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>J(null),children:"Cancel"}),r.jsx(te,{onClick:()=>{W&&Ve.mutate({postId:W.id,content:ae})},disabled:!ae.trim(),children:"Save Changes"})]})]})}),r.jsx(Wjt,{images:be.images,initialIndex:be.index,open:be.open,onOpenChange:wt=>rt(Xt=>({...Xt,open:wt}))})]})]})})},j4={open:{label:"Open",icon:Wa,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Bl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Ii,color:"bg-green-500"},closed:{label:"Closed",icon:Lc,color:"bg-muted-foreground"}},$4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Yjt(){const{user:t}=Qr(),e=qr(),[n,s]=I.useState(null),[a,o]=I.useState(""),{data:l=[],isLoading:i}=Kt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:_}=await Q.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:u=[]}=Kt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:_}=await Q.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(_)throw _;return y},enabled:!!n}),p=or({mutationFn:async y=>{if(!n||!t)throw new Error("Missing data");const{error:_}=await Q.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(""),Oe.success("Reply sent!")},onError:()=>{Oe.error("Failed to send reply")}}),x=()=>{a.trim()&&p.mutate(a)};if(n){const y=j4[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(te,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(io,{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(Lt,{variant:"secondary",children:$4e[n.category]}),r.jsxs(Lt,{className:j4[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),j4[n.status].label]})]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Cn,{children:["Created on ",mn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(Ro,{className:"h-[300px] pr-4",children:u.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:u.map(_=>{var w;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":((w=_.profiles)==null?void 0:w.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:mn(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(_d,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ss,{placeholder:"Type your reply...",value:a,onChange:_=>o(_.target.value),className:"min-h-[80px]"}),r.jsx(te,{onClick:x,disabled:!a.trim()||p.isPending,className:"self-end",children:r.jsx(eo,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(et,{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(Dx,{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(Rhe,{trigger:r.jsxs(te,{size:"lg",className:"gap-2",children:[r.jsx(_n,{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(ji,{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(Rhe,{trigger:r.jsxs(te,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(_n,{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(Ke,{className:"border-dashed",children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Bl,{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 _=j4[y.status].icon;return r.jsx(Ke,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),children:r.jsx(et,{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(Lt,{variant:"outline",className:"text-xs",children:$4e[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:mn(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Lt,{className:j4[y.status].color,children:[r.jsx(_,{className:"h-3 w-3 mr-1"}),j4[y.status].label]})]})})},y.id)})})]})})}function Xjt({open:t,onOpenChange:e}){return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Br,{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(Ds,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(zr,{children:"Schedule Agent Onboarding"}),r.jsx(Jn,{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 Qjt({open:t,onOpenChange:e}){const{brokerageId:n}=Qr(),[s,a]=I.useState(""),[o,l]=I.useState([]),[i,u]=I.useState(!1),{data:p,isLoading:x}=Kt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:N,error:M}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(M)throw M;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(M=>M.includes(N)?M.filter(E=>E!==N):[...M,N])},w=async()=>{if(o.length===0){Oe.error("Please select at least one agent");return}u(!0);try{const{data:N,error:M}=await Q.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(M)throw M;Oe.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),e(!1)}catch(N){console.error("Error sending onboarding link:",N),Oe.error(N.message||"Failed to send onboarding link")}finally{u(!1)}},S=N=>{N||(l([]),a("")),e(N)};return r.jsx(Dr,{open:t,onOpenChange:S,children:r.jsxs(Or,{className:"max-w-md",children:[r.jsx(Br,{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(eo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(zr,{children:"Send Onboarding Link"}),r.jsx(Jn,{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(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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(Yr,{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(Ro,{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(Fl,{checked:o.includes(N.id),onCheckedChange:()=>_(N.id)}),r.jsx(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{className:"text-xs",children:N.name.split(" ").map(M=>M[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(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(te,{onClick:w,disabled:o.length===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(eo,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function Jjt(){const[t,e]=I.useState(!1),[n,s]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{className:"mb-8",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Bn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Agent Onboarding"}),r.jsx(Cn,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(te,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(te,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(eo,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(Xjt,{open:t,onOpenChange:e}),r.jsx(Qjt,{open:n,onOpenChange:s})]})}function ekt({open:t,onOpenChange:e}){return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Br,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Cg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(zr,{children:"Schedule Launch Meeting"}),r.jsx(Jn,{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 tkt(){const[t,e]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{className:"mb-8",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Cg,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Launch or ReLaunch Meeting"}),r.jsx(Cn,{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(et,{children:r.jsxs(te,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(Cg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(ekt,{open:t,onOpenChange:e})]})}function rkt(){const t=Gn(),[e,n]=I.useState(""),[s,a]=I.useState(null),{data:o,isLoading:l}=Kt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:N,error:M}=await Q.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(M)throw M;return N}}),{data:i}=Kt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:N,error:M}=await Q.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(M)throw M;return N}}),{data:u}=Kt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:N,error:M}=await Q.from("brokerage_resource_pdfs").select("resource_id");if(M)throw M;return N}}),{data:p}=Kt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:N,error:M}=await Q.from("brokerage_resource_videos").select("resource_id");if(M)throw M;return N}}),{data:x}=Kt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:N,error:M}=await Q.from("brokerage_resource_links").select("resource_id");if(M)throw M;return N}}),y=o==null?void 0:o.filter(N=>{var A;const M=N.title.toLowerCase().includes(e.toLowerCase())||((A=N.description)==null?void 0:A.toLowerCase().includes(e.toLowerCase())),E=!s||N.category_id===s;return M&&E}),_=i==null?void 0:i.filter(N=>o==null?void 0:o.some(M=>M.category_id===N.id)),w=N=>{const M=(u==null?void 0:u.filter(P=>P.resource_id===N).length)||0,E=(p==null?void 0:p.filter(P=>P.resource_id===N).length)||0,A=(x==null?void 0:x.filter(P=>P.resource_id===N).length)||0;return{pdfCount:M,videoCount:E,linkCount:A}},S=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(Jjt,{}),r.jsx(tkt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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(Lt,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),_.map(N=>r.jsx(Lt,{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,M)=>r.jsxs(Ke,{children:[r.jsx(Ir,{className:"h-40 w-full"}),r.jsx(Ht,{children:r.jsx(Ir,{className:"h-5 w-3/4"})}),r.jsxs(et,{children:[r.jsx(Ir,{className:"h-4 w-full mb-2"}),r.jsx(Ir,{className:"h-4 w-2/3"})]})]},M))}):(y==null?void 0:y.length)===0?r.jsxs(Ke,{className:"p-12 text-center",children:[r.jsx(Nh,{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:M,videoCount:E,linkCount:A}=w(N.id),P=i==null?void 0:i.find(z=>z.id===N.category_id);return r.jsxs(Ke,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>S(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(Nh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Zt,{className:"text-lg line-clamp-1",children:N.title}),P&&r.jsx(Lt,{variant:"secondary",className:"shrink-0 text-xs",children:P.name})]})}),r.jsxs(et,{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:[M>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ka,{className:"h-4 w-4"}),M]}),E>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Da,{className:"h-4 w-4"}),E]}),A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Mo,{className:"h-4 w-4"}),A]})]})]})]},N.id)})})]})})}const nkt=()=>{const{resourceId:t}=td(),{data:e,isLoading:n}=Kt({queryKey:["brokerage-resource-detail",t],queryFn:async()=>{const{data:a,error:o}=await Q.from("brokerage_resources").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;const{data:l}=await Q.from("brokerage_resource_pdfs").select("*").eq("resource_id",t).order("sort_order"),{data:i}=await Q.from("brokerage_resource_videos").select("*").eq("resource_id",t).order("sort_order"),{data:u}=await Q.from("brokerage_resource_links").select("*").eq("resource_id",t).order("sort_order");return{...a,pdfs:l||[],videos:i||[],links:u||[]}},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(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(Ji,{to:"/brokerage-resources",children:[r.jsx(io,{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(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Da,{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(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ka,{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(ka,{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(ao,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})}),e.links&&e.links.length>0&&r.jsx(Ke,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Os,{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(Os,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(Os,{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(Nh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(Ji,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function skt(){const{onlineUsers:t,totalOnline:e}=K8e();return r.jsxs(Ke,{children:[r.jsx(Ht,{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(Lt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Gu,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),e," online"]})]})}),r.jsx(et,{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(Ro,{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(Ys,{className:"h-9 w-9",children:[r.jsx(Pi,{src:n.avatarUrl,alt:n.name}),r.jsx(Xs,{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 ",gu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const U4e={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:hA,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:bm,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:Eg,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:_c,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:Rc,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:O1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:ay,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:As,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:As,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:ny,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:_m,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:Nh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:Nh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"},{title:"Agent Email Templates",description:"Manage curated email templates for agents",icon:ws,path:"/admin/agent-email-templates",color:"bg-rose-500/10 text-rose-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:Sj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Gh,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:ws,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:jm,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:qT,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:Mg,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:Zi,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:Yi,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Facebook & Instagram for social posting",icon:df,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:jm,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:Do,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:yS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:R1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:_s,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:ws,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:gc,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:fi,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:ua,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function akt(){const t=Gn();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(skt,{})})]}),r.jsxs(ki,{defaultValue:"users",className:"w-full",children:[r.jsx(pi,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(U4e).map(([e,n])=>r.jsx(rn,{value:e,className:"data-[state=active]:bg-background",children:n.label},e))}),Object.entries(U4e).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(Ke,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>t(s.path),children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Zt,{className:"text-base",children:s.title})]}),r.jsx(et,{className:"pt-0",children:r.jsx(Cn,{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 ikt=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}));ikt.displayName="TableFooter";const Mr=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}));Mr.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 jt=I.forwardRef(({className:t,...e},n)=>r.jsx("td",{ref:n,className:zt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));jt.displayName="TableCell";const okt=I.forwardRef(({className:t,...e},n)=>r.jsx("caption",{ref:n,className:zt("mt-4 text-sm text-muted-foreground",t),...e}));okt.displayName="TableCaption";const lkt=()=>{const{isAdmin:t}=Qr(),e=Gn(),[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(!1),[u,p]=I.useState(null);I.useEffect(()=>{if(!t){e("/dashboard");return}x()},[t]);const x=async()=>{try{const{data:N,error:M}=await Q.from("app_tiles").select("*").order("name");if(M)throw M;s(N||[])}catch(N){console.error("Error loading apps:",N),Oe.error("Failed to load apps")}finally{o(!1)}},y=async N=>{N.preventDefault();const M=new FormData(N.currentTarget),E={name:M.get("name"),description:M.get("description"),icon:M.get("icon"),app_id:M.get("app_id"),target_url:M.get("target_url"),required_tags:M.get("required_tags").split(",").map(A=>A.trim()).filter(Boolean)};try{if(u){const{error:A}=await Q.from("app_tiles").update(E).eq("id",u.id);if(A)throw A;Oe.success("App updated successfully")}else{const{error:A}=await Q.from("app_tiles").insert([E]);if(A)throw A;Oe.success("App created successfully")}i(!1),p(null),x()}catch(A){console.error("Error saving app:",A),Oe.error("Failed to save app")}},_=async N=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:M}=await Q.from("app_tiles").delete().eq("id",N);if(M)throw M;Oe.success("App deleted successfully"),x()}catch(M){console.error("Error deleting app:",M),Oe.error("Failed to delete app")}},w=N=>{p(N),i(!0)},S=()=>{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(te,{variant:"ghost",size:"sm",onClick:()=>e("/dashboard"),children:[r.jsx(io,{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(Dr,{open:l,onOpenChange:i,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{onClick:S,children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Or,{className:"max-w-2xl",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:u?"Edit App":"Create New App"}),r.jsx(Jn,{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(qe,{htmlFor:"name",children:"App Name"}),r.jsx(ot,{id:"name",name:"name",defaultValue:u==null?void 0:u.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"app_id",children:"App ID"}),r.jsx(ot,{id:"app_id",name:"app_id",defaultValue:u==null?void 0:u.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",name:"description",defaultValue:u==null?void 0:u.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(ot,{id:"icon",name:"icon",defaultValue:u==null?void 0:u.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"target_url",children:"Target URL"}),r.jsx(ot,{id:"target_url",name:"target_url",type:"url",defaultValue:u==null?void 0:u.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(ot,{id:"required_tags",name:"required_tags",defaultValue:u==null?void 0:u.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",children:u?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Application Tiles"}),r.jsx(Cn,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(et,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(te,{onClick:S,children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:[r.jsx(jt,{className:"text-2xl",children:N.icon}),r.jsx(jt,{className:"font-medium",children:N.name}),r.jsx(jt,{className:"font-mono text-sm",children:N.app_id}),r.jsx(jt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:N.target_url}),r.jsx(jt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:N.required_tags.map(M=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:M},M))})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>w(N),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>_(N.id),children:r.jsx($n,{className:"h-4 w-4"})})]})})]},N.id))})]})})]})})]})};function ju({title:t,description:e,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ji,{to:"/admin",children:r.jsxs(te,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(io,{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 q4e=({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(Lt,{variant:"destructive",className:zt("gap-1",e),children:[r.jsx(Xh,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(Lt,{variant:"destructive",className:zt("gap-1",e),children:[r.jsx(Wa,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?r.jsxs(Lt,{className:zt("gap-1 bg-amber-500 hover:bg-amber-600",e),children:[r.jsx(Wa,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(Lt,{variant:"secondary",className:zt("gap-1",e),children:[r.jsx(Wa,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},w7e=({open:t,onOpenChange:e,brokerages:n,fixedBrokerageId:s,onSuccess:a})=>{const{toast:o}=mi(),l=I.useRef(null),[i,u]=I.useState([]),[p,x]=I.useState(""),[y,_]=I.useState(!1),[w,S]=I.useState("upload"),[N,M]=I.useState(null),E=()=>{u([]),x(""),S("upload"),M(null),l.current&&(l.current.value="")},A=()=>{E(),e(!1)},P=K=>{const W=K.split(` `).map(ie=>ie.trim()).filter(ie=>ie);if(W.length===0)return[];const J=W[0].toLowerCase(),oe=J.includes("first")||J.includes("last")||J.includes("email")||J.includes("name")||J.includes("phone")||J.includes("sms")||J.includes("consent")?W.slice(1):W,xe=[];for(const ie of oe){const se=(ie.includes(" ")?ie.split(" "):ie.split(",")).map(fe=>fe.trim().replace(/^["']|["']$/g,""));if(se.length>=2){let fe="",he="",ye="",Ce="",Se;if(se.length===2){const rt=se[0].split(" ");fe=rt[0]||"",he=rt.slice(1).join(" ")||"",ye=se[1]}else if(se.length===3)fe=se[0],he=se[1],ye=se[2];else if(se.length===4)fe=se[0],he=se[1],ye=se[2],Ce=se[3];else if(se.length>=5){fe=se[0],he=se[1],ye=se[2],Ce=se[3];const rt=se[4].toLowerCase();Se=rt==="true"||rt==="yes"||rt==="1"||rt==="y"}const be=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ye);xe.push({firstName:fe.trim(),lastName:he.trim(),email:ye.trim().toLowerCase(),phone:Ce.trim()||void 0,smsConsent:Se,isValid:be&&fe.trim().length>0,error:be?fe.trim()?void 0:"Missing name":"Invalid email"})}}return xe},z=K=>{var ae;const W=(ae=K.target.files)==null?void 0:ae[0];if(!W)return;const J=new FileReader;J.onload=oe=>{var pe;const xe=(pe=oe.target)==null?void 0:pe.result,ie=P(xe);if(ie.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}u(ie),S("preview")},J.readAsText(W)},R=async()=>{const K=i.filter(J=>J.isValid);if(K.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const W=s||p||null;_(!0);try{const{data:{session:J}}=await Q.auth.getSession(),ae=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J==null?void 0:J.access_token}`},body:JSON.stringify({users:K.map(xe=>({firstName:xe.firstName,lastName:xe.lastName,email:xe.email,phone:xe.phone,smsConsent:xe.smsConsent})),brokerageId:W})}),oe=await ae.json();if(!ae.ok)throw new Error(oe.error||"Failed to import users");M(oe),S("result"),oe.created>0&&a(),o({title:"Import Complete",description:`${oe.created} user(s) created successfully.${oe.failed>0?` ${oe.failed} failed.`:""}`})}catch(J){console.error("Import error:",J),o({title:"Import Failed",description:J.message||"Failed to import users",variant:"destructive"})}finally{_(!1)}},U=i.filter(K=>K.isValid).length,V=i.filter(K=>!K.isValid).length;return r.jsx(Dr,{open:t,onOpenChange:A,children:r.jsxs(Or,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(P1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Jn,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),w==="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(ho,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(te,{onClick:()=>{var K;return(K=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."})]})]}),w==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!s&&n&&n.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Assign to Brokerage (optional)"}),r.jsxs(xn,{value:p||"none",onValueChange:K=>x(K==="none"?"":K),children:[r.jsx(fn,{children:r.jsx(vn,{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:[U," valid"]})]}),V>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(pl,{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(Mr,{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,W)=>r.jsxs(Mr,{children:[r.jsx(jt,{children:K.firstName}),r.jsx(jt,{children:K.lastName}),r.jsx(jt,{children:K.email}),r.jsx(jt,{className:"text-muted-foreground",children:K.phone||"-"}),r.jsx(jt,{className:"text-muted-foreground",children:K.smsConsent===!0?"✓":K.smsConsent===!1?"✗":"-"}),r.jsx(jt,{children:K.isValid?r.jsx(Lt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Lt,{variant:"destructive",children:K.error||"Invalid"})})]},W))})]}),i.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",i.length," users"]})]})]}),w==="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,W)=>r.jsxs("li",{children:["• ",K]},W)),N.errors.length>10&&r.jsxs("li",{children:["...and ",N.errors.length-10," more"]})]})]})]}),r.jsxs(Ws,{children:[w==="upload"&&r.jsx(te,{variant:"outline",onClick:A,children:"Cancel"}),w==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:E,children:"Back"}),r.jsx(te,{onClick:R,disabled:y||U===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${U} Agent${U!==1?"s":""}`})]}),w==="result"&&r.jsx(te,{onClick:A,children:"Done"})]})]})})},ckt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:_s},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:Yi},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Fc}];function j7e({open:t,onOpenChange:e,userId:n,userName:s}){const[a,o]=I.useState("custom"),[l,i]=I.useState(""),[u,p]=I.useState(""),x=Dit(),y=w=>{o(w.type),i(w.title),p(w.message)},_=async w=>{if(w.preventDefault(),!l.trim()){ga({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:u.trim()||void 0}),ga({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),e(!1),i(""),p(""),o("custom")}catch{ga({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(Fc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(Jn,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(qe,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:ckt.map((w,S)=>r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y(w),className:"text-xs",children:[r.jsx(w.icon,{className:"h-3 w-3 mr-1"}),w.title]},S))})]}),r.jsxs("form",{onSubmit:_,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(xn,{value:a,onValueChange:w=>o(w),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_s,{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(Yi,{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(ua,{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(wd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:l,onChange:w=>i(w.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"message",children:"Message (optional)"}),r.jsx(ss,{id:"message",value:u,onChange:w=>p(w.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:x.isPending,children:[r.jsx(Fc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Xce={points_earned:{label:"Points Earned",icon:Yi,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:ua,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:wd,color:"bg-green-500"},custom:{label:"Custom",icon:As,color:"bg-purple-500"}};function dkt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState("all"),{data:l=[],isLoading:i}=Kt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await Q.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:w}=await Q.from("profiles").select("id, name, email").in("id",_),S=new Map((w==null?void 0:w.map(N=>[N.id,N]))||[]);return x.map(N=>{var M,E,A;return{...N,user_name:((M=S.get(N.user_id))==null?void 0:M.name)||"Unknown",user_email:((E=S.get(N.user_id))==null?void 0:E.email)||"",creator_name:N.created_by?((A=S.get(N.created_by))==null?void 0:A.name)||"System":"Auto-triggered"}})}}),u=l.filter(x=>{var S,N;const y=((S=x.user_name)==null?void 0:S.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,w=a==="all"||a==="seen"&&x.seen_at||a==="unseen"&&!x.seen_at;return y&&_&&w}),p={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(Xce).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(Yr,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:p.total})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:p.seen})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:p.unseen})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:p.byType.custom||0})})]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Fc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(Cn,{children:"View all celebrations awarded to agents"})]}),r.jsxs(et,{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(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by agent name, email, or title...",value:t,onChange:x=>e(x.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),Object.entries(Xce).map(([x,y])=>r.jsx(qt,{value:x,children:y.label},x))]})]}),r.jsxs(xn,{value:a,onValueChange:o,children:[r.jsx(fn,{className:"w-[140px]",children:r.jsx(vn,{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(Mr,{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:u.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):u.map(x=>{const y=Xce[x.celebration_type],_=y.icon;return r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[r.jsx(_,{className:"h-3 w-3"}),y.label]})}),r.jsx(jt,{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(jt,{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(jt,{children:x.points_amount?r.jsxs(Lt,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(jt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(jt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:mn(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(jt,{children:x.seen_at?r.jsx(Lt,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Lt,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),u.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",u.length," of ",l.length," celebrations"]})]})]})]})}const ukt=()=>{const t=Gn(),{user:e,isAdmin:n}=Qr(),{startImpersonation:s,isLoading:a}=OPe(),{toast:o}=mi(),[l,i]=I.useState([]),[u,p]=I.useState([]),[x,y]=I.useState([]),[_,w]=I.useState({}),[S,N]=I.useState(!0),[M,E]=I.useState({}),[A,P]=I.useState(!1),[z,R]=I.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[U,V]=I.useState(!1),[K,W]=I.useState(""),[J,ae]=I.useState(1),[oe,xe]=I.useState(50),[ie,pe]=I.useState("all"),[se,fe]=I.useState("all"),[he,ye]=I.useState("all"),[Ce,Se]=I.useState("all"),[Ne,be]=I.useState(!1),[rt,Te]=I.useState(!1),[Pe,Ue]=I.useState(null),[Re,Be]=I.useState(null),[Ye,ht]=I.useState(!1),[Me,Qe]=I.useState({name:"",email:"",brokerage_id:"",phone:""}),[le,Ve]=I.useState(null),[Le,We]=I.useState(!1),[_e,st]=I.useState(""),[ze,Ee]=I.useState(!1),[Je,at]=I.useState(!1),[pt,gt]=I.useState(null),[Mt,wt]=I.useState(""),[Xt,Sr]=I.useState(!1),[an,wn]=I.useState(!1),[Xr,Pn]=I.useState(null),[Ns,hr]=I.useState(!1),[ys,Ca]=I.useState(!1),[va,$i]=I.useState(null),[Ui,al]=I.useState(""),[yo,Gs]=I.useState(!1),[Qa,Cs]=I.useState({email:"",name:"",password:"",phone:""}),[Ba,Ra]=I.useState(!1),[Fo,ir]=I.useState(!1),[po,gl]=I.useState(""),[Eo,is]=I.useState(!1),[vo,ku]=I.useState(!1),[Hl,Nu]=I.useState(""),[nt,ge]=I.useState(new Set),[Ae,Ze]=I.useState(!1),[Nt,vt]=I.useState(!1),[At,Bt]=I.useState(null),[Pt,Ut]=I.useState(!1),[fr,ar]=I.useState(null),[Wr,jn]=I.useState([]),[Vr,ts]=I.useState([]),[rs,Xn]=I.useState(!1),[Rs,Oi]=I.useState({});I.useEffect(()=>{!e||!n||(fa(),_o())},[e,n]);const mo=async()=>{try{const{data:kt,error:gr}=await Q.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(gr)throw gr;const Pr={};for(const Wn of kt??[])Pr[Wn.brokerage_id]||(Pr[Wn.brokerage_id]=[]),Pr[Wn.brokerage_id].push(Wn.user_id);w(Pr)}catch(kt){console.error("Error loading brokerage manager assignments:",kt)}},fa=async()=>{try{N(!0);const{data:kt,error:gr}=await Q.functions.invoke("get-user-details");if(gr)throw gr;const Pr=kt.users||[];i(Pr),y(kt.brokerages||[]),await mo();const Wn=Pr.filter(ns=>ns.roles.includes("assistant"));if(Wn.length>0){const ns=Wn.map(na=>na.id),{data:Ma}=await Q.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",ns);if(Ma&&Ma.length>0){const na=[...new Set(Ma.map(bp=>bp.agent_id))],{data:gi}=await Q.from("profiles").select("id, name, email").in("id",na),yl={};for(const bp of Ma){const wp=gi==null?void 0:gi.find(nu=>nu.id===bp.agent_id);wp&&(yl[bp.assistant_id]={agent_name:wp.name||"",agent_email:wp.email||""})}Oi(yl)}}}catch(kt){console.error("Error loading members:",kt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{N(!1)}},_o=async()=>{try{const{data:kt,error:gr}=await Q.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(gr)throw gr;p(kt||[])}catch(kt){console.error("Error loading apps:",kt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Ni=async kt=>{if(!Me.name.trim()||!Me.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Me.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:Pr}=await Q.from("profiles").update({name:Me.name.trim(),email:Me.email.trim(),brokerage_id:Me.brokerage_id||null,phone:Me.phone.trim()||null}).eq("id",kt);if(Pr)throw Pr;o({title:"Success",description:"Member details updated successfully"}),Ue(null),fa()}catch(Pr){console.error("Error updating member:",Pr),o({title:"Error",description:Pr.message||"Failed to update member",variant:"destructive"})}},Ks=async kt=>{try{const{data:{session:gr}}=await Q.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:kt})}),Wn=await Pr.json();if(!Pr.ok)throw new Error(Wn.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"})}},Si=async(kt,gr)=>{try{const{error:Pr}=await Q.functions.invoke("send-password-reset",{body:{email:kt,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"})}},$a=async(kt,gr)=>{if(confirm(`Are you sure you want to delete ${gr}? This action cannot be undone.`))try{const{data:{session:Pr}}=await Q.auth.getSession(),Wn=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:kt})}),ns=await Wn.json();if(!Wn.ok)throw new Error(ns.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),fa()}catch(Pr){console.error("Error deleting user:",Pr),o({title:"Error",description:Pr.message||"Failed to delete user",variant:"destructive"})}},Ms=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:kt}}=await Q.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.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 Wn=z.role==="brokerage_manager"?z.brokerage_id:void 0;await Ci(Pr.userId,z.role,"add",Wn)}o({title:"Success",description:`User ${z.email} created successfully`}),R({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),V(!1),fa()}catch(kt){console.error("Error creating user:",kt),o({title:"Error",description:kt.message||"Failed to create user",variant:"destructive"})}finally{P(!1)}},Ci=async(kt,gr,Pr,Wn)=>{try{const{data:{session:ns}}=await Q.auth.getSession(),Ma={userId:kt,role:gr,action:Pr};if(gr==="brokerage_manager"){if(!Wn){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}Ma.brokerageId=Wn}const na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ns==null?void 0:ns.access_token}`},body:JSON.stringify(Ma)}),gi=await na.json();if(!na.ok)throw new Error(gi.error||"Failed to manage user role");o({title:"Success",description:`Role ${Pr==="add"?"added":"removed"} successfully`}),fa()}catch(ns){console.error("Error managing user role:",ns),o({title:"Error",description:ns.message||"Failed to manage user role",variant:"destructive"})}},xl=(kt,gr)=>gr.length===0?!0:gr.some(Pr=>kt.includes(Pr)),Ml=async(kt,gr,Pr)=>{const Wn=`${kt}-${gr.id}`;Ve(Wn);try{if(Pr){const ns=l.find(na=>na.id===kt),Ma=gr.required_tags.filter(na=>ns==null?void 0:ns.tags.includes(na));for(const na of Ma){const{error:gi}=await Q.from("user_tags").delete().eq("user_id",kt).eq("tag",na);if(gi)throw gi}o({title:"Access Removed",description:`Removed access to ${gr.name}`})}else if(gr.required_tags.length>0){const{error:ns}=await Q.from("user_tags").insert({user_id:kt,tag:gr.required_tags[0]});if(ns)throw ns;o({title:"Access Granted",description:`Granted access to ${gr.name}`})}await fa()}catch(ns){console.error("Error toggling access:",ns),o({title:"Error",description:ns.message||"Failed to update access",variant:"destructive"})}finally{Ve(null)}},$c=async()=>{const kt=_e.trim();if(!kt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(kt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(Pr=>Pr.name.toLowerCase()===kt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Ee(!0);try{const{error:Pr}=await Q.from("brokerages").insert({name:kt});if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${kt}" created successfully`}),st(""),We(!1),fa()}catch(Pr){console.error("Error creating brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to create brokerage",variant:"destructive"})}finally{Ee(!1)}},wf=kt=>{gt(kt),wt(kt.name),at(!0)},qo=()=>{gt(null),wt(""),at(!1)},Ed=async()=>{if(!pt)return;const kt=Mt.trim();if(!kt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(kt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Sr(!0);try{const{error:gr}=await Q.from("brokerages").update({name:kt}).eq("id",pt.id);if(gr)throw gr;o({title:"Success",description:"Brokerage updated successfully"}),qo(),fa()}catch(gr){console.error("Error updating brokerage:",gr),o({title:"Error",description:gr.message||"Failed to update brokerage",variant:"destructive"})}finally{Sr(!1)}},cc=async(kt,gr)=>{var Pr;if(!gr||typeof gr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const Wn={userId:kt,role:"brokerage_manager",action:"add",brokerageId:gr};console.debug("[assignManagerToBrokerage] payload",Wn);const{data:{session:ns}}=await Q.auth.getSession(),Ma=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ns==null?void 0:ns.access_token}`},body:JSON.stringify(Wn)}),na=await Ma.json();if(!Ma.ok&&!((Pr=na.error)!=null&&Pr.includes("duplicate")))throw new Error(na.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await fa()}catch(Wn){console.error("Error assigning manager:",Wn),o({title:"Error",description:Wn.message||"Failed to assign manager",variant:"destructive"})}},th=kt=>{Pn(kt),wn(!0)},Vo=async()=>{if(Xr){hr(!0);try{const kt=l.filter(Wn=>Wn.brokerage_id===Xr.id),{data:{session:gr}}=await Q.auth.getSession();for(const Wn of kt){const ns=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:Wn.id})});if(!ns.ok){const Ma=await ns.json();console.error(`Failed to delete user ${Wn.email}:`,Ma.error)}}const{error:Pr}=await Q.from("brokerages").delete().eq("id",Xr.id);if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${Xr.name}" and ${kt.length} member(s) deleted`}),wn(!1),Pn(null),fa()}catch(kt){console.error("Error deleting brokerage:",kt),o({title:"Error",description:kt.message||"Failed to delete brokerage",variant:"destructive"})}finally{hr(!1)}}},yp=kt=>{$i(kt),al(""),Ca(!0)},Rm=()=>{$i(null),al(""),Ca(!1)},Fy=async kt=>{try{const{error:gr}=await Q.from("profiles").update({brokerage_id:null}).eq("id",kt);if(gr)throw gr;o({title:"Success",description:"User removed from brokerage"}),fa()}catch(gr){console.error("Error removing user from brokerage:",gr),o({title:"Error",description:gr.message||"Failed to remove user",variant:"destructive"})}},zy=async(kt,gr)=>{try{const{error:Pr}=await Q.from("profiles").update({brokerage_id:gr}).eq("id",kt);if(Pr)throw Pr;o({title:"Success",description:"User added to brokerage"}),fa()}catch(Pr){console.error("Error adding user to brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to add user",variant:"destructive"})}},By=async()=>{if(!va||!Qa.email||!Qa.name||!Qa.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Ra(!0);try{const{data:{session:kt}}=await Q.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`},body:JSON.stringify({...Qa,brokerage_id:va.id,role:"user"})}),Pr=await gr.json();if(!gr.ok)throw new Error(Pr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Qa.email} created successfully`}),Cs({email:"",name:"",password:"",phone:""}),Gs(!1),fa()}catch(kt){console.error("Error creating agent:",kt),o({title:"Error",description:kt.message||"Failed to create agent",variant:"destructive"})}finally{Ra(!1)}},Ph=kt=>l.filter(gr=>gr.brokerage_id===kt),Su=kt=>{const gr=Ph(kt);if(!Ui)return gr;const Pr=Ui.toLowerCase();return gr.filter(Wn=>Wn.name.toLowerCase().includes(Pr)||Wn.email.toLowerCase().includes(Pr))},Uc=kt=>l.filter(gr=>gr.brokerage_id!==kt),ru=l.filter(kt=>{var gr;if(K){const Pr=K.toLowerCase();if(!(kt.name.toLowerCase().includes(Pr)||kt.email.toLowerCase().includes(Pr)||((gr=kt.brokerage_name)==null?void 0:gr.toLowerCase().includes(Pr))))return!1}return!(ie==="claimed"&&!kt.claimed||ie==="unclaimed"&&kt.claimed||se!=="all"&&!kt.roles.includes(se)||he==="trial"&&!kt.is_trial||he==="non-trial"&&kt.is_trial||Ce==="none"&&kt.brokerage_id||Ce!=="all"&&Ce!=="none"&&kt.brokerage_id!==Ce)}),qc=ru.length,bo=Math.ceil(qc/oe),Id=(J-1)*oe,rh=Id+oe,kc=ru.slice(Id,rh),$y=kt=>{W(kt),ae(1)},vp=kt=>{xe(kt),ae(1)},_p=(kt,gr)=>{kt(gr),ae(1)},Uy=async(kt,gr)=>{be(!0);try{const Pr=l.find(na=>na.id===kt);if(!Pr)return;const Wn=Pr.trial_expires_at?new Date(Pr.trial_expires_at):new Date,ns=new Date(Wn.getTime()+gr*24*60*60*1e3),{error:Ma}=await Q.from("profiles").update({trial_expires_at:ns.toISOString()}).eq("id",kt);if(Ma)throw Ma;o({title:"Trial Extended",description:`Trial extended by ${gr} days`}),fa()}catch(Pr){console.error("Error extending trial:",Pr),o({title:"Error",description:Pr.message||"Failed to extend trial",variant:"destructive"})}finally{be(!1)}},Jg=async kt=>{Te(!0);try{const{error:gr}=await Q.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",kt);if(gr)throw gr;o({title:"Account Converted",description:"User has been converted to a full account"}),fa(),Lh()}catch(gr){console.error("Error converting trial:",gr),o({title:"Error",description:gr.message||"Failed to convert account",variant:"destructive"})}finally{Te(!1)}},ad=async kt=>{Xn(!0);try{const{data:gr}=await Q.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",kt);if(gr&&gr.length>0){const Wn=gr.map(Ma=>Ma.assistant_id),{data:ns}=await Q.from("profiles").select("id, name, email").in("id",Wn);jn(gr.map(Ma=>{const na=ns==null?void 0:ns.find(gi=>gi.id===Ma.assistant_id);return{id:Ma.id,assistant_id:Ma.assistant_id,assistant_name:(na==null?void 0:na.name)||"Unknown",assistant_email:(na==null?void 0:na.email)||"",permissions:Ma.permissions||{}}}))}else jn([]);const{data:Pr}=await Q.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",kt);if(Pr&&Pr.length>0){const Wn=Pr.map(Ma=>Ma.agent_id),{data:ns}=await Q.from("profiles").select("id, name, email").in("id",Wn);ts(Pr.map(Ma=>{const na=ns==null?void 0:ns.find(gi=>gi.id===Ma.agent_id);return{id:Ma.id,agent_id:Ma.agent_id,agent_name:(na==null?void 0:na.name)||"Unknown",agent_email:(na==null?void 0:na.email)||"",permissions:Ma.permissions||{}}}))}else ts([])}catch(gr){console.error("Error loading assistant data:",gr)}finally{Xn(!1)}},ex=kt=>{Be(kt),Qe({name:kt.name,email:kt.email,brokerage_id:kt.brokerage_id||"",phone:kt.phone||""}),ht(!0),ad(kt.id)},Lh=()=>{Be(null),ht(!1),Qe({name:"",email:"",brokerage_id:"",phone:""})},Oh=async()=>{Re&&(await Ni(Re.id),Lh())},B3=kt=>{ge(gr=>{const Pr=new Set(gr);return Pr.has(kt)?Pr.delete(kt):Pr.add(kt),Pr})},Sk=()=>{if(nt.size===kc.length&&kc.every(kt=>nt.has(kt.id))){const kt=new Set(nt);kc.forEach(gr=>kt.delete(gr.id)),ge(kt)}else{const kt=new Set(nt);kc.forEach(gr=>kt.add(gr.id)),ge(kt)}},jf=()=>{ge(new Set)},Qs=async()=>{if(nt.size===0)return;Ze(!0);let kt=0,gr=0;try{const{data:{session:Pr}}=await Q.auth.getSession();for(const Wn of nt)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:Wn})})).ok?kt++:gr++}catch{gr++}o({title:"Bulk Email Complete",description:`Sent ${kt} emails${gr>0?`, ${gr} failed`:""}`}),jf()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send emails",variant:"destructive"})}finally{Ze(!1)}},qy=async()=>{if(nt.size===0)return;Ze(!0);let kt=0,gr=0;try{const{data:{session:Pr}}=await Q.auth.getSession();for(const Wn of nt)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:Wn})})).ok?kt++:gr++}catch{gr++}o({title:"Bulk Password Reset Complete",description:`Sent ${kt} reset emails${gr>0?`, ${gr} failed`:""}`}),jf()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ze(!1)}},Sv=async()=>{if(nt.size===0)return;const kt=l.filter(ns=>nt.has(ns.id)).map(ns=>ns.name).slice(0,5).join(", "),gr=nt.size>5?` and ${nt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${nt.size} users (${kt}${gr})? This action cannot be undone.`))return;Ze(!0);let Pr=0,Wn=0;try{const{data:{session:ns}}=await Q.auth.getSession();for(const Ma of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ns==null?void 0:ns.access_token}`},body:JSON.stringify({userId:Ma})})).ok?Pr++:Wn++}catch{Wn++}o({title:"Bulk Delete Complete",description:`Deleted ${Pr} users${Wn>0?`, ${Wn} failed`:""}`}),jf(),fa()}catch(ns){o({title:"Error",description:ns.message||"Failed to delete users",variant:"destructive"})}finally{Ze(!1)}},Ck=async()=>{vt(!0);try{const{data:{session:kt}}=await Q.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`}});if(!gr.ok){const Wn=await gr.json();throw new Error(Wn.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`}),fa()}catch(kt){o({title:"Error",description:kt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{vt(!1)}},Mk=async(kt,gr)=>{Bt(kt);try{const{data:{session:Pr}}=await Q.auth.getSession(),{data:Wn}=await Q.from("profiles").select("phone").eq("id",kt).single(),ns=(Wn==null?void 0:Wn.phone)||"",Ma=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:ns||void 0})});if(!Ma.ok){const gi=await Ma.json();throw new Error(gi.error||"Failed to sync with GHL")}const na=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(gr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:ns?`Phone ${ns} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),fa()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to sync phone",variant:"destructive"})}finally{Bt(null)}},Dh=async kt=>{await s(kt)},tx=()=>{if(nt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const kt=l.filter(gi=>nt.has(gi.id)),gr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Pr=kt.map(gi=>[gi.name,gi.email,gi.phone||"",gi.brokerage_name||"",gi.roles.join("; "),gi.claimed?"Claimed":"Unclaimed",new Date(gi.created_at).toLocaleDateString()]),Wn=[gr.join(","),...Pr.map(gi=>gi.map(yl=>`"${(yl||"").replace(/"/g,'""')}"`).join(","))].join(` `),ns=new Blob([Wn],{type:"text/csv"}),Ma=URL.createObjectURL(ns),na=document.createElement("a");na.href=Ma,na.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,na.click(),URL.revokeObjectURL(Ma),o({title:"Export complete",description:`Exported ${kt.length} member(s)`})};return S?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(ju,{title:"Member Management",description:"Manage users, roles, and permissions"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:Ck,disabled:Nt,children:[Nt?r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(ji,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:Nt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:Nt?"Syncing...":"Sync GHL"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(P1,{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(Dr,{open:U,onOpenChange:V,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(hf,{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(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create New User"}),r.jsx(Jn,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",placeholder:"John Doe",value:z.name,onChange:kt=>R({...z,name:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",placeholder:"john@example.com",value:z.email,onChange:kt=>R({...z,email:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"password",children:"Password"}),r.jsx(ot,{id:"password",type:"password",placeholder:"Min 6 characters",value:z.password,onChange:kt=>R({...z,password:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"555-123-4567",value:z.phone,onChange:kt=>R({...z,phone:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{htmlFor:"brokerage",children:["Brokerage",z.role==="brokerage_manager"?" (required)":""]}),r.jsxs(xn,{value:z.brokerage_id||"none",onValueChange:kt=>R({...z,brokerage_id:kt==="none"?"":kt}),children:[r.jsx(fn,{id:"brokerage",children:r.jsx(vn,{placeholder:z.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"None"}),x.map(kt=>r.jsx(qt,{value:kt.id,children:kt.name},kt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"role",children:"Role"}),r.jsxs(xn,{value:z.role,onValueChange:kt=>R({...z,role:kt}),children:[r.jsx(fn,{id:"role",children:r.jsx(vn,{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(qe,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(xn,{value:z.trial_days||"none",onValueChange:kt=>R({...z,trial_days:kt==="none"?"":kt}),children:[r.jsx(fn,{id:"trial_days",children:r.jsx(vn,{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(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(te,{onClick:Ms,disabled:A,children:A?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(ki,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"members",children:"Members"}),r.jsx(rn,{value:"brokerages",children:"Brokerages"}),r.jsx(rn,{value:"access",children:"Access Matrix"}),r.jsx(rn,{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(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search members...",value:K,onChange:kt=>$y(kt.target.value),className:"pl-10 h-9"})]}),r.jsxs(xn,{value:ie,onValueChange:kt=>_p(pe,kt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(vn,{})}),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(xn,{value:se,onValueChange:kt=>_p(fe,kt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(vn,{})}),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(xn,{value:he,onValueChange:kt=>_p(ye,kt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(vn,{})}),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(xn,{value:Ce,onValueChange:kt=>_p(Se,kt),children:[r.jsx(fn,{className:"w-[150px] h-9",children:r.jsx(vn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Brokerages"}),r.jsx(qt,{value:"none",children:"No Brokerage"}),x.map(kt=>r.jsx(qt,{value:kt.id,children:kt.name},kt.id))]})]}),(K||ie!=="all"||se!=="all"||he!=="all"||Ce!=="all")&&r.jsxs(te,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{W(""),pe("all"),fe("all"),ye("all"),Se("all"),ae(1)},children:[r.jsx(gs,{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 ",Id+1,"-",Math.min(rh,qc)," of ",qc," members"]}),r.jsxs(xn,{value:oe.toString(),onValueChange:kt=>vp(Number(kt)),children:[r.jsx(fn,{className:"h-9 w-[110px]",children:r.jsx(vn,{})}),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"})]})]})]})]}),nt.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(F0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[nt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:Qs,disabled:Ae,children:[Ae?r.jsx(Yr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(ws,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),r.jsx("span",{className:"sm:hidden",children:"Invite"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:qy,disabled:Ae,children:[Ae?r.jsx(Yr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(cf,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),r.jsx("span",{className:"sm:hidden",children:"Reset"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:tx,children:[r.jsx(ao,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Export"}),r.jsx("span",{className:"sm:hidden",children:"CSV"})]}),r.jsxs(te,{size:"sm",variant:"destructive",onClick:Sv,disabled:Ae,children:[Ae?r.jsx(Yr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx($n,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Delete"}),r.jsx("span",{className:"sm:hidden",children:"Del"})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:jf,disabled:Ae,children:r.jsx(gs,{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(Mr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"w-[50px]",children:r.jsx(Fl,{checked:kc.length>0&&kc.every(kt=>nt.has(kt.id)),onCheckedChange:Sk,"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:kc.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):kc.map(kt=>r.jsxs(Mr,{className:`hover:bg-muted/30 ${nt.has(kt.id)?"bg-primary/5":""}`,children:[r.jsx(jt,{children:r.jsx(Fl,{checked:nt.has(kt.id),onCheckedChange:()=>B3(kt.id),"aria-label":`Select ${kt.name}`})}),r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>ex(kt),className:"text-primary hover:underline font-medium text-left",children:kt.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:kt.email})]})}),r.jsx(jt,{className:"text-muted-foreground",children:kt.brokerage_name||"—"}),r.jsx(jt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Lt,{variant:kt.claimed?"default":"secondary",className:kt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:kt.claimed?"Active":"Pending"}),kt.is_trial&&kt.trial_expires_at&&r.jsx(q4e,{expiresAt:kt.trial_expires_at,className:"w-fit"})]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[kt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:kt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"}),kt.roles.includes("assistant")&&r.jsxs(Lt,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",Rs[kt.id]?` → ${Rs[kt.id].agent_name||Rs[kt.id].agent_email}`:""]})]})}),r.jsx(jt,{className:"text-muted-foreground",children:kt.last_sign_in_at?new Date(kt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ar(kt),Ut(!0)},title:"Send celebration",children:r.jsx(Fc,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ex(kt),title:"Edit member",children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Mk(kt.id,kt.email),disabled:At===kt.id,title:"Sync phone with GHL",children:At===kt.id?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(ji,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ks(kt.id),title:"Resend welcome email",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Si(kt.email,kt.name),title:"Send password reset",children:r.jsx(Nj,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Dh(kt.id),disabled:a||kt.id===(e==null?void 0:e.id),title:kt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${kt.name}`,children:a?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(_S,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>$a(kt.id,kt.name),title:"Delete user",children:r.jsx($n,{className:"h-4 w-4"})})]})})]},kt.id))})]})}),bo>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 ",J," of ",bo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:J===1,children:"First"}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.max(1,kt-1)),disabled:J===1,children:r.jsx(vc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,bo)},(kt,gr)=>{let Pr;return bo<=5||J<=3?Pr=gr+1:J>=bo-2?Pr=bo-4+gr:Pr=J-2+gr,r.jsx(te,{variant:J===Pr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ae(Pr),children:Pr},Pr)})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.min(bo,kt+1)),disabled:J===bo,children:r.jsx(Bi,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"sm",onClick:()=>ae(bo),disabled:J===bo,children:"Last"})]})]})]}),r.jsx(Dr,{open:Ye,onOpenChange:ht,children:r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Edit Member"}),r.jsx(Jn,{children:"Update member details, roles, and app access"})]}),Re&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"edit-name",children:"Name"}),r.jsx(ot,{id:"edit-name",value:Me.name,onChange:kt=>Qe({...Me,name:kt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"edit-email",children:"Email"}),r.jsx(ot,{id:"edit-email",type:"email",value:Me.email,onChange:kt=>Qe({...Me,email:kt.target.value}),maxLength:255})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(ot,{id:"edit-phone",type:"tel",value:Me.phone,onChange:kt=>Qe({...Me,phone:kt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(xn,{value:Me.brokerage_id||"none",onValueChange:kt=>Qe({...Me,brokerage_id:kt==="none"?"":kt}),children:[r.jsx(fn,{id:"edit-brokerage",children:r.jsx(vn,{placeholder:"Select brokerage"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"None"}),x.map(kt=>r.jsx(qt,{value:kt.id,children:kt.name},kt.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:[Re.roles.map(kt=>r.jsxs(Lt,{variant:"default",className:"gap-1",children:[r.jsx(uf,{className:"h-3 w-3"}),kt,kt==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Ci(Re.id,kt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(gs,{className:"h-3 w-3"})})]},kt)),Re.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(xn,{onValueChange:kt=>Ci(Re.id,kt,"add"),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(vn,{placeholder:"Add role..."})}),r.jsxs(pn,{children:[!Re.roles.includes("admin")&&r.jsx(qt,{value:"admin",children:"Admin"}),!Re.roles.includes("user")&&r.jsx(qt,{value:"user",children:"User"})]})]}),!Re.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||Vr.length>0||Re.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"]}),rs?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Yr,{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(kt=>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:kt.assistant_name}),r.jsx(Lt,{variant:"outline",className:"text-xs",children:"Assistant"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:kt.assistant_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(kt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(Lt,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},kt.id))]}),Vr.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:"}),Vr.map(kt=>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:kt.agent_name}),r.jsx(Lt,{variant:"outline",className:"text-xs",children:"Agent"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:kt.agent_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(kt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(Lt,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},kt.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:u.map(kt=>{const gr=xl(Re.tags,kt.required_tags),Pr=`${Re.id}-${kt.id}`,Wn=le===Pr,ns=kt.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:kt.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:kt.name}),ns&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:Wn?r.jsx(Yr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):ns?r.jsx(Lt,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Ss,{checked:gr,onCheckedChange:()=>Ml(Re.id,kt,gr)})})]},kt.id)})})]}),Re.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(Wa,{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:Re.trial_expires_at&&r.jsx(q4e,{expiresAt:Re.trial_expires_at})}),Re.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Re.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>Uy(Re.id,7),disabled:Ne,children:[r.jsx(vj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>Uy(Re.id,14),disabled:Ne,children:[r.jsx(vj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>Uy(Re.id,30),disabled:Ne,children:[r.jsx(vj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(te,{size:"sm",variant:"default",onClick:()=>Jg(Re.id),disabled:rt,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Pj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Re.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Re.trial_started_at).toLocaleDateString(),Re.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Re.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:[Re.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Re.email_confirmed_at).toLocaleString()]}),Re.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Re.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Re.created_at).toLocaleString()]})]})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:Lh,children:"Cancel"}),r.jsx(te,{onClick:Oh,children:"Save Changes"})]})]})}),r.jsxs(Sn,{value:"access",children:[u.length===0?r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(te,{onClick:()=>t("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Member Access Matrix"}),r.jsx(Cn,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(et,{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"}),u.map(kt=>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:kt.icon}),r.jsx("span",{className:"text-sm",children:kt.name})]})},kt.id))]})}),r.jsxs("tbody",{children:[kc.map(kt=>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:kt.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:kt.email})]})}),u.map(gr=>{const Pr=xl(kt.tags,gr.required_tags),Wn=`${kt.id}-${gr.id}`,ns=le===Wn;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:ns?r.jsx(Yr,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Ss,{checked:Pr,onCheckedChange:()=>Ml(kt.id,gr,Pr),disabled:gr.required_tags.length===0})})},gr.id)})]},kt.id)),kc.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:u.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),bo>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 ",Id+1,"-",Math.min(rh,qc)," of ",qc," • Page ",J," of ",bo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.max(1,kt-1)),disabled:J===1,children:r.jsx(vc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.min(bo,kt+1)),disabled:J===bo,children:r.jsx(Bi,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(te,{variant:"outline",onClick:()=>t("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(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(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search brokerages...",value:po,onChange:kt=>gl(kt.target.value),className:"pl-10"})]}),r.jsxs(Dr,{open:Le,onOpenChange:We,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create New Brokerage"}),r.jsx(Jn,{children:"Add a new brokerage to the system."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(ot,{id:"brokerage-name",placeholder:"Enter brokerage name",value:_e,onChange:kt=>st(kt.target.value),maxLength:100})]})}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>We(!1),children:"Cancel"}),r.jsx(te,{onClick:$c,disabled:ze,children:ze?"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(Mr,{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 kt=x.filter(gr=>gr.name.toLowerCase().includes(po.toLowerCase()));return kt.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:po?"No brokerages match your search":"No brokerages found"})}):kt.map(gr=>{const Pr=l.filter(na=>na.brokerage_id===gr.id),ns=(_[gr.id]??[]).map(na=>l.find(gi=>gi.id===na)).filter(Boolean),Ma=Pr.length;return r.jsxs(Mr,{className:"hover:bg-muted/30",children:[r.jsx(jt,{children:r.jsx("button",{onClick:()=>wf(gr),className:"text-primary hover:underline font-medium",children:gr.name})}),r.jsx(jt,{children:ns.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:ns.map(na=>r.jsx(Lt,{variant:"secondary",className:"text-xs",children:na.name},na.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(jt,{children:[Ma," member",Ma!==1?"s":""]}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"h-8",onClick:()=>yp(gr),children:[r.jsx(Bn,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>wf(gr),title:"Edit brokerage",children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>th(gr),title:"Delete brokerage",children:r.jsx($n,{className:"h-4 w-4"})})]})})]},gr.id)})})()})]})}),r.jsx(Dr,{open:Je,onOpenChange:at,children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Edit Brokerage"}),r.jsx(Jn,{children:"Update brokerage details and manage managers"})]}),pt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(ot,{id:"edit-brokerage-name",value:Mt,onChange:kt=>wt(kt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{children:"Managers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const gr=(_[pt.id]??[]).map(Pr=>l.find(Wn=>Wn.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(Lt,{variant:"default",className:"gap-1",children:[r.jsx(uf,{className:"h-3 w-3"}),Pr.name,r.jsx("button",{onClick:()=>Ci(Pr.id,"brokerage_manager","remove",pt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(gs,{className:"h-3 w-3"})})]},Pr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(Cd,{open:Eo,onOpenChange:is,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":Eo,className:"w-full justify-between",children:["Search for a member...",r.jsx(ya,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(ed,{className:"w-full p-0",align:"start",children:r.jsxs(by,{children:[r.jsx(wy,{placeholder:"Search by name or email..."}),r.jsxs(jy,{className:"max-h-[200px]",children:[r.jsx(ky,{children:"No members found."}),r.jsx(Ny,{children:(()=>{const kt=new Set(_[pt.id]??[]);return l.filter(gr=>!kt.has(gr.id)&&(n||gr.brokerage_id===pt.id)).map(gr=>r.jsxs(Sy,{value:`${gr.name} ${gr.email}`,onSelect:()=>{cc(gr.id,pt.id),is(!1)},children:[gr.name," (",gr.email,")"]},gr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(kt=>kt.brokerage_id===pt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(kt=>kt.brokerage_id===pt.id).map(kt=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:kt.name}),kt.roles.includes("brokerage_manager")&&r.jsx(Lt,{variant:"outline",className:"text-xs",children:"Manager"})]},kt.id))})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:qo,children:"Cancel"}),r.jsx(te,{onClick:Ed,disabled:Xt,children:Xt?"Saving...":"Save Changes"})]})]})}),r.jsx(Dr,{open:an,onOpenChange:wn,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Jn,{children:['Are you sure you want to delete "',Xr==null?void 0:Xr.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 "',Xr==null?void 0:Xr.name,'"']}),r.jsxs("li",{children:["All ",l.filter(kt=>kt.brokerage_id===(Xr==null?void 0:Xr.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>wn(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Vo,disabled:Ns,children:Ns?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Dr,{open:ys,onOpenChange:Ca,children:r.jsxs(Or,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-5 w-5"}),"Manage ",va==null?void 0:va.name]}),r.jsx(Jn,{children:"Add, remove, or manage users in this brokerage"})]}),va&&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(ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search members...",value:Ui,onChange:kt=>al(kt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Dr,{open:yo,onOpenChange:Gs,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(hf,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Add New Agent"}),r.jsxs(Jn,{children:["Create a new agent for ",va.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"agent-name",children:"Name"}),r.jsx(ot,{id:"agent-name",placeholder:"John Doe",value:Qa.name,onChange:kt=>Cs({...Qa,name:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"agent-email",children:"Email"}),r.jsx(ot,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Qa.email,onChange:kt=>Cs({...Qa,email:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"agent-password",children:"Password"}),r.jsx(ot,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Qa.password,onChange:kt=>Cs({...Qa,password:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(ot,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Qa.phone,onChange:kt=>Cs({...Qa,phone:kt.target.value})})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>Gs(!1),children:"Cancel"}),r.jsx(te,{onClick:By,disabled:Ba,children:Ba?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qe,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(Cd,{open:vo,onOpenChange:ku,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":vo,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(ya,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(ed,{className:"w-[300px] p-0",align:"start",children:r.jsxs(by,{children:[r.jsx(wy,{placeholder:"Search users...",value:Hl,onValueChange:Nu}),r.jsxs(jy,{children:[r.jsx(ky,{children:"No users found."}),r.jsx(Ny,{children:Uc(va.id).filter(kt=>Hl===""||kt.name.toLowerCase().includes(Hl.toLowerCase())||kt.email.toLowerCase().includes(Hl.toLowerCase())).map(kt=>r.jsxs(Sy,{value:`${kt.name} ${kt.email}`,onSelect:()=>{zy(kt.id,va.id),ku(!1),Nu("")},children:[kt.name," (",kt.email,")"]},kt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:Su(va.id).length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:Ui?"No matching members found":"No members in this brokerage"})}):Su(va.id).map(kt=>r.jsxs(Mr,{className:"hover:bg-muted/30",children:[r.jsx(jt,{className:"font-medium",children:kt.name}),r.jsx(jt,{className:"text-muted-foreground",children:kt.email}),r.jsx(jt,{children:kt.claimed?r.jsx(Lt,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Lt,{variant:"secondary",children:"Pending"})}),r.jsx(jt,{children:kt.roles.includes("brokerage_manager")?r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[r.jsx(uf,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!kt.claimed&&r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ks(kt.id),title:"Resend welcome email",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Fy(kt.id),title:"Remove from brokerage",children:r.jsx(gs,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Dh(kt.id),disabled:a||kt.id===(e==null?void 0:e.id),title:kt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${kt.name}`,children:a?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(_S,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>$a(kt.id,kt.name),title:"Delete user",children:r.jsx($n,{className:"h-4 w-4"})})]})})]},kt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Ph(va.id).length," total member",Ph(va.id).length!==1?"s":""," •",Ph(va.id).filter(kt=>kt.roles.includes("brokerage_manager")).length," manager",Ph(va.id).filter(kt=>kt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(Ws,{children:r.jsx(te,{variant:"outline",onClick:Rm,children:"Close"})})]})})]}),r.jsx(Sn,{value:"celebrations",children:r.jsx(dkt,{})})]})]}),r.jsx(w7e,{open:Fo,onOpenChange:ir,brokerages:x,onSuccess:fa}),fr&&r.jsx(j7e,{open:Pt,onOpenChange:kt=>{Ut(kt),kt||ar(null)},userId:fr.id,userName:fr.name})]})},hkt=()=>{const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(""),[u,p]=I.useState(""),[x,y]=I.useState(""),[_,w]=I.useState("");I.useEffect(()=>{S()},[]);const S=async()=>{const{data:R,error:U}=await Q.from("invite_codes").select("*").order("created_at",{ascending:!1});U?(Oe.error("Failed to load invite codes"),console.error(U)):e(R||[]),s(!1)},N=async R=>{if(R.preventDefault(),!l.trim()){Oe.error("Please enter a code");return}o(!0);const{error:U}=await Q.from("invite_codes").insert({code:l.trim().toUpperCase(),description:u.trim()||null,max_uses:x?parseInt(x):null,trial_days:_?parseInt(_):null});U?U.code==="23505"?Oe.error("This code already exists"):(Oe.error("Failed to create invite code"),console.error(U)):(Oe.success("Invite code created"),i(""),p(""),y(""),w(""),S()),o(!1)},M=async(R,U)=>{const{error:V}=await Q.from("invite_codes").update({is_active:!U}).eq("id",R);V?Oe.error("Failed to update code"):e(t.map(K=>K.id===R?{...K,is_active:!U}:K))},E=async R=>{const{error:U}=await Q.from("invite_codes").delete().eq("id",R);U?Oe.error("Failed to delete code"):(Oe.success("Code deleted"),e(t.filter(V=>V.id!==R)))},A="https://dashboard.relevelup.com",P=R=>{const U=`${A}/join?code=${R}`;navigator.clipboard.writeText(U),Oe.success("Link copied to clipboard")},z=`${A}/join`;return r.jsx(Lr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Create New Code"}),r.jsxs(Cn,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:z})]})]}),r.jsx(et,{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(qe,{htmlFor:"code",children:"Code"}),r.jsx(ot,{id:"code",placeholder:"WELCOME2024",value:l,onChange:R=>i(R.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(qe,{htmlFor:"description",children:"Description (optional)"}),r.jsx(ot,{id:"description",placeholder:"For marketing campaign",value:u,onChange:R=>p(R.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(ot,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:R=>y(R.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(ot,{id:"trialDays",type:"number",placeholder:"None",value:_,onChange:R=>w(R.target.value),className:"w-28"})]}),r.jsxs(te,{type:"submit",disabled:a,children:[a?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Active Codes"})}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{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(Mr,{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(R=>r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-mono font-medium",children:R.code}),r.jsx(jt,{className:"text-muted-foreground",children:R.description||"—"}),r.jsxs(jt,{children:[R.uses_count,R.max_uses&&` / ${R.max_uses}`]}),r.jsx(jt,{children:R.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[R.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(jt,{className:"text-muted-foreground",children:mn(new Date(R.created_at),"MMM d, yyyy")}),r.jsx(jt,{children:r.jsx(Ss,{checked:R.is_active,onCheckedChange:()=>M(R.id,R.is_active)})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>P(R.code),title:"Copy invite link",children:r.jsx(tl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>E(R.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx($n,{className:"h-4 w-4"})})]})})]},R.id))})]})})]})]})})},lae=async t=>{try{const{data:e,error:n}=await Q.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}},XI=async t=>{try{const{data:e,error:n}=await Q.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}}},fkt=async(t,e)=>await lae("new_templates")?XI({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}),pkt=async(t,e)=>XI({title:"New Academy Video",body:`New video added: ${t}`,url:`/academy/${e}`}),mkt=async(t,e)=>await lae("new_events")?XI({title:"New Event",body:`New event: ${t}`,url:`/events/${e}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),gkt=async(t,e)=>await lae("new_toolbox")?XI({title:"New Resource Kit",body:`New resource kit available: ${t}`,url:`/toolbox/${e}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),Efe=async(t,e)=>await lae("new_social_swag")?XI({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}),tO={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 xkt(){const t=Gn(),e=qr(),[n,s]=I.useState(!1),[a,o]=I.useState(null),[l,i]=I.useState(tO),[u,p]=I.useState(null),[x,y]=I.useState(null),[_,w]=I.useState(!1),S=I.useRef(null),[N,M]=I.useState(!1),[E,A]=I.useState(null),[P,z]=I.useState(!1),[R,U]=I.useState(null),[V,K]=I.useState(null),[W,J]=I.useState(!0),[ae,oe]=I.useState(""),{data:xe,isLoading:ie}=Kt({queryKey:["admin-events"],queryFn:async()=>{const{data:_e,error:st}=await Q.from("events").select("*").order("event_date",{ascending:!0});if(st)throw st;return _e}}),{data:pe}=Kt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:_e,error:st}=await Q.from("event_registrations").select("event_id");if(st)throw st;const ze={};return _e.forEach(Ee=>{ze[Ee.event_id]=(ze[Ee.event_id]||0)+1}),ze}}),{data:se,isLoading:fe}=Kt({queryKey:["event-registrations-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:_e,error:st}=await Q.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(st)throw st;if(!_e||_e.length===0)return[];const ze=_e.map(at=>at.user_id).filter(Boolean);let Ee=[];if(ze.length>0){const{data:at,error:pt}=await Q.from("profiles").select("id, name, email").in("id",ze);if(pt)throw pt;Ee=at||[]}const Je=new Map((Ee==null?void 0:Ee.map(at=>[at.id,at]))||[]);return _e.map(at=>({...at,profiles:at.user_id&&Je.get(at.user_id)||null}))},enabled:!!E}),{data:he,isLoading:ye}=Kt({queryKey:["event-attendees-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:_e,error:st}=await Q.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(st)throw st;if(!_e||_e.length===0)return[];const ze=_e.map(gt=>gt.user_id).filter(Boolean);let Ee=[];if(ze.length>0){const{data:gt,error:Mt}=await Q.from("profiles").select("id, name, email").in("id",ze);if(Mt)throw Mt;Ee=gt||[]}const{data:Je}=await Q.from("agent_points").select("user_id").eq("event_id",E.id),at=new Set((Je==null?void 0:Je.map(gt=>gt.user_id))||[]),pt=new Map((Ee==null?void 0:Ee.map(gt=>[gt.id,gt]))||[]);return _e.map(gt=>({...gt,profiles:gt.user_id&&pt.get(gt.user_id)||null,points_awarded:gt.user_id?at.has(gt.user_id):!1}))},enabled:!!E}),Ce=_e=>{A(_e),M(!0)},Se=or({mutationFn:async _e=>{const{data:{session:st}}=await Q.auth.getSession();if(!st)throw new Error("Not authenticated");const ze=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${st.access_token}`},body:JSON.stringify({event_id:_e})}),Ee=await ze.json();if(!ze.ok)throw new Error(Ee.error||"Failed to sync");return Ee},onSuccess:_e=>{e.invalidateQueries({queryKey:["event-registrations-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-registrations-count"]}),Oe.success(_e.message)},onError:_e=>{Oe.error("Failed to sync: "+_e.message)}}),Ne=or({mutationFn:async _e=>{const{data:{session:st}}=await Q.auth.getSession();if(!st)throw new Error("Not authenticated");const ze=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${st.access_token}`},body:JSON.stringify({event_id:_e})}),Ee=await ze.json();if(!ze.ok)throw new Error(Ee.error||"Failed to sync attendees");return Ee},onSuccess:_e=>{e.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]}),_e!=null&&_e.message?Oe.success(_e.message):Oe.success(`Synced ${_e.synced||0} attendees. ${_e.points_awarded||0} points awarded!`)},onError:_e=>{Oe.error("Failed to sync attendees: "+_e.message)}}),be=or({mutationFn:async({eventId:_e,testMode:st})=>{const{data:{session:ze}}=await Q.auth.getSession();if(!ze)throw new Error("Not authenticated");const Ee=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ze.access_token}`},body:JSON.stringify({event_id:_e,test_mode:st})}),Je=await Ee.json();if(!Ee.ok)throw new Error(Je.error||"Failed to send reminders");return Je},onSuccess:_e=>{_e.test?Oe.success(_e.message||"Test email sent!"):Oe.success(_e.message||`Reminder emails sent to ${_e.sent} registrants!`)},onError:_e=>{Oe.error("Failed to send reminders: "+_e.message)}}),{data:rt}=Kt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let _e=[],st=0;const ze=1e3;for(;;){const{data:Ee,error:Je}=await Q.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(st,st+ze-1);if(Je)throw Je;if(!Ee||Ee.length===0||(_e=[..._e,...Ee],Ee.length{const{error:Je}=await Q.from("event_attendees").update({user_id:st}).eq("id",_e);if(Je)throw Je;if(Ee&&ze){const{error:pt}=await Q.from("zoom_email_aliases").upsert({user_id:st,zoom_email:ze.toLowerCase()},{onConflict:"zoom_email"});pt&&console.error("Failed to save alias:",pt)}const at=E==null?void 0:E.id;if(at){const{data:pt}=await Q.from("user_roles").select("id").eq("user_id",st).eq("role","admin").single();if(!pt){const{data:gt}=await Q.from("agent_points").select("id").eq("user_id",st).eq("event_id",at).single();gt||(await Q.rpc("award_attendance_points",{p_user_id:st,p_event_id:at,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await Q.rpc("check_and_award_badges",{p_user_id:st}))}}return{userId:st,zoomEmail:ze,shouldSaveAlias:Ee}},onSuccess:_e=>{e.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]});let st="Attendee linked and points awarded!";_e.shouldSaveAlias&&_e.zoomEmail&&(st+=` Email "${_e.zoomEmail}" will be auto-matched in the future.`),Oe.success(st),z(!1),U(null),K(null),oe("")},onError:_e=>{Oe.error("Failed to link attendee: "+_e.message)}}),Pe=_e=>{U(_e),K(null),J(!0),oe(""),z(!0)},Ue=()=>{!R||!V||Te.mutate({attendeeId:R.id,userId:V,zoomEmail:R.zoom_email,shouldSaveAlias:W})},Re=(rt==null?void 0:rt.filter(_e=>{var ze,Ee;if(!ae)return!0;const st=ae.toLowerCase();return((ze=_e.name)==null?void 0:ze.toLowerCase().includes(st))||((Ee=_e.email)==null?void 0:Ee.toLowerCase().includes(st))}))||[],Be=async _e=>{const st=_e.name.split(".").pop(),Ee=`${`${crypto.randomUUID()}.${st}`}`,{error:Je}=await Q.storage.from("event-images").upload(Ee,_e);if(Je)throw Je;const{data:{publicUrl:at}}=Q.storage.from("event-images").getPublicUrl(Ee);return at},Ye=_e=>{var ze;const st=(ze=_e.target.files)==null?void 0:ze[0];if(st){if(st.size>5*1024*1024){Oe.error("Image must be less than 5MB");return}p(st),y(URL.createObjectURL(st))}},ht=()=>{p(null),y(null),i({...l,image_url:""}),S.current&&(S.current.value="")},Me=or({mutationFn:async _e=>{w(!0);let st=_e.image_url;u&&(st=await Be(u)||"");const ze=new Date(_e.event_date),[Ee,Je]=_e.event_time.split(":");ze.setHours(parseInt(Ee),parseInt(Je));const at=[new Date(ze)];if(_e.is_recurring&&_e.recurrence_end_date){let wt=new Date(ze);for(;_e.recurrence_pattern==="weekly"?wt=Yw(wt,1):_e.recurrence_pattern==="biweekly"?wt=Yw(wt,2):wt=Mh(wt,1),!(wt>_e.recurrence_end_date);)at.push(new Date(wt))}const pt=at.map(wt=>({title:_e.title,description:_e.description||null,image_url:st||null,video_url:_e.video_url||null,event_date:wt.toISOString(),zoom_link:_e.zoom_link,zoom_meeting_id:_e.zoom_meeting_id||null,capacity:_e.capacity?parseInt(_e.capacity):null,is_published:_e.is_published})),{data:gt,error:Mt}=await Q.from("events").insert(pt).select();if(Mt)throw Mt;return gt&>.length>0&&mkt(_e.title,gt[0].id),at.length},onSuccess:_e=>{e.invalidateQueries({queryKey:["admin-events"]}),Oe.success(_e>1?`${_e} recurring events created successfully`:"Event created successfully"),s(!1),i(tO),p(null),y(null),w(!1)},onError:_e=>{Oe.error("Failed to create event: "+_e.message),w(!1)}}),Qe=or({mutationFn:async({id:_e,data:st})=>{w(!0);let ze=st.image_url;u&&(ze=await Be(u)||"");const Ee=new Date(st.event_date),[Je,at]=st.event_time.split(":");Ee.setHours(parseInt(Je),parseInt(at));const{error:pt}=await Q.from("events").update({title:st.title,description:st.description||null,image_url:ze||null,video_url:st.video_url||null,event_date:Ee.toISOString(),zoom_link:st.zoom_link,zoom_meeting_id:st.zoom_meeting_id||null,capacity:st.capacity?parseInt(st.capacity):null,is_published:st.is_published}).eq("id",_e);if(pt)throw pt},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),Oe.success("Event updated successfully"),s(!1),o(null),i(tO),p(null),y(null),w(!1)},onError:_e=>{Oe.error("Failed to update event: "+_e.message),w(!1)}}),le=or({mutationFn:async _e=>{const{error:st}=await Q.from("events").delete().eq("id",_e);if(st)throw st},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),Oe.success("Event deleted successfully")},onError:_e=>{Oe.error("Failed to delete event: "+_e.message)}}),Ve=_e=>{var ze;const st=new Date(_e.event_date);o(_e),i({title:_e.title,description:_e.description||"",image_url:_e.image_url||"",video_url:_e.video_url||"",event_date:st,event_time:mn(st,"HH:mm"),zoom_link:_e.zoom_link,zoom_meeting_id:_e.zoom_meeting_id||"",capacity:((ze=_e.capacity)==null?void 0:ze.toString())||"",is_published:_e.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(_e.image_url||null),p(null),s(!0)},Le=_e=>{if(_e.preventDefault(),!l.event_date){Oe.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){Oe.error("Please select an end date for recurring events");return}a?Qe.mutate({id:a.id,data:l}):Me.mutate(l)},We=()=>{s(!1),o(null),i(tO),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(te,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:r.jsx(io,{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(Ke,{className:"mb-6",children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"All Events"}),r.jsxs(Dr,{open:n,onOpenChange:_e=>!_e&&We(),children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Or,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:a?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:Le,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:l.title,onChange:_e=>i({...l,title:_e.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:l.description,onChange:_e=>i({...l,description:_e}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Event Image"}),r.jsx("input",{type:"file",ref:S,accept:"image/*",onChange:Ye,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(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:ht,children:r.jsx(gs,{className:"h-4 w-4"})})]}):r.jsxs(te,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var _e;return(_e=S.current)==null?void 0:_e.click()},children:[r.jsx(ho,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Date *"}),r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),l.event_date?mn(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:l.event_date,onSelect:_e=>i({...l,event_date:_e}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"time",children:"Time *"}),r.jsx(ot,{id:"time",type:"time",value:l.event_time,onChange:_e=>i({...l,event_time:_e.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(ot,{id:"zoom_link",value:l.zoom_link,onChange:_e=>i({...l,zoom_link:_e.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(ot,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:_e=>i({...l,zoom_meeting_id:_e.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(ot,{id:"video_url",value:l.video_url,onChange:_e=>i({...l,video_url:_e.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(ot,{id:"capacity",type:"number",value:l.capacity,onChange:_e=>i({...l,capacity:_e.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(aA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(qe,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(Ss,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:_e=>i({...l,is_recurring:_e})})]}),l.is_recurring&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Frequency"}),r.jsxs(xn,{value:l.recurrence_pattern,onValueChange:_e=>i({...l,recurrence_pattern:_e}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(qe,{children:"Repeat Until"}),r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?mn(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:l.recurrence_end_date,onSelect:_e=>i({...l,recurrence_end_date:_e}),disabled:_e=>_e<(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 _e=1,st=new Date(l.event_date);for(;st=l.recurrence_pattern==="weekly"?Yw(st,1):l.recurrence_pattern==="biweekly"?Yw(st,2):Mh(st,1),!(st>l.recurrence_end_date);)_e++;return _e})()," events with the same Zoom link"]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{htmlFor:"is_published",children:"Published"}),r.jsx(Ss,{id:"is_published",checked:l.is_published,onCheckedChange:_e=>i({...l,is_published:_e})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:We,className:"flex-1",children:"Cancel"}),r.jsx(te,{type:"submit",className:"flex-1",disabled:Me.isPending||Qe.isPending||_,children:_?"Uploading...":a?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),r.jsx(et,{children:ie?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(xe==null?void 0:xe.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(Mr,{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:xe==null?void 0:xe.map(_e=>r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:_e.title}),r.jsx(jt,{children:mn(new Date(_e.event_date),"PPP p")}),r.jsx(jt,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ce(_e),children:[r.jsx(Bn,{className:"h-4 w-4"}),(pe==null?void 0:pe[_e.id])||0,_e.capacity&&` / ${_e.capacity}`]})}),r.jsx(jt,{children:r.jsx("span",{className:zt("px-2 py-1 rounded-full text-xs font-medium",_e.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:_e.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(_e.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Os,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Ve(_e),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&le.mutate(_e.id)},children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},_e.id))})]})})]}),r.jsx(Dr,{open:N,onOpenChange:M,children:r.jsxs(Or,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),E==null?void 0:E.title]}),r.jsx(Jn,{children:"View registrations and attendees for this event"})]}),r.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>be.mutate({eventId:E.id,testMode:!0}),disabled:be.isPending,children:[r.jsx(ws,{className:zt("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>be.mutate({eventId:E.id}),disabled:be.isPending||!(se!=null&&se.length),children:[r.jsx(ws,{className:zt("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),be.isPending?"Sending...":"Send Reminder to All"]}),(E==null?void 0:E.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Se.mutate(E.id),disabled:Se.isPending,children:[r.jsx(Ll,{className:zt("h-4 w-4 mr-2",Se.isPending&&"animate-spin")}),Se.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(te,{variant:"default",size:"sm",onClick:()=>Ne.mutate(E.id),disabled:Ne.isPending,children:[r.jsx(Yi,{className:zt("h-4 w-4 mr-2",Ne.isPending&&"animate-spin")}),Ne.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(ki,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(pi,{className:"grid w-full grid-cols-2",children:[r.jsxs(rn,{value:"registrations",className:"gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Registrations (",(se==null?void 0:se.length)||0,")"]}),r.jsxs(rn,{value:"attendees",className:"gap-2",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Attendees (",(he==null?void 0:he.length)||0,")"]})]}),r.jsx(Sn,{value:"registrations",className:"mt-4",children:fe?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(Mr,{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(_e=>{var Je,at;const st=((Je=_e.profiles)==null?void 0:Je.name)||_e.zoom_name||"Unknown",ze=((at=_e.profiles)==null?void 0:at.email)||_e.zoom_email||null,Ee=!_e.user_id;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[st,Ee&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(jt,{children:ze?r.jsxs("a",{href:`mailto:${ze}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ws,{className:"h-3 w-3"}),ze]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(jt,{className:"text-muted-foreground text-sm",children:mn(new Date(_e.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(jt,{children:_e.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"})})]},_e.id)})})]})}),r.jsx(Sn,{value:"attendees",className:"mt-4",children:ye?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(he==null?void 0:he.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:[(he==null?void 0:he.filter(_e=>!_e.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(pl,{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 (",he==null?void 0:he.filter(_e=>!_e.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:he==null?void 0:he.filter(_e=>!_e.user_id).map(_e=>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:_e.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:_e.zoom_email||"No email"})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Pe(_e),className:"gap-1",children:[r.jsx(df,{className:"h-3 w-3"}),"Link to Profile"]})]},_e.id))})]}),r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:he==null?void 0:he.filter(_e=>_e.user_id).map(_e=>{var Ee,Je;const st=((Ee=_e.profiles)==null?void 0:Ee.name)||_e.zoom_name||"Unknown",ze=((Je=_e.profiles)==null?void 0:Je.email)||_e.zoom_email||null;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[st,_e.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(jt,{children:ze?r.jsxs("a",{href:`mailto:${ze}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ws,{className:"h-3 w-3"}),ze]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(jt,{children:_e.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Wa,{className:"h-3 w-3"}),_e.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(jt,{children:_e.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(Yi,{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"})})]},_e.id)})})]})]})})]})]})}),r.jsx(Dr,{open:P,onOpenChange:z,children:r.jsxs(Or,{className:"max-w-md",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(df,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Jn,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),R&&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:R.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:R.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:ae,onChange:_e=>oe(_e.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Re.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:Re.slice(0,20).map(_e=>r.jsxs("button",{type:"button",onClick:()=>K(_e.id),className:zt("w-full p-3 text-left hover:bg-muted/50 transition-colors",V===_e.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:_e.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:_e.email})]},_e.id))})}),R.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Fl,{id:"save-alias",checked:W,onCheckedChange:_e=>J(_e)}),r.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),r.jsx(te,{onClick:Ue,disabled:!V||Te.isPending,children:Te.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const ykt=()=>{const{user:t}=Qr(),{toast:e}=mi(),n=qr(),[s,a]=rd(),[o,l]=I.useState(!1),[i,u]=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),[w,S]=I.useState(0),[N,M]=I.useState(!1),[E,A]=I.useState(null),[P,z]=I.useState(""),[R,U]=I.useState(""),[V,K]=I.useState(""),[W,J]=I.useState(!1),[ae,oe]=I.useState(!1),{data:xe=[]}=Kt({queryKey:["template-categories"],queryFn:async()=>{const{data:Qe,error:le}=await Q.from("template_categories").select("*").order("name");if(le)throw le;return Qe}}),{data:ie=[]}=Kt({queryKey:["template-types"],queryFn:async()=>{const{data:Qe,error:le}=await Q.from("template_types").select("*").order("name");if(le)throw le;return Qe}}),{data:pe=[],isLoading:se}=Kt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Qe,error:le}=await Q.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(le)throw le;const{data:Ve,error:Le}=await Q.from("template_links").select("*").order("sort_order");if(Le)throw Le;const{data:We,error:_e}=await Q.from("template_guides").select("*").order("sort_order");if(_e)throw _e;return Qe.map(ze=>({...ze,links:(Ve==null?void 0:Ve.filter(Ee=>Ee.template_id===ze.id))||[],guides:(We==null?void 0:We.filter(Ee=>Ee.template_id===ze.id))||[]}))}});I.useEffect(()=>{const Qe=s.get("edit");if(Qe&&pe.length>0){const le=pe.find(Ve=>Ve.id===Qe);le&&(Ne(le),a({},{replace:!0}))}},[pe,s]);const fe=or({mutationFn:async Qe=>{const{data:le,error:Ve}=await Q.from("template_categories").insert({name:Qe}).select().single();if(Ve)throw Ve;return le},onSuccess:Qe=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...p,category_id:Qe.id}),U(""),J(!1),e({title:"Category added"})},onError:Qe=>{e({title:"Error adding category",description:Qe.message,variant:"destructive"})}}),he=or({mutationFn:async Qe=>{const{data:le,error:Ve}=await Q.from("template_types").insert({name:Qe}).select().single();if(Ve)throw Ve;return le},onSuccess:Qe=>{n.invalidateQueries({queryKey:["template-types"]}),x({...p,type_id:Qe.id}),K(""),oe(!1),e({title:"Type added"})},onError:Qe=>{e({title:"Error adding type",description:Qe.message,variant:"destructive"})}}),ye=or({mutationFn:async Qe=>{var _e;let le=Qe.existingImageUrl;if(Qe.image){const st=Qe.image.name.split(".").pop(),ze=`${Date.now()}-${Math.random().toString(36).substring(7)}.${st}`,{error:Ee}=await Q.storage.from("template-previews").upload(ze,Qe.image);if(Ee)throw Ee;const{data:Je}=Q.storage.from("template-previews").getPublicUrl(ze);le=Je.publicUrl}const Ve={name:Qe.template.name,description:Qe.template.description||null,category_id:Qe.template.category_id||null,type_id:Qe.template.type_id||null,preview_image_url:le,video_url:Qe.videoUrl||null,publish_date:Qe.template.publish_date?new Date(Qe.template.publish_date).toISOString():new Date().toISOString(),created_by:t==null?void 0:t.id};let Le=Qe.templateId;if(Le){const{error:st}=await Q.from("canva_templates").update(Ve).eq("id",Le);if(st)throw st;const{error:ze}=await Q.from("template_links").delete().eq("template_id",Le);if(ze)throw ze;const Ee=((_e=Qe.existingGuides)==null?void 0:_e.map(pt=>pt.id).filter(Boolean))||[],Je=Qe.template.guides.map(pt=>pt.id).filter(Boolean),at=Ee.filter(pt=>!Je.includes(pt));at.length>0&&await Q.from("template_guides").delete().in("id",at)}else{const{data:st,error:ze}=await Q.from("canva_templates").insert(Ve).select().single();if(ze)throw ze;Le=st.id,fkt(Qe.template.name,st.id)}const We=Qe.template.links.filter(st=>st.title.trim()&&st.canva_share_link.trim());if(We.length>0){const st=We.map((Ee,Je)=>({template_id:Le,title:Ee.title.trim(),canva_share_link:Ee.canva_share_link.trim(),sort_order:Je})),{error:ze}=await Q.from("template_links").insert(st);if(ze)throw ze}for(let st=0;st{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),Se(),l(!1),e({title:i?"Template updated":"Template created"})},onError:Qe=>{e({title:"Error saving template",description:Qe.message,variant:"destructive"})}}),Ce=or({mutationFn:async Qe=>{const{error:le}=await Q.from("canva_templates").delete().eq("id",Qe);if(le)throw le},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),e({title:"Template deleted"})},onError:Qe=>{e({title:"Error deleting template",description:Qe.message,variant:"destructive"})}}),Se=()=>{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:""}),A(null),z(""),u(null),J(!1),oe(!1),U(""),K(""),_(null),S(0),M(!1)},Ne=Qe=>{var le;u(Qe),x({name:Qe.name,description:Qe.description||"",category_id:Qe.category_id||"",type_id:Qe.type_id||"",publish_date:Qe.publish_date?new Date(Qe.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Qe.links&&Qe.links.length>0?Qe.links.map(Ve=>({id:Ve.id,title:Ve.title,canva_share_link:Ve.canva_share_link,sort_order:Ve.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((le=Qe.guides)==null?void 0:le.map(Ve=>({id:Ve.id,name:Ve.name,file_url:Ve.file_url,file_type:Ve.file_type,file_size:Ve.file_size,sort_order:Ve.sort_order})))||[],video_url:Qe.video_url||""}),z(Qe.preview_image_url||""),_(null),l(!0)},be=Qe=>{var Ve;const le=(Ve=Qe.target.files)==null?void 0:Ve[0];le&&(A(le),z(URL.createObjectURL(le)))},rt=()=>{x({...p,links:[...p.links,{title:"",canva_share_link:"",sort_order:p.links.length}]})},Te=Qe=>{if(p.links.length<=1)return;const le=p.links.filter((Ve,Le)=>Le!==Qe);x({...p,links:le})},Pe=(Qe,le,Ve)=>{const Le=[...p.links];Le[Qe]={...Le[Qe],[le]:Ve},x({...p,links:Le})},Ue=Qe=>{const le=Qe.target.files;if(!le)return;const Ve=Array.from(le).map((Le,We)=>({name:Le.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:Le.type,file_size:Le.size,sort_order:p.guides.length+We,file:Le}));x({...p,guides:[...p.guides,...Ve]}),Qe.target.value=""},Re=Qe=>{const le=p.guides.filter((Ve,Le)=>Le!==Qe);x({...p,guides:le})},Be=(Qe,le)=>{const Ve=[...p.guides];Ve[Qe]={...Ve[Qe],name:le},x({...p,guides:Ve})},Ye=async()=>{if(!y)return null;M(!0),S(0);try{const{data:Qe,error:le}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:p.name||y.name}});if(le)throw new Error(le.message);const{videoId:Ve,libraryId:Le}=Qe,{data:We,error:_e}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ve}});if(_e)throw new Error(_e.message);const st=new XMLHttpRequest;return await new Promise((Ee,Je)=>{st.upload.addEventListener("progress",at=>{if(at.lengthComputable){const pt=Math.round(at.loaded/at.total*100);S(pt)}}),st.addEventListener("load",()=>{st.status>=200&&st.status<300?Ee():Je(new Error(`Upload failed with status ${st.status}`))}),st.addEventListener("error",()=>Je(new Error("Upload failed"))),st.open("PUT",We.uploadUrl),st.setRequestHeader("AccessKey",We.apiKey),st.send(y)}),`https://player.mediadelivery.net/embed/${Le}/${Ve}`}catch(Qe){return console.error("Bunny upload error:",Qe),e({title:"Video upload failed",description:Qe instanceof Error?Qe.message:"Unknown error",variant:"destructive"}),null}finally{M(!1)}},ht=Qe=>{var Ve;const le=(Ve=Qe.target.files)==null?void 0:Ve[0];le&&_(le),Qe.target.value=""},Me=async Qe=>{if(Qe.preventDefault(),!p.name.trim()){e({title:"Please enter a template name",variant:"destructive"});return}if(p.links.filter(Le=>Le.title.trim()&&Le.canva_share_link.trim()).length===0){e({title:"Please add at least one Canva link",variant:"destructive"});return}let Ve=p.video_url;if(y){const Le=await Ye();if(!Le)return;Ve=Le}ye.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:Ve})};return r.jsx(Lr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:pe.length})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:xe.length})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.length})})]})]}),r.jsxs(Dr,{open:o,onOpenChange:Qe=>{l(Qe),Qe||Se()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:i?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Me,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Name *"}),r.jsx(ot,{id:"name",value:p.name,onChange:Qe=>x({...p,name:Qe.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:p.description,onChange:Qe=>x({...p,description:Qe}),placeholder:"Brief description of the template",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{children:"Canva Links *"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:rt,className:"gap-1",children:[r.jsx(_n,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:p.links.map((Qe,le)=>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(ot,{value:Qe.title,onChange:Ve=>Pe(le,"title",Ve.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(ot,{value:Qe.canva_share_link,onChange:Ve=>Pe(le,"canva_share_link",Ve.target.value),placeholder:"https://www.canva.com/design/..."})]}),p.links.length>1&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Te(le),children:r.jsx(gs,{className:"h-4 w-4"})})]},le))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Category"}),W?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:R,onChange:Qe=>U(Qe.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>R.trim()&&fe.mutate(R.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{J(!1),U("")},children:r.jsx(gs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(xn,{value:p.category_id,onValueChange:Qe=>x({...p,category_id:Qe}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(vn,{placeholder:"Select category"})}),r.jsx(pn,{children:xe.map(Qe=>r.jsx(qt,{value:Qe.id,children:Qe.name},Qe.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>J(!0),children:r.jsx(_n,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Template Type"}),ae?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:V,onChange:Qe=>K(Qe.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>V.trim()&&he.mutate(V.trim()),disabled:he.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{oe(!1),K("")},children:r.jsx(gs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(xn,{value:p.type_id,onValueChange:Qe=>x({...p,type_id:Qe}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(vn,{placeholder:"Select type"})}),r.jsx(pn,{children:ie.map(Qe=>r.jsx(qt,{value:Qe.id,children:Qe.name},Qe.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>oe(!0),children:r.jsx(_n,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:p.publish_date,onChange:Qe=>x({...p,publish_date:Qe.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[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(te,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{A(null),z("")},children:r.jsx(gs,{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(Ol,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(ot,{type:"file",accept:"image/*",onChange:be,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{children:"Video (Optional)"}),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(Da,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>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(Yr,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",w,"%"]})]}),r.jsx(Jc,{value:w,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Da,{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(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>_(null),children:r.jsx(gs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(ot,{type:"file",accept:"video/*",onChange:ht,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(Da,{className:"h-8 w-8 text-muted-foreground/50"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(ot,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ue,className:"hidden"}),r.jsx(te,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(ho,{className:"h-3 w-3"}),"Add Files"]})})]})]}),p.guides.length>0?r.jsx("div",{className:"space-y-2",children:p.guides.map((Qe,le)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(ka,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(ot,{value:Qe.name,onChange:Ve=>Be(le,Ve.target.value),placeholder:"Guide name",className:"flex-1"}),Qe.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Qe.file_size/1024).toFixed(0)," KB"]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Re(le),children:r.jsx(gs,{className:"h-4 w-4"})})]},Qe.id||le))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>{l(!1),Se()},children:"Cancel"}),r.jsx(te,{type:"submit",disabled:ye.isPending,children:ye.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ke,{children:r.jsx(et,{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(Mr,{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(Qe=>{var le,Ve,Le,We,_e;return r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Qe.preview_image_url?r.jsx("img",{src:Qe.preview_image_url,alt:Qe.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Ol,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(jt,{className:"font-medium",children:Qe.name}),r.jsx(jt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Lt,{variant:"secondary",children:[((le=Qe.links)==null?void 0:le.length)||0," link",(((Ve=Qe.links)==null?void 0:Ve.length)||0)!==1?"s":""]}),(((Le=Qe.guides)==null?void 0:Le.length)||0)>0&&r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[r.jsx(ka,{className:"h-3 w-3"}),(We=Qe.guides)==null?void 0:We.length," guide",(((_e=Qe.guides)==null?void 0:_e.length)||0)!==1?"s":""]})]})}),r.jsx(jt,{children:Qe.category?r.jsx(Lt,{variant:"secondary",children:Qe.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(jt,{children:Qe.type?r.jsx(Lt,{variant:"outline",children:Qe.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(jt,{className:"text-muted-foreground",children:new Date(Qe.publish_date).toLocaleDateString()}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{size:"icon",variant:"ghost",onClick:()=>Ne(Qe),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ce.mutate(Qe.id)},children:r.jsx($n,{className:"h-4 w-4"})})]})})]},Qe.id)})})]})})})]})})};function k7e({selectedTemplateIds:t,onChange:e}){const[n,s]=I.useState(""),[a,o]=I.useState(!1),{data:l=[]}=Kt({queryKey:["all-canva-templates-picker"],queryFn:async()=>{const{data:y,error:_}=await Q.from("canva_templates").select("id, name, preview_image_url").order("name");if(_)throw _;return y}}),i=l.filter(y=>t.includes(y.id)),u=l.filter(y=>!t.includes(y.id)&&y.name.toLowerCase().includes(n.toLowerCase())),p=y=>{e([...t,y])},x=y=>{e(t.filter(_=>_!==y))};return r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{className:"flex items-center gap-2",children:[r.jsx(Cj,{className:"h-4 w-4"}),"Linked Templates"]}),i.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(y=>r.jsxs(Lt,{variant:"secondary",className:"gap-1 pr-1",children:[y.name,r.jsx("button",{type:"button",onClick:()=>x(y.id),className:"ml-1 rounded-full hover:bg-muted-foreground/20 p-0.5",children:r.jsx(gs,{className:"h-3 w-3"})})]},y.id))}),r.jsxs(Cd,{open:a,onOpenChange:o,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"gap-1",children:[r.jsx(Cj,{className:"h-3.5 w-3.5"}),"Add Template"]})}),r.jsxs(ed,{className:"w-80 p-2",align:"start",children:[r.jsxs("div",{className:"relative mb-2",children:[r.jsx(ya,{className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search templates...",value:n,onChange:y=>s(y.target.value),className:"pl-7 h-8 text-sm"})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto space-y-0.5",children:u.length===0?r.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:n?"No templates found":"All templates selected"}):u.map(y=>r.jsxs("button",{type:"button",onClick:()=>{p(y.id),s("")},className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[y.preview_image_url?r.jsx("img",{src:y.preview_image_url,alt:"",className:"w-8 h-8 rounded object-cover flex-shrink-0"}):r.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center flex-shrink-0",children:r.jsx(Cj,{className:"h-3.5 w-3.5 text-muted-foreground"})}),r.jsx("span",{className:"truncate",children:y.name})]},y.id))})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Link templates that agents can use alongside this content."})]})}const vkt=[{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"}],_kt=()=>{const{user:t}=Qr(),[e,n]=rd(),{toast:s}=mi(),a=qr(),[o,l]=I.useState(!1),[i,u]=I.useState(null),[p,x]=I.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[y,_]=I.useState(null),[w,S]=I.useState(""),[N,M]=I.useState([]),[E,A]=I.useState([]),[P,z]=I.useState([]),[R,U]=I.useState([]),[V,K]=I.useState(""),[W,J]=I.useState(!1),[ae,oe]=I.useState(null),[xe,ie]=I.useState(0),[pe,se]=I.useState(!1),[fe,he]=I.useState(null),{data:ye=[]}=Kt({queryKey:["academy-categories"],queryFn:async()=>{const{data:le,error:Ve}=await Q.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(Ve)throw Ve;return le}}),{data:Ce=[],isLoading:Se}=Kt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:le,error:Ve}=await Q.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(Ve)throw Ve;const{data:Le,error:We}=await Q.from("academy_resources").select("*").order("sort_order");if(We)throw We;return le.map(st=>({...st,resources:(Le==null?void 0:Le.filter(ze=>ze.video_id===st.id))||[]}))}});I.useEffect(()=>{const le=e.get("edit");if(le&&Ce.length>0){const Ve=Ce.find(Le=>Le.id===le);Ve&&(Ue(Ve),n({},{replace:!0}))}},[Ce,e]);const Ne=or({mutationFn:async le=>{const{data:Ve,error:Le}=await Q.from("academy_categories").insert({name:le,sort_order:ye.length}).select().single();if(Le)throw Le;return Ve},onSuccess:le=>{a.invalidateQueries({queryKey:["academy-categories"]}),x({...p,category_id:le.id}),K(""),J(!1),s({title:"Category added"})},onError:le=>{s({title:"Error adding category",description:le.message,variant:"destructive"})}}),be=or({mutationFn:async le=>{let Ve=le.existingThumbnailUrl;if(le.thumbnail){const _e=le.thumbnail.name.split(".").pop(),st=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${_e}`,{error:ze}=await Q.storage.from("academy-resources").upload(st,le.thumbnail);if(ze)throw ze;const{data:Ee}=Q.storage.from("academy-resources").getPublicUrl(st);Ve=Ee.publicUrl}const Le={title:le.video.title,description:le.video.description||null,video_url:le.video.video_url,video_type:le.video.video_type,duration:le.video.duration||null,thumbnail_url:Ve,category_id:le.video.category_id||null,publish_date:le.video.publish_date?new Date(le.video.publish_date).toISOString():new Date().toISOString(),is_published:le.video.is_published,created_by:t==null?void 0:t.id};let We=le.videoId;if(We){const{error:_e}=await Q.from("academy_videos").update(Le).eq("id",We);if(_e)throw _e}else{const{data:_e,error:st}=await Q.from("academy_videos").insert(Le).select().single();if(st)throw st;We=_e.id,pkt(le.video.title,_e.id)}if(le.resourcesToDelete.length>0){const{error:_e}=await Q.from("academy_resources").delete().in("id",le.resourcesToDelete);if(_e)throw _e}for(let _e=0;_e0){const{error:_e}=await Q.from("academy_video_templates").insert(R.map(st=>({video_id:We,template_id:st})));if(_e)throw _e}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),Pe(),l(!1),s({title:i?"Video updated":"Video created"})},onError:le=>{s({title:"Error saving video",description:le.message,variant:"destructive"})}}),rt=or({mutationFn:async le=>{const{error:Ve}=await Q.from("academy_videos").delete().eq("id",le);if(Ve)throw Ve},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),s({title:"Video deleted"})},onError:le=>{s({title:"Error deleting video",description:le.message,variant:"destructive"})}}),Te=or({mutationFn:async({id:le,is_published:Ve})=>{const{error:Le}=await Q.from("academy_videos").update({is_published:Ve}).eq("id",le);if(Le)throw Le},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]})},onError:le=>{s({title:"Error updating video",description:le.message,variant:"destructive"})}}),Pe=()=>{x({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),_(null),S(""),M([]),A([]),z([]),u(null),U([]),K(""),oe(null),ie(0),se(!1),he(null)},Ue=async le=>{u(le),x({title:le.title,description:le.description||"",video_url:le.video_url,video_type:le.video_type,duration:le.duration||"",category_id:le.category_id||"",publish_date:le.publish_date?new Date(le.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:le.is_published}),S(le.thumbnail_url||""),A(le.resources||[]),M([]),z([]);const{data:Ve}=await Q.from("academy_video_templates").select("template_id").eq("video_id",le.id);U((Ve||[]).map(Le=>Le.template_id)),l(!0)},Re=le=>{var Le;const Ve=(Le=le.target.files)==null?void 0:Le[0];Ve&&(_(Ve),S(URL.createObjectURL(Ve)))},Be=le=>{const Ve=le.target.files;if(Ve){const Le=Array.from(Ve).map(We=>({file:We,title:We.name.replace(/\.[^/.]+$/,"")}));M([...N,...Le])}le.target.value=""},Ye=le=>{M(N.filter((Ve,Le)=>Le!==le))},ht=le=>{z([...P,le]),A(E.filter(Ve=>Ve.id!==le))},Me=async()=>{if(!ae)return null;se(!0),ie(0);try{const{data:le,error:Ve}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:p.title||ae.name}});if(Ve)throw new Error(Ve.message);const{videoId:Le,libraryId:We}=le;he(Le);const{data:_e,error:st}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Le}});if(st)throw new Error(st.message);const ze=new XMLHttpRequest;return await new Promise((Je,at)=>{ze.upload.addEventListener("progress",pt=>{if(pt.lengthComputable){const gt=Math.round(pt.loaded/pt.total*100);ie(gt)}}),ze.addEventListener("load",()=>{ze.status>=200&&ze.status<300?Je():at(new Error(`Upload failed with status ${ze.status}`))}),ze.addEventListener("error",()=>at(new Error("Upload failed"))),ze.open("PUT",_e.uploadUrl),ze.setRequestHeader("AccessKey",_e.apiKey),ze.send(ae)}),`https://player.mediadelivery.net/embed/${We}/${Le}`}catch(le){return console.error("Bunny upload error:",le),s({title:"Video upload failed",description:le instanceof Error?le.message:"Unknown error",variant:"destructive"}),null}finally{se(!1)}},Qe=async le=>{if(le.preventDefault(),!p.title.trim()){s({title:"Please enter a video title",variant:"destructive"});return}let Ve=p.video_url;if(p.video_type==="bunny_stream"&&ae&&!i){const Le=await Me();if(!Le)return;Ve=Le}else if(!p.video_url.trim()&&p.video_type!=="bunny_stream"){s({title:"Please enter a video URL",variant:"destructive"});return}else if(p.video_type==="bunny_stream"&&!ae&&!p.video_url&&!i){s({title:"Please select a video file to upload",variant:"destructive"});return}be.mutate({video:{...p,video_url:Ve},thumbnail:y,existingThumbnailUrl:(i==null?void 0:i.thumbnail_url)||null,videoId:i==null?void 0:i.id,newResources:N,resourcesToDelete:P})};return r.jsx(Lr,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:Ce.length})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:Ce.filter(le=>le.is_published).length})})]})]}),r.jsxs(Dr,{open:o,onOpenChange:le=>{l(le),le||Pe()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:i?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Qe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:p.title,onChange:le=>x({...p,title:le.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:p.description,onChange:le=>x({...p,description:le}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Video Type"}),r.jsxs(xn,{value:p.video_type,onValueChange:le=>{x({...p,video_type:le,video_url:""}),oe(null)},disabled:pe,children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:vkt.map(le=>r.jsx(qt,{value:le.value,children:le.label},le.value))})]})]}),p.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(qe,{children:["Upload Video File ",!i&&"*"]}),i&&p.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:p.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!i&&r.jsxs(r.Fragment,{children:[r.jsx(ot,{type:"file",accept:"video/*",onChange:le=>{var Le;const Ve=(Le=le.target.files)==null?void 0:Le[0];Ve&&oe(Ve)},disabled:pe}),ae&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Da,{className:"h-4 w-4"}),ae.name," (",(ae.size/(1024*1024)).toFixed(1)," MB)"]}),pe&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Jc,{value:xe,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[xe,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(ot,{id:"video_url",value:p.video_url,onChange:le=>x({...p,video_url:le.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"duration",children:"Duration"}),r.jsx(ot,{id:"duration",value:p.duration,onChange:le=>x({...p,duration:le.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:p.publish_date,onChange:le=>x({...p,publish_date:le.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Category"}),W?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:V,onChange:le=>K(le.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>V.trim()&&Ne.mutate(V.trim()),disabled:Ne.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{J(!1),K("")},children:r.jsx(gs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(xn,{value:p.category_id,onValueChange:le=>x({...p,category_id:le}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(vn,{placeholder:"Select category"})}),r.jsx(pn,{children:ye.map(le=>r.jsx(qt,{value:le.id,children:le.name},le.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:()=>J(!0),children:r.jsx(_n,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[w&&r.jsx("img",{src:w,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(ot,{type:"file",accept:"image/*",onChange:Re,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{children:"Resource Files"}),r.jsx(te,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(ho,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Be,className:"hidden"})]})})]}),(E.length>0||N.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[E.map(le=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:le.title}),r.jsx(Lt,{variant:"outline",className:"text-xs",children:le.file_type}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>ht(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(gs,{className:"h-4 w-4"})})]},le.id)),N.map((le,Ve)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:le.title,onChange:Le=>{const We=[...N];We[Ve].title=Le.target.value,M(We)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Lt,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ye(Ve),className:"text-destructive hover:text-destructive",children:r.jsx(gs,{className:"h-4 w-4"})})]},Ve))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsx(k7e,{selectedTemplateIds:R,onChange:U}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{id:"is_published",checked:p.is_published,onCheckedChange:le=>x({...p,is_published:le})}),r.jsx(qe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(Ws,{children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>l(!1),disabled:pe,children:"Cancel"}),r.jsx(te,{type:"submit",disabled:be.isPending||pe,children:pe?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):be.isPending?"Saving...":i?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:Se?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"})}):Ce.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Da,{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(Mr,{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:Ce.map(le=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[le.thumbnail_url?r.jsx("img",{src:le.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(Da,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:le.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:le.video_type.replace("_"," ")})]})]})}),r.jsx(jt,{children:le.category?r.jsx(Lt,{variant:"outline",children:le.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(jt,{children:le.duration||"-"}),r.jsx(jt,{children:le.resources&&le.resources.length>0?r.jsxs(Lt,{variant:"secondary",children:[le.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(jt,{children:new Date(le.publish_date).toLocaleDateString()}),r.jsx(jt,{children:r.jsx(Ss,{checked:le.is_published,onCheckedChange:Ve=>Te.mutate({id:le.id,is_published:Ve})})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ue(le),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>rt.mutate(le.id),className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})]})})]},le.id))})]})})})]})})};function bkt(){var be,rt,Te;const t=qr(),[e,n]=rd(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,u]=I.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,_]=I.useState(""),[w,S]=I.useState([]),[N,M]=I.useState([]),[E,A]=I.useState([]),[P,z]=I.useState(null),{data:R,isLoading:U}=Kt({queryKey:["resource-kits"],queryFn:async()=>{const{data:Pe,error:Ue}=await Q.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Ue)throw Ue;return Pe}}),{data:V}=Kt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Pe,error:Ue}=await Q.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return Pe}}),{data:K}=Kt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Pe,error:Ue}=await Q.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return Pe}});I.useEffect(()=>{const Pe=e.get("edit");if(Pe&&R&&R.length>0&&V&&K){const Ue=R.find(Re=>Re.id===Pe);Ue&&(J(Ue),n({},{replace:!0}))}},[R,V,K,e]);const W=()=>{u({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),S([]),M([]),A([]),l(null)},J=async Pe=>{l(Pe),u({name:Pe.name,description:Pe.description||"",publish_date:Pe.publish_date.split("T")[0],is_published:Pe.is_published}),_(Pe.featured_image_url||"");const Ue=(V==null?void 0:V.filter(Ye=>Ye.kit_id===Pe.id))||[];S(Ue.map(Ye=>({id:Ye.id,name:Ye.name,file_url:Ye.file_url,file_type:Ye.file_type,file_size:Ye.file_size,sort_order:Ye.sort_order})));const Re=(K==null?void 0:K.filter(Ye=>Ye.kit_id===Pe.id))||[];M(Re.map(Ye=>({id:Ye.id,title:Ye.title,canva_share_link:Ye.canva_share_link,sort_order:Ye.sort_order})));const{data:Be}=await Q.from("resource_kit_templates").select("template_id").eq("kit_id",Pe.id);A((Be||[]).map(Ye=>Ye.template_id)),a(!0)},ae=Pe=>{var Re;const Ue=(Re=Pe.target.files)==null?void 0:Re[0];Ue&&(x(Ue),_(URL.createObjectURL(Ue)))},oe=()=>{S([...w,{name:"",file_url:"",sort_order:w.length}])},xe=Pe=>{S(w.filter((Ue,Re)=>Re!==Pe))},ie=(Pe,Ue,Re)=>{const Be=[...w];Be[Pe]={...Be[Pe],[Ue]:Re},S(Be)},pe=()=>{M([...N,{title:"",canva_share_link:"",sort_order:N.length}])},se=Pe=>{M(N.filter((Ue,Re)=>Re!==Pe))},fe=(Pe,Ue,Re)=>{const Be=[...N];Be[Pe]={...Be[Pe],[Ue]:Re},M(Be)},he=(Pe,Ue)=>{var Be;const Re=(Be=Ue.target.files)==null?void 0:Be[0];if(Re){const Ye=[...w],ht=Re.name.replace(/\.[^/.]+$/,"");Ye[Pe]={...Ye[Pe],file:Re,file_type:Re.type,file_size:Re.size,name:Ye[Pe].name||ht},S(Ye)}},ye=or({mutationFn:async()=>{let Pe=(o==null?void 0:o.featured_image_url)||null;if(p){const ht=p.name.split(".").pop(),Me=`${Date.now()}.${ht}`,{error:Qe}=await Q.storage.from("resource-kits").upload(`featured/${Me}`,p);if(Qe)throw Qe;const{data:le}=Q.storage.from("resource-kits").getPublicUrl(`featured/${Me}`);Pe=le.publicUrl}const Ue={name:i.name,description:i.description||null,featured_image_url:Pe,publish_date:i.publish_date,is_published:i.is_published};let Re;const Be=!o,Ye=(o==null?void 0:o.is_published)||!1;if(o){const{error:ht}=await Q.from("resource_kits").update(Ue).eq("id",o.id);if(ht)throw ht;Re=o.id;const Me=(V==null?void 0:V.filter(_e=>_e.kit_id===o.id).map(_e=>_e.id))||[],Qe=w.filter(_e=>_e.id).map(_e=>_e.id),le=Me.filter(_e=>!Qe.includes(_e));le.length>0&&await Q.from("resource_kit_files").delete().in("id",le);const Ve=(K==null?void 0:K.filter(_e=>_e.kit_id===o.id).map(_e=>_e.id))||[],Le=N.filter(_e=>_e.id).map(_e=>_e.id),We=Ve.filter(_e=>!Le.includes(_e));We.length>0&&await Q.from("resource_kit_links").delete().in("id",We)}else{const{data:ht,error:Me}=await Q.from("resource_kits").insert(Ue).select().single();if(Me)throw Me;Re=ht.id}for(let ht=0;ht0){const{error:ht}=await Q.from("resource_kit_templates").insert(E.map(Me=>({kit_id:Re,template_id:Me})));if(ht)throw ht}return{kitId:Re,kitName:i.name,isNewKit:Be,wasPublished:Ye,isPublished:i.is_published}},onSuccess:Pe=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),t.invalidateQueries({queryKey:["resource-kit-links"]}),Oe.success(o?"Resource kit updated":"Resource kit created"),Pe.isPublished&&(Pe.isNewKit||!Pe.wasPublished)&&gkt(Pe.kitName,Pe.kitId),a(!1),W()},onError:Pe=>{Oe.error("Failed to save resource kit: "+Pe.message)}}),Ce=or({mutationFn:async Pe=>{const{error:Ue}=await Q.from("resource_kits").delete().eq("id",Pe);if(Ue)throw Ue},onSuccess:()=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),Oe.success("Resource kit deleted")},onError:Pe=>{Oe.error("Failed to delete: "+Pe.message)}}),Se=Pe=>{if(Pe.preventDefault(),!i.name){Oe.error("Please enter a name");return}ye.mutate()},Ne=Pe=>(V==null?void 0:V.filter(Ue=>Ue.kit_id===Pe).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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(R==null?void 0:R.length)||0})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(R==null?void 0:R.filter(Pe=>Pe.is_published).length)||0})})]})]}),r.jsxs(te,{onClick:()=>{W(),a(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:U?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(R==null?void 0:R.length)===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):R==null?void 0:R.map(Pe=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Pe.featured_image_url?r.jsx("img",{src:Pe.featured_image_url,alt:Pe.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($l,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Pe.name}),Pe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Pe.description})]})]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}),Ne(Pe.id)]})}),r.jsx(jt,{children:mn(new Date(Pe.publish_date),"MMM d, yyyy")}),r.jsx(jt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Pe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Pe.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{const Ue=(V==null?void 0:V.filter(Be=>Be.kit_id===Pe.id))||[],Re=(K==null?void 0:K.filter(Be=>Be.kit_id===Pe.id))||[];z({...Pe,files:Ue,links:Re})},children:r.jsx($o,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>J(Pe),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&Ce.mutate(Pe.id)},children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},Pe.id))})]})})}),r.jsx(Dr,{open:s,onOpenChange:a,children:r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:Se,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[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($l,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(ot,{type:"file",accept:"image/*",onChange:ae})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Name *"}),r.jsx(ot,{id:"name",value:i.name,onChange:Pe=>u({...i,name:Pe.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:i.description,onChange:Pe=>u({...i,description:Pe}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:i.publish_date,onChange:Pe=>u({...i,publish_date:Pe.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ss,{checked:i.is_published,onCheckedChange:Pe=>u({...i,is_published:Pe})}),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(qe,{children:"Resource Files"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:oe,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),w.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:w.map((Pe,Ue)=>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 ",Ue+1]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>xe(Ue),children:r.jsx(gs,{className:"h-4 w-4"})})]}),r.jsx(ot,{placeholder:"File name (e.g., Getting Started Guide)",value:Pe.name,onChange:Re=>ie(Ue,"name",Re.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ot,{type:"file",onChange:Re=>he(Ue,Re),className:"flex-1"}),Pe.file_url&&!Pe.file&&r.jsx("a",{href:Pe.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Pe.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Ue))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(qe,{children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:pe,children:[r.jsx(_n,{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((Pe,Ue)=>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 ",Ue+1]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>se(Ue),children:r.jsx(gs,{className:"h-4 w-4"})})]}),r.jsx(ot,{placeholder:"Link title (e.g., Social Media Post Template)",value:Pe.title,onChange:Re=>fe(Ue,"title",Re.target.value)}),r.jsx(ot,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Pe.canva_share_link,onChange:Re=>fe(Ue,"canva_share_link",Re.target.value)})]},Ue))})]}),r.jsx(k7e,{selectedTemplateIds:E,onChange:A}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:ye.isPending,children:ye.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Dr,{open:!!P,onOpenChange:()=>z(null),children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsx(Br,{children:r.jsx(zr,{children:P==null?void 0:P.name})}),r.jsxs("div",{className:"space-y-4",children:[(P==null?void 0:P.featured_image_url)&&r.jsx("img",{src:P.featured_image_url,alt:P.name,className:"w-full h-48 object-cover rounded-lg"}),(P==null?void 0:P.description)&&r.jsx("p",{className:"text-muted-foreground",children:P.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((be=P==null?void 0:P.files)==null?void 0:be.length)||0,")"]}),((rt=P==null?void 0:P.files)==null?void 0:rt.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:(Te=P==null?void 0:P.files)==null?void 0:Te.map(Pe=>r.jsxs("a",{href:Pe.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(ka,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Pe.name})]},Pe.id))})]}),(P==null?void 0:P.links)&&P.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",P.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:P.links.map(Pe=>r.jsxs("a",{href:Pe.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(Mo,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Pe.title})]},Pe.id))})]})]})]})})]})})}const wkt=()=>{const{user:t}=Qr(),{toast:e}=mi(),n=qr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,u]=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:w=[],isLoading:S}=Kt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:K,error:W}=await Q.from("social_swag").select("*").order("publish_date",{ascending:!1});if(W)throw W;const{data:J,error:ae}=await Q.from("social_swag_links").select("*").order("sort_order");if(ae)throw ae;return K.map(xe=>({...xe,links:(J==null?void 0:J.filter(ie=>ie.swag_id===xe.id))||[]}))}}),N=or({mutationFn:async K=>{let W=K.existingImageUrl;if(K.image){const pe=K.image.name.split(".").pop(),se=`${Date.now()}-${Math.random().toString(36).substring(7)}.${pe}`,{error:fe}=await Q.storage.from("template-previews").upload(se,K.image);if(fe)throw fe;const{data:he}=Q.storage.from("template-previews").getPublicUrl(se);W=he.publicUrl}const J={title:K.item.title,description:K.item.description||null,preview_image_url:W,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 ae=K.itemId;const oe=!ae,xe=(o==null?void 0:o.is_published)||!1;if(ae){const{error:pe}=await Q.from("social_swag").update(J).eq("id",ae);if(pe)throw pe;await Q.from("social_swag_links").delete().eq("swag_id",ae)}else{const{data:pe,error:se}=await Q.from("social_swag").insert(J).select().single();if(se)throw se;ae=pe.id}const ie=K.item.links.filter(pe=>pe.title.trim()&&pe.canva_share_link.trim());if(ie.length>0){const pe=ie.map((fe,he)=>({swag_id:ae,title:fe.title.trim(),canva_share_link:fe.canva_share_link.trim(),sort_order:he})),{error:se}=await Q.from("social_swag_links").insert(pe);if(se)throw se}return{itemId:ae,itemTitle:K.item.title,isNewItem:oe,wasPublished:xe,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)&&Efe(K.itemTitle,K.itemId),a(!1),E()},onError:K=>{e({title:"Error saving item",description:K.message,variant:"destructive"})}}),M=or({mutationFn:async K=>{const{error:W}=await Q.from("social_swag").delete().eq("id",K);if(W)throw W},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=()=>{u({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)},A=K=>{l(K),u({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(W=>({id:W.id,title:W.title,canva_share_link:W.canva_share_link,sort_order:W.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),_(K.preview_image_url||""),a(!0)},P=K=>{var J;const W=(J=K.target.files)==null?void 0:J[0];W&&(x(W),_(URL.createObjectURL(W)))},z=()=>{u({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},R=K=>{if(i.links.length<=1)return;const W=i.links.filter((J,ae)=>ae!==K);u({...i,links:W})},U=(K,W,J)=>{const ae=[...i.links];ae[K]={...ae[K],[W]:J},u({...i,links:ae})},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(ju,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:w.length})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:w.filter(K=>K.is_published).length})})]})]}),r.jsxs(Dr,{open:s,onOpenChange:K=>{a(K),K||E()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{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(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:i.title,onChange:K=>u({...i,title:K.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:i.description,onChange:K=>u({...i,description:K}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:i.publish_date,onChange:K=>u({...i,publish_date:K.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ss,{id:"is_published",checked:i.is_published,onCheckedChange:K=>u({...i,is_published:K})}),r.jsx(qe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Preview Image"}),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(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),_("")},children:r.jsx(gs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Ol,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(ot,{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(qe,{children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:z,children:[r.jsx(_n,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((K,W)=>r.jsx(Ke,{children:r.jsxs(et,{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 ",W+1]}),i.links.length>1&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>R(W),children:r.jsx(gs,{className:"h-3 w-3"})})]}),r.jsx(ot,{placeholder:"Link title (e.g., Instagram Post)",value:K.title,onChange:J=>U(W,"title",J.target.value)}),r.jsx(ot,{placeholder:"Canva share link",value:K.canva_share_link,onChange:J=>U(W,"canva_share_link",J.target.value)})]})},W))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:S?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"})}):w.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(Mr,{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:w.map(K=>{var W;return r.jsxs(Mr,{children:[r.jsx(jt,{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(Ol,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(jt,{className:"font-medium",children:K.title}),r.jsxs(jt,{children:[((W=K.links)==null?void 0:W.length)||0," links"]}),r.jsx(jt,{children:new Date(K.publish_date).toLocaleDateString()}),r.jsx(jt,{children:r.jsx(Lt,{variant:K.is_published?"default":"secondary",children:K.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${K.id}`,"_blank"),children:r.jsx($o,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>A(K),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&M.mutate(K.id)},children:r.jsx($n,{className:"h-4 w-4"})})]})})]},K.id)})})]})})})]})})},jkt=()=>{const t=qr(),[e,n]=I.useState("all"),[s,a]=I.useState(!1),[o,l]=I.useState(mn(new Date,"yyyy-MM")),[i,u]=I.useState([]),[p,x]=I.useState(!1),[y,_]=I.useState(null),[w,S]=I.useState(!1),[N,M]=I.useState(mn(new Date,"yyyy-MM")),[E,A]=I.useState(null),[P,z]=I.useState(""),[R,U]=I.useState(""),[V,K]=I.useState(""),[W,J]=I.useState(!1),{data:ae=[],isLoading:oe}=Kt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Ye,error:ht}=await Q.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(ht)throw ht;return Ye}}),{data:xe=[]}=Kt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Ye,error:ht}=await Q.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(ht)throw ht;return Ye}}),{data:ie=[]}=Kt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Ye,error:ht}=await Q.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(ht)throw ht;return Ye}}),pe=[...new Set(ae.map(Ye=>Ye.month))].sort((Ye,ht)=>ht.localeCompare(Ye)),se=e==="all"?ae:ae.filter(Ye=>Ye.month===e),fe=Ye=>{const ht=Lxe(Ye,"yyyy-MM",new Date);return mn(ht,"MMMM yyyy")},he=Ye=>{const Me=Array.from(Ye.target.files||[]).slice(0,16-i.length).map(Qe=>({file:Qe,preview:URL.createObjectURL(Qe),caption:""}));u(Qe=>[...Qe,...Me].slice(0,16))},ye=Ye=>{u(ht=>{const Me=[...ht];return URL.revokeObjectURL(Me[Ye].preview),Me.splice(Ye,1),Me})},Ce=(Ye,ht)=>{u(Me=>{const Qe=[...Me];return Qe[Ye]={...Qe[Ye],caption:ht},Qe})},Se=async()=>{if(i.length===0){Oe.error("Please add at least one image");return}if(i.filter(ht=>!ht.caption.trim()).length>0){Oe.error("Please add captions to all images");return}x(!0);try{for(let ht=0;ht{const ht=Ye.image_url.split("/social-swag-2/");ht[1]&&await Q.storage.from("social-swag-2").remove([ht[1]]);const{error:Me}=await Q.from("social_swag_2").delete().eq("id",Ye.id);if(Me)throw Me},onSuccess:()=>{Oe.success("Image deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{Oe.error("Failed to delete image")}}),be=or({mutationFn:async({month:Ye,link:ht})=>{const{error:Me}=await Q.from("social_swag_2_months").upsert({month:Ye,canva_link:ht||null},{onConflict:"month"});if(Me)throw Me},onSuccess:()=>{Oe.success("Canva link updated"),_(null),t.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{Oe.error("Failed to update Canva link")}}),rt=Ye=>{var ht;return((ht=xe.find(Me=>Me.month===Ye))==null?void 0:ht.canva_link)||""},Te=Ye=>ie.find(ht=>ht.month===Ye)||null,Pe=Ye=>{var Me;const ht=(Me=Ye.target.files)==null?void 0:Me[0];ht&&(A(ht),z(URL.createObjectURL(ht)))},Ue=()=>{P&&URL.revokeObjectURL(P),A(null),z(""),U(""),K("")},Re=async()=>{if(!E){Oe.error("Please select an image");return}J(!0);try{const Ye=E.name.split(".").pop(),ht=`reels/${N}-${Date.now()}.${Ye}`,{error:Me}=await Q.storage.from("social-swag-2").upload(ht,E);if(Me)throw Me;const{data:{publicUrl:Qe}}=Q.storage.from("social-swag-2").getPublicUrl(ht),{error:le}=await Q.from("social_swag_2_reels").upsert({month:N,image_url:Qe,canva_link:V||null,caption:R||null},{onConflict:"month"});if(le)throw le;Oe.success("Reel uploaded successfully!"),Efe(`${fe(N)} Reel`,"social-swag-2"),Ue(),S(!1),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Ye){console.error("Reel upload error:",Ye),Oe.error("Failed to upload reel")}finally{J(!1)}},Be=or({mutationFn:async Ye=>{const ht=Ye.image_url.split("/social-swag-2/");ht[1]&&await Q.storage.from("social-swag-2").remove([ht[1]]);const{error:Me}=await Q.from("social_swag_2_reels").delete().eq("id",Ye.id);if(Me)throw Me},onSuccess:()=>{Oe.success("Reel deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{Oe.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(Dr,{open:s,onOpenChange:a,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Or,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Month"}),r.jsx(ot,{type:"month",value:o,onChange:Ye=>l(Ye.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{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:he,className:"hidden",id:"swag-upload",disabled:i.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(ho,{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((Ye,ht)=>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:Ye.preview,alt:`Upload ${ht+1}`,className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>ye(ht),children:r.jsx(gs,{className:"h-3 w-3"})})]}),r.jsx(ss,{placeholder:"Caption...",value:Ye.caption,onChange:Me=>Ce(ht,Me.target.value),className:"text-xs h-20"})]},ht))}),r.jsx(te,{onClick:Se,disabled:p||i.length===0,className:"w-full gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ho,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),r.jsxs(Dr,{open:w,onOpenChange:Ye=>{S(Ye),Ye||Ue()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"gap-2",children:[r.jsx($d,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Or,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Month"}),r.jsx(ot,{type:"month",value:N,onChange:Ye=>M(Ye.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{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(te,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(P),A(null),z("")},children:r.jsx(gs,{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:Pe,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx($d,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Canva Download Link"}),r.jsx(ot,{value:V,onChange:Ye=>K(Ye.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Caption"}),r.jsx(ss,{value:R,onChange:Ye=>U(Ye.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(te,{onClick:Re,disabled:W||!E,className:"w-full gap-2",children:W?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ho,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ke,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ae.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(Ke,{children:r.jsxs(et,{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(ki,{value:e,onValueChange:n,children:r.jsxs(pi,{children:[r.jsx(rn,{value:"all",children:"All"}),pe.map(Ye=>r.jsx(rn,{value:Ye,children:fe(Ye)},Ye))]})}),e!=="all"&&r.jsx(Ke,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(qe,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",fe(e)]}),(y==null?void 0:y.month)===e?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(ot,{value:y.link,onChange:Ye=>_({...y,link:Ye.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(te,{size:"sm",onClick:()=>be.mutate(y),children:"Save"}),r.jsx(te,{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:rt(e)||"No link set"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>_({month:e,link:rt(e)}),children:"Edit"})]})]})]})})}),e!=="all"&&r.jsx(Ke,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx($d,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(qe,{className:"text-sm text-muted-foreground",children:["Reel for ",fe(e)]}),(()=>{const Ye=Te(e);return Ye?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Ye.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:Ye.caption||"No caption"}),Ye.canva_link&&r.jsx("a",{href:Ye.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(te,{variant:"destructive",size:"sm",onClick:()=>Be.mutate(Ye),children:r.jsx($n,{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(Ol,{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(Ye=>r.jsxs(Ke,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:Ye.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>Ne.mutate(Ye),children:r.jsx($n,{className:"h-4 w-4"})})]}),r.jsx(et,{className:"p-3",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:Ye.caption})})]},Ye.id))})]})})},kkt=()=>{const{toast:t}=mi(),e=qr(),[n,s]=I.useState("categories"),[a,o]=I.useState(!1),[l,i]=I.useState(null),[u,p]=I.useState({name:"",description:"",icon:""}),[x,y]=I.useState(!1),[_,w]=I.useState(null),[S,N]=I.useState({name:"",description:"",icon:""}),[M,E]=I.useState(!1),[A,P]=I.useState(null),[z,R]=I.useState(""),{data:U=[],isLoading:V}=Kt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Be,error:Ye}=await Q.from("community_categories").select("*").order("sort_order");if(Ye)throw Ye;return Be}}),{data:K=[],isLoading:W}=Kt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Be,error:Ye}=await Q.from("community_private_groups").select("*").order("sort_order");if(Ye)throw Ye;return Be}}),{data:J=[]}=Kt({queryKey:["admin-group-members",A==null?void 0:A.id],queryFn:async()=>{if(!A)return[];const{data:Be,error:Ye}=await Q.from("community_private_group_members").select("*").eq("group_id",A.id);if(Ye)throw Ye;return Be},enabled:!!A}),{data:ae=[]}=Kt({queryKey:["admin-all-profiles"],queryFn:async()=>{let Ye=[],ht=0,Me=!0;for(;Me;){const{data:Qe,error:le}=await Q.from("profiles").select("id, name, email, brokerage_id").order("name").range(ht,ht+1e3-1);if(le)throw le;Qe&&Qe.length>0?(Ye=[...Ye,...Qe],ht+=1e3,Me=Qe.length===1e3):Me=!1}return Ye}}),{data:oe=[]}=Kt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Be,error:Ye}=await Q.from("brokerages").select("*").order("name");if(Ye)throw Ye;return Be}}),xe=or({mutationFn:async Be=>{if(Be.id){const{error:Ye}=await Q.from("community_categories").update({name:Be.name,description:Be.description||null,icon:Be.icon||null}).eq("id",Be.id);if(Ye)throw Ye}else{const Ye=Math.max(...U.map(Me=>Me.sort_order),0),{error:ht}=await Q.from("community_categories").insert({name:Be.name,description:Be.description||null,icon:Be.icon||null,sort_order:Ye+1});if(ht)throw ht}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),p({name:"",description:"",icon:""}),t({title:l?"Category updated!":"Category created!"})},onError:Be=>{t({title:"Error",description:Be.message,variant:"destructive"})}}),ie=or({mutationFn:async Be=>{const{error:Ye}=await Q.from("community_categories").delete().eq("id",Be);if(Ye)throw Ye},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),t({title:"Category deleted"})}}),pe=or({mutationFn:async({id:Be,direction:Ye})=>{const ht=U.findIndex(Me=>Me.id===Be);if(Ye==="up"&&ht>0){const Me=U[ht-1],Qe=U[ht];await Q.from("community_categories").update({sort_order:Qe.sort_order}).eq("id",Me.id),await Q.from("community_categories").update({sort_order:Me.sort_order}).eq("id",Qe.id)}else if(Ye==="down"&&hte.invalidateQueries({queryKey:["admin-community-categories"]})}),se=or({mutationFn:async Be=>{if(Be.id){const{error:Ye}=await Q.from("community_private_groups").update({name:Be.name,description:Be.description||null,icon:Be.icon||null}).eq("id",Be.id);if(Ye)throw Ye}else{const Ye=Math.max(...K.map(Me=>Me.sort_order),0),{error:ht}=await Q.from("community_private_groups").insert({name:Be.name,description:Be.description||null,icon:Be.icon||null,sort_order:Ye+1});if(ht)throw ht}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),w(null),N({name:"",description:"",icon:""}),t({title:_?"Private group updated!":"Private group created!"})},onError:Be=>{t({title:"Error",description:Be.message,variant:"destructive"})}}),fe=or({mutationFn:async Be=>{const{error:Ye}=await Q.from("community_private_groups").delete().eq("id",Be);if(Ye)throw Ye},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),t({title:"Private group deleted"})}}),he=or({mutationFn:async({id:Be,direction:Ye})=>{const ht=K.findIndex(Me=>Me.id===Be);if(Ye==="up"&&ht>0){const Me=K[ht-1],Qe=K[ht];await Q.from("community_private_groups").update({sort_order:Qe.sort_order}).eq("id",Me.id),await Q.from("community_private_groups").update({sort_order:Me.sort_order}).eq("id",Qe.id)}else if(Ye==="down"&&hte.invalidateQueries({queryKey:["admin-private-groups"]})}),ye=or({mutationFn:async({groupId:Be,userId:Ye,isMember:ht})=>{if(ht){const{error:Me}=await Q.from("community_private_group_members").delete().eq("group_id",Be).eq("user_id",Ye);if(Me)throw Me}else{const{error:Me}=await Q.from("community_private_group_members").insert({group_id:Be,user_id:Ye});if(Me)throw Me}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",A==null?void 0:A.id]})}}),Ce=or({mutationFn:async({groupId:Be,brokerageId:Ye,isMember:ht})=>{if(ht){const{error:Me}=await Q.from("community_private_group_members").delete().eq("group_id",Be).eq("brokerage_id",Ye);if(Me)throw Me}else{const{error:Me}=await Q.from("community_private_group_members").insert({group_id:Be,brokerage_id:Ye});if(Me)throw Me}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",A==null?void 0:A.id]})}}),Se=Be=>{i(Be),p({name:Be.name,description:Be.description||"",icon:Be.icon||""}),o(!0)},Ne=()=>{i(null),p({name:"",description:"",icon:""}),o(!0)},be=Be=>{w(Be),N({name:Be.name,description:Be.description||"",icon:Be.icon||""}),y(!0)},rt=()=>{w(null),N({name:"",description:"",icon:""}),y(!0)},Te=Be=>{P(Be),R(""),E(!0)},Pe=Be=>J.some(Ye=>Ye.user_id===Be),Ue=Be=>J.some(Ye=>Ye.brokerage_id===Be),Re=ae.filter(Be=>Be.name.toLowerCase().includes(z.toLowerCase())||Be.email.toLowerCase().includes(z.toLowerCase()));return r.jsx(Lr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(ki,{value:n,onValueChange:s,children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"categories",children:"Public Categories"}),r.jsxs(rn,{value:"private-groups",children:[r.jsx(np,{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(te,{onClick:Ne,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):U.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):U.map((Be,Ye)=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ye===0,onClick:()=>pe.mutate({id:Be.id,direction:"up"}),children:"↑"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ye===U.length-1,onClick:()=>pe.mutate({id:Be.id,direction:"down"}),children:"↓"})]})}),r.jsx(jt,{className:"text-2xl",children:Be.icon||"📁"}),r.jsx(jt,{className:"font-medium",children:Be.name}),r.jsx(jt,{className:"text-muted-foreground",children:Be.description||"—"}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Se(Be),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ie.mutate(Be.id)},children:r.jsx($n,{className:"h-4 w-4"})})]})})]},Be.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(li,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(te,{onClick:rt,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:W?r.jsx(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):K.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):K.map((Be,Ye)=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ye===0,onClick:()=>he.mutate({id:Be.id,direction:"up"}),children:"↑"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ye===K.length-1,onClick:()=>he.mutate({id:Be.id,direction:"down"}),children:"↓"})]})}),r.jsx(jt,{className:"text-2xl",children:Be.icon||"🔒"}),r.jsx(jt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Be.name,Be.brokerage_id?r.jsxs(Lt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(li,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Lt,{variant:"secondary",className:"text-xs",children:[r.jsx(np,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(jt,{className:"text-muted-foreground",children:Be.description||"—"}),r.jsx(jt,{children:r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Te(Be),children:[r.jsx(Bn,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1",children:[!Be.brokerage_id&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>be(Be),children:r.jsx(ni,{className:"h-4 w-4"})}),!Be.brokerage_id&&r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&fe.mutate(Be.id)},children:r.jsx($n,{className:"h-4 w-4"})}),Be.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Be.id))})]})})})]})]}),r.jsx(Dr,{open:a,onOpenChange:o,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{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(ot,{value:u.icon,onChange:Be=>p(Ye=>({...Ye,icon:Be.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(ot,{value:u.name,onChange:Be=>p(Ye=>({...Ye,name:Be.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ss,{value:u.description,onChange:Be=>p(Ye=>({...Ye,description:Be.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{onClick:()=>xe.mutate({...u,id:l==null?void 0:l.id}),disabled:!u.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Dr,{open:x,onOpenChange:y,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{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(ot,{value:S.icon,onChange:Be=>N(Ye=>({...Ye,icon:Be.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(ot,{value:S.name,onChange:Be=>N(Ye=>({...Ye,name:Be.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(ss,{value:S.description,onChange:Be=>N(Ye=>({...Ye,description:Be.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(te,{onClick:()=>se.mutate({...S,id:_==null?void 0:_.id}),disabled:!S.name.trim(),children:_?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Dr,{open:M,onOpenChange:E,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsx(Br,{children:r.jsxs(zr,{children:["Manage Members: ",A==null?void 0:A.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ki,{defaultValue:"brokerages",children:[r.jsxs(pi,{className:"w-full",children:[r.jsx(rn,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(rn,{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(Ro,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[oe.map(Be=>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(Fl,{checked:Ue(Be.id),onCheckedChange:()=>{A&&Ce.mutate({groupId:A.id,brokerageId:Be.id,isMember:Ue(Be.id)})}}),r.jsx("span",{className:"font-medium",children:Be.name})]}),r.jsxs(Lt,{variant:"secondary",children:[ae.filter(Ye=>Ye.brokerage_id===Be.id).length," agents"]})]},Be.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search users...",value:z,onChange:Be=>R(Be.target.value),className:"pl-9"})]}),r.jsx(Ro,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Re.map(Be=>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(Fl,{checked:Pe(Be.id),onCheckedChange:()=>{A&&ye.mutate({groupId:A.id,userId:Be.id,isMember:Pe(Be.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Be.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Be.email})]})]})},Be.id)),Re.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(te,{onClick:()=>E(!1),children:"Done"})})]})]})})]})})},V4e=t=>{switch(t){case"academy_video":return r.jsx(Ul,{className:"h-3 w-3"});case"template":return r.jsx(ka,{className:"h-3 w-3"});case"toolbox":return r.jsx($l,{className:"h-3 w-3"});case"newsletter":return r.jsx(ny,{className:"h-3 w-3"});case"social_swag":return r.jsx(As,{className:"h-3 w-3"});default:return r.jsx(Os,{className:"h-3 w-3"})}},Nkt=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}},Skt=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}},Ckt=()=>{const{toast:t}=mi(),[e,n]=I.useState([]),[s,a]=I.useState([]),[o,l]=I.useState([]),[i,u]=I.useState(!0),[p,x]=I.useState(""),[y,_]=I.useState(null),[w,S]=I.useState([]),[N,M]=I.useState([]);I.useEffect(()=>{E()},[]);const E=async()=>{try{u(!0);const{data:R,error:U}=await Q.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(U)throw U;const{data:V,error:K}=await Q.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 W=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:J}=await Q.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",W),ae=new Map((J==null?void 0:J.map(se=>[se.id,se]))||[]),oe=(R==null?void 0:R.map(se=>{var fe,he,ye,Ce;return{id:se.id,user_id:se.user_id,app_name:se.app_name,launched_at:se.launched_at,user_name:((fe=se.profiles)==null?void 0:fe.name)||"Unknown",user_email:((he=se.profiles)==null?void 0:he.email)||"Unknown",brokerage_name:((Ce=(ye=se.profiles)==null?void 0:ye.brokerages)==null?void 0:Ce.name)||null}}))||[],xe=(V==null?void 0:V.map(se=>{var he;const fe=ae.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:(fe==null?void 0:fe.name)||"Unknown",user_email:(fe==null?void 0:fe.email)||"Unknown",brokerage_name:((he=fe==null?void 0:fe.brokerages)==null?void 0:he.name)||null}}))||[];n(oe),a(xe);const ie=new Map;oe.forEach(se=>{if(!ie.has(se.user_id))ie.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 fe=ie.get(se.user_id);fe.total_app_launches++,new Date(se.launched_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type="app",fe.last_activity_name=se.app_name,fe.last_activity_at=se.launched_at)}}),xe.forEach(se=>{if(!ie.has(se.user_id))ie.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 fe=ie.get(se.user_id);fe.total_content_views++,new Date(se.created_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type=se.resource_type,fe.last_activity_name=se.resource_title,fe.last_activity_at=se.created_at)}});const pe=Array.from(ie.values()).sort((se,fe)=>new Date(fe.last_activity_at).getTime()-new Date(se.last_activity_at).getTime());l(pe)}catch(R){console.error("Error loading activity:",R),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{u(!1)}},A=R=>{_({id:R.user_id,name:R.user_name,email:R.user_email});const U=e.filter(K=>K.user_id===R.user_id),V=s.filter(K=>K.user_id===R.user_id);S(U),M(V)},P=()=>{_(null),S([]),M([])},z=o.filter(R=>{var V;if(!p)return!0;const U=p.toLowerCase();return R.user_name.toLowerCase().includes(U)||R.user_email.toLowerCase().includes(U)||((V=R.brokerage_name)==null?void 0:V.toLowerCase().includes(U))});return i?r.jsx(Ke,{children:r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"User Activity"}),r.jsx(Cn,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(ya,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or brokerage...",value:p,onChange:R=>x(R.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):z.map(R=>r.jsxs(Mr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>A(R),children:[r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:R.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:R.user_email})]})}),r.jsx(jt,{children:R.brokerage_name?r.jsx(Lt,{variant:"outline",children:R.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(jt,{children:r.jsx("div",{className:"flex items-center gap-2",children:R.last_activity_type==="app"?r.jsxs(Lt,{variant:"secondary",children:[r.jsx(Os,{className:"h-3 w-3 mr-1"}),R.last_activity_name]}):r.jsxs(Lt,{variant:"outline",className:"flex items-center gap-1",children:[V4e(R.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:R.last_activity_name})]})})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:gu(new Date(R.last_activity_at),{addSuffix:!0})}),r.jsx(jt,{className:"text-right",children:r.jsx(Lt,{variant:"outline",children:R.total_app_launches})}),r.jsx(jt,{className:"text-right",children:r.jsx(Lt,{variant:"outline",children:R.total_content_views})})]},R.user_id))})]})})]})]}),r.jsx(Dr,{open:!!y,onOpenChange:R=>!R&&P(),children:r.jsxs(Or,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Jn,{children:y==null?void 0:y.email})]}),r.jsxs(ki,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(pi,{className:"grid w-full grid-cols-2",children:[r.jsxs(rn,{value:"content",children:["Content (",N.length,")"]}),r.jsxs(rn,{value:"apps",children:["App Launches (",w.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(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):N.map(R=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs(Lt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[V4e(R.resource_type),Nkt(R.resource_type)]})}),r.jsx(jt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:R.resource_title})}),r.jsx(jt,{children:r.jsx(Lt,{variant:"secondary",children:Skt(R.action_type)})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:gu(new Date(R.created_at),{addSuffix:!0})})]},R.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(Mr,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:w.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):w.map(R=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsx(Lt,{variant:"secondary",children:R.app_name})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:gu(new Date(R.launched_at),{addSuffix:!0})})]},R.id))})]})})})]})]})})]})},Mkt=()=>{const{toast:t}=mi(),[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 Q.from("profiles").select("*",{count:"exact",head:!0}),{count:i}=await Q.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),u=(l||0)-(i||0),{count:p}=await Q.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:_}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),w=new Date;w.setMonth(w.getMonth()-1);const{count:S}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",w.toISOString()),{data:N}=await Q.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),M=new Set(N==null?void 0:N.map(E=>E.user_id)).size;n({totalUsers:l||0,activeUsers:i||0,pendingUsers:u,totalBrokerages:p||0,totalLaunches:x||0,launchesThisWeek:_||0,launchesThisMonth:S||0,uniqueActiveThisWeek:M})}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(Ke,{children:r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{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(et,{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(Ke,{children:[r.jsxs(Ht,{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(Ii,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(Wa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(li,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(wg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(wg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(wg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(ap,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},H4e={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},W4e={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 N7e({brokerageOnly:t=!1,brokerageId:e}){const[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(""),[u,p]=I.useState("all");I.useEffect(()=>{x()},[e]);const x=async()=>{o(!0);try{let E=[];if(t&&e){const{data:W}=await Q.from("profiles").select("id").eq("brokerage_id",e);if(E=(W==null?void 0:W.map(J=>J.id))||[],E.length===0){s([]),o(!1);return}}let A=Q.from("resource_shares").select("*").order("created_at",{ascending:!1});t&&E.length>0&&(A=A.or(`sender_id.in.(${E.join(",")}),recipient_id.in.(${E.join(",")})`));const{data:P,error:z}=await A;if(z)throw z;const R=new Set;P==null||P.forEach(W=>{R.add(W.sender_id),R.add(W.recipient_id)});const{data:U}=await Q.from("profiles").select("id, name, email").in("id",Array.from(R)),V=new Map((U==null?void 0:U.map(W=>[W.id,W]))||[]),K=(P==null?void 0:P.map(W=>({...W,sender:V.get(W.sender_id),recipient:V.get(W.recipient_id)})))||[];s(K)}catch(E){console.error("Error loading shares:",E)}finally{o(!1)}},y=n.filter(E=>{var z,R;const A=l===""||E.resource_title.toLowerCase().includes(l.toLowerCase())||((z=E.sender)==null?void 0:z.name.toLowerCase().includes(l.toLowerCase()))||((R=E.recipient)==null?void 0:R.name.toLowerCase().includes(l.toLowerCase())),P=u==="all"||E.resource_type===u;return A&&P}),_=n.length,w=new Set(n.map(E=>E.sender_id)).size,S=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,M=n.reduce((E,A)=>(E[A.resource_type]=(E[A.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,A)=>r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Ir,{className:"h-4 w-20"})}),r.jsx(et,{children:r.jsx(Ir,{className:"h-8 w-16"})})]},A))}),r.jsx(Ke,{children:r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{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(_c,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:_})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{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(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:w})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{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(ap,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:S})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{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(ka,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[N,"%"]})})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(M).map(([E,A])=>r.jsxs(Lt,{variant:"secondary",className:W4e[E],children:[H4e[E],": ",A]},E)),Object.keys(M).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Share History"}),r.jsxs(Cn,{children:["All resource shares ",t?"in your brokerage":"across the platform"]})]}),r.jsxs(et,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:E=>i(E.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:u,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{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(Ro,{className:"h-[400px]",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(E=>{var A,P;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium max-w-[200px] truncate",children:E.resource_title}),r.jsx(jt,{children:r.jsx(Lt,{variant:"secondary",className:W4e[E.resource_type],children:H4e[E.resource_type]})}),r.jsx(jt,{children:((A=E.sender)==null?void 0:A.name)||"Unknown"}),r.jsx(jt,{children:((P=E.recipient)==null?void 0:P.name)||"Unknown"}),r.jsx(jt,{children:r.jsx(Lt,{variant:E.is_read?"default":"outline",children:E.is_read?"Read":"Unread"})}),r.jsx(jt,{className:"text-muted-foreground",children:mn(new Date(E.created_at),"MMM d, yyyy")})]},E.id)})})]})})]})]})]})}const Tkt=()=>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(ki,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"analytics",children:"Analytics"}),r.jsx(rn,{value:"activity",children:"Activity"}),r.jsx(rn,{value:"shares",children:"Shares"})]}),r.jsx(Sn,{value:"analytics",className:"space-y-4",children:r.jsx(Mkt,{})}),r.jsx(Sn,{value:"activity",className:"space-y-4",children:r.jsx(Ckt,{})}),r.jsx(Sn,{value:"shares",className:"space-y-4",children:r.jsx(N7e,{})})]})]})});function Akt(){const t=qr(),[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,u]=I.useState(null),[p,x]=I.useState(""),[y,_]=I.useState([]),[w,S]=I.useState([]),[N,M]=I.useState([]),[E,A]=I.useState(!1),[P,z]=I.useState(null),[R,U]=I.useState(""),{data:V,isLoading:K}=Kt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Me,error:Qe}=await Q.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Qe)throw Qe;return Me}}),{data:W}=Kt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Me,error:Qe}=await Q.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Qe)throw Qe;return Me}}),{data:J}=Kt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Me,error:Qe}=await Q.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Qe)throw Qe;return Me}}),{data:ae}=Kt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Me,error:Qe}=await Q.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Qe)throw Qe;return Me}}),{data:oe,isLoading:xe}=Kt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Me,error:Qe}=await Q.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Qe)throw Qe;return Me}}),ie=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),u(null),x(""),_([]),S([]),M([]),a(null),U("")},pe=Me=>{a(Me),l({title:Me.title,description:Me.description||"",publish_date:Me.publish_date.split("T")[0],is_published:Me.is_published,category_id:Me.category_id||""}),x(Me.preview_image_url||""),U("");const Qe=(W==null?void 0:W.filter(Le=>Le.resource_id===Me.id))||[];_(Qe.map(Le=>({id:Le.id,name:Le.name,file_url:Le.file_url,file_size:Le.file_size,sort_order:Le.sort_order})));const le=(J==null?void 0:J.filter(Le=>Le.resource_id===Me.id))||[];S(le.map(Le=>({id:Le.id,title:Le.title,video_url:Le.video_url,sort_order:Le.sort_order})));const Ve=(ae==null?void 0:ae.filter(Le=>Le.resource_id===Me.id))||[];M(Ve.map(Le=>({id:Le.id,title:Le.title,canva_share_link:Le.canva_share_link,sort_order:Le.sort_order}))),n(!0)},se=Me=>{var le;const Qe=(le=Me.target.files)==null?void 0:le[0];Qe&&(u(Qe),x(URL.createObjectURL(Qe)))},fe=()=>{_([...y,{name:"",file_url:"",sort_order:y.length}])},he=Me=>{_(y.filter((Qe,le)=>le!==Me))},ye=(Me,Qe,le)=>{const Ve=[...y];if(Qe==="file"&&le instanceof File){const Le=le.name.replace(/\.[^/.]+$/,"");Ve[Me]={...Ve[Me],file:le,file_size:le.size,name:Ve[Me].name||Le}}else Ve[Me]={...Ve[Me],[Qe]:le};_(Ve)},Ce=()=>{S([...w,{title:"",video_url:"",sort_order:w.length}])},Se=Me=>{S(w.filter((Qe,le)=>le!==Me))},Ne=(Me,Qe,le)=>{const Ve=[...w];Qe==="file"&&le instanceof File?Ve[Me]={...Ve[Me],file:le}:Ve[Me]={...Ve[Me],[Qe]:le},S(Ve)},be=()=>{M([...N,{title:"",canva_share_link:"",sort_order:N.length}])},rt=Me=>{M(N.filter((Qe,le)=>le!==Me))},Te=(Me,Qe,le)=>{const Ve=[...N];Ve[Me]={...Ve[Me],[Qe]:le},M(Ve)},Pe=async(Me,Qe)=>{try{const le=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:Me.name}});if(le.error)throw le.error;const{videoId:Ve,uploadUrl:Le,libraryId:We}=le.data,_e=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ve,libraryId:We}});if(_e.error)throw _e.error;const{uploadUrl:st,apiKey:ze}=_e.data,Ee=new XMLHttpRequest;return Ee.open("PUT",st,!0),Ee.setRequestHeader("AccessKey",ze),Ee.upload.onprogress=Je=>{if(Je.lengthComputable){const at=Math.round(Je.loaded/Je.total*100),pt=[...w];pt[Qe]={...pt[Qe],uploadProgress:at},S(pt)}},await new Promise((Je,at)=>{Ee.onload=()=>Ee.status>=200&&Ee.status<300?Je():at(new Error("Upload failed")),Ee.onerror=()=>at(new Error("Upload failed")),Ee.send(Me)}),`https://iframe.mediadelivery.net/embed/${We}/${Ve}`}catch(le){throw console.error("Bunny upload error:",le),le}},Ue=or({mutationFn:async Me=>{const{data:Qe,error:le}=await Q.from("brokerage_resource_categories").insert({name:Me,sort_order:(oe==null?void 0:oe.length)||0}).select().single();if(le)throw le;return Qe},onSuccess:Me=>{t.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Me.id}),U(""),Oe.success("Category created")},onError:Me=>{Oe.error("Failed to create category: "+Me.message)}}),Re=or({mutationFn:async()=>{A(!0);let Me=(s==null?void 0:s.preview_image_url)||null;if(i){const Ve=i.name.split(".").pop(),Le=`${Date.now()}.${Ve}`,{error:We}=await Q.storage.from("brokerage-resources").upload(`previews/${Le}`,i);if(We)throw We;const{data:_e}=Q.storage.from("brokerage-resources").getPublicUrl(`previews/${Le}`);Me=_e.publicUrl}const Qe={title:o.title,description:o.description||null,preview_image_url:Me,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let le;if(s){const{error:Ve}=await Q.from("brokerage_resources").update(Qe).eq("id",s.id);if(Ve)throw Ve;le=s.id;const Le=(W==null?void 0:W.filter(gt=>gt.resource_id===s.id).map(gt=>gt.id))||[],We=y.filter(gt=>gt.id).map(gt=>gt.id),_e=Le.filter(gt=>!We.includes(gt));_e.length>0&&await Q.from("brokerage_resource_pdfs").delete().in("id",_e);const st=(J==null?void 0:J.filter(gt=>gt.resource_id===s.id).map(gt=>gt.id))||[],ze=w.filter(gt=>gt.id).map(gt=>gt.id),Ee=st.filter(gt=>!ze.includes(gt));Ee.length>0&&await Q.from("brokerage_resource_videos").delete().in("id",Ee);const Je=(ae==null?void 0:ae.filter(gt=>gt.resource_id===s.id).map(gt=>gt.id))||[],at=N.filter(gt=>gt.id).map(gt=>gt.id),pt=Je.filter(gt=>!at.includes(gt));pt.length>0&&await Q.from("brokerage_resource_links").delete().in("id",pt)}else{const{data:Ve,error:Le}=await Q.from("brokerage_resources").insert(Qe).select().single();if(Le)throw Le;le=Ve.id}for(let Ve=0;Ve{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),Oe.success(s?"Resource updated":"Resource created"),n(!1),ie(),A(!1)},onError:Me=>{Oe.error("Failed to save resource: "+Me.message),A(!1)}}),Be=or({mutationFn:async Me=>{const{error:Qe}=await Q.from("brokerage_resources").delete().eq("id",Me);if(Qe)throw Qe},onSuccess:()=>{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),Oe.success("Resource deleted")},onError:Me=>{Oe.error("Failed to delete: "+Me.message)}}),Ye=Me=>{if(Me.preventDefault(),!o.title){Oe.error("Please enter a title");return}Re.mutate()},ht=Me=>{const Qe=(W==null?void 0:W.filter(Le=>Le.resource_id===Me).length)||0,le=(J==null?void 0:J.filter(Le=>Le.resource_id===Me).length)||0,Ve=(ae==null?void 0:ae.filter(Le=>Le.resource_id===Me).length)||0;return{pdfCount:Qe,videoCount:le,linkCount:Ve}};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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.length)||0})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.filter(Me=>Me.is_published).length)||0})})]})]}),r.jsxs(te,{onClick:()=>{ie(),n(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(V==null?void 0:V.length)===0?r.jsx(Mr,{children:r.jsx(jt,{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(Me=>{const{pdfCount:Qe,videoCount:le,linkCount:Ve}=ht(Me.id),Le=oe==null?void 0:oe.find(We=>We.id===Me.category_id);return r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Me.preview_image_url?r.jsx("img",{src:Me.preview_image_url,alt:Me.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(Nh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Me.title}),Me.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Me.description})]})]})}),r.jsx(jt,{children:Le?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:Le.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(jt,{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(ka,{className:"h-3.5 w-3.5"}),Qe]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Da,{className:"h-3.5 w-3.5"}),le]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Mo,{className:"h-3.5 w-3.5"}),Ve]})]})}),r.jsx(jt,{children:mn(new Date(Me.publish_date),"MMM d, yyyy")}),r.jsx(jt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Me.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Me.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{const We=(W==null?void 0:W.filter(ze=>ze.resource_id===Me.id))||[],_e=(J==null?void 0:J.filter(ze=>ze.resource_id===Me.id))||[],st=(ae==null?void 0:ae.filter(ze=>ze.resource_id===Me.id))||[];z({...Me,pdfs:We,videos:_e,links:st})},children:r.jsx($o,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>pe(Me),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Be.mutate(Me.id)},children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},Me.id)})})]})})}),r.jsx(Dr,{open:e,onOpenChange:n,children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:Ye,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[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(Nh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(ot,{type:"file",accept:"image/*",onChange:se})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:o.title,onChange:Me=>l({...o,title:Me.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{className:"flex items-center gap-2",children:[r.jsx(Eg,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(xn,{value:o.category_id,onValueChange:Me=>l({...o,category_id:Me}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(vn,{placeholder:"Select a category"})}),r.jsx(pn,{children:oe==null?void 0:oe.map(Me=>r.jsx(qt,{value:Me.id,children:Me.name},Me.id))})]}),o.category_id&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(gs,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Or create new category...",value:R,onChange:Me=>U(Me.target.value),className:"flex-1"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",disabled:!R.trim()||Ue.isPending,onClick:()=>Ue.mutate(R.trim()),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:o.description,onChange:Me=>l({...o,description:Me}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:o.publish_date,onChange:Me=>l({...o,publish_date:Me.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ss,{checked:o.is_published,onCheckedChange:Me=>l({...o,is_published:Me})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(qe,{className:"flex items-center gap-2",children:[r.jsx(ka,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Me,Qe)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(ot,{placeholder:"PDF Name",value:Me.name,onChange:le=>ye(Qe,"name",le.target.value),className:"flex-1"}),r.jsx(ot,{type:"file",accept:".pdf",onChange:le=>{var Le;const Ve=(Le=le.target.files)==null?void 0:Le[0];Ve&&ye(Qe,"file",Ve)},className:"flex-1"}),Me.file_url&&!Me.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>he(Qe),children:r.jsx(gs,{className:"h-4 w-4"})})]},Qe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(qe,{className:"flex items-center gap-2",children:[r.jsx(Da,{className:"h-4 w-4"}),"Videos (",w.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ce,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),w.map((Me,Qe)=>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(ot,{placeholder:"Video Title",value:Me.title,onChange:le=>Ne(Qe,"title",le.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>Se(Qe),children:r.jsx(gs,{className:"h-4 w-4"})})]}),r.jsx(ot,{type:"file",accept:"video/*",onChange:le=>{var Le;const Ve=(Le=le.target.files)==null?void 0:Le[0];Ve&&Ne(Qe,"file",Ve)}}),Me.uploadProgress!==void 0&&Me.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:`${Me.uploadProgress}%`}})}),Me.video_url&&!Me.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},Qe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(qe,{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Canva Links (",N.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:be,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),N.map((Me,Qe)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(ot,{placeholder:"Link Title",value:Me.title,onChange:le=>Te(Qe,"title",le.target.value),className:"flex-1"}),r.jsx(ot,{placeholder:"Canva Share Link",value:Me.canva_share_link,onChange:le=>Te(Qe,"canva_share_link",le.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>rt(Qe),children:r.jsx(gs,{className:"h-4 w-4"})})]},Qe))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:Re.isPending||E,children:Re.isPending||E?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Dr,{open:!!P,onOpenChange:()=>z(null),children:r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{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(ka,{className:"h-4 w-4"}),"PDF Documents (",P.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.pdfs.map(Me=>r.jsx("a",{href:Me.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Me.name},Me.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(Da,{className:"h-4 w-4"}),"Videos (",P.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:P.videos.map(Me=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Me.title})},Me.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(Mo,{className:"h-4 w-4"}),"Canva Links (",P.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.links.map(Me=>r.jsx("a",{href:Me.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Me.title},Me.id))})]})]})]})})]})})}const S7e=[{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 Ekt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(!1),[u,p]=I.useState(null),[x,y]=I.useState(!1),[_,w]=I.useState(!1),[S,N]=I.useState(""),[M,E]=I.useState(""),[A,P]=I.useState(""),[z,R]=I.useState(""),[U,V]=I.useState("Learn More"),[K,W]=I.useState("top"),[J,ae]=I.useState(""),[oe,xe]=I.useState(!0),[ie,pe]=I.useState(""),[se,fe]=I.useState("");I.useEffect(()=>{he()},[]);const he=async()=>{try{const{data:Ue,error:Re}=await Q.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Re)throw Re;e(Ue||[])}catch(Ue){Oe.error("Failed to load banners: "+Ue.message)}finally{s(!1)}},ye=()=>{N(""),E(""),P(""),R(""),V("Learn More"),W("top"),ae(""),xe(!0),pe(""),fe(""),p(null)},Ce=Ue=>{p(Ue),N(Ue.title),E(Ue.description||""),P(Ue.image_url),R(Ue.link_url||""),V(Ue.link_text||"Learn More"),W(Ue.placement),ae(Ue.section_after||""),xe(Ue.is_active),pe(Ue.start_date?mn(new Date(Ue.start_date),"yyyy-MM-dd'T'HH:mm"):""),fe(Ue.end_date?mn(new Date(Ue.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},Se=async Ue=>{var Be;const Re=(Be=Ue.target.files)==null?void 0:Be[0];if(Re){y(!0);try{const Ye=Re.name.split(".").pop(),ht=`${Date.now()}.${Ye}`,{error:Me}=await Q.storage.from("banner-images").upload(ht,Re);if(Me)throw Me;const{data:{publicUrl:Qe}}=Q.storage.from("banner-images").getPublicUrl(ht);P(Qe),Oe.success("Image uploaded successfully")}catch(Ye){Oe.error("Failed to upload image: "+Ye.message)}finally{y(!1)}}},Ne=async()=>{if(!S.trim()||!A){Oe.error("Please fill in required fields (title and image)");return}w(!0);try{const Ue={title:S.trim(),description:M.trim()||null,image_url:A,link_url:z.trim()||null,link_text:U.trim()||"Learn More",placement:K,section_after:K==="between"?J:null,is_active:oe,start_date:ie?new Date(ie).toISOString():null,end_date:se?new Date(se).toISOString():null};if(u){const{error:Re}=await Q.from("dashboard_banners").update(Ue).eq("id",u.id);if(Re)throw Re;Oe.success("Banner updated successfully")}else{const Re=t.filter(Ye=>Ye.placement===K).length,{error:Be}=await Q.from("dashboard_banners").insert({...Ue,sort_order:Re});if(Be)throw Be;Oe.success("Banner created successfully")}o(!1),ye(),he()}catch(Ue){Oe.error("Failed to save banner: "+Ue.message)}finally{w(!1)}},be=async()=>{if(u)try{const{error:Ue}=await Q.from("dashboard_banners").delete().eq("id",u.id);if(Ue)throw Ue;Oe.success("Banner deleted successfully"),i(!1),p(null),he()}catch(Ue){Oe.error("Failed to delete banner: "+Ue.message)}},rt=async Ue=>{try{const{error:Re}=await Q.from("dashboard_banners").update({is_active:!Ue.is_active}).eq("id",Ue.id);if(Re)throw Re;Oe.success(Ue.is_active?"Banner deactivated":"Banner activated"),he()}catch(Re){Oe.error("Failed to update banner: "+Re.message)}},Te=t.filter(Ue=>Ue.placement==="top"),Pe=t.filter(Ue=>Ue.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(Ke,{children:[r.jsxs(Ht,{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(Ol,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(Cn,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Dr,{open:a&&K==="top",onOpenChange:Ue=>{Ue||ye(),o(Ue),Ue&&W("top")},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{onClick:()=>{ye(),W("top")},children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:[u?"Edit":"Create"," Banner"]}),r.jsx(Jn,{children:"Configure the banner's content and display settings"})]}),r.jsx(G4e,{title:S,setTitle:N,description:M,setDescription:E,imageUrl:A,linkUrl:z,setLinkUrl:R,linkText:U,setLinkText:V,placement:K,setPlacement:W,sectionAfter:J,setSectionAfter:ae,isActive:oe,setIsActive:xe,startDate:ie,setStartDate:pe,endDate:se,setEndDate:fe,handleImageUpload:Se,uploading:x,showPlacementOptions:!1}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>{o(!1),ye()},children:"Cancel"}),r.jsx(te,{onClick:Ne,disabled:_,children:_?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Te.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:Te.map(Ue=>r.jsx(K4e,{banner:Ue,onEdit:()=>Ce(Ue),onDelete:()=>{p(Ue),i(!0)},onToggleActive:()=>rt(Ue)},Ue.id))})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{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(Ol,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(Cn,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Dr,{open:a&&K==="between",onOpenChange:Ue=>{Ue||ye(),o(Ue),Ue&&W("between")},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{onClick:()=>{ye(),W("between")},children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:[u?"Edit":"Create"," Section Banner"]}),r.jsx(Jn,{children:"Configure where this banner appears between sections"})]}),r.jsx(G4e,{title:S,setTitle:N,description:M,setDescription:E,imageUrl:A,linkUrl:z,setLinkUrl:R,linkText:U,setLinkText:V,placement:K,setPlacement:W,sectionAfter:J,setSectionAfter:ae,isActive:oe,setIsActive:xe,startDate:ie,setStartDate:pe,endDate:se,setEndDate:fe,handleImageUpload:Se,uploading:x,showPlacementOptions:!0}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>{o(!1),ye()},children:"Cancel"}),r.jsx(te,{onClick:Ne,disabled:_,children:_?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Pe.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:Pe.map(Ue=>r.jsx(K4e,{banner:Ue,onEdit:()=>Ce(Ue),onDelete:()=>{p(Ue),i(!0)},onToggleActive:()=>rt(Ue),showSection:!0},Ue.id))})})]})]}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Delete Banner"}),r.jsxs(Jn,{children:['Are you sure you want to delete "',u==null?void 0:u.title,'"? This action cannot be undone.']})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:be,children:"Delete"})]})]})})]})}function G4e({title:t,setTitle:e,description:n,setDescription:s,imageUrl:a,linkUrl:o,setLinkUrl:l,linkText:i,setLinkText:u,placement:p,setPlacement:x,sectionAfter:y,setSectionAfter:_,isActive:w,setIsActive:S,startDate:N,setStartDate:M,endDate:E,setEndDate:A,handleImageUpload:P,uploading:z,showPlacementOptions:R}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",placeholder:"Banner headline...",value:t,onChange:U=>e(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",placeholder:"Optional banner description...",value:n,onChange:U=>s(U.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ot,{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(qe,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(ot,{id:"linkUrl",placeholder:"https://...",value:o,onChange:U=>l(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"linkText",children:"Button Text"}),r.jsx(ot,{id:"linkText",placeholder:"Learn More",value:i,onChange:U=>u(U.target.value)})]})]}),R&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Placement"}),r.jsxs(xn,{value:y,onValueChange:_,children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select section placement..."})}),r.jsx(pn,{children:S7e.map(U=>r.jsx(qt,{value:U.value,children:U.label},U.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(ot,{id:"startDate",type:"datetime-local",value:N,onChange:U=>M(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(ot,{id:"endDate",type:"datetime-local",value:E,onChange:U=>A(U.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(Ss,{id:"isActive",checked:w,onCheckedChange:S}),r.jsx(qe,{htmlFor:"isActive",children:"Active"})]})})]})}function K4e({banner:t,onEdit:e,onDelete:n,onToggleActive:s,showSection:a=!1}){var l;const o=(l=S7e.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(D1,{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(Lt,{variant:"secondary",children:"Inactive"}),t.start_date&&new Date(t.start_date)>new Date&&r.jsx(Lt,{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(te,{variant:"ghost",size:"icon",children:r.jsx(Os,{className:"h-4 w-4"})})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:s,children:t.is_active?r.jsx($o,{className:"h-4 w-4"}):r.jsx(E1,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:e,children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})]})}const rO={open:{label:"Open",icon:Wa,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Bl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Ii,color:"bg-green-500"},closed:{label:"Closed",icon:Lc,color:"bg-muted-foreground"}},Z4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Ikt(){var U,V;const{user:t}=Qr(),e=qr(),[n,s]=I.useState(null),[a,o]=I.useState(""),[l,i]=I.useState("all"),[u,p]=I.useState("all"),[x,y]=I.useState(!1),{data:_=[],isLoading:w}=Kt({queryKey:["admin-support-tickets",l,u],queryFn:async()=>{let K=Q.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(K=K.eq("status",l)),u!=="all"&&(K=K.eq("category",u));const{data:W,error:J}=await K;if(J)throw J;return W}}),{data:S=[]}=Kt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:K,error:W}=await Q.from("user_roles").select("user_id").eq("role","admin");if(W)throw W;const J=K.map(se=>se.user_id),{data:ae,error:oe}=await Q.from("profiles").select("id, name, email").in("id",J);if(oe)throw oe;const{data:xe,error:ie}=await Q.from("support_notification_settings").select("user_id, receive_notifications");if(ie)throw ie;const pe=new Map((xe==null?void 0:xe.map(se=>[se.user_id,se.receive_notifications]))||[]);return ae.map(se=>({...se,receives_notifications:pe.get(se.id)||!1}))}}),{data:N=[]}=Kt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:K,error:W}=await Q.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(W)throw W;return K},enabled:!!n}),M=or({mutationFn:async({userId:K,enabled:W})=>{const{data:J}=await Q.from("support_notification_settings").select("id").eq("user_id",K).maybeSingle();if(J){const{error:ae}=await Q.from("support_notification_settings").update({receive_notifications:W}).eq("user_id",K);if(ae)throw ae}else{const{error:ae}=await Q.from("support_notification_settings").insert({user_id:K,receive_notifications:W});if(ae)throw ae}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-users-notifications"]}),Oe.success("Notification settings updated")},onError:()=>{Oe.error("Failed to update settings")}}),E=or({mutationFn:async({ticketId:K,status:W})=>{const{error:J}=await Q.from("support_tickets").update({status:W}).eq("id",K);if(J)throw J},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),Oe.success("Status updated")},onError:()=>{Oe.error("Failed to update status")}}),A=or({mutationFn:async({ticketId:K,assignedTo:W})=>{const{error:J}=await Q.from("support_tickets").update({assigned_to:W}).eq("id",K);if(J)throw J},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),Oe.success("Ticket assigned")},onError:()=>{Oe.error("Failed to assign ticket")}}),P=or({mutationFn:async K=>{var J,ae;if(!n||!t)throw new Error("Missing data");const{error:W}=await Q.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:K,is_admin_reply:!0});if(W)throw W;try{await Q.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:K,userEmail:(J=n.profiles)==null?void 0:J.email,userName:(ae=n.profiles)==null?void 0:ae.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(""),Oe.success("Reply sent!")},onError:()=>{Oe.error("Failed to send reply")}}),z=()=>{a.trim()&&P.mutate(a)};I.useEffect(()=>{const K=Q.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{Q.removeChannel(K)}},[e]);const R=_.filter(K=>K.status==="open").length;return n?(rO[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(te,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(io,{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(Lt,{variant:"secondary",children:Z4e[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((U=n.profiles)==null?void 0:U.name)||"Unknown"," (",(V=n.profiles)==null?void 0:V.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm",children:"Status"})}),r.jsx(et,{children:r.jsxs(xn,{value:n.status,onValueChange:K=>{E.mutate({ticketId:n.id,status:K}),s({...n,status:K})},children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm",children:"Assigned To"})}),r.jsx(et,{children:r.jsxs(xn,{value:n.assigned_to||"unassigned",onValueChange:K=>{const W=K==="unassigned"?null:K;A.mutate({ticketId:n.id,assignedTo:W}),s({...n,assigned_to:W})},children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Unassigned"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"unassigned",children:"Unassigned"}),S.map(K=>r.jsx(qt,{value:K.id,children:K.name},K.id))]})]})})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Cn,{children:["Created on ",mn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(Ro,{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 W,J;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?`${((W=K.profiles)==null?void 0:W.name)||"Admin"} (Support)`:((J=K.profiles)==null?void 0:J.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:mn(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(_d,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ss,{placeholder:"Type your reply...",value:a,onChange:K=>o(K.target.value),className:"min-h-[80px]"}),r.jsx(te,{onClick:z,disabled:!a.trim()||P.isPending,className:"self-end",children:r.jsx(eo,{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",R>0&&r.jsxs(Lt,{variant:"destructive",className:"ml-2",children:[R," open"]})]})]}),r.jsxs(Dr,{open:x,onOpenChange:y,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(jd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Email Notification Settings"}),r.jsx(Jn,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:S.map(K=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ac,{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(kg,{className:"h-4 w-4 text-primary"}):r.jsx(xj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ss,{checked:K.receives_notifications,onCheckedChange:W=>M.mutate({userId:K.id,enabled:W})})]})]},K.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(ki,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(pi,{children:[r.jsx(rn,{value:"all",children:"All"}),r.jsx(rn,{value:"open",children:"Open"}),r.jsx(rn,{value:"in_progress",children:"In Progress"}),r.jsx(rn,{value:"resolved",children:"Resolved"}),r.jsx(rn,{value:"closed",children:"Closed"})]})}),r.jsxs(xn,{value:u,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{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:w?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):_.length===0?r.jsx(Ke,{children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Bl,{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 J,ae;const W=rO[K.status].icon;return r.jsx(Ke,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(K),children:r.jsx(et,{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(Lt,{variant:"outline",className:"text-xs",children:Z4e[K.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(J=K.profiles)==null?void 0:J.name," • ",mn(new Date(K.created_at),"MMM d, yyyy")]}),K.assigned_to&&r.jsxs(Lt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(ac,{className:"h-3 w-3"}),((ae=S.find(oe=>oe.id===K.assigned_to))==null?void 0:ae.name)||"Assigned"]})]})]}),r.jsxs(Lt,{className:rO[K.status].color,children:[r.jsx(W,{className:"h-3 w-3 mr-1"}),rO[K.status].label]})]})})},K.id)})})})]})]})})}const Pkt=tu.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 Lkt({content:t,onChange:e,variables:n}){const s=FFe({extensions:[VFe,eze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),tze.configure({types:["heading","paragraph"]}),rze,Pkt],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(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(dS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(gS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(rp,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(vS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(lS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(oS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(cS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(Mo,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(_j,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(CS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(kS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(gA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(eh,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(ri,{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(DFe,{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(Lt,{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 Okt(){const t=qr(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(""),[i,u]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(!0),[w,S]=I.useState("visual"),{data:N,isLoading:M}=Kt({queryKey:["email-templates"],queryFn:async()=>{const{data:R,error:U}=await Q.from("email_templates").select("*").order("name");if(U)throw U;return R.map(V=>({...V,available_variables:V.available_variables||[]}))}}),E=or({mutationFn:async R=>{const{error:U}=await Q.from("email_templates").update({subject:R.subject,body_html:R.body_html,description:R.description,is_active:R.is_active}).eq("id",R.id);if(U)throw U},onSuccess:()=>{t.invalidateQueries({queryKey:["email-templates"]}),Oe.success("Email template updated successfully"),n(null)},onError:R=>{Oe.error("Failed to update template: "+R.message)}}),A=R=>{n(R),l(R.subject),u(R.body_html),x(R.description||""),_(R.is_active),S("visual")},P=()=>{e&&E.mutate({id:e.id,subject:o,body_html:i,description:p,is_active:y})},z=(R,U)=>{let V=R;return U.forEach(K=>{const W=`{{${K.key}}}`,J=`[${K.label}]`;V=V.replace(new RegExp(W.replace(/[{}]/g,"\\$&"),"g"),J)}),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(te,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(te,{variant:"outline",onClick:()=>a(e),children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(te,{onClick:P,disabled:E.isPending,children:[r.jsx(km,{className:"h-4 w-4 mr-2"}),E.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{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(ws,{className:"h-5 w-5"}),e.name]}),r.jsxs(Cn,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:e.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qe,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Ss,{id:"active-toggle",checked:y,onCheckedChange:_})]})]})}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",value:p,onChange:R=>x(R.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"subject",children:"Email Subject"}),r.jsx(ot,{id:"subject",value:o,onChange:R=>l(R.target.value),placeholder:"Email subject line"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{children:"Email Body"}),r.jsx(ki,{value:w,onValueChange:R=>S(R),children:r.jsxs(pi,{className:"h-8",children:[r.jsxs(rn,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(Mj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(rn,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(_j,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),w==="visual"?r.jsx(Lkt,{content:i,onChange:u,variables:e.available_variables}):r.jsx(ss,{value:i,onChange:R=>u(R.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Dr,{open:!!s,onOpenChange:()=>a(null),children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Email Preview"}),r.jsxs(Jn,{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"})]}),M?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((R,U)=>r.jsx(Ke,{children:r.jsxs(Ht,{children:[r.jsx(Ir,{className:"h-5 w-48"}),r.jsx(Ir,{className:"h-4 w-96"})]})},U))}):r.jsx("div",{className:"grid gap-4",children:N==null?void 0:N.map(R=>r.jsxs(Ke,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Zt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(ws,{className:"h-5 w-5 text-muted-foreground"}),R.name,!R.is_active&&r.jsx(Lt,{variant:"secondary",children:"Inactive"})]}),r.jsx(Cn,{children:R.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>a(R),children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(te,{size:"sm",onClick:()=>A(R),children:[r.jsx(hc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(et,{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:R.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:R.available_variables.map(U=>r.jsx(Lt,{variant:"outline",className:"font-mono text-xs",children:`{{${U.key}}}`},U.key))})]})]})})]},R.id))}),r.jsx(Dr,{open:!!s&&!e,onOpenChange:()=>a(null),children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(Jn,{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)}})})]})})]})})}function Dkt(){const t=qr(),[e,n]=I.useState("templates"),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,u]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),[w,S]=I.useState({name:"",description:"",icon:"📧"}),{data:N=[]}=Kt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:J,error:ae}=await Q.from("email_template_categories").select("*").order("sort_order");if(ae)throw ae;return J}}),{data:M=[],isLoading:E}=Kt({queryKey:["agent-email-templates-admin"],queryFn:async()=>{const{data:J,error:ae}=await Q.from("agent_email_templates").select("*, category:email_template_categories(*)").order("sort_order");if(ae)throw ae;return J}}),A=or({mutationFn:async J=>{const ae={title:J.title,subject:J.subject,body:J.body,description:J.description||null,tone:J.tone||null,category_id:J.category_id||null,is_active:J.is_active};if(J.id){const{error:oe}=await Q.from("agent_email_templates").update(ae).eq("id",J.id);if(oe)throw oe}else{const{error:oe}=await Q.from("agent_email_templates").insert(ae);if(oe)throw oe}},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-templates-admin"]}),u(!1),Oe.success(s?"Template updated":"Template created")},onError:()=>Oe.error("Failed to save template")}),P=or({mutationFn:async J=>{const{error:ae}=await Q.from("agent_email_templates").delete().eq("id",J);if(ae)throw ae},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-templates-admin"]}),Oe.success("Template deleted")}}),z=or({mutationFn:async J=>{const ae={name:J.name,description:J.description||null,icon:J.icon};if(J.id){const{error:oe}=await Q.from("email_template_categories").update(ae).eq("id",J.id);if(oe)throw oe}else{const oe=N.length>0?Math.max(...N.map(ie=>ie.sort_order))+1:0,{error:xe}=await Q.from("email_template_categories").insert({...ae,sort_order:oe});if(xe)throw xe}},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-template-categories"]}),x(!1),Oe.success(o?"Category updated":"Category created")},onError:()=>Oe.error("Failed to save category")}),R=or({mutationFn:async J=>{const{error:ae}=await Q.from("email_template_categories").delete().eq("id",J);if(ae)throw ae},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-template-categories"]}),Oe.success("Category deleted")}}),U=()=>{a(null),_({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),u(!0)},V=J=>{a(J),_({title:J.title,subject:J.subject,body:J.body,description:J.description||"",tone:J.tone||"",category_id:J.category_id||"",is_active:J.is_active}),u(!0)},K=()=>{l(null),S({name:"",description:"",icon:"📧"}),x(!0)},W=J=>{l(J),S({name:J.name,description:J.description||"",icon:J.icon}),x(!0)};return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6 animate-fade-in",children:[r.jsx(ju,{title:"Agent Email Templates",description:"Manage email templates that agents use when composing emails from Mission Control."}),r.jsxs(ki,{value:e,onValueChange:n,children:[r.jsxs(pi,{children:[r.jsxs(rn,{value:"templates",className:"gap-2",children:[r.jsx(ws,{className:"h-4 w-4"})," Templates"]}),r.jsxs(rn,{value:"categories",className:"gap-2",children:[r.jsx(Sg,{className:"h-4 w-4"})," Categories"]})]}),r.jsxs(Sn,{value:"templates",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(te,{onClick:U,className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"})," Add Template"]})}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Template"}),r.jsx(It,{className:"hidden md:table-cell",children:"Category"}),r.jsx(It,{className:"hidden md:table-cell",children:"Tone"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:E?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin mx-auto"})})}):M.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No templates yet. Create your first one!"})}):M.map(J=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:J.title}),r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:J.subject})]})}),r.jsx(jt,{className:"hidden md:table-cell",children:J.category?r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[J.category.icon," ",J.category.name]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(jt,{className:"hidden md:table-cell",children:J.tone?r.jsx(Lt,{variant:"secondary",children:J.tone}):"—"}),r.jsx(jt,{children:r.jsx(Lt,{variant:J.is_active?"default":"secondary",children:J.is_active?"Active":"Inactive"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>V(J),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&P.mutate(J.id)},children:r.jsx($n,{className:"h-4 w-4"})})]})})]},J.id))})]})})})]}),r.jsxs(Sn,{value:"categories",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(te,{onClick:K,className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"})," Add Category"]})}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:N.map(J=>r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",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("span",{className:"text-lg",children:J.icon})," ",J.name]}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>W(J),children:r.jsx(ni,{className:"h-3.5 w-3.5"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this category?")&&R.mutate(J.id)},children:r.jsx($n,{className:"h-3.5 w-3.5"})})]})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:J.description||"No description"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[M.filter(ae=>ae.category_id===J.id).length," templates"]})]})]},J.id))})]})]}),r.jsx(Dr,{open:i,onOpenChange:u,children:r.jsxs(Or,{className:"sm:max-w-[700px] max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:s?"Edit Template":"New Template"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Title"}),r.jsx(ot,{value:y.title,onChange:J=>_(ae=>({...ae,title:J.target.value})),placeholder:"e.g. Quick Check-in"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Category"}),r.jsxs(xn,{value:y.category_id,onValueChange:J=>_(ae=>({...ae,category_id:J})),children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select category"})}),r.jsx(pn,{children:N.map(J=>r.jsxs(qt,{value:J.id,children:[J.icon," ",J.name]},J.id))})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Subject Line"}),r.jsx(ot,{value:y.subject,onChange:J=>_(ae=>({...ae,subject:J.target.value})),placeholder:"e.g. Hey {{first_name}}, just checking in!"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ","{{first_name}}",", ","{{last_name}}",", ","{{full_name}}"," for merge variables"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Email Body"}),r.jsx(ss,{value:y.body,onChange:J=>_(ae=>({...ae,body:J.target.value})),rows:12,placeholder:"Write your email template...",className:"resize-y"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Description (internal)"}),r.jsx(ot,{value:y.description,onChange:J=>_(ae=>({...ae,description:J.target.value})),placeholder:"Short description for admin reference"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Tone"}),r.jsx(ot,{value:y.tone,onChange:J=>_(ae=>({...ae,tone:J.target.value})),placeholder:"e.g. Warm & Casual"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{checked:y.is_active,onCheckedChange:J=>_(ae=>({...ae,is_active:J}))}),r.jsx(qe,{children:"Active"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(te,{onClick:()=>A.mutate({...y,id:s==null?void 0:s.id}),disabled:A.isPending||!y.title||!y.subject||!y.body,children:[A.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),s?"Save Changes":"Create Template"]})]})]})}),r.jsx(Dr,{open:p,onOpenChange:x,children:r.jsxs(Or,{className:"sm:max-w-[450px]",children:[r.jsx(Br,{children:r.jsx(zr,{children:o?"Edit Category":"New Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-[60px_1fr] gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Icon"}),r.jsx(ot,{value:w.icon,onChange:J=>S(ae=>({...ae,icon:J.target.value})),className:"text-center text-lg"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Name"}),r.jsx(ot,{value:w.name,onChange:J=>S(ae=>({...ae,name:J.target.value})),placeholder:"e.g. Check-in & Stay in Touch"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Description"}),r.jsx(ot,{value:w.description,onChange:J=>S(ae=>({...ae,description:J.target.value})),placeholder:"Brief description of this category"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),r.jsxs(te,{onClick:()=>z.mutate({...w,id:o==null?void 0:o.id}),disabled:z.isPending||!w.name,children:[z.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),o?"Save Changes":"Create Category"]})]})]})})]})})}const Rkt=({brokerageId:t})=>{var Hl,Nu;const{toast:e}=mi(),[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(""),[u,p]=I.useState("all"),[x,y]=I.useState(new Set),[_,w]=I.useState(!1),[S,N]=I.useState({}),[M,E]=I.useState(!1),[A,P]=I.useState(!1),[z,R]=I.useState({email:"",name:"",password:"",phone:""}),[U,V]=I.useState(!1),[K,W]=I.useState(null),[J,ae]=I.useState(!1),[oe,xe]=I.useState(!1),[ie,pe]=I.useState(!1),[se,fe]=I.useState(""),[he,ye]=I.useState(!1),[Ce,Se]=I.useState([]),[Ne,be]=I.useState(!1),[rt,Te]=I.useState(!1),[Pe,Ue]=I.useState(null),[Re,Be]=I.useState({name:"",phone:"",email:""}),[Ye,ht]=I.useState(!1),[Me,Qe]=I.useState(!1),[le,Ve]=I.useState(null),[Le,We]=I.useState("asc"),[_e,st]=I.useState(!1),[ze,Ee]=I.useState(null),[Je,at]=I.useState(!1),[pt,gt]=I.useState(null),[Mt,wt]=I.useState(""),[Xt,Sr]=I.useState(!1),[an,wn]=I.useState(null);I.useEffect(()=>{Pn(),Xr()},[t]);const Xr=async()=>{try{const{data:nt,error:ge}=await Q.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",t);if(ge)throw ge;Se((nt==null?void 0:nt.map(Ae=>Ae.user_id))||[])}catch(nt){console.error("Error loading brokerage managers:",nt)}},Pn=async()=>{try{o(!0);const{data:nt,error:ge}=await Q.functions.invoke("get-brokerage-agents",{body:{brokerageId:t}});if(ge)throw ge;const Ae=nt.agents||[];if(s(Ae),Ae.length>0){const Ze=Ae.map(vt=>vt.id),{data:Nt}=await Q.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ze);if(Nt&&Nt.length>0){const vt=Nt.map(Pt=>Pt.assistant_id),{data:At}=await Q.from("profiles").select("id, name, email").in("id",vt),Bt={};for(const Pt of Nt){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(nt){console.error("Error loading agents:",nt),e({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},Ns=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:nt}}=await Q.auth.getSession(),ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${nt==null?void 0:nt.access_token}`},body:JSON.stringify({...z,brokerageId:t})}),Ae=await ge.json();if(!ge.ok)throw new Error(Ae.error||"Failed to create agent");e({title:"Success",description:`Agent ${z.email} created successfully`}),R({email:"",name:"",password:"",phone:""}),E(!1),Pn()}catch(nt){console.error("Error creating agent:",nt),e({title:"Error",description:nt.message||"Failed to create agent",variant:"destructive"})}finally{P(!1)}},hr=async nt=>{try{const{data:{session:ge}}=await Q.auth.getSession(),Ae=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:nt})}),Ze=await Ae.json();if(!Ae.ok)throw new Error(Ze.error||"Failed to resend welcome email");e({title:"Success",description:"Welcome email sent successfully"})}catch(ge){console.error("Error resending welcome email:",ge),e({title:"Error",description:ge.message||"Failed to resend welcome email",variant:"destructive"})}},ys=async(nt,ge)=>{try{const{error:Ae}=await Q.functions.invoke("send-password-reset",{body:{email:nt,redirectTo:window.location.origin}});if(Ae)throw Ae;e({title:"Password Reset Sent",description:`Password reset email sent to ${ge}`})}catch(Ae){console.error("Error sending password reset:",Ae),e({title:"Error",description:Ae.message||"Failed to send password reset email",variant:"destructive"})}},Ca=nt=>{W(nt),V(!0)},va=nt=>{Ue(nt),Be({name:nt.name,phone:nt.phone||"",email:nt.email}),Te(!0)},$i=async()=>{if(!Pe)return;if(!Re.name.trim()){e({title:"Error",description:"Name is required",variant:"destructive"});return}const nt=Re.email.trim().toLowerCase()!==Pe.email.toLowerCase();ht(!0);try{if(nt){if(!Re.email.trim())throw new Error("Email is required");Qe(!0);const{data:{session:Ae}}=await Q.auth.getSession(),Ze=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ae==null?void 0:Ae.access_token}`},body:JSON.stringify({agentId:Pe.id,newEmail:Re.email.trim(),brokerageId:t})}),Nt=await Ze.json();if(Qe(!1),!Ze.ok)throw new Error(Nt.error||"Failed to update email")}const{error:ge}=await Q.from("profiles").update({name:Re.name.trim(),phone:Re.phone.trim()||null}).eq("id",Pe.id);if(ge)throw ge;e({title:"Success",description:"Agent profile updated successfully"}),Te(!1),Ue(null),Pn()}catch(ge){console.error("Error updating agent:",ge),e({title:"Error",description:ge.message||"Failed to update agent",variant:"destructive"})}finally{ht(!1),Qe(!1)}},Ui=async()=>{if(!se){e({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}ye(!0);try{const{data:{session:nt}}=await Q.auth.getSession(),ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${nt==null?void 0:nt.access_token}`},body:JSON.stringify({userId:se,role:"brokerage_manager",action:"add",brokerageId:t})}),Ae=await ge.json();if(!ge.ok)throw new Error(Ae.error||"Failed to add brokerage manager");e({title:"Success",description:"Brokerage manager added successfully"}),pe(!1),fe(""),Xr()}catch(nt){console.error("Error adding brokerage manager:",nt),e({title:"Error",description:nt.message||"Failed to add brokerage manager",variant:"destructive"})}finally{ye(!1)}},al=async nt=>{try{const{data:{session:ge}}=await Q.auth.getSession(),Ae=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ge==null?void 0:ge.access_token}`},body:JSON.stringify({userId:nt,role:"brokerage_manager",action:"remove",brokerageId:t})}),Ze=await Ae.json();if(!Ae.ok)throw new Error(Ze.error||"Failed to remove brokerage manager");e({title:"Success",description:"Brokerage manager role removed"}),Xr()}catch(ge){console.error("Error removing brokerage manager:",ge),e({title:"Error",description:ge.message||"Failed to remove brokerage manager",variant:"destructive"})}},yo=nt=>Ce.includes(nt),Gs=nt=>{gt(nt),wt(""),at(!0)},Qa=async()=>{if(!(!pt||!Mt)){if(Mt.length<6){e({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}Sr(!0);try{const{data:{session:nt}}=await Q.auth.getSession(),ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${nt==null?void 0:nt.access_token}`},body:JSON.stringify({agentId:pt.id,brokerageId:t,action:"set_password",newPassword:Mt})}),Ae=await ge.json();if(!ge.ok)throw new Error(Ae.error||"Failed to set password");e({title:"Success",description:`Password set for ${pt.name}`}),at(!1),gt(null),wt("")}catch(nt){console.error("Error setting password:",nt),e({title:"Error",description:nt.message||"Failed to set password",variant:"destructive"})}finally{Sr(!1)}}},Cs=async nt=>{wn(nt.id);try{const{data:{session:ge}}=await Q.auth.getSession(),Ae=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ge==null?void 0:ge.access_token}`},body:JSON.stringify({agentId:nt.id,brokerageId:t,action:"claim_account"})}),Ze=await Ae.json();if(!Ae.ok)throw new Error(Ze.error||"Failed to claim account");e({title:"Success",description:`Account claimed for ${nt.name}`}),Pn()}catch(ge){console.error("Error claiming account:",ge),e({title:"Error",description:ge.message||"Failed to claim account",variant:"destructive"})}finally{wn(null)}},Ba=async()=>{if(K){ae(!0);try{const{data:{session:nt}}=await Q.auth.getSession(),ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${nt==null?void 0:nt.access_token}`},body:JSON.stringify({userId:K.id,brokerageId:t})}),Ae=await ge.json();if(!ge.ok)throw new Error(Ae.error||"Failed to remove agent");e({title:"Success",description:`${K.name} has been removed from your brokerage`}),V(!1),W(null),Pn()}catch(nt){console.error("Error removing agent:",nt),e({title:"Error",description:nt.message||"Failed to remove agent",variant:"destructive"})}finally{ae(!1)}}},Ra=nt=>{const ge=nt.trim().split(" ");return ge.length>1?ge[ge.length-1].toLowerCase():nt.toLowerCase()},Fo=nt=>{le===nt?We(Le==="asc"?"desc":"asc"):(Ve(nt),We("asc"))},ir=nt=>le!==nt?r.jsx(jg,{className:"ml-1 h-4 w-4"}):Le==="asc"?r.jsx(ep,{className:"ml-1 h-4 w-4"}):r.jsx(Xx,{className:"ml-1 h-4 w-4"}),po=n.filter(nt=>{if(u==="active"&&!nt.claimed||u==="pending"&&nt.claimed)return!1;if(!l)return!0;const ge=l.toLowerCase();return nt.name.toLowerCase().includes(ge)||nt.email.toLowerCase().includes(ge)}),gl=[...po].sort((nt,ge)=>{if(!le)return 0;let Ae=0;return le==="name"?Ae=Ra(nt.name).localeCompare(Ra(ge.name)):le==="status"&&(Ae=nt.claimed===ge.claimed?0:nt.claimed?-1:1),Le==="asc"?Ae:-Ae});po.filter(nt=>nt.claimed&&!yo(nt.id));const Eo=nt=>{y(ge=>{const Ae=new Set(ge);return Ae.has(nt)?Ae.delete(nt):Ae.add(nt),Ae})},is=()=>{x.size===gl.length?y(new Set):y(new Set(gl.map(nt=>nt.id)))},vo=()=>{y(new Set)},ku=async()=>{const nt=Array.from(x);if(nt.length===0)return;w(!0);let ge=0,Ae=0;try{const{data:{session:Ze}}=await Q.auth.getSession();for(const Nt of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ze==null?void 0:Ze.access_token}`},body:JSON.stringify({userId:Nt})})).ok?ge++:Ae++}catch{Ae++}ge>0?e({title:"Success",description:`Welcome emails sent to ${ge} agent${ge>1?"s":""}${Ae>0?` (${Ae} failed)`:""}`}):e({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),vo()}catch(Ze){console.error("Error bulk sending welcome emails:",Ze),e({title:"Error",description:Ze.message||"Failed to send welcome emails",variant:"destructive"})}finally{w(!1)}};return a?r.jsx(Ke,{children:r.jsx(et,{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(Ke,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Agents"}),r.jsx(Cn,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>pe(!0),children:[r.jsx(uf,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(te,{variant:"outline",onClick:()=>xe(!0),children:[r.jsx(P1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(te,{onClick:()=>E(!0),children:[r.jsx(hf,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(et,{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(ya,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:l,onChange:nt=>i(nt.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:u,onValueChange:nt=>p(nt),children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(vn,{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(te,{size:"sm",variant:"outline",onClick:ku,disabled:_,children:[r.jsx(ws,{className:"mr-2 h-4 w-4"}),_?"Sending...":"Resend Welcome Email"]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:vo,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Fl,{checked:gl.length>0&&x.size===gl.length,onCheckedChange:is,"aria-label":"Select all"})}),r.jsx(It,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Fo("name"),children:["Name (Last)",ir("name")]})}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Fo("status"),children:["Status",ir("status")]})}),r.jsx(It,{children:"Actions"})]})}),r.jsx(Vs,{children:gl.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):gl.map(nt=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsx(Fl,{checked:x.has(nt.id),onCheckedChange:()=>Eo(nt.id),"aria-label":`Select ${nt.name}`})}),r.jsx(jt,{className:"font-medium",children:nt.name}),r.jsx(jt,{children:nt.email}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[nt.claimed?r.jsx(Lt,{variant:"default",children:"Active"}):r.jsx(Lt,{variant:"secondary",children:"Pending"}),yo(nt.id)&&r.jsxs(Lt,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(cA,{className:"mr-1 h-3 w-3"}),"Manager"]}),S[nt.id]&&r.jsxs(Lt,{variant:"outline",className:"text-xs",children:[r.jsx(Bn,{className:"mr-1 h-3 w-3"}),"Asst: ",S[nt.id].name||S[nt.id].email]})]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{Ee(nt),st(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Fc,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>va(nt),title:"Edit agent",children:r.jsx(ni,{className:"h-4 w-4"})}),!nt.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>hr(nt.id),title:"Resend welcome email",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Cs(nt),title:"Claim account for agent",disabled:an===nt.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(Pj,{className:"h-4 w-4"})})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Gs(nt),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(np,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>ys(nt.email,nt.name),title:"Send password reset email",children:r.jsx(Nj,{className:"h-4 w-4"})}),yo(nt.id)&&r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>al(nt.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(uf,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Ca(nt),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx($n,{className:"h-4 w-4"})})]})})]},nt.id))})]})})]})]}),r.jsx(Dr,{open:M,onOpenChange:E,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Add New Agent"}),r.jsx(Jn,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",value:z.name,onChange:nt=>R({...z,name:nt.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:z.email,onChange:nt=>R({...z,email:nt.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(ot,{id:"phone",type:"tel",value:z.phone,onChange:nt=>R({...z,phone:nt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"password",children:"Temporary Password"}),r.jsx(ot,{id:"password",type:"password",value:z.password,onChange:nt=>R({...z,password:nt.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),r.jsx(te,{onClick:Ns,disabled:A,children:A?"Creating...":"Create Agent"})]})]})}),r.jsx(Dr,{open:U,onOpenChange:V,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Remove Agent"}),r.jsxs(Jn,{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(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Ba,disabled:J,children:J?"Removing...":"Remove Agent"})]})]})}),r.jsx(w7e,{open:oe,onOpenChange:xe,fixedBrokerageId:t,onSuccess:Pn}),r.jsx(Dr,{open:ie,onOpenChange:pe,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Add Brokerage Manager"}),r.jsx(Jn,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(qe,{children:"Select Agent"}),r.jsxs(Cd,{open:Ne,onOpenChange:be,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":Ne,className:"w-full justify-between",children:[se?((Hl=n.find(nt=>nt.id===se))==null?void 0:Hl.name)+" ("+((Nu=n.find(nt=>nt.id===se))==null?void 0:Nu.email)+")":"Select an agent to promote...",r.jsx(Qx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(ed,{className:"w-full p-0",align:"start",children:r.jsxs(by,{children:[r.jsx(wy,{placeholder:"Search by name or email..."}),r.jsxs(jy,{className:"max-h-[200px]",children:[r.jsx(ky,{children:"No eligible agents found."}),r.jsx(Ny,{children:n.filter(nt=>!yo(nt.id)).map(nt=>r.jsxs(Sy,{value:`${nt.name} ${nt.email}`,onSelect:()=>{fe(nt.id),be(!1)},children:[r.jsx(_i,{className:`mr-2 h-4 w-4 ${se===nt.id?"opacity-100":"opacity-0"}`}),nt.name," (",nt.email,")"]},nt.id))})]})]})})]}),n.filter(nt=>!yo(nt.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>pe(!1),children:"Cancel"}),r.jsx(te,{onClick:Ui,disabled:he||!se,children:he?"Adding...":"Add as Manager"})]})]})}),r.jsx(Dr,{open:rt,onOpenChange:Te,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Edit Agent"}),r.jsxs(Jn,{children:["Update profile information for ",Pe==null?void 0:Pe.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"edit-name",children:"Name"}),r.jsx(ot,{id:"edit-name",value:Re.name,onChange:nt=>Be({...Re,name:nt.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"edit-email",children:"Email"}),r.jsx(ot,{id:"edit-email",type:"email",value:Re.email,onChange:nt=>Be({...Re,email:nt.target.value}),placeholder:"agent@example.com"}),Re.email.trim().toLowerCase()!==(Pe==null?void 0:Pe.email.toLowerCase())&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(ot,{id:"edit-phone",type:"tel",value:Re.phone,onChange:nt=>Be({...Re,phone:nt.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>Te(!1),children:"Cancel"}),r.jsx(te,{onClick:$i,disabled:Ye||Me,children:Me?"Updating email...":Ye?"Saving...":"Save Changes"})]})]})}),ze&&r.jsx(j7e,{open:_e,onOpenChange:nt=>{st(nt),nt||Ee(null)},userId:ze.id,userName:ze.name}),r.jsx(Dr,{open:Je,onOpenChange:at,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Set Password"}),r.jsxs(Jn,{children:["Set a new password for ",pt==null?void 0:pt.name,". They will be able to log in with this password immediately."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"new-password",children:"New Password"}),r.jsx(ot,{id:"new-password",type:"password",value:Mt,onChange:nt=>wt(nt.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(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>at(!1),children:"Cancel"}),r.jsx(te,{onClick:Qa,disabled:Xt||!Mt||Mt.length<6,children:Xt?"Setting...":"Set Password"})]})]})})]})},Fkt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},zkt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},Bkt=t=>{switch(t){case"academy_video":return r.jsx(Da,{className:"h-4 w-4"});case"template":return r.jsx(ka,{className:"h-4 w-4"});case"toolbox":return r.jsx(ka,{className:"h-4 w-4"});case"newsletter":return r.jsx(ny,{className:"h-4 w-4"});case"social_swag":return r.jsx(As,{className:"h-4 w-4"});case"event":return r.jsx(Ds,{className:"h-4 w-4"});default:return r.jsx(Os,{className:"h-4 w-4"})}},$kt=({brokerageId:t})=>{const{toast:e}=mi(),[n,s]=I.useState([]),[a,o]=I.useState([]),[l,i]=I.useState([]),[u,p]=I.useState(!0),[x,y]=I.useState(null);I.useEffect(()=>{_()},[t]);const _=async()=>{try{p(!0);const{data:N,error:M}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",t);if(M)throw M;const E=N.map(ae=>ae.id),A=new Map(N.map(ae=>[ae.id,ae]));if(E.length===0){s([]),o([]),i([]);return}const{data:P,error:z}=await Q.from("activity_logs").select("*").in("user_id",E).order("launched_at",{ascending:!1});if(z)throw z;const R=P.map(ae=>{var oe,xe;return{id:ae.id,user_id:ae.user_id,app_name:ae.app_name,launched_at:ae.launched_at,user_name:((oe=A.get(ae.user_id))==null?void 0:oe.name)||"Unknown",user_email:((xe=A.get(ae.user_id))==null?void 0:xe.email)||"Unknown"}});s(R);const{data:U,error:V}=await Q.from("content_engagement_logs").select("*").in("user_id",E).order("created_at",{ascending:!1});if(V)throw V;const K=(U||[]).map(ae=>{var oe,xe;return{id:ae.id,user_id:ae.user_id,resource_type:ae.resource_type,resource_id:ae.resource_id,resource_title:ae.resource_title,action_type:ae.action_type,created_at:ae.created_at,user_name:((oe=A.get(ae.user_id))==null?void 0:oe.name)||"Unknown",user_email:((xe=A.get(ae.user_id))==null?void 0:xe.email)||"Unknown"}});o(K);const W=new Map;N.forEach(ae=>{W.set(ae.id,{user_id:ae.id,user_name:ae.name,user_email:ae.email,app_launches:0,content_views:0,last_activity:""})}),R.forEach(ae=>{const oe=W.get(ae.user_id);oe&&(oe.app_launches++,(!oe.last_activity||new Date(ae.launched_at)>new Date(oe.last_activity))&&(oe.last_activity=ae.launched_at))}),K.forEach(ae=>{const oe=W.get(ae.user_id);oe&&(oe.content_views++,(!oe.last_activity||new Date(ae.created_at)>new Date(oe.last_activity))&&(oe.last_activity=ae.created_at))});const J=Array.from(W.values()).filter(ae=>ae.app_launches>0||ae.content_views>0).sort((ae,oe)=>new Date(oe.last_activity).getTime()-new Date(ae.last_activity).getTime());i(J)}catch(N){console.error("Error loading activity:",N),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{p(!1)}},w=N=>n.filter(M=>M.user_id===N),S=N=>a.filter(M=>M.user_id===N);return u?r.jsx(Ke,{children:r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Agent Activity"}),r.jsx(Cn,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(et,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(N=>r.jsxs(Mr,{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(jt,{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(jt,{className:"text-center",children:r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[r.jsx(Ul,{className:"h-3 w-3"}),N.app_launches]})}),r.jsx(jt,{className:"text-center",children:r.jsxs(Lt,{variant:"secondary",className:"gap-1",children:[r.jsx(ka,{className:"h-3 w-3"}),N.content_views]})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:N.last_activity&&gu(new Date(N.last_activity),{addSuffix:!0})})]},N.user_id))})]})})})]}),r.jsx(Dr,{open:!!x,onOpenChange:N=>!N&&y(null),children:r.jsxs(Or,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Jn,{children:x==null?void 0:x.email})]}),r.jsxs(ki,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(pi,{className:"grid w-full grid-cols-2",children:[r.jsx(rn,{value:"content",children:"Content Engagement"}),r.jsx(rn,{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(Mr,{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&&S(x.id).length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&S(x.id).map(N=>r.jsxs(Mr,{children:[r.jsx(jt,{className:"max-w-[200px] truncate font-medium",children:N.resource_title}),r.jsx(jt,{children:r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[Bkt(N.resource_type),Fkt[N.resource_type]||N.resource_type]})}),r.jsx(jt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:zkt[N.action_type]||N.action_type})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:gu(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(Mr,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:x&&w(x.id).length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&w(x.id).map(N=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",children:N.app_name})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:gu(new Date(N.launched_at),{addSuffix:!0})})]},N.id))})]})})})]})]})})]})},Ukt=({brokerageId:t})=>{const{toast:e}=mi(),[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:u}=await Q.from("profiles").select("id").eq("brokerage_id",t);if(u)throw u;const p=i.map(R=>R.id),x=p.length;if(p.length===0){o(!1);return}const{data:y,error:_}=await Q.from("profiles").select("id, email").in("id",p);if(_)throw _;const{count:w}=await Q.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",t).not("last_login","is",null),S=w||0,N=x-S,{count:M}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p),E=new Date;E.setDate(E.getDate()-7);const{count:A}=await Q.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 Q.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",P.toISOString());s({totalAgents:x,activeAgents:S,pendingAgents:N,totalLaunches:M||0,launchesThisWeek:A||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(Ke,{children:r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{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(et,{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(Ke,{children:[r.jsxs(Ht,{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(Ii,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(Wa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(wg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(wg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(Ke,{children:[r.jsxs(Ht,{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(wg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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"})]})]})]})},qkt=({brokerageId:t})=>{const[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,u]=I.useState(!1),[p,x]=I.useState({description:"",maxUses:""});I.useEffect(()=>{y()},[t]);const y=async()=>{try{const{data:E,error:A}=await Q.from("invite_codes").select("*").eq("brokerage_id",t).order("created_at",{ascending:!1});if(A)throw A;n(E||[])}catch(E){console.error("Error loading invite codes:",E),Oe.error("Failed to load invite links")}finally{a(!1)}},_=()=>Math.random().toString(36).substring(2,8).toUpperCase(),w=async()=>{l(!0);try{const E=_(),{error:A}=await Q.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(A)throw A;Oe.success("Invite link created!"),u(!1),x({description:"",maxUses:""}),y()}catch(E){console.error("Error creating invite code:",E),Oe.error("Failed to create invite link")}finally{l(!1)}},S=async E=>{try{const{error:A}=await Q.from("invite_codes").delete().eq("id",E);if(A)throw A;Oe.success("Invite link deleted"),n(e.filter(P=>P.id!==E))}catch(A){console.error("Error deleting invite code:",A),Oe.error("Failed to delete invite link")}},N=async(E,A)=>{try{const{error:P}=await Q.from("invite_codes").update({is_active:!A}).eq("id",E);if(P)throw P;n(e.map(z=>z.id===E?{...z,is_active:!A}:z)),Oe.success(`Invite link ${A?"deactivated":"activated"}`)}catch(P){console.error("Error toggling invite code:",P),Oe.error("Failed to update invite link")}},M=E=>{const A=`${window.location.origin}/join?code=${E}`;navigator.clipboard.writeText(A),Oe.success("Link copied to clipboard!")};return s?r.jsx(Ke,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ke,{children:[r.jsxs(Ht,{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(Mo,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(Cn,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Dr,{open:i,onOpenChange:u,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create Invite Link"}),r.jsx(Jn,{children:"Create a new invite link for agents to join your brokerage"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description (optional)"}),r.jsx(ot,{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(qe,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(ot,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:p.maxUses,onChange:E=>x({...p,maxUses:E.target.value})})]}),r.jsx(te,{onClick:w,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(et,{children:e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Mo,{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(Lt,{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(te,{variant:"ghost",size:"sm",onClick:()=>M(E.code),title:"Copy link",children:r.jsx(tl,{className:"h-4 w-4"})}),r.jsx(te,{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(te,{variant:"ghost",size:"sm",onClick:()=>S(E.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx($n,{className:"h-4 w-4"})})]})]},E.id))})})]})},Vkt=({open:t,onOpenChange:e,referralCode:n,brokerageId:s,senderName:a,brokerageName:o,onInvitesSent:l})=>{const[i,u]=I.useState(""),[p,x]=I.useState([]),[y,_]=I.useState(""),[w,S]=I.useState(!1),N=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z),M=()=>{const z=i.trim().toLowerCase();if(z&&N(z)&&!p.includes(z)){if(p.length>=10){Oe.error("Maximum 10 emails per invite");return}x([...p,z]),u("")}else z&&!N(z)?Oe.error("Please enter a valid email address"):p.includes(z)&&Oe.error("Email already added")},E=z=>{x(p.filter(R=>R!==z))},A=z=>{(z.key==="Enter"||z.key===",")&&(z.preventDefault(),M())},P=async()=>{if(p.length===0){Oe.error("Please add at least one email address");return}S(!0);try{const{data:z,error:R}=await Q.functions.invoke("send-referral-invite",{body:{emails:p,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:a,brokerageName:o}});if(R)throw R;z.successCount===z.totalCount?Oe.success(`${z.successCount} invite${z.successCount>1?"s":""} sent successfully!`):Oe.warning(`${z.successCount} of ${z.totalCount} invites sent. Some failed.`),x([]),_(""),e(!1),l==null||l()}catch(z){console.error("Error sending invites:",z),Oe.error("Failed to send invites. Please try again.")}finally{S(!1)}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-[550px]",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Jn,{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(Zi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:i,onChange:z=>u(z.target.value),onKeyDown:A,onBlur:M}),r.jsx(te,{type:"button",variant:"secondary",onClick:M,children:"Add"})]}),p.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.map(z=>r.jsxs(Lt,{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(gs,{className:"h-3 w-3"})})]},z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(ss,{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(As,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:P,disabled:p.length===0||w,children:w?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(eo,{className:"h-4 w-4 mr-2"}),"Send ",p.length>0&&`(${p.length})`," Invite",p.length!==1?"s":""]})})]})]})})},Hkt=({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:u,error:p}=await Q.from("referral_invites").select("*").eq("referrer_brokerage_id",t).order("sent_at",{ascending:!1}).limit(20);if(p)throw p;s(u||[])}catch(u){console.error("Error fetching invites:",u)}finally{o(!1)}},i=u=>{switch(u){case"signed_up":return r.jsxs(Lt,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(Ii,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Lt,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(Lc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Lt,{variant:"secondary",className:"gap-1",children:[r.jsx(Wa,{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(ws,{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(u=>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:u.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",mn(new Date(u.sent_at),"MMM d, yyyy")]})]}),i(u.status)]},u.id))]})},Wkt=()=>{const{brokerageId:t,user:e}=Qr(),[n,s]=I.useState(null),[a,o]=I.useState(""),[l,i]=I.useState(""),[u,p]=I.useState([]),[x,y]=I.useState(!0),[_,w]=I.useState(!1),[S,N]=I.useState(0);I.useEffect(()=>{t&&M()},[t]);const M=async()=>{try{const[U,V]=await Promise.all([Q.from("brokerages").select("name").eq("id",t).single(),e?Q.from("profiles").select("name").eq("id",e.id).single():Promise.resolve({data:null})]);U.data&&o(U.data.name),V.data&&i(V.data.name||"A LevelUp Member");const{data:K}=await Q.from("referral_codes").select("code").eq("brokerage_id",t).single();if(K)s(K.code);else{const J=`REF${t==null?void 0:t.slice(0,8).toUpperCase()}`;await Q.from("referral_codes").insert({brokerage_id:t,code:J}),s(J)}const{data:W}=await Q.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(W||[])}catch(U){console.error("Error fetching referral data:",U)}finally{y(!1)}},E=()=>{const U=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(U),Oe.success("Referral link copied to clipboard!")},A=u.filter(U=>U.status==="qualified").length,P=u.filter(U=>U.status==="pending").length,z=A*25,R=Math.max(0,Math.ceil((299-z)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{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(Zi,{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(Ii,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),R>0&&z<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",R," 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(As,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(et,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(te,{onClick:()=>w(!0),className:"w-full",size:"lg",children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(te,{onClick:E,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(tl,{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(wd,{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:A}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),r.jsxs("div",{className:"text-center p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900",children:[r.jsx(Wa,{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(Hkt,{brokerageId:t,refreshTrigger:S}),u.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),u.slice(0,5).map(U=>{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=U.referred_brokerage)==null?void 0:V.name)||((K=U.referred_user)==null?void 0:K.email)||"Pending setup"}),r.jsxs(Lt,{variant:U.status==="qualified"?"default":U.status==="pending"?"secondary":"destructive",className:U.status==="qualified"?"bg-green-600":"",children:[U.status==="qualified"&&r.jsx(Ii,{className:"h-3 w-3 mr-1"}),U.status]})]},U.id)})]})]})]}),r.jsx(Vkt,{open:_,onOpenChange:w,referralCode:n||"",brokerageId:t||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>N(U=>U+1)})]})},Gkt=()=>{const{user:t,isBrokerageManager:e,brokerageId:n,isAdmin:s,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=Qr(),i=Gn(),{toast:u}=mi(),[p,x]=I.useState(""),[y,_]=I.useState(!0),w=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),w?S():a.length===0&&!n&&_(!1)},[t,e,s,w,i,a,o]);const S=async()=>{if(!w){_(!1);return}try{const{data:N,error:M}=await Q.from("brokerages").select("name").eq("id",w).single();if(M)throw M;x(N.name)}catch(N){console.error("Error loading brokerage info:",N),u({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"})})}):w?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(xn,{value:o||"",onValueChange:l,children:[r.jsxs(fn,{className:"w-[280px]",children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),r.jsx(vn,{placeholder:"Select brokerage"})]}),r.jsx(pn,{children:a.map(N=>r.jsx(qt,{value:N.id,children:N.name},N.id))})]})]}),r.jsxs(ki,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(pi,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(rn,{value:"agents",children:"Agents"}),r.jsx(rn,{value:"invite",children:"Invite Links"}),r.jsx(rn,{value:"referrals",children:"Referrals"}),r.jsx(rn,{value:"leaderboard",children:"Leaderboard"}),r.jsx(rn,{value:"activity",children:"Activity"}),r.jsx(rn,{value:"analytics",children:"Analytics"}),r.jsx(rn,{value:"shares",children:"Shares"})]}),r.jsx(Sn,{value:"agents",className:"space-y-4",children:r.jsx(Rkt,{brokerageId:w})}),r.jsx(Sn,{value:"invite",className:"space-y-4",children:r.jsx(qkt,{brokerageId:w})}),r.jsx(Sn,{value:"referrals",className:"space-y-4",children:r.jsx(Wkt,{})}),r.jsx(Sn,{value:"leaderboard",className:"space-y-4",children:r.jsx($ze,{brokerageId:w,title:`${p} Event Leaderboard`,showUserStats:!1})}),r.jsx(Sn,{value:"activity",className:"space-y-4",children:r.jsx($kt,{brokerageId:w})}),r.jsx(Sn,{value:"analytics",className:"space-y-4",children:r.jsx(Ukt,{brokerageId:w})}),r.jsx(Sn,{value:"shares",className:"space-y-4",children:r.jsx(N7e,{brokerageOnly:!0,brokerageId:w})})]})]})}):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(li,{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 Kkt({brokerageId:t,canManage:e}){const{user:n}=Qr(),[s,a]=I.useState([]),[o,l]=I.useState(!0),[i,u]=I.useState(!1),[p,x]=I.useState(null),[y,_]=I.useState(null),[w,S]=I.useState(!1),[N,M]=I.useState(""),[E,A]=I.useState(""),[P,z]=I.useState(!1),R=async()=>{try{const{data:J,error:ae}=await Q.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(ae)throw ae;const oe=J;if(oe&&oe.length>0){const xe=[...new Set(oe.map(fe=>fe.created_by))],{data:ie}=await Q.from("profiles").select("id, name, avatar_url").in("id",xe),pe=new Map((ie==null?void 0:ie.map(fe=>[fe.id,fe]))||[]),se=oe.map(fe=>({...fe,author:pe.get(fe.created_by)||{name:"Unknown",avatar_url:null}}));a(se)}else a([])}catch(J){console.error("Error fetching announcements:",J)}finally{l(!1)}};I.useEffect(()=>{R()},[t]);const U=()=>{M(""),A(""),z(!1),x(null)},V=J=>{J?(x(J),M(J.title),A(J.content),z(J.is_pinned)):U(),u(!0)},K=async()=>{if(!N.trim()||!E.trim()){Oe.error("Please fill in all fields");return}S(!0);try{if(p){const{error:J}=await Q.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(J)throw J;Oe.success("Announcement updated")}else{const{error:J}=await Q.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(J)throw J;Oe.success("Announcement created")}u(!1),U(),R()}catch(J){console.error("Error saving announcement:",J),Oe.error("Failed to save announcement")}finally{S(!1)}},W=async()=>{if(y)try{const{error:J}=await Q.from("brokerage_announcements").delete().eq("id",y);if(J)throw J;Oe.success("Announcement deleted"),R()}catch(J){console.error("Error deleting announcement:",J),Oe.error("Failed to delete announcement")}finally{_(null)}};return o?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(jm,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{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(jm,{className:"h-5 w-5 text-primary"}),"Announcements"]}),e&&r.jsxs(te,{size:"sm",onClick:()=>V(),className:"gap-1",children:[r.jsx(_n,{className:"h-4 w-4"}),"New"]})]}),r.jsx(et,{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(J=>{var ae,oe,xe,ie;return r.jsx("div",{className:`p-4 rounded-lg border ${J.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:[J.is_pinned&&r.jsx(z1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:J.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:J.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(Ys,{className:"h-5 w-5",children:[r.jsx(Pi,{src:((ae=J.author)==null?void 0:ae.avatar_url)||void 0}),r.jsx(Xs,{className:"text-[10px]",children:((xe=(oe=J.author)==null?void 0:oe.name)==null?void 0:xe.charAt(0))||"?"})]}),r.jsx("span",{children:(ie=J.author)==null?void 0:ie.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:mn(new Date(J.created_at),"MMM d, yyyy")})]})]}),e&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>V(J),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>_(J.id),children:r.jsx($n,{className:"h-4 w-4"})})]})]})},J.id)})})})]}),r.jsx(Dr,{open:i,onOpenChange:u,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:p?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title"}),r.jsx(ot,{id:"title",value:N,onChange:J=>M(J.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"content",children:"Content"}),r.jsx(ss,{id:"content",value:E,onChange:J=>A(J.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(Ss,{id:"pinned",checked:P,onCheckedChange:z}),r.jsxs(qe,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(z1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(te,{onClick:K,disabled:w,children:w?"Saving...":p?"Update":"Create"})]})]})]})}),r.jsx(pu,{open:!!y,onOpenChange:()=>_(null),children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Delete Announcement"}),r.jsx(Zd,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Zkt({brokerageId:t}){const[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(""),[i,u]=I.useState(new Set);I.useEffect(()=>{(async()=>{try{const{data:y,error:_}=await Q.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 w=y.map(N=>N.id),{data:S}=await Q.from("agent_assistant_assignments").select("agent_id").in("agent_id",w);S&&u(new Set(S.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(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:o,onChange:x=>l(x.target.value),className:"pl-9"})]})]}),r.jsx(et,{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(Ykt,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function Ykt({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(Ys,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Pi,{src:t.avatar_url||void 0,alt:t.name}),r.jsx(Xs,{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(Lt,{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(To,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:t.areas_served})]}),t.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[t.years_experience," ",t.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.phone&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${t.phone}`,title:`Call ${t.name}`,children:r.jsx(ji,{className:"h-4 w-4"})})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`mailto:${t.email}`,title:`Email ${t.name}`,children:r.jsx(ws,{className:"h-4 w-4"})})}),t.linkedin_url&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(wm,{className:"h-4 w-4"})})}),t.instagram_url&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(mu,{className:"h-4 w-4"})})})]})]})}function Xkt({brokerageId:t}){const[e,n]=I.useState([]),[s,a]=I.useState(!0);if(I.useEffect(()=>{(async()=>{try{const{data:u,error:p}=await Q.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(p)throw p;if(!u||u.length===0){n([]),a(!1);return}const x=u.map(N=>N.id),{data:y,error:_}=await Q.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(_)throw _;const w=new Map(u.map(N=>[N.id,N])),S=(y||[]).filter(N=>N.total_points>0).map(N=>{const M=w.get(N.user_id);return{user_id:N.user_id,total_points:N.total_points,name:(M==null?void 0:M.name)||"Unknown",avatar_url:(M==null?void 0:M.avatar_url)||null}});n(S)}catch(u){console.error("Error fetching leaderboard:",u)}finally{a(!1)}})()},[t]),s)return r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(et,{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(ry,{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(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(et,{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,u)=>{const p=i.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=u+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(Ys,{className:"h-8 w-8",children:[r.jsx(Pi,{src:i.avatar_url||void 0}),r.jsx(Xs,{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 Qkt({brokerageId:t}){const e=Gn(),[n,s]=I.useState([]),[a,o]=I.useState(!0);I.useEffect(()=>{(async()=>{try{const{data:u,error:p}=await Q.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(p)throw p;if(!u||u.length===0){s([]),o(!1);return}const x=u.map(N=>N.id),y=new Map(u.map(N=>[N.id,N])),{data:_,error:w}=await Q.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(w)throw w;const S=(_||[]).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(S)}catch(u){console.error("Error fetching listings:",u)}finally{o(!1)}})()},[t]);const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(i);return a?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ua,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{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(ua,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>e("/mission-control/listings"),className:"gap-1",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(et,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(ua,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),r.jsxs(te,{size:"sm",onClick:()=>e("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(_n,{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(ua,{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(te,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>e("/mission-control/listings"),children:["View All Listings",r.jsx(Os,{className:"h-3 w-3 ml-1"})]})]})]})}function Jkt(){const{user:t,isAdmin:e,isBrokerageManager:n}=Qr(),s=Gn(),[a,o]=I.useState(!0),[l,i]=I.useState(null),[u,p]=I.useState(""),[x,y]=I.useState(0),[_,w]=I.useState(!1),[S,N]=I.useState(!1);return I.useEffect(()=>{(async()=>{if(t)try{const{data:E}=await Q.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:A}=await Q.from("brokerages").select("name").eq("id",E.brokerage_id).maybeSingle();A&&p(A.name);const{count:P}=await Q.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",E.brokerage_id);if(y(P||0),e)w(!0),N(!0);else if(n){const{data:z}=await Q.from("brokerage_manager_assignments").select("id").eq("user_id",t.id).eq("brokerage_id",E.brokerage_id).maybeSingle();w(!!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:u||"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"]})]}),S&&r.jsxs(te,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(ua,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(Kkt,{brokerageId:l,canManage:_}),r.jsx(Zkt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(Xkt,{brokerageId:l}),r.jsx(Qkt,{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(li,{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 eNt(){const t=Gn(),[e,n]=I.useState(""),[s,a]=I.useState("grid"),{data:o,isLoading:l}=Kt({queryKey:["newsletters"],queryFn:async()=>{const{data:P,error:z}=await Q.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(z)throw z;return P}}),{data:i}=Kt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:P}=await Q.from("newsletter_likes").select("newsletter_id");return P||[]}}),{data:u}=Kt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:P}=await Q.from("newsletter_comments").select("newsletter_id");return P||[]}}),{data:p}=Kt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[P,z,R,U]=await Promise.all([Q.from("newsletter_canva_links").select("newsletter_id"),Q.from("newsletter_pdfs").select("newsletter_id"),Q.from("newsletter_videos").select("newsletter_id"),Q.from("newsletter_drive_links").select("newsletter_id")]);return{canva:P.data||[],pdfs:z.data||[],videos:R.data||[],drives:U.data||[]}}}),x=P=>(i==null?void 0:i.filter(z=>z.newsletter_id===P).length)||0,y=P=>(u==null?void 0:u.filter(z=>z.newsletter_id===P).length)||0,_=P=>{var z;return((z=p==null?void 0:p.canva)==null?void 0:z.filter(R=>R.newsletter_id===P).length)||0},w=P=>{var z;return((z=p==null?void 0:p.pdfs)==null?void 0:z.filter(R=>R.newsletter_id===P).length)||0},S=P=>{var z;return((z=p==null?void 0:p.videos)==null?void 0:z.filter(R=>R.newsletter_id===P).length)||0},N=P=>{var z;return((z=p==null?void 0:p.drives)==null?void 0:z.filter(R=>R.newsletter_id===P).length)||0},M=P=>_(P)+w(P)+S(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()))}),A=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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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(te,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(tp,{className:"h-4 w-4"})}),r.jsx(te,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(rp,{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(Ke,{children:r.jsxs(et,{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(ka,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No newsletters match your search":"No newsletters available yet"}),e&&r.jsx(te,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!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=M(P.id),R=_(P.id),U=w(P.id),V=S(P.id);return s==="grid"?r.jsxs(Ke,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>A(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(ka,{className:"h-16 w-16"})})}),r.jsxs(et,{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(Ds,{className:"h-3 w-3"}),mn(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:[R>0&&r.jsxs(Lt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Rc,{className:"h-3 w-3"})," ",R," Template",R>1?"s":""]}),U>0&&r.jsxs(Lt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(ao,{className:"h-3 w-3"})," ",U," PDF",U>1?"s":""]}),V>0&&r.jsxs(Lt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Ul,{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(kd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bl,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]},P.id):r.jsx(Ke,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>A(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(ka,{className:"h-10 w-10"})})}),r.jsxs(et,{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(Ds,{className:"h-3 w-3"}),mn(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(kd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bl,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]})},P.id)})})]})})}function tNt({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(Ke,{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(et,{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 rNt(){const{id:t}=td(),e=Gn(),{user:n}=Qr(),{toast:s}=mi(),a=qr(),{trackEngagement:o}=WI(),[l,i]=I.useState(""),{data:u,isLoading:p}=Kt({queryKey:["newsletter",t],queryFn:async()=>{const{data:R,error:U}=await Q.from("newsletter_content").select("*").eq("id",t).single();if(U)throw U;return R},enabled:!!t});I.useEffect(()=>{u&&o("newsletter",u.id,u.title,"view")},[u==null?void 0:u.id]);const{data:x}=Kt({queryKey:["newsletter-drives",t],queryFn:async()=>{const{data:R}=await Q.from("newsletter_drive_links").select("*").eq("newsletter_id",t).order("sort_order");return R||[]},enabled:!!t}),{data:y}=Kt({queryKey:["newsletter-pdfs",t],queryFn:async()=>{const{data:R}=await Q.from("newsletter_pdfs").select("*").eq("newsletter_id",t).order("sort_order");return R||[]},enabled:!!t}),{data:_}=Kt({queryKey:["newsletter-videos",t],queryFn:async()=>{const{data:R}=await Q.from("newsletter_videos").select("*").eq("newsletter_id",t).order("sort_order");return R||[]},enabled:!!t}),{data:w}=Kt({queryKey:["newsletter-canva-links",t],queryFn:async()=>{const{data:R}=await Q.from("newsletter_canva_links").select("*").eq("newsletter_id",t).order("sort_order");return R||[]},enabled:!!t}),{data:S}=Kt({queryKey:["newsletter-likes",t],queryFn:async()=>{const{data:R}=await Q.from("newsletter_likes").select("*").eq("newsletter_id",t);return R||[]},enabled:!!t}),{data:N}=Kt({queryKey:["newsletter-comments",t],queryFn:async()=>{const{data:R}=await Q.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",t).order("created_at",{ascending:!1});return R||[]},enabled:!!t}),M=S==null?void 0:S.some(R=>R.user_id===(n==null?void 0:n.id)),E=or({mutationFn:async()=>{M?await Q.from("newsletter_likes").delete().eq("newsletter_id",t).eq("user_id",n==null?void 0:n.id):await Q.from("newsletter_likes").insert({newsletter_id:t,user_id:n==null?void 0:n.id})},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-likes",t]})}}),A=or({mutationFn:async R=>{const{error:U}=await Q.from("newsletter_comments").insert({newsletter_id:t,user_id:n==null?void 0:n.id,content:R});if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),i(""),s({title:"Comment added"})}}),P=or({mutationFn:async R=>{const{error:U}=await Q.from("newsletter_comments").delete().eq("id",R);if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),s({title:"Comment deleted"})}}),z=R=>{if(R.includes("player.mediadelivery.net")||R.includes("iframe.mediadelivery.net")){const U=R.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(U)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${U[1]}/${U[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(R.includes("youtube.com")||R.includes("youtu.be")){const U=R.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(U)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${U[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:R,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Ul,{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"})]})}):u?r.jsx(Lr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/newsletters"),className:"mb-4",children:[r.jsx(io,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),u.preview_image_url&&r.jsx("img",{src:u.preview_image_url,alt:u.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:u.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:mn(new Date(u.publish_date),"MMMM d, yyyy")})]}),u.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:u.description}}),r.jsx(tNt,{rows:u.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(N3,{resourceType:"newsletter",resourceId:u.id,resourceTitle:u.title}),r.jsxs(te,{variant:M?"default":"outline",size:"sm",onClick:()=>E.mutate(),children:[r.jsx(fi,{className:`h-4 w-4 mr-1 ${M?"fill-current":""}`}),(S==null?void 0:S.length)||0," ",(S==null?void 0:S.length)===1?"Like":"Likes"]})]}),w&&w.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(et,{className:"space-y-2",children:w.map(R=>r.jsxs("a",{href:R.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Rc,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:R.title}),r.jsx(Os,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},R.id))})]}),x&&x.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(et,{className:"space-y-2",children:x.map(R=>r.jsxs("a",{href:R.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Os,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:R.title})]},R.id))})]}),y&&y.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(et,{className:"space-y-2",children:y.map(R=>r.jsxs("a",{href:R.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(ka,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:R.name}),r.jsx(ao,{className:"h-4 w-4 text-muted-foreground"})]},R.id))})]}),_&&_.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Videos"})}),r.jsx(et,{className:"space-y-6",children:_.map(R=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:R.title}),z(R.video_url)]},R.id))})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"text-lg",children:["Comments (",(N==null?void 0:N.length)||0,")"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ss,{placeholder:"Write a comment...",value:l,onChange:R=>i(R.target.value),className:"flex-1"}),r.jsx(te,{onClick:()=>l.trim()&&A.mutate(l),disabled:!l.trim()||A.isPending,children:r.jsx(eo,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:N==null?void 0:N.map(R=>{var U,V,K;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{children:((V=(U=R.profiles)==null?void 0:U.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=R.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:mn(new Date(R.created_at),"MMM d, yyyy")}),R.user_id===(n==null?void 0:n.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>P.mutate(R.id),children:r.jsx($n,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:R.content})]})]},R.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(te,{variant:"link",onClick:()=>e("/newsletters"),children:"Back to Newsletters"})]})})}function nNt({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 w=[...t];w[p]={...w[p],columns:w[p].columns.map((S,N)=>N===x?{...S,[y]:_}:S)},e(w)},i=async(p,x,y)=>{var S;const _=(S=y.target.files)==null?void 0:S[0];if(!_)return;const w=`${p}-${x}`;s(w);try{const N=`content-blocks/${Date.now()}-${_.name}`,{error:M}=await Q.storage.from("newsletter-content").upload(N,_);if(!M){const{data:E}=Q.storage.from("newsletter-content").getPublicUrl(N);l(p,x,"image_url",E.publicUrl)}}finally{s(null)}},u=(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(qe,{className:"text-base font-medium",children:"Content Blocks (3-Column Rows)"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:a,children:[r.jsx(_n,{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(Ke,{className:"relative",children:[r.jsx(te,{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(gs,{className:"h-4 w-4"})}),r.jsxs(et,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(D1,{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 w=`${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(te,{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:()=>u(x,_),children:r.jsx(gs,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(ot,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${w}`,onChange:S=>i(x,_,S)}),r.jsx(te,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:n===w,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${w}`,className:"cursor-pointer",children:n===w?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(Ol,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(ot,{placeholder:"Title",value:y.title,onChange:S=>l(x,_,"title",S.target.value),className:"h-8 text-sm"}),r.jsx(ss,{placeholder:"Description",value:y.description,onChange:S=>l(x,_,"description",S.target.value),className:"text-sm min-h-[60px] resize-none"})]},_)})})]})]},x))]})}function sNt(){const{toast:t}=mi(),e=qr(),[n,s]=I.useState(!1),[a,o]=I.useState(null),[l,i]=I.useState({title:"",description:"",publish_date:mn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[u,p]=I.useState(null),[x,y]=I.useState(null),[_,w]=I.useState([]),[S,N]=I.useState([]),[M,E]=I.useState([]),[A,P]=I.useState([]),[z,R]=I.useState([]),[U,V]=I.useState([]),[K,W]=I.useState(!1),{data:J,isLoading:ae}=Kt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:Te,error:Pe}=await Q.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Pe)throw Pe;return Te}}),oe=or({mutationFn:async Te=>{const{data:Pe,error:Ue}=await Q.from("newsletter_content").insert({title:Te.title,description:Te.description||null,preview_image_url:Te.preview_image_url,publish_date:Te.publish_date,is_published:Te.is_published,content_blocks:Te.content_blocks}).select().single();if(Ue)throw Ue;return Pe},onSuccess:async Te=>{await pe(Te.id),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter created successfully"}),he()},onError:Te=>{t({title:"Error creating newsletter",description:Te.message,variant:"destructive"})}}),xe=or({mutationFn:async Te=>{const{error:Pe}=await Q.from("newsletter_content").update({title:Te.title,description:Te.description||null,preview_image_url:Te.preview_image_url,publish_date:Te.publish_date,is_published:Te.is_published,content_blocks:Te.content_blocks}).eq("id",Te.id);if(Pe)throw Pe;return Te.id},onSuccess:async Te=>{await pe(Te),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter updated successfully"}),he()},onError:Te=>{t({title:"Error updating newsletter",description:Te.message,variant:"destructive"})}}),ie=or({mutationFn:async Te=>{const{error:Pe}=await Q.from("newsletter_content").delete().eq("id",Te);if(Pe)throw Pe},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter deleted successfully"})},onError:Te=>{t({title:"Error deleting newsletter",description:Te.message,variant:"destructive"})}}),pe=async Te=>{await Q.from("newsletter_drive_links").delete().eq("newsletter_id",Te),await Q.from("newsletter_pdfs").delete().eq("newsletter_id",Te),await Q.from("newsletter_videos").delete().eq("newsletter_id",Te),await Q.from("newsletter_canva_links").delete().eq("newsletter_id",Te);for(const Pe of U){const Ue=`${Te}/${Date.now()}-${Pe.file.name}`,{error:Re}=await Q.storage.from("newsletter-content").upload(Ue,Pe.file);if(!Re){const{data:Be}=Q.storage.from("newsletter-content").getPublicUrl(Ue);S.push({name:Pe.name,file_url:Be.publicUrl,file_size:Pe.file.size,sort_order:S.length})}}_.length>0&&await Q.from("newsletter_drive_links").insert(_.map((Pe,Ue)=>({newsletter_id:Te,title:Pe.title,drive_url:Pe.drive_url,sort_order:Ue}))),S.length>0&&await Q.from("newsletter_pdfs").insert(S.map((Pe,Ue)=>({newsletter_id:Te,name:Pe.name,file_url:Pe.file_url,file_size:Pe.file_size||null,sort_order:Ue}))),M.length>0&&await Q.from("newsletter_videos").insert(M.map((Pe,Ue)=>({newsletter_id:Te,title:Pe.title,video_url:Pe.video_url,sort_order:Ue}))),A.length>0&&await Q.from("newsletter_canva_links").insert(A.map((Pe,Ue)=>({newsletter_id:Te,title:Pe.title,canva_share_link:Pe.canva_share_link,sort_order:Ue})))},se=async Te=>{o(Te),i({title:Te.title,description:Te.description||"",publish_date:mn(new Date(Te.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:Te.is_published}),y(Te.preview_image_url),R(Te.content_blocks||[]);const[Pe,Ue,Re,Be]=await Promise.all([Q.from("newsletter_drive_links").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_pdfs").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_videos").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_canva_links").select("*").eq("newsletter_id",Te.id).order("sort_order")]);w(Pe.data||[]),N(Ue.data||[]),E(Re.data||[]),P(Be.data||[]),V([]),s(!0)},fe=async Te=>{const[Pe,Ue,Re,Be]=await Promise.all([Q.from("newsletter_drive_links").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_pdfs").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_videos").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_canva_links").select("*").eq("newsletter_id",Te.id).order("sort_order")]);o(null),i({title:`${Te.title} (Copy)`,description:Te.description||"",publish_date:mn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(Te.preview_image_url),R(Te.content_blocks||[]),w((Pe.data||[]).map(({id:Ye,...ht})=>ht)),N((Ue.data||[]).map(({id:Ye,...ht})=>ht)),E((Re.data||[]).map(({id:Ye,...ht})=>ht)),P((Be.data||[]).map(({id:Ye,...ht})=>ht)),V([]),s(!0)},he=()=>{s(!1),o(null),i({title:"",description:"",publish_date:mn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),p(null),y(null),w([]),N([]),E([]),P([]),R([]),V([])},ye=async Te=>{var Ue;const Pe=(Ue=Te.target.files)==null?void 0:Ue[0];Pe&&(p(Pe),y(URL.createObjectURL(Pe)))},Ce=async()=>{if(!l.title){t({title:"Title is required",variant:"destructive"});return}W(!0);let Te=x;if(u){const Pe=`previews/${Date.now()}-${u.name}`,{error:Ue}=await Q.storage.from("newsletter-content").upload(Pe,u);if(!Ue){const{data:Re}=Q.storage.from("newsletter-content").getPublicUrl(Pe);Te=Re.publicUrl}}a?xe.mutate({id:a.id,...l,preview_image_url:Te,content_blocks:z}):oe.mutate({...l,preview_image_url:Te,content_blocks:z}),W(!1)},Se=()=>w([..._,{title:"",drive_url:"",sort_order:_.length}]),Ne=()=>E([...M,{title:"",video_url:"",sort_order:M.length}]),be=()=>P([...A,{title:"",canva_share_link:"",sort_order:A.length}]),rt=Te=>{const Pe=Te.target.files;if(!Pe)return;const Ue=Array.from(Pe).map(Re=>({file:Re,name:Re.name.replace(/\.[^/.]+$/,"")}));V([...U,...Ue])};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(ju,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(J==null?void 0:J.length)||0})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(J==null?void 0:J.filter(Te=>Te.is_published).length)||0})})]})]}),r.jsxs(Dr,{open:n,onOpenChange:Te=>!Te&&he(),children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Or,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{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(qe,{children:"Title *"}),r.jsx(ot,{value:l.title,onChange:Te=>i({...l,title:Te.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Publish Date"}),r.jsx(ot,{type:"datetime-local",value:l.publish_date,onChange:Te=>i({...l,publish_date:Te.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:l.description,onChange:Te=>i({...l,description:Te}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[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(te,{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(gs,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(ot,{type:"file",accept:"image/*",onChange:ye,className:"hidden",id:"preview-upload"}),r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(ho,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{checked:l.is_published,onCheckedChange:Te=>i({...l,is_published:Te})}),r.jsx(qe,{children:"Published"})]}),r.jsx(nNt,{rows:z,onChange:R}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:be,children:[r.jsx(_n,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),A.map((Te,Pe)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ot,{placeholder:"Link title",value:Te.title,onChange:Ue=>{const Re=[...A];Re[Pe].title=Ue.target.value,P(Re)},className:"w-1/3"}),r.jsx(ot,{placeholder:"Canva share link",value:Te.canva_share_link,onChange:Ue=>{const Re=[...A];Re[Pe].canva_share_link=Ue.target.value,P(Re)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(A.filter((Ue,Re)=>Re!==Pe)),children:r.jsx(gs,{className:"h-4 w-4"})})]},Pe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Se,children:[r.jsx(_n,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),_.map((Te,Pe)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ot,{placeholder:"Link title",value:Te.title,onChange:Ue=>{const Re=[..._];Re[Pe].title=Ue.target.value,w(Re)},className:"w-1/3"}),r.jsx(ot,{placeholder:"Google Drive URL",value:Te.drive_url,onChange:Ue=>{const Re=[..._];Re[Pe].drive_url=Ue.target.value,w(Re)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>w(_.filter((Ue,Re)=>Re!==Pe)),children:r.jsx(gs,{className:"h-4 w-4"})})]},Pe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(ot,{type:"file",accept:".pdf",multiple:!0,onChange:rt,className:"hidden",id:"pdf-upload"}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(ho,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),S.map((Te,Pe)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:Te.name}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>N(S.filter((Ue,Re)=>Re!==Pe)),children:r.jsx(gs,{className:"h-4 w-4"})})]},`existing-${Pe}`)),U.map((Te,Pe)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:Te.name,onChange:Ue=>{const Re=[...U];Re[Pe].name=Ue.target.value,V(Re)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>V(U.filter((Ue,Re)=>Re!==Pe)),children:r.jsx(gs,{className:"h-4 w-4"})})]},`pending-${Pe}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ne,children:[r.jsx(_n,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),M.map((Te,Pe)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ot,{placeholder:"Video title",value:Te.title,onChange:Ue=>{const Re=[...M];Re[Pe].title=Ue.target.value,E(Re)},className:"w-1/3"}),r.jsx(ot,{placeholder:"Video URL",value:Te.video_url,onChange:Ue=>{const Re=[...M];Re[Pe].video_url=Ue.target.value,E(Re)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(M.filter((Ue,Re)=>Re!==Pe)),children:r.jsx(gs,{className:"h-4 w-4"})})]},Pe))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(te,{variant:"outline",onClick:he,children:"Cancel"}),r.jsx(te,{onClick:Ce,disabled:K||oe.isPending||xe.isPending,children:K?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:ae?r.jsx(Mr,{children:r.jsx(jt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(J==null?void 0:J.length)===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):J==null?void 0:J.map(Te=>r.jsxs(Mr,{children:[r.jsx(jt,{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(ka,{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.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(jt,{children:mn(new Date(Te.publish_date),"MMM d, yyyy")}),r.jsx(jt,{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 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:Te.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>se(Te),title:"Edit",children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>fe(Te),title:"Duplicate",children:r.jsx(tl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",title:"Delete",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ie.mutate(Te.id)},children:r.jsx($n,{className:"h-4 w-4"})})]})})]},Te.id))})]})})})]})})}const Y4e={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 aNt(){const{user:t}=Qr(),{toast:e}=mi(),n=Gn(),s=qr(),[a,o]=I.useState(""),[l,i]=I.useState("popular"),[u,p]=I.useState(!1),[x,y]=I.useState(""),[_,w]=I.useState(""),[S,N]=I.useState(!1),{data:M=[],isLoading:E}=Kt({queryKey:["wishlist-items",l,S],queryFn:async()=>{let U=Q.from("wishlist_items").select("*");S&&t&&(U=U.eq("user_id",t.id)),l==="latest"?U=U.order("created_at",{ascending:!1}):l==="popular"?U=U.order("vote_count",{ascending:!1}):l==="trending"&&(U=U.order("vote_count",{ascending:!1}));const{data:V,error:K}=await U;if(K)throw K;const W=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:J}=await Q.from("profiles").select("id, name").in("id",W),ae=new Map((J==null?void 0:J.map(se=>[se.id,se]))||[]);let oe=[];if(t){const{data:se}=await Q.from("wishlist_votes").select("item_id").eq("user_id",t.id);oe=(se==null?void 0:se.map(fe=>fe.item_id))||[]}const xe=(V==null?void 0:V.map(se=>se.id))||[],{data:ie}=await Q.from("wishlist_comments").select("item_id").in("item_id",xe),pe=new Map;return ie==null||ie.forEach(se=>{pe.set(se.item_id,(pe.get(se.item_id)||0)+1)}),V==null?void 0:V.map(se=>{const fe=ae.get(se.user_id),he=(fe==null?void 0:fe.name)||"Unknown";return{...se,user_name:he,user_initials:he.split(" ").map(ye=>ye[0]).join("").toUpperCase().slice(0,2),has_voted:oe.includes(se.id),comment_count:pe.get(se.id)||0}})}}),A=or({mutationFn:async({title:U,description:V})=>{const{error:K}=await Q.from("wishlist_items").insert({user_id:t.id,title:U,description:V});if(K)throw K},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),p(!1),y(""),w(""),e({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:U=>{e({title:"Error",description:U.message,variant:"destructive"})}}),P=or({mutationFn:async({itemId:U,hasVoted:V})=>{if(V){const{error:K}=await Q.from("wishlist_votes").delete().eq("item_id",U).eq("user_id",t.id);if(K)throw K;return{itemId:U,wasAdded:!1}}else{const{error:K}=await Q.from("wishlist_votes").insert({item_id:U,user_id:t.id});if(K)throw K;return{itemId:U,wasAdded:!0}}},onSuccess:async U=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),U!=null&&U.wasAdded){const V=M.find(W=>W.id===U.itemId),K=((V==null?void 0:V.vote_count)||0)+1;Q.functions.invoke("wishlist-notify",{body:{itemId:U.itemId,voteCount:K}}).catch(console.error)}},onError:U=>{e({title:"Error",description:U.message,variant:"destructive"})}}),z=M.filter(U=>U.title.toLowerCase().includes(a.toLowerCase())||U.description.toLowerCase().includes(a.toLowerCase())),R=()=>{if(!x.trim()||!_.trim()){e({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}A.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(R1,{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(Dr,{open:u,onOpenChange:p,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:"Submit a New Idea"})}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title"}),r.jsx(ot,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:U=>y(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:_,onChange:U=>w(U.target.value),rows:4})]}),r.jsx(te,{onClick:R,className:"w-full",disabled:A.isPending,children:A.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search ideas...",value:a,onChange:U=>o(U.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ki,{value:l,onValueChange:U=>i(U),children:r.jsxs(pi,{children:[r.jsx(rn,{value:"popular",children:"Most Popular"}),r.jsx(rn,{value:"latest",children:"Latest"}),r.jsx(rn,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(te,{variant:S?"default":"outline",size:"sm",onClick:()=>N(!S),children:S?"Show All Ideas":"My Ideas"})}),E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Yr,{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(R1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(te,{onClick:()=>p(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:z.map(U=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${U.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:V=>{V.stopPropagation(),P.mutate({itemId:U.id,hasVoted:U.has_voted||!1})},className:zt("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",U.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(ep,{className:zt("h-4 w-4",U.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:U.vote_count})]}),r.jsx(Ys,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Xs,{className:"bg-primary/20 text-primary text-sm font-medium",children:U.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:U.title}),r.jsx(Lt,{className:zt("text-xs",Y4e[U.status].color),children:Y4e[U.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:U.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:U.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(U.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Do,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:U.comment_count})]})]})},U.id))})]})})}const X4e={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 iNt(){const{itemId:t}=td(),e=Gn(),{user:n}=Qr(),{toast:s}=mi(),a=qr(),[o,l]=I.useState(""),{data:i=!1}=Kt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:M,error:E}=await Q.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!E&&!!M},enabled:!!n}),{data:u,isLoading:p}=Kt({queryKey:["wishlist-item",t],queryFn:async()=>{const{data:M,error:E}=await Q.from("wishlist_items").select("*").eq("id",t).single();if(E)throw E;const{data:A}=await Q.from("profiles").select("name").eq("id",M.user_id).single();let P=!1;if(n){const{data:z}=await Q.from("wishlist_votes").select("id").eq("item_id",t).eq("user_id",n.id).maybeSingle();P=!!z}return{...M,user_name:(A==null?void 0:A.name)||"Unknown",user_initials:((A==null?void 0:A.name)||"U").split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),has_voted:P}}}),{data:x=[],isLoading:y}=Kt({queryKey:["wishlist-comments",t],queryFn:async()=>{const{data:M,error:E}=await Q.from("wishlist_comments").select("*").eq("item_id",t).order("created_at",{ascending:!0});if(E)throw E;const A=[...new Set((M==null?void 0:M.map(R=>R.user_id))||[])],{data:P}=await Q.from("profiles").select("id, name").in("id",A),z=new Map((P==null?void 0:P.map(R=>[R.id,R]))||[]);return M==null?void 0:M.map(R=>{const U=z.get(R.user_id),V=(U==null?void 0:U.name)||"Unknown";return{...R,user_name:V,user_initials:V.split(" ").map(K=>K[0]).join("").toUpperCase().slice(0,2)}})}}),_=or({mutationFn:async M=>{if(M){const{error:E}=await Q.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 Q.from("wishlist_votes").insert({item_id:t,user_id:n.id});if(E)throw E;return{wasAdded:!0}}},onSuccess:async M=>{if(a.invalidateQueries({queryKey:["wishlist-item",t]}),a.invalidateQueries({queryKey:["wishlist-items"]}),M!=null&&M.wasAdded&&u){const E=(u.vote_count||0)+1;Q.functions.invoke("wishlist-notify",{body:{itemId:t,voteCount:E}}).catch(console.error)}},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),w=or({mutationFn:async M=>{const{error:E}=await Q.from("wishlist_comments").insert({item_id:t,user_id:n.id,content:M});if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),l(""),s({title:"Comment added!"})},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),S=or({mutationFn:async M=>{const{error:E}=await Q.from("wishlist_comments").delete().eq("id",M);if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),s({title:"Comment deleted"})},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),N=()=>{o.trim()&&w.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"})]})}):u?r.jsx(Lr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/wishlist"),className:"mb-4",children:[r.jsx(io,{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(u.has_voted),className:zt("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",u.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(ep,{className:zt("h-5 w-5",u.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:u.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:u.title}),r.jsx(Lt,{className:zt("text-xs",X4e[u.status].color),children:X4e[u.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:u.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ys,{className:"h-6 w-6",children:r.jsx(Xs,{className:"bg-primary/20 text-primary text-xs",children:u.user_initials})}),r.jsx("span",{children:u.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(u.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(Sre,{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(te,{onClick:N,disabled:!o.trim()||w.isPending,size:"icon",className:"h-auto",children:w.isPending?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(eo,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(M=>r.jsx(Ir,{className:"h-20 w-full"},M))}):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(M=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{className:"bg-primary/20 text-primary text-xs",children:M.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:M.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(M.created_at).toLocaleDateString()})]}),r.jsx(Kye,{content:M.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===M.user_id&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>S.mutate(M.id),children:r.jsx($n,{className:"h-4 w-4"})})]},M.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(te,{variant:"link",onClick:()=>e("/wishlist"),children:"Go back to Wishlist"})]})})}const Q4e={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"}},J4e=["open","under_review","planned","in_progress","launched","declined"];function oNt(){const{toast:t}=mi(),e=Gn(),n=qr(),[s,a]=I.useState(""),[o,l]=I.useState("all"),[i,u]=I.useState(!1),[p,x]=I.useState(null),{data:y=[],isLoading:_}=Kt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:E,error:A}=await Q.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(A)throw A;const P=[...new Set((E==null?void 0:E.map(W=>W.user_id))||[])],{data:z}=await Q.from("profiles").select("id, name, email").in("id",P),R=new Map((z==null?void 0:z.map(W=>[W.id,W]))||[]),U=(E==null?void 0:E.map(W=>W.id))||[],{data:V}=await Q.from("wishlist_comments").select("item_id").in("item_id",U),K=new Map;return V==null||V.forEach(W=>{K.set(W.item_id,(K.get(W.item_id)||0)+1)}),E==null?void 0:E.map(W=>{const J=R.get(W.user_id);return{...W,user_name:(J==null?void 0:J.name)||"Unknown",user_email:(J==null?void 0:J.email)||"",comment_count:K.get(W.id)||0}})}}),w=or({mutationFn:async({itemId:E,status:A})=>{const{error:P}=await Q.from("wishlist_items").update({status:A}).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"})}}),S=or({mutationFn:async E=>{const{error:A}=await Q.from("wishlist_items").delete().eq("id",E);if(A)throw A},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),u(!1),x(null),t({title:"Item deleted!"})},onError:E=>{t({title:"Error",description:E.message,variant:"destructive"})}}),N=y.filter(E=>{const A=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 A&&P}),M={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(te,{variant:"ghost",size:"icon",onClick:()=>e("/admin"),children:r.jsx(io,{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:M.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:M.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:M.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:M.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:M.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search ideas, users...",value:s,onChange:E=>a(E.target.value),className:"pl-10"})]}),r.jsxs(xn,{value:o,onValueChange:E=>l(E),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),J4e.map(E=>r.jsx(qt,{value:E,children:Q4e[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(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):N.map(E=>r.jsxs(Mr,{className:zt(E.vote_count>=10&&"bg-primary/5"),children:[r.jsx(jt,{children:r.jsx(Lt,{variant:E.vote_count>=10?"default":"secondary",children:E.vote_count})}),r.jsx(jt,{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(jt,{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(jt,{className:"hidden sm:table-cell",children:E.comment_count}),r.jsx(jt,{children:r.jsxs(xn,{value:E.status,onValueChange:A=>w.mutate({itemId:E.id,status:A}),children:[r.jsx(fn,{className:"w-[140px] h-8",children:r.jsx(vn,{})}),r.jsx(pn,{children:J4e.map(A=>r.jsx(qt,{value:A,children:Q4e[A].label},A))})]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${E.id}`,"_blank"),children:r.jsx(Os,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(E.id),u(!0)},children:r.jsx($n,{className:"h-4 w-4"})})]})})]},E.id))})]})}),r.jsx(Dr,{open:i,onOpenChange:u,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:"Delete Wishlist Item"})}),r.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:()=>p&&S.mutate(p),disabled:S.isPending,children:S.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function lNt(){const{user:t}=Qr(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,u]=I.useState(null),[p,x]=I.useState(!1),[y,_]=I.useState(null),[w,S]=I.useState(""),[N,M]=I.useState(""),[E,A]=I.useState(""),[P,z]=I.useState(""),[R,U]=I.useState(""),[V,K]=I.useState(!1),[W,J]=I.useState(""),[ae,oe]=I.useState("once"),[xe,ie]=I.useState([]),[pe,se]=I.useState([]),[fe,he]=I.useState(!1),[ye,Ce]=I.useState(!1),[Se,Ne]=I.useState([]),[be,rt]=I.useState({total:0,dismissed:0});I.useEffect(()=>{Te()},[]);const Te=async()=>{const{data:at,error:pt}=await Q.from("levelup_briefs").select("*").order("created_at",{ascending:!1});pt?(Oe.error("Failed to fetch briefs"),console.error(pt)):n(at||[]),a(!1)},Pe=()=>{S(""),M(""),A(""),z(""),U(""),K(!1),J(new Date().toISOString().slice(0,16)),oe("once"),ie([]),se([]),u(null)},Ue=()=>{Pe(),l(!0)},Re=async at=>{u(at),S(at.title),M(at.description||""),A(at.video_url||""),z(at.graphic_url||""),U(at.graphic_link_url||""),K(at.is_published),J(at.publish_date.slice(0,16)),oe(at.show_frequency);const{data:pt}=await Q.from("levelup_brief_links").select("*").eq("brief_id",at.id).order("sort_order");ie((pt==null?void 0:pt.map(Mt=>({title:Mt.title,url:Mt.url})))||[]);const{data:gt}=await Q.from("levelup_brief_polls").select("*").eq("brief_id",at.id).order("sort_order");if(gt){const Mt=[];for(const wt of gt){const{data:Xt}=await Q.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:(Xt==null?void 0:Xt.map(Sr=>Sr.option_text))||[]})}se(Mt)}l(!0)},Be=async at=>{var gt;const pt=(gt=at.target.files)==null?void 0:gt[0];if(pt){he(!0);try{const Mt=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:pt.name.replace(/\.[^/.]+$/,"")}});if(Mt.error)throw Mt.error;const{videoId:wt,libraryId:Xt}=Mt.data,Sr=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:wt}});if(Sr.error)throw Sr.error;const{uploadUrl:an,apiKey:wn}=Sr.data,Xr=new XMLHttpRequest;await new Promise((Ns,hr)=>{Xr.upload.addEventListener("progress",ys=>{if(ys.lengthComputable){const Ca=Math.round(ys.loaded/ys.total*100);console.log("Upload progress:",Ca)}}),Xr.addEventListener("load",()=>{Xr.status>=200&&Xr.status<300?Ns():hr(new Error(`Upload failed with status ${Xr.status}`))}),Xr.addEventListener("error",()=>hr(new Error("Upload failed"))),Xr.open("PUT",an),Xr.setRequestHeader("AccessKey",wn),Xr.send(pt)});const Pn=`https://player.mediadelivery.net/embed/${Xt}/${wt}`;A(Pn),Oe.success("Video uploaded successfully! It may take a few minutes to process.")}catch(Mt){console.error("Upload error:",Mt),Oe.error("Failed to upload video")}finally{he(!1)}}},Ye=async()=>{if(!w.trim()){Oe.error("Title is required");return}try{let at;if(i){const{error:pt}=await Q.from("levelup_briefs").update({title:w,description:N||null,video_url:E||null,graphic_url:P||null,graphic_link_url:R||null,is_published:V,publish_date:W,show_frequency:ae}).eq("id",i.id);if(pt)throw pt;at=i.id,await Q.from("levelup_brief_links").delete().eq("brief_id",at);const{data:gt}=await Q.from("levelup_brief_polls").select("id").eq("brief_id",at);if(gt)for(const Mt of gt)await Q.from("levelup_brief_poll_options").delete().eq("poll_id",Mt.id);await Q.from("levelup_brief_polls").delete().eq("brief_id",at)}else{const{data:pt,error:gt}=await Q.from("levelup_briefs").insert({title:w,description:N||null,video_url:E||null,graphic_url:P||null,graphic_link_url:R||null,is_published:V,publish_date:W,show_frequency:ae,created_by:t==null?void 0:t.id}).select().single();if(gt)throw gt;at=pt.id}if(xe.length>0){const pt=xe.map((gt,Mt)=>({brief_id:at,title:gt.title,url:gt.url,sort_order:Mt}));await Q.from("levelup_brief_links").insert(pt)}for(let pt=0;pt0){const Xt=gt.options.map((Sr,an)=>({poll_id:Mt.id,option_text:Sr,sort_order:an}));await Q.from("levelup_brief_poll_options").insert(Xt)}}Oe.success(i?"Brief updated":"Brief created"),l(!1),Pe(),Te()}catch(at){console.error("Error saving brief:",at),Oe.error("Failed to save brief")}},ht=async at=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:pt}=await Q.from("levelup_briefs").delete().eq("id",at);if(pt)throw pt;Oe.success("Brief deleted"),Te()}catch(pt){console.error("Error deleting brief:",pt),Oe.error("Failed to delete brief")}},Me=async at=>{_(at);const{count:pt}=await Q.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",at.id),{count:gt}=await Q.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",at.id).not("dismissed_at","is",null);rt({total:pt||0,dismissed:gt||0});const{data:Mt}=await Q.from("levelup_brief_polls").select("*").eq("brief_id",at.id).order("sort_order");if(Mt){const wt=[];for(const Xt of Mt){const{data:Sr}=await Q.from("levelup_brief_poll_options").select("*").eq("poll_id",Xt.id).order("sort_order"),{data:an}=await Q.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",Xt.id),wn={};let Xr=0;Sr&&Sr.forEach(Pn=>{const Ns=(an==null?void 0:an.filter(hr=>hr.option_id===Pn.id).length)||0;wn[Pn.id]=Ns,Xr+=Ns}),wt.push({...Xt,options:Sr||[],results:wn,totalResponses:Xt.poll_type==="single"?new Set(an==null?void 0:an.map(Pn=>Pn.option_id)).size:Xr})}Ne(wt)}x(!0)},Qe=()=>{ie([...xe,{title:"",url:""}])},le=(at,pt,gt)=>{const Mt=[...xe];Mt[at][pt]=gt,ie(Mt)},Ve=at=>{ie(xe.filter((pt,gt)=>gt!==at))},Le=()=>{se([...pe,{question:"",poll_type:"single",options:["",""]}])},We=(at,pt)=>{const gt=[...pe];gt[at].question=pt,se(gt)},_e=(at,pt)=>{const gt=[...pe];gt[at].poll_type=pt,se(gt)},st=at=>{const pt=[...pe];pt[at].options.push(""),se(pt)},ze=(at,pt,gt)=>{const Mt=[...pe];Mt[at].options[pt]=gt,se(Mt)},Ee=(at,pt)=>{const gt=[...pe];gt[at].options=gt[at].options.filter((Mt,wt)=>wt!==pt),se(gt)},Je=at=>{se(pe.filter((pt,gt)=>gt!==at))};return r.jsxs(Lr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(te,{onClick:Ue,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):e.length===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):e.map(at=>r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:at.title}),r.jsx(jt,{children:r.jsx(Lt,{variant:at.is_published?"default":"secondary",children:at.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"capitalize",children:at.show_frequency.replace("_"," ")}),r.jsx(jt,{children:mn(new Date(at.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Me(at),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Re(at),children:r.jsx(hc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ht(at.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},at.id))})]})})})]}),r.jsx(Dr,{open:o,onOpenChange:l,children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(ki,{defaultValue:"content",className:"w-full",children:[r.jsxs(pi,{className:"grid w-full grid-cols-4",children:[r.jsx(rn,{value:"content",children:"Content"}),r.jsx(rn,{value:"media",children:"Media"}),r.jsx(rn,{value:"links",children:"Links"}),r.jsx(rn,{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(qe,{children:"Title *"}),r.jsx(ot,{value:w,onChange:at=>S(at.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:N,onChange:at=>M(at),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Publish Date"}),r.jsx(ot,{type:"datetime-local",value:W,onChange:at=>J(at.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Show Frequency"}),r.jsxs(xn,{value:ae,onValueChange:oe,children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(Ss,{checked:V,onCheckedChange:K}),r.jsx(qe,{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(qe,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ot,{type:"file",accept:"video/*",onChange:Be,disabled:fe})}),fe&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Or paste embed URL"}),r.jsx(ot,{value:E,onChange:at=>A(at.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(qe,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ot,{type:"file",accept:"image/*",onChange:async at=>{var gt;const pt=(gt=at.target.files)==null?void 0:gt[0];if(pt){Ce(!0);try{const Mt=pt.name.split(".").pop(),wt=`brief-graphics/${Date.now()}.${Mt}`,{error:Xt}=await Q.storage.from("banner-images").upload(wt,pt,{upsert:!0});if(Xt)throw Xt;const{data:Sr}=Q.storage.from("banner-images").getPublicUrl(wt);z(Sr.publicUrl),Oe.success("Image uploaded!")}catch(Mt){console.error(Mt),Oe.error("Failed to upload image")}finally{Ce(!1)}}},disabled:ye})}),ye&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Or paste Image URL"}),r.jsx(ot,{value:P,onChange:at=>z(at.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Click-through Link (optional)"}),r.jsx(ot,{value:R,onChange:at=>U(at.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(qe,{children:"Quick Links"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:Qe,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),xe.map((at,pt)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(ot,{value:at.title,onChange:gt=>le(pt,"title",gt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(ot,{value:at.url,onChange:gt=>le(pt,"url",gt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Ve(pt),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]},pt)),xe.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(qe,{children:"Polls"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:Le,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),pe.map((at,pt)=>r.jsx(Ke,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{value:at.question,onChange:gt=>We(pt,gt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(xn,{value:at.poll_type,onValueChange:gt=>_e(pt,gt),children:[r.jsx(fn,{className:"w-32",children:r.jsx(vn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"single",children:"Single"}),r.jsx(qt,{value:"multi",children:"Multi-select"})]})]}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Je(pt),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[at.options.map((gt,Mt)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:gt,onChange:wt=>ze(pt,Mt,wt.target.value),placeholder:`Option ${Mt+1}`}),at.options.length>2&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Ee(pt,Mt),children:r.jsx($n,{className:"h-4 w-4 text-muted-foreground"})})]},Mt)),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>st(pt),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},pt)),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(te,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(te,{onClick:Ye,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Dr,{open:p,onOpenChange:x,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsx(Br,{children:r.jsxs(zr,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:be.total})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:be.dismissed})})]})]}),Se.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),Se.map(at=>r.jsxs(Ke,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:at.question}),r.jsx("div",{className:"space-y-2",children:at.options.map(pt=>{const gt=at.results[pt.id]||0,Mt=at.totalResponses>0?Math.round(gt/at.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:pt.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[gt," (",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}%`}})})]},pt.id)})})]},at.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const cNt=()=>{const{user:t}=Qr(),{toast:e}=mi(),n=qr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,u]=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:w=[],isLoading:S}=Kt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:R,error:U}=await Q.from("additional_services").select("*").order("publish_date",{ascending:!1});if(U)throw U;return R}}),N=or({mutationFn:async R=>{let U=R.existingImageUrl;if(R.image){const K=R.image.name.split(".").pop(),W=`${Date.now()}-${Math.random().toString(36).substring(7)}.${K}`,{error:J}=await Q.storage.from("service-images").upload(W,R.image);if(J)throw J;const{data:ae}=Q.storage.from("service-images").getPublicUrl(W);U=ae.publicUrl}const V={name:R.item.name,description:R.item.description||null,preview_image_url:U,signup_link_url:R.item.signup_link_url,publish_date:R.item.publish_date?new Date(R.item.publish_date).toISOString():new Date().toISOString(),is_published:R.item.is_published,created_by:t==null?void 0:t.id};if(R.itemId){const{error:K}=await Q.from("additional_services").update(V).eq("id",R.itemId);if(K)throw K}else{const{error:K}=await Q.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:R=>{e({title:"Error saving service",description:R.message,variant:"destructive"})}}),M=or({mutationFn:async R=>{const{error:U}=await Q.from("additional_services").delete().eq("id",R);if(U)throw U},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:"Service deleted"})},onError:R=>{e({title:"Error deleting service",description:R.message,variant:"destructive"})}}),E=()=>{u({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),l(null)},A=R=>{l(R),u({name:R.name,description:R.description||"",signup_link_url:R.signup_link_url,publish_date:R.publish_date?new Date(R.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:R.is_published}),_(R.preview_image_url||""),a(!0)},P=R=>{var V;const U=(V=R.target.files)==null?void 0:V[0];U&&(x(U),_(URL.createObjectURL(U)))},z=R=>{if(R.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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:w.length})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:w.filter(R=>R.is_published).length})})]})]}),r.jsxs(Dr,{open:s,onOpenChange:R=>{a(R),R||E()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{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(qe,{htmlFor:"name",children:"Name *"}),r.jsx(ot,{id:"name",value:i.name,onChange:R=>u({...i,name:R.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(Yg,{content:i.description,onChange:R=>u({...i,description:R}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(ot,{id:"signup_link_url",type:"url",value:i.signup_link_url,onChange:R=>u({...i,signup_link_url:R.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:i.publish_date,onChange:R=>u({...i,publish_date:R.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ss,{id:"is_published",checked:i.is_published,onCheckedChange:R=>u({...i,is_published:R})}),r.jsx(qe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{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(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),_("")},children:r.jsx(gs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Ol,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(ot,{type:"file",accept:"image/*",onChange:P,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:S?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"})}):w.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(Mr,{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:w.map(R=>r.jsxs(Mr,{children:[r.jsx(jt,{children:R.preview_image_url?r.jsx("img",{src:R.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(Ol,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(jt,{className:"font-medium",children:R.name}),r.jsx(jt,{children:r.jsxs("a",{href:R.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Os,{className:"h-3 w-3"}),"Link"]})}),r.jsx(jt,{children:new Date(R.publish_date).toLocaleDateString()}),r.jsx(jt,{children:r.jsx(Lt,{variant:R.is_published?"default":"secondary",children:R.is_published?"Published":"Draft"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>A(R),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&M.mutate(R.id)},children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})})})]})})};function dNt(){const{toast:t}=mi(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,u]=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:M,error:E}=await Q.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(E)throw E;n(M.coupons||[])}catch(M){console.error("Error fetching coupons:",M),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 M={action:"create",name:p.name,duration:p.duration,promotion_code:p.promotionCode.trim()||void 0};p.discountType==="percent"?M.percent_off=parseFloat(p.percentOff):(M.amount_off=Math.round(parseFloat(p.amountOff)*100),M.currency="usd"),p.duration==="repeating"&&(M.duration_in_months=parseInt(p.durationInMonths));const{data:E,error:A}=await Q.functions.invoke("stripe-manage-coupons",{body:M});if(A)throw A;t({title:"Success",description:"Coupon created successfully"}),u(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(M){console.error("Error creating coupon:",M),t({title:"Error",description:M.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},w=async M=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:E}=await Q.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:M}});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"})}},S=M=>M.percent_off?`${M.percent_off}% off`:M.amount_off?`$${(M.amount_off/100).toFixed(2)} off`:"N/A",N=M=>{switch(M.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${M.duration_in_months} months`;default:return M.duration}};return r.jsx(Lr,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Dr,{open:i,onOpenChange:u,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create New Coupon"}),r.jsx(Jn,{children:"Create a discount coupon that can be applied to subscriptions"})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Promotion Code (what users will type)"}),r.jsx(ot,{placeholder:"e.g., BROKERAGE50",value:p.promotionCode,onChange:M=>x({...p,promotionCode:M.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Coupon Name (internal label)"}),r.jsx(ot,{placeholder:"e.g., 50% Off Brokerage Launch",value:p.name,onChange:M=>x({...p,name:M.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Discount Type"}),r.jsxs(xn,{value:p.discountType,onValueChange:M=>{const E=M==="amount"&&p.duration==="forever"?"once":p.duration;x({...p,discountType:M,duration:E})},children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(jS,{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(wd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),p.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(ot,{type:"number",min:"1",max:"100",placeholder:"20",value:p.percentOff,onChange:M=>x({...p,percentOff:M.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Amount Off (USD)"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(ot,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:p.amountOff,onChange:M=>x({...p,amountOff:M.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Duration"}),r.jsxs(xn,{value:p.duration,onValueChange:M=>x({...p,duration:M}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(qe,{children:"Number of Months"}),r.jsx(ot,{type:"number",min:"1",placeholder:"3",value:p.durationInMonths,onChange:M=>x({...p,durationInMonths:M.target.value})})]}),r.jsx(te,{onClick:_,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Active Coupons"}),r.jsx(Cn,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Yr,{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(Mr,{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(M=>{var E;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-mono font-medium",children:((E=M.promotion_codes)==null?void 0:E.length)>0?M.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(jt,{children:M.name||"-"}),r.jsx(jt,{children:S(M)}),r.jsx(jt,{children:N(M)}),r.jsx(jt,{children:M.times_redeemed}),r.jsx(jt,{children:r.jsx(Lt,{variant:M.valid?"default":"secondary",children:M.valid?"Active":"Inactive"})}),r.jsx(jt,{className:"text-right",children:r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(M.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})})]},M.id)})})]})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"How to Use Coupons"})}),r.jsxs(et,{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 Qce={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 uNt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState(null),{data:l,isLoading:i,refetch:u}=Kt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:S,error:N}=await Q.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(N)throw N;return S}}),{data:p}=Kt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:S,error:N}=await Q.from("brokerages").select("*").order("name");if(N)throw N;return await Promise.all((S||[]).map(async E=>{const{data:A}=await Q.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",E.id),{data:P}=await Q.from("user_roles").select("user_id").eq("role","brokerage_manager"),z=(P==null?void 0:P.map(V=>V.user_id))||[],R=(A==null?void 0:A.filter(V=>z.includes(V.id)))||[],U=(A==null?void 0:A.length)||0;return{...E,managers:R,agentCount:U}}))}}),x=S=>{if(S.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(S.brokerage_id&&!S.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(S.is_trial&&S.trial_expires_at)return new Date(S.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(S.subscription_status==="active"||S.subscription_status==="trialing"){const N=Qce[S.subscription_product_id];return{status:(N==null?void 0:N.name)||"Active",badge:S.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return S.subscription_status==="canceled"||S.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},y=l==null?void 0:l.filter(S=>{var M,E;if(!(((M=S.name)==null?void 0:M.toLowerCase().includes(t.toLowerCase()))||((E=S.email)==null?void 0:E.toLowerCase().includes(t.toLowerCase()))))return!1;switch(x(S),n){case"active":return S.subscription_status==="active";case"trialing":return S.subscription_status==="trialing"||S.is_trial&&new Date(S.trial_expires_at)>new Date;case"grandfathered":return S.is_grandfathered;case"brokerage":return S.brokerage_id&&!S.subscription_product_id&&!S.is_grandfathered;case"expired":return S.subscription_status==="canceled"||S.subscription_status==="past_due"||S.is_trial&&new Date(S.trial_expires_at)<=new Date;case"none":return!S.subscription_status||S.subscription_status==="none";default:return!0}}),_={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(S=>S.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(S=>S.subscription_status==="trialing"||S.is_trial&&new Date(S.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(S=>S.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(S=>S.brokerage_id&&!S.subscription_product_id&&!S.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(S=>S.subscription_status==="active"&&S.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(S=>S.subscription_status==="active"&&(S.subscription_product_id==="prod_Tc08MupgoVySDG"||S.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},w=S=>{window.open(`https://dashboard.stripe.com/customers/${S}`,"_blank")};return r.jsx(Lr,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(te,{onClick:()=>u(),variant:"outline",size:"sm",children:[r.jsx(Ll,{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(Ke,{children:r.jsxs(et,{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(Ke,{className:"border-green-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bm,{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(Ke,{className:"border-blue-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wa,{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(Ke,{className:"border-purple-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A1,{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(Ke,{className:"border-orange-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{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(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Pj,{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(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{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(ki,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"users",children:"All Users"}),r.jsx(rn,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:t,onChange:S=>e(S.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:n,onValueChange:S=>s(S),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(vn,{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(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(S=>{var E,A;const N=x(S),M=Qce[S.subscription_product_id];return r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:S.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:S.email})]})}),r.jsx(jt,{children:r.jsx(Lt,{variant:N.variant,children:N.badge})}),r.jsx(jt,{children:r.jsx("span",{className:"text-sm",children:S.is_grandfathered?"Legacy Access":S.brokerage_id&&!S.subscription_product_id?"Brokerage Subscription":(M==null?void 0:M.name)||N.status})}),r.jsx(jt,{children:(E=S.brokerages)!=null&&E.name?r.jsx("span",{className:"text-sm",children:S.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(jt,{children:S.subscription_end_date?r.jsx("span",{className:"text-sm",children:mn(new Date(S.subscription_end_date),"MMM d, yyyy")}):S.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",mn(new Date(S.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[S.stripe_customer_id&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(S.stripe_customer_id),children:r.jsx(Os,{className:"h-4 w-4"})}),r.jsxs(Dr,{children:[r.jsx(Uo,{asChild:!0,children:r.jsx(te,{variant:"outline",size:"sm",onClick:()=>o(S),children:"Details"})}),r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Subscription Details"}),r.jsxs(Jn,{children:[S.name," (",S.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(Lt,{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:S.is_grandfathered?"Grandfathered (Legacy)":S.brokerage_id&&!S.subscription_product_id?"Brokerage Subscription":(M==null?void 0:M.name)||"None"})]}),S.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((A=S.brokerages)==null?void 0:A.name)||"Unknown"})]}),S.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:mn(new Date(S.subscription_end_date),"MMMM d, yyyy")})]}),S.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:mn(new Date(S.trial_expires_at),"MMMM d, yyyy")})]}),S.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:S.stripe_customer_id})]})]}),S.stripe_customer_id&&r.jsxs(te,{className:"w-full",onClick:()=>w(S.stripe_customer_id),children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},S.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(S=>{var M,E;const N=(M=S.managers)==null?void 0:M.some(A=>A.subscription_status==="active"&&(A.subscription_product_id==="prod_Tc08MupgoVySDG"||A.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:r.jsx(li,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:S.name}),r.jsxs(Cn,{children:[S.agentCount," agents"]})]})]}),r.jsx(Lt,{variant:N?"default":"outline",children:N?"Active Subscription":"No Active Subscription"})]})}),r.jsx(et,{children:((E=S.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:"}),S.managers.map(A=>{const P=Qce[A.subscription_product_id];return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:A.email})]}),r.jsx("div",{className:"text-right",children:P?r.jsxs("div",{children:[r.jsx(Lt,{variant:"default",children:P.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:P.price})]}):r.jsx(Lt,{variant:"outline",children:"No Subscription"})})]},A.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},S.id)})})})]})]})})}function hNt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(""),[l,i]=I.useState("all"),[u,p]=I.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:S,error:N}=await Q.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(S||[]);const M=(S==null?void 0:S.filter(P=>P.status==="qualified").length)||0,E=(S==null?void 0:S.filter(P=>P.status==="pending").length)||0,A=(S==null?void 0:S.filter(P=>P.status==="cancelled").length)||0;p({total:(S==null?void 0:S.length)||0,qualified:M,pending:E,cancelled:A,totalDiscounts:M*25})}catch(S){console.error("Error fetching referrals:",S),Oe.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{Oe.loading("Processing qualifications...");const{error:S}=await Q.functions.invoke("process-referral-qualifications");if(S)throw S;Oe.dismiss(),Oe.success("Qualifications processed successfully"),x()}catch(S){Oe.dismiss(),console.error("Error processing qualifications:",S),Oe.error("Failed to process qualifications")}},_=t.filter(S=>{var E,A,P,z,R,U;const N=((A=(E=S.referrer_brokerage)==null?void 0:E.name)==null?void 0:A.toLowerCase().includes(a.toLowerCase()))||((z=(P=S.referred_brokerage)==null?void 0:P.name)==null?void 0:z.toLowerCase().includes(a.toLowerCase()))||((U=(R=S.referred_user)==null?void 0:R.email)==null?void 0:U.toLowerCase().includes(a.toLowerCase())),M=l==="all"||S.status===l;return N&&M}),w=S=>{switch(S){case"qualified":return r.jsxs(Lt,{className:"bg-green-100 text-green-800",children:[r.jsx(Ii,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Lt,{variant:"secondary",children:[r.jsx(Wa,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Lt,{variant:"destructive",children:[r.jsx(Lc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Lt,{children:S})}};return r.jsx(Lr,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(te,{onClick:y,variant:"outline",children:[r.jsx(Ll,{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(Ke,{children:r.jsx(et,{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:u.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ii,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Lc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wd,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",u.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"All Referrals"}),r.jsx(Cn,{children:"View and manage all referral relationships"})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by brokerage or email...",value:a,onChange:S=>o(S.target.value),className:"pl-10"})]}),r.jsxs(xn,{value:l,onValueChange:i,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{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(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):_.map(S=>{var N,M,E,A;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:((N=S.referrer_brokerage)==null?void 0:N.name)||"Unknown"}),r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((M=S.referred_brokerage)==null?void 0:M.name)||((E=S.referred_user)==null?void 0:E.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(A=S.referred_user)==null?void 0:A.email})]})}),r.jsx(jt,{children:mn(new Date(S.signup_date),"MMM d, yyyy")}),r.jsx(jt,{children:w(S.status)}),r.jsx(jt,{children:S.qualified_date?mn(new Date(S.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(jt,{children:S.discount_applied?r.jsx(Lt,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},S.id)})})]})]})]})]})})}const Jce=[{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"}],fNt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function pNt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(null),[u,p]=I.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:A,error:P}=await Q.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(P)throw P;e(A||[])}catch(A){console.error("Error fetching checklist items:",A),Oe.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)},_=A=>{i(A),p({title:A.title,description:A.description||"",action_type:A.action_type,target_role:A.target_role,is_active:A.is_active}),o(!0)},w=async()=>{if(!u.title.trim()){Oe.error("Title is required");return}try{if(l){const{error:A}=await Q.from("onboarding_checklist_items").update({title:u.title,description:u.description||null,action_type:u.action_type,target_role:u.target_role,is_active:u.is_active}).eq("id",l.id);if(A)throw A;Oe.success("Checklist item updated")}else{const A=t.filter(z=>z.target_role===u.target_role).reduce((z,R)=>Math.max(z,R.sort_order),-1),{error:P}=await Q.from("onboarding_checklist_items").insert({title:u.title,description:u.description||null,action_type:u.action_type,target_role:u.target_role,is_active:u.is_active,sort_order:A+1});if(P)throw P;Oe.success("Checklist item created")}o(!1),x()}catch(A){console.error("Error saving checklist item:",A),Oe.error("Failed to save checklist item")}},S=async A=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:P}=await Q.from("onboarding_checklist_items").delete().eq("id",A);if(P)throw P;Oe.success("Checklist item deleted"),x()}catch(P){console.error("Error deleting checklist item:",P),Oe.error("Failed to delete checklist item")}},N=async A=>{try{const{error:P}=await Q.from("onboarding_checklist_items").update({is_active:!A.is_active}).eq("id",A.id);if(P)throw P;Oe.success(A.is_active?"Item deactivated":"Item activated"),x()}catch(P){console.error("Error toggling item:",P),Oe.error("Failed to update item")}},M=t.filter(A=>A.target_role==="brokerage_manager"),E=t.filter(A=>A.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(te,{onClick:y,className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Lt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(et,{children:M.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(Mr,{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:M.map((A,P)=>{var z;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"text-muted-foreground",children:P+1}),r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.title}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",children:((z=Jce.find(R=>R.value===A.action_type))==null?void 0:z.label)||A.action_type})}),r.jsx(jt,{children:r.jsx(Ss,{checked:A.is_active,onCheckedChange:()=>N(A)})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>_(A),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>S(A.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},A.id)})})]})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Lt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(et,{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(Mr,{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((A,P)=>{var z;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"text-muted-foreground",children:P+1}),r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.title}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",children:((z=Jce.find(R=>R.value===A.action_type))==null?void 0:z.label)||A.action_type})}),r.jsx(jt,{children:r.jsx(Ss,{checked:A.is_active,onCheckedChange:()=>N(A)})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>_(A),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>S(A.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},A.id)})})]})})]})]}),r.jsx(Dr,{open:a,onOpenChange:o,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{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(qe,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:u.title,onChange:A=>p({...u,title:A.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",value:u.description,onChange:A=>p({...u,description:A.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Target Role"}),r.jsxs(xn,{value:u.target_role,onValueChange:A=>p({...u,target_role:A}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:fNt.map(A=>r.jsx(qt,{value:A.value,children:A.label},A.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Action Type"}),r.jsxs(xn,{value:u.action_type,onValueChange:A=>p({...u,action_type:A}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:Jce.map(A=>r.jsx(qt,{value:A.value,children:A.label},A.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{id:"is_active",checked:u.is_active,onCheckedChange:A=>p({...u,is_active:A})}),r.jsx(qe,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{onClick:w,children:l?"Save Changes":"Create Item"})]})]})})]})}function mNt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState("name"),[l,i]=I.useState("asc"),[u,p]=I.useState(""),[x,y]=I.useState(""),[_,w]=I.useState(""),[S,N]=I.useState(""),{data:M}=Kt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:W,error:J}=await Q.from("brokerages").select("id, name").order("name");if(J)throw J;return W}}),E=async W=>{let ae=[],oe=0,xe=!0;for(;xe;){const{data:ie,error:pe}=await W(oe,oe+1e3-1);if(pe)throw pe;ie&&ie.length>0?(ae=[...ae,...ie],oe+=1e3,xe=ie.length===1e3):xe=!1}return ae},{data:A,isLoading:P}=Kt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const W=await E((be,rt)=>Q.from("profiles").select("id, name, email, brokerage_id, created_at").range(be,rt)),{data:J}=await Q.from("brokerages").select("id, name"),ae=new Map((J==null?void 0:J.map(be=>[be.id,be.name]))||[]),{data:oe}=await Q.rpc("get_admin_contact_counts"),xe=new Map;oe==null||oe.forEach(be=>{xe.set(be.owner_user_id,be.contact_count)});const{data:ie}=await Q.rpc("get_admin_video_counts"),pe=new Map;ie==null||ie.forEach(be=>{pe.set(be.owner_user_id,be.video_count)});const{data:se}=await Q.rpc("get_admin_popby_counts"),fe=new Map;se==null||se.forEach(be=>{fe.set(be.owner_user_id,be.popby_count)});const{data:he}=await Q.rpc("get_admin_listing_counts"),ye=new Map;he==null||he.forEach(be=>{ye.set(be.agent_id,be.listing_count)});const{data:Ce}=await Q.rpc("get_admin_deal_counts"),Se=new Map;return Ce==null||Ce.forEach(be=>{Se.set(be.owner_user_id,be.deal_count)}),W.map(be=>({id:be.id,name:be.name||"Unknown",email:be.email||"",brokerage_id:be.brokerage_id,brokerage_name:be.brokerage_id&&ae.get(be.brokerage_id)||null,contact_count:xe.get(be.id)||0,video_count:pe.get(be.id)||0,popby_count:fe.get(be.id)||0,listing_count:ye.get(be.id)||0,deal_count:Se.get(be.id)||0,created_at:be.created_at}))}}),z=I.useMemo(()=>{if(!A)return[];let W=A.filter(J=>{const ae=t.toLowerCase(),oe=!t||J.name.toLowerCase().includes(ae)||J.email.toLowerCase().includes(ae),xe=n==="all"||n==="none"&&!J.brokerage_id||J.brokerage_id===n,ie=parseInt(u)||0,pe=parseInt(x)||0,se=parseInt(_)||0,fe=parseInt(S)||0,he=J.contact_count>=ie&&J.video_count>=pe&&J.popby_count>=se&&J.listing_count>=fe;return oe&&xe&&he});return W.sort((J,ae)=>{let oe=0;return a==="name"?oe=J.name.localeCompare(ae.name):oe=J[a]-ae[a],l==="asc"?oe:-oe}),W},[A,t,n,a,l,u,x,_,S]),R=W=>{a===W?i(l==="asc"?"desc":"asc"):(o(W),i("desc"))},U=()=>{const W=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings","Deals"],J=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]),ae=[W.join(","),...J.map(pe=>pe.map(se=>`"${se}"`).join(","))].join(` `),oe=new Blob([ae],{type:"text/csv"}),xe=URL.createObjectURL(oe),ie=document.createElement("a");ie.href=xe,ie.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ie.click(),URL.revokeObjectURL(xe)},V=I.useMemo(()=>z.length?z.reduce((W,J)=>({contacts:W.contacts+J.contact_count,videos:W.videos+J.video_count,popbys:W.popbys+J.popby_count,listings:W.listings+J.listing_count,deals:W.deals+J.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:W,children:J})=>r.jsx(It,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>R(W),children:r.jsxs("div",{className:"flex items-center gap-1",children:[J,r.jsx(jg,{className:`h-3 w-3 ${a===W?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ke,{children:[r.jsx(Ht,{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(Cn,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:U,children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(et,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:t,onChange:W=>e(W.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(xn,{value:n,onValueChange:s,children:[r.jsxs(fn,{children:[r.jsx(li,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(vn,{placeholder:"Brokerage"})]}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Brokerages"}),r.jsx(qt,{value:"none",children:"No Brokerage"}),M==null?void 0:M.map(W=>r.jsx(qt,{value:W.id,children:W.name},W.id))]})]})}),r.jsx("div",{children:r.jsx(ot,{type:"number",placeholder:"Min contacts",value:u,onChange:W=>p(W.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(ot,{type:"number",placeholder:"Min videos",value:x,onChange:W=>y(W.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(ot,{type:"number",placeholder:"Min popbys",value:_,onChange:W=>w(W.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(Yr,{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(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):z.map(W=>r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:W.name}),r.jsx(jt,{className:"text-muted-foreground",children:W.email}),r.jsx(jt,{children:W.brokerage_name?r.jsx(Lt,{variant:"secondary",children:W.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(jt,{children:r.jsx(Lt,{variant:W.contact_count>0?"default":"outline",children:W.contact_count})}),r.jsx(jt,{children:r.jsx(Lt,{variant:W.video_count>0?"default":"outline",children:W.video_count})}),r.jsx(jt,{children:r.jsx(Lt,{variant:W.popby_count>0?"default":"outline",children:W.popby_count})}),r.jsx(jt,{children:r.jsx(Lt,{variant:W.listing_count>0?"default":"outline",children:W.listing_count})}),r.jsx(jt,{children:r.jsx(Lt,{variant:W.deal_count>0?"default":"outline",children:W.deal_count})})]},W.id))})]})})]})]})}function gNt(){mi(),qr();const[t,e]=I.useState("user-analytics"),{data:n}=Kt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:w,error:S}=await Q.from("feature_flags").select("*").order("key");if(S)throw S;return w}}),{data:s,isLoading:a}=Kt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:w,error:S}=await Q.from("relationship_types").select("*").order("sort_order");if(S)throw S;return w}}),{data:o,isLoading:l}=Kt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:w,error:S}=await Q.from("action_types").select("*").order("sort_order");if(S)throw S;return w}}),{data:i,isLoading:u}=Kt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:w,error:S}=await Q.from("action_scripts").select("*, action_type:action_types(*)");if(S)throw S;return w}}),{data:p,isLoading:x}=Kt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:w,error:S}=await Q.from("touchpoint_plans").select("*").order("name");if(S)throw S;return w}}),{data:y,isLoading:_}=Kt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:w,error:S}=await Q.from("popby_items").select("*").is("owner_user_id",null).order("name");if(S)throw S;return w}});return r.jsx(Lr,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(ki,{value:t,onValueChange:e,children:[r.jsxs(pi,{className:"grid w-full grid-cols-9",children:[r.jsxs(rn,{value:"user-analytics",className:"gap-2",children:[r.jsx(gc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(rn,{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(rn,{value:"action-types",className:"gap-2",children:[r.jsx(ji,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(rn,{value:"scripts",className:"gap-2",children:[r.jsx(ka,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(rn,{value:"video-scripts",className:"gap-2",children:[r.jsx($d,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(rn,{value:"plans",className:"gap-2",children:[r.jsx(Ds,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(rn,{value:"popbys",className:"gap-2",children:[r.jsx(Zi,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(rn,{value:"settings",className:"gap-2",children:[r.jsx(jd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(rn,{value:"feature-flags",className:"gap-2",children:[r.jsx(Jx,{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(mNt,{})}),r.jsx(Sn,{value:"relationship-types",className:"mt-6",children:r.jsx(xNt,{types:s||[],isLoading:a})}),r.jsx(Sn,{value:"action-types",className:"mt-6",children:r.jsx(yNt,{types:o||[],isLoading:l})}),r.jsx(Sn,{value:"scripts",className:"mt-6",children:r.jsx(vNt,{scripts:i||[],actionTypes:o||[],isLoading:u})}),r.jsx(Sn,{value:"video-scripts",className:"mt-6",children:r.jsx(jNt,{})}),r.jsx(Sn,{value:"plans",className:"mt-6",children:r.jsx(_Nt,{plans:p||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(Sn,{value:"popbys",className:"mt-6",children:r.jsx(wNt,{items:y||[],isLoading:_})}),r.jsx(Sn,{value:"settings",className:"mt-6",children:r.jsx(kNt,{})}),r.jsx(Sn,{value:"feature-flags",className:"mt-6",children:r.jsx(bNt,{flags:n||[]})})]})]})})}function xNt({types:t,isLoading:e}){const{toast:n}=mi(),s=qr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),u=or({mutationFn:async x=>{if(x.id){const{error:y}=await Q.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 Q.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 Q.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Relationship Types"}),r.jsx(Cn,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(te,{onClick:()=>{o(null),i(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(et,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:[r.jsx(jt,{children:r.jsx(D1,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(jt,{className:"font-medium",children:x.name}),r.jsx(jt,{className:"text-muted-foreground",children:x.description}),r.jsx(jt,{children:r.jsx(Ss,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(jt,{children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(ni,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{children:[a?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);u.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(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"icon",children:"Icon"}),r.jsx(ot,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function yNt({types:t,isLoading:e}){const{toast:n}=mi(),s=qr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),u=or({mutationFn:async x=>{if(x.id){const{error:y}=await Q.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 Q.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 Q.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Action Types"}),r.jsx(Cn,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(te,{onClick:()=>{o(null),i(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(et,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-medium",children:x.name}),r.jsx(jt,{className:"text-muted-foreground",children:x.description}),r.jsx(jt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(jt,{children:r.jsx(Ss,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(jt,{children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(ni,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{children:[a?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);u.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(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"icon",children:"Icon"}),r.jsx(ot,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"color",children:"Color"}),r.jsx(ot,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),r.jsxs(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function vNt({scripts:t,actionTypes:e,isLoading:n}){const{toast:s}=mi(),a=qr(),[o,l]=I.useState(null),[i,u]=I.useState(!1),p=or({mutationFn:async y=>{if(y.id){const{error:_}=await Q.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 Q.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"]}),u(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=or({mutationFn:async y=>{const{error:_}=await Q.from("action_scripts").delete().eq("id",y);if(_)throw _},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Script Library"}),r.jsx(Cn,{children:"Create and manage scripts for each action type"})]}),r.jsxs(te,{onClick:()=>{l(null),u(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-medium",children:y.title}),r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",children:((_=y.action_type)==null?void 0:_.name)||"Unknown"})}),r.jsx(jt,{className:"text-muted-foreground",children:y.tone}),r.jsx(jt,{children:r.jsx(Lt,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(jt,{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{l(y),u(!0)},children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Dr,{open:i,onOpenChange:u,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsx(Br,{children:r.jsxs(zr,{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(qe,{htmlFor:"title",children:"Title"}),r.jsx(ot,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(xn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(ot,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ss,{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(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:p.isPending,children:[p.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function _Nt({plans:t,actionTypes:e,scripts:n,isLoading:s}){const{toast:a}=mi(),o=qr(),[l,i]=I.useState(null),[u,p]=I.useState(!1),[x,y]=I.useState(null),[_,w]=I.useState(!1),[S,N]=I.useState(null),[M,E]=I.useState(null),{data:A}=Kt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:W,error:J}=await Q.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(J)throw J;return W},enabled:!!x}),P=or({mutationFn:async W=>{if(W.id){const{error:J}=await Q.from("touchpoint_plans").update({name:W.name,description:W.description,active:W.active}).eq("id",W.id);if(J)throw J}else{const{error:J}=await Q.from("touchpoint_plans").insert([{name:W.name,description:W.description,active:!0}]);if(J)throw J}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),p(!1),i(null),a({title:"Saved successfully"})},onError:W=>{a({title:"Error",description:W.message,variant:"destructive"})}}),z=or({mutationFn:async W=>{if(W.id){const{error:J}=await Q.from("touchpoint_plan_items").update({action_type_id:W.action_type_id,default_script_id:W.default_script_id,notes:W.notes}).eq("id",W.id);if(J)throw J}else{const{error:J}=await Q.from("touchpoint_plan_items").insert([{plan_id:W.plan_id,month_number:W.month_number,action_type_id:W.action_type_id,default_script_id:W.default_script_id,notes:W.notes}]);if(J)throw J}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),a({title:"Item saved"})}}),R=or({mutationFn:async W=>{const{error:J}=await Q.from("touchpoint_plan_items").delete().eq("id",W);if(J)throw J},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),U=or({mutationFn:async W=>{const{data:J,error:ae}=await Q.from("action_scripts").insert([{...W,active:!0}]).select().single();if(ae)throw ae;return J},onSuccess:async W=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),S&&await z.mutateAsync({id:S.itemId,plan_id:x,month_number:S.month,action_type_id:S.actionTypeId,default_script_id:W.id}),w(!1),N(null),a({title:"Script created and assigned"})},onError:W=>{a({title:"Error",description:W.message,variant:"destructive"})}}),V=(W,J,ae)=>{N({month:W,actionTypeId:J,itemId:ae}),w(!0)},K=W=>n.find(J=>J.id===W);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Touchpoint Plans"}),r.jsx(Cn,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(te,{onClick:()=>{i(null),p(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{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(W=>r.jsxs(Ke,{className:`cursor-pointer transition-colors ${x===W.id?"border-primary":""}`,onClick:()=>y(W.id),children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Zt,{className:"text-base",children:W.name}),r.jsx(te,{variant:"ghost",size:"icon",onClick:J=>{J.stopPropagation(),i(W),p(!0)},children:r.jsx(ni,{className:"h-4 w-4"})})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:W.description}),r.jsx(Lt,{variant:W.active?"default":"secondary",className:"mt-2",children:W.active?"Active":"Inactive"})]})]},W.id))})})]}),x&&r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Plan Schedule"}),r.jsx(Cn,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(W,J)=>J+1).map(W=>{const J=A==null?void 0:A.find(xe=>xe.month_number===W),ae=J!=null&&J.default_script_id?K(J.default_script_id):null,oe=n.filter(xe=>xe.action_type_id===(J==null?void 0:J.action_type_id)&&xe.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 ",W]}),r.jsxs(xn,{value:(J==null?void 0:J.action_type_id)||"none",onValueChange:xe=>{xe==="none"&&J?R.mutate(J.id):xe!=="none"&&z.mutate({id:J==null?void 0:J.id,plan_id:x,month_number:W,action_type_id:xe,default_script_id:null})},children:[r.jsx(fn,{className:"w-40",children:r.jsx(vn,{placeholder:"No action"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No action"}),e.filter(xe=>xe.active).map(xe=>r.jsx(qt,{value:xe.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[xe.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:xe.color}}),xe.name]})},xe.id))]})]}),J&&r.jsxs(r.Fragment,{children:[r.jsxs(xn,{value:J.default_script_id||"none",onValueChange:xe=>{E(null),z.mutate({id:J.id,default_script_id:xe==="none"?null:xe})},children:[r.jsx(fn,{className:"w-56",children:r.jsx(vn,{placeholder:"Select script"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No default script"}),oe.map(xe=>r.jsxs(qt,{value:xe.id,children:[xe.title," ",xe.tone&&`(${xe.tone})`]},xe.id))]})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>V(W,J.action_type_id,J.id),children:[r.jsx(_n,{className:"h-3 w-3 mr-1"}),"New Script"]}),ae&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>E((M==null?void 0:M.id)===ae.id?null:ae),children:(M==null?void 0:M.id)===ae.id?"Hide":"Preview"})]})]}),M&&(J==null?void 0:J.default_script_id)===M.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(Lt,{variant:"outline",children:M.title}),M.tone&&r.jsx(Lt,{variant:"secondary",children:M.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:M.script_body})]})]},W)})})})]}),r.jsx(Dr,{open:u,onOpenChange:p,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:W=>{W.preventDefault();const J=new FormData(W.currentTarget);P.mutate({id:l==null?void 0:l.id,name:J.get("name"),description:J.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:P.isPending,children:[P.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Dr,{open:_,onOpenChange:w,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create New Script"}),r.jsxs(Jn,{children:["Create a script for Month ",S==null?void 0:S.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:W=>{W.preventDefault();const J=new FormData(W.currentTarget);U.mutate({title:J.get("title"),action_type_id:S.actionTypeId,tone:J.get("tone"),script_body:J.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script_title",children:"Title"}),r.jsx(ot,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script_tone",children:"Tone"}),r.jsx(ot,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ss,{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(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>w(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:U.isPending,children:[U.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function bNt({flags:t}){const{toast:e}=mi(),n=qr(),s=async(a,o)=>{const{error:l}=await Q.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(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Feature Flags"}),r.jsx(Cn,{children:"Control which features are enabled for members"})]}),r.jsx(et,{children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-mono text-sm",children:a.key}),r.jsx(jt,{children:r.jsx(Ss,{checked:a.enabled,onCheckedChange:o=>s(a,{enabled:o})})}),r.jsx(jt,{children:r.jsx(ot,{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(jt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function wNt({items:t,isLoading:e}){const{toast:n}=mi(),s=qr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),u=or({mutationFn:async y=>{if(y.id){const{error:_}=await Q.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(_)throw _}else{const{error:_}=await Q.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 Q.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 Q.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(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Popby Ideas"}),r.jsx(Cn,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(te,{onClick:()=>{o(null),i(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(et,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{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(Zi,{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(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-medium",children:y.name}),r.jsx(jt,{className:"text-muted-foreground",children:y.description}),r.jsx(jt,{children:r.jsx(Ss,{checked:y.is_active,onCheckedChange:()=>p(y)})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{children:[a?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const _=new FormData(y.currentTarget);u.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(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function jNt(){var w;const{toast:t}=mi(),e=qr(),[n,s]=I.useState(null),[a,o]=I.useState(!1),{data:l,isLoading:i}=Kt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:S,error:N}=await Q.from("video_script_categories").select("*").order("sort_order");if(N)throw N;return S}}),{data:u,isLoading:p}=Kt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:S,error:N}=await Q.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(N)throw N;return S}}),x=or({mutationFn:async S=>{var N,M;if(S.id){const{error:E}=await Q.from("video_scripts").update({title:S.title,script_text:S.script_text,category_id:S.category_id,tags:((N=S.tags)==null?void 0:N.split(",").map(A=>A.trim()).filter(Boolean))||[]}).eq("id",S.id);if(E)throw E}else{const{error:E}=await Q.from("video_scripts").insert([{title:S.title,script_text:S.script_text,category_id:S.category_id||null,tags:((M=S.tags)==null?void 0:M.split(",").map(A=>A.trim()).filter(Boolean))||[]}]);if(E)throw E}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),t({title:"Video script saved!"})},onError:S=>t({title:"Error",description:S.message,variant:"destructive"})}),y=async S=>{await Q.from("video_scripts").update({is_active:!S.is_active}).eq("id",S.id),e.invalidateQueries({queryKey:["admin-video-scripts"]})},_=async S=>{confirm("Delete this video script?")&&(await Q.from("video_scripts").delete().eq("id",S),e.invalidateQueries({queryKey:["admin-video-scripts"]}),t({title:"Script deleted"}))};return r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Video Scripts"}),r.jsx(Cn,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(te,{onClick:()=>{s(null),o(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:p?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:u==null?void 0:u.map(S=>{var N;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:S.title}),r.jsx(jt,{className:"text-muted-foreground",children:((N=S.category)==null?void 0:N.name)||"Uncategorized"}),r.jsx(jt,{children:r.jsx(Ss,{checked:S.is_active,onCheckedChange:()=>y(S)})}),r.jsxs(jt,{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{s(S),o(!0)},children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>_(S.id),children:r.jsx($n,{className:"h-4 w-4"})})]})]},S.id)})})]})}),r.jsx(Dr,{open:a,onOpenChange:o,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsx(Br,{children:r.jsxs(zr,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:S=>{S.preventDefault();const N=new FormData(S.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(qe,{htmlFor:"title",children:"Title"}),r.jsx(ot,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"category_id",children:"Category"}),r.jsxs(xn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select category"})}),r.jsx(pn,{children:l==null?void 0:l.map(S=>r.jsx(qt,{value:S.id,children:S.name},S.id))})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script_text",children:"Script Text"}),r.jsx(ss,{id:"script_text",name:"script_text",defaultValue:n==null?void 0:n.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(ot,{id:"tags",name:"tags",defaultValue:((w=n==null?void 0:n.tags)==null?void 0:w.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(Ws,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function kNt(){const{toast:t}=mi(),[e,n]=I.useState(""),[s,a]=I.useState(!0),[o,l]=I.useState(!1);I.useEffect(()=>{(async()=>{a(!0);try{const{data:p}=await Q.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 Q.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(Ke,{children:r.jsx(et,{className:"flex justify-center py-8",children:r.jsx(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(Cn,{children:"Configure the map feature for popbys"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(ot,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:e,onChange:u=>n(u.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(te,{onClick:i,disabled:o,children:[o&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),e&&r.jsx(Lt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const NNt=()=>{const[t,e]=I.useState(""),[n,s]=I.useState("grid"),a=Gn(),{data:o=[],isLoading:l}=Kt({queryKey:["additional-services"],queryFn:async()=>{const{data:u,error:p}=await Q.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(p)throw p;return u}}),i=o.filter(u=>{var x;return u.name.toLowerCase().includes(t.toLowerCase())||((x=u.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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search services...",value:t,onChange:u=>e(u.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>e(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(tp,{className:"h-4 w-4"})}),r.jsx(te,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(rp,{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((u,p)=>r.jsx(Ke,{children:r.jsxs(et,{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(te,{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(u=>r.jsxs(Ke,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${u.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:u.preview_image_url?r.jsx("img",{src:u.preview_image_url,alt:u.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(As,{className:"h-8 w-8"})})}),r.jsxs(et,{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:u.name}),u.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:Vne(u.description)})]})]},u.id))})]})})},SNt=()=>{const{serviceId:t}=td(),e=Gn(),{data:n,isLoading:s}=Kt({queryKey:["additional-service",t],queryFn:async()=>{const{data:a,error:o}=await Q.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(te,{variant:"ghost",onClick:()=>e("/additional-services"),className:"gap-2",children:[r.jsx(io,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(Ke,{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(As,{className:"h-16 w-16"})})})}),r.jsx(Ke,{children:r.jsxs(et,{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(Ds,{className:"h-4 w-4 mr-1"}),"Published ",mn(new Date(n.publish_date),"MMMM d, yyyy")]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:n.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(te,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Os,{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(te,{onClick:()=>e("/additional-services"),children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},eT=[{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 CNt(){const[t,e]=I.useState(eT[0].id),n=eT.find(s=>s.id===t)||eT[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(uS,{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(xn,{value:t,onValueChange:e,children:[r.jsx(fn,{className:"w-full",children:r.jsx(vn,{placeholder:"Select a tool"})}),r.jsx(pn,{children:eT.map(s=>r.jsx(qt,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(ki,{value:t,onValueChange:e,className:"w-full",children:r.jsx(pi,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:eT.map(s=>r.jsx(rn,{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 eSe="agent-os-onboarding-completed",nO=[{icon:Cg,iconColor:"text-white",bgGradient:"from-primary via-primary/80 to-purple-600",title:"Welcome to Agent OS",description:"You've unlocked a powerful new tool designed to help you build stronger relationships and close more deals. Agent OS is currently in beta, and we're excited for you to try it!",highlights:["Manage your most important relationships","Stay in touch with automated reminders","Track your transactions and goals","Maximize referrals from your sphere"]},{icon:Ig,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:_m,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:Zi,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:gc,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"]}],MNt=()=>{const[t,e]=I.useState(!1),[n,s]=I.useState(0),[a,o]=I.useState(!1);I.useEffect(()=>{if(!localStorage.getItem(eSe)){const S=setTimeout(()=>e(!0),500);return()=>clearTimeout(S)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):u()},i=()=>{u()},u=()=>{localStorage.setItem(eSe,"true"),e(!1)},p=nO[n],x=p.icon,y=n===nO.length-1,_=w=>{w||u(),e(w)};return r.jsx(Dr,{open:t,onOpenChange:_,children:r.jsxs(Or,{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(As,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(Br,{className:"text-center sm:text-center pb-2",children:[r.jsx(zr,{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(Jn,{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((w,S)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+S*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(_i,{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:w})]},S))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:nO.map((w,S)=>r.jsx("button",{onClick:()=>{S!==n&&(o(!0),setTimeout(()=>{s(S),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${S===n?"w-8 bg-gradient-to-r "+p.bgGradient:S{const{user:t}=Qr();return Kt({queryKey:["contact-snoozes",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return e},enabled:!!t})},ANt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async({contactId:n,days:s})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const a=Xl(new Date,s);await Q.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await Q.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"]}),ga({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{ga({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},ENt=()=>{const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("contact_snoozes").delete().eq("contact_id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),ga({title:"Snooze cancelled"})},onError:e=>{ga({title:"Error cancelling snooze",description:e.message,variant:"destructive"})}})},INt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function Zye({open:t,onOpenChange:e,contactId:n,contactName:s}){const[a,o]=I.useState(null),l=ANt(),i=async()=>{a&&(await l.mutateAsync({contactId:n,days:a}),o(null),e(!1))},u=p=>mn(Xl(new Date,p),"MMM d, yyyy");return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Jn,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:INt.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(Ds,{className:"h-3.5 w-3.5"}),"Until ",u(p.days)]})]},p.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const PNt={Crown:A1,FileText:ka,Users:Bn,Globe:ey,Star:_s,Phone:ji,MessageSquare:Do,PenTool:Aj,Video:Da,Gift:Zi};function LNt({actions:t,onMarkComplete:e,onViewScript:n,isLoading:s,buildSmsLink:a,buildEmailLink:o,onGmailCompose:l}){const i=Gn(),[u,p]=I.useState("name"),[x,y]=I.useState("asc"),[_,w]=I.useState(null),[S,N]=I.useState(""),M=R=>{u===R?y(U=>U==="asc"?"desc":"asc"):(p(R),y("asc"))},E=I.useMemo(()=>[...t].sort((R,U)=>{var K,W;let V=0;switch(u){case"name":{const J=`${R.contact.first_name} ${R.contact.last_name||""}`.toLowerCase(),ae=`${U.contact.first_name} ${U.contact.last_name||""}`.toLowerCase();V=J.localeCompare(ae);break}case"relationship_type":V=(R.relationshipTypeName||"").localeCompare(U.relationshipTypeName||"");break;case"action_type":V=(((K=R.actionType)==null?void 0:K.name)||"").localeCompare(((W=U.actionType)==null?void 0:W.name)||"");break;case"last_touch":V=(R.monthNumber||0)-(U.monthNumber||0);break}return x==="asc"?V:-V}),[t,u,x]),A=R=>PNt[R||"Phone"]||ji,P=({field:R,children:U})=>r.jsxs(te,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>M(R),children:[U,u===R?x==="asc"?r.jsx(ep,{className:"ml-2 h-4 w-4"}):r.jsx(Xx,{className:"ml-2 h-4 w-4"}):r.jsx(jg,{className:"ml-2 h-4 w-4 opacity-50"})]}),z=(R,U,V)=>{w(R),N(`${U} ${V||""}`.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(Mr,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[180px]",children:r.jsx(P,{field:"name",children:"Contact"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(P,{field:"relationship_type",children:"Type"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(P,{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:E.map((R,U)=>{var oe,xe,ie,pe,se,fe;const V=R.isSpecialDate,K=R.specialDateType,W=V?K==="birthday"?of:ua:A(((oe=R.actionType)==null?void 0:oe.icon)||null),J=R.contact.phone,ae=R.contact.email;return r.jsxs(Mr,{className:zt("hover:bg-muted/50 transition-colors",V&&K==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",V&&K==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(jt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>i(`/mission-control/contacts/${R.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[R.contact.first_name," ",R.contact.last_name]})})}),r.jsx(jt,{children:R.relationshipTypeName?r.jsx(Lt,{variant:"secondary",className:"text-xs",children:R.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(jt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:V?r.jsx(Lt,{className:zt("gap-1",K==="birthday"&&"bg-pink-500 hover:bg-pink-600",K==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:K==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(of,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(ua,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Lt,{variant:"outline",className:"gap-1",children:[r.jsx(W,{className:"h-3 w-3"}),(xe=R.actionType)==null?void 0:xe.name]})})}),r.jsx(jt,{children:J?r.jsx("span",{className:"text-sm font-mono",children:R.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[J&&r.jsx("a",{href:`tel:${R.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(ji,{className:"h-3.5 w-3.5"})}),J&&r.jsx("a",{href:a(R.contact.phone,(ie=R.script)==null?void 0:ie.script_body,R.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(Do,{className:"h-3.5 w-3.5"})}),ae&&(l?r.jsx("button",{onClick:()=>l({id:R.contact.id,first_name:R.contact.first_name,last_name:R.contact.last_name,email:R.contact.email}),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Compose Email",children:r.jsx(ws,{className:"h-3.5 w-3.5"})}):r.jsx("a",{href:o(R.contact.email,(pe=R.script)==null?void 0:pe.script_body,(se=R.script)==null?void 0:se.email_subject,(fe=R.actionType)==null?void 0:fe.name,R.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(ws,{className:"h-3.5 w-3.5"})})),r.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>z(R.contact.id,R.contact.first_name,R.contact.last_name),title:"Snooze",children:r.jsx(sp,{className:"h-3.5 w-3.5"})}),r.jsxs(te,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var he;return e(R.contact.id,R.actionType.id,(he=R.script)==null?void 0:he.id)},disabled:s,children:[r.jsx(Xi,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${R.contact.id}-${U}`)})})]})}),r.jsx(Zye,{open:!!_,onOpenChange:R=>!R&&w(null),contactId:_||"",contactName:S})]})}function cae(){const{isAdmin:t}=Qr(),{data:e,isLoading:n}=Kt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:o,error:l}=await Q.from("gmail_integrations").select("*").maybeSingle();if(l)throw l;return o},enabled:t}),s=t&&!!(e!=null&&e.is_active),a=(e==null?void 0:e.gmail_email)||null;return{isGmailConnected:s,gmailEmail:a,isLoading:n}}function ONt({onSelect:t}){const[e,n]=I.useState(null),{data:s=[],isLoading:a}=Kt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:u,error:p}=await Q.from("email_template_categories").select("*").order("sort_order");if(p)throw p;return u}}),{data:o=[],isLoading:l}=Kt({queryKey:["agent-email-templates",e],queryFn:async()=>{let u=Q.from("agent_email_templates").select("*").eq("is_active",!0).order("sort_order");e&&(u=u.eq("category_id",e));const{data:p,error:x}=await u;if(x)throw x;return p}}),i=s.find(u=>u.id===e);return a?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Yr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):e?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("button",{onClick:()=>n(null),className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(vc,{className:"h-3.5 w-3.5"}),"Back to categories"]}),r.jsxs("p",{className:"text-xs font-medium flex items-center gap-1.5",children:[r.jsx("span",{children:i==null?void 0:i.icon})," ",i==null?void 0:i.name]}),l?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Yr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No templates in this category"}):r.jsx(Ro,{className:"max-h-[280px]",children:r.jsx("div",{className:"space-y-1",children:o.map(u=>r.jsxs("button",{onClick:()=>t(u),className:"w-full p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"font-medium text-sm",children:u.title}),u.tone&&r.jsx(Lt,{variant:"secondary",className:"text-[10px] shrink-0",children:u.tone})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:u.subject})]},u.id))})})]}):r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground px-1 mb-2",children:"Select a category"}),r.jsx(Ro,{className:"max-h-[280px]",children:r.jsx("div",{className:"space-y-1",children:s.map(u=>r.jsxs("button",{onClick:()=>n(u.id),className:"w-full flex items-center justify-between p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("span",{className:"text-lg",children:u.icon}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:u.name}),u.description&&r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:u.description})]})]}),r.jsx(Bi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},u.id))})})]})}function tT(t,e){return t.replace(/\{\{first_name\}\}/gi,e.first_name).replace(/\{\{last_name\}\}/gi,e.last_name||"").replace(/\{\{full_name\}\}/gi,`${e.first_name} ${e.last_name||""}`.trim())}function Yye({open:t,onOpenChange:e,contact:n,bulkContacts:s,defaultSubject:a="",defaultBody:o="",gmailEmail:l,onSendComplete:i}){const u=!!s&&s.length>0,p=u?s:n?[n]:[],x=p[0],[y,_]=I.useState((x==null?void 0:x.email)||""),[w,S]=I.useState(a),[N,M]=I.useState(o),[E,A]=I.useState(!1),[P,z]=I.useState(!1);I.useEffect(()=>{t&&(_((x==null?void 0:x.email)||""),S(tT(a,x||{first_name:""})),M(tT(o,x||{first_name:""})),z(!a&&!o))},[t,x,a,o]);const R=W=>{S(tT(W.subject,x||{first_name:""})),M(tT(W.body,x||{first_name:""})),z(!1)},U=W=>W.split(/\n\n+/).map(J=>`

${J.replace(/\n/g,"
")}

`).join(""),V=async W=>{if(!w||!N)return Oe.error("Please fill in subject and message"),!1;const J=tT(N,W),ae=U(J);try{const{data:oe,error:xe}=await Q.functions.invoke("gmail-send",{body:{to:W.email,subject:w,body:ae,contactId:W.id}});if(xe)throw xe;if(!(oe!=null&&oe.success))throw new Error((oe==null?void 0:oe.error)||"Failed to send");return!0}catch(oe){return console.error("Gmail send error:",oe),Oe.error("Failed to send to "+W.first_name+": "+(oe instanceof Error?oe.message:"Unknown error")),!1}},K=async()=>{if(!w||!N){Oe.error("Please fill in subject and message");return}if(u&&p.length>50){Oe.error("Maximum 50 recipients per bulk send");return}A(!0);try{if(u){let W=0;for(const J of p)await V(J)&&W++,await new Promise(oe=>setTimeout(oe,100));Oe.success(`Sent ${W} of ${p.length} emails`)}else await V(x)&&Oe.success("Email sent successfully!");e(!1),i==null||i()}catch(W){console.error("Bulk send error:",W),Oe.error("Error sending emails")}finally{A(!1)}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5 text-red-500"}),u?`Send to ${p.length} Contacts`:"Compose Email"]}),l&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:l})]})]}),r.jsxs("div",{className:"space-y-4",children:[P?r.jsxs("div",{className:"border rounded-lg p-3 bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("p",{className:"text-sm font-medium flex items-center gap-1.5",children:[r.jsx(ka,{className:"h-4 w-4"})," Choose a Template"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>z(!1),className:"h-7 px-2 text-xs",children:[r.jsx(gs,{className:"h-3 w-3 mr-1"})," Write from scratch"]})]}),r.jsx(ONt,{onSelect:R})]}):r.jsxs(te,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>z(!0),children:[r.jsx(ka,{className:"h-4 w-4"}),"Browse Templates"]}),r.jsx(_d,{}),r.jsx("div",{className:"space-y-1.5",children:u?r.jsxs(r.Fragment,{children:[r.jsx(qe,{children:"Recipients"}),r.jsx("div",{className:"bg-muted p-3 rounded-md space-y-1 max-h-24 overflow-y-auto text-muted-foreground",children:p.map(W=>r.jsxs("div",{className:"text-sm",children:[W.first_name," ",W.last_name," — ",W.email]},W.id))})]}):r.jsxs(r.Fragment,{children:[r.jsx(qe,{htmlFor:"gmail-to",children:"To"}),r.jsx(ot,{id:"gmail-to",value:y,onChange:W=>_(W.target.value),placeholder:"recipient@example.com"})]})}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{htmlFor:"gmail-subject",children:"Subject"}),r.jsx(ot,{id:"gmail-subject",value:w,onChange:W=>S(W.target.value),placeholder:"Enter subject..."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{htmlFor:"gmail-body",children:"Message"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Lt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(W=>W+"{{first_name}}"),children:"{{first_name}}"}),r.jsx(Lt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(W=>W+"{{last_name}}"),children:"{{last_name}}"})]})]}),r.jsx(ss,{id:"gmail-body",value:N,onChange:W=>M(W.target.value),placeholder:"Write your message...",rows:10,className:"resize-y"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),disabled:E,children:"Cancel"}),r.jsxs(te,{onClick:K,disabled:E||!w||!N,className:"gap-2",children:[E?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(eo,{className:"h-4 w-4"}),E?"Sending...":u?`Send to ${p.length}`:"Send Email"]})]})]})]})})}const tSe={Crown:A1,FileText:ka,Users:Bn,Globe:ey,Star:_s,Phone:ji,MessageSquare:Do,PenTool:Aj,Video:Da,Gift:Zi},DNt={"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 RNt(){const t=Gn(),{user:e}=Qr(),{data:n}=Lm(),{data:s}=eDe(),{data:a}=mp(),{data:o}=Hxe(),{data:l}=oDe(),i=Bpt(),u=iDe(),p=Fpt(90),x=nDe(),[y,_]=I.useState(null),[w,S]=I.useState(null),[N,M]=I.useState(!1),[E,A]=I.useState(""),[P,z]=I.useState(!1),[R,U]=I.useState(""),[V,K]=I.useState(Ote()),[W,J]=I.useState("cards"),[ae,oe]=I.useState(!1),[xe,ie]=I.useState(null),{isGmailConnected:pe,gmailEmail:se}=cae(),fe=()=>{const Le=parseInt(R,10);if(isNaN(Le)||Le<1){ga({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}K(Le),aDe(Le),z(!1),ga({title:"Goal updated",description:`Weekly touch goal set to ${Le}`})},he=()=>{U(V.toString()),z(!0)};I.useEffect(()=>{(async()=>{if(!(e!=null&&e.id))return;const{data:We}=await Q.from("profiles").select("name").eq("id",e.id).single();We!=null&&We.name&&A(We.name.split(" ")[0])})()},[e==null?void 0:e.id]),I.useEffect(()=>{i.mutate()},[]);const ye=vf(new Date),Ce=Xl(ye,7),Se=Le=>{if(!Le)return null;const We=new Date(Le);return new Date(ye.getFullYear(),We.getMonth(),We.getDate())},Ne=(a==null?void 0:a.filter(Le=>{const We=Se(Le.birthday),_e=Se(Le.home_anniversary);return We&&sc(We,ye)||_e&&sc(_e,ye)}))||[],be=(a==null?void 0:a.filter(Le=>{if(!Le.birthday&&!Le.home_anniversary)return!1;const We=_e=>{if(!_e)return!1;const st=Se(_e);return st?Ete(st,ye)&&Ese(st,Ce):!1};return We(Le.birthday)||We(Le.home_anniversary)}).slice(0,5))||[],rt=Ne.map(Le=>{var ze,Ee,Je;const We=Se(Le.birthday),_e=We&&sc(We,ye),st=(o==null?void 0:o.find(at=>at.name==="Call"))||(o==null?void 0:o[0]);return{contact:Le,actionType:st||{id:"special-date",name:_e?"Birthday Call":"Anniversary Call",icon:_e?"Cake":"Home",color:_e?"#EC4899":"#8B5CF6",description:_e?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:_e?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((Je=(Ee=(ze=Le.tags)==null?void 0:ze[0])==null?void 0:Ee.relationship_type)==null?void 0:Je.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:_e?"birthday":"anniversary"}}),Pe=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((Le,We)=>{var st,ze,Ee;const _e=o==null?void 0:o[We%((o==null?void 0:o.length)||1)];return _e?{contact:Le,actionType:_e,planName:"Quick Touch",relationshipTypeName:((Ee=(ze=(st=Le.tags)==null?void 0:st[0])==null?void 0:ze.relationship_type)==null?void 0:Ee.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Ue=[...rt,...Pe],Re=async(Le,We,_e)=>{await x.mutateAsync({contactId:Le,actionTypeId:We,scriptUsedId:_e}),M(!1),S(null)},Be=Le=>{Le.script?(S(Le),M(!0)):Re(Le.contact.id,Le.actionType.id)},Ye=Le=>tSe[Le||"Phone"]||ji,ht=Le=>tSe[Le||"Users"]||Bn,Me=(Le,We)=>Le.replace(/\{\{FirstName\}\}/g,We.first_name).replace(/\{\{LastName\}\}/g,We.last_name||"").replace(/\{\{AgentName\}\}/g,E||"there"),Qe=(Le,We)=>({Call:`Thinking of you, ${We}!`,Text:`Quick hello, ${We}`,Email:`Checking in, ${We}`,"Handwritten Note":`A note for ${We}`,Video:`Video message for ${We}`,Gift:`Something special for you, ${We}`})[Le]||`Hello ${We}!`,le=(Le,We,_e)=>{const st=`sms:${Le}`;if(We&&_e){const ze=Me(We,_e);return`${st}?body=${encodeURIComponent(ze)}`}return st},Ve=(Le,We,_e,st,ze)=>{const Ee=`mailto:${Le}`,Je=[];if(ze){const at=_e||Qe(st||"Email",ze.first_name);if(Je.push(`subject=${encodeURIComponent(at)}`),We){const pt=Me(We,ze);Je.push(`body=${encodeURIComponent(pt)}`)}}return Je.length>0?`${Ee}?${Je.join("&")}`:Ee};return r.jsxs(r.Fragment,{children:[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(Le=>Le.active).map(Le=>{const We=ht(Le.icon),_e=(s==null?void 0:s[Le.id])||0,st=y===Le.id,ze=DNt[Le.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{st?(_(null),t("/mission-control/contacts")):(_(Le.id),t(`/mission-control/contacts?type=${Le.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${st?ze:"bg-card hover:bg-accent"} `,children:[r.jsx(We,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:Le.name}),r.jsxs("div",{className:`text-sm ${st?"opacity-90":"text-muted-foreground"}`,children:[_e," Contacts"]})]})]},Le.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(te,{onClick:()=>t("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx($d,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(te,{onClick:()=>t("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Bi,{className:"h-4 w-4 ml-1"})]}),r.jsx(te,{variant:"outline",onClick:()=>t("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(te,{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(Lt,{variant:"outline",className:"gap-1",children:[r.jsx(As,{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(te,{variant:W==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>J("cards"),title:"Card view",children:r.jsx(tp,{className:"h-4 w-4"})}),r.jsx(te,{variant:W==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>J("table"),title:"Table view",children:r.jsx(rp,{className:"h-4 w-4"})})]})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-4",children:Ue.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),r.jsx(te,{variant:"outline",className:"mt-4",onClick:()=>t("/mission-control/plans"),children:"Manage Plans"})]}):W==="table"?r.jsx(LNt,{actions:Ue,onMarkComplete:Re,onViewScript:Be,isLoading:x.isPending,buildSmsLink:le,buildEmailLink:Ve,onGmailCompose:pe?Le=>{ie(Le),oe(!0)}:void 0}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Ue.map((Le,We)=>{var gt,Mt,wt,Xt,Sr,an,wn;const _e=Le.isSpecialDate,st=Le.specialDateType,ze=_e?st==="birthday"?of:ua:Ye(((gt=Le.actionType)==null?void 0:gt.icon)||null),Ee=Le.contact.phone,Je=Le.contact.email,at=_e?st==="birthday"?"#EC4899":"#8B5CF6":((Mt=Le.actionType)==null?void 0:Mt.color)||"#3B82F6",pt=_e?st==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(wt=Le.actionType)==null?void 0:wt.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${_e?"ring-2 ring-offset-2":""}`,style:_e?{"--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(ze,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:pt})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>t(`/mission-control/contacts/${Le.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Le.contact.first_name," ",Le.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[Ee&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${Le.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(ji,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:le(Le.contact.phone,(Xt=Le.script)==null?void 0:Xt.script_body,Le.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(Do,{className:"h-3 w-3"}),"Text"]})]}),Je&&(pe?r.jsxs("button",{onClick:()=>{ie({id:Le.contact.id,first_name:Le.contact.first_name,last_name:Le.contact.last_name,email:Le.contact.email}),oe(!0)},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:"Compose Email",children:[r.jsx(ws,{className:"h-3 w-3"}),"Email"]}):r.jsxs("a",{href:Ve(Le.contact.email,(Sr=Le.script)==null?void 0:Sr.script_body,(an=Le.script)==null?void 0:an.email_subject,(wn=Le.actionType)==null?void 0:wn.name,Le.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(ws,{className:"h-3 w-3"}),"Email"]}))]}),!Ee&&!Je&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Le.relationshipTypeName&&r.jsx(Lt,{variant:"secondary",className:"text-xs",children:Le.relationshipTypeName}),Le.monthNumber>0&&r.jsxs(Lt,{variant:"outline",className:"text-xs",children:["Month ",Le.monthNumber]})]}),Le.script&&r.jsx(te,{size:"sm",variant:"outline",className:"w-full",onClick:()=>Be(Le),children:"View Script"}),r.jsx(te,{size:"sm",className:"w-full",onClick:()=>{var Xr;return Re(Le.contact.id,Le.actionType.id,(Xr=Le.script)==null?void 0:Xr.id)},disabled:x.isPending,children:"Mark Complete"})]})]},Le.contact.id+We)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"h-full w-full",children:[r.jsx(lm,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(eh,{children:r.jsx(ri,{onClick:()=>t("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ke,{className:"md:col-span-2",children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{className:"text-lg",children:"Momentum"}),r.jsxs(Dr,{open:P,onOpenChange:z,children:[r.jsx(Uo,{asChild:!0,children:r.jsx("button",{onClick:he,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(jd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Or,{className:"sm:max-w-[360px]",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Set Weekly Goal"}),r.jsx(Jn,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(ot,{id:"weekly-goal-ic",type:"number",min:"1",value:R,onChange:Le=>U(Le.target.value),placeholder:"20",onKeyDown:Le=>{Le.key==="Enter"&&fe()}})]}),r.jsx(te,{onClick:fe,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Jc,{value:Math.min(u.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(lf,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[u.actionsThisWeek," / ",V]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),u.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! (",u.streak," days)"]})]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(et,{className:"space-y-3",children:[be.length>0?be.map(Le=>{const We=Le.birthday,_e=Le.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[We?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:[Le.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",We?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[We&&Le.birthday&&mn(new Date(Le.birthday),"MMM d"),_e&&Le.home_anniversary&&mn(new Date(Le.home_anniversary),"MMM d")]})]})]},Le.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(Wa,{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(Bi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(wDe,{})]})]}),r.jsx(Dr,{open:N,onOpenChange:M,children:r.jsxs(Or,{className:"max-w-md",children:[r.jsx(Br,{children:r.jsx(zr,{className:"flex items-center gap-2",children:w&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.actionType.color||"#3B82F6"}}),w.actionType.name," Script"]})})}),w&&w.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:[w.contact.first_name," ",w.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Me(w.script.script_body,w.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",className:"flex-1",onClick:()=>M(!1),children:"Close"}),r.jsx(te,{className:"flex-1",onClick:()=>{var Le;return Re(w.contact.id,w.actionType.id,(Le=w.script)==null?void 0:Le.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(MNt,{})]}),pe&&xe&&r.jsx(Yye,{open:ae,onOpenChange:oe,contact:xe,gmailEmail:se})]})}const C7e=()=>{const{user:t}=Qr();return Kt({queryKey:["popby-items",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.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})},dae=t=>{const{user:e}=Qr();return Kt({queryKey:["popby-logs",e==null?void 0:e.id,t],queryFn:async()=>{let n=Q.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})},Xye=()=>{const{user:t}=Qr();return Kt({queryKey:["relationship-type-popby-defaults",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.from("relationship_type_popby_defaults").select("*");if(n)throw n;return e},enabled:!!t})},M7e=()=>{const{user:t}=Qr();return Kt({queryKey:["contact-popby-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.from("contact_popby_settings").select("*");if(n)throw n;return e},enabled:!!t})},T7e=()=>{const{data:t}=mp(),{data:e}=Lm(),{data:n}=dae(),{data:s}=M7e(),{data:a}=Xye(),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 u=vf(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 M=x.tags.map(E=>l.get(E.relationship_type_id)).filter(E=>E!==void 0);M.length>0&&(y=Math.min(...M))}const _=o.get(x.id)||null,w=_?_y(u,vf(new Date(_))):null,S=w===null||w>=y,N=S&&w!==null?w-y:0;return{...x,lastPopby:_,daysSinceLastPopby:w,frequencyDays:y,isDue:S,daysOverdue:N}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},A7e=()=>T7e().filter(e=>e.isDue),FNt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{error:s}=await Q.from("popby_items").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-items"]}),ga({title:"Popby item created!"})},onError:n=>{ga({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},E7e=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{error:s}=await Q.from("popby_logs").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-logs"]}),ga({title:"Popby logged!"})},onError:n=>{ga({title:"Error logging popby",description:n.message,variant:"destructive"})}})},zNt=()=>{const t=qr(),{user:e}=Qr();return or({mutationFn:async n=>{const{error:s}=await Q.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"]}),ga({title:"Frequency updated!"})},onError:n=>{ga({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},BNt=()=>{const{data:t}=dae(30),e=A7e(),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 $Nt(){const{user:t}=Qr();return Kt({queryKey:["contact-touch-logs",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function I7e(t){const{data:e}=$Nt(),{data:n}=M7e(),{data:s}=Xye(),{data:a}=TNt();return I.useMemo(()=>{const o=a==null?void 0:a.find(M=>M.contact_id===t.id),l=o?new Date(o.snoozed_until):null,i=vf(new Date);if(l&&!Ese(l,i))return{nextTouchDate:l,daysUntil:_y(l,i),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const p=((e==null?void 0:e.filter(M=>M.contact_id===t.id))||[]).sort((M,E)=>new Date(E.completed_at).getTime()-new Date(M.completed_at).getTime())[0],x=p?new Date(p.completed_at):null;let y=90;const _=n==null?void 0:n.find(M=>M.contact_id===t.id&&M.is_active);if(_)y=_.frequency_days;else if(t.tags&&t.tags.length>0){const M=t.tags.map(E=>{const A=s==null?void 0:s.find(P=>P.relationship_type_id===E.relationship_type_id);return A==null?void 0:A.frequency_days}).filter(E=>E!==void 0);M.length>0&&(y=Math.min(...M))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const w=Xl(vf(x),y),S=_y(w,i);let N;return S<0?N="overdue":S<=7?N="due-soon":N="on-track",{nextTouchDate:w,daysUntil:S,status:N,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[t,e,n,s,a])}function Ife({contact:t}){const e=I7e(t),s=(()=>{switch(e.status){case"overdue":return{variant:"destructive",icon:pl,text:`${Math.abs(e.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Wa,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:sp,text:`Snoozed until ${mn(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:Ds,text:"Never touched",className:"border-dashed"}}})(),a=s.icon;return r.jsxs(Lt,{variant:s.variant,className:zt("gap-1",s.className),children:[r.jsx(a,{className:"h-3 w-3"}),s.text]})}function UNt({contact:t,onLogTouch:e,onSnooze:n}){const s=I7e(t),a=ENt(),[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"}},u=()=>{switch(s.status){case"overdue":return r.jsx(pl,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Wa,{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(sp,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(Ds,{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(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Zt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(Ds,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[u(),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:"})," ",mn(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:"})," ",mn(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:"})," ",mn(s.lastTouchDate,"MMM d, yyyy")]}),s.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",s.frequencyDays," days"]}),s.status==="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:a.isPending,children:[r.jsx(gs,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),e&&r.jsx(te,{size:"sm",className:"flex-1",onClick:e,children:"Log Touch"})]}),s.status!=="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(sp,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&e&&r.jsx(te,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:e,children:"Log Touch"})]})]})]}),r.jsx(Zye,{open:o,onOpenChange:l,contactId:t.id,contactName:`${t.first_name} ${t.last_name||""}`.trim()})]})}const ede=768;function S3(){const[t,e]=I.useState(void 0);return I.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ede-1}px)`),s=()=>{e(window.innerWidthn.removeEventListener("change",s)},[]),!!t}const qNt={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"}},VNt={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 tde({score:t,showScore:e=!1,showTooltip:n=!0,size:s="sm",className:a}){const o=qNt[t.status],l=VNt[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(AI,{children:r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:i}),r.jsx(Nm,{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(Jc,{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 HNt=[{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}],WNt=({open:t,onOpenChange:e,relationshipTypes:n,onSuccess:s})=>{const{user:a}=Qr(),{toast:o}=mi(),l=I.useRef(null),[i,u]=I.useState("upload"),[p,x]=I.useState([]),[y,_]=I.useState([]),[w,S]=I.useState({}),[N,M]=I.useState([]),[E,A]=I.useState([]),[P,z]=I.useState(!1),[R,U]=I.useState(null),V=()=>{u("upload"),x([]),_([]),S({}),M([]),A([]),U(null),l.current&&(l.current.value="")},K=()=>{V(),e(!1)},W=fe=>{const he=fe.split(` `).map(Ne=>Ne.trim()).filter(Ne=>Ne);if(he.length===0)return{headers:[],data:[]};const ye=Ne=>{const be=[];let rt="",Te=!1;for(let Pe=0;Pe{var Ce;const he=(Ce=fe.target.files)==null?void 0:Ce[0];if(!he)return;const ye=new FileReader;ye.onload=Se=>{var Pe;const Ne=(Pe=Se.target)==null?void 0:Pe.result,{headers:be,data:rt}=W(Ne);if(be.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(be),_(rt);const Te={};be.forEach(Ue=>{const Re=Ue.toLowerCase().replace(/[_\s-]/g,"");Re.includes("firstname")||Re==="first"?Te.first_name=Ue:Re.includes("lastname")||Re==="last"?Te.last_name=Ue:Re.includes("email")?Te.email=Ue:Re.includes("phone")||Re.includes("mobile")||Re.includes("cell")?Te.phone=Ue:Re.includes("address")||Re.includes("street")?Te.address=Ue:Re==="city"?Te.city=Ue:Re==="state"||Re==="province"?Te.state=Ue:Re==="zip"||Re==="zipcode"||Re==="postalcode"?Te.zip=Ue:Re.includes("spouse")&&Re.includes("email")?Te.spouse_email=Ue:Re.includes("spouse")||Re.includes("partner")?Te.spouse_name=Ue:Re.includes("company")||Re.includes("organization")||Re.includes("business")?Te.company_name=Ue:Re.includes("jobtitle")||Re.includes("title")||Re.includes("position")?Te.job_title=Ue:Re.includes("birthday")||Re.includes("dob")||Re.includes("birthdate")?Te.birthday=Ue:Re.includes("anniversary")||Re.includes("homeanniversary")?Te.home_anniversary=Ue:(Re.includes("notes")||Re.includes("comment"))&&(Te.notes=Ue)}),S(Te),u("mapping")},ye.readAsText(he)},ae=(fe,he)=>{S(ye=>{if(he==="none"){const{[fe]:Ce,...Se}=ye;return Se}return{...ye,[fe]:he}})},oe=fe=>{M(he=>he.includes(fe)?he.filter(ye=>ye!==fe):[...he,fe])},xe=()=>{const fe=y.map(he=>{const ye=Ne=>{const be=w[Ne];if(!be)return"";const rt=p.indexOf(be);return rt>=0?(he[rt]||"").trim():""},Ce=ye("first_name"),Se=Ce.length>0;return{first_name:Ce,last_name:ye("last_name"),email:ye("email"),phone:ye("phone"),address:ye("address"),city:ye("city"),state:ye("state"),zip:ye("zip"),spouse_name:ye("spouse_name"),spouse_email:ye("spouse_email"),company_name:ye("company_name"),job_title:ye("job_title"),birthday:ye("birthday"),home_anniversary:ye("home_anniversary"),notes:ye("notes"),isValid:Se,error:Se?void 0:"First name is required"}});A(fe),u("preview")},ie=async()=>{if(!(a!=null&&a.id))return;const fe=E.filter(Se=>Se.isValid);if(fe.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}z(!0);let he=0,ye=0,Ce=0;try{for(const Se of fe)try{let Ne=null;if(Se.email){const{data:rt}=await Q.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",Se.email).maybeSingle();Ne=rt}if(!Ne&&Se.phone){const{data:rt}=await Q.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",Se.phone).maybeSingle();Ne=rt}const be={owner_user_id:a.id,first_name:Se.first_name,last_name:Se.last_name||null,email:Se.email||null,phone:Se.phone||null,address:Se.address||null,city:Se.city||null,state:Se.state||null,zip:Se.zip||null,spouse_name:Se.spouse_name||null,spouse_email:Se.spouse_email||null,company_name:Se.company_name||null,job_title:Se.job_title||null,birthday:Se.birthday||null,home_anniversary:Se.home_anniversary||null,notes:Se.notes||null};if(Ne)await Q.from("innercircle_contacts").update(be).eq("id",Ne.id),ye++;else{const{data:rt}=await Q.from("innercircle_contacts").insert(be).select("id").single();rt&&N.length>0&&await Q.from("innercircle_contact_tags").insert(N.map(Te=>({contact_id:rt.id,relationship_type_id:Te}))),he++}}catch(Ne){console.error("Error importing contact:",Ne),Ce++}U({created:he,updated:ye,failed:Ce}),u("result"),(he>0||ye>0)&&s(),o({title:"Import Complete",description:`${he} created, ${ye} updated${Ce>0?`, ${Ce} failed`:""}.`})}catch(Se){console.error("Import error:",Se),o({title:"Import Failed",description:Se.message||"Failed to import contacts",variant:"destructive"})}finally{z(!1)}},pe=E.filter(fe=>fe.isValid).length,se=E.filter(fe=>!fe.isValid).length;return r.jsx(Dr,{open:t,onOpenChange:K,children:r.jsxs(Or,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(P1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Jn,{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:J,className:"hidden"}),r.jsx(ho,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(te,{onClick:()=>{var fe;return(fe=l.current)==null?void 0:fe.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{const fe=`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`,he=new Blob([fe],{type:"text/csv"}),ye=URL.createObjectURL(he),Ce=document.createElement("a");Ce.href=ye,Ce.download="contact_import_template.csv",Ce.click(),URL.revokeObjectURL(ye)},children:[r.jsx(ao,{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(qe,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:HNt.map(fe=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(qe,{className:"w-40 text-sm",children:[fe.label,fe.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(xn,{value:w[fe.key]||"none",onValueChange:he=>ae(fe.key,he),children:[r.jsx(fn,{className:"w-48",children:r.jsx(vn,{placeholder:"Select column..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"-- Not mapped --"}),p.map(he=>r.jsx(qt,{value:he,children:he},he))]})]})]},fe.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(fe=>r.jsx(Lt,{variant:N.includes(fe.id)?"default":"outline",className:"cursor-pointer",onClick:()=>oe(fe.id),children:fe.name},fe.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(pl,{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(Mr,{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((fe,he)=>r.jsxs(Mr,{children:[r.jsx(jt,{children:fe.first_name}),r.jsx(jt,{children:fe.last_name}),r.jsx(jt,{children:fe.email}),r.jsx(jt,{children:fe.phone}),r.jsx(jt,{children:fe.isValid?r.jsx(Lt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Lt,{variant:"destructive",children:fe.error||"Invalid"})})]},he))})]}),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"&&R&&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:[R.created," contact(s) created, ",R.updated," updated"]}),R.failed>0&&r.jsxs("p",{className:"text-destructive",children:[R.failed," failed to import"]})]}),r.jsxs(Ws,{children:[i==="upload"&&r.jsx(te,{variant:"outline",onClick:K,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:V,children:"Back"}),r.jsx(te,{onClick:xe,disabled:!w.first_name,children:"Continue"})]}),i==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:()=>u("mapping"),children:"Back"}),r.jsx(te,{onClick:ie,disabled:P||pe===0,children:P?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${pe} Contact${pe!==1?"s":""}`})]}),i==="result"&&r.jsx(te,{onClick:K,children:"Done"})]})]})})};function GNt(){return"contacts"in navigator&&"ContactsManager"in window}function KNt(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="",u="",p="";for(const x of a){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const w=y.substring(y.indexOf(":")+1).split(";");l=(w[0]||"").trim(),o=(w[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const w=y.substring(y.indexOf(":")+1).trim().split(" ");o=w[0]||"",l=w.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))&&!u&&(u=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!p&&(p=y.substring(y.indexOf(":")+1).split(";").map(S=>S.trim()).filter(Boolean).join(", "))}(o||l)&&e.push({first_name:o,last_name:l,email:i,phone:u,address:p})}return e}function ZNt({open:t,onOpenChange:e,onComplete:n}){const{user:s}=Qr(),{data:a}=mp(),o=qxe(),l=I.useRef(null),[i,u]=I.useState("choose"),[p,x]=I.useState([]),[y,_]=I.useState(new Set),[w,S]=I.useState(0),[N,M]=I.useState(0),E=GNt(),A=I.useCallback(ae=>{if(!a)return ae;const oe=new Set(a.filter(ie=>ie.email).map(ie=>ie.email.toLowerCase())),xe=new Set(a.filter(ie=>ie.phone).map(ie=>ie.phone.replace(/\D/g,"")));return ae.map(ie=>{var fe,he;const pe=(fe=ie.email)==null?void 0:fe.toLowerCase(),se=(he=ie.phone)==null?void 0:he.replace(/\D/g,"");return pe&&oe.has(pe)?{...ie,isDuplicate:!0,duplicateField:"email"}:se&&se.length>=7&&xe.has(se)?{...ie,isDuplicate:!0,duplicateField:"phone"}:ie})},[a]),P=async()=>{try{const ae=["name","email","tel","address"],oe=await navigator.contacts.select(ae,{multiple:!0});if(!oe||oe.length===0)return;const xe=oe.map(se=>{var ye,Ce,Se,Ne;const he=(((ye=se.name)==null?void 0:ye[0])||"").split(" ");return{first_name:he[0]||"",last_name:he.slice(1).join(" "),email:((Ce=se.email)==null?void 0:Ce[0])||"",phone:((Se=se.tel)==null?void 0:Se[0])||"",address:(Ne=se.address)!=null&&Ne[0]?[se.address[0].streetAddress,se.address[0].city,se.address[0].region,se.address[0].postalCode].filter(Boolean).join(", "):""}}),ie=A(xe);x(ie);const pe=new Set;ie.forEach((se,fe)=>{se.isDuplicate||pe.add(fe)}),_(pe),u("preview")}catch(ae){console.error("Contact Picker error:",ae),ga({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},z=ae=>{var ie;const oe=(ie=ae.target.files)==null?void 0:ie[0];if(!oe)return;const xe=new FileReader;xe.onload=pe=>{var Ce;const se=(Ce=pe.target)==null?void 0:Ce.result,fe=KNt(se);if(fe.length===0){ga({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const he=A(fe);x(he);const ye=new Set;he.forEach((Se,Ne)=>{Se.isDuplicate||ye.add(Ne)}),_(ye),u("preview")},xe.readAsText(oe),l.current&&(l.current.value="")},R=async()=>{const ae=p.filter((xe,ie)=>y.has(ie));if(ae.length===0)return;u("importing");let oe=0;for(const xe of ae)try{await o.mutateAsync({first_name:xe.first_name,last_name:xe.last_name||void 0,email:xe.email||void 0,phone:xe.phone||void 0,address:xe.address||void 0}),oe++,M(Math.round(oe/ae.length*100))}catch(ie){console.error(`Failed to import ${xe.first_name} ${xe.last_name}:`,ie)}S(oe),u("done")},U=ae=>{_(oe=>{const xe=new Set(oe);return xe.has(ae)?xe.delete(ae):xe.add(ae),xe})},V=()=>{y.size===p.length?_(new Set):_(new Set(p.map((ae,oe)=>oe)))},K=ae=>{ae||(u("choose"),x([]),_(new Set),S(0),M(0),i==="done"&&n()),e(ae)},W=p.filter(ae=>ae.isDuplicate).length,J=y.size;return r.jsx(Dr,{open:t,onOpenChange:K,children:r.jsxs(Or,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(Tg,{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(Jn,{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(te,{onClick:P,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(Tg,{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(te,{variant:E?"outline":"default",onClick:()=>{var ae;return(ae=l.current)==null?void 0:ae.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(ho,{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",W>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",W," already exist)"]})]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:V,children:y.size===p.length?"Deselect All":"Select All"})]}),r.jsx(Ro,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:p.map((ae,oe)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ae.isDuplicate?"opacity-60":""}`,onClick:()=>U(oe),children:[r.jsx(Fl,{checked:y.has(oe),onCheckedChange:()=>U(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:[ae.first_name," ",ae.last_name]}),ae.isDuplicate&&r.jsxs(Lt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",ae.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ae.phone&&r.jsx("div",{children:ae.phone}),ae.email&&r.jsx("div",{className:"truncate",children:ae.email})]})]})]},oe))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>u("choose"),children:"Back"}),r.jsxs(te,{onClick:R,disabled:J===0,children:["Import ",J," Contact",J!==1?"s":""]})]})]}),i==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(Yr,{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(_i,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[w," contact",w!==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(te,{onClick:()=>K(!1),className:"mt-2",children:"Done"})]})]})})}function YNt({selectedIds:t,contacts:e,onClearSelection:n}){const{data:s}=Lm(),a=Vxe(),o=qr(),{isGmailConnected:l}=cae(),[i,u]=I.useState(!1),[p,x]=I.useState(!1),y=t.size;if(y===0)return null;const _=async N=>{u(!0);try{const E=Array.from(t).map(P=>({contact_id:P,relationship_type_id:N})),{error:A}=await Q.from("innercircle_contact_tags").upsert(E,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(A)throw A;o.invalidateQueries({queryKey:["innercircle-contacts"]}),o.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ga({title:`Assigned type to ${y} contacts`}),n()}catch(M){ga({title:"Error assigning type",description:M.message,variant:"destructive"})}finally{u(!1)}},w=()=>{const N=e.filter(U=>t.has(U.id)),M=["First Name","Last Name","Email","Phone","Address","Birthday","Home Anniversary","Notes","Relationship Types"],E=N.map(U=>{var V;return[U.first_name,U.last_name||"",U.email||"",U.phone||"",U.address||"",U.birthday||"",U.home_anniversary||"",U.notes||"",((V=U.tags)==null?void 0:V.map(K=>{var W;return(W=K.relationship_type)==null?void 0:W.name}).join("; "))||""]}),A=[M.join(","),...E.map(U=>U.map(V=>`"${(V||"").replace(/"/g,'""')}"`).join(","))].join(` `),P=new Blob([A],{type:"text/csv"}),z=URL.createObjectURL(P),R=document.createElement("a");R.href=z,R.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,R.click(),URL.revokeObjectURL(z),ga({title:`Exported ${y} contacts`})},S=async()=>{if(confirm(`Are you sure you want to delete ${y} contacts? This cannot be undone.`)){u(!0);try{const N=Array.from(t);for(const M of N)await a.mutateAsync(M);n()}catch(N){ga({title:"Error deleting contacts",description:N.message,variant:"destructive"})}finally{u(!1)}}};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[r.jsxs(Lt,{variant:"secondary",className:"font-semibold",children:[y," selected"]}),r.jsxs(xn,{onValueChange:_,disabled:i,children:[r.jsx(fn,{className:"w-[180px] h-8",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Eg,{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(N=>N.active).map(N=>r.jsx(qt,{value:N.id,children:N.name},N.id))})]}),l&&r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>x(!0),disabled:i,children:[r.jsx(ws,{className:"h-3.5 w-3.5 mr-1"}),"Email"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:w,disabled:i,children:[r.jsx(ao,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:S,disabled:i,className:"text-destructive hover:text-destructive",children:[r.jsx($n,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:n,className:"ml-auto",children:[r.jsx(gs,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),r.jsx(Yye,{open:p,onOpenChange:x,bulkContacts:Array.from(t).map(N=>{const M=e.find(E=>E.id===N);return M?{id:M.id,first_name:M.first_name,last_name:M.last_name,email:M.email||""}:null}).filter(N=>N!==null&&N.email!==""),onSendComplete:()=>{x(!1),n()}})]})}function rSe({contact:t,onEdit:e,onDelete:n,onSnooze:s}){const a=Gn(),o=`${t.first_name} ${t.last_name||""}`.trim();return r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:l=>l.stopPropagation(),children:r.jsx(lm,{className:"h-4 w-4"})})}),r.jsxs(eh,{align:"end",onClick:l=>l.stopPropagation(),children:[r.jsxs(ri,{onClick:()=>a(`/mission-control/contacts/${t.id}?tab=activity&action=log`),children:[r.jsx(ji,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(ri,{onClick:()=>a(`/mission-control/video?contactId=${t.id}`),children:[r.jsx(Da,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(ri,{onClick:()=>a(`/mission-control/popbys?contactId=${t.id}`),children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(ri,{onClick:()=>s(t.id,o),children:[r.jsx(sp,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(ri,{onClick:()=>e(t),children:[r.jsx(ni,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(ri,{onClick:()=>n(t.id),className:"text-destructive focus:text-destructive",children:[r.jsx($n,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function XNt(){const{user:t}=Qr();return Kt({queryKey:["contact-smart-lists",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function QNt(){const t=qr(),{user:e}=Qr();return or({mutationFn:async({name:n,filters:s,sort_by:a})=>{const{data:o,error:l}=await Q.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"]}),ga({title:"Smart list saved"})},onError:n=>{ga({title:"Error saving smart list",description:n.message,variant:"destructive"})}})}function JNt(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("contact_smart_lists").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),ga({title:"Smart list deleted"})}})}function e4t({currentFilters:t,currentSortBy:e,onApplySmartList:n}){const{data:s}=XNt(),a=QNt(),o=JNt(),[l,i]=I.useState(!1),[u,p]=I.useState(""),x=t.search||t.type&&t.type!=="all"||t.status&&t.status!=="all",y=async()=>{u.trim()&&(await a.mutateAsync({name:u.trim(),filters:t,sort_by:e}),p(""),i(!1))};return r.jsxs(r.Fragment,{children:[r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(L1,{className:"h-3.5 w-3.5"}),"Smart Lists",s&&s.length>0&&r.jsx(Lt,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:s.length}),r.jsx(Qd,{className:"h-3.5 w-3.5"})]})}),r.jsxs(eh,{align:"start",className:"w-56",children:[s&&s.length>0?r.jsxs(r.Fragment,{children:[s.map(_=>r.jsxs(ri,{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(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:w=>{w.stopPropagation(),o.mutate(_.id)},children:r.jsx($n,{className:"h-3 w-3 text-destructive"})})]},_.id)),r.jsx(Zj,{})]}):r.jsx(ri,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved lists yet"}),x&&r.jsxs(ri,{onClick:()=>i(!0),children:[r.jsx(BT,{className:"h-4 w-4 mr-2"}),"Save Current Filters"]})]})]}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{className:"max-w-sm",children:[r.jsx(Br,{children:r.jsx(zr,{children:"Save Smart List"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(ot,{placeholder:"e.g. Buyers in 40205",value:u,onChange:_=>p(_.target.value),onKeyDown:_=>_.key==="Enter"&&y(),autoFocus:!0}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{onClick:y,disabled:!u.trim()||a.isPending,children:"Save"})]})]})]})})]})}function ST(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=Pte(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 sSe({birthday:t,homeAnniversary:e,className:n}){const s=nSe(t,"birthday",7),a=nSe(e,"anniversary",7);return!s&&!a?null:r.jsxs("div",{className:zt("flex flex-wrap gap-1",n),children:[s&&r.jsx(Lt,{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(Lt,{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 aSe({deal:t}){if(!t||!t.stage)return null;const{stage:e}=t;return r.jsxs(Lt,{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 t4t(){const t=Bc();return Kt({queryKey:["contact-deals-map",t],queryFn:async()=>{const{data:e,error:n}=await Q.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 r4t(){const t=Gn(),[e]=rd(),{user:n}=Qr(),s=S3(),a=qr(),o=e.get("type"),l=e.get("filter")??e.get("status"),i=e.get("new")==="true",{contactsWithScores:u,isLoading:p}=Gxe(),{data:x}=Lm(),{data:y}=t4t(),_=qxe(),w=tDe(),S=Vxe(),[N,M]=I.useState(""),[E,A]=I.useState(o||"all"),[P,z]=I.useState(l||"all"),[R,U]=I.useState("name"),[V,K]=I.useState(i),[W,J]=I.useState(null),[ae,oe]=I.useState(!1),[xe,ie]=I.useState(!1),[pe,se]=I.useState(null),[fe,he]=I.useState(""),[ye,Ce]=I.useState(new Set),[Se,Ne]=I.useState(!1),[be,rt]=I.useState(1),[Te,Pe]=I.useState(50),Ue=I.useCallback(Ee=>{Ne(!1),Ce(Je=>{const at=new Set(Je);return at.has(Ee)?at.delete(Ee):at.add(Ee),at})},[]);I.useEffect(()=>{if(!(n!=null&&n.id))return;const Ee=Q.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()=>{Q.removeChannel(Ee)}},[a,n==null?void 0:n.id]),I.useEffect(()=>{l&&z(l)},[l]);const[Re,Be]=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 Ee;W&&Be({first_name:W.first_name||"",last_name:W.last_name||"",email:W.email||"",phone:W.phone||"",address:W.address||"",city:W.city||"",state:W.state||"",zip_code:W.zip_code||"",birthday:W.birthday||"",home_anniversary:W.home_anniversary||"",spouse_name:W.spouse_name||"",spouse_email:W.spouse_email||"",notes:W.notes||"",tagIds:((Ee=W.tags)==null?void 0:Ee.map(Je=>Je.relationship_type_id))||[]})},[W]);const Ye=I.useMemo(()=>{if(!u)return[];let Ee=u.filter(Je=>{var gt,Mt,wt;const at=N===""||`${Je.first_name} ${Je.last_name}`.toLowerCase().includes(N.toLowerCase())||((gt=Je.email)==null?void 0:gt.toLowerCase().includes(N.toLowerCase()))||((Mt=Je.phone)==null?void 0:Mt.includes(N)),pt=E==="all"||((wt=Je.tags)==null?void 0:wt.some(Xt=>Xt.relationship_type_id===E));return at&&pt});return P==="not-touched-90"?Ee=Ee.filter(Je=>{const at=Je.relationshipScore.daysSinceTouch;return at===null||at>90}):P==="at-risk"?Ee=Ee.filter(Je=>Je.relationshipScore.status==="at-risk"):P==="cooling"?Ee=Ee.filter(Je=>Je.relationshipScore.status==="cooling"):P==="warm"&&(Ee=Ee.filter(Je=>Je.relationshipScore.status==="warm")),Ee=[...Ee].sort((Je,at)=>{switch(R){case"important-dates":{const pt=ST(Je.birthday),gt=ST(at.birthday),Mt=ST(Je.home_anniversary),wt=ST(at.home_anniversary),Xt=[pt,Mt].filter(an=>an!==null).sort((an,wn)=>(an??1/0)-(wn??1/0))[0]??1/0,Sr=[gt,wt].filter(an=>an!==null).sort((an,wn)=>(an??1/0)-(wn??1/0))[0]??1/0;return Xt-Sr}case"last-touched":{const pt=Je.relationshipScore.lastTouchDate,gt=at.relationshipScore.lastTouchDate;return!pt&&!gt?0:pt?gt?new Date(pt).getTime()-new Date(gt).getTime():1:-1}case"next-touch":{const pt=Je.relationshipScore.daysSinceTouch,gt=at.relationshipScore.daysSinceTouch;return pt===null&>===null?0:pt===null?-1:gt===null?1:gt-pt}case"score":return Je.relationshipScore.score-at.relationshipScore.score;case"date-added":{const pt=Je.created_at,gt=at.created_at;return!pt&&!gt?0:pt?gt?new Date(gt).getTime()-new Date(pt).getTime():-1:1}case"name":default:{const pt=`${Je.first_name||""} ${Je.last_name||""}`.toLowerCase(),gt=`${at.first_name||""} ${at.last_name||""}`.toLowerCase();return pt.localeCompare(gt)}}}),Ee},[u,N,E,P,R]),ht=Ye.length,Me=Math.max(1,Math.ceil(ht/Te)),Qe=Math.min(be,Me),le=I.useMemo(()=>{const Ee=(Qe-1)*Te;return Ye.slice(Ee,Ee+Te)},[Ye,Qe,Te]);I.useEffect(()=>{rt(1)},[N,E,P,R]);const Ve=I.useCallback(()=>{Ne(!1),Ce(Ee=>Ee.size>0?new Set:new Set(le.map(Je=>Je.id)))},[le]),Le=I.useCallback(()=>{Ne(!0),Ce(new Set(Ye.map(Ee=>Ee.id)))},[Ye]),We=I.useCallback((Ee,Je)=>{M(Ee.search||""),A(Ee.type||"all"),z(Ee.status||"all"),U(Je||"name")},[]),_e=()=>{Be({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},st=async Ee=>{Ee.preventDefault(),W?(await w.mutateAsync({id:W.id,...Re}),J(null)):(await _.mutateAsync(Re),K(!1)),_e()},ze=async Ee=>{confirm("Are you sure you want to delete this contact?")&&await S.mutateAsync(Ee)};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(te,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(vc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(Ke,{children:r.jsx(et,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or phone...",value:N,onChange:Ee=>M(Ee.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:E,onValueChange:A,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(vn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),x==null?void 0:x.filter(Ee=>Ee.active).map(Ee=>r.jsx(qt,{value:Ee.id,children:Ee.name},Ee.id))]})]}),r.jsxs(xn,{value:P,onValueChange:z,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(vn,{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(xn,{value:R,onValueChange:U,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jg,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(vn,{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(e4t,{currentFilters:{search:N,type:E,status:P},currentSortBy:R,onApplySmartList:We}),r.jsxs(te,{onClick:()=>K(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(te,{variant:"outline",onClick:()=>oe(!0),children:[r.jsx(ho,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(te,{variant:"outline",onClick:()=>ie(!0),children:[r.jsx(Tg,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),r.jsx(YNt,{selectedIds:ye,contacts:Ye,onClearSelection:()=>{Ce(new Set),Ne(!1)}}),ye.size>0&&ye.size===le.length&&!Se&&ht>Te&&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 ",le.length," contacts on this page are selected."]}),r.jsxs(te,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:Le,children:["Select all ",ht.toLocaleString()," matching contacts"]})]}),Se&&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 ",ht.toLocaleString()," matching contacts are selected.",r.jsx(te,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>{Ce(new Set),Ne(!1)},children:"Clear selection"})]}),s?r.jsx("div",{className:"space-y-3",children:p?r.jsx(Ke,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):Ye.length===0?r.jsx(Ke,{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!"}):le.map(Ee=>{var at;const{relationshipScore:Je}=Ee;return r.jsx(Ke,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const pt=new URLSearchParams;N&&pt.set("search",N),E!=="all"&&pt.set("type",E),P!=="all"&&pt.set("filter",P);const gt=pt.toString();t(`/mission-control/contacts/${Ee.id}${gt?`?${gt}`:""}`)},children:r.jsx(et,{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:[Ee.first_name," ",Ee.last_name]}),r.jsx(Bi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[Ee.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(ws,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:Ee.email})]}),Ee.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(ji,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:Ee.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(tde,{score:Je,size:"sm"}),r.jsx(Ife,{contact:Ee}),(at=Ee.tags)==null?void 0:at.map(pt=>{var gt;return r.jsx(Lt,{variant:"secondary",className:"text-xs",children:(gt=pt.relationship_type)==null?void 0:gt.name},pt.id)}),r.jsx(aSe,{deal:y==null?void 0:y[Ee.id]})]}),r.jsx(sSe,{birthday:Ee.birthday,homeAnniversary:Ee.home_anniversary,className:"mb-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Je.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Wa,{className:"h-3 w-3"}),mn(new Date(Je.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),Ee.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ds,{className:"h-3 w-3"}),mn(new Date(Ee.birthday),"MMM d")]}),Ee.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ua,{className:"h-3 w-3"}),mn(new Date(Ee.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:pt=>pt.stopPropagation(),children:r.jsx(rSe,{contact:Ee,onEdit:J,onDelete:ze,onSnooze:(pt,gt)=>{se(pt),he(gt)}})})]})})},Ee.id)})}):r.jsx(Ke,{children:r.jsx(et,{className:"p-0 overflow-x-auto",children:r.jsxs(Us,{className:"min-w-[800px]",children:[r.jsx(qs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Fl,{checked:le.length>0&&le.every(Ee=>ye.has(Ee.id)),onCheckedChange:()=>Ve()})}),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(Mr,{children:r.jsx(jt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):Ye.length===0?r.jsx(Mr,{children:r.jsx(jt,{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!"})}):le.map(Ee=>{var pt;const{relationshipScore:Je}=Ee,at=y==null?void 0:y[Ee.id];return r.jsxs(Mr,{className:`cursor-pointer hover:bg-accent/50 ${ye.has(Ee.id)?"bg-accent/30":""}`,onClick:()=>{const gt=new URLSearchParams;N&>.set("search",N),E!=="all"&>.set("type",E),P!=="all"&>.set("status",P);const Mt=gt.toString();t(`/mission-control/contacts/${Ee.id}${Mt?`?${Mt}`:""}`)},children:[r.jsx(jt,{onClick:gt=>gt.stopPropagation(),children:r.jsx(Fl,{checked:ye.has(Ee.id),onCheckedChange:()=>Ue(Ee.id)})}),r.jsxs(jt,{className:"font-medium",children:[Ee.first_name," ",Ee.last_name]}),r.jsx(jt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(tde,{score:Je,size:"sm"}),r.jsx(Ife,{contact:Ee})]})}),r.jsx(jt,{children:r.jsx(tde,{score:Je,size:"sm",showScore:!0})}),r.jsx(jt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[Ee.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(ws,{className:"h-3 w-3"}),Ee.email]}),Ee.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(ji,{className:"h-3 w-3"}),Ee.phone]})]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(pt=Ee.tags)==null?void 0:pt.map(gt=>{var Mt;return r.jsx(Lt,{variant:"secondary",className:"text-xs",children:(Mt=gt.relationship_type)==null?void 0:Mt.name},gt.id)}),r.jsx(aSe,{deal:at})]})}),r.jsx(jt,{children:r.jsx("div",{className:"text-sm",children:Je.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Wa,{className:"h-3 w-3"}),mn(new Date(Je.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(jt,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsx(sSe,{birthday:Ee.birthday,homeAnniversary:Ee.home_anniversary}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Ee.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ds,{className:"h-3 w-3"}),mn(new Date(Ee.birthday),"MMM d")]}),Ee.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ua,{className:"h-3 w-3"}),mn(new Date(Ee.home_anniversary),"MMM d")]})]})]})}),r.jsx(jt,{children:r.jsx(rSe,{contact:Ee,onEdit:J,onDelete:ze,onSnooze:(gt,Mt)=>{se(gt),he(Mt)}})})]},Ee.id)})})]})})}),ht>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 ",(Qe-1)*Te+1,"–",Math.min(Qe*Te,ht)," of ",ht.toLocaleString()," contacts"]}),r.jsxs(xn,{value:String(Te),onValueChange:Ee=>{Pe(Number(Ee)),rt(1)},children:[r.jsx(fn,{className:"w-[80px] h-8",children:r.jsx(vn,{})}),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(te,{variant:"outline",size:"sm",disabled:Qe<=1,onClick:()=>rt(1),children:"First"}),r.jsx(te,{variant:"outline",size:"sm",disabled:Qe<=1,onClick:()=>rt(Ee=>Ee-1),children:r.jsx(vc,{className:"h-4 w-4"})}),r.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",Qe," of ",Me]}),r.jsx(te,{variant:"outline",size:"sm",disabled:Qe>=Me,onClick:()=>rt(Ee=>Ee+1),children:r.jsx(Bi,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"sm",disabled:Qe>=Me,onClick:()=>rt(Me),children:"Last"})]})]}),r.jsx(Dr,{open:V||!!W,onOpenChange:Ee=>{Ee||(K(!1),J(null),_e())},children:r.jsxs(Or,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:W?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:st,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"first_name",children:"First Name *"}),r.jsx(ot,{id:"first_name",value:Re.first_name,onChange:Ee=>Be({...Re,first_name:Ee.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"last_name",children:"Last Name"}),r.jsx(ot,{id:"last_name",value:Re.last_name,onChange:Ee=>Be({...Re,last_name:Ee.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:Re.email,onChange:Ee=>Be({...Re,email:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",value:Re.phone,onChange:Ee=>Be({...Re,phone:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"address",children:"Address"}),r.jsx(ot,{id:"address",value:Re.address,onChange:Ee=>Be({...Re,address:Ee.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"city",children:"City"}),r.jsx(ot,{id:"city",value:Re.city,onChange:Ee=>Be({...Re,city:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"state",children:"State"}),r.jsx(ot,{id:"state",value:Re.state,onChange:Ee=>Be({...Re,state:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"zip_code",children:"Zip"}),r.jsx(ot,{id:"zip_code",value:Re.zip_code,onChange:Ee=>Be({...Re,zip_code:Ee.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"birthday",children:"Birthday"}),r.jsx(ot,{id:"birthday",type:"date",value:Re.birthday,onChange:Ee=>Be({...Re,birthday:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(ot,{id:"home_anniversary",type:"date",value:Re.home_anniversary,onChange:Ee=>Be({...Re,home_anniversary:Ee.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(ot,{id:"spouse_name",value:Re.spouse_name,onChange:Ee=>Be({...Re,spouse_name:Ee.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(ot,{id:"spouse_email",type:"email",value:Re.spouse_email,onChange:Ee=>Be({...Re,spouse_email:Ee.target.value}),placeholder:"Spouse/partner email"})]})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(Ee=>Ee.active).map(Ee=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Fl,{checked:Re.tagIds.includes(Ee.id),onCheckedChange:Je=>{Be(Je?{...Re,tagIds:[...Re.tagIds,Ee.id]}:{...Re,tagIds:Re.tagIds.filter(at=>at!==Ee.id)})}}),r.jsx("span",{className:"text-sm",children:Ee.name})]},Ee.id))})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ss,{id:"notes",value:Re.notes,onChange:Ee=>Be({...Re,notes:Ee.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>{K(!1),J(null),_e()},children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:_.isPending||w.isPending,children:[W?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(WNt,{open:ae,onOpenChange:oe,relationshipTypes:(x==null?void 0:x.filter(Ee=>Ee.active))||[],onSuccess:()=>{oe(!1)}}),r.jsx(ZNt,{open:xe,onOpenChange:ie,onComplete:()=>ie(!1)}),r.jsx(Zye,{open:!!pe,onOpenChange:Ee=>{Ee||se(null)},contactId:pe||"",contactName:fe})]})})}function n4t(){return Kt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:t,error:e}=await Q.from("video_script_categories").select("*").order("sort_order");if(e)throw e;return t}})}function s4t(t){return Kt({queryKey:["video-scripts",t],queryFn:async()=>{let e=Q.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 a4t(){const{user:t}=Qr();return Kt({queryKey:["user-video-scripts",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await Q.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 i4t(){const{user:t}=Qr(),e=qr();return or({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:a}=await Q.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 o4t(t){const{user:e}=Qr();return Kt({queryKey:["agent-videos",e==null?void 0:e.id,t],queryFn:async()=>{if(!(e!=null&&e.id))return[];let n=Q.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 l4t(t){return Kt({queryKey:["agent-video",t],queryFn:async()=>{const{data:e,error:n}=await Q.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 P7e(){const{user:t}=Qr(),e=qr();return or({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:a}=await Q.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 c4t(){const t=qr();return or({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 Q.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 Q.from("agent_videos").delete().eq("id",e);if(a)throw a}else{console.log("Soft deleting from database:",e);const{error:a}=await Q.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 Qye(){const{user:t}=Qr();return Kt({queryKey:["storage-usage",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await Q.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 d4t(){const{data:t,isLoading:e}=Qye(),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 u4t(t){const{data:e,error:n}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:t,isAgentVideo:!0}});if(n)throw n;return e}async function h4t(t){const{data:e,error:n}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}async function f4t(t){const{data:e,error:n}=await Q.functions.invoke("bunny-upload",{body:{action:"status",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}function p4t(){const{user:t}=Qr(),e=qr();return or({mutationFn:async({contactId:n,videoId:s,notes:a})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:o}=await Q.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 Q.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 m4t(t){return Kt({queryKey:["contact-video-replies",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.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 g4t({videoId:t}){var l;const{data:e,isLoading:n,error:s}=l4t(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(Xh,{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 u=i;return u.includes("iframe.mediadelivery.net/play/")&&(u=u.replace("/play/","/embed/"),u+=(u.includes("?")?"&":"?")+"autoplay=true&responsive=true"),u},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 x4t(){var Qe,le;const{contactId:t}=td(),e=Gn(),[n]=rd(),s=n.get("search")||"",a=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:i}=Cpt(t||""),{data:u}=Lm(),{data:p}=Hxe(),{data:x}=Dse(365),{data:y}=dae(365),{data:_}=m4t(t),{contactsWithScores:w}=Gxe(),S=tDe(),N=Vxe(),M=nDe(),[E,A]=I.useState(!1),[P,z]=I.useState({}),[R,U]=I.useState(!1),[V,K]=I.useState(null),[W,J]=I.useState(""),[ae,oe]=I.useState(null),[xe,ie]=I.useState(!1),[pe,se]=I.useState(null),{isGmailConnected:fe,gmailEmail:he}=cae(),{data:ye}=Kt({queryKey:["gmail-sent-emails",t],queryFn:async()=>{const{data:Ve,error:Le}=await Q.from("gmail_sent_emails").select("*").eq("contact_id",t).order("sent_at",{ascending:!1});if(Le)throw Le;return Ve},enabled:!!t}),Ce=Ve=>{if(!Ve)return null;const Le=Ve.match(/Video ID:\s*([a-f0-9-]+)/i);return Le?Le[1]:null},Se=I.useMemo(()=>{if(!w)return[];let Ve=w.filter(Le=>{var st,ze,Ee;const We=s===""||`${Le.first_name} ${Le.last_name}`.toLowerCase().includes(s.toLowerCase())||((st=Le.email)==null?void 0:st.toLowerCase().includes(s.toLowerCase()))||((ze=Le.phone)==null?void 0:ze.includes(s)),_e=a==="all"||((Ee=Le.tags)==null?void 0:Ee.some(Je=>Je.relationship_type_id===a));return We&&_e});return o==="not-touched-90"?Ve=Ve.filter(Le=>{const We=Le.relationshipScore.daysSinceTouch;return We===null||We>90}):o==="at-risk"?Ve=Ve.filter(Le=>Le.relationshipScore.status==="at-risk"):o==="cooling"?Ve=Ve.filter(Le=>Le.relationshipScore.status==="cooling"):o==="warm"&&(Ve=Ve.filter(Le=>Le.relationshipScore.status==="warm")),Ve.map(Le=>Le.id)},[w,s,a,o]),Ne=Se.indexOf(t||""),be=Ne>0?Se[Ne-1]:null,rt=Ne1&&Ne!==-1,Pe=Ve=>{const Le=new URLSearchParams;s&&Le.set("search",s),a!=="all"&&Le.set("type",a),o!=="all"&&Le.set("status",o);const We=Le.toString();return`/mission-control/contacts/${Ve}${We?`?${We}`:""}`},Ue=I.useMemo(()=>{const Ve=((x==null?void 0:x.filter(We=>We.contact_id===t))||[]).map(We=>{var st,ze;const _e=Ce(We.notes);return{id:We.id,type:"touch",completed_at:We.completed_at,name:((st=We.action_type)==null?void 0:st.name)||"Touch",color:((ze=We.action_type)==null?void 0:ze.color)||"#3B82F6",notes:We.notes,videoId:_e}}),Le=((y==null?void 0:y.filter(We=>We.contact_id===t))||[]).map(We=>({id:We.id,type:"popby",completed_at:We.completed_at,name:"Pop-by",color:"#F97316",notes:We.notes,videoId:null}));return[...Ve,...Le].sort((We,_e)=>new Date(_e.completed_at).getTime()-new Date(We.completed_at).getTime())},[x,y,t]),Re=()=>{var Ve;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:((Ve=l.tags)==null?void 0:Ve.map(Le=>Le.relationship_type_id))||[]}),A(!0))},Be=async()=>{await S.mutateAsync({id:t,...P}),A(!1)},Ye=async()=>{confirm("Are you sure you want to delete this contact?")&&(await N.mutateAsync(t),e("/mission-control/contacts"))},ht=async()=>{V&&(await M.mutateAsync({contactId:t,actionTypeId:V,notes:W}),U(!1),K(null),J(""))},Me=(Ve,Le)=>{fe&&l?(se({email:Ve,name:Le||`${l.first_name} ${l.last_name||""}`.trim()}),ie(!0)):window.location.href=`mailto:${Ve}`};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.jsxs(r.Fragment,{children:[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(te,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/contacts"),children:[r.jsx(vc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),Te&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>be&&e(Pe(be)),disabled:!be,className:"px-2",children:[r.jsx(vc,{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:[Ne+1," of ",Se.length]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>rt&&e(Pe(rt)),disabled:!rt,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Bi,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[l.email&&r.jsxs(te,{variant:"outline",onClick:()=>Me(l.email,`${l.first_name} ${l.last_name||""}`.trim()),children:[r.jsx(ws,{className:"h-4 w-4 mr-1"}),"Email"]}),r.jsxs(te,{variant:"default",onClick:()=>e(`/mission-control/video/record?contact_id=${t}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Da,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Dr,{open:R,onOpenChange:U,children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:p==null?void 0:p.filter(Ve=>Ve.active).map(Ve=>r.jsxs("button",{onClick:()=>K(Ve.id),className:` p-3 rounded-lg border text-left transition-all ${V===Ve.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Ve.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ve.description})]},Ve.id))})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(ss,{id:"action-notes",value:W,onChange:Ve=>J(Ve.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(te,{onClick:ht,disabled:!V||M.isPending,className:"w-full",children:[r.jsx(_i,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(te,{variant:"outline",onClick:Re,children:[r.jsx(hc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(te,{variant:"destructive",size:"icon",onClick:Ye,children:r.jsx($n,{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("button",{onClick:()=>Me(l.email),className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(ws,{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(ji,{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(Ife,{contact:l}),(Qe=l.tags)==null?void 0:Qe.map(Ve=>{const Le=u==null?void 0:u.find(We=>We.id===Ve.relationship_type_id);return Le?r.jsx(Lt,{variant:"secondary",className:"text-xs",children:Le.name},Ve.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ke,{className:"md:col-span-2",children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Contact Information"})}),r.jsx(et,{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(qe,{htmlFor:"first_name",children:"First Name"}),r.jsx(ot,{id:"first_name",value:P.first_name,onChange:Ve=>z({...P,first_name:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"last_name",children:"Last Name"}),r.jsx(ot,{id:"last_name",value:P.last_name,onChange:Ve=>z({...P,last_name:Ve.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:P.email,onChange:Ve=>z({...P,email:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",value:P.phone,onChange:Ve=>z({...P,phone:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"address",children:"Street Address"}),r.jsx(ot,{id:"address",value:P.address,onChange:Ve=>z({...P,address:Ve.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(qe,{htmlFor:"city",children:"City"}),r.jsx(ot,{id:"city",value:P.city,onChange:Ve=>z({...P,city:Ve.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"state",children:"State"}),r.jsx(ot,{id:"state",value:P.state,onChange:Ve=>z({...P,state:Ve.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(ot,{id:"zip_code",value:P.zip_code,onChange:Ve=>z({...P,zip_code:Ve.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"birthday",children:"Birthday"}),r.jsx(ot,{id:"birthday",type:"date",value:P.birthday,onChange:Ve=>z({...P,birthday:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(ot,{id:"home_anniversary",type:"date",value:P.home_anniversary,onChange:Ve=>z({...P,home_anniversary:Ve.target.value})})]})]}),r.jsx(_d,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(ot,{id:"spouse_name",value:P.spouse_name,onChange:Ve=>z({...P,spouse_name:Ve.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(ot,{id:"spouse_email",type:"email",value:P.spouse_email,onChange:Ve=>z({...P,spouse_email:Ve.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(qe,{htmlFor:"company_name",children:"Company"}),r.jsx(ot,{id:"company_name",value:P.company_name,onChange:Ve=>z({...P,company_name:Ve.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"job_title",children:"Job Title"}),r.jsx(ot,{id:"job_title",value:P.job_title,onChange:Ve=>z({...P,job_title:Ve.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:u==null?void 0:u.filter(Ve=>Ve.active).map(Ve=>{var Le;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Fl,{checked:(Le=P.tagIds)==null?void 0:Le.includes(Ve.id),onCheckedChange:We=>{var _e;z(We?{...P,tagIds:[...P.tagIds||[],Ve.id]}:{...P,tagIds:(_e=P.tagIds)==null?void 0:_e.filter(st=>st!==Ve.id)})}}),r.jsx("span",{className:"text-sm",children:Ve.name})]},Ve.id)})})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ss,{id:"notes",value:P.notes,onChange:Ve=>z({...P,notes:Ve.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{onClick:Be,disabled:S.isPending,children:"Save Changes"}),r.jsx(te,{variant:"outline",onClick:()=>A(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ue.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(Ds,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",mn(new Date(Ue[0].completed_at),"MMM d, yyyy")," ","(",Ue[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(ws,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("button",{onClick:()=>Me(l.email),className:"text-primary hover:underline truncate text-left",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ji,{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(To,{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(Ds,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",mn(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",mn(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(_d,{}),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(ac,{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(ws,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("button",{onClick:()=>Me(l.spouse_email,l.spouse_name||void 0),className:"text-primary hover:underline text-left",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{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(_d,{}),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:(le=l.tags)!=null&&le.length?l.tags.map(Ve=>{var Le;return r.jsx(Lt,{variant:"secondary",children:(Le=Ve.relationship_type)==null?void 0:Le.name},Ve.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(_d,{}),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(UNt,{contact:l,onLogTouch:()=>U(!0)}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Activity Log"})}),r.jsx(et,{children:Ue.length>0?r.jsx("div",{className:"space-y-4",children:Ue.map(Ve=>{var Le;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:Ve.color},children:Ve.type==="popby"?r.jsx(Zi,{className:"h-4 w-4"}):(Le=Ve.name)==null?void 0:Le.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:Ve.name}),Ve.videoId&&r.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>oe(Ve.videoId),children:[r.jsx(Ul,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:mn(new Date(Ve.completed_at),"MMM d, yyyy h:mm a")}),Ve.notes&&!Ve.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ve.notes})]})]},Ve.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),_&&_.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:_.map(Ve=>{var Le,We;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Le=Ve.video)!=null&&Le.thumbnail_url?r.jsx("img",{src:Ve.video.thumbnail_url,alt:Ve.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>oe(Ve.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(Ve.video_id),children:r.jsx(Da,{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: ",((We=Ve.video)==null?void 0:We.title)||"Untitled Video"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>oe(Ve.video_id),children:[r.jsx(Ul,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:mn(new Date(Ve.created_at),"MMM d, yyyy h:mm a")}),Ve.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Ve.message,'"']})]})]},Ve.id)})})})]}),ye&&ye.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(eo,{className:"h-5 w-5 text-sky-500"}),"Sent Emails"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:ye.map(Ve=>r.jsxs("details",{className:"group pb-3 border-b last:border-0",children:[r.jsxs("summary",{className:"flex items-start gap-3 cursor-pointer list-none",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-sky-500/10 flex items-center justify-center text-sky-600 flex-shrink-0",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:Ve.subject}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["To: ",Ve.to_email," · ",mn(new Date(Ve.sent_at),"MMM d, yyyy h:mm a")]})]})]}),r.jsx("div",{className:"mt-2 ml-11 p-3 bg-muted/30 rounded-lg text-sm whitespace-pre-wrap",children:Ve.body})]},Ve.id))})})]})]}),r.jsx(Dr,{open:!!ae,onOpenChange:Ve=>!Ve&&oe(null),children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsx(Br,{children:r.jsx(zr,{children:"Video Preview"})}),ae&&r.jsx(g4t,{videoId:ae})]})})]})]})}),fe&&l&&pe&&r.jsx(Yye,{open:xe,onOpenChange:ie,contact:{id:l.id,first_name:l.first_name,last_name:l.last_name,email:pe.email},gmailEmail:he})]}):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(te,{onClick:()=>e("/mission-control/contacts"),children:"Back to Contacts"})]})})}const iSe={Crown:A1,FileText:ka,Users:Bn,Globe:ey,Star:_s,Phone:ji,MessageSquare:Do,PenTool:Aj,Video:Da,Gift:Zi},rde=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function y4t(){var pt,gt;const t=Gn(),{user:e}=Qr(),{data:n}=Lm(),{data:s}=Tpt(),{data:a}=Dpt(),{data:o}=eDe(),{data:l}=Hxe(),{data:i}=Mpt(),u=Rpt(),p=Apt(),x=Ipt(),y=Ppt(),_=Lpt(),w=Opt(),S=Ept(),[N,M]=I.useState(null),[E,A]=I.useState(!1),[P,z]=I.useState(null),[R,U]=I.useState(""),[V,K]=I.useState(""),[W,J]=I.useState([]),[ae,oe]=I.useState(null),[xe,ie]=I.useState(null),[pe,se]=I.useState(!1),[fe,he]=I.useState(""),[ye,Ce]=I.useState(""),[Se,Ne]=I.useState(""),[be,rt]=I.useState(""),Te=(Mt,wt)=>a==null?void 0:a.some(Xt=>Xt.plan_id===Mt&&Xt.relationship_type_id===wt&&Xt.active),Pe=Mt=>a==null?void 0:a.find(wt=>wt.relationship_type_id===Mt&&wt.active),Ue=async(Mt,wt)=>{const Xt=Te(Mt,wt);await u.mutateAsync({planId:Mt,relationshipTypeId:wt,active:!Xt})},Re=(s==null?void 0:s.filter(Mt=>Mt.active&&!Mt.owner_user_id))||[],Be=(s==null?void 0:s.filter(Mt=>Mt.owner_user_id===(e==null?void 0:e.id)))||[],Ye=n==null?void 0:n.find(Mt=>Mt.id===N),ht=N?Pe(N):null,Me=s==null?void 0:s.find(Mt=>Mt.id===(ht==null?void 0:ht.plan_id)),Qe=async()=>{if(!R.trim())return;const Mt=await p.mutateAsync({name:R,description:V});Mt&&W.length>0&&await _.mutateAsync({planId:Mt.id,items:W}),Le()},le=async()=>{!R.trim()||!P||(await x.mutateAsync({id:P,name:R,description:V}),await _.mutateAsync({planId:P,items:W}),Le())},Ve=Mt=>{var wt;z(Mt.id),U(Mt.name),K(Mt.description||""),J(((wt=Mt.items)==null?void 0:wt.map(Xt=>({month_number:Xt.month_number,action_type_id:Xt.action_type_id,default_script_id:Xt.default_script_id||void 0,notes:Xt.notes||void 0})))||[]),A(!0)},Le=()=>{A(!1),z(null),U(""),K(""),J([])},We=(Mt,wt)=>{ie(wt)},_e=(Mt,wt,Xt)=>{J(Sr=>[...Sr.filter(wn=>wn.month_number!==Mt),{month_number:Mt,action_type_id:wt,default_script_id:Xt}]),oe(null),ie(null)},st=Mt=>{J(wt=>wt.filter(Xt=>Xt.month_number!==Mt))},ze=async()=>{if(!fe.trim()||!ye.trim()||!xe)return;const Mt=await w.mutateAsync({actionTypeId:xe,title:fe,scriptBody:ye,emailSubject:Se||void 0,tone:be||void 0});Mt&&ae!==null&&_e(ae,xe,Mt.id),se(!1),he(""),Ce(""),Ne(""),rt("")},Ee=xe?i==null?void 0:i.filter(Mt=>Mt.action_type_id===xe&&Mt.active):[],Je=Mt=>iSe[Mt||"Phone"]||ji,at=Mt=>iSe[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(te,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(vc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(te,{onClick:()=>A(!0),className:"w-full sm:w-auto",children:[r.jsx(_n,{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=at(Mt.icon),Xt=(o==null?void 0:o[Mt.id])||0,Sr=Pe(Mt.id),an=s==null?void 0:s.find(Xr=>Xr.id===(Sr==null?void 0:Sr.plan_id)),wn=N===Mt.id;return r.jsxs("button",{onClick:()=>M(Mt.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${wn?"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:[Xt," contacts"]})]}),an?r.jsxs(Lt,{variant:"secondary",className:"text-xs",children:[r.jsx(Ii,{className:"h-3 w-3 mr-1"}),an.name.split(" ")[0]]}):r.jsx(Lt,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},Mt.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:N&&Ye?r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[(()=>{const Mt=at(Ye.icon);return r.jsx(Mt,{className:"h-5 w-5"})})(),Ye.name," Touchpoint Plan"]}),r.jsxs(Cn,{children:["Choose a plan for your ",Ye.name," contacts"]})]}),r.jsxs(et,{className:"space-y-6",children:[Me&&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(Ii,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Me.name]}),Me.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Me.description})]}),r.jsx(te,{variant:"outline",size:"sm",onClick:()=>Ue(Me.id,N),children:"Disable"})]}),Me.items&&Me.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(Ds,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:rde.map((Mt,wt)=>{var wn,Xr;const Xt=((wn=Me.items)==null?void 0:wn.filter(Pn=>Pn.month_number===wt+1))||[],Sr=(Xr=Xt[0])==null?void 0:Xr.action_type,an=Sr?Je(Sr.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${Xt.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:Mt}),an&&r.jsx(an,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Sr==null?void 0:Sr.color)||"#3B82F6"}})]},wt)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Me?"Switch to a Different Plan":"Choose a Plan"}),Re.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"}),Re.map(Mt=>{var Xt;const wt=(Me==null?void 0:Me.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:[((Xt=Mt.items)==null?void 0:Xt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:S.isPending,onClick:()=>{const Sr=`${Mt.name} (Copy)`;S.mutate({sourcePlanId:Mt.id,newName:Sr})},children:r.jsx(tl,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:wt?"outline":"default",disabled:wt||u.isPending,onClick:()=>Ue(Mt.id,N),children:wt?"Active":"Use This"})]})]},Mt.id)})]}),Be.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Be.map(Mt=>{var Xt;const wt=(Me==null?void 0:Me.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:[((Xt=Mt.items)==null?void 0:Xt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>Ve(Mt),children:r.jsx(R0,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(Mt.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})}),r.jsx(te,{size:"sm",variant:wt?"outline":"default",disabled:wt||u.isPending,onClick:()=>Ue(Mt.id,N),children:wt?"Active":"Use This"})]})]},Mt.id)})]}),Re.length===0&&Be.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(Ke,{children:r.jsxs(et,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Ds,{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(Ke,{className:"bg-muted/50",children:r.jsx(et,{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(Dr,{open:E,onOpenChange:Mt=>{Mt?A(!0):Le()},children:r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{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(qe,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(ot,{id:"plan-name",value:R,onChange:Mt=>U(Mt.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(ss,{id:"plan-description",value:V,onChange:Mt=>K(Mt.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"12-Month Schedule"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),r.jsx("div",{className:"grid grid-cols-6 gap-2",children:rde.map((Mt,wt)=>{const Xt=wt+1,Sr=W.find(Xr=>Xr.month_number===Xt),an=Sr?l==null?void 0:l.find(Xr=>Xr.id===Sr.action_type_id):null,wn=an?Je(an.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>oe(ae===Xt?null:Xt),className:` w-full p-3 rounded-lg border text-center transition-all ${Sr?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ae===Xt?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:Mt}),wn?r.jsx(wn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(an==null?void 0:an.color)||"#3B82F6"}}):r.jsx(_n,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Sr&&r.jsx("button",{type:"button",onClick:Xr=>{Xr.stopPropagation(),st(Xt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(gs,{className:"h-3 w-3"})})]},wt)})}),ae!==null&&!xe&&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 ",rde[ae-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(Mt=>Mt.active).map(Mt=>{const wt=Je(Mt.icon);return r.jsxs("button",{type:"button",onClick:()=>We(ae,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)})})]}),ae!==null&&xe&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ie(null),children:[r.jsx(vc,{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:()=>_e(ae,xe),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"})]})}),Ee==null?void 0:Ee.map(Mt=>r.jsx("button",{type:"button",onClick:()=>_e(ae,xe,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(Lt,{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(_n,{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"})]})]})]})]})]}),W.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[W.length," touchpoint",W.length!==1?"s":""," per year"]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:Le,children:"Cancel"}),r.jsxs(te,{onClick:P?le:Qe,disabled:!R.trim()||p.isPending||x.isPending,children:[r.jsx(km,{className:"h-4 w-4 mr-2"}),P?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Dr,{open:pe,onOpenChange:se,children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsx(Br,{children:r.jsx(zr,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script-title",children:"Script Title"}),r.jsx(ot,{id:"script-title",value:fe,onChange:Mt=>he(Mt.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(xn,{value:be,onValueChange:rt,children:[r.jsx(fn,{children:r.jsx(vn,{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"})]})]})]}),((gt=(pt=l==null?void 0:l.find(Mt=>Mt.id===xe))==null?void 0:pt.name)==null?void 0:gt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(ot,{id:"script-email-subject",value:Se,onChange:Mt=>Ne(Mt.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(qe,{htmlFor:"script-body",children:"Script Content"}),r.jsx(ss,{id:"script-body",value:ye,onChange:Mt=>Ce(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(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>se(!1),children:"Cancel"}),r.jsxs(te,{onClick:ze,disabled:!fe.trim()||!ye.trim()||w.isPending,children:[r.jsx(km,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const v4t="0dde5abb-0005-4c8c-a471-30d0cbc9e280",_4t=[{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 b4t(){const t=Gn(),e=A7e(),{data:n}=C7e(),{data:s}=Lm(),{data:a}=Xye(),{data:o}=dae(90),{data:l}=mp(),i=BNt(),u=E7e(),p=FNt(),x=zNt(),{data:y=[],isLoading:_}=Kt({queryKey:["popby-templates"],queryFn:async()=>{const{data:pe,error:se}=await Q.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",v4t).order("publish_date",{ascending:!1});if(se)throw se;const{data:fe}=await Q.from("template_likes").select("template_id"),{data:he}=await Q.from("template_comments").select("template_id"),ye=new Map;fe==null||fe.forEach(Se=>{ye.set(Se.template_id,(ye.get(Se.template_id)||0)+1)});const Ce=new Map;return he==null||he.forEach(Se=>{Ce.set(Se.template_id,(Ce.get(Se.template_id)||0)+1)}),(pe||[]).map(Se=>({...Se,likesCount:ye.get(Se.id)||0,commentsCount:Ce.get(Se.id)||0}))}}),w=pe=>{const se=l==null?void 0:l.find(fe=>fe.id===pe);return se?`${se.first_name} ${se.last_name||""}`.trim():"Unknown"},S=pe=>{if(!pe)return null;const se=n==null?void 0:n.find(fe=>fe.id===pe);return(se==null?void 0:se.name)||null},[N,M]=I.useState(null),[E,A]=I.useState(!1),[P,z]=I.useState(!1),[R,U]=I.useState(!1),[V,K]=I.useState({popby_item_id:"",notes:""}),[W,J]=I.useState({name:"",description:""}),ae=async()=>{N&&(await u.mutateAsync({contact_id:N.id,popby_item_id:V.popby_item_id||void 0,notes:V.notes||void 0}),A(!1),M(null),K({popby_item_id:"",notes:""}))},oe=async()=>{W.name.trim()&&(await p.mutateAsync({name:W.name.trim(),description:W.description.trim()||void 0}),U(!1),J({name:"",description:""}))},xe=async(pe,se)=>{await x.mutateAsync({relationship_type_id:pe,frequency_days:parseInt(se)})},ie=pe=>{var fe;const se=a==null?void 0:a.find(he=>he.relationship_type_id===pe);return((fe=se==null?void 0:se.frequency_days)==null?void 0:fe.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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{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(te,{onClick:()=>t("/mission-control/popbys/map"),children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(te,{variant:"outline",onClick:()=>z(!0),children:[r.jsx(jd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(te,{variant:"outline",onClick:()=>U(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(ki,{defaultValue:"due",children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"due",children:"Due for Popby"}),r.jsx(rn,{value:"activity",children:"Recent Activity"}),r.jsx(rn,{value:"library",children:"Popby Library"}),r.jsx(rn,{value:"templates",children:"Popby Templates"})]}),r.jsx(Sn,{value:"due",className:"space-y-4 mt-4",children:!e||e.length===0?r.jsx(Ke,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Zi,{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(Ke,{className:"hover:shadow-md transition-shadow",children:r.jsx(et,{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(Lt,{variant:"destructive",className:"text-xs",children:[pe.daysOverdue,"+ days overdue"]}),pe.daysSinceLastPopby===null&&r.jsx(Lt,{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(To,{className:"h-3 w-3"}),pe.city||pe.address]}),pe.tags&&pe.tags.length>0&&r.jsx("span",{children:pe.tags.map(se=>{var fe;return(fe=se.relationship_type)==null?void 0:fe.name}).join(", ")})]}),pe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",mn(new Date(pe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[pe.phone&&r.jsx(te,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${pe.phone}`,children:r.jsx(ji,{className:"h-4 w-4"})})}),r.jsxs(te,{size:"sm",onClick:()=>{M(pe),A(!0)},children:[r.jsx(Ii,{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(Ke,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Wa,{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(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(et,{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(Zi,{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:w(pe.contact_id)}),S(pe.popby_item_id)&&r.jsx(Lt,{variant:"secondary",className:"text-xs",children:S(pe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:mn(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(Ke,{children:r.jsx(et,{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(Zi,{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(Lt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},pe.id)),r.jsx(Ke,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>U(!0),children:r.jsx(et,{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(_n,{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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx($l,{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(Ke,{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(et,{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:Vne(pe.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Lt,{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(kd,{className:"h-3.5 w-3.5"}),pe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bl,{className:"h-3.5 w-3.5"}),pe.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:se=>{se.stopPropagation(),t(`/templates/${pe.id}`)},children:[r.jsx(Os,{className:"h-4 w-4"}),"View Template"]})]})]},pe.id))})]})]}),r.jsx(Dr,{open:E,onOpenChange:A,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{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(qe,{children:"Popby Item (optional)"}),r.jsxs(xn,{value:V.popby_item_id,onValueChange:pe=>K(se=>({...se,popby_item_id:pe})),children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{children:"Notes (optional)"}),r.jsx(ss,{placeholder:"Any notes about this popby...",value:V.notes,onChange:pe=>K(se=>({...se,notes:pe.target.value}))})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(te,{onClick:ae,disabled:u.isPending,children:"Log Popby"})]})]})}),r.jsx(Dr,{open:P,onOpenChange:z,children:r.jsxs(Or,{className:"max-w-md",children:[r.jsx(Br,{children:r.jsx(zr,{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(qe,{className:"font-medium",children:pe.name}),r.jsxs(xn,{value:ie(pe.id),onValueChange:se=>xe(pe.id,se),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{})}),r.jsx(pn,{children:_4t.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]},pe.id))]}),r.jsx(Ws,{children:r.jsx(te,{onClick:()=>z(!1),children:"Done"})})]})}),r.jsx(Dr,{open:R,onOpenChange:U,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Name *"}),r.jsx(ot,{placeholder:"e.g., Homemade cookies",value:W.name,onChange:pe=>J(se=>({...se,name:pe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(ss,{placeholder:"Optional description...",value:W.description,onChange:pe=>J(se=>({...se,description:pe.target.value}))})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),r.jsx(te,{onClick:oe,disabled:!W.name.trim()||p.isPending,children:"Add Item"})]})]})})]})})}function w4t(){const t=Gn(),{isAdmin:e}=Qr(),n=I.useRef(null),s=I.useRef(null),a=I.useRef([]),o=T7e(),{data:l}=C7e(),i=E7e(),[u,p]=I.useState(""),[x,y]=I.useState(""),[_,w]=I.useState(!0),[S,N]=I.useState(null),[M,E]=I.useState(null),[A,P]=I.useState(!1),[z,R]=I.useState({popby_item_id:"",notes:""}),U=o.filter(J=>J.address||J.city&&J.state);I.useEffect(()=>{(async()=>{w(!0);try{const{data:ae}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ae!=null&&ae.value&&p(ae.value)}catch(ae){console.error("Error fetching mapbox token:",ae)}w(!1)})()},[]),I.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(J=>{N([J.coords.longitude,J.coords.latitude])},J=>{console.log("Could not get location:",J)})},[]),I.useEffect(()=>{if(!(!n.current||!u||s.current))return tc.accessToken=u,s.current=new tc.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:S?12:4,center:S||[-98.5795,39.8283]}),s.current.addControl(new tc.NavigationControl,"top-right"),()=>{var J;(J=s.current)==null||J.remove(),s.current=null}},[u,S]),I.useEffect(()=>{!s.current||!u||(a.current.forEach(J=>J.remove()),a.current=[],U.forEach(async J=>{var oe;const ae=[J.address,J.city,J.state,J.zip].filter(Boolean).join(", ");if(ae)try{const ie=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ae)}.json?access_token=${u}`)).json();if(ie.features&&ie.features.length>0){const[pe,se]=ie.features[0].center,fe=document.createElement("div");fe.className="cursor-pointer",fe.innerHTML=`
${J.first_name[0]}${((oe=J.last_name)==null?void 0:oe[0])||""}
${J.isDue?'
':""}
`;const he=new tc.Marker(fe).setLngLat([pe,se]).addTo(s.current);fe.addEventListener("click",()=>{E(J)}),a.current.push(he)}}catch(xe){console.error("Geocoding error for",J.first_name,xe)}}))},[U,u]);const V=()=>{S&&s.current?s.current.flyTo({center:S,zoom:13}):ga({title:"Location not available",description:"Please enable location services",variant:"destructive"})},K=async()=>{M&&(await i.mutateAsync({contact_id:M.id,popby_item_id:z.popby_item_id||void 0,notes:z.notes||void 0,latitude:S==null?void 0:S[1],longitude:S==null?void 0:S[0]}),P(!1),E(null),R({popby_item_id:"",notes:""}))},W=async()=>{if(x.trim())try{await Q.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),p(x.trim()),ga({title:"Mapbox token saved!"})}catch{ga({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"})})}):u?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(te,{variant:"ghost",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(te,{onClick:V,children:[r.jsx(KT,{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"}),U.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(pl,{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."})]})})]}),M&&r.jsx(Ke,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(et,{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:[M.first_name," ",M.last_name]}),M.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[M.city,", ",M.state]})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>E(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[M.isDue?r.jsxs(Lt,{variant:"destructive",children:[M.daysOverdue,"+ days overdue"]}):r.jsx(Lt,{variant:"secondary",children:"Up to date"}),M.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",mn(new Date(M.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[M.phone&&r.jsx(te,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${M.phone}`,children:[r.jsx(ji,{className:"h-4 w-4 mr-1"}),"Call"]})}),M.address&&r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const J=[M.address,M.city,M.state,M.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(J)}`,"_blank")},children:[r.jsx(eA,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(te,{size:"sm",className:"flex-1",onClick:()=>P(!0),children:[r.jsx(Zi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Dr,{open:A,onOpenChange:P,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{children:["Log Popby for ",M==null?void 0:M.first_name," ",M==null?void 0:M.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Popby Item (optional)"}),r.jsxs(xn,{value:z.popby_item_id,onValueChange:J=>R(ae=>({...ae,popby_item_id:J})),children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:l==null?void 0:l.map(J=>r.jsx(qt,{value:J.id,children:J.name},J.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Notes (optional)"}),r.jsx(ss,{placeholder:"Any notes about this popby...",value:z.notes,onChange:J=>R(ae=>({...ae,notes:J.target.value}))})]}),S&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(To,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsxs(te,{onClick:K,disabled:i.isPending,children:[r.jsx(Ii,{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(Ke,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(To,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Mapbox Public Token"}),r.jsx(ot,{placeholder:"pk.eyJ1I...",value:x,onChange:J=>y(J.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(te,{onClick:W,className:"w-full",children:"Save Token"}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(io,{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(Ke,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(pl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const j4t=b3({property_address:fc().min(1,"Property address is required"),city:fc().optional(),state:fc().optional(),zip:fc().optional(),transaction_type:gOe(["buyer","seller"]),close_date:fc().min(1,"Close date is required"),sale_price:bA().min(0,"Sale price must be positive"),commission_amount:bA().optional(),lead_source_id:fc().optional(),client_type_id:fc().optional(),contact_id:fc().optional(),notes:fc().optional(),is_win:tct()});function L7e({open:t,onOpenChange:e,transaction:n}){const[s,a]=I.useState(!1),[o,l]=I.useState(""),[i,u]=I.useState(!1),[p,x]=I.useState(""),y=Fse(),_=lmt(),{data:w}=Rse(),{data:S}=Lm(),{data:N}=mp(),M=qxe(),E=omt(),{data:A}=zse(),P=(A==null?void 0:A.show_commission)??!0,z=Nse({resolver:Sse(j4t),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 R=async W=>{const J={property_address:W.property_address,transaction_type:W.transaction_type,close_date:W.close_date,sale_price:W.sale_price,is_win:W.is_win,commission_amount:W.commission_amount||null,lead_source_id:W.lead_source_id||null,client_type_id:W.client_type_id||null,contact_id:W.contact_id||null,city:W.city||null,state:W.state||null,zip:W.zip||null,notes:W.notes||null};n?await _.mutateAsync({id:n.id,...J}):await y.mutateAsync(J),e(!1)},U=async()=>{if(!o.trim())return;const[W,...J]=o.trim().split(" "),ae=J.join(" ")||null,oe=await M.mutateAsync({first_name:W,last_name:ae,tagIds:[]});oe&&(z.setValue("contact_id",oe.id),l(""),u(!1),a(!1))},V=async()=>{if(!p.trim())return;const W=await E.mutateAsync(p.trim());W&&(z.setValue("lead_source_id",W.id),x(""))},K=N==null?void 0:N.find(W=>W.id===z.watch("contact_id"));return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(Br,{children:r.jsx(zr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Ro,{className:"max-h-[70vh] pr-4",children:r.jsx(Cse,{...z,children:r.jsxs("form",{onSubmit:z.handleSubmit(R),className:"space-y-4",children:[r.jsx(El,{control:z.control,name:"property_address",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Property Address *"}),r.jsx(Nl,{children:r.jsx(ot,{placeholder:"123 Main St",...W})}),r.jsx($u,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(El,{control:z.control,name:"city",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"City"}),r.jsx(Nl,{children:r.jsx(ot,{placeholder:"City",...W})})]})}),r.jsx(El,{control:z.control,name:"state",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"State"}),r.jsx(Nl,{children:r.jsx(ot,{placeholder:"TX",...W})})]})}),r.jsx(El,{control:z.control,name:"zip",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Zip"}),r.jsx(Nl,{children:r.jsx(ot,{placeholder:"75001",...W})})]})})]}),r.jsx(El,{control:z.control,name:"transaction_type",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Transaction Type *"}),r.jsxs(xn,{onValueChange:W.onChange,value:W.value,children:[r.jsx(Nl,{children:r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select type"})})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]}),r.jsx($u,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(El,{control:z.control,name:"close_date",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Close Date *"}),r.jsx(Nl,{children:r.jsx(ot,{type:"date",...W})}),r.jsx($u,{})]})}),r.jsx(El,{control:z.control,name:"sale_price",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Sale Price *"}),r.jsx(Nl,{children:r.jsx(ot,{type:"number",placeholder:"0",...W,onChange:J=>W.onChange(Number(J.target.value))})}),r.jsx($u,{})]})})]}),P&&r.jsx(El,{control:z.control,name:"commission_amount",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Commission"}),r.jsx(Nl,{children:r.jsx(ot,{type:"number",placeholder:"0",...W,value:W.value??"",onChange:J=>W.onChange(J.target.value?Number(J.target.value):void 0)})})]})}),r.jsx(El,{control:z.control,name:"lead_source_id",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Lead Source"}),r.jsxs(xn,{onValueChange:W.onChange,value:W.value||"",children:[r.jsx(Nl,{children:r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select source"})})}),r.jsx(pn,{children:w==null?void 0:w.map(J=>r.jsx(qt,{value:J.id,children:J.name},J.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Add custom source...",value:p,onChange:W=>x(W.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:V,disabled:!p.trim(),children:r.jsx(_n,{className:"h-4 w-4"})})]}),r.jsx(El,{control:z.control,name:"client_type_id",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Client Type"}),r.jsxs(xn,{onValueChange:W.onChange,value:W.value||"",children:[r.jsx(Nl,{children:r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select client type"})})}),r.jsx(pn,{children:S==null?void 0:S.map(J=>r.jsx(qt,{value:J.id,children:J.name},J.id))})]})]})}),r.jsx(El,{control:z.control,name:"contact_id",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Client Contact"}),r.jsxs(Cd,{open:s,onOpenChange:a,children:[r.jsx(Md,{asChild:!0,children:r.jsx(Nl,{children:r.jsxs(te,{variant:"outline",role:"combobox",className:zt("w-full justify-between",!W.value&&"text-muted-foreground"),children:[K?`${K.first_name} ${K.last_name||""}`.trim():"Select contact",r.jsx(Qx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(ed,{className:"w-full p-0",align:"start",children:[r.jsxs(by,{children:[r.jsx(wy,{placeholder:"Search contacts..."}),r.jsxs(jy,{children:[r.jsx(ky,{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(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>u(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(Ny,{children:N==null?void 0:N.map(J=>r.jsxs(Sy,{value:`${J.first_name} ${J.last_name||""}`,onSelect:()=>{W.onChange(J.id),a(!1)},children:[r.jsx(_i,{className:zt("mr-2 h-4 w-4",J.id===W.value?"opacity-100":"opacity-0")}),J.first_name," ",J.last_name||""]},J.id))})]})]}),i&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(ot,{placeholder:"Enter contact name...",value:o,onChange:J=>l(J.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",onClick:U,disabled:!o.trim()||M.isPending,children:"Add Contact"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>{u(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(El,{control:z.control,name:"notes",render:({field:W})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Notes"}),r.jsx(Nl,{children:r.jsx(ss,{placeholder:"Any notes about this transaction...",...W})})]})}),r.jsx(El,{control:z.control,name:"is_win",render:({field:W})=>r.jsxs(jl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(kl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(Nl,{children:r.jsx(Ss,{checked:W.value,onCheckedChange:W.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:y.isPending||_.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function O7e({transactions:t,showCommission:e,isLoading:n}){const[s,a]=I.useState(null),[o,l]=I.useState(null),[i,u]=I.useState(""),[p,x]=I.useState("all"),[y,_]=I.useState("all"),[w,S]=I.useState("all"),[N,M]=I.useState(!1),E=cmt(),A=Fse(),{data:P}=Rse(),{data:z}=Lm(),R=S3(),U=W=>{const{id:J,created_at:ae,updated_at:oe,lead_source:xe,client_type:ie,contact:pe,...se}=W;A.mutate(se)},V=()=>{o&&(E.mutate(o),l(null))},K=t.filter(W=>{var pe,se,fe,he;const J=i===""||W.property_address.toLowerCase().includes(i.toLowerCase())||((se=(pe=W.contact)==null?void 0:pe.first_name)==null?void 0:se.toLowerCase().includes(i.toLowerCase()))||((he=(fe=W.contact)==null?void 0:fe.last_name)==null?void 0:he.toLowerCase().includes(i.toLowerCase())),ae=p==="all"||W.transaction_type===p,oe=y==="all"||W.lead_source_id===y,xe=w==="all"||W.client_type_id===w,ie=!N||W.is_win;return J&&ae&&oe&&xe&&ie});return n?r.jsx(Ke,{children:r.jsx(et,{className:"p-6 space-y-4",children:[1,2,3].map(W=>r.jsx(Ir,{className:"h-16 w-full"},W))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(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(ya,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search...",value:i,onChange:W=>u(W.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(xn,{value:p,onValueChange:x,children:[r.jsx(fn,{className:"w-[100px]",children:r.jsx(vn,{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(xn,{value:y,onValueChange:_,children:[r.jsx(fn,{className:"w-[130px]",children:r.jsx(vn,{placeholder:"Lead Source"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Sources"}),P==null?void 0:P.map(W=>r.jsx(qt,{value:W.id,children:W.name},W.id))]})]}),r.jsxs(te,{variant:N?"default":"outline",size:"sm",onClick:()=>M(!N),children:[r.jsx(Rl,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(et,{children:K.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):R?r.jsx("div",{className:"space-y-3",children:K.map(W=>r.jsxs(Ke,{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:W.property_address}),W.is_win&&r.jsx(Rl,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[W.city,W.state?`, ${W.state}`:""]})]}),r.jsx(Lt,{variant:W.transaction_type==="buyer"?"default":"secondary",children:W.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: "}),kwe(W.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),Ud(W.sale_price)]}),e&&W.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),Ud(W.commission_amount)]}),W.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),W.lead_source.name]}),W.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),W.contact.first_name," ",W.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>a(W),children:r.jsx(hc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>U(W),children:r.jsx(tl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>l(W.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})]},W.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(W=>{var J;return r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[W.is_win&&r.jsx(Rl,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:W.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[W.city,W.state?`, ${W.state}`:""]})]})]})}),r.jsx(jt,{children:r.jsx(Lt,{variant:W.transaction_type==="buyer"?"default":"secondary",children:W.transaction_type})}),r.jsx(jt,{children:kwe(W.close_date)}),r.jsx(jt,{children:Ud(W.sale_price)}),e&&r.jsx(jt,{children:W.commission_amount?Ud(W.commission_amount):"-"}),r.jsx(jt,{children:((J=W.lead_source)==null?void 0:J.name)||"-"}),r.jsx(jt,{children:W.contact?`${W.contact.first_name} ${W.contact.last_name||""}`.trim():"-"}),r.jsx(jt,{children:r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(Rx,{className:"h-4 w-4"})})}),r.jsxs(eh,{align:"end",children:[r.jsxs(ri,{onClick:()=>a(W),children:[r.jsx(hc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(ri,{onClick:()=>U(W),children:[r.jsx(tl,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(ri,{onClick:()=>l(W.id),className:"text-destructive",children:[r.jsx($n,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},W.id)})})]})})})]}),r.jsx(L7e,{open:!!s,onOpenChange:W=>!W&&a(null),transaction:s||void 0}),r.jsx(pu,{open:!!o,onOpenChange:W=>!W&&l(null),children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Delete Transaction?"}),r.jsx(Zd,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:V,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function D7e({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=(_,w)=>{if(!w||w===0)return null;const S=Math.min(_/w*100,100),N=Math.max(w-_,0),M=l>0?N/l:0,E=o/12*100,A=S>=E?"ahead":S>=E*.8?"on-track":"behind";return{percent:S,remaining:N,pace:M,status:A}},u=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(Lt,{className:"bg-green-500 text-white",children:[r.jsx(ap,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Lt,{variant:"secondary",children:[r.jsx(F1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Lt,{variant:"destructive",children:[r.jsx(Ij,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!t.transactions_goal&&!t.volume_goal&&!t.gci_goal?null:r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sy,{className:"h-5 w-5 text-primary"}),r.jsxs(Zt,{children:[n," Goals Progress"]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[t.transactions_goal&&u&&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(u.status)]}),r.jsx(Jc,{value:u.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(u.percent),"%"]})]}),u.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(u.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(Jc,{value:p.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Ud(e.totalVolume,!0)," of ",Ud(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 ",Ud(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(Jc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Ud(e.totalCommission,!0)," of ",Ud(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 ",Ud(x.pace,!0),"/month"]})]})]})})]})}var k4t=Array.isArray,Ih=k4t,N4t=typeof $x=="object"&&$x&&$x.Object===Object&&$x,R7e=N4t,S4t=R7e,C4t=typeof self=="object"&&self&&self.Object===Object&&self,M4t=S4t||C4t||Function("return this")(),Xg=M4t,T4t=Xg,A4t=T4t.Symbol,QI=A4t,oSe=QI,F7e=Object.prototype,E4t=F7e.hasOwnProperty,I4t=F7e.toString,rT=oSe?oSe.toStringTag:void 0;function P4t(t){var e=E4t.call(t,rT),n=t[rT];try{t[rT]=void 0;var s=!0}catch{}var a=I4t.call(t);return s&&(e?t[rT]=n:delete t[rT]),a}var L4t=P4t,O4t=Object.prototype,D4t=O4t.toString;function R4t(t){return D4t.call(t)}var F4t=R4t,lSe=QI,z4t=L4t,B4t=F4t,$4t="[object Null]",U4t="[object Undefined]",cSe=lSe?lSe.toStringTag:void 0;function q4t(t){return t==null?t===void 0?U4t:$4t:cSe&&cSe in Object(t)?z4t(t):B4t(t)}var Ly=q4t;function V4t(t){return t!=null&&typeof t=="object"}var Oy=V4t,H4t=Ly,W4t=Oy,G4t="[object Symbol]";function K4t(t){return typeof t=="symbol"||W4t(t)&&H4t(t)==G4t}var C3=K4t,Z4t=Ih,Y4t=C3,X4t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q4t=/^\w*$/;function J4t(t,e){if(Z4t(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Y4t(t)?!0:Q4t.test(t)||!X4t.test(t)||e!=null&&t in Object(e)}var Jye=J4t;function eSt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var wv=eSt;const M3=Wi(wv);var tSt=Ly,rSt=wv,nSt="[object AsyncFunction]",sSt="[object Function]",aSt="[object GeneratorFunction]",iSt="[object Proxy]";function oSt(t){if(!rSt(t))return!1;var e=tSt(t);return e==sSt||e==aSt||e==nSt||e==iSt}var e0e=oSt;const Va=Wi(e0e);var lSt=Xg,cSt=lSt["__core-js_shared__"],dSt=cSt,nde=dSt,dSe=function(){var t=/[^.]+$/.exec(nde&&nde.keys&&nde.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function uSt(t){return!!dSe&&dSe in t}var hSt=uSt,fSt=Function.prototype,pSt=fSt.toString;function mSt(t){if(t!=null){try{return pSt.call(t)}catch{}try{return t+""}catch{}}return""}var z7e=mSt,gSt=e0e,xSt=hSt,ySt=wv,vSt=z7e,_St=/[\\^$.*+?()[\]{}|]/g,bSt=/^\[object .+?Constructor\]$/,wSt=Function.prototype,jSt=Object.prototype,kSt=wSt.toString,NSt=jSt.hasOwnProperty,SSt=RegExp("^"+kSt.call(NSt).replace(_St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function CSt(t){if(!ySt(t)||xSt(t))return!1;var e=gSt(t)?SSt:bSt;return e.test(vSt(t))}var MSt=CSt;function TSt(t,e){return t==null?void 0:t[e]}var ASt=TSt,ESt=MSt,ISt=ASt;function PSt(t,e){var n=ISt(t,e);return ESt(n)?n:void 0}var bk=PSt,LSt=bk,OSt=LSt(Object,"create"),uae=OSt,uSe=uae;function DSt(){this.__data__=uSe?uSe(null):{},this.size=0}var RSt=DSt;function FSt(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var zSt=FSt,BSt=uae,$St="__lodash_hash_undefined__",USt=Object.prototype,qSt=USt.hasOwnProperty;function VSt(t){var e=this.__data__;if(BSt){var n=e[t];return n===$St?void 0:n}return qSt.call(e,t)?e[t]:void 0}var HSt=VSt,WSt=uae,GSt=Object.prototype,KSt=GSt.hasOwnProperty;function ZSt(t){var e=this.__data__;return WSt?e[t]!==void 0:KSt.call(e,t)}var YSt=ZSt,XSt=uae,QSt="__lodash_hash_undefined__";function JSt(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=XSt&&e===void 0?QSt:e,this}var eCt=JSt,tCt=RSt,rCt=zSt,nCt=HSt,sCt=YSt,aCt=eCt;function T3(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var wCt=bCt,jCt=hae;function kCt(t,e){var n=this.__data__,s=jCt(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this}var NCt=kCt,SCt=lCt,CCt=gCt,MCt=vCt,TCt=wCt,ACt=NCt;function A3(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},tj=function(e){return ok(e)&&e.indexOf("%")===e.length-1},Dn=function(e){return Y3t(e)&&!JI(e)},e5t=function(e){return wi(e)},Xc=function(e){return Dn(e)||ok(e)},t5t=0,eP=function(e){var n=++t5t;return"".concat(e||"").concat(n)},Vu=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)&&!ok(e))return s;var o;if(tj(e)){var l=e.indexOf("%");o=n*parseFloat(e.slice(0,l))/100}else o=+e;return JI(o)&&(o=s),a&&o>n&&(o=n),o},J0=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},r5t=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 c5t(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 ySe={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"},cy=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},vSe=null,ade=null,d0e=function t(e){if(e===vSe&&Array.isArray(ade))return ade;var n=[];return I.Children.forEach(e,function(s){wi(s)||(H3t.isFragment(s)?n=n.concat(t(s.props.children)):n.push(s))}),ade=n,vSe=e,n};function cp(t,e){var n=[],s=[];return Array.isArray(e)?s=e.map(function(a){return cy(a)}):s=[cy(e)],d0e(t).forEach(function(a){var o=mf(a,"type.displayName")||mf(a,"type.name");s.indexOf(o)!==-1&&n.push(a)}),n}function Zh(t,e){var n=cp(t,e);return n&&n[0]}var _Se=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)},d5t=["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"],u5t=function(e){return e&&e.type&&ok(e.type)&&d5t.indexOf(e.type)>=0},h5t=function(e,n,s,a){var o,l=(o=sde==null?void 0:sde[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Va(e)&&(a&&l.includes(n)||a5t.includes(n))||s&&c0e.includes(n)},Oa=function(e,n,s){if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(I.isValidElement(e)&&(a=e.props),!M3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;h5t((i=a)===null||i===void 0?void 0:i[l],l,n,s)&&(o[l]=a[l])}),o},Ofe=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 bSe(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 x5t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function Rfe(t){var e=t.children,n=t.width,s=t.height,a=t.viewBox,o=t.className,l=t.style,i=t.title,u=t.desc,p=g5t(t,m5t),x=a||{width:n,height:s,x:0,y:0},y=oi("recharts-surface",o);return it.createElement("svg",Dfe({},Oa(p,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),it.createElement("title",null,i),it.createElement("desc",null,u),e)}var y5t=["children","className"];function Ffe(){return Ffe=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 _5t(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 So=it.forwardRef(function(t,e){var n=t.children,s=t.className,a=v5t(t,y5t),o=oi("recharts-layer",s);return it.createElement("g",Ffe({className:o},Oa(a,!0),{ref:e}),n)}),Sm=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:j5t(t,e,n)}var N5t=k5t,S5t="\\ud800-\\udfff",C5t="\\u0300-\\u036f",M5t="\\ufe20-\\ufe2f",T5t="\\u20d0-\\u20ff",A5t=C5t+M5t+T5t,E5t="\\ufe0e\\ufe0f",I5t="\\u200d",P5t=RegExp("["+I5t+S5t+A5t+E5t+"]");function L5t(t){return P5t.test(t)}var Z7e=L5t;function O5t(t){return t.split("")}var D5t=O5t,Y7e="\\ud800-\\udfff",R5t="\\u0300-\\u036f",F5t="\\ufe20-\\ufe2f",z5t="\\u20d0-\\u20ff",B5t=R5t+F5t+z5t,$5t="\\ufe0e\\ufe0f",U5t="["+Y7e+"]",zfe="["+B5t+"]",Bfe="\\ud83c[\\udffb-\\udfff]",q5t="(?:"+zfe+"|"+Bfe+")",X7e="[^"+Y7e+"]",Q7e="(?:\\ud83c[\\udde6-\\uddff]){2}",J7e="[\\ud800-\\udbff][\\udc00-\\udfff]",V5t="\\u200d",eBe=q5t+"?",tBe="["+$5t+"]?",H5t="(?:"+V5t+"(?:"+[X7e,Q7e,J7e].join("|")+")"+tBe+eBe+")*",W5t=tBe+eBe+H5t,G5t="(?:"+[X7e+zfe+"?",zfe,Q7e,J7e,U5t].join("|")+")",K5t=RegExp(Bfe+"(?="+Bfe+")|"+G5t+W5t,"g");function Z5t(t){return t.match(K5t)||[]}var Y5t=Z5t,X5t=D5t,Q5t=Z7e,J5t=Y5t;function eMt(t){return Q5t(t)?J5t(t):X5t(t)}var tMt=eMt,rMt=N5t,nMt=Z7e,sMt=tMt,aMt=q7e;function iMt(t){return function(e){e=aMt(e);var n=nMt(e)?sMt(e):void 0,s=n?n[0]:e.charAt(0),a=n?rMt(n,1).join(""):e.slice(1);return s[t]()+a}}var oMt=iMt,lMt=oMt,cMt=lMt("toUpperCase"),dMt=cMt;const Sae=Wi(dMt);function Qo(t){return function(){return t}}const rBe=Math.cos,Mre=Math.sin,Dm=Math.sqrt,Tre=Math.PI,Cae=2*Tre,$fe=Math.PI,Ufe=2*$fe,Rw=1e-6,uMt=Ufe-Rw;function nBe(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return nBe;const n=10**e;return function(s){this._+=s[0];for(let a=1,o=s.length;aRw)if(!(Math.abs(y*u-p*x)>Rw)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let w=s-l,S=a-i,N=u*u+p*p,M=w*w+S*S,E=Math.sqrt(N),A=Math.sqrt(_),P=o*Math.tan(($fe-Math.acos((N+_-M)/(2*E*A)))/2),z=P/A,R=P/E;Math.abs(z-1)>Rw&&this._append`L${e+z*x},${n+z*y}`,this._append`A${o},${o},0,0,${+(y*w>x*S)},${this._x1=e+R*u},${this._y1=n+R*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),u=s*Math.sin(a),p=e+i,x=n+u,y=1^l,_=l?a-o:o-a;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Rw||Math.abs(this._y1-x)>Rw)&&this._append`L${p},${x}`,s&&(_<0&&(_=_%Ufe+Ufe),_>uMt?this._append`A${s},${s},0,1,${y},${e-i},${n-u}A${s},${s},0,1,${y},${this._x1=p},${this._y1=x}`:_>Rw&&this._append`A${s},${s},0,${+(_>=$fe)},${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 u0e(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 fMt(e)}function h0e(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function sBe(t){this._context=t}sBe.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 Mae(t){return new sBe(t)}function aBe(t){return t[0]}function iBe(t){return t[1]}function oBe(t,e){var n=Qo(!0),s=null,a=Mae,o=null,l=u0e(i);t=typeof t=="function"?t:t===void 0?aBe:Qo(t),e=typeof e=="function"?e:e===void 0?iBe:Qo(e);function i(u){var p,x=(u=h0e(u)).length,y,_=!1,w;for(s==null&&(o=a(w=l())),p=0;p<=x;++p)!(p=w;--S)i.point(P[S],z[S]);i.lineEnd(),i.areaEnd()}E&&(P[_]=+t(M,_,y),z[_]=+e(M,_,y),i.point(s?+s(M,_,y):P[_],n?+n(M,_,y):z[_]))}if(A)return i=null,A+""||null}function x(){return oBe().defined(a).curve(l).context(o)}return p.x=function(y){return arguments.length?(t=typeof y=="function"?y:Qo(+y),s=null,p):t},p.x0=function(y){return arguments.length?(t=typeof y=="function"?y:Qo(+y),p):t},p.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:Qo(+y),p):s},p.y=function(y){return arguments.length?(e=typeof y=="function"?y:Qo(+y),n=null,p):e},p.y0=function(y){return arguments.length?(e=typeof y=="function"?y:Qo(+y),p):e},p.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:Qo(+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:Qo(!!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 lBe{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 pMt(t){return new lBe(t,!0)}function mMt(t){return new lBe(t,!1)}const f0e={draw(t,e){const n=Dm(e/Tre);t.moveTo(n,0),t.arc(0,0,n,0,Cae)}},gMt={draw(t,e){const n=Dm(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()}},cBe=Dm(1/3),xMt=cBe*2,yMt={draw(t,e){const n=Dm(e/xMt),s=n*cBe;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}},vMt={draw(t,e){const n=Dm(e),s=-n/2;t.rect(s,s,n,n)}},_Mt=.8908130915292852,dBe=Mre(Tre/10)/Mre(7*Tre/10),bMt=Mre(Cae/10)*dBe,wMt=-rBe(Cae/10)*dBe,jMt={draw(t,e){const n=Dm(e*_Mt),s=bMt*n,a=wMt*n;t.moveTo(0,-n),t.lineTo(s,a);for(let o=1;o<5;++o){const l=Cae*o/5,i=rBe(l),u=Mre(l);t.lineTo(u*n,-i*n),t.lineTo(i*s-u*a,u*s+i*a)}t.closePath()}},ide=Dm(3),kMt={draw(t,e){const n=-Dm(e/(ide*3));t.moveTo(0,n*2),t.lineTo(-ide*n,-n),t.lineTo(ide*n,-n),t.closePath()}},Rf=-.5,Ff=Dm(3)/2,qfe=1/Dm(12),NMt=(qfe/2+1)*3,SMt={draw(t,e){const n=Dm(e/NMt),s=n/2,a=n*qfe,o=s,l=n*qfe+n,i=-o,u=l;t.moveTo(s,a),t.lineTo(o,l),t.lineTo(i,u),t.lineTo(Rf*s-Ff*a,Ff*s+Rf*a),t.lineTo(Rf*o-Ff*l,Ff*o+Rf*l),t.lineTo(Rf*i-Ff*u,Ff*i+Rf*u),t.lineTo(Rf*s+Ff*a,Rf*a-Ff*s),t.lineTo(Rf*o+Ff*l,Rf*l-Ff*o),t.lineTo(Rf*i+Ff*u,Rf*u-Ff*i),t.closePath()}};function CMt(t,e){let n=null,s=u0e(a);t=typeof t=="function"?t:Qo(t||f0e),e=typeof e=="function"?e:Qo(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:Qo(o),a):t},a.size=function(o){return arguments.length?(e=typeof o=="function"?o:Qo(+o),a):e},a.context=function(o){return arguments.length?(n=o??null,a):n},a}function Are(){}function Ere(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 uBe(t){this._context=t}uBe.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:Ere(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:Ere(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function MMt(t){return new uBe(t)}function hBe(t){this._context=t}hBe.prototype={areaStart:Are,areaEnd:Are,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:Ere(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function TMt(t){return new hBe(t)}function fBe(t){this._context=t}fBe.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:Ere(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function AMt(t){return new fBe(t)}function pBe(t){this._context=t}pBe.prototype={areaStart:Are,areaEnd:Are,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 EMt(t){return new pBe(t)}function jSe(t){return t<0?-1:1}function kSe(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(jSe(o)+jSe(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function NSe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function ode(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 Ire(t){this._context=t}Ire.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:ode(this,this._t0,NSe(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,ode(this,NSe(this,n=kSe(this,t,e)),n);break;default:ode(this,this._t0,n=kSe(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function mBe(t){this._context=new gBe(t)}(mBe.prototype=Object.create(Ire.prototype)).point=function(t,e){Ire.prototype.point.call(this,e,t)};function gBe(t){this._context=t}gBe.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 IMt(t){return new Ire(t)}function PMt(t){return new mBe(t)}function xBe(t){this._context=t}xBe.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=SSe(t),a=SSe(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 OMt(t){return new Tae(t,.5)}function DMt(t){return new Tae(t,0)}function RMt(t){return new Tae(t,1)}function IC(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 FMt(t,e){return t[e]}function zMt(t){const e=[];return e.key=t,e}function BMt(){var t=Qo([]),e=Vfe,n=IC,s=FMt;function a(o){var l=Array.from(t.apply(this,arguments),zMt),i,u=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 ZMt(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 yBe={symbolCircle:f0e,symbolCross:gMt,symbolDiamond:yMt,symbolSquare:vMt,symbolStar:jMt,symbolTriangle:kMt,symbolWye:SMt},YMt=Math.PI/180,XMt=function(e){var n="symbol".concat(Sae(e));return yBe[n]||f0e},QMt=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*YMt;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}},JMt=function(e,n){yBe["symbol".concat(Sae(e))]=n},p0e=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,u=KMt(e,VMt),p=MSe(MSe({},u),{},{type:s,size:o,sizeType:i}),x=function(){var M=XMt(s),E=CMt().type(M).size(QMt(o,i,s));return E()},y=p.className,_=p.cx,w=p.cy,S=Oa(p,!0);return _===+_&&w===+w&&o===+o?it.createElement("path",Hfe({},S,{className:oi("recharts-symbols",y),transform:"translate(".concat(_,", ").concat(w,")"),d:x()})):null};p0e.registerSymbol=JMt;function PC(t){"@babel/helpers - typeof";return PC=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},PC(t)}function Wfe(){return Wfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var A=w.inactive?p:w.color;return it.createElement("li",Wfe({className:M,style:y,key:"legend-item-".concat(S)},lk(s.props,w,S)),it.createElement(Rfe,{width:l,height:l,viewBox:x,style:_},s.renderIcon(w)),it.createElement("span",{className:"recharts-legend-item-text",style:{color:A}},N?N(E,w,S):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 it.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(I.PureComponent);LE(m0e,"displayName","Legend");LE(m0e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var cTt=fae;function dTt(){this.__data__=new cTt,this.size=0}var uTt=dTt;function hTt(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var fTt=hTt;function pTt(t){return this.__data__.get(t)}var mTt=pTt;function gTt(t){return this.__data__.has(t)}var xTt=gTt,yTt=fae,vTt=r0e,_Tt=n0e,bTt=200;function wTt(t,e){var n=this.__data__;if(n instanceof yTt){var s=n.__data__;if(!vTt||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,w=n&VTt?new BTt:void 0;for(o.set(t,e),o.set(e,t);++y-1&&t%1==0&&t-1&&t%1==0&&t<=KAt}var v0e=ZAt,YAt=Ly,XAt=v0e,QAt=Oy,JAt="[object Arguments]",eEt="[object Array]",tEt="[object Boolean]",rEt="[object Date]",nEt="[object Error]",sEt="[object Function]",aEt="[object Map]",iEt="[object Number]",oEt="[object Object]",lEt="[object RegExp]",cEt="[object Set]",dEt="[object String]",uEt="[object WeakMap]",hEt="[object ArrayBuffer]",fEt="[object DataView]",pEt="[object Float32Array]",mEt="[object Float64Array]",gEt="[object Int8Array]",xEt="[object Int16Array]",yEt="[object Int32Array]",vEt="[object Uint8Array]",_Et="[object Uint8ClampedArray]",bEt="[object Uint16Array]",wEt="[object Uint32Array]",ul={};ul[pEt]=ul[mEt]=ul[gEt]=ul[xEt]=ul[yEt]=ul[vEt]=ul[_Et]=ul[bEt]=ul[wEt]=!0;ul[JAt]=ul[eEt]=ul[hEt]=ul[tEt]=ul[fEt]=ul[rEt]=ul[nEt]=ul[sEt]=ul[aEt]=ul[iEt]=ul[oEt]=ul[lEt]=ul[cEt]=ul[dEt]=ul[uEt]=!1;function jEt(t){return QAt(t)&&XAt(t.length)&&!!ul[YAt(t)]}var kEt=jEt;function NEt(t){return function(e){return t(e)}}var TBe=NEt,Dre={exports:{}};Dre.exports;(function(t,e){var n=R7e,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 u=a&&a.require&&a.require("util").types;return u||l&&l.binding&&l.binding("util")}catch{}}();t.exports=i})(Dre,Dre.exports);var SEt=Dre.exports,CEt=kEt,MEt=TBe,OSe=SEt,DSe=OSe&&OSe.isTypedArray,TEt=DSe?MEt(DSe):CEt,ABe=TEt,AEt=PAt,EEt=x0e,IEt=Ih,PEt=MBe,LEt=y0e,OEt=ABe,DEt=Object.prototype,REt=DEt.hasOwnProperty;function FEt(t,e){var n=IEt(t),s=!n&&EEt(t),a=!n&&!s&&PEt(t),o=!n&&!s&&!a&&OEt(t),l=n||s||a||o,i=l?AEt(t.length,String):[],u=i.length;for(var p in t)(e||REt.call(t,p))&&!(l&&(p=="length"||a&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||LEt(p,u)))&&i.push(p);return i}var zEt=FEt,BEt=Object.prototype;function $Et(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||BEt;return t===n}var UEt=$Et;function qEt(t,e){return function(n){return t(e(n))}}var EBe=qEt,VEt=EBe,HEt=VEt(Object.keys,Object),WEt=HEt,GEt=UEt,KEt=WEt,ZEt=Object.prototype,YEt=ZEt.hasOwnProperty;function XEt(t){if(!GEt(t))return KEt(t);var e=[];for(var n in Object(t))YEt.call(t,n)&&n!="constructor"&&e.push(n);return e}var QEt=XEt,JEt=e0e,eIt=v0e;function tIt(t){return t!=null&&eIt(t.length)&&!JEt(t)}var tP=tIt,rIt=zEt,nIt=QEt,sIt=tP;function aIt(t){return sIt(t)?rIt(t):nIt(t)}var Aae=aIt,iIt=bAt,oIt=EAt,lIt=Aae;function cIt(t){return iIt(t,lIt,oIt)}var dIt=cIt,RSe=dIt,uIt=1,hIt=Object.prototype,fIt=hIt.hasOwnProperty;function pIt(t,e,n,s,a,o){var l=n&uIt,i=RSe(t),u=i.length,p=RSe(e),x=p.length;if(u!=x&&!l)return!1;for(var y=u;y--;){var _=i[y];if(!(l?_ in e:fIt.call(e,_)))return!1}var w=o.get(t),S=o.get(e);if(w&&S)return w==e&&S==t;var N=!0;o.set(t,e),o.set(e,t);for(var M=l;++y-1}var h6t=u6t;function f6t(t,e,n){for(var s=-1,a=t==null?0:t.length;++s=M6t){var p=e?null:S6t(t);if(p)return C6t(p);l=!1,a=N6t,u=new w6t}else u=e?[]:i;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function V6t(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 H6t(t){return t.value}function W6t(t,e){if(it.isValidElement(t))return it.cloneElement(t,e);if(typeof t=="function")return it.createElement(t,e);e.ref;var n=q6t(e,O6t);return it.createElement(m0e,n)}var JSe=1,HS=function(t){function e(){var n;D6t(this,e);for(var s=arguments.length,a=new Array(s),o=0;oJSe||Math.abs(a.height-this.lastBoundingBox.height)>JSe)&&(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?Cx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,o=a.layout,l=a.align,i=a.verticalAlign,u=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 w=this.getBBoxSnapshot();y={left:((p||0)-w.width)/2}}else y=l==="right"?{right:u&&u.right||0}:{left:u&&u.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(i==="middle"){var S=this.getBBoxSnapshot();_={top:((x||0)-S.height)/2}}else _=i==="bottom"?{bottom:u&&u.bottom||0}:{top:u&&u.top||0};return Cx(Cx({},y),_)}},{key:"render",value:function(){var s=this,a=this.props,o=a.content,l=a.width,i=a.height,u=a.wrapperStyle,p=a.payloadUniqBy,x=a.payload,y=Cx(Cx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(u)),u);return it.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(w){s.wrapperNode=w}},W6t(o,Cx(Cx({},this.props),{},{payload:FBe(x,p,H6t)})))}}],[{key:"getWithHeight",value:function(s,a){var o=Cx(Cx({},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);Eae(HS,"displayName","Legend");Eae(HS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var eCe=QI,G6t=x0e,K6t=Ih,tCe=eCe?eCe.isConcatSpreadable:void 0;function Z6t(t){return K6t(t)||G6t(t)||!!(tCe&&t&&t[tCe])}var Y6t=Z6t,X6t=SBe,Q6t=Y6t;function $Be(t,e,n,s,a){var o=-1,l=t.length;for(n||(n=Q6t),a||(a=[]);++o0&&n(i)?e>1?$Be(i,e-1,n,s,a):X6t(a,i):s||(a[a.length]=i)}return a}var UBe=$Be;function J6t(t){return function(e,n,s){for(var a=-1,o=Object(e),l=s(e),i=l.length;i--;){var u=l[t?i:++a];if(n(o[u],u,o)===!1)break}return e}}var eLt=J6t,tLt=eLt,rLt=tLt(),nLt=rLt,sLt=nLt,aLt=Aae;function iLt(t,e){return t&&sLt(t,e,aLt)}var qBe=iLt,oLt=tP;function lLt(t,e){return function(n,s){if(n==null)return n;if(!oLt(n))return t(n,s);for(var a=n.length,o=e?a:-1,l=Object(n);(e?o--:++oe||o&&l&&u&&!i&&!p||s&&l&&u||!n&&u||!a)return 1;if(!s&&!o&&!p&&t=i)return u;var p=n[s];return u*(p=="desc"?-1:1)}}return t.index-e.index}var wLt=bLt,ude=a0e,jLt=i0e,kLt=Qg,NLt=VBe,SLt=xLt,CLt=TBe,MLt=wLt,TLt=L3,ALt=Ih;function ELt(t,e,n){e.length?e=ude(e,function(o){return ALt(o)?function(l){return jLt(l,o.length===1?o[0]:o)}:o}):e=[TLt];var s=-1;e=ude(e,CLt(kLt));var a=NLt(t,function(o,l,i){var u=ude(e,function(p){return p(o)});return{criteria:u,index:++s,value:o}});return SLt(a,function(o,l){return MLt(o,l,n)})}var ILt=ELt;function PLt(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 LLt=PLt,OLt=LLt,nCe=Math.max;function DLt(t,e,n){return e=nCe(e===void 0?t.length-1:e,0),function(){for(var s=arguments,a=-1,o=nCe(s.length-e,0),l=Array(o);++a0){if(++e>=WLt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var YLt=ZLt,XLt=HLt,QLt=YLt,JLt=QLt(XLt),eOt=JLt,tOt=L3,rOt=RLt,nOt=eOt;function sOt(t,e){return nOt(rOt(t,e,tOt),t+"")}var aOt=sOt,iOt=t0e,oOt=tP,lOt=y0e,cOt=wv;function dOt(t,e,n){if(!cOt(n))return!1;var s=typeof e;return(s=="number"?oOt(n)&&lOt(e,n.length):s=="string"&&e in n)?iOt(n[e],t):!1}var Iae=dOt,uOt=UBe,hOt=ILt,fOt=aOt,aCe=Iae,pOt=fOt(function(t,e){if(t==null)return[];var n=e.length;return n>1&&aCe(t,e[0],e[1])?e=[]:n>2&&aCe(e[0],e[1],e[2])&&(e=[e[0]]),hOt(t,uOt(e,1),[])}),mOt=pOt;const w0e=Wi(mOt);function OE(t){"@babel/helpers - typeof";return OE=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},OE(t)}function epe(){return epe=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(nT,"-left"),Dn(n)&&e&&Dn(e.x)&&n=e.y),"".concat(nT,"-top"),Dn(s)&&e&&Dn(e.y)&&sN?Math.max(x,u[s]):Math.max(y,u[s])}function AOt(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 EOt(t){var e=t.allowEscapeViewBox,n=t.coordinate,s=t.offsetTopLeft,a=t.position,o=t.reverseDirection,l=t.tooltipBox,i=t.useTranslate3d,u=t.viewBox,p,x,y;return l.height>0&&l.width>0&&n?(x=lCe({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),y=lCe({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),p=AOt({translateX:x,translateY:y,useTranslate3d:i})):p=MOt,{cssProperties:p,cssClasses:TOt({translateX:x,translateY:y,coordinate:n})}}function OC(t){"@babel/helpers - typeof";return OC=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},OC(t)}function cCe(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 dCe(t){for(var e=1;euCe||Math.abs(s.height-this.state.lastBoundingBox.height)>uCe)&&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,u=a.animationEasing,p=a.children,x=a.coordinate,y=a.hasPayload,_=a.isAnimationActive,w=a.offset,S=a.position,N=a.reverseDirection,M=a.useTranslate3d,E=a.viewBox,A=a.wrapperStyle,P=EOt({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:w,position:S,reverseDirection:N,tooltipBox:this.state.lastBoundingBox,useTranslate3d:M,viewBox:E}),z=P.cssClasses,R=P.cssProperties,U=dCe(dCe({transition:_&&o?"transform ".concat(i,"ms ").concat(u):void 0},R),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},A);return it.createElement("div",{tabIndex:-1,className:z,style:U,ref:function(K){s.wrapperNode=K}},p)}}])}(I.PureComponent),$Ot=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},O3={isSsr:$Ot()};function DC(t){"@babel/helpers - typeof";return DC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DC(t)}function hCe(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 fCe(t){for(var e=1;e0;return it.createElement(BOt,{allowEscapeViewBox:l,animationDuration:i,animationEasing:u,isAnimationActive:_,active:o,coordinate:x,hasPayload:U,offset:w,position:M,reverseDirection:E,useTranslate3d:A,viewBox:P,wrapperStyle:z},XOt(p,fCe(fCe({},this.props),{},{payload:R})))}}])}(I.PureComponent);j0e(am,"displayName","Tooltip");j0e(am,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!O3.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 QOt=Xg,JOt=function(){return QOt.Date.now()},e8t=JOt,t8t=/\s/;function r8t(t){for(var e=t.length;e--&&t8t.test(t.charAt(e)););return e}var n8t=r8t,s8t=n8t,a8t=/^\s+/;function i8t(t){return t&&t.slice(0,s8t(t)+1).replace(a8t,"")}var o8t=i8t,l8t=o8t,pCe=wv,c8t=C3,mCe=NaN,d8t=/^[-+]0x[0-9a-f]+$/i,u8t=/^0b[01]+$/i,h8t=/^0o[0-7]+$/i,f8t=parseInt;function p8t(t){if(typeof t=="number")return t;if(c8t(t))return mCe;if(pCe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=pCe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=l8t(t);var n=u8t.test(t);return n||h8t.test(t)?f8t(t.slice(2),n?2:8):d8t.test(t)?mCe:+t}var YBe=p8t,m8t=wv,fde=e8t,gCe=YBe,g8t="Expected a function",x8t=Math.max,y8t=Math.min;function v8t(t,e,n){var s,a,o,l,i,u,p=0,x=!1,y=!1,_=!0;if(typeof t!="function")throw new TypeError(g8t);e=gCe(e)||0,m8t(n)&&(x=!!n.leading,y="maxWait"in n,o=y?x8t(gCe(n.maxWait)||0,e):o,_="trailing"in n?!!n.trailing:_);function w(U){var V=s,K=a;return s=a=void 0,p=U,l=t.apply(K,V),l}function S(U){return p=U,i=setTimeout(E,e),x?w(U):l}function N(U){var V=U-u,K=U-p,W=e-V;return y?y8t(W,o-K):W}function M(U){var V=U-u,K=U-p;return u===void 0||V>=e||V<0||y&&K>=o}function E(){var U=fde();if(M(U))return A(U);i=setTimeout(E,N(U))}function A(U){return i=void 0,_&&s?w(U):(s=a=void 0,l)}function P(){i!==void 0&&clearTimeout(i),p=0,s=u=a=i=void 0}function z(){return i===void 0?l:A(fde())}function R(){var U=fde(),V=M(U);if(s=arguments,a=this,u=U,V){if(i===void 0)return S(u);if(y)return clearTimeout(i),i=setTimeout(E,e),w(u)}return i===void 0&&(i=setTimeout(E,e)),l}return R.cancel=P,R.flush=z,R}var _8t=v8t,b8t=_8t,w8t=wv,j8t="Expected a function";function k8t(t,e,n){var s=!0,a=!0;if(typeof t!="function")throw new TypeError(j8t);return w8t(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),b8t(t,e,{leading:s,maxWait:e,trailing:a})}var N8t=k8t;const XBe=Wi(N8t);function RE(t){"@babel/helpers - typeof";return RE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},RE(t)}function xCe(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 oO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&(xe=XBe(xe,N,{trailing:!0,leading:!1}));var ie=new ResizeObserver(xe),pe=R.current.getBoundingClientRect(),se=pe.width,fe=pe.height;return ae(se,fe),ie.observe(R.current),function(){ie.disconnect()}},[ae,N]);var oe=I.useMemo(function(){var xe=W.containerWidth,ie=W.containerHeight;if(xe<0||ie<0)return null;Sm(tj(l)||tj(u),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,u),Sm(!n||n>0,"The aspect(%s) must be greater than zero.",n);var pe=tj(l)?xe:l,se=tj(u)?ie:u;n&&n>0&&(pe?se=pe/n:se&&(pe=se*n),_&&se>_&&(se=_)),Sm(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,u,x,y,n);var fe=!Array.isArray(w)&&cy(w.type).endsWith("Chart");return it.Children.map(w,function(he){return it.isValidElement(he)?I.cloneElement(he,oO({width:pe,height:se},fe?{style:oO({height:"100%",width:"100%",maxHeight:se,maxWidth:pe},he.props.style)}:{})):he})},[n,w,u,_,y,x,W,l]);return it.createElement("div",{id:M?"".concat(M):void 0,className:oi("recharts-responsive-container",E),style:oO(oO({},z),{},{width:l,height:u,minWidth:x,minHeight:y,maxHeight:_}),ref:R},oe)}),Pae=function(e){return null};Pae.displayName="Cell";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)}function vCe(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 ape(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||O3.isSsr)return{width:0,height:0};var s=z8t(n),a=JSON.stringify({text:e,copyStyle:s});if(k4.widthCache[a])return k4.widthCache[a];try{var o=document.getElementById(_Ce);o||(o=document.createElement("span"),o.setAttribute("id",_Ce),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=ape(ape({},F8t),s);Object.assign(o.style,l),o.textContent="".concat(e);var i=o.getBoundingClientRect(),u={width:i.width,height:i.height};return k4.widthCache[a]=u,++k4.cacheCount>R8t&&(k4.cacheCount=0,k4.widthCache={}),u}catch{return{width:0,height:0}}},B8t=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};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 Bre(t,e){return V8t(t)||q8t(t,e)||U8t(t,e)||$8t()}function $8t(){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 U8t(t,e){if(t){if(typeof t=="string")return bCe(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 bCe(t,e)}}function bCe(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 sDt(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 CCe(t,e){return lDt(t)||oDt(t,e)||iDt(t,e)||aDt()}function aDt(){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 iDt(t,e){if(t){if(typeof t=="string")return MCe(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 MCe(t,e)}}function MCe(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,fe){var he=fe.word,ye=fe.width,Ce=se[se.length-1];if(Ce&&(a==null||o||Ce.width+ye+sfe.width?se:fe})};if(!x)return w;for(var N="…",M=function(pe){var se=y.slice(0,pe),fe=t9e({breakAll:p,style:u,children:se+N}).wordsWithComputedWidth,he=_(fe),ye=he.length>l||S(he).width>Number(a);return[ye,he]},E=0,A=y.length-1,P=0,z;E<=A&&P<=y.length-1;){var R=Math.floor((E+A)/2),U=R-1,V=M(U),K=CCe(V,2),W=K[0],J=K[1],ae=M(R),oe=CCe(ae,1),xe=oe[0];if(!W&&!xe&&(E=R+1),W&&xe&&(A=R-1),!W&&xe){z=J;break}P++}return z||w},TCe=function(e){var n=wi(e)?[]:e.toString().split(e9e);return[{words:n}]},dDt=function(e){var n=e.width,s=e.scaleToFit,a=e.children,o=e.style,l=e.breakAll,i=e.maxLines;if((n||s)&&!O3.isSsr){var u,p,x=t9e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,_=x.spaceWidth;u=y,p=_}else return TCe(a);return cDt({breakAll:l,children:a,maxLines:i,style:o},u,p,n,s)}return TCe(a)},ACe="#808080",ck=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,u=e.capHeight,p=u===void 0?"0.71em":u,x=e.scaleToFit,y=x===void 0?!1:x,_=e.textAnchor,w=_===void 0?"start":_,S=e.verticalAnchor,N=S===void 0?"end":S,M=e.fill,E=M===void 0?ACe:M,A=SCe(e,rDt),P=I.useMemo(function(){return dDt({breakAll:A.breakAll,children:A.children,maxLines:A.maxLines,scaleToFit:y,style:A.style,width:A.width})},[A.breakAll,A.children,A.maxLines,y,A.style,A.width]),z=A.dx,R=A.dy,U=A.angle,V=A.className,K=A.breakAll,W=SCe(A,nDt);if(!Xc(s)||!Xc(o))return null;var J=s+(Dn(z)?z:0),ae=o+(Dn(R)?R:0),oe;switch(N){case"start":oe=pde("calc(".concat(p,")"));break;case"middle":oe=pde("calc(".concat((P.length-1)/2," * -").concat(i," + (").concat(p," / 2))"));break;default:oe=pde("calc(".concat(P.length-1," * -").concat(i,")"));break}var xe=[];if(y){var ie=P[0].width,pe=A.width;xe.push("scale(".concat((Dn(pe)?pe/ie:1)/ie,")"))}return U&&xe.push("rotate(".concat(U,", ").concat(J,", ").concat(ae,")")),xe.length&&(W.transform=xe.join(" ")),it.createElement("text",ipe({},Oa(W,!0),{x:J,y:ae,className:oi("recharts-text",V),textAnchor:w,fill:E.includes("url")?ACe:E}),P.map(function(se,fe){var he=se.words.join(K?"":" ");return it.createElement("tspan",{x:J,dy:fe===0?oe:i,key:"".concat(he,"-").concat(fe)},he)}))};function Y1(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function uDt(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function k0e(t){let e,n,s;t.length!==2?(e=Y1,n=(i,u)=>Y1(t(i),u),s=(i,u)=>t(i)-u):(e=t===Y1||t===uDt?t:hDt,n=t,s=t);function a(i,u,p=0,x=i.length){if(p>>1;n(i[y],u)<0?p=y+1:x=y}while(p>>1;n(i[y],u)<=0?p=y+1:x=y}while(pp&&s(i[y-1],u)>-s(i[y],u)?y-1:y}return{left:a,center:l,right:o}}function hDt(){return 0}function r9e(t){return t===null?NaN:+t}function*fDt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const pDt=k0e(Y1),rP=pDt.right;k0e(r9e).center;class ECe extends Map{constructor(e,n=xDt){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(ICe(this,e))}has(e){return super.has(ICe(this,e))}set(e,n){return super.set(mDt(this,e),n)}delete(e){return super.delete(gDt(this,e))}}function ICe({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):n}function mDt({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):(t.set(s,n),n)}function gDt({_intern:t,_key:e},n){const s=e(n);return t.has(s)&&(n=t.get(s),t.delete(s)),n}function xDt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function yDt(t=Y1){if(t===Y1)return n9e;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 n9e(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const vDt=Math.sqrt(50),_Dt=Math.sqrt(10),bDt=Math.sqrt(2);function $re(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>=vDt?10:o>=_Dt?5:o>=bDt?2:1;let i,u,p;return a<0?(p=Math.pow(10,-a)/l,i=Math.round(t*p),u=Math.round(e*p),i/pe&&--u,p=-p):(p=Math.pow(10,a)*l,i=Math.round(t/p),u=Math.round(e/p),i*pe&&--u),u0))return[];if(t===e)return[t];const s=e=a))return[];const i=o-a+1,u=new Array(i);if(s)if(l<0)for(let p=0;p=s)&&(n=s);return n}function LCe(t,e){let n;for(const s of t)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function s9e(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?n9e:yDt(a);s>n;){if(s-n>600){const u=s-n+1,p=e-n+1,x=Math.log(u),y=.5*Math.exp(2*x/3),_=.5*Math.sqrt(x*y*(u-y)/u)*(p-u/2<0?-1:1),w=Math.max(n,Math.floor(e-p*y/u+_)),S=Math.min(s,Math.floor(e+(u-p)*y/u+_));s9e(t,e,w,S,a)}const o=t[e];let l=n,i=s;for(sT(t,n,e),a(t[s],o)>0&&sT(t,n,s);l0;)--i}a(t[n],o)===0?sT(t,n,i):(++i,sT(t,i,s)),i<=e&&(n=i+1),e<=i&&(s=i-1)}return t}function sT(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function wDt(t,e,n){if(t=Float64Array.from(fDt(t)),!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return LCe(t);if(e>=1)return PCe(t);var s,a=(s-1)*e,o=Math.floor(a),l=PCe(s9e(t,o).subarray(0,o+1)),i=LCe(t.subarray(o+1));return l+(i-l)*(a-o)}}function jDt(t,e,n=r9e){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 kDt(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?cO(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?cO(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=SDt.exec(t))?new bh(e[1],e[2],e[3],1):(e=CDt.exec(t))?new bh(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=MDt.exec(t))?cO(e[1],e[2],e[3],e[4]):(e=TDt.exec(t))?cO(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ADt.exec(t))?$Ce(e[1],e[2]/100,e[3]/100,1):(e=EDt.exec(t))?$Ce(e[1],e[2]/100,e[3]/100,e[4]):OCe.hasOwnProperty(t)?FCe(OCe[t]):t==="transparent"?new bh(NaN,NaN,NaN,0):null}function FCe(t){return new bh(t>>16&255,t>>8&255,t&255,1)}function cO(t,e,n,s){return s<=0&&(t=e=n=NaN),new bh(t,e,n,s)}function LDt(t){return t instanceof nP||(t=qE(t)),t?(t=t.rgb(),new bh(t.r,t.g,t.b,t.opacity)):new bh}function upe(t,e,n,s){return arguments.length===1?LDt(t):new bh(t,e,n,s??1)}function bh(t,e,n,s){this.r=+t,this.g=+e,this.b=+n,this.opacity=+s}S0e(bh,upe,i9e(nP,{brighter(t){return t=t==null?Ure:Math.pow(Ure,t),new bh(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?$E:Math.pow($E,t),new bh(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new bh(zj(this.r),zj(this.g),zj(this.b),qre(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:zCe,formatHex:zCe,formatHex8:ODt,formatRgb:BCe,toString:BCe}));function zCe(){return`#${rj(this.r)}${rj(this.g)}${rj(this.b)}`}function ODt(){return`#${rj(this.r)}${rj(this.g)}${rj(this.b)}${rj((isNaN(this.opacity)?1:this.opacity)*255)}`}function BCe(){const t=qre(this.opacity);return`${t===1?"rgb(":"rgba("}${zj(this.r)}, ${zj(this.g)}, ${zj(this.b)}${t===1?")":`, ${t})`}`}function qre(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function zj(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function rj(t){return t=zj(t),(t<16?"0":"")+t.toString(16)}function $Ce(t,e,n,s){return s<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new hm(t,e,n,s)}function o9e(t){if(t instanceof hm)return new hm(t.h,t.s,t.l,t.opacity);if(t instanceof nP||(t=qE(t)),!t)return new hm;if(t instanceof hm)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,u=(o+a)/2;return i?(e===o?l=(n-s)/i+(n0&&u<1?0:l,new hm(l,i,u,t.opacity)}function DDt(t,e,n,s){return arguments.length===1?o9e(t):new hm(t,e,n,s??1)}function hm(t,e,n,s){this.h=+t,this.s=+e,this.l=+n,this.opacity=+s}S0e(hm,DDt,i9e(nP,{brighter(t){return t=t==null?Ure:Math.pow(Ure,t),new hm(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?$E:Math.pow($E,t),new hm(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 bh(mde(t>=240?t-240:t+120,a,s),mde(t,a,s),mde(t<120?t+240:t-120,a,s),this.opacity)},clamp(){return new hm(UCe(this.h),dO(this.s),dO(this.l),qre(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=qre(this.opacity);return`${t===1?"hsl(":"hsla("}${UCe(this.h)}, ${dO(this.s)*100}%, ${dO(this.l)*100}%${t===1?")":`, ${t})`}`}}));function UCe(t){return t=(t||0)%360,t<0?t+360:t}function dO(t){return Math.max(0,Math.min(1,t||0))}function mde(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 C0e=t=>()=>t;function RDt(t,e){return function(n){return t+n*e}}function FDt(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 zDt(t){return(t=+t)==1?l9e:function(e,n){return n-e?FDt(e,n,t):C0e(isNaN(e)?n:e)}}function l9e(t,e){var n=e-t;return n?RDt(t,n):C0e(isNaN(t)?e:t)}const qCe=function t(e){var n=zDt(e);function s(a,o){var l=n((a=upe(a)).r,(o=upe(o)).r),i=n(a.g,o.g),u=n(a.b,o.b),p=l9e(a.opacity,o.opacity);return function(x){return a.r=l(x),a.g=i(x),a.b=u(x),a.opacity=p(x),a+""}}return s.gamma=t,s}(1);function BDt(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,u.push({i:l,x:Vre(s,a)})),n=gde.lastIndex;return ne&&(n=t,t=e,e=n),function(s){return Math.max(t,Math.min(e,s))}}function XDt(t,e,n){var s=t[0],a=t[1],o=e[0],l=e[1];return a2?QDt:XDt,u=p=null,y}function y(_){return _==null||isNaN(_=+_)?o:(u||(u=i(t.map(s),e,n)))(s(l(_)))}return y.invert=function(_){return l(a((p||(p=i(e,t.map(s),Vre)))(_)))},y.domain=function(_){return arguments.length?(t=Array.from(_,Hre),x()):t.slice()},y.range=function(_){return arguments.length?(e=Array.from(_),x()):e.slice()},y.rangeRound=function(_){return e=Array.from(_),n=M0e,x()},y.clamp=function(_){return arguments.length?(l=_?!0:Hu,x()):l!==Hu},y.interpolate=function(_){return arguments.length?(n=_,x()):n},y.unknown=function(_){return arguments.length?(o=_,y):o},function(_,w){return s=_,a=w,x()}}function T0e(){return Lae()(Hu,Hu)}function JDt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Wre(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 RC(t){return t=Wre(Math.abs(t)),t?t[1]:NaN}function eRt(t,e){return function(n,s){for(var a=n.length,o=[],l=0,i=t[0],u=0;a>0&&i>0&&(u+i+1>s&&(i=Math.max(1,s-u)),o.push(n.substring(a-=i,a+i)),!((u+=i+1)>s));)i=t[l=(l+1)%t.length];return o.reverse().join(e)}}function tRt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var rRt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function VE(t){if(!(e=rRt.exec(t)))throw new Error("invalid format: "+t);var e;return new A0e({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]})}VE.prototype=A0e.prototype;function A0e(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+""}A0e.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 nRt(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 c9e;function sRt(t,e){var n=Wre(t,e);if(!n)return t+"";var s=n[0],a=n[1],o=a-(c9e=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")+Wre(t,Math.max(0,e+o-1))[0]}function HCe(t,e){var n=Wre(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 WCe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:JDt,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)=>HCe(t*100,e),r:HCe,s:sRt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function GCe(t){return t}var KCe=Array.prototype.map,ZCe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function aRt(t){var e=t.grouping===void 0||t.thousands===void 0?GCe:eRt(KCe.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?GCe:tRt(KCe.call(t.numerals,String)),l=t.percent===void 0?"%":t.percent+"",i=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function p(y){y=VE(y);var _=y.fill,w=y.align,S=y.sign,N=y.symbol,M=y.zero,E=y.width,A=y.comma,P=y.precision,z=y.trim,R=y.type;R==="n"?(A=!0,R="g"):WCe[R]||(P===void 0&&(P=12),z=!0,R="g"),(M||_==="0"&&w==="=")&&(M=!0,_="0",w="=");var U=N==="$"?n:N==="#"&&/[boxX]/.test(R)?"0"+R.toLowerCase():"",V=N==="$"?s:/[%p]/.test(R)?l:"",K=WCe[R],W=/[defgprs%]/.test(R);P=P===void 0?6:/[gprs]/.test(R)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function J(ae){var oe=U,xe=V,ie,pe,se;if(R==="c")xe=K(ae)+xe,ae="";else{ae=+ae;var fe=ae<0||1/ae<0;if(ae=isNaN(ae)?u:K(Math.abs(ae),P),z&&(ae=nRt(ae)),fe&&+ae==0&&S!=="+"&&(fe=!1),oe=(fe?S==="("?S:i:S==="-"||S==="("?"":S)+oe,xe=(R==="s"?ZCe[8+c9e/3]:"")+xe+(fe&&S==="("?")":""),W){for(ie=-1,pe=ae.length;++iese||se>57){xe=(se===46?a+ae.slice(ie+1):ae.slice(ie))+xe,ae=ae.slice(0,ie);break}}}A&&!M&&(ae=e(ae,1/0));var he=oe.length+ae.length+xe.length,ye=he>1)+oe+ae+xe+ye.slice(he);break;default:ae=ye+oe+ae+xe;break}return o(ae)}return J.toString=function(){return y+""},J}function x(y,_){var w=p((y=VE(y),y.type="f",y)),S=Math.max(-8,Math.min(8,Math.floor(RC(_)/3)))*3,N=Math.pow(10,-S),M=ZCe[8+S/3];return function(E){return w(N*E)+M}}return{format:p,formatPrefix:x}}var uO,E0e,d9e;iRt({thousands:",",grouping:[3],currency:["$",""]});function iRt(t){return uO=aRt(t),E0e=uO.format,d9e=uO.formatPrefix,uO}function oRt(t){return Math.max(0,-RC(Math.abs(t)))}function lRt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(RC(e)/3)))*3-RC(Math.abs(t)))}function cRt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,RC(e)-RC(t))+1}function u9e(t,e,n,s){var a=cpe(t,e,n),o;switch(s=VE(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(t),Math.abs(e));return s.precision==null&&!isNaN(o=lRt(a,l))&&(s.precision=o),d9e(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=cRt(a,Math.max(Math.abs(t),Math.abs(e))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=oRt(a))&&(s.precision=o-(s.type==="%")*2);break}}return E0e(s)}function jv(t){var e=t.domain;return t.ticks=function(n){var s=e();return ope(s[0],s[s.length-1],n??10)},t.tickFormat=function(n,s){var a=e();return u9e(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],u,p,x=10;for(i0;){if(p=lpe(l,i,n),p===u)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;u=p}return t},t}function Gre(){var t=T0e();return t.copy=function(){return sP(t,Gre())},xp.apply(t,arguments),jv(t)}function h9e(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,Hre),n):t.slice()},n.unknown=function(s){return arguments.length?(e=s,n):e},n.copy=function(){return h9e(t).unknown(e)},t=arguments.length?Array.from(t,Hre):[0,1],jv(n)}function f9e(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 pRt(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 QCe(t){return(e,n)=>-t(-e,n)}function I0e(t){const e=t(YCe,XCe),n=e.domain;let s=10,a,o;function l(){return a=pRt(s),o=fRt(s),n()[0]<0?(a=QCe(a),o=QCe(o),t(dRt,uRt)):t(YCe,XCe),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 u=n();let p=u[0],x=u[u.length-1];const y=x0){for(;_<=w;++_)for(S=1;Sx)break;E.push(N)}}else for(;_<=w;++_)for(S=s-1;S>=1;--S)if(N=_>0?S/o(-_):S*o(_),!(Nx)break;E.push(N)}E.length*2{if(i==null&&(i=10),u==null&&(u=s===10?"s":","),typeof u!="function"&&(!(s%1)&&(u=VE(u)).precision==null&&(u.trim=!0),u=E0e(u)),i===1/0)return u;const p=Math.max(1,s*i/e.ticks().length);return x=>{let y=x/o(Math.round(a(x)));return y*sn(f9e(n(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),e}function p9e(){const t=I0e(Lae()).domain([1,10]);return t.copy=()=>sP(t,p9e()).base(t.base()),xp.apply(t,arguments),t}function JCe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function e3e(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function P0e(t){var e=1,n=t(JCe(e),e3e(e));return n.constant=function(s){return arguments.length?t(JCe(e=+s),e3e(e)):e},jv(n)}function m9e(){var t=P0e(Lae());return t.copy=function(){return sP(t,m9e()).constant(t.constant())},xp.apply(t,arguments)}function t3e(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function mRt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function gRt(t){return t<0?-t*t:t*t}function L0e(t){var e=t(Hu,Hu),n=1;function s(){return n===1?t(Hu,Hu):n===.5?t(mRt,gRt):t(t3e(n),t3e(1/n))}return e.exponent=function(a){return arguments.length?(n=+a,s()):n},jv(e)}function O0e(){var t=L0e(Lae());return t.copy=function(){return sP(t,O0e()).exponent(t.exponent())},xp.apply(t,arguments),t}function xRt(){return O0e.apply(null,arguments).exponent(.5)}function r3e(t){return Math.sign(t)*t*t}function yRt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function g9e(){var t=T0e(),e=[0,1],n=!1,s;function a(o){var l=yRt(t(o));return isNaN(l)?s:n?Math.round(l):l}return a.invert=function(o){return t.invert(r3e(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,Hre)).map(r3e)),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 g9e(t.domain(),e).round(n).clamp(t.clamp()).unknown(s)},xp.apply(a,arguments),jv(a)}function x9e(){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(u){return arguments.length&&(o=u),l},l.thresholds=function(){return s.slice()},l.copy=function(){return y9e().domain([t,e]).range(a).unknown(o)},xp.apply(jv(l),arguments)}function v9e(){var t=[.5],e=[0,1],n,s=1;function a(o){return o!=null&&o<=o?e[rP(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 v9e().domain(t).range(e).unknown(n)},xp.apply(a,arguments)}const xde=new Date,yde=new Date;function sd(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 u=[];if(o=a.ceil(o),i=i==null?1:Math.floor(i),!(o0))return u;let p;do u.push(p=new Date(+o)),e(o,i),t(o);while(psd(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)=>(xde.setTime(+o),yde.setTime(+l),t(xde),t(yde),Math.floor(n(xde,yde))),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 Kre=sd(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Kre.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?sd(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Kre);Kre.range;const Gx=1e3,Qf=Gx*60,Kx=Qf*60,Cy=Kx*24,D0e=Cy*7,n3e=Cy*30,vde=Cy*365,nj=sd(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Gx)},(t,e)=>(e-t)/Gx,t=>t.getUTCSeconds());nj.range;const R0e=sd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Gx)},(t,e)=>{t.setTime(+t+e*Qf)},(t,e)=>(e-t)/Qf,t=>t.getMinutes());R0e.range;const F0e=sd(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Qf)},(t,e)=>(e-t)/Qf,t=>t.getUTCMinutes());F0e.range;const z0e=sd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Gx-t.getMinutes()*Qf)},(t,e)=>{t.setTime(+t+e*Kx)},(t,e)=>(e-t)/Kx,t=>t.getHours());z0e.range;const B0e=sd(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Kx)},(t,e)=>(e-t)/Kx,t=>t.getUTCHours());B0e.range;const aP=sd(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Qf)/Cy,t=>t.getDate()-1);aP.range;const Oae=sd(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Cy,t=>t.getUTCDate()-1);Oae.range;const _9e=sd(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Cy,t=>Math.floor(t/Cy));_9e.range;function wk(t){return sd(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())*Qf)/D0e)}const Dae=wk(0),Zre=wk(1),vRt=wk(2),_Rt=wk(3),FC=wk(4),bRt=wk(5),wRt=wk(6);Dae.range;Zre.range;vRt.range;_Rt.range;FC.range;bRt.range;wRt.range;function jk(t){return sd(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)/D0e)}const Rae=jk(0),Yre=jk(1),jRt=jk(2),kRt=jk(3),zC=jk(4),NRt=jk(5),SRt=jk(6);Rae.range;Yre.range;jRt.range;kRt.range;zC.range;NRt.range;SRt.range;const $0e=sd(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());$0e.range;const U0e=sd(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 My=sd(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());My.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:sd(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)});My.range;const Ty=sd(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());Ty.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:sd(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)});Ty.range;function b9e(t,e,n,s,a,o){const l=[[nj,1,Gx],[nj,5,5*Gx],[nj,15,15*Gx],[nj,30,30*Gx],[o,1,Qf],[o,5,5*Qf],[o,15,15*Qf],[o,30,30*Qf],[a,1,Kx],[a,3,3*Kx],[a,6,6*Kx],[a,12,12*Kx],[s,1,Cy],[s,2,2*Cy],[n,1,D0e],[e,1,n3e],[e,3,3*n3e],[t,1,vde]];function i(p,x,y){const _=xM).right(l,_);if(w===l.length)return t.every(cpe(p/vde,x/vde,y));if(w===0)return Kre.every(Math.max(cpe(p,x,y),1));const[S,N]=l[_/l[w-1][2]53)return null;"w"in Me||(Me.w=1),"Z"in Me?(le=bde(aT(Me.y,0,1)),Ve=le.getUTCDay(),le=Ve>4||Ve===0?Yre.ceil(le):Yre(le),le=Oae.offset(le,(Me.V-1)*7),Me.y=le.getUTCFullYear(),Me.m=le.getUTCMonth(),Me.d=le.getUTCDate()+(Me.w+6)%7):(le=_de(aT(Me.y,0,1)),Ve=le.getDay(),le=Ve>4||Ve===0?Zre.ceil(le):Zre(le),le=aP.offset(le,(Me.V-1)*7),Me.y=le.getFullYear(),Me.m=le.getMonth(),Me.d=le.getDate()+(Me.w+6)%7)}else("W"in Me||"U"in Me)&&("w"in Me||(Me.w="u"in Me?Me.u%7:"W"in Me?1:0),Ve="Z"in Me?bde(aT(Me.y,0,1)).getUTCDay():_de(aT(Me.y,0,1)).getDay(),Me.m=0,Me.d="W"in Me?(Me.w+6)%7+Me.W*7-(Ve+5)%7:Me.w+Me.U*7-(Ve+6)%7);return"Z"in Me?(Me.H+=Me.Z/100|0,Me.M+=Me.Z%100,bde(Me)):_de(Me)}}function K(Be,Ye,ht,Me){for(var Qe=0,le=Ye.length,Ve=ht.length,Le,We;Qe=Ve)return-1;if(Le=Ye.charCodeAt(Qe++),Le===37){if(Le=Ye.charAt(Qe++),We=R[Le in s3e?Ye.charAt(Qe++):Le],!We||(Me=We(Be,ht,Me))<0)return-1}else if(Le!=ht.charCodeAt(Me++))return-1}return Me}function W(Be,Ye,ht){var Me=p.exec(Ye.slice(ht));return Me?(Be.p=x.get(Me[0].toLowerCase()),ht+Me[0].length):-1}function J(Be,Ye,ht){var Me=w.exec(Ye.slice(ht));return Me?(Be.w=S.get(Me[0].toLowerCase()),ht+Me[0].length):-1}function ae(Be,Ye,ht){var Me=y.exec(Ye.slice(ht));return Me?(Be.w=_.get(Me[0].toLowerCase()),ht+Me[0].length):-1}function oe(Be,Ye,ht){var Me=E.exec(Ye.slice(ht));return Me?(Be.m=A.get(Me[0].toLowerCase()),ht+Me[0].length):-1}function xe(Be,Ye,ht){var Me=N.exec(Ye.slice(ht));return Me?(Be.m=M.get(Me[0].toLowerCase()),ht+Me[0].length):-1}function ie(Be,Ye,ht){return K(Be,e,Ye,ht)}function pe(Be,Ye,ht){return K(Be,n,Ye,ht)}function se(Be,Ye,ht){return K(Be,s,Ye,ht)}function fe(Be){return l[Be.getDay()]}function he(Be){return o[Be.getDay()]}function ye(Be){return u[Be.getMonth()]}function Ce(Be){return i[Be.getMonth()]}function Se(Be){return a[+(Be.getHours()>=12)]}function Ne(Be){return 1+~~(Be.getMonth()/3)}function be(Be){return l[Be.getUTCDay()]}function rt(Be){return o[Be.getUTCDay()]}function Te(Be){return u[Be.getUTCMonth()]}function Pe(Be){return i[Be.getUTCMonth()]}function Ue(Be){return a[+(Be.getUTCHours()>=12)]}function Re(Be){return 1+~~(Be.getUTCMonth()/3)}return{format:function(Be){var Ye=U(Be+="",P);return Ye.toString=function(){return Be},Ye},parse:function(Be){var Ye=V(Be+="",!1);return Ye.toString=function(){return Be},Ye},utcFormat:function(Be){var Ye=U(Be+="",z);return Ye.toString=function(){return Be},Ye},utcParse:function(Be){var Ye=V(Be+="",!0);return Ye.toString=function(){return Be},Ye}}}var s3e={"-":"",_:" ",0:"0"},Ad=/^\s*\d+/,IRt=/^%/,PRt=/[\\^$*+?|[\]().{}]/g;function oo(t,e,n){var s=t<0?"-":"",a=(s?-t:t)+"",o=a.length;return s+(o[e.toLowerCase(),n]))}function ORt(t,e,n){var s=Ad.exec(e.slice(n,n+1));return s?(t.w=+s[0],n+s[0].length):-1}function DRt(t,e,n){var s=Ad.exec(e.slice(n,n+1));return s?(t.u=+s[0],n+s[0].length):-1}function RRt(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.U=+s[0],n+s[0].length):-1}function FRt(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.V=+s[0],n+s[0].length):-1}function zRt(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.W=+s[0],n+s[0].length):-1}function a3e(t,e,n){var s=Ad.exec(e.slice(n,n+4));return s?(t.y=+s[0],n+s[0].length):-1}function i3e(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function BRt(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 $Rt(t,e,n){var s=Ad.exec(e.slice(n,n+1));return s?(t.q=s[0]*3-3,n+s[0].length):-1}function URt(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.m=s[0]-1,n+s[0].length):-1}function o3e(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.d=+s[0],n+s[0].length):-1}function qRt(t,e,n){var s=Ad.exec(e.slice(n,n+3));return s?(t.m=0,t.d=+s[0],n+s[0].length):-1}function l3e(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.H=+s[0],n+s[0].length):-1}function VRt(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.M=+s[0],n+s[0].length):-1}function HRt(t,e,n){var s=Ad.exec(e.slice(n,n+2));return s?(t.S=+s[0],n+s[0].length):-1}function WRt(t,e,n){var s=Ad.exec(e.slice(n,n+3));return s?(t.L=+s[0],n+s[0].length):-1}function GRt(t,e,n){var s=Ad.exec(e.slice(n,n+6));return s?(t.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function KRt(t,e,n){var s=IRt.exec(e.slice(n,n+1));return s?n+s[0].length:-1}function ZRt(t,e,n){var s=Ad.exec(e.slice(n));return s?(t.Q=+s[0],n+s[0].length):-1}function YRt(t,e,n){var s=Ad.exec(e.slice(n));return s?(t.s=+s[0],n+s[0].length):-1}function c3e(t,e){return oo(t.getDate(),e,2)}function XRt(t,e){return oo(t.getHours(),e,2)}function QRt(t,e){return oo(t.getHours()%12||12,e,2)}function JRt(t,e){return oo(1+aP.count(My(t),t),e,3)}function w9e(t,e){return oo(t.getMilliseconds(),e,3)}function eFt(t,e){return w9e(t,e)+"000"}function tFt(t,e){return oo(t.getMonth()+1,e,2)}function rFt(t,e){return oo(t.getMinutes(),e,2)}function nFt(t,e){return oo(t.getSeconds(),e,2)}function sFt(t){var e=t.getDay();return e===0?7:e}function aFt(t,e){return oo(Dae.count(My(t)-1,t),e,2)}function j9e(t){var e=t.getDay();return e>=4||e===0?FC(t):FC.ceil(t)}function iFt(t,e){return t=j9e(t),oo(FC.count(My(t),t)+(My(t).getDay()===4),e,2)}function oFt(t){return t.getDay()}function lFt(t,e){return oo(Zre.count(My(t)-1,t),e,2)}function cFt(t,e){return oo(t.getFullYear()%100,e,2)}function dFt(t,e){return t=j9e(t),oo(t.getFullYear()%100,e,2)}function uFt(t,e){return oo(t.getFullYear()%1e4,e,4)}function hFt(t,e){var n=t.getDay();return t=n>=4||n===0?FC(t):FC.ceil(t),oo(t.getFullYear()%1e4,e,4)}function fFt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+oo(e/60|0,"0",2)+oo(e%60,"0",2)}function d3e(t,e){return oo(t.getUTCDate(),e,2)}function pFt(t,e){return oo(t.getUTCHours(),e,2)}function mFt(t,e){return oo(t.getUTCHours()%12||12,e,2)}function gFt(t,e){return oo(1+Oae.count(Ty(t),t),e,3)}function k9e(t,e){return oo(t.getUTCMilliseconds(),e,3)}function xFt(t,e){return k9e(t,e)+"000"}function yFt(t,e){return oo(t.getUTCMonth()+1,e,2)}function vFt(t,e){return oo(t.getUTCMinutes(),e,2)}function _Ft(t,e){return oo(t.getUTCSeconds(),e,2)}function bFt(t){var e=t.getUTCDay();return e===0?7:e}function wFt(t,e){return oo(Rae.count(Ty(t)-1,t),e,2)}function N9e(t){var e=t.getUTCDay();return e>=4||e===0?zC(t):zC.ceil(t)}function jFt(t,e){return t=N9e(t),oo(zC.count(Ty(t),t)+(Ty(t).getUTCDay()===4),e,2)}function kFt(t){return t.getUTCDay()}function NFt(t,e){return oo(Yre.count(Ty(t)-1,t),e,2)}function SFt(t,e){return oo(t.getUTCFullYear()%100,e,2)}function CFt(t,e){return t=N9e(t),oo(t.getUTCFullYear()%100,e,2)}function MFt(t,e){return oo(t.getUTCFullYear()%1e4,e,4)}function TFt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?zC(t):zC.ceil(t),oo(t.getUTCFullYear()%1e4,e,4)}function AFt(){return"+0000"}function u3e(){return"%"}function h3e(t){return+t}function f3e(t){return Math.floor(+t/1e3)}var N4,S9e,C9e;EFt({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 EFt(t){return N4=ERt(t),S9e=N4.format,N4.parse,C9e=N4.utcFormat,N4.utcParse,N4}function IFt(t){return new Date(t)}function PFt(t){return t instanceof Date?+t:+new Date(+t)}function q0e(t,e,n,s,a,o,l,i,u,p){var x=T0e(),y=x.invert,_=x.domain,w=p(".%L"),S=p(":%S"),N=p("%I:%M"),M=p("%I %p"),E=p("%a %d"),A=p("%b %d"),P=p("%B"),z=p("%Y");function R(U){return(u(U)e(a/(t.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,o)=>wDt(t,o/s))},n.copy=function(){return E9e(e).domain(t)},Dy.apply(n,arguments)}function zae(){var t=0,e=.5,n=1,s=1,a,o,l,i,u,p=Hu,x,y=!1,_;function w(N){return isNaN(N=+N)?_:(N=.5+((N=+x(N))-o)*(s*Ne}var O9e=BFt,$Ft=Bae,UFt=O9e,qFt=L3;function VFt(t){return t&&t.length?$Ft(t,qFt,UFt):void 0}var HFt=VFt;const $ae=Wi(HFt);function WFt(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)*fl;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 dy(this,new this.constructor(t))};bs.dividedToIntegerBy=bs.idiv=function(t){var e=this,n=e.constructor;return Bo(dy(e,new n(t),0,1),n.precision)};bs.equals=bs.eq=function(t){return!this.cmp(t)};bs.exponent=function(){return zc(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(nf))throw Error(hp+"NaN");if(n.s<1)throw Error(hp+(n.s?"NaN":"-Infinity"));return n.eq(nf)?new s(0):(Cl=!1,e=dy(HE(n,o),HE(t,o),o),Cl=!0,Bo(e,a))};bs.minus=bs.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?B9e(e,t):F9e(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(hp+"NaN");return n.s?(Cl=!1,e=dy(n,t,0,1).times(t),Cl=!0,n.minus(e)):Bo(new s(n),a)};bs.naturalExponential=bs.exp=function(){return z9e(this)};bs.naturalLogarithm=bs.ln=function(){return HE(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?F9e(e,t):B9e(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(Bj+t);if(e=zc(a)+1,s=a.d.length-1,n=s*fl+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,u=i.constructor;if(i.s<1){if(!i.s)return new u(0);throw Error(hp+"NaN")}for(t=zc(i),Cl=!1,a=Math.sqrt(+i),a==0||a==1/0?(e=vg(i.d),(e.length+t)%2==0&&(e+="0"),a=Math.sqrt(e),t=F3((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 u(e)):s=new u(a.toString()),n=u.precision,a=l=n+3;;)if(o=s,s=o.plus(dy(i,o,l+2)).times(.5),vg(o.d).slice(0,l)===(e=vg(s.d)).slice(0,l)){if(e=e.slice(l-3,l+1),a==l&&e=="4999"){if(Bo(o,n+1,0),o.times(o).eq(i)){s=o;break}}else if(e!="9999")break;l+=4}return Cl=!0,Bo(s,n)};bs.times=bs.mul=function(t){var e,n,s,a,o,l,i,u,p,x=this,y=x.constructor,_=x.d,w=(t=new y(t)).d;if(!x.s||!t.s)return new y(0);for(t.s*=x.s,n=x.e+t.e,u=_.length,p=w.length,u=0;){for(e=0,a=u+s;a>s;)i=o[a]+w[s]*_[a-s-1]+e,o[a--]=i%pd|0,e=i/pd|0;o[a]=(o[a]+e)%pd|0}for(;!o[--l];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Cl?Bo(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:(Vg(t,0,R3),e===void 0?e=s.rounding:Vg(e,0,8),Bo(n,t+zc(n)+1,e))};bs.toExponential=function(t,e){var n,s=this,a=s.constructor;return t===void 0?n=dk(s,!0):(Vg(t,0,R3),e===void 0?e=a.rounding:Vg(e,0,8),s=Bo(new a(s),t+1,e),n=dk(s,!0,t+1)),n};bs.toFixed=function(t,e){var n,s,a=this,o=a.constructor;return t===void 0?dk(a):(Vg(t,0,R3),e===void 0?e=o.rounding:Vg(e,0,8),s=Bo(new o(a),t+zc(a)+1,e),n=dk(s.abs(),!1,t+zc(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};bs.toInteger=bs.toint=function(){var t=this,e=t.constructor;return Bo(new e(t),zc(t)+1,e.rounding)};bs.toNumber=function(){return+this};bs.toPower=bs.pow=function(t){var e,n,s,a,o,l,i=this,u=i.constructor,p=12,x=+(t=new u(t));if(!t.s)return new u(nf);if(i=new u(i),!i.s){if(t.s<1)throw Error(hp+"Infinity");return i}if(i.eq(nf))return i;if(s=u.precision,t.eq(nf))return Bo(i,s);if(e=t.e,n=t.d.length-1,l=e>=n,o=i.s,l){if((n=x<0?-x:x)<=R9e){for(a=new u(nf),e=Math.ceil(s/fl+4),Cl=!1;n%2&&(a=a.times(i),g3e(a.d,e)),n=F3(n/2),n!==0;)i=i.times(i),g3e(i.d,e);return Cl=!0,t.s<0?new u(nf).div(a):Bo(a,s)}}else if(o<0)throw Error(hp+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,i.s=1,Cl=!1,a=t.times(HE(i,s+p)),Cl=!0,a=z9e(a),a.s=o,a};bs.toPrecision=function(t,e){var n,s,a=this,o=a.constructor;return t===void 0?(n=zc(a),s=dk(a,n<=o.toExpNeg||n>=o.toExpPos)):(Vg(t,1,R3),e===void 0?e=o.rounding:Vg(e,0,8),a=Bo(new o(a),t,e),n=zc(a),s=dk(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):(Vg(t,1,R3),e===void 0?e=s.rounding:Vg(e,0,8)),Bo(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=zc(t),n=t.constructor;return dk(t,e<=n.toExpNeg||e>=n.toExpPos)};function F9e(t,e){var n,s,a,o,l,i,u,p,x=t.constructor,y=x.precision;if(!t.s||!e.s)return e.s||(e=new x(t)),Cl?Bo(e,y):e;if(u=t.d,p=e.d,l=t.e,a=e.e,u=u.slice(),o=l-a,o){for(o<0?(s=u,o=-o,i=p.length):(s=p,a=l,i=u.length),l=Math.ceil(y/fl),i=l>i?l+1:i+1,o>i&&(o=i,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(i=u.length,o=p.length,i-o<0&&(o=i,s=p,p=u,u=s),n=0;o;)n=(u[--o]=u[o]+p[o]+n)/pd|0,u[o]%=pd;for(n&&(u.unshift(n),++a),i=u.length;u[--i]==0;)u.pop();return e.d=u,e.e=a,Cl?Bo(e,y):e}function Vg(t,e,n){if(t!==~~t||tn)throw Error(Bj+t)}function vg(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=u=0;ia[i]?1:-1;break}return u}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,u,p,x,y,_,w,S,N,M,E,A,P,z,R,U,V,K,W=s.constructor,J=s.s==a.s?1:-1,ae=s.d,oe=a.d;if(!s.s)return new W(s);if(!a.s)throw Error(hp+"Division by zero");for(u=s.e-a.e,V=oe.length,R=ae.length,w=new W(J),S=w.d=[],p=0;oe[p]==(ae[p]||0);)++p;if(oe[p]>(ae[p]||0)&&--u,o==null?A=o=W.precision:l?A=o+(zc(s)-zc(a))+1:A=o,A<0)return new W(0);if(A=A/fl+2|0,p=0,V==1)for(x=0,oe=oe[0],A++;(p1&&(oe=t(oe,x),ae=t(ae,x),V=oe.length,R=ae.length),z=V,N=ae.slice(0,V),M=N.length;M=pd/2&&++U;do x=0,i=e(oe,N,V,M),i<0?(E=N[0],V!=M&&(E=E*pd+(N[1]||0)),x=E/U|0,x>1?(x>=pd&&(x=pd-1),y=t(oe,x),_=y.length,M=N.length,i=e(y,N,_,M),i==1&&(x--,n(y,V<_?K:oe,_))):(x==0&&(i=x=1),y=oe.slice()),_=y.length,_16)throw Error(W0e+zc(t));if(!t.s)return new x(nf);for(Cl=!1,i=y,l=new x(.03125);t.abs().gte(.1);)t=t.times(l),p+=5;for(s=Math.log(zw(2,p))/Math.LN10*2+5|0,i+=s,n=a=o=new x(nf),x.precision=i;;){if(a=Bo(a.times(t),i),n=n.times(++u),l=o.plus(dy(a,n,i)),vg(l.d).slice(0,i)===vg(o.d).slice(0,i)){for(;p--;)o=Bo(o.times(o),i);return x.precision=y,e==null?(Cl=!0,Bo(o,y)):o}o=l}}function zc(t){for(var e=t.e*fl,n=t.d[0];n>=10;n/=10)e++;return e}function wde(t,e,n){if(e>t.LN10.sd())throw Cl=!0,n&&(t.precision=n),Error(hp+"LN10 precision limit exceeded");return Bo(new t(t.LN10),e)}function W0(t){for(var e="";t--;)e+="0";return e}function HE(t,e){var n,s,a,o,l,i,u,p,x,y=1,_=10,w=t,S=w.d,N=w.constructor,M=N.precision;if(w.s<1)throw Error(hp+(w.s?"NaN":"-Infinity"));if(w.eq(nf))return new N(0);if(e==null?(Cl=!1,p=M):p=e,w.eq(10))return e==null&&(Cl=!0),wde(N,p);if(p+=_,N.precision=p,n=vg(S),s=n.charAt(0),o=zc(w),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)w=w.times(t),n=vg(w.d),s=n.charAt(0),y++;o=zc(w),s>1?(w=new N("0."+n),o++):w=new N(s+"."+n.slice(1))}else return u=wde(N,p+2,M).times(o+""),w=HE(new N(s+"."+n.slice(1)),p-_).plus(u),N.precision=M,e==null?(Cl=!0,Bo(w,M)):w;for(i=l=w=dy(w.minus(nf),w.plus(nf),p),x=Bo(w.times(w),p),a=3;;){if(l=Bo(l.times(x),p),u=i.plus(dy(l,new N(a),p)),vg(u.d).slice(0,p)===vg(i.d).slice(0,p))return i=i.times(2),o!==0&&(i=i.plus(wde(N,p+2,M).times(o+""))),i=dy(i,new N(y),p),N.precision=M,e==null?(Cl=!0,Bo(i,M)):i;i=u,a+=2}}function m3e(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=F3(n/fl),t.d=[],s=(n+1)%fl,n<0&&(s+=fl),sXre||t.e<-Xre))throw Error(W0e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Bo(t,e,n){var s,a,o,l,i,u,p,x,y=t.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=e-l,s<0)s+=fl,a=e,p=y[x=0];else{if(x=Math.ceil((s+1)/fl),o=y.length,x>=o)return t;for(p=o=y[x],l=1;o>=10;o/=10)l++;s%=fl,a=s-fl+l}if(n!==void 0&&(o=zw(10,l-a-1),i=p/o%10|0,u=e<0||y[x+1]!==void 0||p%o,u=n<4?(i||u)&&(n==0||n==(t.s<0?3:2)):i>5||i==5&&(n==4||u||n==6&&(s>0?a>0?p/zw(10,l-a):0:y[x-1])%10&1||n==(t.s<0?8:7))),e<1||!y[0])return u?(o=zc(t),y.length=1,e=e-o-1,y[0]=zw(10,(fl-e%fl)%fl),t.e=F3(-e/fl)||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=zw(10,fl-s),y[x]=a>0?(p/zw(10,l-a)%zw(10,a)|0)*o:0),u)for(;;)if(x==0){(y[0]+=o)==pd&&(y[0]=1,++t.e);break}else{if(y[x]+=o,y[x]!=pd)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(Cl&&(t.e>Xre||t.e<-Xre))throw Error(W0e+zc(t));return t}function B9e(t,e){var n,s,a,o,l,i,u,p,x,y,_=t.constructor,w=_.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new _(t),Cl?Bo(e,w):e;if(u=t.d,y=e.d,s=e.e,p=t.e,u=u.slice(),l=p-s,l){for(x=l<0,x?(n=u,l=-l,i=y.length):(n=y,s=p,i=u.length),a=Math.max(Math.ceil(w/fl),i)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=u.length,i=y.length,x=a0;--a)u[i++]=0;for(a=y.length;a>l;){if(u[--a]0?o=o.charAt(0)+"."+o.slice(1)+W0(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+W0(-a-1)+o,n&&(s=n-l)>0&&(o+=W0(s))):a>=l?(o+=W0(a+1-l),n&&(s=n-a-1)>0&&(o=o+"."+W0(s))):((s=a+1)0&&(a+1===l&&(o+="."),o+=W0(s))),t.s<0?"-"+o:o}function g3e(t,e){if(t.length>e)return t.length=e,!0}function $9e(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(Bj+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 m3e(l,o.toString())}else if(typeof o!="string")throw Error(Bj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,fzt.test(o))m3e(l,o);else throw Error(Bj+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=$9e,a.config=a.set=pzt,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(Bj+n+": "+s);if((s=t[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Bj+n+": "+s);return this}var G0e=$9e(hzt);nf=new G0e(1);const Oo=G0e;function mzt(t){return vzt(t)||yzt(t)||xzt(t)||gzt()}function gzt(){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 xzt(t,e){if(t){if(typeof t=="string")return ppe(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 ppe(t,e)}}function yzt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function vzt(t){if(Array.isArray(t))return ppe(t)}function ppe(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,x3e(function(){for(var i=arguments.length,u=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(u){a=!0,o=u}finally{try{!s&&l.return!=null&&l.return()}finally{if(a)throw o}}return n}}function Lzt(t){if(Array.isArray(t))return t}function W9e(t){var e=WE(t,2),n=e[0],s=e[1],a=n,o=s;return n>s&&(a=s,o=n),[a,o]}function G9e(t,e,n){if(t.lte(0))return new Oo(0);var s=Hae.getDigitCount(t.toNumber()),a=new Oo(10).pow(s),o=t.div(a),l=s!==1?.05:.1,i=new Oo(Math.ceil(o.div(l).toNumber())).add(n).mul(l),u=i.mul(a);return e?u:new Oo(Math.ceil(u))}function Ozt(t,e,n){var s=1,a=new Oo(t);if(!a.isint()&&n){var o=Math.abs(t);o<1?(s=new Oo(10).pow(Hae.getDigitCount(t)-1),a=new Oo(Math.floor(a.div(s).toNumber())).mul(s)):o>1&&(a=new Oo(Math.floor(t)))}else t===0?a=new Oo(Math.floor((e-1)/2)):n||(a=new Oo(Math.floor(t)));var l=Math.floor((e-1)/2),i=jzt(wzt(function(u){return a.add(new Oo(u-l).mul(s)).toNumber()}),mpe);return i(0,e)}function K9e(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 Oo(0),tickMin:new Oo(0),tickMax:new Oo(0)};var o=G9e(new Oo(e).sub(t).div(n-1),s,a),l;t<=0&&e>=0?l=new Oo(0):(l=new Oo(t).add(e).div(2),l=l.sub(new Oo(l).mod(o)));var i=Math.ceil(l.sub(t).div(o).toNumber()),u=Math.ceil(new Oo(e).sub(l).div(o).toNumber()),p=i+u+1;return p>n?K9e(t,e,n,s,a+1):(p0?u+(n-p):u,i=e>0?i:i+(n-p)),{step:o,tickMin:l.sub(new Oo(i).mul(o)),tickMax:l.add(new Oo(u).mul(o))})}function Dzt(t){var e=WE(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=W9e([n,s]),u=WE(i,2),p=u[0],x=u[1];if(p===-1/0||x===1/0){var y=x===1/0?[p].concat(xpe(mpe(0,a-1).map(function(){return 1/0}))):[].concat(xpe(mpe(0,a-1).map(function(){return-1/0})),[x]);return n>s?gpe(y):y}if(p===x)return Ozt(p,a,o);var _=K9e(p,x,l,o),w=_.step,S=_.tickMin,N=_.tickMax,M=Hae.rangeStep(S,N.add(new Oo(.1).mul(w)),w);return n>s?gpe(M):M}function Rzt(t,e){var n=WE(t,2),s=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=W9e([s,a]),i=WE(l,2),u=i[0],p=i[1];if(u===-1/0||p===1/0)return[s,a];if(u===p)return[u];var x=Math.max(e,2),y=G9e(new Oo(p).sub(u).div(x-1),o,0),_=[].concat(xpe(Hae.rangeStep(new Oo(u),new Oo(p).sub(new Oo(.99).mul(y)),y)),[p]);return s>a?gpe(_):_}var Fzt=V9e(Dzt),zzt=V9e(Rzt),Bzt="Invariant failed";function uk(t,e){throw new Error(Bzt)}var $zt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function BC(t){"@babel/helpers - typeof";return BC=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},BC(t)}function Qre(){return Qre=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 Kzt(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 Zzt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yzt(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 u=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,w=void 0;if(qu(y-x)!==qu(_-y)){var S=[];if(qu(_-y)===qu(u[1]-u[0])){w=_;var N=y+u[1]-u[0];S[0]=Math.min(N,(N+x)/2),S[1]=Math.max(N,(N+x)/2)}else{w=x;var M=_+u[1]-u[0];S[0]=Math.min(y,(M+y)/2),S[1]=Math.max(y,(M+y)/2)}var E=[Math.min(y,(w+y)/2),Math.max(y,(w+y)/2)];if(e>E[0]&&e<=E[1]||e>=S[0]&&e<=S[1]){l=a[p].index;break}}else{var A=Math.min(x,_),P=Math.max(x,_);if(e>(A+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},K0e=function(e){var n,s=e,a=s.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Ql(Ql({},e.type.defaultProps),e.props):e.props,l=o.stroke,i=o.fill,u;switch(a){case"Line":u=l;break;case"Area":case"Radar":u=l&&l!=="none"?l:i;break;default:u=i;break}return u},f7t=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),u=0,p=i.length;u=0});if(E&&E.length){var A=E[0].type.defaultProps,P=A!==void 0?Ql(Ql({},A),E[0].props):E[0].props,z=P.barSize,R=P[M];l[R]||(l[R]=[]);var U=wi(z)?n:z;l[R].push({item:E[0],stackList:E.slice(1),barSize:wi(U)?void 0:Vu(U,s,0)})}}return l},p7t=function(e){var n=e.barGap,s=e.barCategoryGap,a=e.bandSize,o=e.sizeList,l=o===void 0?[]:o,i=e.maxBarSize,u=l.length;if(u<1)return null;var p=Vu(n,a,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var _=!1,w=a/u,S=l.reduce(function(z,R){return z+R.barSize||0},0);S+=(u-1)*p,S>=a&&(S-=(u-1)*p,p=0),S>=a&&w>0&&(_=!0,w*=.9,S=u*w);var N=(a-S)/2>>0,M={offset:N-p,size:0};x=l.reduce(function(z,R){var U={item:R.item,position:{offset:M.offset+M.size+p,size:_?w:R.barSize}},V=[].concat(_3e(z),[U]);return M=V[V.length-1].position,R.stackList&&R.stackList.length&&R.stackList.forEach(function(K){V.push({item:K,position:M})}),V},y)}else{var E=Vu(s,a,0,!0);a-2*E-(u-1)*p<=0&&(p=0);var A=(a-2*E-(u-1)*p)/u;A>1&&(A>>=0);var P=i===+i?Math.min(A,i):A;x=l.reduce(function(z,R,U){var V=[].concat(_3e(z),[{item:R.item,position:{offset:E+(A+p)*U+(A-P)/2,size:P}}]);return R.stackList&&R.stackList.length&&R.stackList.forEach(function(K){V.push({item:K,position:V[V.length-1].position})}),V},y)}return x},m7t=function(e,n,s,a){var o=s.children,l=s.width,i=s.margin,u=l-(i.left||0)-(i.right||0),p=Q9e({children:o,legendWidth:u});if(p){var x=a||{},y=x.width,_=x.height,w=p.align,S=p.verticalAlign,N=p.layout;if((N==="vertical"||N==="horizontal"&&S==="middle")&&w!=="center"&&Dn(e[w]))return Ql(Ql({},e),{},GS({},w,e[w]+(y||0)));if((N==="horizontal"||N==="vertical"&&w==="center")&&S!=="middle"&&Dn(e[S]))return Ql(Ql({},e),{},GS({},S,e[S]+(_||0)))}return e},g7t=function(e,n,s){return wi(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},J9e=function(e,n,s,a,o){var l=n.props.children,i=cp(l,Wae).filter(function(p){return g7t(a,o,p.props.direction)});if(i&&i.length){var u=i.map(function(p){return p.props.dataKey});return e.reduce(function(p,x){var y=fu(x,s);if(wi(y))return p;var _=Array.isArray(y)?[Uae(y),$ae(y)]:[y,y],w=u.reduce(function(S,N){var M=fu(x,N,0),E=_[0]-Math.abs(Array.isArray(M)?M[0]:M),A=_[1]+Math.abs(Array.isArray(M)?M[1]:M);return[Math.min(E,S[0]),Math.max(A,S[1])]},[1/0,-1/0]);return[Math.min(w[0],p[0]),Math.max(w[1],p[1])]},[1/0,-1/0])}return null},x7t=function(e,n,s,a,o){var l=n.map(function(i){return J9e(e,i,s,o,a)}).filter(function(i){return!wi(i)});return l&&l.length?l.reduce(function(i,u){return[Math.min(i[0],u[0]),Math.max(i[1],u[1])]},[1/0,-1/0]):null},e$e=function(e,n,s,a,o){var l=n.map(function(u){var p=u.props.dataKey;return s==="number"&&p&&J9e(e,u,p,a)||RA(e,p,s,o)});if(s==="number")return l.reduce(function(u,p){return[Math.min(u[0],p[0]),Math.max(u[1],p[1])]},[1/0,-1/0]);var i={};return l.reduce(function(u,p){for(var x=0,y=p.length;x=2?qu(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!JI(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}})},jde=new WeakMap,hO=function(e,n){if(typeof n!="function")return e;jde.has(e)||jde.set(e,new WeakMap);var s=jde.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},n$e=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:BE(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:Gre(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:DA(),realScaleType:"point"}:o==="category"?{scale:BE(),realScaleType:"band"}:{scale:Gre(),realScaleType:"linear"};if(ok(a)){var u="scale".concat(Sae(a));return{scale:(p3e[u]||DA)(),realScaleType:p3e[u]?u:"point"}}return Va(a)?{scale:a}:{scale:DA(),realScaleType:"point"}},w3e=1e-4,s$e=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])-w3e,l=Math.max(a[0],a[1])+w3e,i=e(n[0]),u=e(n[s-1]);(il||ul)&&e.domain([n[0],n[s-1]])}},y7t=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+u,o=e[i][s][1]):(e[i][s][0]=l,e[i][s][1]=l+u,l=e[i][s][1])}},b7t=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)}},w7t={sign:_7t,expand:$Mt,none:IC,silhouette:UMt,wiggle:qMt,positive:b7t},j7t=function(e,n,s){var a=n.map(function(i){return i.props.dataKey}),o=w7t[s],l=BMt().keys(a).value(function(i,u){return+fu(i,u,0)}).order(Vfe).offset(o);return l(e)},k7t=function(e,n,s,a,o,l){if(!e)return null;var i=l?n.reverse():n,u={},p=i.reduce(function(y,_){var w,S=(w=_.type)!==null&&w!==void 0&&w.defaultProps?Ql(Ql({},_.type.defaultProps),_.props):_.props,N=S.stackId,M=S.hide;if(M)return y;var E=S[s],A=y[E]||{hasStack:!1,stackGroups:{}};if(Xc(N)){var P=A.stackGroups[N]||{numericAxisId:s,cateAxisId:a,items:[]};P.items.push(_),A.hasStack=!0,A.stackGroups[N]=P}else A.stackGroups[eP("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[_]};return Ql(Ql({},y),{},GS({},E,A))},u),x={};return Object.keys(p).reduce(function(y,_){var w=p[_];if(w.hasStack){var S={};w.stackGroups=Object.keys(w.stackGroups).reduce(function(N,M){var E=w.stackGroups[M];return Ql(Ql({},N),{},GS({},M,{numericAxisId:s,cateAxisId:a,items:E.items,stackedData:j7t(e,E.items,o)}))},S)}return Ql(Ql({},y),{},GS({},_,w))},x)},a$e=function(e,n){var s=n.realScaleType,a=n.type,o=n.tickCount,l=n.originalDomain,i=n.allowDecimals,u=s||n.scale;if(u!=="auto"&&u!=="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=Fzt(p,o,i);return e.domain([Uae(x),$ae(x)]),{niceTicks:x}}if(o&&a==="number"){var y=e.domain(),_=zzt(y,o,i);return{niceTicks:_}}return null},j3e=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 u=fu(l,n.dataKey,n.domain[i]);return wi(u)?null:n.scale(u)-o/2+a},N7t=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]},S7t=function(e,n){var s,a=(s=e.type)!==null&&s!==void 0&&s.defaultProps?Ql(Ql({},e.type.defaultProps),e.props):e.props,o=a.stackId;if(Xc(o)){var l=n[o];if(l){var i=l.items.indexOf(e);return i>=0?l.stackedData[i]:null}}return null},C7t=function(e){return e.reduce(function(n,s){return[Uae(s.concat([n[0]]).filter(Dn)),$ae(s.concat([n[1]]).filter(Dn))]},[1/0,-1/0])},i$e=function(e,n,s){return Object.keys(e).reduce(function(a,o){var l=e[o],i=l.stackedData,u=i.reduce(function(p,x){var y=C7t(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(u[0],a[0]),Math.max(u[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},k3e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,N3e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,bpe=function(e,n,s){if(Va(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(k3e.test(e[0])){var o=+k3e.exec(e[0])[1];a[0]=n[0]-o}else Va(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(N3e.test(e[1])){var l=+N3e.exec(e[1])[1];a[1]=n[1]+l}else Va(e[1])?a[1]=e[1](n[1]):a[1]=n[1];return a},ene=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=w0e(n,function(y){return y.coordinate}),l=1/0,i=1,u=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},D7t=function(e,n,s,a,o){var l=e.width,i=e.height,u=e.startAngle,p=e.endAngle,x=Vu(e.cx,l,l/2),y=Vu(e.cy,i,i/2),_=c$e(l,i,s),w=Vu(e.innerRadius,_,0),S=Vu(e.outerRadius,_,_*.8),N=Object.keys(n);return N.reduce(function(M,E){var A=n[E],P=A.domain,z=A.reversed,R;if(wi(A.range))a==="angleAxis"?R=[u,p]:a==="radiusAxis"&&(R=[w,S]),z&&(R=[R[1],R[0]]);else{R=A.range;var U=R,V=A7t(U,2);u=V[0],p=V[1]}var K=n$e(A,o),W=K.realScaleType,J=K.scale;J.domain(P).range(R),s$e(J);var ae=a$e(J,Lx(Lx({},A),{},{realScaleType:W})),oe=Lx(Lx(Lx({},A),ae),{},{range:R,radius:S,realScaleType:W,scale:J,cx:x,cy:y,innerRadius:w,outerRadius:S,startAngle:u,endAngle:p});return Lx(Lx({},M),{},l$e({},E,oe))},{})},R7t=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))},F7t=function(e,n){var s=e.x,a=e.y,o=n.cx,l=n.cy,i=R7t({x:s,y:a},{x:o,y:l});if(i<=0)return{radius:i};var u=(s-o)/i,p=Math.acos(u);return a>l&&(p=2*Math.PI-p),{radius:i,angle:O7t(p),angleInRadian:p}},z7t=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}},B7t=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},T3e=function(e,n){var s=e.x,a=e.y,o=F7t({x:s,y:a},n),l=o.radius,i=o.angle,u=n.innerRadius,p=n.outerRadius;if(lp)return!1;if(l===0)return!0;var x=z7t(n),y=x.startAngle,_=x.endAngle,w=i,S;if(y<=_){for(;w>_;)w-=360;for(;w=y&&w<=_}else{for(;w>y;)w-=360;for(;w<_;)w+=360;S=w>=_&&w<=y}return S?Lx(Lx({},n),{},{radius:l,angle:B7t(w,n)}):null},d$e=function(e){return!I.isValidElement(e)&&!Va(e)&&typeof e!="boolean"?e.className:""};function YE(t){"@babel/helpers - typeof";return YE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},YE(t)}var $7t=["offset"];function U7t(t){return W7t(t)||H7t(t)||V7t(t)||q7t()}function q7t(){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 V7t(t,e){if(t){if(typeof t=="string")return wpe(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 wpe(t,e)}}function H7t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function W7t(t){if(Array.isArray(t))return wpe(t)}function wpe(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 K7t(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 A3e(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 Hc(t){for(var e=1;e=0?1:-1,P,z;a==="insideStart"?(P=w+A*l,z=N):a==="insideEnd"?(P=S-A*l,z=!N):a==="end"&&(P=S+A*l,z=N),z=E<=0?z:!z;var R=rl(p,x,M,P),U=rl(p,x,M,P+(z?1:-1)*359),V="M".concat(R.x,",").concat(R.y,` A`).concat(M,",").concat(M,",0,1,").concat(z?0:1,`, `).concat(U.x,",").concat(U.y),K=wi(e.id)?eP("recharts-radial-line-"):e.id;return it.createElement("text",XE({},s,{dominantBaseline:"central",className:oi("recharts-radial-bar-label",i)}),it.createElement("defs",null,it.createElement("path",{id:K,d:V})),it.createElement("textPath",{xlinkHref:"#".concat(K)},n))},tBt=function(e){var n=e.viewBox,s=e.offset,a=e.position,o=n,l=o.cx,i=o.cy,u=o.innerRadius,p=o.outerRadius,x=o.startAngle,y=o.endAngle,_=(x+y)/2;if(a==="outside"){var w=rl(l,i,p+s,_),S=w.x,N=w.y;return{x:S,y:N,textAnchor:S>=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 M=(u+p)/2,E=rl(l,i,M,_),A=E.x,P=E.y;return{x:A,y:P,textAnchor:"middle",verticalAnchor:"middle"}},rBt=function(e){var n=e.viewBox,s=e.parentViewBox,a=e.offset,o=e.position,l=n,i=l.x,u=l.y,p=l.width,x=l.height,y=x>=0?1:-1,_=y*a,w=y>0?"end":"start",S=y>0?"start":"end",N=p>=0?1:-1,M=N*a,E=N>0?"end":"start",A=N>0?"start":"end";if(o==="top"){var P={x:i+p/2,y:u-y*a,textAnchor:"middle",verticalAnchor:w};return Hc(Hc({},P),s?{height:Math.max(u-s.y,0),width:p}:{})}if(o==="bottom"){var z={x:i+p/2,y:u+x+_,textAnchor:"middle",verticalAnchor:S};return Hc(Hc({},z),s?{height:Math.max(s.y+s.height-(u+x),0),width:p}:{})}if(o==="left"){var R={x:i-M,y:u+x/2,textAnchor:E,verticalAnchor:"middle"};return Hc(Hc({},R),s?{width:Math.max(R.x-s.x,0),height:x}:{})}if(o==="right"){var U={x:i+p+M,y:u+x/2,textAnchor:A,verticalAnchor:"middle"};return Hc(Hc({},U),s?{width:Math.max(s.x+s.width-U.x,0),height:x}:{})}var V=s?{width:p,height:x}:{};return o==="insideLeft"?Hc({x:i+M,y:u+x/2,textAnchor:A,verticalAnchor:"middle"},V):o==="insideRight"?Hc({x:i+p-M,y:u+x/2,textAnchor:E,verticalAnchor:"middle"},V):o==="insideTop"?Hc({x:i+p/2,y:u+_,textAnchor:"middle",verticalAnchor:S},V):o==="insideBottom"?Hc({x:i+p/2,y:u+x-_,textAnchor:"middle",verticalAnchor:w},V):o==="insideTopLeft"?Hc({x:i+M,y:u+_,textAnchor:A,verticalAnchor:S},V):o==="insideTopRight"?Hc({x:i+p-M,y:u+_,textAnchor:E,verticalAnchor:S},V):o==="insideBottomLeft"?Hc({x:i+M,y:u+x-_,textAnchor:A,verticalAnchor:w},V):o==="insideBottomRight"?Hc({x:i+p-M,y:u+x-_,textAnchor:E,verticalAnchor:w},V):M3(o)&&(Dn(o.x)||tj(o.x))&&(Dn(o.y)||tj(o.y))?Hc({x:i+Vu(o.x,p),y:u+Vu(o.y,x),textAnchor:"end",verticalAnchor:"end"},V):Hc({x:i+p/2,y:u+x/2,textAnchor:"middle",verticalAnchor:"middle"},V)},nBt=function(e){return"cx"in e&&Dn(e.cx)};function xd(t){var e=t.offset,n=e===void 0?5:e,s=G7t(t,$7t),a=Hc({offset:n},s),o=a.viewBox,l=a.position,i=a.value,u=a.children,p=a.content,x=a.className,y=x===void 0?"":x,_=a.textBreakAll;if(!o||wi(i)&&wi(u)&&!I.isValidElement(p)&&!Va(p))return null;if(I.isValidElement(p))return I.cloneElement(p,a);var w;if(Va(p)){if(w=I.createElement(p,a),I.isValidElement(w))return w}else w=Q7t(a);var S=nBt(o),N=Oa(a,!0);if(S&&(l==="insideStart"||l==="insideEnd"||l==="end"))return eBt(a,w,N);var M=S?tBt(a):rBt(a);return it.createElement(ck,XE({className:oi("recharts-label",y)},N,M,{breakAll:_}),w)}xd.displayName="Label";var u$e=function(e){var n=e.cx,s=e.cy,a=e.angle,o=e.startAngle,l=e.endAngle,i=e.r,u=e.radius,p=e.innerRadius,x=e.outerRadius,y=e.x,_=e.y,w=e.top,S=e.left,N=e.width,M=e.height,E=e.clockWise,A=e.labelViewBox;if(A)return A;if(Dn(N)&&Dn(M)){if(Dn(y)&&Dn(_))return{x:y,y:_,width:N,height:M};if(Dn(w)&&Dn(S))return{x:w,y:S,width:N,height:M}}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||u||i||0,clockWise:E}:e.viewBox?e.viewBox:{}},sBt=function(e,n){return e?e===!0?it.createElement(xd,{key:"label-implicit",viewBox:n}):Xc(e)?it.createElement(xd,{key:"label-implicit",viewBox:n,value:e}):I.isValidElement(e)?e.type===xd?I.cloneElement(e,{key:"label-implicit",viewBox:n}):it.createElement(xd,{key:"label-implicit",content:e,viewBox:n}):Va(e)?it.createElement(xd,{key:"label-implicit",content:e,viewBox:n}):M3(e)?it.createElement(xd,XE({viewBox:n},e,{key:"label-implicit"})):null:null},aBt=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=u$e(e),l=cp(a,xd).map(function(u,p){return I.cloneElement(u,{viewBox:n||o,key:"label-".concat(p)})});if(!s)return l;var i=sBt(e.label,n||o);return[i].concat(U7t(l))};xd.parseViewBox=u$e;xd.renderCallByParent=aBt;function iBt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var oBt=iBt;const lBt=Wi(oBt);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)}var cBt=["valueAccessor"],dBt=["data","dataKey","clockWise","id","textBreakAll"];function uBt(t){return mBt(t)||pBt(t)||fBt(t)||hBt()}function hBt(){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 fBt(t,e){if(t){if(typeof t=="string")return jpe(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 jpe(t,e)}}function pBt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function mBt(t){if(Array.isArray(t))return jpe(t)}function jpe(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 vBt(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 _Bt=function(e){return Array.isArray(e.value)?lBt(e.value):e.value};function X1(t){var e=t.valueAccessor,n=e===void 0?_Bt:e,s=P3e(t,cBt),a=s.data,o=s.dataKey,l=s.clockWise,i=s.id,u=s.textBreakAll,p=P3e(s,dBt);return!a||!a.length?null:it.createElement(So,{className:"recharts-label-list"},a.map(function(x,y){var _=wi(o)?n(x,y):fu(x&&x.payload,o),w=wi(i)?{}:{id:"".concat(i,"-").concat(y)};return it.createElement(xd,rne({},Oa(x,!0),p,w,{parentViewBox:x.parentViewBox,value:_,textBreakAll:u,viewBox:xd.parseViewBox(wi(l)?x:I3e(I3e({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}X1.displayName="LabelList";function bBt(t,e){return t?t===!0?it.createElement(X1,{key:"labelList-implicit",data:e}):it.isValidElement(t)||Va(t)?it.createElement(X1,{key:"labelList-implicit",data:e,content:t}):M3(t)?it.createElement(X1,rne({data:e},t,{key:"labelList-implicit"})):null:null}function wBt(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=cp(s,X1).map(function(l,i){return I.cloneElement(l,{data:e,key:"labelList-".concat(i)})});if(!n)return a;var o=bBt(t.label,e);return[o].concat(uBt(a))}X1.renderCallByParent=wBt;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 kpe(){return kpe=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 w=rl(n,s,a,l),S=rl(n,s,a,p);_+="L ".concat(S.x,",").concat(S.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(u)>180),",").concat(+(l<=p),`, `).concat(w.x,",").concat(w.y," Z")}else _+="L ".concat(n,",").concat(s," Z");return _},CBt=function(e){var n=e.cx,s=e.cy,a=e.innerRadius,o=e.outerRadius,l=e.cornerRadius,i=e.forceCornerRadius,u=e.cornerIsExternal,p=e.startAngle,x=e.endAngle,y=qu(x-p),_=fO({cx:n,cy:s,radius:o,angle:p,sign:y,cornerRadius:l,cornerIsExternal:u}),w=_.circleTangency,S=_.lineTangency,N=_.theta,M=fO({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:u}),E=M.circleTangency,A=M.lineTangency,P=M.theta,z=u?Math.abs(p-x):Math.abs(p-x)-N-P;if(z<0)return i?"M ".concat(S.x,",").concat(S.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 `):h$e({cx:n,cy:s,innerRadius:a,outerRadius:o,startAngle:p,endAngle:x});var R="M ".concat(S.x,",").concat(S.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(w.x,",").concat(w.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(A.x,",").concat(A.y,` `);if(a>0){var U=fO({cx:n,cy:s,radius:a,angle:p,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),V=U.circleTangency,K=U.lineTangency,W=U.theta,J=fO({cx:n,cy:s,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),ae=J.circleTangency,oe=J.lineTangency,xe=J.theta,ie=u?Math.abs(p-x):Math.abs(p-x)-W-xe;if(ie<0&&l===0)return"".concat(R,"L").concat(n,",").concat(s,"Z");R+="L".concat(oe.x,",").concat(oe.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ae.x,",").concat(ae.y,` A`).concat(a,",").concat(a,",0,").concat(+(ie>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 R+="L".concat(n,",").concat(s,"Z");return R},MBt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},f$e=function(e){var n=O3e(O3e({},MBt),e),s=n.cx,a=n.cy,o=n.innerRadius,l=n.outerRadius,i=n.cornerRadius,u=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,_=n.className;if(l0&&Math.abs(x-y)<360?M=CBt({cx:s,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(N,S/2),forceCornerRadius:u,cornerIsExternal:p,startAngle:x,endAngle:y}):M=h$e({cx:s,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),it.createElement("path",kpe({},Oa(n,!0),{className:w,d:M,role:"img"}))};function eI(t){"@babel/helpers - typeof";return eI=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},eI(t)}function Npe(){return Npe=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 GBt(t,e){return kk(t.getTime(),e.getTime())}function KBt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function ZBt(t,e){return t===e}function q3e(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,u=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,w=i.value;if(n.equals(_[0],w[0],u,y,t,e,n)&&n.equals(_[1],w[1],_[0],w[0],t,e,n)){x=a[y]=!0;break}y++}if(!x)return!1;u++}return!0}var YBt=kk;function XBt(t,e,n){var s=U3e(t),a=s.length;if(U3e(e).length!==a)return!1;for(;a-- >0;)if(!x$e(t,e,n,s[a]))return!1;return!0}function dT(t,e,n){var s=B3e(t),a=s.length;if(B3e(e).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=s[a],!x$e(t,e,n,o)||(l=$3e(t,o),i=$3e(e,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function QBt(t,e){return kk(t.valueOf(),e.valueOf())}function JBt(t,e){return t.source===e.source&&t.flags===e.flags}function V3e(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 u=e.values(),p=!1,x=0;(i=u.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 e9t(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 t9t(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 x$e(t,e,n,s){return(s===HBt||s===VBt||s===qBt)&&(t.$$typeof||e.$$typeof)?!0:UBt(e,s)&&n.equals(t[s],e[s],s,s,t,e,n)}var r9t="[object Arguments]",n9t="[object Boolean]",s9t="[object Date]",a9t="[object Error]",i9t="[object Map]",o9t="[object Number]",l9t="[object Object]",c9t="[object RegExp]",d9t="[object Set]",u9t="[object String]",h9t="[object URL]",f9t=Array.isArray,H3e=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,W3e=Object.assign,p9t=Object.prototype.toString.call.bind(Object.prototype.toString);function m9t(t){var e=t.areArraysEqual,n=t.areDatesEqual,s=t.areErrorsEqual,a=t.areFunctionsEqual,o=t.areMapsEqual,l=t.areNumbersEqual,i=t.areObjectsEqual,u=t.arePrimitiveWrappersEqual,p=t.areRegExpsEqual,x=t.areSetsEqual,y=t.areTypedArraysEqual,_=t.areUrlsEqual;return function(S,N,M){if(S===N)return!0;if(S==null||N==null)return!1;var E=typeof S;if(E!==typeof N)return!1;if(E!=="object")return E==="number"?l(S,N,M):E==="function"?a(S,N,M):!1;var A=S.constructor;if(A!==N.constructor)return!1;if(A===Object)return i(S,N,M);if(f9t(S))return e(S,N,M);if(H3e!=null&&H3e(S))return y(S,N,M);if(A===Date)return n(S,N,M);if(A===RegExp)return p(S,N,M);if(A===Map)return o(S,N,M);if(A===Set)return x(S,N,M);var P=p9t(S);return P===s9t?n(S,N,M):P===c9t?p(S,N,M):P===i9t?o(S,N,M):P===d9t?x(S,N,M):P===l9t?typeof S.then!="function"&&typeof N.then!="function"&&i(S,N,M):P===h9t?_(S,N,M):P===a9t?s(S,N,M):P===r9t?i(S,N,M):P===n9t||P===o9t||P===u9t?u(S,N,M):!1}}function g9t(t){var e=t.circular,n=t.createCustomConfig,s=t.strict,a={areArraysEqual:s?dT:WBt,areDatesEqual:GBt,areErrorsEqual:KBt,areFunctionsEqual:ZBt,areMapsEqual:s?z3e(q3e,dT):q3e,areNumbersEqual:YBt,areObjectsEqual:s?dT:XBt,arePrimitiveWrappersEqual:QBt,areRegExpsEqual:JBt,areSetsEqual:s?z3e(V3e,dT):V3e,areTypedArraysEqual:s?dT:e9t,areUrlsEqual:t9t};if(n&&(a=W3e({},a,n(a))),e){var o=mO(a.areArraysEqual),l=mO(a.areMapsEqual),i=mO(a.areObjectsEqual),u=mO(a.areSetsEqual);a=W3e({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:u})}return a}function x9t(t){return function(e,n,s,a,o,l,i){return t(e,n,i)}}function y9t(t){var e=t.circular,n=t.comparator,s=t.createState,a=t.equals,o=t.strict;if(s)return function(u,p){var x=s(),y=x.cache,_=y===void 0?e?new WeakMap:void 0:y,w=x.meta;return n(u,p,{cache:_,equals:a,meta:w,strict:o})};if(e)return function(u,p){return n(u,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(u,p){return n(u,p,l)}}var v9t=Nv();Nv({strict:!0});Nv({circular:!0});Nv({circular:!0,strict:!0});Nv({createInternalComparator:function(){return kk}});Nv({strict:!0,createInternalComparator:function(){return kk}});Nv({circular:!0,createInternalComparator:function(){return kk}});Nv({circular:!0,createInternalComparator:function(){return kk},strict:!0});function Nv(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=g9t(t),u=m9t(i),p=s?s(u):x9t(u);return y9t({circular:n,comparator:u,createState:a,equals:p,strict:l})}function _9t(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function G3e(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):_9t(a)};requestAnimationFrame(s)}function Cpe(t){"@babel/helpers - typeof";return Cpe=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},Cpe(t)}function b9t(t){return N9t(t)||k9t(t)||j9t(t)||w9t()}function w9t(){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 j9t(t,e){if(t){if(typeof t=="string")return K3e(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 K3e(t,e)}}function K3e(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 A=E>1?1:E,P=A,z=0;z<8;++z){var R=y(P)-A,U=w(P);if(Math.abs(R-A)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,u=function(x,y,_){var w=-(x-y)*s,S=_*o,N=_+(w-S)*i/1e3,M=_*i/1e3+x;return Math.abs(M-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 r$t(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 kde(t){return i$t(t)||a$t(t)||s$t(t)||n$t()}function n$t(){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 s$t(t,e){if(t){if(typeof t=="string")return Ipe(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 Ipe(t,e)}}function a$t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function i$t(t){if(Array.isArray(t))return Ipe(t)}function Ipe(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 ane(t){return ane=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ane(t)}var Ay=function(t){u$t(n,t);var e=h$t(n);function n(s,a){var o;o$t(this,n),o=e.call(this,s,a);var l=o.props,i=l.isActive,u=l.attributeName,p=l.from,x=l.to,y=l.steps,_=l.children,w=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(Ope(o)),o.changeStyle=o.changeStyle.bind(Ope(o)),!i||w<=0)return o.state={style:{}},typeof _=="function"&&(o.state={style:x}),Lpe(o);if(y&&y.length)o.state={style:y[0].style};else if(p){if(typeof _=="function")return o.state={style:p},Lpe(o);o.state={style:u?CT({},u,p):p}}else o.state={style:{}};return o}return c$t(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,u=o.attributeName,p=o.shouldReAnimate,x=o.to,y=o.from,_=this.state.style;if(i){if(!l){var w={style:u?CT({},u,x):x};this.state&&_&&(u&&_[u]!==x||!u&&_!==x)&&this.setState(w);return}if(!(v9t(a.to,x)&&a.canBegin&&a.isActive)){var S=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var N=S||p?y:a.to;if(this.state&&_){var M={style:u?CT({},u,N):N};(u&&_[u]!==N||!u&&_!==N)&&this.setState(M)}this.runAnimation(Kp(Kp({},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,u=a.duration,p=a.easing,x=a.begin,y=a.onAnimationEnd,_=a.onAnimationStart,w=J9t(l,i,U9t(p),u,this.changeStyle),S=function(){o.stopJSAnimation=w()};this.manager.start([_,x,S,u,y])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,i=a.begin,u=a.onAnimationStart,p=l[0],x=p.style,y=p.duration,_=y===void 0?0:y,w=function(N,M,E){if(E===0)return N;var A=M.duration,P=M.easing,z=P===void 0?"ease":P,R=M.style,U=M.properties,V=M.onAnimationEnd,K=E>0?l[E-1]:M,W=U||Object.keys(R);if(typeof z=="function"||z==="spring")return[].concat(kde(N),[o.runJSAnimation.bind(o,{from:K.style,to:R,duration:A,easing:z}),A]);var J=X3e(W,A,z),ae=Kp(Kp(Kp({},K.style),R),{},{transition:J});return[].concat(kde(N),[ae,A,V]).filter(A9t)};return this.manager.start([u].concat(kde(l.reduce(w,[x,Math.max(_,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=S9t());var o=a.begin,l=a.duration,i=a.attributeName,u=a.to,p=a.easing,x=a.onAnimationStart,y=a.onAnimationEnd,_=a.steps,w=a.children,S=this.manager;if(this.unSubscribe=S.subscribe(this.handleStyleChange),typeof p=="function"||typeof w=="function"||p==="spring"){this.runJSAnimation(a);return}if(_.length>1){this.runStepAnimation(a);return}var N=i?CT({},i,u):u,M=X3e(Object.keys(N),l,p);S.start([x,o,Kp(Kp({},N),{},{transition:M}),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 u=t$t(a,e$t),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(w){var S=w.props,N=S.style,M=N===void 0?{}:N,E=S.className,A=I.cloneElement(w,Kp(Kp({},u),{},{style:Kp(Kp({},M),x),className:E}));return A};return p===1?y(I.Children.only(o)):it.createElement("div",null,I.Children.map(o,function(_){return y(_)}))}}]),n}(I.PureComponent);Ay.displayName="Animate";Ay.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Ay.propTypes={from:go.oneOfType([go.object,go.string]),to:go.oneOfType([go.object,go.string]),attributeName:go.string,duration:go.number,begin:go.number,easing:go.oneOfType([go.string,go.func]),steps:go.arrayOf(go.shape({duration:go.number.isRequired,style:go.object.isRequired,easing:go.oneOfType([go.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),go.func]),properties:go.arrayOf("string"),onAnimationEnd:go.func})),children:go.oneOfType([go.node,go.func]),isActive:go.bool,canBegin:go.bool,onAnimationEnd:go.func,shouldReAnimate:go.bool,onAnimationStart:go.func,onAnimationReStart:go.func};function nI(t){"@babel/helpers - typeof";return nI=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},nI(t)}function ine(){return ine=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,u=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,w=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+u*y[0],",").concat(n)),x+="L ".concat(e+s-u*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-u*y[2],",").concat(n+a)),x+="L ".concat(e+u*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 S=Math.min(l,o);x="M ".concat(e,",").concat(n+i*S,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(e+u*S,",").concat(n,` L `).concat(e+s-u*S,",").concat(n,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(e+s,",").concat(n+i*S,` L `).concat(e+s,",").concat(n+a-i*S,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(e+s-u*S,",").concat(n+a,` L `).concat(e+u*S,",").concat(n+a,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(e,",").concat(n+a-i*S," Z")}else x="M ".concat(e,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return x},w$t=function(e,n){if(!e||!n)return!1;var s=e.x,a=e.y,o=n.x,l=n.y,i=n.width,u=n.height;if(Math.abs(i)>0&&Math.abs(u)>0){var p=Math.min(o,o+i),x=Math.max(o,o+i),y=Math.min(l,l+u),_=Math.max(l,l+u);return s>=p&&s<=x&&a>=y&&a<=_}return!1},j$t={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Z0e=function(e){var n=a5e(a5e({},j$t),e),s=I.useRef(),a=I.useState(-1),o=p$t(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 u=n.x,p=n.y,x=n.width,y=n.height,_=n.radius,w=n.className,S=n.animationEasing,N=n.animationDuration,M=n.animationBegin,E=n.isAnimationActive,A=n.isUpdateAnimationActive;if(u!==+u||p!==+p||x!==+x||y!==+y||x===0||y===0)return null;var P=oi("recharts-rectangle",w);return A?it.createElement(Ay,{canBegin:l>0,from:{width:x,height:y,x:u,y:p},to:{width:x,height:y,x:u,y:p},duration:N,animationEasing:S,isActive:A},function(z){var R=z.width,U=z.height,V=z.x,K=z.y;return it.createElement(Ay,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:M,duration:N,isActive:E,easing:S},it.createElement("path",ine({},Oa(n,!0),{className:P,d:i5e(V,K,R,U,_),ref:s})))}):it.createElement("path",ine({},Oa(n,!0),{className:P,d:i5e(u,p,x,y,_)}))},k$t=["points","className","baseLinePoints","connectNulls"];function Y4(){return Y4=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 S$t(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 o5e(t){return A$t(t)||T$t(t)||M$t(t)||C$t()}function C$t(){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 M$t(t,e){if(t){if(typeof t=="string")return Dpe(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 Dpe(t,e)}}function T$t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function A$t(t){if(Array.isArray(t))return Dpe(t)}function Dpe(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){l5e(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),l5e(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},zA=function(e,n){var s=E$t(e);n&&(s=[s.reduce(function(o,l){return[].concat(o5e(o),o5e(l))},[])]);var a=s.map(function(o){return o.reduce(function(l,i,u){return"".concat(l).concat(u===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},I$t=function(e,n,s){var a=zA(e,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(zA(n.reverse(),s).slice(1))},P$t=function(e){var n=e.points,s=e.className,a=e.baseLinePoints,o=e.connectNulls,l=N$t(e,k$t);if(!n||!n.length)return null;var i=oi("recharts-polygon",s);if(a&&a.length){var u=l.stroke&&l.stroke!=="none",p=I$t(n,a,o);return it.createElement("g",{className:i},it.createElement("path",Y4({},Oa(l,!0),{fill:p.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:p})),u?it.createElement("path",Y4({},Oa(l,!0),{fill:"none",d:zA(n,o)})):null,u?it.createElement("path",Y4({},Oa(l,!0),{fill:"none",d:zA(a,o)})):null)}var x=zA(n,o);return it.createElement("path",Y4({},Oa(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function Rpe(){return Rpe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function B$t(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 $$t=function(e,n,s,a,o,l){return"M".concat(e,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(s)},U$t=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,u=e.left,p=u===void 0?0:u,x=e.width,y=x===void 0?0:x,_=e.height,w=_===void 0?0:_,S=e.className,N=z$t(e,L$t),M=O$t({x:s,y:o,top:i,left:p,width:y,height:w},N);return!Dn(s)||!Dn(o)||!Dn(y)||!Dn(w)||!Dn(i)||!Dn(p)?null:it.createElement("path",Fpe({},Oa(M,!0),{className:oi("recharts-cross",S),d:$$t(s,o,y,w,i,p)}))},q$t=Bae,V$t=O9e,H$t=Qg;function W$t(t,e){return t&&t.length?q$t(t,H$t(e),V$t):void 0}var G$t=W$t;const K$t=Wi(G$t);var Z$t=Bae,Y$t=Qg,X$t=D9e;function Q$t(t,e){return t&&t.length?Z$t(t,Y$t(e),X$t):void 0}var J$t=Q$t;const eUt=Wi(J$t);var tUt=["cx","cy","angle","ticks","axisLine"],rUt=["ticks","tick","angle","tickFormatter","stroke"];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 BA(){return BA=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 nUt(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 sUt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h5e(t,e){for(var n=0;nm5e?l=a==="outer"?"start":"end":o<-m5e?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,u=s.axisLineType,p=__(__({},Oa(this.props,!1)),{},{fill:"none"},Oa(i,!1));if(u==="circle")return it.createElement(Y0e,Vw({className:"recharts-polar-angle-axis-line"},p,{cx:a,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(_){return rl(a,o,l,_.coordinate)});return it.createElement(P$t,Vw({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,u=a.tickFormatter,p=a.stroke,x=Oa(this.props,!1),y=Oa(l,!1),_=__(__({},x),{},{fill:"none"},Oa(i,!1)),w=o.map(function(S,N){var M=s.getTickLineCoord(S),E=s.getTickTextAnchor(S),A=__(__(__({textAnchor:E},x),{},{stroke:"none",fill:p},y),{},{index:N,payload:S,x:M.x2,y:M.y2});return it.createElement(So,Vw({className:oi("recharts-polar-angle-axis-tick",d$e(l)),key:"tick-".concat(S.coordinate)},lk(s.props,S,N)),i&&it.createElement("line",Vw({className:"recharts-polar-angle-axis-tick-line"},_,M)),l&&e.renderTickItem(l,A,u?u(S.value,N):S.value))});return it.createElement(So,{className:"recharts-polar-angle-axis-ticks"},w)}},{key:"render",value:function(){var s=this.props,a=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!a||!a.length?null:it.createElement(So,{className:oi("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,o){var l;return it.isValidElement(s)?l=it.cloneElement(s,a):Va(s)?l=s(a):l=it.createElement(ck,Vw({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(I.PureComponent);Zae(Yae,"displayName","PolarAngleAxis");Zae(Yae,"axisType","angleAxis");Zae(Yae,"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 vUt=EBe,_Ut=vUt(Object.getPrototypeOf,Object),bUt=_Ut,wUt=Ly,jUt=bUt,kUt=Oy,NUt="[object Object]",SUt=Function.prototype,CUt=Object.prototype,M$e=SUt.toString,MUt=CUt.hasOwnProperty,TUt=M$e.call(Object);function AUt(t){if(!kUt(t)||wUt(t)!=NUt)return!1;var e=jUt(t);if(e===null)return!0;var n=MUt.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&M$e.call(n)==TUt}var EUt=AUt;const IUt=Wi(EUt);var PUt=Ly,LUt=Oy,OUt="[object Boolean]";function DUt(t){return t===!0||t===!1||LUt(t)&&PUt(t)==OUt}var RUt=DUt;const FUt=Wi(RUt);function aI(t){"@babel/helpers - typeof";return aI=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},aI(t)}function cne(){return cne=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:u,y:p},to:{upperWidth:x,lowerWidth:y,height:_,x:u,y:p},duration:N,animationEasing:S,isActive:E},function(P){var z=P.upperWidth,R=P.lowerWidth,U=P.height,V=P.x,K=P.y;return it.createElement(Ay,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:M,duration:N,easing:S},it.createElement("path",cne({},Oa(n,!0),{className:A,d:v5e(V,K,z,R,U),ref:s})))}):it.createElement("g",null,it.createElement("path",cne({},Oa(n,!0),{className:A,d:v5e(u,p,x,y,_)})))},ZUt=["option","shapeType","propTransformer","activeClassName","isActive"];function iI(t){"@babel/helpers - typeof";return iI=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},iI(t)}function YUt(t,e){if(t==null)return{};var n=XUt(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 XUt(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 _5e(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 dne(t){for(var e=1;e0?mf(P,"paddingAngle",0):0;if(R){var V=H0(R.endAngle-R.startAngle,P.endAngle-P.startAngle),K=Xo(Xo({},P),{},{startAngle:A+U,endAngle:A+V(N)+U});M.push(K),A=K.endAngle}else{var W=P.endAngle,J=P.startAngle,ae=H0(0,W-J),oe=ae(N),xe=Xo(Xo({},P),{},{startAngle:A+U,endAngle:A+oe+U});M.push(xe),A=xe.endAngle}}),it.createElement(So,null,s.renderSectorsStatically(M))})}},{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||!qae(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,u=a.label,p=a.cx,x=a.cy,y=a.innerRadius,_=a.outerRadius,w=a.isAnimationActive,S=this.state.isAnimationFinished;if(o||!l||!l.length||!Dn(p)||!Dn(x)||!Dn(y)||!Dn(_))return null;var N=oi("recharts-pie",i);return it.createElement(So,{tabIndex:this.props.rootTabIndex,className:N,ref:function(E){s.pieRef=E}},this.renderSectors(),u&&this.renderLabels(l),xd.renderCallByParent(this.props,null,!1),(!w||S)&&X1.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?A:A-1)*u,z=M-A*w-P,R=a.reduce(function(K,W){var J=fu(W,E,0);return K+(Dn(J)?J:0)},0),U;if(R>0){var V;U=a.map(function(K,W){var J=fu(K,E,0),ae=fu(K,x,W),oe=(Dn(J)?J:0)/R,xe;W?xe=V.endAngle+qu(N)*u*(J!==0?1:0):xe=l;var ie=xe+qu(N)*((J!==0?w:0)+oe*z),pe=(xe+ie)/2,se=(S.innerRadius+S.outerRadius)/2,fe=[{name:ae,value:J,payload:K,dataKey:E,type:_}],he=rl(S.cx,S.cy,se,pe);return V=Xo(Xo(Xo({percent:oe,cornerRadius:o,name:ae,tooltipPayload:fe,midAngle:pe,middleRadius:se,tooltipPosition:he},K),S),{},{value:fu(K,E),startAngle:xe,endAngle:ie,payload:K,paddingAngle:qu(N)*u}),V})}return Xo(Xo({},S),{},{sectors:U,data:a})});var yqt=Math.ceil,vqt=Math.max;function _qt(t,e,n,s){for(var a=-1,o=vqt(yqt((e-t)/(n||1)),0),l=Array(o);o--;)l[s?o:++a]=t,t+=n;return l}var bqt=_qt,wqt=YBe,k5e=1/0,jqt=17976931348623157e292;function kqt(t){if(!t)return t===0?t:0;if(t=wqt(t),t===k5e||t===-k5e){var e=t<0?-1:1;return e*jqt}return t===t?t:0}var I$e=kqt,Nqt=bqt,Sqt=Iae,Nde=I$e;function Cqt(t){return function(e,n,s){return s&&typeof s!="number"&&Sqt(e,n,s)&&(n=s=void 0),e=Nde(e),n===void 0?(n=e,e=0):n=Nde(n),s=s===void 0?e0&&s.handleDrag(a.changedTouches[0])}),Wh(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()}),Wh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Wh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Wh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Wh(s,"handleSlideDragStart",function(a){var o=T5e(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 $qt(e,t),Rqt(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,u=i.gap,p=i.data,x=p.length-1,y=Math.min(a,o),_=Math.max(a,o),w=e.getIndexInRange(l,y),S=e.getIndexInRange(l,_);return{startIndex:w-w%u,endIndex:S===x?x:S-S%u}}},{key:"getTextOfTick",value:function(s){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,u=fu(o[s],i,s);return Va(l)?l(u,s):u}},{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,u=this.props,p=u.x,x=u.width,y=u.travellerWidth,_=u.startIndex,w=u.endIndex,S=u.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 M=this.getIndex({startX:l+N,endX:i+N});(M.startIndex!==_||M.endIndex!==w)&&S&&S(M),this.setState({startX:l+N,endX:i+N,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var o=T5e(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,u=a.startX,p=this.state[l],x=this.props,y=x.x,_=x.width,w=x.travellerWidth,S=x.onChange,N=x.gap,M=x.data,E={startX:this.state.startX,endX:this.state.endX},A=s.pageX-o;A>0?A=Math.min(A,y+_-w-p):A<0&&(A=Math.max(A,y-p)),E[l]=p+A;var P=this.getIndex(E),z=P.startIndex,R=P.endIndex,U=function(){var K=M.length-1;return l==="startX"&&(i>u?z%N===0:R%N===0)||iu?R%N===0:z%N===0)||i>u&&R===K};this.setState(Wh(Wh({},l,p+A),"brushMoveStartX",s.pageX),function(){S&&U()&&S(P)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var o=this,l=this.state,i=l.scaleValues,u=l.startX,p=l.endX,x=this.state[a],y=i.indexOf(x);if(y!==-1){var _=y+s;if(!(_===-1||_>=i.length)){var w=i[_];a==="startX"&&w>=p||a==="endX"&&w<=u||this.setState(Wh({},a,w),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,u=s.fill,p=s.stroke;return it.createElement("rect",{stroke:p,fill:u,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,u=s.data,p=s.children,x=s.padding,y=I.Children.only(p);return y?it.cloneElement(y,{x:a,y:o,width:l,height:i,margin:x,compact:!0,data:u}):null}},{key:"renderTravellerLayer",value:function(s,a){var o,l,i=this,u=this.props,p=u.y,x=u.travellerWidth,y=u.height,_=u.traveller,w=u.ariaLabel,S=u.data,N=u.startIndex,M=u.endIndex,E=Math.max(s,this.props.x),A=Sde(Sde({},Oa(this.props,!1)),{},{x:E,y:p,width:x,height:y}),P=w||"Min value: ".concat((o=S[N])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=S[M])===null||l===void 0?void 0:l.name);return it.createElement(So,{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(R){["ArrowLeft","ArrowRight"].includes(R.key)&&(R.preventDefault(),R.stopPropagation(),i.handleTravellerMoveKeyboard(R.key==="ArrowRight"?1:-1,a))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(_,A))}},{key:"renderSlide",value:function(s,a){var o=this.props,l=o.y,i=o.height,u=o.stroke,p=o.travellerWidth,x=Math.min(s,a)+p,y=Math.max(Math.abs(a-s)-p,0);return it.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:u,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,u=s.travellerWidth,p=s.stroke,x=this.state,y=x.startX,_=x.endX,w=5,S={pointerEvents:"none",fill:p};return it.createElement(So,{className:"recharts-brush-texts"},it.createElement(ck,fne({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,_)-w,y:l+i/2},S),this.getTextOfTick(a)),it.createElement(ck,fne({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,_)+u+w,y:l+i/2},S),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,a=s.data,o=s.className,l=s.children,i=s.x,u=s.y,p=s.width,x=s.height,y=s.alwaysShowText,_=this.state,w=_.startX,S=_.endX,N=_.isTextActive,M=_.isSlideMoving,E=_.isTravellerMoving,A=_.isTravellerFocused;if(!a||!a.length||!Dn(i)||!Dn(u)||!Dn(p)||!Dn(x)||p<=0||x<=0)return null;var P=oi("recharts-brush",o),z=it.Children.count(l)===1,R=Oqt("userSelect","none");return it.createElement(So,{className:P,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:R},this.renderBackground(),z&&this.renderPanorama(),this.renderSlide(w,S),this.renderTravellerLayer(w,"startX"),this.renderTravellerLayer(S,"endX"),(N||M||E||A||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,o=s.y,l=s.width,i=s.height,u=s.stroke,p=Math.floor(o+i/2)-1;return it.createElement(it.Fragment,null,it.createElement("rect",{x:a,y:o,width:l,height:i,fill:u,stroke:"none"}),it.createElement("line",{x1:a+1,y1:p,x2:a+l-1,y2:p,fill:"none",stroke:"#fff"}),it.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 it.isValidElement(s)?o=it.cloneElement(s,a):Va(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,u=s.travellerWidth,p=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==a.prevData||p!==a.prevUpdateId)return Sde({prevData:o,prevTravellerWidth:u,prevUpdateId:p,prevX:i,prevWidth:l},o&&o.length?qqt({data:o,width:l,x:i,travellerWidth:u,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||i!==a.prevX||u!==a.prevTravellerWidth)){a.scale.range([i,i+l-u]);var _=a.scale.domain().map(function(w){return a.scale(w)});return{prevData:o,prevTravellerWidth:u,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 u=Math.floor((l+i)/2);s[u]>a?i=u:l=u}return a>=s[i]?i:l}}])}(I.PureComponent);Wh(WC,"displayName","Brush");Wh(WC,"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 Vqt=b0e;function Hqt(t,e){var n;return Vqt(t,function(s,a,o){return n=e(s,a,o),!n}),!!n}var Wqt=Hqt,Gqt=jBe,Kqt=Qg,Zqt=Wqt,Yqt=Ih,Xqt=Iae;function Qqt(t,e,n){var s=Yqt(t)?Gqt:Zqt;return n&&Xqt(t,e,n)&&(e=void 0),s(t,Kqt(e))}var Jqt=Qqt;const eVt=Wi(Jqt);var Fg=function(e,n){var s=e.alwaysShow,a=e.ifOverflow;return s&&(a="extendDomain"),a===n},A5e=HBe;function tVt(t,e,n){e=="__proto__"&&A5e?A5e(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var rVt=tVt,nVt=rVt,sVt=qBe,aVt=Qg;function iVt(t,e){var n={};return e=aVt(e),sVt(t,function(s,a,o){nVt(n,a,e(s,a,o))}),n}var oVt=iVt;const lVt=Wi(oVt);function cVt(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 SVt(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 CVt(t,e){var n=t.x,s=t.y,a=NVt(t,bVt),o="".concat(n),l=parseInt(o,10),i="".concat(s),u=parseInt(i,10),p="".concat(e.height||a.height),x=parseInt(p,10),y="".concat(e.width||a.width),_=parseInt(y,10);return uT(uT(uT(uT(uT({},e),a),l?{x:l}:{}),u?{y:u}:{}),{},{height:x,width:_,name:e.name,radius:e.radius})}function I5e(t){return it.createElement(T$e,qpe({shapeType:"rectangle",propTransformer:CVt,activeClassName:"recharts-active-bar"},t))}var MVt=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)||e5t(s);return o?e(s,a):(o||uk(),n)}},TVt=["value","background"],R$e;function GC(t){"@babel/helpers - typeof";return GC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},GC(t)}function AVt(t,e){if(t==null)return{};var n=EVt(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 EVt(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 mne(){return mne=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(pe)0&&Math.abs(ie)0&&(xe=Math.min((rt||0)-(ie[Te-1]||0),xe))}),Number.isFinite(xe)){var pe=xe/oe,se=N.layout==="vertical"?s.height:s.width;if(N.padding==="gap"&&(V=pe*se/2),N.padding==="no-gap"){var fe=Vu(e.barCategoryGap,pe*se),he=pe*se/2;V=he-fe-(he-fe)/se*fe}}}a==="xAxis"?K=[s.left+(P.left||0)+(V||0),s.left+s.width-(P.right||0)-(V||0)]:a==="yAxis"?K=u==="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,R&&(K=[K[1],K[0]]);var ye=n$e(N,o,_),Ce=ye.scale,Se=ye.realScaleType;Ce.domain(E).range(K),s$e(Ce);var Ne=a$e(Ce,im(im({},N),{},{realScaleType:Se}));a==="xAxis"?(ae=M==="top"&&!z||M==="bottom"&&z,W=s.left,J=y[U]-ae*N.height):a==="yAxis"&&(ae=M==="left"&&!z||M==="right"&&z,W=y[U]-ae*N.width,J=s.top);var be=im(im(im({},N),Ne),{},{realScaleType:Se,x:W,y:J,scale:Ce,width:a==="xAxis"?s.width:N.width,height:a==="yAxis"?s.height:N.height});return be.bandSize=ene(be,Ne),!N.hide&&a==="xAxis"?y[U]+=(ae?-1:1)*be.height:N.hide||(y[U]+=(ae?-1:1)*be.width),im(im({},w),{},Jae({},S,be))},{})},$$e=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)}},qVt=function(e){var n=e.x1,s=e.y1,a=e.x2,o=e.y2;return $$e({x:n,y:s},{x:a,y:o})},U$e=function(){function t(e){zVt(this,t),this.scale=e}return BVt(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 u=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+u}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)}}])}();Jae(U$e,"EPS",1e-4);var X0e=function(e){var n=Object.keys(e).reduce(function(s,a){return im(im({},s),{},Jae({},a,U$e.create(e[a])))},{});return im(im({},n),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return lVt(a,function(u,p){return n[p].apply(u,{bandAware:l,position:i})})},isInRange:function(a){return D$e(a,function(o,l){return n[l].isInRange(o)})}})};function VVt(t){return(t%180+180)%180}var HVt=function(e){var n=e.width,s=e.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=VVt(a),l=o*Math.PI/180,i=Math.atan(s/n),u=l>i&&l-1?a[o?e[l]:l]:void 0}}var YVt=ZVt,XVt=I$e;function QVt(t){var e=XVt(t),n=e%1;return e===e?n?e-n:e:0}var JVt=QVt,eHt=RBe,tHt=Qg,rHt=JVt,nHt=Math.max;function sHt(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var a=n==null?0:rHt(n);return a<0&&(a=nHt(s+a,0)),eHt(t,tHt(e),a)}var aHt=sHt,iHt=YVt,oHt=aHt,lHt=iHt(oHt),cHt=lHt;const dHt=Wi(cHt);var uHt=i3t(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("")}),Q0e=I.createContext(void 0),J0e=I.createContext(void 0),q$e=I.createContext(void 0),V$e=I.createContext({}),H$e=I.createContext(void 0),W$e=I.createContext(0),G$e=I.createContext(0),R5e=function(e){var n=e.state,s=n.xAxisMap,a=n.yAxisMap,o=n.offset,l=e.clipPathId,i=e.children,u=e.width,p=e.height,x=uHt(o);return it.createElement(Q0e.Provider,{value:s},it.createElement(J0e.Provider,{value:a},it.createElement(V$e.Provider,{value:o},it.createElement(q$e.Provider,{value:x},it.createElement(H$e.Provider,{value:l},it.createElement(W$e.Provider,{value:p},it.createElement(G$e.Provider,{value:u},i)))))))},hHt=function(){return I.useContext(H$e)},K$e=function(e){var n=I.useContext(Q0e);n==null&&uk();var s=n[e];return s==null&&uk(),s},fHt=function(){var e=I.useContext(Q0e);return J0(e)},pHt=function(){var e=I.useContext(J0e),n=dHt(e,function(s){return D$e(s.domain,Number.isFinite)});return n||J0(e)},Z$e=function(e){var n=I.useContext(J0e);n==null&&uk();var s=n[e];return s==null&&uk(),s},mHt=function(){var e=I.useContext(q$e);return e},gHt=function(){return I.useContext(V$e)},e1e=function(){return I.useContext(G$e)},t1e=function(){return I.useContext(W$e)};function KC(t){"@babel/helpers - typeof";return KC=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},KC(t)}function xHt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yHt(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 JHt(t,e){return rUe(t,e+1)}function eWt(t,e,n,s,a){for(var o=(s||[]).slice(),l=e.start,i=e.end,u=0,p=1,x=l,y=function(){var S=s==null?void 0:s[u];if(S===void 0)return{v:rUe(s,p)};var N=u,M,E=function(){return M===void 0&&(M=n(S,N)),M},A=S.coordinate,P=u===0||_ne(t,A,E,x,i);P||(u=0,x=l,p+=1),P&&(x=A+t*(E()/2+a),u+=p)},_;p<=o.length;)if(_=y(),_)return _.v;return[]}function uI(t){"@babel/helpers - typeof";return uI=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},uI(t)}function H5e(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 du(t){for(var e=1;e0?w.coordinate-M*t:w.coordinate})}else o[_]=w=du(du({},w),{},{tickCoord:w.coordinate});var E=_ne(t,w.tickCoord,N,i,u);E&&(u=w.tickCoord-t*(N()/2+a),o[_]=du(du({},w),{},{isShow:!0}))},x=l-1;x>=0;x--)p(x);return o}function aWt(t,e,n,s,a,o){var l=(s||[]).slice(),i=l.length,u=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=du(du({},x),{},{tickCoord:_>0?x.coordinate-_*t:x.coordinate});var w=_ne(t,x.tickCoord,function(){return y},u,p);w&&(p=x.tickCoord-t*(y/2+a),l[i-1]=du(du({},x),{},{isShow:!0}))}for(var S=o?i-1:i,N=function(A){var P=l[A],z,R=function(){return z===void 0&&(z=n(P,A)),z};if(A===0){var U=t*(P.coordinate-t*R()/2-u);l[A]=P=du(du({},P),{},{tickCoord:U<0?P.coordinate-U*t:P.coordinate})}else l[A]=P=du(du({},P),{},{tickCoord:P.coordinate});var V=_ne(t,P.tickCoord,R,u,p);V&&(u=P.tickCoord+t*(R()/2+a),l[A]=du(du({},P),{},{isShow:!0}))},M=0;M=2?qu(a[1].coordinate-a[0].coordinate):1,E=QHt(o,M,w);return u==="equidistantPreserveStart"?eWt(M,E,N,a,l):(u==="preserveStart"||u==="preserveStartEnd"?_=aWt(M,E,N,a,l,u==="preserveStartEnd"):_=sWt(M,E,N,a,l),_.filter(function(A){return A.isShow}))}var iWt=["viewBox"],oWt=["viewBox"],lWt=["ticks"];function XC(t){"@babel/helpers - typeof";return XC=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},XC(t)}function Q4(){return Q4=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 cWt(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 dWt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function G5e(t,e){for(var n=0;n0?u(this.props):u(w)),l<=0||i<=0||!S||!S.length?null:it.createElement(So,{className:oi("recharts-cartesian-axis",p),ref:function(M){s.layerReference=M}},o&&this.renderAxisLine(),this.renderTicks(S,this.state.fontSize,this.state.letterSpacing),xd.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,o){var l,i=oi(a.className,"recharts-cartesian-axis-tick-value");return it.isValidElement(s)?l=it.cloneElement(s,Vc(Vc({},a),{},{className:i})):Va(s)?l=s(Vc(Vc({},a),{},{className:i})):l=it.createElement(ck,Q4({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(I.Component);a1e(z3,"displayName","CartesianAxis");a1e(z3,"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 xWt=["x1","y1","x2","y2","key"],yWt=["offset"];function hk(t){"@babel/helpers - typeof";return hk=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},hk(t)}function K5e(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 hu(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function wWt(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 jWt=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,u=e.ry;return it.createElement("rect",{x:a,y:o,ry:u,width:l,height:i,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function aUe(t,e){var n;if(it.isValidElement(t))n=it.cloneElement(t,e);else if(Va(t))n=t(e);else{var s=e.x1,a=e.y1,o=e.x2,l=e.y2,i=e.key,u=Z5e(e,xWt),p=Oa(u,!1);p.offset;var x=Z5e(p,yWt);n=it.createElement("line",sj({},x,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:i}))}return n}function kWt(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,u){var p=hu(hu({},t),{},{x1:e,y1:i,x2:e+n,y2:i,key:"line-".concat(u),index:u});return aUe(a,p)});return it.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function NWt(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,u){var p=hu(hu({},t),{},{x1:i,y1:e,x2:i,y2:e+n,key:"line-".concat(u),index:u});return aUe(a,p)});return it.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function SWt(t){var e=t.horizontalFill,n=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,i=t.horizontalPoints,u=t.horizontal,p=u===void 0?!0:u;if(!p||!e||!e.length)return null;var x=i.map(function(_){return Math.round(_+a-a)}).sort(function(_,w){return _-w});a!==x[0]&&x.unshift(0);var y=x.map(function(_,w){var S=!x[w+1],N=S?a+l-_:x[w+1]-_;if(N<=0)return null;var M=w%e.length;return it.createElement("rect",{key:"react-".concat(w),y:_,x:s,height:N,width:o,stroke:"none",fill:e[M],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return it.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function CWt(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,u=t.height,p=t.verticalPoints;if(!n||!s||!s.length)return null;var x=p.map(function(_){return Math.round(_+o-o)}).sort(function(_,w){return _-w});o!==x[0]&&x.unshift(0);var y=x.map(function(_,w){var S=!x[w+1],N=S?o+i-_:x[w+1]-_;if(N<=0)return null;var M=w%s.length;return it.createElement("rect",{key:"react-".concat(w),x:_,y:l,width:N,height:u,stroke:"none",fill:s[M],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return it.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var MWt=function(e,n){var s=e.xAxis,a=e.width,o=e.height,l=e.offset;return r$e(s1e(hu(hu(hu({},z3.defaultProps),s),{},{ticks:Zx(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},TWt=function(e,n){var s=e.yAxis,a=e.width,o=e.height,l=e.offset;return r$e(s1e(hu(hu(hu({},z3.defaultProps),s),{},{ticks:Zx(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,n)},S4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function iUe(t){var e,n,s,a,o,l,i=e1e(),u=t1e(),p=gHt(),x=hu(hu({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:S4.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:S4.fill,horizontal:(s=t.horizontal)!==null&&s!==void 0?s:S4.horizontal,horizontalFill:(a=t.horizontalFill)!==null&&a!==void 0?a:S4.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:S4.vertical,verticalFill:(l=t.verticalFill)!==null&&l!==void 0?l:S4.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,w=x.width,S=x.height,N=x.syncWithTicks,M=x.horizontalValues,E=x.verticalValues,A=fHt(),P=pHt();if(!Dn(w)||w<=0||!Dn(S)||S<=0||!Dn(y)||y!==+y||!Dn(_)||_!==+_)return null;var z=x.verticalCoordinatesGenerator||MWt,R=x.horizontalCoordinatesGenerator||TWt,U=x.horizontalPoints,V=x.verticalPoints;if((!U||!U.length)&&Va(R)){var K=M&&M.length,W=R({yAxis:P?hu(hu({},P),{},{ticks:K?M:P.ticks}):void 0,width:i,height:u,offset:p},K?!0:N);Sm(Array.isArray(W),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(hk(W),"]")),Array.isArray(W)&&(U=W)}if((!V||!V.length)&&Va(z)){var J=E&&E.length,ae=z({xAxis:A?hu(hu({},A),{},{ticks:J?E:A.ticks}):void 0,width:i,height:u,offset:p},J?!0:N);Sm(Array.isArray(ae),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(hk(ae),"]")),Array.isArray(ae)&&(V=ae)}return it.createElement("g",{className:"recharts-cartesian-grid"},it.createElement(jWt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),it.createElement(kWt,sj({},x,{offset:p,horizontalPoints:U,xAxis:A,yAxis:P})),it.createElement(NWt,sj({},x,{offset:p,verticalPoints:V,xAxis:A,yAxis:P})),it.createElement(SWt,sj({},x,{horizontalPoints:U})),it.createElement(CWt,sj({},x,{verticalPoints:V})))}iUe.displayName="CartesianGrid";function QC(t){"@babel/helpers - typeof";return QC=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},QC(t)}function AWt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function EWt(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 xGt(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 yGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vGt(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 _Ue(t){return t==="number"?[0,"auto"]:void 0}var ime=function(e,n,s,a){var o=e.graphicalItems,l=e.tooltipAxis,i=iie(n,e);return s<0||!o||!o.length||s>=i.length?null:o.reduce(function(u,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 w=y===void 0?i:y;_=Pfe(w,l.dataKey,a)}else _=y&&y[s]||i[s];return _?[].concat(t3(u),[o$e(p,_)]):u},[])},tMe=function(e,n,s,a){var o=a||{x:e.chartX,y:e.chartY},l=EGt(o,s),i=e.orderedTooltipTicks,u=e.tooltipAxis,p=e.tooltipTicks,x=h7t(l,i,p,u);if(x>=0&&p){var y=p[x]&&p[x].value,_=ime(e,n,x,y),w=IGt(s,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:_,activeCoordinate:w}}return null},PGt=function(e,n){var s=n.axes,a=n.graphicalItems,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,u=n.dataStartIndex,p=n.dataEndIndex,x=e.layout,y=e.children,_=e.stackOffset,w=t$e(x,o);return s.reduce(function(S,N){var M,E=N.type.defaultProps!==void 0?Zr(Zr({},N.type.defaultProps),N.props):N.props,A=E.type,P=E.dataKey,z=E.allowDataOverflow,R=E.allowDuplicatedCategory,U=E.scale,V=E.ticks,K=E.includeHidden,W=E[l];if(S[W])return S;var J=iie(e.data,{graphicalItems:a.filter(function(Ne){var be,rt=l in Ne.props?Ne.props[l]:(be=Ne.type.defaultProps)===null||be===void 0?void 0:be[l];return rt===W}),dataStartIndex:u,dataEndIndex:p}),ae=J.length,oe,xe,ie;aGt(E.domain,z,A)&&(oe=bpe(E.domain,null,z),w&&(A==="number"||U!=="auto")&&(ie=RA(J,P,"category")));var pe=_Ue(A);if(!oe||oe.length===0){var se,fe=(se=E.domain)!==null&&se!==void 0?se:pe;if(P){if(oe=RA(J,P,A),A==="category"&&w){var he=r5t(oe);R&&he?(xe=oe,oe=hne(0,ae)):R||(oe=S3e(fe,oe,N).reduce(function(Ne,be){return Ne.indexOf(be)>=0?Ne:[].concat(t3(Ne),[be])},[]))}else if(A==="category")R?oe=oe.filter(function(Ne){return Ne!==""&&!wi(Ne)}):oe=S3e(fe,oe,N).reduce(function(Ne,be){return Ne.indexOf(be)>=0||be===""||wi(be)?Ne:[].concat(t3(Ne),[be])},[]);else if(A==="number"){var ye=x7t(J,a.filter(function(Ne){var be,rt,Te=l in Ne.props?Ne.props[l]:(be=Ne.type.defaultProps)===null||be===void 0?void 0:be[l],Pe="hide"in Ne.props?Ne.props.hide:(rt=Ne.type.defaultProps)===null||rt===void 0?void 0:rt.hide;return Te===W&&(K||!Pe)}),P,o,x);ye&&(oe=ye)}w&&(A==="number"||U!=="auto")&&(ie=RA(J,P,"category"))}else w?oe=hne(0,ae):i&&i[W]&&i[W].hasStack&&A==="number"?oe=_==="expand"?[0,1]:i$e(i[W].stackGroups,u,p):oe=e$e(J,a.filter(function(Ne){var be=l in Ne.props?Ne.props[l]:Ne.type.defaultProps[l],rt="hide"in Ne.props?Ne.props.hide:Ne.type.defaultProps.hide;return be===W&&(K||!rt)}),A,x,!0);if(A==="number")oe=nme(y,oe,W,o,V),fe&&(oe=bpe(fe,oe,z));else if(A==="category"&&fe){var Ce=fe,Se=oe.every(function(Ne){return Ce.indexOf(Ne)>=0});Se&&(oe=Ce)}}return Zr(Zr({},S),{},ja({},W,Zr(Zr({},E),{},{axisType:o,domain:oe,categoricalDomain:ie,duplicateDomain:xe,originalDomain:(M=E.domain)!==null&&M!==void 0?M:pe,isCategorical:w,layout:x})))},{})},LGt=function(e,n){var s=n.graphicalItems,a=n.Axis,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,u=n.dataStartIndex,p=n.dataEndIndex,x=e.layout,y=e.children,_=iie(e.data,{graphicalItems:s,dataStartIndex:u,dataEndIndex:p}),w=_.length,S=t$e(x,o),N=-1;return s.reduce(function(M,E){var A=E.type.defaultProps!==void 0?Zr(Zr({},E.type.defaultProps),E.props):E.props,P=A[l],z=_Ue("number");if(!M[P]){N++;var R;return S?R=hne(0,w):i&&i[P]&&i[P].hasStack?(R=i$e(i[P].stackGroups,u,p),R=nme(y,R,P,o)):(R=bpe(z,e$e(_,s.filter(function(U){var V,K,W=l in U.props?U.props[l]:(V=U.type.defaultProps)===null||V===void 0?void 0:V[l],J="hide"in U.props?U.props.hide:(K=U.type.defaultProps)===null||K===void 0?void 0:K.hide;return W===P&&!J}),"number",x),a.defaultProps.allowDataOverflow),R=nme(y,R,P,o)),Zr(Zr({},M),{},ja({},P,Zr(Zr({axisType:o},a.defaultProps),{},{hide:!0,orientation:mf(TGt,"".concat(o,".").concat(N%2),null),domain:R,originalDomain:z,isCategorical:S,layout:x})))}return M},{})},OGt=function(e,n){var s=n.axisType,a=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,i=n.stackGroups,u=n.dataStartIndex,p=n.dataEndIndex,x=e.children,y="".concat(a,"Id"),_=cp(x,o),w={};return _&&_.length?w=PGt(e,{axes:_,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:p}):l&&l.length&&(w=LGt(e,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:p})),w},DGt=function(e){var n=J0(e),s=Zx(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:w0e(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:ene(n,s)}},rMe=function(e){var n=e.children,s=e.defaultShowTooltip,a=Zh(n,WC),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}},RGt=function(e){return!e||!e.length?!1:e.some(function(n){var s=cy(n&&n.type);return s&&s.indexOf("Bar")>=0})},nMe=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"}},FGt=function(e,n){var s=e.props,a=e.graphicalItems,o=e.xAxisMap,l=o===void 0?{}:o,i=e.yAxisMap,u=i===void 0?{}:i,p=s.width,x=s.height,y=s.children,_=s.margin||{},w=Zh(y,WC),S=Zh(y,HS),N=Object.keys(u).reduce(function(R,U){var V=u[U],K=V.orientation;return!V.mirror&&!V.hide?Zr(Zr({},R),{},ja({},K,R[K]+V.width)):R},{left:_.left||0,right:_.right||0}),M=Object.keys(l).reduce(function(R,U){var V=l[U],K=V.orientation;return!V.mirror&&!V.hide?Zr(Zr({},R),{},ja({},K,mf(R,"".concat(K))+V.height)):R},{top:_.top||0,bottom:_.bottom||0}),E=Zr(Zr({},M),N),A=E.bottom;w&&(E.bottom+=w.props.height||WC.defaultProps.height),S&&n&&(E=m7t(E,a,s,n));var P=p-E.left-E.right,z=x-E.top-E.bottom;return Zr(Zr({brushBottom:A},E),{},{width:Math.max(P,0),height:Math.max(z,0)})},zGt=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},bUe=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,u=e.axisComponents,p=e.legendContent,x=e.formatAxisMap,y=e.defaultProps,_=function(E,A){var P=A.graphicalItems,z=A.stackGroups,R=A.offset,U=A.updateId,V=A.dataStartIndex,K=A.dataEndIndex,W=E.barSize,J=E.layout,ae=E.barGap,oe=E.barCategoryGap,xe=E.maxBarSize,ie=nMe(J),pe=ie.numericAxisName,se=ie.cateAxisName,fe=RGt(P),he=[];return P.forEach(function(ye,Ce){var Se=iie(E.data,{graphicalItems:[ye],dataStartIndex:V,dataEndIndex:K}),Ne=ye.type.defaultProps!==void 0?Zr(Zr({},ye.type.defaultProps),ye.props):ye.props,be=Ne.dataKey,rt=Ne.maxBarSize,Te=Ne["".concat(pe,"Id")],Pe=Ne["".concat(se,"Id")],Ue={},Re=u.reduce(function(Ee,Je){var at=A["".concat(Je.axisType,"Map")],pt=Ne["".concat(Je.axisType,"Id")];at&&at[pt]||Je.axisType==="zAxis"||uk();var gt=at[pt];return Zr(Zr({},Ee),{},ja(ja({},Je.axisType,gt),"".concat(Je.axisType,"Ticks"),Zx(gt)))},Ue),Be=Re[se],Ye=Re["".concat(se,"Ticks")],ht=z&&z[Te]&&z[Te].hasStack&&S7t(ye,z[Te].stackGroups),Me=cy(ye.type).indexOf("Bar")>=0,Qe=ene(Be,Ye),le=[],Ve=fe&&f7t({barSize:W,stackGroups:z,totalSize:zGt(Re,se)});if(Me){var Le,We,_e=wi(rt)?xe:rt,st=(Le=(We=ene(Be,Ye,!0))!==null&&We!==void 0?We:_e)!==null&&Le!==void 0?Le:0;le=p7t({barGap:ae,barCategoryGap:oe,bandSize:st!==Qe?st:Qe,sizeList:Ve[Pe],maxBarSize:_e}),st!==Qe&&(le=le.map(function(Ee){return Zr(Zr({},Ee),{},{position:Zr(Zr({},Ee.position),{},{offset:Ee.position.offset-st/2})})}))}var ze=ye&&ye.type&&ye.type.getComposedData;ze&&he.push({props:Zr(Zr({},ze(Zr(Zr({},Re),{},{displayedData:Se,props:E,dataKey:be,item:ye,bandSize:Qe,barPosition:le,offset:R,stackedData:ht,layout:J,dataStartIndex:V,dataEndIndex:K}))),{},ja(ja(ja({key:ye.key||"item-".concat(Ce)},pe,Re[pe]),se,Re[se]),"animationId",U)),childIndex:p5t(ye,E.children),item:ye})}),he},w=function(E,A){var P=E.props,z=E.dataStartIndex,R=E.dataEndIndex,U=E.updateId;if(!_Se({props:P}))return null;var V=P.children,K=P.layout,W=P.stackOffset,J=P.data,ae=P.reverseStackOrder,oe=nMe(K),xe=oe.numericAxisName,ie=oe.cateAxisName,pe=cp(V,s),se=k7t(J,pe,"".concat(xe,"Id"),"".concat(ie,"Id"),W,ae),fe=u.reduce(function(Ne,be){var rt="".concat(be.axisType,"Map");return Zr(Zr({},Ne),{},ja({},rt,OGt(P,Zr(Zr({},be),{},{graphicalItems:pe,stackGroups:be.axisType===xe&&se,dataStartIndex:z,dataEndIndex:R}))))},{}),he=FGt(Zr(Zr({},fe),{},{props:P,graphicalItems:pe}),A==null?void 0:A.legendBBox);Object.keys(fe).forEach(function(Ne){fe[Ne]=x(P,fe[Ne],he,Ne.replace("Map",""),n)});var ye=fe["".concat(ie,"Map")],Ce=DGt(ye),Se=_(P,Zr(Zr({},fe),{},{dataStartIndex:z,dataEndIndex:R,updateId:U,graphicalItems:pe,stackGroups:se,offset:he}));return Zr(Zr({formattedGraphicalItems:Se,graphicalItems:pe,offset:he,stackGroups:se},Ce),fe)},S=function(M){function E(A){var P,z,R;return yGt(this,E),R=bGt(this,E,[A]),ja(R,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ja(R,"accessibilityManager",new sGt),ja(R,"handleLegendBBoxUpdate",function(U){if(U){var V=R.state,K=V.dataStartIndex,W=V.dataEndIndex,J=V.updateId;R.setState(Zr({legendBBox:U},w({props:R.props,dataStartIndex:K,dataEndIndex:W,updateId:J},Zr(Zr({},R.state),{},{legendBBox:U}))))}}),ja(R,"handleReceiveSyncEvent",function(U,V,K){if(R.props.syncId===U){if(K===R.eventEmitterSymbol&&typeof R.props.syncMethod!="function")return;R.applySyncEvent(V)}}),ja(R,"handleBrushChange",function(U){var V=U.startIndex,K=U.endIndex;if(V!==R.state.dataStartIndex||K!==R.state.dataEndIndex){var W=R.state.updateId;R.setState(function(){return Zr({dataStartIndex:V,dataEndIndex:K},w({props:R.props,dataStartIndex:V,dataEndIndex:K,updateId:W},R.state))}),R.triggerSyncEvent({dataStartIndex:V,dataEndIndex:K})}}),ja(R,"handleMouseEnter",function(U){var V=R.getMouseInfo(U);if(V){var K=Zr(Zr({},V),{},{isTooltipActive:!0});R.setState(K),R.triggerSyncEvent(K);var W=R.props.onMouseEnter;Va(W)&&W(K,U)}}),ja(R,"triggeredAfterMouseMove",function(U){var V=R.getMouseInfo(U),K=V?Zr(Zr({},V),{},{isTooltipActive:!0}):{isTooltipActive:!1};R.setState(K),R.triggerSyncEvent(K);var W=R.props.onMouseMove;Va(W)&&W(K,U)}),ja(R,"handleItemMouseEnter",function(U){R.setState(function(){return{isTooltipActive:!0,activeItem:U,activePayload:U.tooltipPayload,activeCoordinate:U.tooltipPosition||{x:U.cx,y:U.cy}}})}),ja(R,"handleItemMouseLeave",function(){R.setState(function(){return{isTooltipActive:!1}})}),ja(R,"handleMouseMove",function(U){U.persist(),R.throttleTriggeredAfterMouseMove(U)}),ja(R,"handleMouseLeave",function(U){R.throttleTriggeredAfterMouseMove.cancel();var V={isTooltipActive:!1};R.setState(V),R.triggerSyncEvent(V);var K=R.props.onMouseLeave;Va(K)&&K(V,U)}),ja(R,"handleOuterEvent",function(U){var V=f5t(U),K=mf(R.props,"".concat(V));if(V&&Va(K)){var W,J;/.*touch.*/i.test(V)?J=R.getMouseInfo(U.changedTouches[0]):J=R.getMouseInfo(U),K((W=J)!==null&&W!==void 0?W:{},U)}}),ja(R,"handleClick",function(U){var V=R.getMouseInfo(U);if(V){var K=Zr(Zr({},V),{},{isTooltipActive:!0});R.setState(K),R.triggerSyncEvent(K);var W=R.props.onClick;Va(W)&&W(K,U)}}),ja(R,"handleMouseDown",function(U){var V=R.props.onMouseDown;if(Va(V)){var K=R.getMouseInfo(U);V(K,U)}}),ja(R,"handleMouseUp",function(U){var V=R.props.onMouseUp;if(Va(V)){var K=R.getMouseInfo(U);V(K,U)}}),ja(R,"handleTouchMove",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&R.throttleTriggeredAfterMouseMove(U.changedTouches[0])}),ja(R,"handleTouchStart",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&R.handleMouseDown(U.changedTouches[0])}),ja(R,"handleTouchEnd",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&R.handleMouseUp(U.changedTouches[0])}),ja(R,"handleDoubleClick",function(U){var V=R.props.onDoubleClick;if(Va(V)){var K=R.getMouseInfo(U);V(K,U)}}),ja(R,"handleContextMenu",function(U){var V=R.props.onContextMenu;if(Va(V)){var K=R.getMouseInfo(U);V(K,U)}}),ja(R,"triggerSyncEvent",function(U){R.props.syncId!==void 0&&Mde.emit(Tde,R.props.syncId,U,R.eventEmitterSymbol)}),ja(R,"applySyncEvent",function(U){var V=R.props,K=V.layout,W=V.syncMethod,J=R.state.updateId,ae=U.dataStartIndex,oe=U.dataEndIndex;if(U.dataStartIndex!==void 0||U.dataEndIndex!==void 0)R.setState(Zr({dataStartIndex:ae,dataEndIndex:oe},w({props:R.props,dataStartIndex:ae,dataEndIndex:oe,updateId:J},R.state)));else if(U.activeTooltipIndex!==void 0){var xe=U.chartX,ie=U.chartY,pe=U.activeTooltipIndex,se=R.state,fe=se.offset,he=se.tooltipTicks;if(!fe)return;if(typeof W=="function")pe=W(he,U);else if(W==="value"){pe=-1;for(var ye=0;ye=0){var ht,Me;if(xe.dataKey&&!xe.allowDuplicatedCategory){var Qe=typeof xe.dataKey=="function"?Ye:"payload.".concat(xe.dataKey.toString());ht=Pfe(ye,Qe,pe),Me=Ce&&Se&&Pfe(Se,Qe,pe)}else ht=ye==null?void 0:ye[ie],Me=Ce&&Se&&Se[ie];if(Pe||Te){var le=U.props.activeIndex!==void 0?U.props.activeIndex:ie;return[I.cloneElement(U,Zr(Zr(Zr({},W.props),Re),{},{activeIndex:le})),null,null]}if(!wi(ht))return[Be].concat(t3(R.renderActivePoints({item:W,activePoint:ht,basePoint:Me,childIndex:ie,isRange:Ce})))}else{var Ve,Le=(Ve=R.getItemByXY(R.state.activeCoordinate))!==null&&Ve!==void 0?Ve:{graphicalItem:Be},We=Le.graphicalItem,_e=We.item,st=_e===void 0?U:_e,ze=We.childIndex,Ee=Zr(Zr(Zr({},W.props),Re),{},{activeIndex:ze});return[I.cloneElement(st,Ee),null,null]}return Ce?[Be,null,null]:[Be,null]}),ja(R,"renderCustomized",function(U,V,K){return I.cloneElement(U,Zr(Zr({key:"recharts-customized-".concat(K)},R.props),R.state))}),ja(R,"renderMap",{CartesianGrid:{handler:xO,once:!0},ReferenceArea:{handler:R.renderReferenceElement},ReferenceLine:{handler:xO},ReferenceDot:{handler:R.renderReferenceElement},XAxis:{handler:xO},YAxis:{handler:xO},Brush:{handler:R.renderBrush,once:!0},Bar:{handler:R.renderGraphicChild},Line:{handler:R.renderGraphicChild},Area:{handler:R.renderGraphicChild},Radar:{handler:R.renderGraphicChild},RadialBar:{handler:R.renderGraphicChild},Scatter:{handler:R.renderGraphicChild},Pie:{handler:R.renderGraphicChild},Funnel:{handler:R.renderGraphicChild},Tooltip:{handler:R.renderCursor,once:!0},PolarGrid:{handler:R.renderPolarGrid,once:!0},PolarAngleAxis:{handler:R.renderPolarAxis},PolarRadiusAxis:{handler:R.renderPolarAxis},Customized:{handler:R.renderCustomized}}),R.clipPathId="".concat((P=A.id)!==null&&P!==void 0?P:eP("recharts"),"-clip"),R.throttleTriggeredAfterMouseMove=XBe(R.triggeredAfterMouseMove,(z=A.throttleDelay)!==null&&z!==void 0?z:1e3/60),R.state={},R}return kGt(E,M),_Gt(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,R=P.data,U=P.height,V=P.layout,K=Zh(z,am);if(K){var W=K.props.defaultIndex;if(!(typeof W!="number"||W<0||W>this.state.tooltipTicks.length-1)){var J=this.state.tooltipTicks[W]&&this.state.tooltipTicks[W].value,ae=ime(this.state,R,W,J),oe=this.state.tooltipTicks[W].coordinate,xe=(this.state.offset.top+U)/2,ie=V==="horizontal",pe=ie?{x:oe,y:xe}:{y:oe,x:xe},se=this.state.formattedGraphicalItems.find(function(he){var ye=he.item;return ye.type.name==="Scatter"});se&&(pe=Zr(Zr({},pe),se.props.points[W].tooltipPosition),ae=se.props.points[W].tooltipPayload);var fe={activeTooltipIndex:W,isTooltipActive:!0,activeLabel:J,activePayload:ae,activeCoordinate:pe};this.setState(fe),this.renderCursor(K),this.accessibilityManager.setIndex(W)}}}},{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 R,U;this.accessibilityManager.setDetails({offset:{left:(R=this.props.margin.left)!==null&&R!==void 0?R:0,top:(U=this.props.margin.top)!==null&&U!==void 0?U:0}})}return null}},{key:"componentDidUpdate",value:function(P){Ofe([Zh(P.children,am)],[Zh(this.props.children,am)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var P=Zh(this.props.children,am);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,R=z.getBoundingClientRect(),U=B8t(R),V={chartX:Math.round(P.pageX-U.left),chartY:Math.round(P.pageY-U.top)},K=R.width/z.offsetWidth||1,W=this.inRange(V.chartX,V.chartY,K);if(!W)return null;var J=this.state,ae=J.xAxisMap,oe=J.yAxisMap,xe=this.getTooltipEventType(),ie=tMe(this.state,this.props.data,this.props.layout,W);if(xe!=="axis"&&ae&&oe){var pe=J0(ae).scale,se=J0(oe).scale,fe=pe&&pe.invert?pe.invert(V.chartX):null,he=se&&se.invert?se.invert(V.chartY):null;return Zr(Zr({},V),{},{xValue:fe,yValue:he},ie)}return ie?Zr(Zr({},V),ie):null}},{key:"inRange",value:function(P,z){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,U=this.props.layout,V=P/R,K=z/R;if(U==="horizontal"||U==="vertical"){var W=this.state.offset,J=V>=W.left&&V<=W.left+W.width&&K>=W.top&&K<=W.top+W.height;return J?{x:V,y:K}:null}var ae=this.state,oe=ae.angleAxisMap,xe=ae.radiusAxisMap;if(oe&&xe){var ie=J0(oe);return T3e({x:V,y:K},ie)}return null}},{key:"parseEventsOfWrapper",value:function(){var P=this.props.children,z=this.getTooltipEventType(),R=Zh(P,am),U={};R&&z==="axis"&&(R.props.trigger==="click"?U={onClick:this.handleClick}:U={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),U)}},{key:"addListener",value:function(){Mde.on(Tde,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Mde.removeListener(Tde,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(P,z,R){for(var U=this.state.formattedGraphicalItems,V=0,K=U.length;V");return t}const kUe=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(wUe.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(qGt,{id:i,config:s}),r.jsx(spe,{children:n})]})})});kUe.displayName="Chart";const qGt=({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(UGt).map(([s,a])=>` ${a} [data-chart=${t}] { ${n.map(([o,l])=>{var u;const i=((u=l.theme)==null?void 0:u[s])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},NUe=I.forwardRef(({active:t,payload:e,className:n,indicator:s="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:i,labelClassName:u,formatter:p,color:x,nameKey:y,labelKey:_},w)=>{const{config:S}=jUe(),N=I.useMemo(()=>{var R;if(a||!(e!=null&&e.length))return null;const[E]=e,A=`${_||E.dataKey||E.name||"value"}`,P=ome(S,E,A),z=!_&&typeof l=="string"?((R=S[l])==null?void 0:R.label)||l:P==null?void 0:P.label;return i?r.jsx("div",{className:zt("font-medium",u),children:i(z,e)}):z?r.jsx("div",{className:zt("font-medium",u),children:z}):null},[l,i,e,a,u,S,_]);if(!t||!(e!=null&&e.length))return null;const M=e.length===1&&s!=="dot";return r.jsxs("div",{ref:w,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:[M?null:N,r.jsx("div",{className:"grid gap-1.5",children:e.map((E,A)=>{const P=`${y||E.name||E.dataKey||"value"}`,z=ome(S,E,P),R=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,A,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":M&&s==="dashed"}),style:{"--color-bg":R,"--color-border":R}}),r.jsxs("div",{className:zt("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[M?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)})})]})});NUe.displayName="ChartTooltip";const VGt=I.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:s="bottom",nameKey:a},o)=>{const{config:l}=jUe();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 u=`${a||i.dataKey||"value"}`,p=ome(l,i,u);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});VGt.displayName="ChartLegend";function ome(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 yO=["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 SUe({stats:t,year:e}){const n=t.transactionsByMonth.some(a=>a.count>0),s=t.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(Ke,{children:r.jsx(et,{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(Ke,{className:"overflow-hidden",children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(et,{className:"overflow-hidden",children:r.jsx(kUe,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(spe,{width:"100%",height:"100%",children:r.jsxs(BGt,{data:t.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(iUe,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(sie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(aie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(am,{content:r.jsx(NUe,{})}),r.jsx(Nk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(et,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(spe,{width:"100%",height:"100%",children:r.jsxs($Gt,{children:[r.jsx(Ry,{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(Pae,{fill:yO[o%yO.length]},`cell-${o}`))}),r.jsx(am,{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:yO[o%yO.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function HGt(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=Lxe(e,s,new Date);if(Fhe(a))return mn(a,"yyyy-MM-dd")}catch{}try{const s=new Date(e);if(Fhe(s))return mn(s,"yyyy-MM-dd")}catch{}return null}const WGt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function GGt({open:t,onOpenChange:e}){const[n,s]=I.useState([]),[a,o]=I.useState(!1),[l,i]=I.useState(0),{data:u}=Rse(),{data:p}=Lm(),x=Fse(),y=()=>{const E=WGt.join(","),A=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),P=`${E} ${A}`,z=new Blob([P],{type:"text/csv"}),R=URL.createObjectURL(z),U=document.createElement("a");U.href=R,U.download="transaction-import-template.csv",U.click(),URL.revokeObjectURL(R)},_=E=>{const A=E.split(` `).filter(z=>z.trim());if(A.length<2)return[];const P=A[0].split(",").map(z=>z.trim().toLowerCase().replace(/['"]/g,""));return A.slice(1).map((z,R)=>{var fe,he,ye,Ce;const U=[];let V="",K=!1;for(const Se of z)Se==='"'?K=!K:Se===","&&!K?(U.push(V.trim()),V=""):V+=Se;U.push(V.trim());const W=Se=>{var be;const Ne=P.indexOf(Se);return Ne>=0?(be=U[Ne])==null?void 0:be.replace(/^["']|["']$/g,"").trim():""},J=(fe=W("transaction_type"))==null?void 0:fe.toLowerCase(),ae=(he=W("sale_price"))==null?void 0:he.replace(/[$,]/g,""),oe=(ye=W("commission_amount"))==null?void 0:ye.replace(/[$,]/g,""),xe=(Ce=W("is_win"))==null?void 0:Ce.toLowerCase(),ie=W("close_date"),pe=HGt(ie);let se;return W("property_address")?["buyer","seller"].includes(J)?pe?(!ae||isNaN(Number(ae)))&&(se="Invalid sale price"):se=`Invalid date format: "${ie}" - use MM/DD/YYYY or YYYY-MM-DD`:se='Transaction type must be "buyer" or "seller"':se="Missing property address",{property_address:W("property_address"),city:W("city"),state:W("state"),zip:W("zip"),transaction_type:J==="seller"?"seller":"buyer",close_date:pe||"",sale_price:Number(ae)||0,commission_amount:oe?Number(oe):null,lead_source_name:W("lead_source"),client_type_name:W("client_type"),is_win:["yes","true","1"].includes(xe),notes:W("notes"),error:se}})},w=E=>{var z;const A=(z=E.target.files)==null?void 0:z[0];if(!A)return;const P=new FileReader;P.onload=R=>{var K;const U=(K=R.target)==null?void 0:K.result,V=_(U);s(V)},P.readAsText(A)},S=async()=>{const E=n.filter(z=>!z.error);if(E.length===0){Oe.error("No valid transactions to import");return}o(!0),i(0);let A=0,P=0;for(let z=0;zK.name.toLowerCase()===R.lead_source_name.toLowerCase()),V=p==null?void 0:p.find(K=>K.name.toLowerCase()===R.client_type_name.toLowerCase());await x.mutateAsync({property_address:R.property_address,city:R.city||null,state:R.state||null,zip:R.zip||null,transaction_type:R.transaction_type,close_date:R.close_date,sale_price:R.sale_price,commission_amount:R.commission_amount,lead_source_id:(U==null?void 0:U.id)||null,client_type_id:(V==null?void 0:V.id)||null,contact_id:null,notes:R.notes||null,is_win:R.is_win}),A++}catch(U){P++,console.error("Failed to import transaction:",U)}i(Math.round((z+1)/E.length*100))}o(!1),A>0&&Oe.success(`Imported ${A} transaction${A>1?"s":""}`),P>0&&Oe.error(`Failed to import ${P} transaction${P>1?"s":""}`),s([]),e(!1)},N=n.filter(E=>!E.error).length,M=n.filter(E=>E.error).length;return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Import Transactions"}),r.jsx(Jn,{children:"Upload a CSV file with your past transactions"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Download Template"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),r.jsxs(te,{variant:"outline",onClick:y,children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(ot,{id:"csv-file",type:"file",accept:".csv",onChange:w})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Lt,{variant:"outline",children:[n.length," rows found"]}),N>0&&r.jsxs(Lt,{className:"bg-green-500 text-white",children:[r.jsx(_i,{className:"h-3 w-3 mr-1"}),N," valid"]}),M>0&&r.jsxs(Lt,{variant:"destructive",children:[r.jsx(pl,{className:"h-3 w-3 mr-1"}),M," errors"]})]}),r.jsx(Ro,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((E,A)=>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(Lt,{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(Hye,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(Wye,{className:"text-xs",children:E.error})})]},A)),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(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{onClick:S,disabled:N===0||a,children:[r.jsx(ho,{className:"h-4 w-4 mr-2"}),"Import ",N," Transaction",N!==1?"s":""]})]})]})]})})}const KGt=b3({transactions_goal:bA().min(0).optional(),volume_goal:bA().min(0).optional(),gci_goal:bA().min(0).optional()});function ZGt({open:t,onOpenChange:e,year:n,existingGoals:s}){const a=dmt(),{data:o}=zse(),l=(o==null?void 0:o.show_commission)??!0,i=Nse({resolver:Sse(KGt),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 u=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(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-md",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:[n," Goals"]}),r.jsx(Jn,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(Cse,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(u),className:"space-y-4",children:[r.jsx(El,{control:i.control,name:"transactions_goal",render:({field:p})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Transactions Goal"}),r.jsx(Nl,{children:r.jsx(ot,{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(_ee,{children:"Total number of deals you want to close"}),r.jsx($u,{})]})}),r.jsx(El,{control:i.control,name:"volume_goal",render:({field:p})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"Volume Goal ($)"}),r.jsx(Nl,{children:r.jsx(ot,{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(_ee,{children:"Total sales volume you want to achieve"}),r.jsx($u,{})]})}),l&&r.jsx(El,{control:i.control,name:"gci_goal",render:({field:p})=>r.jsxs(jl,{children:[r.jsx(kl,{children:"GCI Goal ($)"}),r.jsx(Nl,{children:r.jsx(ot,{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(_ee,{children:"Gross commission income target"}),r.jsx($u,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}function CUe({transactions:t,isLoading:e}){const n=I.useRef(null),s=I.useRef(null),a=I.useRef([]),o=I.useRef(null),{isAdmin:l}=Qr(),[i,u]=I.useState(""),[p,x]=I.useState(!0),[y,_]=I.useState(0),[w,S]=I.useState(!1),N=t.filter(E=>E.latitude!=null&&E.longitude!=null),M=t.filter(E=>E.latitude==null||E.longitude==null);return I.useEffect(()=>{(async()=>{x(!0);try{const{data:A}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();A!=null&&A.value&&u(A.value)}catch(A){console.error("Error fetching mapbox token:",A)}x(!1)})()},[]),I.useEffect(()=>{if(!i||M.length===0||w)return;(async()=>{var P;S(!0);let A=0;for(const z of M){const R=[z.property_address,z.city,z.state,z.zip].filter(Boolean).join(", ");if(R)try{const V=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(R)}.json?access_token=${i}&limit=1`)).json();if((P=V.features)!=null&&P[0]){const[K,W]=V.features[0].center;await Q.from("scorecard_transactions").update({latitude:W,longitude:K}).eq("id",z.id),z.latitude=W,z.longitude=K,A++}}catch(U){console.error("Geocode error:",U)}}_(A),S(!1)})()},[i,t]),I.useEffect(()=>{if(!n.current||!i||s.current)return;tc.accessToken=i;const E=t.filter(z=>z.latitude!=null&&z.longitude!=null);let A=[-98.5795,39.8283],P=4;if(E.length>0){const z=E.reduce((U,V)=>U+V.longitude,0)/E.length,R=E.reduce((U,V)=>U+V.latitude,0)/E.length;A=[z,R],P=E.length===1?12:10}return s.current=new tc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:P,center:A}),s.current.addControl(new tc.NavigationControl,"top-right"),()=>{var z;(z=s.current)==null||z.remove(),s.current=null}},[i]),I.useEffect(()=>{var A;if(!s.current||!i)return;a.current.forEach(P=>P.remove()),a.current=[],(A=o.current)==null||A.remove();const E=t.filter(P=>P.latitude!=null&&P.longitude!=null);if(E.forEach(P=>{var W;const z=P.transaction_type==="buyer",R=z?"#3B82F6":"#10B981",U=document.createElement("div");U.className="cursor-pointer",U.innerHTML=`
${z?'':''}
`;const V=new tc.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"})} ${(W=P.lead_source)!=null&&W.name?" · "+P.lead_source.name:""}
${P.contact?`
Client: ${P.contact.first_name} ${P.contact.last_name||""}
`:""}
`),K=new tc.Marker(U).setLngLat([P.longitude,P.latitude]).setPopup(V).addTo(s.current);a.current.push(K)}),E.length>1){const P=new tc.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,w]),p||e?r.jsx(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(To,{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",w&&" · Geocoding..."]})]}),r.jsx("div",{ref:n,className:"w-full h-[55vh] rounded-lg shadow-lg border"})]}):r.jsx(Ke,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(pl,{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 MUe=new Date().getFullYear(),YGt=Array.from({length:10},(t,e)=>MUe-e);function XGt(){var R;const[t,e]=I.useState(MUe),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(!1),[u,p]=I.useState(!1),{data:x,isLoading:y}=Wxe(t),{yearStats:_,lifetimeStats:w,showCommission:S}=bDe(t),{data:N,isLoading:M}=_De(t),{data:E}=zse(),A=umt(),P=()=>{if(!x||x.length===0)return;const U=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...S?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],V=x.map(oe=>{var xe,ie;return[oe.property_address,oe.city||"",oe.state||"",oe.zip||"",oe.transaction_type,oe.close_date,oe.sale_price,...S?[oe.commission_amount||""]:[],((xe=oe.lead_source)==null?void 0:xe.name)||"",((ie=oe.client_type)==null?void 0:ie.name)||"",oe.contact?`${oe.contact.first_name} ${oe.contact.last_name||""}`.trim():"",oe.is_win?"Yes":"No",oe.notes||""]}),K=[U,...V].map(oe=>oe.map(xe=>`"${String(xe).replace(/"/g,'""')}"`).join(",")).join(` `),W=new Blob([K],{type:"text/csv"}),J=URL.createObjectURL(W),ae=document.createElement("a");ae.href=J,ae.download=`transactions-${t}.csv`,ae.click(),URL.revokeObjectURL(J)},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(xn,{value:String(t),onValueChange:U=>e(Number(U)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(vn,{})}),r.jsx(pn,{children:YGt.map(U=>r.jsx(qt,{value:String(U),children:U},U))})]}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>p(!u),children:r.jsx(jd,{className:"h-4 w-4"})})]})]}),u&&r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsx(Zt,{className:"text-lg",children:"Settings"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(qe,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Ss,{checked:(E==null?void 0:E.show_commission)??!0,onCheckedChange:U=>A.mutate({show_commission:U})})]})})]}),z&&!y?r.jsx(Ke,{className:"py-12",children:r.jsxs(et,{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(gc,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mt-1",children:"Add your past transactions to see your performance metrics, track your goals, and celebrate your wins."})]}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(te,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(ho,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),r.jsxs("div",{className:"pt-4 border-t mt-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),r.jsx(te,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(te,{variant:"outline",onClick:()=>i(!0),children:[r.jsx(sy,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(te,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(ho,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(te,{variant:"outline",onClick:P,disabled:z,children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(ao,{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(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ua,{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:[w.totalTransactions," lifetime"]})]})}),r.jsx(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(wd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ud(_.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ud(w.totalVolume,!0)," lifetime"]})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ap,{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:Ud(_.averagePrice,!0)})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Rl,{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:((R=_.topLeadSource)==null?void 0:R.name)||"-"}),_.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[_.topLeadSource.count," deals"]})]})}),S&&r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(wd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ud(_.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ud(w.totalCommission,!0)," lifetime"]})]})})]}),N&&r.jsx(D7e,{goals:N,stats:_,year:t,showCommission:S}),r.jsxs(ki,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"transactions",children:"Transactions"}),r.jsx(rn,{value:"charts",children:"Charts"}),r.jsxs(rn,{value:"map",children:[r.jsx(To,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Sn,{value:"transactions",children:r.jsx(O7e,{transactions:x||[],showCommission:S,isLoading:y})}),r.jsx(Sn,{value:"charts",children:r.jsx(SUe,{stats:_,year:t})}),r.jsx(Sn,{value:"map",children:r.jsx(CUe,{transactions:x||[],isLoading:y})})]})]})]}),r.jsx(L7e,{open:n,onOpenChange:s}),r.jsx(GGt,{open:a,onOpenChange:o}),r.jsx(ZGt,{open:l,onOpenChange:i,year:t,existingGoals:N})]})}function TUe({open:t,onOpenChange:e,listingId:n,listingSlug:s,listingTitle:a}){const{user:o}=Qr(),[l,i]=I.useState(null),[u,p]=I.useState(!1),[x,y]=I.useState(!1);I.useEffect(()=>{(async()=>{if(!(!t||!o)){p(!0);try{const{data:M,error:E}=await Q.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(M&&M.share_token)i(M);else if(M&&!M.share_token){const{data:A,error:P}=await Q.from("listing_shares").update({share_type:"referral_link"}).eq("id",M.id).select("id, share_token, click_count, lead_count").single();if(P)throw P;i(A)}else{const{data:A,error:P}=await Q.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(A)}}catch(M){console.error("Error creating share link:",M),Oe.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}`:"",w=async()=>{try{await navigator.clipboard.writeText(_),y(!0),Oe.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{Oe.error("Failed to copy link")}},S=N=>{const M=encodeURIComponent(_),E=encodeURIComponent(`Check out this listing: ${a}`);switch(N){case"email":window.open(`mailto:?subject=${E}&body=${M}`);break;case"text":window.open(`sms:?body=${E}%20${M}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${M}`,"_blank");break}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(As,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Jn,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:r.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[r.jsx("strong",{children:"How it works:"})," The listing still shows the original agent's info, but any leads from your unique link go directly to you!"]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:u?"Generating...":_,readOnly:!0,className:"font-mono text-sm"}),r.jsx(te,{onClick:w,disabled:u||!_,variant:x?"default":"outline",children:x?r.jsx(_i,{className:"h-4 w-4"}):r.jsx(tl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>S("email"),disabled:u,children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>S("text"),disabled:u,children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>S("facebook"),disabled:u,children:[r.jsx(Jd,{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(qe,{className:"mb-2 block",children:"Your Share Performance"}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[r.jsx($o,{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 QGt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},JGt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},eKt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function vO({listing:t,onClick:e,onEdit:n,onDelete:s,showActions:a}){var N,M;const{user:o}=Qr(),{data:l}=pDe(t.id),i=fDe(),[u,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))||((M=t.photos)==null?void 0:M[0]),_=(o==null?void 0:o.id)===t.agent_id,w=async E=>{E.stopPropagation();try{const A=await i.mutateAsync(t.id);Oe.success(A.saved?"Listing saved!":"Listing removed from saved")}catch{Oe.error("Failed to save listing")}},S=E=>{if(E.stopPropagation(),o)p(!0);else{const A=`https://listings.relevelup.com/${t.slug||t.id}`;navigator.clipboard.writeText(A),Oe.success("Link copied to clipboard!")}};return r.jsxs(Ke,{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(Ag,{className:"h-12 w-12"})}),r.jsx(Lt,{className:`absolute top-2 left-2 ${QGt[t.status]} text-white border-0`,children:JGt[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(_s,{className:"h-4 w-4 text-white fill-white"})}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(te,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:w,children:r.jsx(fi,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(te,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:S,title:_?"Copy link":"Share & earn leads",children:_?r.jsx(_c,{className:"h-4 w-4"}):r.jsx(As,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(TUe,{open:u,onOpenChange:p,listingId:t.id,listingSlug:t.slug||null,listingTitle:t.property_address||`${t.city}, ${t.state}`}),r.jsxs(et,{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(Lt,{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(To,{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(M1,{className:"h-4 w-4"}),t.bedrooms," bd"]}),t.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(C1,{className:"h-4 w-4"}),t.bathrooms," ba"]}),t.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ag,{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(Lt,{variant:"secondary",className:"text-xs",children:eKt[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($o,{className:"h-3 w-3"}),t.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(_c,{className:"h-3 w-3"}),t.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),t.save_count]})]}),a&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(te,{variant:"outline",size:"sm",className:"flex-1",onClick:E=>{E.stopPropagation(),n()},children:[r.jsx(hc,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(te,{variant:"destructive",size:"sm",onClick:E=>{E.stopPropagation(),s()},children:r.jsx($n,{className:"h-4 w-4"})})]})]})]})}const tKt=[{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"}],rKt=[{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 nKt({filters:t,onFiltersChange:e,onClose:n}){const s=()=>{e({sortBy:"newest"})};return r.jsxs(Ke,{children:[r.jsxs(Ht,{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(te,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(gs,{className:"h-4 w-4"})})]})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Status"}),r.jsxs(xn,{value:t.status||"all",onValueChange:a=>e({...t,status:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"All statuses"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),tKt.map(a=>r.jsx(qt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Property Type"}),r.jsxs(xn,{value:t.propertyType||"all",onValueChange:a=>e({...t,propertyType:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"All types"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),rKt.map(a=>r.jsx(qt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Min Price"}),r.jsx(ot,{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(qe,{children:"Max Price"}),r.jsx(ot,{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(qe,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Ss,{checked:t.openToReferrals||!1,onCheckedChange:a=>e({...t,openToReferrals:a||void 0})})]})]})]})}function sKt({leaderboard:t}){const e=s=>{switch(s){case 0:return r.jsx(Yi,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(ry,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Rl,{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(Lt,{variant:l===0?"default":"secondary",children:[o.count," ",a]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(et,{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(_c,{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(ua,{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(ry,{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(Yi,{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(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Community Leaderboard"})}),r.jsx(et,{children:r.jsxs(ki,{defaultValue:"sharers",children:[r.jsxs(pi,{className:"w-full",children:[r.jsxs(rn,{value:"sharers",className:"flex-1",children:[r.jsx(_c,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(rn,{value:"listers",className:"flex-1",children:[r.jsx(ua,{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 sMe={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},aMe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function aKt(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function iKt({listings:t,isLoading:e}){const n=Gn(),s=I.useRef(null),a=I.useRef(null),o=I.useRef([]),{isAdmin:l}=Qr(),[i,u]=I.useState(""),[p,x]=I.useState(!0),[y,_]=I.useState(!1),w=t.filter(N=>N.latitude!=null&&N.longitude!=null),S=t.filter(N=>(N.latitude==null||N.longitude==null)&&(N.property_address||N.city));return I.useEffect(()=>{(async()=>{x(!0);try{const{data:M}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();M!=null&&M.value&&u(M.value)}catch(M){console.error("Error fetching mapbox token:",M)}x(!1)})()},[]),I.useEffect(()=>{if(!i||S.length===0||y)return;(async()=>{var M;_(!0);for(const E of S){const A=[E.property_address,E.city,E.state].filter(Boolean).join(", ");if(A)try{const z=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(A)}.json?access_token=${i}&limit=1`)).json();if((M=z.features)!=null&&M[0]){const[R,U]=z.features[0].center;await Q.from("listings").update({latitude:U,longitude:R}).eq("id",E.id),E.latitude=U,E.longitude=R}}catch(P){console.error("Geocode error:",P)}}_(!1)})()},[i,t]),I.useEffect(()=>{if(!s.current||!i||a.current)return;tc.accessToken=i;const N=t.filter(A=>A.latitude!=null&&A.longitude!=null);let M=[-98.5795,39.8283],E=4;if(N.length>0){const A=N.reduce((z,R)=>z+R.longitude,0)/N.length,P=N.reduce((z,R)=>z+R.latitude,0)/N.length;M=[A,P],E=N.length===1?12:10}return a.current=new tc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:E,center:M}),a.current.addControl(new tc.NavigationControl,"top-right"),()=>{var A;(A=a.current)==null||A.remove(),a.current=null}},[i]),I.useEffect(()=>{if(!a.current||!i)return;o.current.forEach(M=>M.remove()),o.current=[];const N=t.filter(M=>M.latitude!=null&&M.longitude!=null);if(N.forEach(M=>{var U,V,K;const E=sMe[M.status]||"#10B981",A=((U=M.photos)==null?void 0:U.find(W=>W.is_primary))||((V=M.photos)==null?void 0:V[0]),P=document.createElement("div");P.className="cursor-pointer",P.innerHTML=`
`;const z=new tc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${A!=null&&A.photo_url?``:""}
${aKt(M.price)}
${M.property_address||""}
${M.city}, ${M.state}
${aMe[M.status]||M.status} ${M.bedrooms?`${M.bedrooms} bed`:""} ${M.bathrooms?`${M.bathrooms} bath`:""}
${(K=M.agent)!=null&&K.name?`
Listed by ${M.agent.name}
`:""}
Click to view details →
`),R=new tc.Marker(P).setLngLat([M.longitude,M.latitude]).setPopup(z).addTo(a.current);o.current.push(R)}),N.length>1){const M=new tc.LngLatBounds;N.forEach(E=>M.extend([E.longitude,E.latitude])),a.current.fitBounds(M,{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(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(To,{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(sMe).map(([N,M])=>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:M}}),r.jsx("span",{className:"text-xs",children:aMe[N]})]},N)),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[w.length," of ",t.length," mapped",y&&" · Geocoding..."]})]}),r.jsx("div",{ref:s,className:"w-full h-[60vh] rounded-lg shadow-lg border"})]}):r.jsx(Ke,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(pl,{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 oKt(){var W,J,ae,oe,xe,ie,pe,se;const t=Gn(),{brokerageId:e}=Qr(),{data:n,isLoading:s}=lDe(),[a,o]=I.useState("feed"),[l,i]=I.useState(!1),[u,p]=I.useState(""),[x,y]=I.useState({sortBy:"newest"}),{data:_,isLoading:w}=cDe({...x,city:u||x.city}),{data:S,isLoading:N}=Gpt(),{data:M,isLoading:E}=dDe(),{data:A,isLoading:P}=Xpt(),{data:z,isLoading:R}=emt(),{data:U}=Jpt(),V=hDe(),K=async fe=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await V.mutateAsync(fe),Oe.success("Listing deleted successfully")}catch{Oe.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(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(_n,{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(Ke,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(ua,{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(Ke,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(fi,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(S==null?void 0:S.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(yj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(M==null?void 0:M.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(Ke,{children:r.jsxs(et,{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:(((W=A==null?void 0:A.sent)==null?void 0:W.length)||0)+(((J=A==null?void 0:A.received)==null?void 0:J.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(ki,{value:a,onValueChange:o,children:[r.jsxs(pi,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(rn,{value:"feed",children:"Community Feed"}),e&&r.jsx(rn,{value:"brokerage",children:"Brokerage"}),r.jsx(rn,{value:"my-listings",children:"My Listings"}),r.jsx(rn,{value:"saved",children:"Saved"}),r.jsx(rn,{value:"referrals",children:"Referrals"}),r.jsx(rn,{value:"map",children:"Map"}),r.jsx(rn,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by city or neighborhood...",value:u,onChange:fe=>p(fe.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:x.sortBy,onValueChange:fe=>y({...x,sortBy:fe}),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(vn,{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(te,{variant:"outline",onClick:()=>i(!l),children:[r.jsx(L1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(nKt,{filters:x,onFiltersChange:y,onClose:()=>i(!1)}),w?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((fe,he)=>r.jsxs(Ke,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(et,{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"})]})]},he))}):(_==null?void 0:_.length)===0?r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(ua,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),r.jsxs(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(_n,{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(fe=>r.jsx(vO,{listing:fe,onClick:()=>t(`/mission-control/listings/${fe.id}`)},fe.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((fe,he)=>r.jsxs(Ke,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(et,{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"})]})]},he))}):(M==null?void 0:M.length)===0?r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(yj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),r.jsxs(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(_n,{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:M==null?void 0:M.map(fe=>r.jsx(vO,{listing:fe,showActions:!0,onClick:()=>t(`/mission-control/listings/${fe.id}`),onEdit:()=>t(`/mission-control/listings/${fe.id}/edit`),onDelete:()=>K(fe.id)},fe.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((fe,he)=>r.jsxs(Ke,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(et,{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"})]})]},he))}):(S==null?void 0:S.length)===0?r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(fi,{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:S==null?void 0:S.map(fe=>r.jsx(vO,{listing:fe.listing,onClick:()=>t(`/mission-control/listings/${fe.listing.id}`)},fe.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(_c,{className:"h-4 w-4"}),"Referrals Sent (",((ae=A==null?void 0:A.sent)==null?void 0:ae.length)||0,")"]}),((oe=A==null?void 0:A.sent)==null?void 0:oe.length)===0?r.jsx(Ke,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(xe=A==null?void 0:A.sent)==null?void 0:xe.map(fe=>{var he,ye;return r.jsx(Ke,{children:r.jsx(et,{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:fe.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((he=fe.listing)==null?void 0:he.property_address)||((ye=fe.listing)==null?void 0:ye.city)})]}),r.jsx(Lt,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]})})},fe.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 (",((ie=A==null?void 0:A.received)==null?void 0:ie.length)||0,")"]}),((pe=A==null?void 0:A.received)==null?void 0:pe.length)===0?r.jsx(Ke,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(se=A==null?void 0:A.received)==null?void 0:se.map(fe=>{var he;return r.jsx(Ke,{children:r.jsxs(et,{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:fe.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(he=fe.sender)==null?void 0:he.name]})]}),r.jsx(Lt,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]}),r.jsx(te,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>t(`/mission-control/listings/${fe.listing_id}`),children:"View Listing"})]})},fe.id)})})]})]})}),e&&r.jsx(Sn,{value:"brokerage",className:"space-y-4",children:R?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,he)=>r.jsxs(Ke,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(et,{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"})]})]},he))}):(z==null?void 0:z.length)===0?r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(yj,{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(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(_n,{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(fe=>r.jsx(vO,{listing:fe,onClick:()=>t(`/mission-control/listings/${fe.id}`)},fe.id))})}),r.jsx(Sn,{value:"map",children:r.jsx(iKt,{listings:_||[],isLoading:w})}),r.jsx(Sn,{value:"leaderboard",children:r.jsx(sKt,{leaderboard:U})})]})]})}):r.jsx(Lr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(ua,{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 i1e(){const t=Bc();return Kt({queryKey:["deal-pipeline-stages",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.from("deal_pipeline_stages").select("*").eq("owner_user_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function AUe(){const t=Bc(),e=qr();return or({mutationFn:async()=>{if(!t)throw new Error("Not authenticated");const{error:n}=await Q.rpc("initialize_deal_pipeline_stages",{p_user_id:t});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function EUe(){const t=Bc();return Kt({queryKey:["deal-pipeline-deals",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.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 IUe(){const t=Bc(),e=qr();return or({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:a}=await Q.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 Q.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 PUe(){const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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 lKt(){const t=qr();return or({mutationFn:async({dealId:e,stageId:n,stageName:s})=>{const{data:a,error:o}=await Q.from("deal_pipeline").update({stage_id:n}).eq("id",e).select().single();if(o)throw o;return await Q.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 cKt(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.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 dKt(t){return Kt({queryKey:["deal-activities",t],queryFn:async()=>{const{data:e,error:n}=await Q.from("deal_activities").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function uKt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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 hKt(t){return Kt({queryKey:["deal-checklist",t],queryFn:async()=>{const{data:e,error:n}=await Q.from("deal_checklist_items").select("*").eq("deal_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function fKt(){const t=qr();return or({mutationFn:async({id:e,is_completed:n,deal_id:s})=>{const{data:a,error:o}=await Q.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 pKt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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 mKt(){const t=Bc();return Kt({queryKey:["deal-pipeline-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await Q.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 gKt(t){const e=Bc();return Kt({queryKey:["deal-by-listing",t,e],queryFn:async()=>{if(!e||!t)return null;const{data:n,error:s}=await Q.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 xKt(){const t=qr();return or({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:a}=await Q.from("deal_pipeline").update({listing_id:n}).eq("id",e).select().single();if(a)throw a;return await Q.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 yKt(){const t=qr();return or({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:a}=await Q.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 vKt({listing:t}){const e=Gn(),[n,s]=I.useState(""),[a,o]=I.useState(!1),{data:l,isLoading:i}=gKt(t.id),{data:u,isLoading:p}=i1e(),{data:x,isLoading:y}=EUe(),_=AUe(),w=xKt(),S=yKt(),N=IUe(),M=(x==null?void 0:x.filter(R=>!R.listing_id))||[],E=R=>{if(!(u!=null&&u.length))return null;switch(R){case"coming_soon":case"active":case"price_improvement":return u.find(U=>U.name==="Active");case"under_contract":return u.find(U=>U.name==="Under Contract");case"sold":return u.find(U=>U.is_won_stage);default:return u.find(U=>U.name==="Active")}},A=async()=>{o(!0);try{u!=null&&u.length||await _.mutateAsync();const R=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:(R==null?void 0:R.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}),Oe.success("Deal created and linked to listing!")}catch(R){console.error("Failed to create deal:",R),Oe.error("Failed to create deal")}finally{o(!1)}},P=async()=>{if(!n){Oe.error("Please select a deal");return}try{await w.mutateAsync({dealId:n,listingId:t.id}),Oe.success("Listing linked to deal!"),s("")}catch{Oe.error("Failed to link listing")}},z=async()=>{if(l)try{await S.mutateAsync({dealId:l.id,listingId:t.id}),Oe.success("Listing unlinked from deal")}catch{Oe.error("Failed to unlink listing")}};return i||p?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(ty,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Yr,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(Ke,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(df,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(et,{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(Lt,{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(te,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>e("/mission-control/pipeline"),children:["View Pipeline",r.jsx(Jo,{className:"h-3 w-3 ml-1"})]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:z,disabled:S.isPending,children:S.isPending?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(pA,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(ty,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(te,{onClick:A,disabled:a||N.isPending,className:"w-full",size:"sm",children:[a||N.isPending?r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),M.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(xn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"flex-1 text-sm",children:r.jsx(vn,{placeholder:"Link to existing deal..."})}),r.jsx(pn,{children:M.map(R=>r.jsx(qt,{value:R.id,children:R.deal_name},R.id))})]}),r.jsx(te,{variant:"secondary",size:"icon",onClick:P,disabled:!n||w.isPending,children:w.isPending?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(df,{className:"h-4 w-4"})})]})]})]})]})}const _Kt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},bKt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},iMe={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function wKt(){var xe,ie,pe,se,fe,he,ye,Ce,Se;const{listingId:t}=td(),e=Gn(),{user:n}=Qr(),{data:s,isLoading:a}=uDe(t||""),{data:o}=pDe(t||""),{data:l}=Zpt(t||""),i=fDe(),u=Kpt(),p=Ypt(),x=hDe(),y=Qpt(),[_,w]=I.useState(!1),[S,N]=I.useState(!1),[M,E]=I.useState(!1),[A,P]=I.useState(null),[z,R]=I.useState({buyerName:"",buyerType:"",notes:""}),U=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),V=Ne=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(Ne),K=async Ne=>{const be=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,rt=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;p.mutate({listingId:s.id,shareType:Ne});try{switch(Ne){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(be)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(be),Oe.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${rt} ${be}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(rt)}&body=${encodeURIComponent(`Check out this listing: ${be}`)}`);break}}catch(Te){console.error("Share error:",Te),Oe.error("Failed to share")}},W=async()=>{try{await x.mutateAsync(s.id),Oe.success("Listing deleted"),e("/mission-control/listings")}catch{Oe.error("Failed to delete listing")}},J=async()=>{if(!z.buyerName.trim()){Oe.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}),Oe.success("Referral sent successfully!"),N(!1),R({buyerName:"",buyerType:"",notes:""})}catch{Oe.error("Failed to send referral")}},ae=Ne=>{var Be,Ye;const be=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,rt=V((s==null?void 0:s.price)||0),Te=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Pe=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Ue=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Re=[Te,Pe,Ue].filter(Boolean).join(" | ");switch(Ne){case"just_listed":return`🏡 JUST LISTED! ${be} ${rt} ${Re} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Be=s==null?void 0:s.city)==null?void 0:Be.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${be} Now ${rt}! ${Re} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${iMe[(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! ${Re} DM me for details! 📩 #ComingSoon #RealEstate #${(Ye=s==null?void 0:s.city)==null?void 0:Ye.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(Ke,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(te,{onClick:()=>e("/mission-control/listings"),children:"Back to Listings"})]})})});const oe=((xe=s.photos)==null?void 0:xe.find(Ne=>Ne.is_primary))||((ie=s.photos)==null?void 0:ie[0]);return r.jsxs(Lr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/mission-control/listings"),children:[r.jsx(io,{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((Ne,be)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>P(Ne.photo_url),children:r.jsx("img",{src:Ne.photo_url,alt:`Photo ${be+2}`,className:"w-full h-full object-cover"})},Ne.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(Ke,{children:r.jsxs(et,{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(Lt,{className:`${_Kt[s.status]} text-white border-0`,children:bKt[s.status]}),s.is_featured&&r.jsxs(Lt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(_s,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Lt,{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(To,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>i.mutate(s.id),children:r.jsx(fi,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>u.mutate(s.id),children:l?r.jsx(xj,{className:"h-4 w-4"}):r.jsx(kg,{className:"h-4 w-4"})}),!U&&r.jsxs(te,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>E(!0),children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(_c,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(eh,{children:[r.jsxs(ri,{onClick:()=>K("copy"),children:[r.jsx(tl,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(ri,{onClick:()=>K("facebook"),children:[r.jsx(Jd,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(ri,{onClick:()=>K("text"),children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(ri,{onClick:()=>K("email"),children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),U&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",onClick:()=>e(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(hc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(te,{variant:"destructive",size:"icon",onClick:()=>w(!0),children:r.jsx($n,{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(M1,{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(C1,{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(Ag,{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(Ds,{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(Lt,{variant:"secondary",children:[r.jsx(li,{className:"h-3 w-3 mr-1"}),iMe[s.property_type]]}),s.lot_size&&r.jsxs(Lt,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Lt,{variant:"secondary",children:"HOA"})]}),s.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Os,{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($o,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(_c,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Share Content"})}),r.jsx(et,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(Ne=>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:[Ne.replace("_"," ")," Caption"]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ae(Ne)),Oe.success("Caption copied!")},children:r.jsx(tl,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ae(Ne)})]},Ne))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(et,{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:((fe=(se=s.agent)==null?void 0:se.name)==null?void 0:fe.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((he=s.agent)==null?void 0:he.name)||"Unknown"}),((Ce=(ye=s.agent)==null?void 0:ye.brokerage)==null?void 0:Ce.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!U&&r.jsx("div",{className:"space-y-2",children:((Se=s.agent)==null?void 0:Se.email)&&r.jsx(te,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),U&&r.jsx(vKt,{listing:s}),!U&&s.open_to_referrals&&r.jsxs(Ke,{children:[r.jsx(Ht,{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(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(te,{className:"w-full",onClick:()=>N(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Dr,{open:!!A,onOpenChange:()=>P(null),children:r.jsx(Or,{className:"max-w-4xl",children:r.jsx("img",{src:A||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Dr,{open:_,onOpenChange:w,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Delete Listing"}),r.jsx(Jn,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:W,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Dr,{open:S,onOpenChange:N,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Send Buyer Referral"}),r.jsx(Jn,{children:"Submit buyer information to the listing agent"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Buyer Name *"}),r.jsx(ot,{value:z.buyerName,onChange:Ne=>R({...z,buyerName:Ne.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Buyer Type"}),r.jsxs(xn,{value:z.buyerType,onValueChange:Ne=>R({...z,buyerType:Ne}),children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{children:"Notes"}),r.jsx(ss,{value:z.notes,onChange:Ne=>R({...z,notes:Ne.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(te,{onClick:J,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(TUe,{open:M,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 jKt({selectedVideoId:t,onVideoSelect:e,listingId:n}){const s=Gn(),{user:a}=Qr(),[o,l]=I.useState(!1),[i,u]=I.useState([]),[p,x]=I.useState(!1),[y,_]=I.useState(null),[w,S]=I.useState({});I.useEffect(()=>{t&&a?N():_(null)},[t,a]);const N=async()=>{if(!t)return;const{data:W,error:J}=await Q.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();!J&&W&&(_(W),M(W))},M=async W=>{try{const{data:J,error:ae}=await Q.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:W.bunny_video_id,isAgentVideo:!0}});!ae&&(J!=null&&J.thumbnailUrl)&&S(oe=>({...oe,[W.id]:{thumbnailUrl:J.thumbnailUrl}}))}catch(J){console.warn("Failed to get signed URL",J)}},E=async()=>{if(a){x(!0);try{const{data:W,error:J}=await Q.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(J)throw J;u(W||[]),W!=null&&W.length&&A(W)}catch(W){console.error("Error fetching videos:",W),Oe.error("Failed to load videos")}finally{x(!1)}}},A=async W=>{const J=await Promise.allSettled(W.map(async oe=>{const{data:xe,error:ie}=await Q.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:oe.bunny_video_id,isAgentVideo:!0}});if(ie)throw ie;return{id:oe.id,thumbnailUrl:xe==null?void 0:xe.thumbnailUrl}})),ae={};for(const oe of J)oe.status==="fulfilled"&&oe.value.thumbnailUrl&&(ae[oe.value.id]={thumbnailUrl:oe.value.thumbnailUrl});S(oe=>({...oe,...ae}))},P=()=>{l(!0),E()},z=W=>{e(W.id),_(W),l(!1),Oe.success("Video selected")},R=()=>{e(null),_(null)},U=()=>{const W=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(W)}`)},V=W=>{if(!W)return"0:00";const J=Math.floor(W/60),ae=W%60;return`${J}:${ae.toString().padStart(2,"0")}`},K=W=>{var J;return((J=w[W.id])==null?void 0:J.thumbnailUrl)||W.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(Ke,{className:"overflow-hidden",children:r.jsx(et,{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(Da,{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(Ul,{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(te,{type:"button",variant:"outline",size:"sm",onClick:P,children:"Change"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:R,className:"text-destructive hover:text-destructive",children:r.jsx(gs,{className:"h-4 w-4"})})]})]})})}):r.jsx(Ke,{className:"border-dashed",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Da,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[r.jsxs(te,{type:"button",variant:"outline",onClick:P,className:"gap-2",children:[r.jsx(xS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(te,{type:"button",variant:"outline",onClick:U,className:"gap-2",children:[r.jsx(Ng,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Dr,{open:o,onOpenChange:l,children:r.jsxs(Or,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(Br,{children:r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(xS,{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(Yr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Da,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),r.jsxs(te,{onClick:U,className:"gap-2",children:[r.jsx(Ng,{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(W=>r.jsxs("button",{type:"button",onClick:()=>z(W),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${t===W.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(W)?r.jsx("img",{src:K(W),alt:W.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(Da,{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(Ul,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),W.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(W.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:W.title||"Untitled Video"})})]},W.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(te,{type:"button",variant:"ghost",onClick:U,className:"gap-2",children:[r.jsx(Ng,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(te,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const kKt=[{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"}],NKt=[{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 oMe(){var pe;const{listingId:t}=td(),[e]=rd(),n=e.get("brokerage"),s=Gn(),{user:a}=Qr(),o=!!t&&t!=="new",l=!!n&&!o,{data:i,isLoading:u}=uDe(o?t:""),p=Upt(),x=qpt(),y=Vpt(),_=Hpt(),w=Wpt(),{data:S=[]}=Kt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:se,error:fe}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(fe)throw fe;return se||[]},enabled:l}),[N,M]=I.useState(""),[E,A]=I.useState(!1),[P,z]=I.useState([]),[R,U]=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,fe,he,ye,Ce;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:((fe=i.bedrooms)==null?void 0:fe.toString())||"",bathrooms:((he=i.bathrooms)==null?void 0:he.toString())||"",square_footage:((ye=i.square_footage)==null?void 0:ye.toString())||"",lot_size:i.lot_size||"",year_built:((Ce=i.year_built)==null?void 0:Ce.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 W=se=>{if(!se)return;const fe=Array.from(se);z(ye=>[...ye,...fe]);const he=fe.map(ye=>URL.createObjectURL(ye));U(ye=>[...ye,...he])},J=se=>{URL.revokeObjectURL(R[se]),z(fe=>fe.filter((he,ye)=>ye!==se)),U(fe=>fe.filter((he,ye)=>ye!==se))},ae=async se=>{var fe;if(!(!se||!i)){A(!0);try{for(const he of Array.from(se)){const ye=he.name.split(".").pop(),Ce=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${ye}`,{error:Se}=await Q.storage.from("listing-photos").upload(Ce,he);if(Se)throw Se;const{data:{publicUrl:Ne}}=Q.storage.from("listing-photos").getPublicUrl(Ce);await _.mutateAsync({listingId:i.id,photoUrl:Ne,isPrimary:!((fe=i.photos)!=null&&fe.length)})}Oe.success("Photos uploaded!")}catch(he){console.error("Upload error:",he),Oe.error("Failed to upload photos")}finally{A(!1)}}},oe=async se=>{for(let fe=0;fe{if(i)try{await w.mutateAsync({photoId:se,listingId:i.id}),Oe.success("Photo removed")}catch{Oe.error("Failed to remove photo")}},ie=async se=>{if(se.preventDefault(),!V.city.trim()||!V.state.trim()||!V.price){Oe.error("Please fill in required fields (City, State, Price)");return}if(l&&!N){Oe.error("Please select an agent to assign this listing to");return}try{const fe={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,...fe}),Oe.success("Listing updated!"),s(`/mission-control/listings/${t}`);else{A(!0);let he;if(l&&N?he=await x.mutateAsync({agentId:N,...fe}):he=await p.mutateAsync(fe),P.length>0)try{await oe(he.id),R.forEach(ye=>URL.revokeObjectURL(ye)),z([]),U([])}catch(ye){console.error("Photo upload error:",ye),Oe.error("Listing created but some photos failed to upload")}A(!1),Oe.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${he.id}`)}}catch(fe){console.error("Save error:",fe),Oe.error("Failed to save listing"),A(!1)}};return o&&u?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:ie,className:"space-y-6",children:[r.jsxs(te,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(io,{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(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Assign to Agent *"})}),r.jsxs(et,{children:[r.jsxs(xn,{value:N,onValueChange:M,children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select an agent..."})}),r.jsx(pn,{children:S.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(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Property Details"})}),r.jsx(et,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(qe,{children:"Property Address"}),r.jsx(ot,{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(qe,{children:"City *"}),r.jsx(ot,{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(qe,{children:"State *"}),r.jsx(ot,{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(qe,{children:"Neighborhood"}),r.jsx(ot,{value:V.neighborhood,onChange:se=>K({...V,neighborhood:se.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Price *"}),r.jsx(ot,{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(qe,{children:"Property Type"}),r.jsxs(xn,{value:V.property_type,onValueChange:se=>K({...V,property_type:se}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:NKt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Status"}),r.jsxs(xn,{value:V.status,onValueChange:se=>K({...V,status:se}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:kKt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]})]})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Property Specs (Optional)"})}),r.jsx(et,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Bedrooms"}),r.jsx(ot,{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(qe,{children:"Bathrooms"}),r.jsx(ot,{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(qe,{children:"Sq Ft"}),r.jsx(ot,{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(qe,{children:"Lot Size"}),r.jsx(ot,{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(qe,{children:"Year Built"}),r.jsx(ot,{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(Ss,{checked:V.has_hoa,onCheckedChange:se=>K({...V,has_hoa:se})}),r.jsx(qe,{children:"Has HOA"})]})]})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Description & Links"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Description"}),r.jsx(ss,{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(qe,{children:"Agent Notes"}),r.jsx(ss,{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(Ss,{checked:V.agent_notes_public,onCheckedChange:se=>K({...V,agent_notes_public:se})}),r.jsx(qe,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"MLS Link"}),r.jsx(ot,{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(qe,{children:"Video Link"}),r.jsx(ot,{value:V.video_link,onChange:se=>K({...V,video_link:se.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Da,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(et,{children:r.jsx(jKt,{selectedVideoId:V.video_id,onVideoSelect:se=>K({...V,video_id:se}),listingId:o?t:void 0})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Photos"})}),r.jsxs(et,{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:()=>xe(se.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(gs,{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&&R.map((se,fe)=>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:()=>J(fe),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(gs,{className:"h-3 w-3"})}),fe===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"})]},fe)),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(Yr,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(ho,{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?ae(se.target.files):W(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(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Sharing & Collaboration"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(qe,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Ss,{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(qe,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Ss,{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(qe,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Ss,{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(qe,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Ss,{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(qe,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Ss,{checked:V.is_public,onCheckedChange:se=>K({...V,is_public:se})})]})]})]}),r.jsx(te,{type:"submit",className:"w-full",size:"lg",disabled:p.isPending||y.isPending,children:p.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function SKt({maxDurationSeconds:t=30,onRecordingComplete:e,onError:n,onRecordingStateChange:s,className:a,teleprompterContent:o}){const l=I.useRef(null),i=I.useRef(null),u=I.useRef(null),p=I.useRef([]),x=I.useRef(null),y=I.useRef(null),_=I.useRef(null),w=I.useRef(null),S=S3(),[N,M]=I.useState(!0),[E,A]=I.useState(!0),[P,z]=I.useState(null),[R,U]=I.useState(!1),[V,K]=I.useState(!1),[W,J]=I.useState(null),[ae,oe]=I.useState(null),[xe,ie]=I.useState(0),[pe,se]=I.useState("user"),[fe,he]=I.useState(0),[ye,Ce]=I.useState(!1),[Se,Ne]=I.useState(!0),[be,rt]=I.useState(null),[Te,Pe]=I.useState(!1),Ue=I.useCallback(Ee=>{M(Ee)},[]),Re=I.useRef(N),Be=I.useCallback(async()=>{var Je;A(!0),rt(null);const Ee=S&&N;console.log("[VideoRecorder] initCamera start",{isMobile:S,usePortraitMode:N,shouldBePortrait:Ee,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.");u.current&&(console.log("[VideoRecorder] stopping existing stream"),u.current.getTracks().forEach(wt=>wt.stop()));const at=S&&Ee?{facingMode:{ideal:pe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:pe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",at);const pt=await navigator.mediaDevices.getUserMedia({video:at,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),pt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");u.current=pt,z(!0);const Mt=pt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Mt.width,"x",Mt.height),l.current){const wt=l.current;wt.srcObject=pt,wt.muted=!0,wt.playsInline=!0,wt.autoplay=!0,wt.setAttribute("muted",""),wt.setAttribute("playsinline",""),wt.setAttribute("autoplay","");try{(Je=wt.load)==null||Je.call(wt)}catch(Sr){console.warn("[VideoRecorder] videoEl.load failed",Sr)}const Xt=async()=>{try{return await wt.play(),console.log("[VideoRecorder] preview play ok"),Pe(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:wt.readyState,videoWidth:wt.videoWidth,videoHeight:wt.videoHeight})},300),!0}catch(Sr){return console.warn("[VideoRecorder] preview play blocked",Sr),Pe(!0),!1}};await new Promise(Sr=>{let an=!1;const wn=()=>{an||(an=!0,Sr())},Xr=()=>{Xt().finally(wn)};wt.onloadedmetadata=Xr,wt.onloadeddata=Xr,setTimeout(wn,1500)})}try{y.current=new AudioContext;const wt=y.current.createMediaStreamSource(pt);_.current=y.current.createAnalyser(),_.current.fftSize=256,wt.connect(_.current);const Xt=()=>{if(_.current){const Sr=new Uint8Array(_.current.frequencyBinCount);_.current.getByteFrequencyData(Sr);const an=Sr.reduce((wn,Xr)=>wn+Xr)/Sr.length;he(Math.min(100,an/128*100))}w.current=requestAnimationFrame(Xt)};Xt()}catch(wt){console.warn("Audio context not available:",wt)}}catch(at){console.error("Camera initialization error:",at),z(!1);let pt="Failed to access camera or microphone.";at.name==="NotAllowedError"?pt="Camera permission denied. Please allow camera access in your browser settings.":at.name==="NotFoundError"?pt="No camera found. Please connect a camera and try again.":at.name==="NotReadableError"?pt="Camera is in use by another application. Please close other apps using the camera.":at.message&&(pt=at.message),rt(pt),n==null||n(pt)}finally{A(!1)}},[pe,n,S,N]);I.useEffect(()=>{Re.current!==N&&P&&!R&&!ae&&(Re.current=N,Be())},[N,P,R,ae,Be]),I.useEffect(()=>(Be(),()=>{u.current&&u.current.getTracks().forEach(Ee=>Ee.stop()),x.current&&clearInterval(x.current),w.current&&cancelAnimationFrame(w.current),y.current&&y.current.close(),ae&&URL.revokeObjectURL(ae)}),[Be,ae]),I.useEffect(()=>{if(E||P!==!0||ae)return;const Ee=u.current,Je=l.current;!Ee||!Je||(Je.srcObject!==Ee&&(Je.srcObject=Ee,Je.muted=!0,Je.playsInline=!0,Je.autoplay=!0,Je.setAttribute("muted",""),Je.setAttribute("playsinline",""),Je.setAttribute("autoplay","")),Je.play().then(()=>Pe(!1)).catch(at=>{Pe(!0),console.warn("Live preview play blocked on mount:",at)}))},[P,E,ae]),I.useEffect(()=>{s==null||s(R)},[R,s]);const Ye=I.useCallback(async()=>{if(ae)return;const Ee=l.current;if(Ee)try{await Ee.play(),Pe(!1)}catch(Je){Pe(!0),console.warn("Live preview still blocked (needs user gesture):",Je)}},[ae]),ht=I.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),x.current&&(clearInterval(x.current),x.current=null),U(!1),K(!1)},[]),Me=I.useCallback(()=>{if(!u.current)return;Ye(),p.current=[],ie(0);const Je=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(pt=>MediaRecorder.isTypeSupported(pt)),at=new MediaRecorder(u.current,Je?{mimeType:Je,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});at.ondataavailable=pt=>{pt.data.size>0&&p.current.push(pt.data)},at.onstop=()=>{var wt;const pt=at.mimeType||Je||((wt=p.current[0])==null?void 0:wt.type)||"video/webm",gt=new Blob(p.current,{type:pt});J(gt);const Mt=URL.createObjectURL(gt);oe(Mt)},i.current=at,at.start(100),U(!0),x.current=setInterval(()=>{ie(pt=>pt>=t-1?(ht(),t):pt+1)},1e3)},[Ye,t,ht]),Qe=I.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),K(!0),x.current&&clearInterval(x.current))},[]),le=I.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),K(!1),x.current=setInterval(()=>{ie(Ee=>Ee>=t-1?(ht(),t):Ee+1)},1e3))},[t,ht]),Ve=I.useCallback(()=>{ae&&URL.revokeObjectURL(ae),J(null),oe(null),ie(0),Ce(!1),Ne(!0),l.current&&u.current&&(l.current.srcObject=u.current,l.current.muted=!0,Ye())},[Ye,ae]),Le=I.useCallback(()=>{se(Ee=>Ee==="user"?"environment":"user")},[]),We=I.useCallback(()=>{W&&e(W,xe)},[W,xe,e]),_e=I.useCallback(()=>{l.current&&ae&&(ye?l.current.pause():(Ne(!1),l.current.muted=!1,l.current.play()),Ce(!ye))},[ae,ye]);I.useEffect(()=>{if(!ae)return;const Ee=l.current;if(!Ee)return;Ne(!1),Ee.pause(),Ee.removeAttribute("src"),Ee.srcObject=null,Ee.load(),Ee.src=ae,Ee.currentTime=0,Ee.playsInline=!0,Ee.muted=!1,Ee.onended=()=>Ce(!1);const Je=()=>{const at=Ee.error,pt=at?`Recorded video failed to play (code ${at.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",at),n==null||n(pt)};return Ee.addEventListener("error",Je),Ee.load(),()=>{Ee.removeEventListener("error",Je)}},[n,ae]);const st=Ee=>{const Je=Math.floor(Ee/60),at=Ee%60;return`${Je}:${at.toString().padStart(2,"0")}`},ze=S&&N?"aspect-[9/16]":"aspect-video";return E?r.jsx("div",{className:zt("flex items-center justify-center bg-black rounded-lg",ze,a),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(Yr,{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",ze,a),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(pl,{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:be||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(te,{onClick:()=>Be(),variant:"secondary",className:"w-full",children:[r.jsx(Ll,{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:[S&&!R&&!ae&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(Mj,{className:zt("h-4 w-4",N?"text-muted-foreground":"text-primary")}),r.jsx(qe,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Ss,{id:"orientation-toggle",checked:N,onCheckedChange:Ue}),r.jsx(qe,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(Tg,{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:()=>{Ye()},children:[r.jsx("video",{ref:l,src:ae??void 0,className:zt("w-full bg-black",N&&!ae?"object-contain":"object-cover",ze,pe==="user"&&!ae&&"scale-x-[-1]"),playsInline:!0,controls:!!ae,muted:ae?Se:!0,autoPlay:!ae},ae??"live"),!ae&&Te&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(te,{type:"button",variant:"secondary",onClick:()=>void Ye(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!ae&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),R&&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:[st(xe)," / ",st(t)]})]}),R&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Jc,{value:xe/t*100,className:"h-1 rounded-none"})}),!ae&&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(JT,{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:`${fe}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ae?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:Ve,children:[r.jsx(Ll,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(te,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:_e,children:ye?r.jsx(sp,{className:"h-5 w-5"}):r.jsx(Ul,{className:"h-5 w-5"})}),r.jsxs(te,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:We,children:[r.jsx(_i,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Le,disabled:R,children:r.jsx(NS,{className:"h-5 w-5"})}),R?r.jsxs(r.Fragment,{children:[r.jsx(te,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:V?le:Qe,children:V?r.jsx(Ul,{className:"h-5 w-5"}):r.jsx(sp,{className:"h-5 w-5"})}),r.jsx(te,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:ht,children:r.jsx(Ag,{className:"h-6 w-6 fill-current"})})]}):r.jsx(te,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Me,children:r.jsx(Da,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function CKt({text:t,isVisible:e,onToggleVisibility:n,isRecording:s=!1,className:a}){const o=I.useRef(null),l=I.useRef(null),i=I.useRef(0),u=I.useRef(0),[p,x]=I.useState(!1),[y,_]=I.useState(30),[w,S]=I.useState(24),[N,M]=I.useState(1.6),[E,A]=I.useState(.85),[P,z]=I.useState("top"),[R,U]=I.useState(!1),V=I.useCallback(ae=>{if(!o.current)return;i.current===0&&(i.current=ae);const oe=ae-i.current;i.current=ae,u.current+=y*oe/1e3;const xe=Math.floor(u.current);xe>0&&(o.current.scrollTop+=xe,u.current-=xe);const{scrollTop:ie,scrollHeight:pe,clientHeight:se}=o.current;if(ie+se>=pe){x(!1);return}l.current=requestAnimationFrame(V)},[y]);I.useEffect(()=>(p?(i.current=0,u.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)},[]),W=I.useCallback(()=>{x(ae=>!ae)},[]);if(!e)return r.jsx("div",{className:zt("absolute top-4 right-4 pointer-events-auto z-10",a),children:r.jsxs(te,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const J={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",J[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",R&&"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:`${w}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(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsx(te,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(jd,{className:"h-4 w-4"})})}),r.jsx(ed,{className:"w-72",side:"left",align:"start",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-xs",children:"Scroll Speed"}),r.jsx(gm,{value:[y],onValueChange:([ae])=>_(ae),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-xs",children:"Font Size"}),r.jsx(gm,{value:[w],onValueChange:([ae])=>S(ae),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-xs",children:"Line Spacing"}),r.jsx(gm,{value:[N*10],onValueChange:([ae])=>M(ae/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-xs",children:"Opacity"}),r.jsx(gm,{value:[E*100],onValueChange:([ae])=>A(ae/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:P==="top"?"default":"outline",size:"sm",onClick:()=>z("top"),children:r.jsx(T1,{className:"h-4 w-4"})}),r.jsx(te,{variant:P==="center"?"default":"outline",size:"sm",onClick:()=>z("center"),children:r.jsx(F1,{className:"h-4 w-4"})}),r.jsx(te,{variant:P==="bottom"?"default":"outline",size:"sm",onClick:()=>z("bottom"),children:r.jsx(Qd,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Ss,{checked:R,onCheckedChange:U})]})]})})]}),r.jsx(te,{variant:"secondary",size:"icon",onClick:W,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:p?r.jsx(sp,{className:"h-4 w-4"}):r.jsx(Ul,{className:"h-4 w-4"})}),r.jsx(te,{variant:"secondary",size:"icon",onClick:K,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(NS,{className:"h-4 w-4"})}),r.jsxs(te,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(E1,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function MKt({onSelectScript:t,onCreateNew:e,selectedScriptId:n,className:s}){const{toast:a}=mi(),[o,l]=I.useState(""),[i,u]=I.useState(null),[p,x]=I.useState("levelup"),{data:y,isLoading:_}=n4t(),{data:w,isLoading:S}=s4t(),{data:N,isLoading:M}=a4t(),E=i4t(),A=I.useMemo(()=>w?w.filter(V=>{const K=!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())||V.tags.some(J=>J.toLowerCase().includes(o.toLowerCase())),W=!i||V.category_id===i;return K&&W}):[],[w,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})},R=async V=>{try{await E.mutateAsync(V),a({title:"Script saved to My Scripts"})}catch{a({title:"Failed to save script",variant:"destructive"})}},U=_||S||M;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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search scripts...",value:o,onChange:V=>l(V.target.value),className:"pl-9"})]})}),r.jsxs(ki,{value:p,onValueChange:V=>x(V),className:"flex-1 flex flex-col",children:[r.jsxs(pi,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(rn,{value:"levelup",children:[r.jsx(ka,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(rn,{value:"my-scripts",children:[r.jsx(vm,{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(Lt,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>u(null),children:"All"}),y==null?void 0:y.map(V=>r.jsx(Lt,{variant:i===V.id?"default":"outline",className:"cursor-pointer",onClick:()=>u(V.id),children:V.name},V.id))]}),r.jsx(Ro,{className:"flex-1 max-h-[50vh]",children:U?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Yr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ka,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:A.map(V=>r.jsxs(Ke,{className:zt("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>z(V),children:[r.jsx(Ht,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Zt,{className:"text-sm font-medium truncate",children:V.title}),V.category&&r.jsx(Lt,{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(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:K=>{K.stopPropagation(),R(V)},children:r.jsx(vm,{className:"h-4 w-4"})}),r.jsx(Bi,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(et,{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(te,{variant:"outline",className:"mb-4",onClick:e,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Ro,{className:"flex-1 max-h-[50vh]",children:M?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Yr,{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(vm,{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(Ke,{className:zt("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>z(V),children:[r.jsx(Ht,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(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(Lt,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Lt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Bi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(et,{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 TKt({selectedTemplate:t,onSelect:e,contactName:n,saving:s=!1}){const[a,o]=I.useState(()=>{const i=zS(t);return new Set([i.category])}),l=i=>{o(u=>{const p=new Set(u);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(qe,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(Yr,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:apt.map(i=>{const u=ipt(i.id),p=a.has(i.id),x=u.some(y=>y.id===t);return r.jsxs(DS,{open:p,onOpenChange:()=>l(i.id),children:[r.jsxs(RS,{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:["(",u.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(Qd,{className:zt("h-4 w-4 text-muted-foreground transition-transform",p&&"rotate-180")})]}),r.jsx(FS,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:u.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(_i,{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: "',zS(t).headerText(n),'"']})]})}function LUe({open:t,onOpenChange:e,video:n,contactName:s,onTemplateUpdated:a}){const[o,l]=I.useState(n.page_template||"default"),[i,u]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState(n.page_template||"default"),[w,S]=I.useState([]),[N,M]=I.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[E,A]=I.useState(!1),[P,z]=I.useState(!1),R=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";I.useEffect(()=>{t&&w.length===0&&U()},[t]);const U=async()=>{z(!0);try{const{data:pe,error:se}=await Q.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;const fe=(pe||[]).map(he=>({id:he.id,name:[he.first_name,he.last_name].filter(Boolean).join(" ")||"Unnamed",email:he.email||null}));S(fe)}catch(pe){console.error("Failed to fetch contacts:",pe)}finally{z(!1)}},V=async pe=>{M(pe),A(!1),u(!0);try{const{error:se}=await Q.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;Oe.success(pe?`Assigned to ${pe.name}`:"Contact removed"),a==null||a()}catch(se){console.error("Failed to update contact:",se),Oe.error("Failed to update contact")}finally{u(!1)}},K=async pe=>{l(pe),u(!0);try{const{error:se}=await Q.from("agent_videos").update({page_template:pe}).eq("id",n.id);if(se)throw se;_(pe),Oe.success("Template saved!"),a==null||a()}catch(se){console.error("Failed to save template:",se),Oe.error("Failed to save template"),l(y)}finally{u(!1)}},W=(N==null?void 0:N.name)||null,J=()=>{const pe=n.title||"Video Message",se=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},ae=async()=>{if(!n.thumbnail_url){Oe.error("Video thumbnail not available yet");return}const pe=J(),se=`Watch: ${n.title||"Video Message"} ${R}`;try{const fe=new Blob([pe],{type:"text/html"}),he=new Blob([se],{type:"text/plain"}),ye=new ClipboardItem({"text/html":fe,"text/plain":he});await navigator.clipboard.write([ye]),Oe.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(se+` `+pe),Oe.success("Copied! Paste into your email.")}},oe=async()=>{await navigator.clipboard.writeText(R),x(!0),Oe.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},xe=()=>{const se=zS(o).headerText(W),fe=o==="default"?`Check out this video: ${R}`:`${se} Check out this special video: ${R}`;window.open(`sms:?body=${encodeURIComponent(fe)}`,"_self")},ie=()=>{const pe=zS(o),se=pe.headerText(W),fe=o==="default"?n.title||"Video Message":se,he=`${pe.subText} Watch the video: ${R}`,ye=N!=null&&N.email?encodeURIComponent(N.email):"";window.open(`mailto:${ye}?subject=${encodeURIComponent(fe)}&body=${encodeURIComponent(he)}`,"_self")};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Jn,{children:"Choose a themed page template and share your video"})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Cd,{open:E,onOpenChange:A,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{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(ac,{className:"h-4 w-4 text-muted-foreground"}),N.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(Qx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(ed,{className:"w-[300px] p-0",align:"start",children:r.jsxs(by,{children:[r.jsx(wy,{placeholder:"Search contacts..."}),r.jsxs(jy,{children:[r.jsx(ky,{children:P?"Loading...":"No contacts found."}),r.jsx(Ny,{children:w.map(pe=>r.jsxs(Sy,{value:pe.name,onSelect:()=>V(pe),children:[r.jsx(_i,{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(te,{variant:"ghost",size:"icon",onClick:()=>V(null),disabled:i,className:"shrink-0",children:r.jsx(gs,{className:"h-4 w-4"})})]}),N&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',zS(o).headerText(N.name),'"']})]}),r.jsx(TKt,{selectedTemplate:o,onSelect:K,contactName:W,saving:i}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:R,readOnly:!0,className:"font-mono text-sm"}),r.jsx(te,{onClick:oe,variant:p?"default":"outline",className:"shrink-0 gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(_i,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(tl,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Share for Email"}),r.jsxs(te,{variant:"outline",className:"w-full gap-2",onClick:ae,children:[r.jsx(Ol,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",className:"flex-1 gap-2",onClick:xe,children:[r.jsx(Do,{className:"h-4 w-4"}),"Text"]}),r.jsxs(te,{variant:"outline",className:"flex-1 gap-2",onClick:ie,children:[r.jsx(ws,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(Ws,{children:r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Done"})})]})})}function AKt(){var We;const t=Gn(),[e]=rd(),{toast:n}=mi(),s=e.get("contact_id"),a=e.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:u}=d4t(),{data:p}=mp(),x=P7e(),y=p4t(),[_,w]=I.useState("record"),[S,N]=I.useState(""),[M,E]=I.useState(!1),[A,P]=I.useState(!1),[z,R]=I.useState(!1),[U,V]=I.useState(null),[K,W]=I.useState(0),[J,ae]=I.useState(0),[oe,xe]=I.useState(null),[ie,pe]=I.useState(null),[se,fe]=I.useState(s||""),[he,ye]=I.useState(""),[Ce,Se]=I.useState(""),[Ne,be]=I.useState(null),[rt,Te]=I.useState(null),[Pe,Ue]=I.useState(null),[Re,Be]=I.useState(!1),Ye=I.useCallback(async(_e,st)=>{V(_e),w("uploading");try{const{videoId:ze,uploadUrl:Ee}=await u4t(he||"Quick Video Touch");xe(ze);const{apiKey:Je}=await h4t(ze),at=new XMLHttpRequest;at.upload.onprogress=gt=>{gt.lengthComputable&&W(gt.loaded/gt.total*100)},await new Promise((gt,Mt)=>{at.onload=()=>{at.status>=200&&at.status<300?gt():Mt(new Error(`Upload failed: ${at.status}`))},at.onerror=()=>Mt(new Error("Upload failed")),at.open("PUT",Ee),at.setRequestHeader("AccessKey",Je),at.send(_e)}),w("processing");let pt=0;for(;pt<4;){await new Promise(Mt=>setTimeout(Mt,2e3));const gt=await f4t(ze);if(pt=gt.status,ae(gt.encodeProgress||0),pt===4)pe({playbackUrl:gt.directPlayUrl,thumbnailUrl:gt.thumbnailUrl,previewUrl:gt.previewUrl||null,duration:gt.length||st,fileSizeMb:(gt.storageSize||_e.size)/(1024*1024)});else if(pt===5||pt===6)throw new Error("Video processing failed")}w("details")}catch(ze){console.error("Upload error:",ze),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),w("record")}},[he,n]),ht=async()=>{if(!(!oe||!ie))try{const _e=se&&se!=="none"?se:null,st=await x.mutateAsync({bunny_video_id:oe,contact_id:_e,playback_url:ie.playbackUrl,thumbnail_url:ie.thumbnailUrl,preview_url:ie.previewUrl,duration_seconds:ie.duration,file_size_mb:ie.fileSizeMb,title:he||"Quick Video Touch",notes:Ce,task_id:a||null,status:"ready"});be(st.id),Te(st.share_token||null),_e&&await y.mutateAsync({contactId:_e,videoId:st.id,notes:Ce}),n({title:"Video saved successfully!"}),w("share")}catch(_e){console.error("Save video error:",_e),n({title:"Failed to save video",description:(_e==null?void 0:_e.message)||"Please try again.",variant:"destructive"})}},Me=(_e,st)=>{navigator.clipboard.writeText(st),Ue(_e),setTimeout(()=>Ue(null),2e3),n({title:"Copied to clipboard!"})},Qe=()=>rt?`https://video.relevelup.com/${rt}`:(ie==null?void 0:ie.playbackUrl)||"",le=()=>{const _e=p==null?void 0:p.find(at=>at.id===se),st=_e?`${_e.first_name}`:"",ze=(_e==null?void 0:_e.phone)||"",Ee=(_e==null?void 0:_e.email)||"",Je=Qe();return{text:`Hey${st?` ${st}`:""}! I recorded a quick video for you: ${Je}`,link:Je,contactPhone:ze,contactEmail:Ee}},Ve=()=>{const{text:_e,contactPhone:st}=le(),ze=st?`sms:${st}?body=${encodeURIComponent(_e)}`:`sms:?body=${encodeURIComponent(_e)}`;window.open(ze,"_self")},Le=()=>{const{link:_e,contactEmail:st}=le(),ze="Check out this video",Ee=`I recorded a quick video for you: ${_e}`,Je=st?`mailto:${st}?subject=${encodeURIComponent(ze)}&body=${encodeURIComponent(Ee)}`:`mailto:?subject=${encodeURIComponent(ze)}&body=${encodeURIComponent(Ee)}`;window.open(Je,"_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(te,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:r.jsx(io,{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"})]})]}),u&&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(SKt,{maxDurationSeconds:30,onRecordingComplete:Ye,onRecordingStateChange:R,className:"w-full",teleprompterContent:M&&S&&r.jsx(CKt,{text:S,isVisible:M,onToggleVisibility:()=>E(!1),isRecording:z})}),!M&&S&&r.jsxs(te,{variant:"outline",className:"mt-4",onClick:()=>E(!0),children:[r.jsx(ka,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ke,{className:"lg:col-span-1",children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Zt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(ss,{placeholder:"Type or paste your script here...",value:S,onChange:_e=>N(_e.target.value),rows:6}),r.jsxs(xse,{open:A,onOpenChange:P,children:[r.jsx(dxe,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"w-full",children:[r.jsx(ka,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(BI,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(yse,{className:"p-4 border-b",children:r.jsx(vse,{children:"Select a Script"})}),r.jsx(MKt,{onSelectScript:_e=>{N(_e.text),P(!1),E(!0)},className:"h-[calc(100vh-80px)]"})]})]}),S&&r.jsx(te,{className:"w-full",onClick:()=>E(!0),children:"Use Script"})]})]})]}),_==="uploading"&&r.jsx(Ke,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center",children:[r.jsx(ho,{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(Jc,{value:K,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[K.toFixed(0),"%"]})]})}),_==="processing"&&r.jsx(Ke,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center",children:[r.jsx(Yr,{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(Jc,{value:J,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[J.toFixed(0),"%"]})]})}),_==="details"&&r.jsxs(Ke,{className:"max-w-lg mx-auto",children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Video Details"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{children:"Title"}),r.jsx(ot,{value:he,onChange:_e=>ye(_e.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Attach to Contact (Optional)"}),r.jsxs(xn,{value:se,onValueChange:fe,children:[r.jsx(fn,{children:r.jsx(vn,{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(Mo,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),p==null?void 0:p.map(_e=>r.jsx(qt,{value:_e.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ac,{className:"h-4 w-4"}),_e.first_name," ",_e.last_name]})},_e.id))]})]})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Notes"}),r.jsx(ss,{value:Ce,onChange:_e=>Se(_e.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(te,{className:"w-full",onClick:ht,disabled:x.isPending,children:[x.isPending&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),_==="share"&&r.jsxs(Ke,{className:"max-w-lg mx-auto",children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(_i,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(te,{variant:"outline",className:"justify-start",onClick:Ve,children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:Le,children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:()=>Me("link",le().link),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Pe==="link"&&r.jsx(_i,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:()=>Be(!0),children:[r.jsx(Rc,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>t("/mission-control/video-library"),children:"View Library"}),r.jsx(te,{onClick:()=>{w("record"),V(null),xe(null),pe(null)},children:"Record Another"})]})]})]}),Ne&&rt&&r.jsx(LUe,{open:Re,onOpenChange:Be,video:{id:Ne,share_token:rt,title:he||null,contact_id:se||null,thumbnail_url:(ie==null?void 0:ie.thumbnailUrl)||null},contactName:((We=p==null?void 0:p.find(_e=>_e.id===se))==null?void 0:We.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(Xh,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),r.jsx(te,{onClick:()=>t("/mission-control/video-library"),children:"Open Video Library"})]})})}function EKt({open:t,onOpenChange:e}){const{data:n}=mp(),{data:s}=Qye(),a=P7e(),o=I.useRef(null),[l,i]=I.useState(null),[u,p]=I.useState(""),[x,y]=I.useState(""),[_,w]=I.useState(""),[S,N]=I.useState(!1),[M,E]=I.useState(0),[A,P]=I.useState("idle"),z=(s==null?void 0:s.total_storage_mb)||0,U=((s==null?void 0:s.max_storage_mb)||1024)-z,V=ae=>{var ie;const oe=(ie=ae.target.files)==null?void 0:ie[0];if(!oe)return;if(!oe.type.startsWith("video/")){Oe.error("Please select a video file");return}const xe=oe.size/(1024*1024);if(xe>500){Oe.error("Video file must be less than 500MB");return}if(xe>U){Oe.error(`Not enough storage. You have ${U.toFixed(1)} MB remaining.`);return}i(oe),u||p(oe.name.replace(/\.[^/.]+$/,""))},K=async()=>{if(!l){Oe.error("Please select a video file");return}N(!0),E(0),P("creating");try{const{data:ae,error:oe}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:u||l.name,isAgentVideo:!0}});if(oe)throw new Error(oe.message);const{videoId:xe,libraryId:ie}=ae;P("uploading");const{data:pe,error:se}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:xe,isAgentVideo:!0}});if(se)throw new Error(se.message);await new Promise((ye,Ce)=>{const Se=new XMLHttpRequest;Se.upload.addEventListener("progress",Ne=>{if(Ne.lengthComputable){const be=Math.round(Ne.loaded/Ne.total*100);E(be)}}),Se.addEventListener("load",()=>{Se.status>=200&&Se.status<300?ye():Ce(new Error(`Upload failed with status ${Se.status}`))}),Se.addEventListener("error",()=>Ce(new Error("Upload failed"))),Se.open("PUT",pe.uploadUrl),Se.setRequestHeader("AccessKey",pe.apiKey),Se.send(l)}),P("processing");const fe=l.size/(1024*1024),he=`https://iframe.mediadelivery.net/embed/${ie}/${xe}`;await a.mutateAsync({bunny_video_id:xe,playback_url:he,file_size_mb:fe,title:u||l.name,notes:x||void 0,contact_id:_||void 0,status:"processing",touch_type:"video_upload"}),Oe.success("Video uploaded successfully! Processing may take a few minutes."),W()}catch(ae){console.error("Upload error:",ae),Oe.error(ae instanceof Error?ae.message:"Failed to upload video")}finally{N(!1),P("idle")}},W=()=>{S||(i(null),p(""),y(""),w(""),E(0),P("idle"),e(!1))},J=()=>{switch(A){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${M}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Dr,{open:t,onOpenChange:W,children:r.jsxs(Or,{className:"sm:max-w-md",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Upload Video"}),r.jsx(Jn,{children:"Upload a video file from your device to your video library."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Da,{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"]})]}),!S&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ae=>{ae.stopPropagation(),i(null)},children:r.jsx(gs,{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 ae;return(ae=o.current)==null?void 0:ae.click()},children:[r.jsx(ho,{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:S})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"title",children:"Title"}),r.jsx(ot,{id:"title",value:u,onChange:ae=>p(ae.target.value),placeholder:"Enter video title",disabled:S})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Associate with Contact (optional)"}),r.jsxs(xn,{value:_||"__none__",onValueChange:ae=>w(ae==="__none__"?"":ae),disabled:S,children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select a contact"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ae=>r.jsxs(qt,{value:ae.id,children:[ae.first_name," ",ae.last_name||""]},ae.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(ss,{id:"notes",value:x,onChange:ae=>y(ae.target.value),placeholder:"Add any notes about this video",rows:2,disabled:S})]}),S&&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(Yr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:J()})]}),r.jsx(Jc,{value:A==="uploading"?M:A==="processing"?100:10})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:W,disabled:S,children:"Cancel"}),r.jsx(te,{onClick:K,disabled:!l||S,children:S?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ho,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function IKt({open:t,onOpenChange:e,video:n,gmailEmail:s,signedThumbnailUrl:a,onSendComplete:o}){const[l,i]=I.useState([]),[u,p]=I.useState(null),[x,y]=I.useState(!1),[_,w]=I.useState(!1),[S,N]=I.useState(""),[M,E]=I.useState(""),[A,P]=I.useState(""),[z,R]=I.useState(!1),U=n.share_token?`https://video.relevelup.com/${n.share_token}`:"",V=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:a||n.thumbnail_url||"",K=n.title||"Video Message";I.useEffect(()=>{t&&l.length===0&&W()},[t]),I.useEffect(()=>{if(t&&(E(`I recorded a video for you — ${K}`),P("Hey! I recorded a quick video just for you. Click below to watch it:"),p(null),N(""),n.contact_id)){const pe=l.find(se=>se.id===n.contact_id);pe&&(p(pe),N(pe.email||""))}},[t,n.contact_id,l]);const W=async()=>{w(!0);try{const{data:pe,error:se}=await Q.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;i(pe||[])}catch{console.error("Failed to fetch contacts")}finally{w(!1)}},J=pe=>{p(pe),y(!1),N(pe.email||""),P(`Hey ${pe.first_name}! I recorded a quick video just for you. Click below to watch it:`),E(`I recorded a video for you — ${K}`)},ae=()=>{p(null),N(""),P("Hey! I recorded a quick video just for you. Click below to watch it:")},oe=pe=>`${pe.first_name} ${pe.last_name||""}`.trim(),xe=()=>`
${A.split(/\n\n+/).map(se=>`

${se.replace(/\n/g,"
")}

`).join("")}

▶ Watch Video

`,ie=async()=>{if(!S){Oe.error("Please enter a recipient email");return}if(!U){Oe.error("Video does not have a share link");return}R(!0);try{const pe=xe(),{data:se,error:fe}=await Q.functions.invoke("gmail-send",{body:{to:S,subject:M,body:pe,contactId:(u==null?void 0:u.id)||null}});if(fe)throw fe;if(!(se!=null&&se.success))throw new Error((se==null?void 0:se.error)||"Failed to send");Oe.success("Video email sent!"),e(!1),o==null||o()}catch(pe){console.error("Gmail send error:",pe),Oe.error("Failed to send: "+(pe instanceof Error?pe.message:"Unknown error"))}finally{R(!1)}};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5 text-red-500"}),"Send Video via Gmail"]}),s&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:s})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{children:"Send to Contact"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Cd,{open:x,onOpenChange:y,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox",className:"flex-1 justify-between",children:[u?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ac,{className:"h-4 w-4 text-muted-foreground"}),oe(u),u.email&&r.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",u.email,")"]})]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(Qx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(ed,{className:"w-[350px] p-0",align:"start",children:r.jsxs(by,{children:[r.jsx(wy,{placeholder:"Search contacts..."}),r.jsxs(jy,{children:[r.jsx(ky,{children:_?"Loading...":"No contacts found."}),r.jsx(Ny,{children:l.filter(pe=>pe.email).map(pe=>r.jsxs(Sy,{value:`${pe.first_name} ${pe.last_name||""} ${pe.email||""}`,onSelect:()=>J(pe),children:[r.jsx(_i,{className:zt("mr-2 h-4 w-4",(u==null?void 0:u.id)===pe.id?"opacity-100":"opacity-0")}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:oe(pe)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:pe.email})]})]},pe.id))})]})]})})]}),u&&r.jsx(te,{variant:"ghost",size:"icon",onClick:ae,className:"shrink-0",children:r.jsx(gs,{className:"h-4 w-4"})})]})]}),!u&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{htmlFor:"video-to",children:"Or type email address"}),r.jsx(ot,{id:"video-to",value:S,onChange:pe=>N(pe.target.value),placeholder:"recipient@example.com",type:"email"})]}),r.jsx(_d,{}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{htmlFor:"video-subject",children:"Subject"}),r.jsx(ot,{id:"video-subject",value:M,onChange:pe=>E(pe.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{htmlFor:"video-message",children:"Personal Message"}),r.jsx(ss,{id:"video-message",value:A,onChange:pe=>P(pe.target.value),rows:4,className:"resize-y"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:[r.jsx(qe,{className:"text-xs text-muted-foreground",children:"Video Preview (embedded in email)"}),r.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{maxWidth:320},children:[V?r.jsx("img",{src:V,alt:K,className:"w-full aspect-video object-cover"}):r.jsx("div",{className:"w-full aspect-video flex items-center justify-center bg-muted",children:r.jsx(Ul,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-10 h-10 rounded-full bg-white/80 flex items-center justify-center shadow",children:r.jsx(Ul,{className:"h-5 w-5 text-primary ml-0.5"})})})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Recipients will see the thumbnail with a play button. Clicking opens the video page."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),disabled:z,children:"Cancel"}),r.jsxs(te,{onClick:ie,disabled:z||!S||!M,className:"gap-2",children:[z?r.jsx(Yr,{className:"h-4 w-4 animate-spin"}):r.jsx(eo,{className:"h-4 w-4"}),z?"Sending...":"Send Video Email"]})]})]})]})})}function PKt({previewSrc:t,thumbnailSrc:e,alt:n,isHovered:s}){const[a,o]=I.useState(!1),[l,i]=I.useState(!1),u=s&&t&&!a,p=e&&!l;return!p&&!u?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Da,{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 ${u?"opacity-0":"opacity-100"}`,onError:()=>i(!0)}),u&&r.jsx("img",{src:t,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function LKt({video:t,previewSrc:e,thumbnailSrc:n,onOpen:s,onDelete:a,onNavigateToContact:o,onGetEmbedCode:l,onCopyEmailHtml:i,onShareWithTemplate:u,onSendViaGmail:p,isGmailConnected:x,getContactName:y,getShareUrl:_,copyToClipboard:w,formatDuration:S}){const[N,M]=I.useState(!1);return r.jsxs(Ke,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(PKt,{previewSrc:e,thumbnailSrc:n,alt:t.title||"Video preview",isHovered:N}),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(Ul,{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:S(t.duration_seconds)}),t.status!=="ready"&&r.jsx(Lt,{variant:t.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:t.status})]}),r.jsx(et,{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(ac,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:y(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(Wa,{className:"h-3 w-3"}),r.jsx("span",{children:mn(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($o,{className:"h-3 w-3"}),r.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]}),x&&t.share_token&&r.jsxs(te,{variant:"outline",size:"sm",className:"mt-2 gap-1.5 text-xs h-7",onClick:E=>{E.stopPropagation(),p==null||p()},children:[r.jsx(ws,{className:"h-3 w-3"}),"Send via Gmail"]}),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(ac,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:y(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(Wa,{className:"h-3 w-3"}),r.jsx("span",{children:mn(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($o,{className:"h-3 w-3"}),r.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]})]}),r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:E=>E.stopPropagation(),children:r.jsx(Rx,{className:"h-4 w-4"})})}),r.jsxs(eh,{align:"end",className:"bg-popover",children:[r.jsxs(ri,{onClick:E=>{E.stopPropagation(),s()},children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(Zj,{}),r.jsxs(ri,{onClick:E=>{E.stopPropagation(),u()},children:[r.jsx(Rc,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(ri,{onClick:E=>{E.stopPropagation(),w(_(t),"Share link")},children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(ri,{onClick:E=>{E.stopPropagation(),l()},children:[r.jsx(_j,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(ri,{onClick:E=>{E.stopPropagation(),i()},children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),x&&t.share_token&&r.jsxs(ri,{onClick:E=>{E.stopPropagation(),p==null||p()},children:[r.jsx(eo,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]}),r.jsx(Zj,{}),t.contact_id&&r.jsxs(ri,{onClick:E=>{E.stopPropagation(),o()},children:[r.jsx(ac,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(ri,{onClick:E=>{E.stopPropagation(),a()},className:"text-destructive",children:[r.jsx($n,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function OKt(){var Ue;const t=Gn(),{data:e,isLoading:n}=o4t(),{data:s}=Qye(),{data:a}=mp(),o=c4t(),{isGmailConnected:l,gmailEmail:i}=cae(),[u,p]=I.useState(""),[x,y]=I.useState(null),[_,w]=I.useState(!1),[S,N]=I.useState(!1),[M,E]=I.useState(!1),[A,P]=I.useState(!1),[z,R]=I.useState(!1),[U,V]=I.useState(!1),[K,W]=I.useState({}),J=Re=>{if(!Re)return"Unassigned";const Be=a==null?void 0:a.find(Ye=>Ye.id===Re);return Be?`${Be.first_name} ${Be.last_name||""}`.trim():"Unknown"},ae=Re=>{if(!Re)return"0:00";const Be=Math.floor(Re/60),Ye=Re%60;return`${Be}:${Ye.toString().padStart(2,"0")}`},oe=e==null?void 0:e.filter(Re=>{if(!u)return!0;const Be=J(Re.contact_id).toLowerCase(),Ye=(Re.title||"").toLowerCase(),ht=(Re.notes||"").toLowerCase();return Be.includes(u.toLowerCase())||Ye.includes(u.toLowerCase())||ht.includes(u.toLowerCase())});I.useEffect(()=>{(async()=>{if(!(e!=null&&e.length))return;const Be=e.filter(ht=>(ht==null?void 0:ht.bunny_video_id)&&!K[ht.id]);if(!Be.length)return;const Ye=await Promise.allSettled(Be.map(async ht=>{const{data:Me,error:Qe}=await Q.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:ht.bunny_video_id,isAgentVideo:!0}});if(Qe)throw Qe;return{id:ht.id,previewUrl:Me==null?void 0:Me.previewUrl,thumbnailUrl:Me==null?void 0:Me.thumbnailUrl}}));W(ht=>{const Me={...ht};for(const Qe of Ye)Qe.status==="fulfilled"&&(Me[Qe.value.id]={previewUrl:Qe.value.previewUrl,thumbnailUrl:Qe.value.thumbnailUrl});return Me})})().catch(Be=>console.warn("Failed to load signed Bunny asset URLs",Be))},[e,K]);const xe=(s==null?void 0:s.total_storage_mb)||0,ie=(s==null?void 0:s.max_storage_mb)||1024,pe=xe/ie*100,se=pe>=80,fe=pe>=100,he=async(Re,Be)=>{await navigator.clipboard.writeText(Re),Oe.success(`${Be} copied to clipboard`)},ye=Re=>Re.share_token?`https://video.relevelup.com/${Re.share_token}`:Re.playback_url||"",Ce=Re=>{const Be=ye(Re),Ye=a==null?void 0:a.find(Le=>Le.id===Re.contact_id),ht=J(Re.contact_id),Me=ht!=="Unassigned"?ht.split(" ")[0]:"",Qe=(Ye==null?void 0:Ye.phone)||"",le=`Hey${Me?` ${Me}`:""}! I recorded a quick video message for you. Check it out: ${Be}`,Ve=Qe?`sms:${Qe}?body=${encodeURIComponent(le)}`:`sms:?body=${encodeURIComponent(le)}`;window.open(Ve,"_self")},Se=Re=>{const Be=a==null?void 0:a.find(Ve=>Ve.id===Re.contact_id),Ye=(Be==null?void 0:Be.email)||"",ht=ye(Re),Me="Check out this video",Qe=`I recorded a quick video for you: ${ht}`,le=Ye?`mailto:${Ye}?subject=${encodeURIComponent(Me)}&body=${encodeURIComponent(Qe)}`:`mailto:?subject=${encodeURIComponent(Me)}&body=${encodeURIComponent(Qe)}`;window.open(le,"_self")},Ne=Re=>{var Me;const Be=ye(Re),Ye=Re.title||"Video Message",ht=Re.share_token?`https://video.relevelup.com/thumb/${Re.share_token}`:((Me=K[Re.id])==null?void 0:Me.thumbnailUrl)||Re.thumbnail_url||"";return``},be=async Re=>{if(!Re.thumbnail_url&&!Re.share_token){Oe.error("Video thumbnail not available yet");return}const Be=Ne(Re),Ye=ye(Re),ht=`Watch: ${Re.title||"Video Message"} ${Ye}`;try{const Me=new Blob([Be],{type:"text/html"}),Qe=new Blob([ht],{type:"text/plain"}),le=new ClipboardItem({"text/html":Me,"text/plain":Qe});await navigator.clipboard.write([le]),Oe.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ht+` `+Be),Oe.success("Copied! Paste into your email.")}},rt=async Re=>{try{Oe.loading("Preparing download...",{id:"download"});const{data:Be,error:Ye}=await Q.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:Re.bunny_video_id,isAgentVideo:!0}});if(Ye||!(Be!=null&&Be.downloadUrl))throw new Error((Ye==null?void 0:Ye.message)||"Failed to get download URL");const Me=`${((Re.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,Qe=await fetch(Be.downloadUrl);if(!Qe.ok)throw new Error("Failed to fetch video file");const le=await Qe.blob(),Ve=URL.createObjectURL(le),Le=document.createElement("a");Le.href=Ve,Le.download=Me,Le.rel="noreferrer",document.body.appendChild(Le),Le.click(),Le.remove(),URL.revokeObjectURL(Ve),Oe.success("Download started",{id:"download"})}catch(Be){console.error("Download error:",Be),Oe.error("Could not force download (your browser may block it).",{id:"download"})}},Te=Re=>{y(Re),w(!0)},Pe=async()=>{if(x)try{await o.mutateAsync({id:x.id,bunnyVideoId:x.bunny_video_id,hardDelete:!0}),N(!1),y(null),Oe.success("Video deleted successfully")}catch{Oe.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(te,{variant:"outline",onClick:()=>E(!0),children:[r.jsx(ho,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(te,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ke,{className:se?"border-amber-500":fe?"border-destructive":"",children:r.jsxs(et,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(HT,{className:`h-5 w-5 ${fe?"text-destructive":se?"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:[xe.toFixed(1)," MB / ",ie>=1024?`${(ie/1024).toFixed(0)} GB`:`${ie} MB`]})]}),r.jsx(Jc,{value:Math.min(pe,100),className:`h-2 ${fe?"[&>div]:bg-destructive":se?"[&>div]:bg-amber-500":""}`})]}),se&&!fe&&r.jsxs(Lt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(pl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),fe&&r.jsxs(Lt,{variant:"destructive",children:[r.jsx(pl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),fe&&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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search videos by contact, title, or notes...",value:u,onChange:Re=>p(Re.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"})}):(oe==null?void 0:oe.length)===0?r.jsx(Ke,{children:r.jsxs(et,{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:"font-semibold mb-2",children:"No videos yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),r.jsxs(te,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(_n,{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:oe==null?void 0:oe.map(Re=>{var Be,Ye;return r.jsx(LKt,{video:Re,previewSrc:(Be=K[Re.id])==null?void 0:Be.previewUrl,thumbnailSrc:(Ye=K[Re.id])==null?void 0:Ye.thumbnailUrl,onOpen:()=>Te(Re),onDelete:()=>{y(Re),N(!0)},onNavigateToContact:()=>t(`/mission-control/contacts/${Re.contact_id}`),onGetEmbedCode:()=>{y(Re),P(!0)},onCopyEmailHtml:()=>be(Re),onShareWithTemplate:()=>{y(Re),R(!0)},onSendViaGmail:()=>{y(Re),V(!0)},isGmailConnected:l,getContactName:J,getShareUrl:ye,copyToClipboard:he,formatDuration:ae},Re.id)})}),r.jsx(Dr,{open:_,onOpenChange:w,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:(x==null?void 0:x.title)||"Video Preview"}),r.jsx(Jn,{children:(x==null?void 0:x.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ac,{className:"h-3 w-3"}),J(x.contact_id)]})})]}),x&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:x.playback_url?(()=>{let Re=x.playback_url;return Re.includes("iframe.mediadelivery.net/play/")&&(Re=Re.replace("/play/","/embed/"),Re+=(Re.includes("?")?"&":"?")+"autoplay=false&responsive=true"),Re.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:Re,title:x.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:x.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:x.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>Oe.error("Video preview failed to load")},x.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Da,{className:"h-12 w-12 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>Ce(x),children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),!l&&r.jsxs(te,{variant:"outline",onClick:()=>Se(x),children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>he(ye(x),"Share link"),children:[r.jsx(tl,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(te,{variant:"outline",onClick:()=>be(x),children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(te,{variant:"outline",onClick:()=>rt(x),children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>{w(!1),R(!0)},children:[r.jsx(Rc,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]}),l&&(x==null?void 0:x.share_token)&&r.jsxs(te,{variant:"outline",onClick:()=>{w(!1),V(!0)},children:[r.jsx(eo,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(te,{variant:"destructive",onClick:()=>{w(!1),N(!0)},children:[r.jsx($n,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Dr,{open:S,onOpenChange:N,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Delete Video"}),r.jsx(Jn,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Pe,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(EKt,{open:M,onOpenChange:E}),r.jsx(Dr,{open:A,onOpenChange:P,children:r.jsxs(Or,{className:"sm:max-w-lg",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Embed Video"}),r.jsx(Jn,{children:"Copy this code to embed the video on your website."})]}),x&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Embed Code"}),r.jsx(ss,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(te,{className:"flex-1",onClick:()=>{const Re=``;he(Re,"Embed code")},children:[r.jsx(tl,{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."})]})]})}),x&&r.jsx(LUe,{open:z,onOpenChange:R,video:x,contactName:J(x.contact_id)}),x&&r.jsx(IKt,{open:U,onOpenChange:V,video:x,gmailEmail:i,signedThumbnailUrl:(Ue=K[x.id])==null?void 0:Ue.thumbnailUrl})]})})}function OUe({stages:t,currentStageId:e,onStageSelect:n,disabled:s}){const[a,o]=I.useState(!1),l=t.find(u=>u.id===e),i=u=>{u.id!==e&&n(u.id,u.name),o(!1)};return r.jsxs(Th,{open:a,onOpenChange:o,children:[r.jsx(Ah,{asChild:!0,children:r.jsxs(te,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:u=>u.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(Bi,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(eh,{align:"end",className:"w-48 z-50 bg-popover",onClick:u=>u.stopPropagation(),children:t.map(u=>{const p=u.icon&&dEe[u.icon]||Gu,x=u.id===e;return r.jsxs(ri,{onClick:()=>i(u),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:`${u.color}20`},children:r.jsx(p,{className:"h-3 w-3",style:{color:u.color}})}),r.jsx("span",{className:"flex-1",children:u.name}),x&&r.jsx(_i,{className:"h-4 w-4 text-primary"})]},u.id)})})]})}const DKt={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"}},RKt={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 DUe({deal:t,onClick:e,isDragging:n,stages:s,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var E,A;const i=S3(),u=DKt[t.deal_type],p=RKt[t.priority],x=I.useMemo(()=>t.target_close_date?_y(new Date(t.target_close_date),new Date):null,[t.target_close_date]),y=x!==null&&x<0,_=x!==null&&x<=7&&x>=0,w=I.useMemo(()=>{var R;if(t.deal_type!=="seller"&&t.deal_type!=="dual")return null;const P=((R=t.listing)==null?void 0:R.created_at)||t.listing_date;if(!P)return null;const z=t.contract_date?new Date(t.contract_date):new Date;return _y(z,new Date(P))},[t]),S=l&&!t.scorecard_transaction_id,N=!!t.scorecard_transaction_id,M=P=>P?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(P):null;return r.jsx(Ke,{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",S&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:e,children:r.jsxs(et,{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(Lt,{variant:"outline",className:zt("text-[10px] px-1.5 py-0 shrink-0",u.color),children:u.label})]}),t.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ys,{className:"h-5 w-5",children:r.jsxs(Xs,{className:"text-[10px] bg-primary/10 text-primary",children:[(E=t.contact.first_name)==null?void 0:E[0],(A=t.contact.last_name)==null?void 0:A[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(df,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),S&&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(Yi,{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"})]}),w!==null&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(UT,{className:"h-3 w-3 text-muted-foreground shrink-0"}),r.jsxs("span",{className:zt("font-medium",w>90?"text-red-600":w>60?"text-amber-600":"text-muted-foreground"),children:[w," 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(ua,{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(wd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:M(t.expected_price)}),t.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",M(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(OUe,{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(pl,{className:"h-3 w-3"}):r.jsx(Ds,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:_?`${x}d left`:mn(new Date(t.target_close_date),"MMM d")})]}):null]})]})})}function FKt({stage:t,deals:e,onDealClick:n,onAddDeal:s,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:u=!1}){const p=I.useRef(null),x=e.reduce((S,N)=>S+(N.expected_price||0),0),y=e.reduce((S,N)=>S+(N.expected_commission||0),0),_=S=>S>=1e6?`$${(S/1e6).toFixed(1)}M`:S>=1e3?`$${(S/1e3).toFixed(0)}K`:`$${S.toFixed(0)}`,w=t.icon&&dEe[t.icon]||Gu;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:S=>o(S,t.id),onDrop:S=>l(S,t.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:t.color,borderTopWidth:3},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}20`},children:r.jsx(w,{className:"h-4 w-4",style:{color:t.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:t.name})})]}),r.jsx(Lt,{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(Ro,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[e.map(S=>r.jsx("div",{draggable:!0,onDragStart:N=>{N.dataTransfer.effectAllowed="move",a(S.id,t.id)},children:r.jsx(DUe,{deal:S,onClick:()=>n(S),isWonStage:u})},S.id)),e.length===0&&r.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[r.jsx("p",{className:"mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),r.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(t.id),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function zKt({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:sy,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((t==null?void 0:t.pipelineValue)||0),icon:gc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((t==null?void 0:t.expectedCommission)||0),icon:wd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(t==null?void 0:t.wonDeals)||0,icon:Yi,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(Ke,{className:"animate-pulse",children:r.jsx(et,{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(Ke,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(et,{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 BKt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],$Kt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function UKt({open:t,onOpenChange:e,deal:n,defaultStageId:s}){const{data:a}=i1e(),{data:o}=mp(),{data:l}=dDe(),i=IUe(),u=PUe(),[p,x]=I.useState(""),[y,_]=I.useState(!1),w=(l==null?void 0:l.filter(z=>((n==null?void 0:n.listing_id)===z.id,!0)))||[],[S,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,R,U;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:((R=n.commission_percentage)==null?void 0:R.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||((U=a==null?void 0:a[0])==null?void 0:U.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 M=o==null?void 0:o.filter(z=>{var U,V,K;const R=p.toLowerCase();return((U=z.first_name)==null?void 0:U.toLowerCase().includes(R))||((V=z.last_name)==null?void 0:V.toLowerCase().includes(R))||((K=z.email)==null?void 0:K.toLowerCase().includes(R))}).slice(0,5),E=()=>{const z=parseFloat(S.expected_price)||0,R=parseFloat(S.commission_percentage)||0;return z*(R/100)},A=async z=>{var R,U,V;if(z.preventDefault(),!S.deal_name.trim()){Oe.error("Please enter a deal name");return}try{const K={deal_name:S.deal_name,deal_type:S.deal_type,stage_id:S.stage_id||null,contact_id:S.contact_id||null,listing_id:S.listing_id||null,property_address:S.property_address||null,city:S.city||null,state:S.state||null,zip_code:S.zip_code||null,expected_price:S.expected_price?parseFloat(S.expected_price):null,expected_commission:E()||null,commission_percentage:S.commission_percentage?parseFloat(S.commission_percentage):3,target_close_date:((R=S.target_close_date)==null?void 0:R.toISOString().split("T")[0])||null,contract_date:((U=S.contract_date)==null?void 0:U.toISOString().split("T")[0])||null,listing_date:((V=S.listing_date)==null?void 0:V.toISOString().split("T")[0])||null,priority:S.priority,probability:parseInt(S.probability)||50,notes:S.notes||null};n?(await u.mutateAsync({id:n.id,...K}),Oe.success("Deal updated successfully")):(await i.mutateAsync(K),Oe.success("Deal created successfully")),e(!1)}catch{Oe.error("Failed to save deal")}},P=i.isPending||u.isPending;return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(Jn,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:A,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(qe,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(ot,{id:"deal_name",value:S.deal_name,onChange:z=>N(R=>({...R,deal_name:z.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Deal Type"}),r.jsxs(xn,{value:S.deal_type,onValueChange:z=>N(R=>({...R,deal_type:z})),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:BKt.map(z=>r.jsx(qt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Stage"}),r.jsxs(xn,{value:S.stage_id,onValueChange:z=>N(R=>({...R,stage_id:z})),children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:p,onChange:z=>{x(z.target.value),_(!0),z.target.value||N(R=>({...R,contact_id:""}))},onFocus:()=>_(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&p&&M&&M.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:M.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(R=>({...R,contact_id:z.id})),x(`${z.first_name} ${z.last_name}`),_(!1)},children:[r.jsx(ac,{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))})]})]}),w.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{className:"flex items-center gap-2",children:[r.jsx(df,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(xn,{value:S.listing_id,onValueChange:z=>{const R=w.find(U=>U.id===z);N(R?U=>{var V;return{...U,listing_id:z,deal_type:"seller",property_address:R.property_address||U.property_address,city:R.city||U.city,state:R.state||U.state,expected_price:((V=R.price)==null?void 0:V.toString())||U.expected_price}}:U=>({...U,listing_id:z}))},children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"",children:"None"}),w.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(qe,{htmlFor:"property_address",children:"Address"}),r.jsx(ot,{id:"property_address",value:S.property_address,onChange:z=>N(R=>({...R,property_address:z.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"city",children:"City"}),r.jsx(ot,{id:"city",value:S.city,onChange:z=>N(R=>({...R,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(qe,{htmlFor:"state",children:"State"}),r.jsx(ot,{id:"state",value:S.state,onChange:z=>N(R=>({...R,state:z.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(ot,{id:"zip_code",value:S.zip_code,onChange:z=>N(R=>({...R,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(qe,{htmlFor:"expected_price",children:"Expected Price"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(ot,{id:"expected_price",type:"number",value:S.expected_price,onChange:z=>N(R=>({...R,expected_price:z.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(ot,{id:"commission_percentage",type:"number",step:"0.1",value:S.commission_percentage,onChange:z=>N(R=>({...R,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(qe,{children:"Expected GCI"}),r.jsx(ot,{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(qe,{children:"Target Close Date"}),r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!S.target_close_date&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),S.target_close_date?mn(S.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:S.target_close_date,onSelect:z=>N(R=>({...R,target_close_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Contract Date"}),r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!S.contract_date&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),S.contract_date?mn(S.contract_date,"PPP"):"Pick a date"]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:S.contract_date,onSelect:z=>N(R=>({...R,contract_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),(S.deal_type==="seller"||S.deal_type==="dual")&&!S.listing_id&&r.jsxs("div",{className:"space-y-2 col-span-2",children:[r.jsx(qe,{children:"Listing Date (for Days on Market)"}),r.jsxs(Cd,{children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!S.listing_date&&"text-muted-foreground"),children:[r.jsx(Ds,{className:"mr-2 h-4 w-4"}),S.listing_date?mn(S.listing_date,"PPP"):"Pick a date"]})}),r.jsx(ed,{className:"w-auto p-0",align:"start",children:r.jsx(ly,{mode:"single",selected:S.listing_date,onSelect:z=>N(R=>({...R,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(qe,{children:"Priority"}),r.jsxs(xn,{value:S.priority,onValueChange:z=>N(R=>({...R,priority:z})),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:$Kt.map(z=>r.jsx(qt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(ot,{type:"number",min:"0",max:"100",value:S.probability,onChange:z=>N(R=>({...R,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(qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ss,{id:"notes",value:S.notes,onChange:z=>N(R=>({...R,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(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:P,children:[P&&r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const qKt={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"}},VKt={note:Do,call:ji,email:ws,meeting:Ds,stage_change:Os,task_completed:Xi,document:ua,system:Wa};function HKt({deal:t,open:e,onOpenChange:n,onEdit:s,onAddToScorecard:a,isWonStage:o}){var xe,ie;const{data:l,isLoading:i}=dKt((t==null?void 0:t.id)||""),{data:u,isLoading:p}=hKt((t==null?void 0:t.id)||""),x=uKt(),y=pKt(),_=fKt(),w=cKt(),[S,N]=I.useState(""),[M,E]=I.useState(""),[A,P]=I.useState(!1);if(!t)return null;const z=qKt[t.deal_type],R=(()=>{var fe;if(t.deal_type!=="seller"&&t.deal_type!=="dual")return null;const pe=((fe=t.listing)==null?void 0:fe.created_at)||t.listing_date;if(!pe)return null;const se=t.contract_date?new Date(t.contract_date):new Date;return _y(se,new Date(pe))})(),U=pe=>pe?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(pe):"-",V=async()=>{if(S.trim())try{await x.mutateAsync({deal_id:t.id,activity_type:"note",title:"Note added",description:S}),N(""),Oe.success("Note added")}catch{Oe.error("Failed to add note")}},K=async()=>{if(M.trim())try{await y.mutateAsync({deal_id:t.id,title:M,sort_order:((u==null?void 0:u.length)||0)+1}),E(""),Oe.success("Task added")}catch{Oe.error("Failed to add task")}},W=async(pe,se)=>{try{await _.mutateAsync({id:pe,is_completed:se,deal_id:t.id})}catch{Oe.error("Failed to update task")}},J=async()=>{try{await w.mutateAsync(t.id),Oe.success("Deal deleted"),n(!1)}catch{Oe.error("Failed to delete deal")}},ae=(u==null?void 0:u.filter(pe=>pe.is_completed).length)||0,oe=(u==null?void 0:u.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(xse,{open:e,onOpenChange:n,children:r.jsxs(BI,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(yse,{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(Lt,{variant:"outline",className:zt("text-xs",z.color),children:z.label}),r.jsxs(Lt,{variant:"secondary",className:"text-xs capitalize",children:[t.priority," priority"]})]}),r.jsx(vse,{className:"text-xl",children:t.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>s(t),children:r.jsx(hc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>P(!0),children:r.jsx($n,{className:"h-4 w-4"})})]})]})}),r.jsx(Ro,{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(Ys,{className:"h-10 w-10",children:r.jsxs(Xs,{className:"bg-primary/10 text-primary",children:[(xe=t.contact.first_name)==null?void 0:xe[0],(ie=t.contact.last_name)==null?void 0:ie[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[t.contact.first_name," ",t.contact.last_name]}),t.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[t.contact.phone&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${t.contact.phone}`,children:r.jsx(ji,{className:"h-4 w-4"})})}),t.contact.email&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${t.contact.email}`,children:r.jsx(ws,{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(ua,{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:U(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:U(t.expected_commission)})]}),o&&!t.scorecard_transaction_id&&a&&r.jsxs(te,{onClick:()=>a(t),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(Yi,{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"})]}),R!==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",R>90?"text-red-600":R>60?"text-amber-600":"text-foreground"),children:[R," ",t.contract_date?"(final)":"days"]})]}),t.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ds,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",mn(new Date(t.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(wd,{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(ki,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(pi,{className:"w-full grid grid-cols-2",children:[r.jsxs(rn,{value:"tasks",className:"gap-1",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Tasks ",oe>0&&`(${ae}/${oe})`]}),r.jsxs(rn,{value:"activity",className:"gap-1",children:[r.jsx(Wa,{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(ot,{placeholder:"Add a new task...",value:M,onChange:pe=>E(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&K()}),r.jsx(te,{onClick:K,disabled:!M.trim(),children:r.jsx(_n,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[u==null?void 0:u.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(Fl,{checked:pe.is_completed,onCheckedChange:se=>W(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:mn(new Date(pe.due_date),"MMM d")})]},pe.id)),(u==null?void 0:u.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(ss,{placeholder:"Add a note...",value:S,onChange:pe=>N(pe.target.value),rows:2}),r.jsxs(te,{onClick:V,disabled:!S.trim(),size:"sm",className:"w-full",children:[r.jsx(eo,{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=VKt[pe.activity_type]||Wa;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:gu(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(pu,{open:A,onOpenChange:P,children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Delete Deal?"}),r.jsxs(Zd,{children:['This will permanently delete "',t.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function WKt({open:t,onOpenChange:e,deal:n,onComplete:s}){const a=Fse(),o=PUe(),{data:l}=Rse(),{data:i}=Lm(),[u,p]=I.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:mn(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",w=n.expected_price||0,S=n.commission_percentage||3,N=n.expected_commission||w*S/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||mn(new Date,"yyyy-MM-dd"),sale_price:w,commission_amount:N,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,t]);const x=async _=>{if(_.preventDefault(),!!n)try{const w=await a.mutateAsync({property_address:u.property_address,city:u.city||null,state:u.state||null,zip:u.zip||null,transaction_type:u.transaction_type,close_date:u.close_date,sale_price:u.sale_price,commission_amount:u.commission_amount||null,lead_source_id:u.lead_source_id||null,client_type_id:u.client_type_id||null,contact_id:n.contact_id||null,notes:u.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:w.id,actual_close_date:u.close_date}),Oe.success("Deal added to Scorecard! 🎉"),e(!1),s==null||s()}catch(w){console.error("Error syncing to scorecard:",w),Oe.error("Failed to add to scorecard")}},y=_=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(_);return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{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(Yi,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(zr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Jn,{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(qe,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(ot,{id:"property_address",value:u.property_address,onChange:_=>p(w=>({...w,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(qe,{htmlFor:"city",children:"City"}),r.jsx(ot,{id:"city",value:u.city,onChange:_=>p(w=>({...w,city:_.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"state",children:"State"}),r.jsx(ot,{id:"state",value:u.state,onChange:_=>p(w=>({...w,state:_.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"zip",children:"Zip"}),r.jsx(ot,{id:"zip",value:u.zip,onChange:_=>p(w=>({...w,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(qe,{children:"Transaction Type *"}),r.jsxs(xn,{value:u.transaction_type,onValueChange:_=>p(w=>({...w,transaction_type:_})),children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(qe,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(ot,{id:"close_date",type:"date",value:u.close_date,onChange:_=>p(w=>({...w,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(qe,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(wd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(ot,{id:"sale_price",type:"number",value:u.sale_price||"",onChange:_=>p(w=>({...w,sale_price:Number(_.target.value)})),placeholder:"450000",required:!0,min:0}),u.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(u.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(qe,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(jS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(ot,{id:"commission_amount",type:"number",value:u.commission_amount||"",onChange:_=>p(w=>({...w,commission_amount:Number(_.target.value)})),placeholder:"13500",min:0}),u.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(u.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Lead Source"}),r.jsxs(xn,{value:u.lead_source_id,onValueChange:_=>p(w=>({...w,lead_source_id:_})),children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{children:"Client Type"}),r.jsxs(xn,{value:u.client_type_id,onValueChange:_=>p(w=>({...w,client_type_id:_})),children:[r.jsx(fn,{children:r.jsx(vn,{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(qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ss,{id:"notes",value:u.notes,onChange:_=>p(w=>({...w,notes:_.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(Ws,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Skip for now"}),r.jsx(te,{type:"submit",disabled: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(Jo,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const GKt={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"}},lMe={urgent:0,high:1,medium:2,low:3};function KKt({deals:t,stages:e,onDealClick:n,onStageChange:s}){const[a,o]=I.useState("target_close_date"),[l,i]=I.useState("asc"),u=w=>{a===w?i(S=>S==="asc"?"desc":"asc"):(o(w),i("asc"))},p=I.useMemo(()=>[...t].sort((w,S)=>{var M,E;let N=0;switch(a){case"deal_name":N=w.deal_name.localeCompare(S.deal_name);break;case"stage":{const A=((M=e.find(z=>z.id===w.stage_id))==null?void 0:M.sort_order)||0,P=((E=e.find(z=>z.id===S.stage_id))==null?void 0:E.sort_order)||0;N=A-P;break}case"expected_price":N=(w.expected_price||0)-(S.expected_price||0);break;case"expected_commission":N=(w.expected_commission||0)-(S.expected_commission||0);break;case"target_close_date":{const A=w.target_close_date?new Date(w.target_close_date).getTime():1/0,P=S.target_close_date?new Date(S.target_close_date).getTime():1/0;N=A-P;break}case"priority":N=lMe[w.priority]-lMe[S.priority];break}return l==="asc"?N:-N}),[t,e,a,l]),x=w=>w?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(w):"—",y=w=>w?e.find(S=>S.id===w):null,_=({field:w,children:S})=>r.jsxs(te,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>u(w),children:[S,a===w?l==="asc"?r.jsx(ep,{className:"ml-2 h-4 w-4"}):r.jsx(Xx,{className:"ml-2 h-4 w-4"}):r.jsx(jg,{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(Mr,{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(w=>{y(w.stage_id);const S=GKt[w.deal_type],N=w.target_close_date?_y(new Date(w.target_close_date),new Date):null,M=N!==null&&N<0,E=N!==null&&N<=7&&N>=0;return r.jsxs(Mr,{className:zt("cursor-pointer hover:bg-muted/50 transition-colors",M&&"bg-red-50/50"),onClick:()=>n(w),children:[r.jsx(jt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:w.deal_name}),w.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[w.contact.first_name," ",w.contact.last_name]})]})}),r.jsx(jt,{onClick:A=>A.stopPropagation(),children:r.jsx(OUe,{stages:e,currentStageId:w.stage_id||"",onStageSelect:(A,P)=>s(w.id,A,P)})}),r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",className:zt("text-xs",S.color),children:S.label})}),r.jsx(jt,{children:r.jsx("span",{className:"font-medium",children:x(w.expected_price)})}),r.jsx(jt,{children:r.jsx("span",{className:"text-emerald-600",children:x(w.expected_commission)})}),r.jsx(jt,{children:w.target_close_date?r.jsxs("div",{className:zt("flex items-center gap-1 text-sm",M&&"text-red-600",E&&!M&&"text-amber-600"),children:[M&&r.jsx(pl,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:mn(new Date(w.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",className:zt("text-xs capitalize",w.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",w.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",w.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",w.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:w.priority})})]},w.id)})})]})})}function ZKt(){var Ne;const t=S3(),{data:e,isLoading:n}=i1e(),{data:s,isLoading:a,refetch:o}=EUe(),{data:l,isLoading:i}=mKt(),u=AUe(),p=lKt(),[x,y]=I.useState("board"),[_,w]=I.useState(!1),[S,N]=I.useState(!1),[M,E]=I.useState(null),[A,P]=I.useState(null),[z,R]=I.useState(null),[U,V]=I.useState(null),[K,W]=I.useState(!1),[J,ae]=I.useState(null);I.useEffect(()=>{!n&&e&&e.length===0&&u.mutate()},[n,e]);const oe=be=>{E(be),N(!0)},xe=be=>{P(be||null),E(null),w(!0)},ie=be=>{E(be),N(!1),w(!0)},pe=(be,rt)=>{R(be)},se=(be,rt)=>{be.preventDefault(),be.dataTransfer.dropEffect="move",V(rt)},fe=async(be,rt)=>{if(be.preventDefault(),V(null),!z)return;const Te=s==null?void 0:s.find(Ue=>Ue.id===z),Pe=e==null?void 0:e.find(Ue=>Ue.id===rt);if(!Te||!Pe||Te.stage_id===rt){R(null);return}try{if(await p.mutateAsync({dealId:z,stageId:rt,stageName:Pe.name}),Oe.success(`Moved to ${Pe.name}`),Pe.is_won_stage&&!Te.scorecard_transaction_id){const Ue={...Te,stage_id:rt};ae(Ue),W(!0)}}catch{Oe.error("Failed to move deal")}R(null)},he=I.useCallback(async(be,rt,Te)=>{const Pe=s==null?void 0:s.find(Re=>Re.id===be),Ue=e==null?void 0:e.find(Re=>Re.id===rt);if(!(!Pe||!Ue||Pe.stage_id===rt))try{if(await p.mutateAsync({dealId:be,stageId:rt,stageName:Te}),Oe.success(`Moved to ${Te}`),Ue.is_won_stage&&!Pe.scorecard_transaction_id){const Re={...Pe,stage_id:rt};ae(Re),W(!0)}}catch{Oe.error("Failed to move deal")}},[s,e,p]),ye=be=>(s==null?void 0:s.filter(rt=>rt.stage_id===be))||[],Ce=n||a,Se=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(te,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Ll,{className:"h-4 w-4"})}),!t&&r.jsx(AI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:r.jsxs(te,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[r.jsx(tp,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(Nm,{children:"Kanban board view"})]}),r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:r.jsxs(te,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(rp,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(Nm,{children:"Grouped list view"})]}),r.jsxs(Lg,{children:[r.jsx(Og,{asChild:!0,children:r.jsxs(te,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(SS,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(Nm,{children:"Sortable table view"})]})]})}),r.jsxs(te,{onClick:()=>xe(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(zKt,{stats:l||null,isLoading:i})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ce?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(be=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Ir,{className:"h-full rounded-xl"})},be))}):Se==="board"?r.jsxs(Ro,{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(be=>r.jsx(FKt,{stage:be,deals:ye(be.id),onDealClick:oe,onAddDeal:xe,onDragStart:pe,onDragOver:se,onDrop:fe,isDragOver:U===be.id,isWonStage:be.is_won_stage},be.id))}),r.jsx(mxe,{orientation:"horizontal"})]}):Se==="table"?r.jsx(Ro,{className:"h-full",children:r.jsx(KKt,{deals:s||[],stages:e||[],onDealClick:oe,onStageChange:he})}):r.jsx(Ro,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[e==null?void 0:e.map(be=>{const rt=ye(be.id);return rt.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:be.color}}),r.jsx("h3",{className:"font-semibold",children:be.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",rt.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:rt.map(Te=>r.jsx(DUe,{deal:Te,onClick:()=>oe(Te),stages:e,onStageChange:he,showStagePicker:!0,isWonStage:be.is_won_stage},Te.id))})]},be.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(tp,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),r.jsxs(te,{onClick:()=>xe(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(UKt,{open:_,onOpenChange:w,deal:M,defaultStageId:A}),r.jsx(HKt,{deal:M,open:S,onOpenChange:N,onEdit:ie,isWonStage:M?(Ne=e==null?void 0:e.find(be=>be.id===M.stage_id))==null?void 0:Ne.is_won_stage:!1,onAddToScorecard:be=>{ae(be),W(!0),N(!1)}}),r.jsx(WKt,{open:K,onOpenChange:W,deal:J,onComplete:()=>{o(),ae(null)}})]})}const lme=[{value:"video_intro",label:"Video Intro",icon:Da,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:QT,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:Eg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:df,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:_c,description:"Links to your social profiles"}],YKt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],XKt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function RUe({cardId:t}){const{data:e,isLoading:n}=Hot(t),s=Wot(),a=Got(),o=Kot(),[l,i]=I.useState(!1),[u,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 _=()=>{u&&s.mutate({card_id:t,block_type:u,sort_order:(e==null?void 0:e.length)||0,config:XKt[u]||{}},{onSuccess:()=>{i(!1),p("")}})},w=A=>{a.mutate({id:A.id,is_visible:!A.is_visible})},S=(A,P)=>{if(!e)return;const z=e.findIndex(V=>V.id===A.id),R=P==="up"?z-1:z+1;if(R<0||R>=e.length)return;const U=e[R];a.mutate({id:A.id,sort_order:U.sort_order}),a.mutate({id:U.id,sort_order:A.sort_order})},N=A=>{confirm("Remove this block from this card?")&&o.mutate(A.id)},M=(A,P)=>{a.mutate({id:A.id,config:P},{onSuccess:()=>y(null)})},E=A=>lme.find(P=>P.value===A);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(te,{size:"sm",onClick:()=>i(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[e.map((A,P)=>{const z=E(A.block_type),R=(z==null?void 0:z.icon)||Eg;return r.jsx(Ke,{className:A.is_visible?"":"opacity-50",children:r.jsx(et,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(D1,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(R,{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)||A.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:QKt(A)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>S(A,"up"),disabled:P===0,children:r.jsx(ep,{className:"h-3 w-3"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>S(A,"down"),disabled:P===e.length-1,children:r.jsx(Xx,{className:"h-3 w-3"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>w(A),children:A.is_visible?r.jsx($o,{className:"h-3 w-3"}):r.jsx(E1,{className:"h-3 w-3"})}),r.jsx(te,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(A),children:"Edit"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>N(A),children:r.jsx($n,{className:"h-3 w-3"})})]})]})})},A.id)}),r.jsxs(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:lme.map(A=>{const P=A.icon;return r.jsxs("button",{onClick:()=>p(A.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${u===A.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:A.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:A.description})]})]},A.value)})}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{onClick:_,disabled:!u||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(JKt,{block:x,onSave:A=>M(x,A),onClose:()=>y(null)})]})}function QKt(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 JKt({block:t,onSave:e,onClose:n}){const[s,a]=I.useState(t.config),o=lme.find(l=>l.value===t.block_type);return r.jsx(Dr,{open:!0,onOpenChange:n,children:r.jsxs(Or,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsxs(zr,{children:["Edit ",o==null?void 0:o.label]})}),t.block_type==="video_intro"&&r.jsx(eZt,{config:s,onChange:a,cardId:t.card_id}),t.block_type==="testimonials"&&r.jsx(tZt,{config:s,onChange:a}),t.block_type==="specialties"&&r.jsx(rZt,{config:s,onChange:a}),t.block_type==="custom_links"&&r.jsx(nZt,{config:s,onChange:a}),t.block_type==="social_media"&&r.jsx(sZt,{config:s,onChange:a}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(te,{onClick:()=>e(s),children:"Save"})]})]})})}function eZt({config:t,onChange:e,cardId:n}){var w,S;const[s,a]=I.useState(""),[o,l]=I.useState((w=t.video_url)!=null&&w.includes("youtube")||(S=t.video_url)!=null&&S.includes("youtu.be")?"youtube":"library"),{data:i}=Kt({queryKey:["card-owner",n],queryFn:async()=>{const{data:N}=await Q.from("agent_cards").select("user_id").eq("id",n).single();return N==null?void 0:N.user_id},enabled:!!n}),{data:u,isLoading:p}=Kt({queryKey:["agent-videos-library",i],queryFn:async()=>{const{data:N,error:M}=await Q.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(M)throw M;return N||[]},enabled:!!i}),x=(u==null?void 0:u.filter(N=>!s||(N.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=t.bunny_video_id,_=N=>{var P;const M=(P=N.playback_url)==null?void 0:P.match(/\/(?:play|embed)\/(\d+)\//),A=`https://iframe.mediadelivery.net/embed/${M?M[1]:"570924"}/${N.bunny_video_id}?autoplay=false&responsive=true`;e({...t,video_url:A,bunny_video_id:N.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(ki,{value:o,onValueChange:l,children:[r.jsxs(pi,{className:"w-full",children:[r.jsx(rn,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(rn,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search videos...",value:s,onChange:N=>a(N.target.value),className:"pl-9"})]}),r.jsx(Ro,{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:(u==null?void 0:u.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:M=>{var E;M.currentTarget.style.display="none",(E=M.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(Da,{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(_i,{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(qe,{children:"YouTube URL"}),r.jsx(ot,{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 tZt({config:t,onChange:e}){const n=t.testimonials||[],s=(l,i,u)=>{const p=[...n];p[l]={...p[l],[i]:u},e({...t,testimonials:p})},a=()=>e({...t,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>e({...t,testimonials:n.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,i)=>r.jsx(Ke,{children:r.jsxs(et,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(qe,{className:"text-xs font-medium",children:["Testimonial ",i+1]}),n.length>1&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:r.jsx($n,{className:"h-3 w-3"})})]}),r.jsx(ot,{placeholder:"Client name",value:l.name,onChange:u=>s(i,"name",u.target.value)}),r.jsx(ot,{placeholder:"Role/title (optional)",value:l.role||"",onChange:u=>s(i,"role",u.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:u=>s(i,"quote",u.target.value)})]})},i)),r.jsxs(te,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function rZt({config:t,onChange:e}){const n=t.tags||[],[s,a]=I.useState(""),o=i=>{e({...t,tags:n.includes(i)?n.filter(u=>u!==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(qe,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:YKt.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(qe,{className:"text-sm mb-2 block",children:"Custom Tag"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Add your own...",value:s,onChange:i=>a(i.target.value),onKeyDown:i=>i.key==="Enter"&&(i.preventDefault(),l())}),r.jsx(te,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsxs(qe,{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 nZt({config:t,onChange:e}){const n=t.links||[],s=(l,i,u)=>{const p=[...n];p[l]={...p[l],[i]:u},e({...t,links:p})},a=()=>e({...t,links:[...n,{label:"",url:""}]}),o=l=>e({...t,links:n.filter((i,u)=>u!==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(ot,{placeholder:"Button label",value:l.label,onChange:u=>s(i,"label",u.target.value)}),r.jsx(ot,{placeholder:"https://...",value:l.url,onChange:u=>s(i,"url",u.target.value)})]}),n.length>1&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:r.jsx($n,{className:"h-3 w-3"})})]},i)),r.jsxs(te,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const cMe=[{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 sZt({config:t,onChange:e}){const n=t.platforms||[],s=u=>{n.find(p=>p.platform===u)||e({...t,platforms:[...n,{platform:u,url:""}]})},a=(u,p)=>{const x=[...n];x[u]={...x[u],url:p},e({...t,platforms:x})},o=u=>{e({...t,platforms:n.filter((p,x)=>x!==u)})},l=cMe.filter(u=>!n.find(p=>p.platform===u.value)),i=u=>{const p=Che[u],x=cMe.find(y=>y.value===u);return{label:(x==null?void 0:x.label)||u,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((u,p)=>{const x=i(u.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(ot,{placeholder:`Your ${x.label} profile URL`,value:u.url,onChange:y=>a(p,y.target.value)})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(p),children:r.jsx($n,{className:"h-3.5 w-3.5"})})]},p)})}),l.length>0&&r.jsxs("div",{children:[r.jsx(qe,{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(u=>{const p=Che[u.value];return r.jsxs("button",{onClick:()=>s(u.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})}),u.label]},u.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 aZt=Object.defineProperty,Nne=Object.getOwnPropertySymbols,FUe=Object.prototype.hasOwnProperty,zUe=Object.prototype.propertyIsEnumerable,dMe=(t,e,n)=>e in t?aZt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,cme=(t,e)=>{for(var n in e||(e={}))FUe.call(e,n)&&dMe(t,n,e[n]);if(Nne)for(var n of Nne(e))zUe.call(e,n)&&dMe(t,n,e[n]);return t},dme=(t,e)=>{var n={};for(var s in t)FUe.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&Nne)for(var s of Nne(t))e.indexOf(s)<0&&zUe.call(t,s)&&(n[s]=t[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var fk;(t=>{const e=class Ai{constructor(u,p,x,y){if(this.version=u,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],uAi.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=u*4+17;let _=[];for(let S=0;S7)throw new RangeError("Invalid value");let S,N;for(S=x;;S++){const P=Ai.getNumDataCodewords(S,p)*8,z=l.getTotalBits(u,S);if(z<=P){N=z;break}if(S>=y)throw new RangeError("Data too long")}for(const P of[Ai.Ecc.MEDIUM,Ai.Ecc.QUARTILE,Ai.Ecc.HIGH])w&&N<=Ai.getNumDataCodewords(S,P)*8&&(p=P);let M=[];for(const P of u){n(P.mode.modeBits,4,M),n(P.numChars,P.mode.numCharCountBits(S),M);for(const z of P.getData())M.push(z)}a(M.length==N);const E=Ai.getNumDataCodewords(S,p)*8;a(M.length<=E),n(0,Math.min(4,E-M.length),M),n(0,(8-M.length%8)%8,M),a(M.length%8==0);for(let P=236;M.lengthA[z>>>3]|=P<<7-(z&7)),new Ai(S,p,A,_)}getModule(u,p){return 0<=u&&u>>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 u=this.version;for(let x=0;x<12;x++)u=u<<1^(u>>>11)*7973;const p=this.version<<12|u;a(p>>>18==0);for(let x=0;x<18;x++){const y=s(p,x),_=this.size-11+x%3,w=Math.floor(x/3);this.setFunctionModule(_,w,y),this.setFunctionModule(w,_,y)}}drawFinderPattern(u,p){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const _=Math.max(Math.abs(y),Math.abs(x)),w=u+y,S=p+x;0<=w&&w{(P!=N-_||R>=S)&&A.push(z[P])});return a(A.length==w),A}drawCodewords(u){if(u.length!=Math.floor(Ai.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==u.length*8)}applyMask(u){if(u<0||u>7)throw new RangeError("Mask value out of range");for(let p=0;p5&&u++):(this.finderPenaltyAddHistory(S,N),w||(u+=this.finderPenaltyCountPatterns(N)*Ai.PENALTY_N3),w=this.modules[_][M],S=1);u+=this.finderPenaltyTerminateAndCount(w,S,N)*Ai.PENALTY_N3}for(let _=0;_5&&u++):(this.finderPenaltyAddHistory(S,N),w||(u+=this.finderPenaltyCountPatterns(N)*Ai.PENALTY_N3),w=this.modules[M][_],S=1);u+=this.finderPenaltyTerminateAndCount(w,S,N)*Ai.PENALTY_N3}for(let _=0;_w+(S?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),u+=y*Ai.PENALTY_N4,a(0<=u&&u<=2568888),u}getAlignmentPatternPositions(){if(this.version==1)return[];{const u=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(u*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthAi.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*u+128)*u+64;if(u>=2){const x=Math.floor(u/7)+2;p-=(25*x-10)*x-55,u>=7&&(p-=36)}return a(208<=p&&p<=29648),p}static getNumDataCodewords(u,p){return Math.floor(Ai.getNumRawDataModules(u)/8)-Ai.ECC_CODEWORDS_PER_BLOCK[p.ordinal][u]*Ai.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][u]}static reedSolomonComputeDivisor(u){if(u<1||u>255)throw new RangeError("Degree out of range");let p=[];for(let y=0;y0);for(const y of u){const _=y^x.shift();x.push(0),p.forEach((w,S)=>x[S]^=Ai.reedSolomonMultiply(w,_))}return x}static reedSolomonMultiply(u,p){if(u>>>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)*u;return a(x>>>8==0),x}finderPenaltyCountPatterns(u){const p=u[1];a(p<=this.size*3);const x=p>0&&u[2]==p&&u[3]==p*3&&u[4]==p&&u[5]==p;return(x&&u[0]>=p*4&&u[6]>=p?1:0)+(x&&u[6]>=p*4&&u[0]>=p?1:0)}finderPenaltyTerminateAndCount(u,p,x){return u&&(this.finderPenaltyAddHistory(p,x),p=0),p+=this.size,this.finderPenaltyAddHistory(p,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(u,p){p[0]==0&&(u+=this.size),p.pop(),p.unshift(u)}};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,u,p){if(u<0||u>31||i>>>u)throw new RangeError("Value out of range");for(let x=u-1;x>=0;x--)p.push(i>>>x&1)}function s(i,u){return(i>>>u&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class Kl{constructor(u,p,x){if(this.mode=u,this.numChars=p,this.bitData=x,p<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(u){let p=[];for(const x of u)n(x,8,p);return new Kl(Kl.Mode.BYTE,u.length,p)}static makeNumeric(u){if(!Kl.isNumeric(u))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(u){u=encodeURI(u);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={}))})(fk||(fk={}));(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={}))})(fk||(fk={}));var eS=fk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var iZt={L:eS.QrCode.Ecc.LOW,M:eS.QrCode.Ecc.MEDIUM,Q:eS.QrCode.Ecc.QUARTILE,H:eS.QrCode.Ecc.HIGH},BUe=128,$Ue="L",UUe="#FFFFFF",qUe="#000000",VUe=!1,HUe=1,oZt=4,lZt=0,cZt=.1;function WUe(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 GUe(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 dZt(t,e,n,s){if(s==null)return null;const a=t.length+n*2,o=Math.floor(e*cZt),l=a/e,i=(s.width||o)*l,u=(s.height||o)*l,p=s.x==null?t.length/2-i/2:s.x*l,x=s.y==null?t.length/2-u/2:s.y*l,y=s.opacity==null?1:s.opacity;let _=null;if(s.excavate){let S=Math.floor(p),N=Math.floor(x),M=Math.ceil(i+p-S),E=Math.ceil(u+x-N);_={x:S,y:N,w:M,h:E}}const w=s.crossOrigin;return{x:p,y:x,h:u,w:i,excavation:_,opacity:y,crossOrigin:w}}function uZt(t,e){return e!=null?Math.max(Math.floor(e),0):t?oZt:lZt}function KUe({value:t,level:e,minVersion:n,includeMargin:s,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let u=it.useMemo(()=>{const S=(Array.isArray(t)?t:[t]).reduce((N,M)=>(N.push(...eS.QrSegment.makeSegments(M)),N),[]);return eS.QrCode.encodeSegments(S,iZt[e],n,void 0,void 0,i)},[t,e,n,i]);const{cells:p,margin:x,numCells:y,calculatedImageSettings:_}=it.useMemo(()=>{let w=u.getModules();const S=uZt(s,a),N=w.length+S*2,M=dZt(w,l,S,o);return{cells:w,margin:S,numCells:N,calculatedImageSettings:M}},[u,l,o,s,a]);return{qrcode:u,margin:x,cells:p,numCells:y,calculatedImageSettings:_}}var hZt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),fZt=it.forwardRef(function(e,n){const s=e,{value:a,size:o=BUe,level:l=$Ue,bgColor:i=UUe,fgColor:u=qUe,includeMargin:p=VUe,minVersion:x=HUe,boostLevel:y,marginSize:_,imageSettings:w}=s,N=dme(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:M}=N,E=dme(N,["style"]),A=w==null?void 0:w.src,P=it.useRef(null),z=it.useRef(null),R=it.useCallback(ie=>{P.current=ie,typeof n=="function"?n(ie):n&&(n.current=ie)},[n]),[U,V]=it.useState(!1),{margin:K,cells:W,numCells:J,calculatedImageSettings:ae}=KUe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:_,imageSettings:w,size:o});it.useEffect(()=>{if(P.current!=null){const ie=P.current,pe=ie.getContext("2d");if(!pe)return;let se=W;const fe=z.current,he=ae!=null&&fe!==null&&fe.complete&&fe.naturalHeight!==0&&fe.naturalWidth!==0;he&&ae.excavation!=null&&(se=GUe(W,ae.excavation));const ye=window.devicePixelRatio||1;ie.height=ie.width=o*ye;const Ce=o/J*ye;pe.scale(Ce,Ce),pe.fillStyle=i,pe.fillRect(0,0,J,J),pe.fillStyle=u,hZt?pe.fill(new Path2D(WUe(se,K))):W.forEach(function(Se,Ne){Se.forEach(function(be,rt){be&&pe.fillRect(rt+K,Ne+K,1,1)})}),ae&&(pe.globalAlpha=ae.opacity),he&&pe.drawImage(fe,ae.x+K,ae.y+K,ae.w,ae.h)}}),it.useEffect(()=>{V(!1)},[A]);const oe=cme({height:o,width:o},M);let xe=null;return A!=null&&(xe=it.createElement("img",{src:A,key:A,style:{display:"none"},onLoad:()=>{V(!0)},ref:z,crossOrigin:ae==null?void 0:ae.crossOrigin})),it.createElement(it.Fragment,null,it.createElement("canvas",cme({style:oe,height:o,width:o,ref:R,role:"img"},E)),xe)});fZt.displayName="QRCodeCanvas";var ZUe=it.forwardRef(function(e,n){const s=e,{value:a,size:o=BUe,level:l=$Ue,bgColor:i=UUe,fgColor:u=qUe,includeMargin:p=VUe,minVersion:x=HUe,boostLevel:y,title:_,marginSize:w,imageSettings:S}=s,N=dme(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:M,cells:E,numCells:A,calculatedImageSettings:P}=KUe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:w,imageSettings:S,size:o});let z=E,R=null;S!=null&&P!=null&&(P.excavation!=null&&(z=GUe(E,P.excavation)),R=it.createElement("image",{href:S.src,height:P.h,width:P.w,x:P.x+M,y:P.y+M,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const U=WUe(z,M);return it.createElement("svg",cme({height:o,width:o,viewBox:`0 0 ${A} ${A}`,ref:n,role:"img"},N),!!_&&it.createElement("title",null,_),it.createElement("path",{fill:i,d:`M0,0 h${A}v${A}H0z`,shapeRendering:"crispEdges"}),it.createElement("path",{fill:u,d:U,shapeRendering:"crispEdges"}),R)});ZUe.displayName="QRCodeSVG";function pZt({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 u=l.getContext("2d");if(!u)return;const p=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{u.fillStyle="#ffffff",u.fillRect(0,0,i,i),u.drawImage(x,0,0,i,i);const _=document.createElement("a");_.download=`${t}-qr-code.png`,_.href=l.toDataURL("image/png"),_.click(),Oe.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(qe,{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(ZUe,{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(te,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[r.jsx(ao,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function Ede(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 mZt(){const{user:t}=Qr(),{data:e,isLoading:n}=Uot(t==null?void 0:t.id),s=S3(),[a,o]=I.useState(null),l=I.useMemo(()=>a||(e?Ede(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(xZt,{userId:t==null?void 0:t.id})});const i=l||Ede(e),u=p=>{o(x=>{const y=x||Ede(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(yZt,{card:e}),r.jsx(wZt,{card:e,form:i,setForm:u})]}),!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(Mj,{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(gZt,{card:e,form:i})})]})})]})})}function gZt({card:t,form:e}){const{data:n}=Kt({queryKey:["card-preview-profile",t.user_id],queryFn:async()=>{const{data:a}=await Q.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 Q.storage.from("avatars").list(`${t.user_id}`);if(l&&l.length>0){const{data:i}=Q.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(lxe,{card:s})})}function xZt({userId:t}){var u;const[e,n]=I.useState(""),s=dOe(),{data:a}=Kt({queryKey:["my-profile-for-card",t],queryFn:async()=>{if(!t)return null;const{data:p}=await Q.from("profiles").select("name").eq("id",t).single();return p},enabled:!!t}),o=((u=a==null?void 0:a.name)==null?void 0:u.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){Oe.error("Please enter a URL slug for your card");return}s.mutate({user_id:t,slug:p,is_published:!0},{onSuccess:()=>Oe.success("Your digital card has been created!")})},i=[{icon:ey,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Ig,title:"Lead Capture",desc:"Collect leads automatically"},{icon:uf,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:Rc,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(As,{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(Ke,{className:"shadow-lg border-2",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx(Zt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(Cn,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(et,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(qe,{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(ot,{value:e||o,onChange:p=>n(p.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(te,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function yZt({card:t}){const n=`https://cards.relevelup.com/${t.slug}`,s=()=>{navigator.clipboard.writeText(n),Oe.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(Lt,{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(ey,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",t.slug]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(tl,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(te,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Os,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function vZt({userId:t}){const e=qr(),n=I.useRef(null),[s,a]=I.useState(!1),[o,l]=I.useState(""),{data:i,isLoading:u}=Kt({queryKey:["card-editor-profile",t],queryFn:async()=>{const{data:ae}=await Q.from("profiles").select("name, email, phone, avatar_url").eq("id",t).single();let oe=(ae==null?void 0:ae.avatar_url)||null;if(!oe){const{data:xe}=await Q.storage.from("avatars").list(`${t}`);if(xe&&xe.length>0){const{data:ie}=Q.storage.from("avatars").getPublicUrl(`${t}/${xe[0].name}`);oe=`${ie.publicUrl}?t=${Date.now()}`,await Q.from("profiles").update({avatar_url:oe}).eq("id",t)}}return{...ae,avatar_url:oe}}}),[p,x]=I.useState(null),[y,_]=I.useState(null),[w,S]=I.useState(null),[N,M]=I.useState(!1),E=p??(i==null?void 0:i.name)??"",A=y??(i==null?void 0:i.phone)??"",P=w??(i==null?void 0:i.email)??"",z=i==null?void 0:i.avatar_url,R=((i==null?void 0:i.name)||"A").split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),U=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),V=or({mutationFn:async ae=>{const{error:oe}=await Q.from("profiles").update(ae).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"]}),Oe.success("Profile updated!")},onError:()=>Oe.error("Failed to update profile")}),K=()=>{const ae={};if(p!==null&&p!==(i==null?void 0:i.name)&&(ae.name=p),y!==null&&y!==(i==null?void 0:i.phone)&&(ae.phone=y||null),w!==null&&w!==(i==null?void 0:i.email)&&(ae.email=w),Object.keys(ae).length===0){Oe.info("No changes to save");return}V.mutate(ae)},W=ae=>{var ie;const oe=(ie=ae.target.files)==null?void 0:ie[0];if(!oe)return;if(!oe.type.startsWith("image/")){Oe.error("Please select an image file");return}const xe=new FileReader;xe.onloadend=()=>{l(xe.result),a(!0)},xe.readAsDataURL(oe),ae.target.value=""},J=async ae=>{M(!0);try{const{data:oe}=await Q.storage.from("avatars").list(`${t}`);oe&&oe.length>0&&await Q.storage.from("avatars").remove(oe.map(fe=>`${t}/${fe.name}`));const xe=`${t}/avatar.jpg`,{error:ie}=await Q.storage.from("avatars").upload(xe,ae,{upsert:!0,contentType:"image/jpeg"});if(ie)throw ie;const{data:pe}=Q.storage.from("avatars").getPublicUrl(xe),se=pe.publicUrl+"?t="+Date.now();await Q.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"]}),Oe.success("Photo updated!")}catch{Oe.error("Failed to upload photo")}finally{M(!1)}};return u?r.jsx(Ir,{className:"h-32 w-full rounded-xl"}):r.jsxs(r.Fragment,{children:[r.jsx(Ke,{className:U?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(et,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(qe,{className:"text-sm font-semibold",children:"Profile Info"}),U&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(pl,{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 ae;return(ae=n.current)==null?void 0:ae.click()},children:[r.jsxs(Ys,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Pi,{src:z||void 0,alt:E}),r.jsx(Xs,{className:"text-lg font-semibold bg-primary/10 text-primary",children:R})]}),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(Ng,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:W})]}),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(qe,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(ot,{value:E,onChange:ae=>x(ae.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(qe,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(ot,{value:A,onChange:ae=>_(ae.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(ot,{value:P,onChange:ae=>S(ae.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(te,{variant:"outline",size:"sm",onClick:K,disabled:V.isPending,className:"w-full",children:V.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(Oye,{open:s,onClose:()=>a(!1),imageSrc:o,onCropComplete:J,aspectRatio:1})]})}function _Zt({form:t,setForm:e,userId:n}){const[s,a]=I.useState(null),[o,l]=I.useState(t.brokerage_logo_url?"logo":"name"),[i,u]=I.useState(t.team_logo_url?"logo":"name"),p=w=>{l(w),e(w==="name"?S=>({...S,brokerage_logo_url:""}):S=>({...S,brokerage_display_name:""}))},x=w=>{u(w),e(w==="name"?S=>({...S,team_logo_url:""}):S=>({...S,team_name:""}))},y=async(w,S)=>{var M;const N=(M=w.target.files)==null?void 0:M[0];if(N){if(!N.type.startsWith("image/")){Oe.error("Please select an image file");return}a(S);try{const E=N.name.split(".").pop()||"png",P=`${n}/${S==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${E}`,{error:z}=await Q.storage.from("card-logos").upload(P,N,{upsert:!0});if(z)throw z;const{data:R}=Q.storage.from("card-logos").getPublicUrl(P),U=R.publicUrl+"?t="+Date.now();e(S==="brokerage_logo_url"?V=>({...V,[S]:U,brokerage_display_name:""}):V=>({...V,[S]:U,team_name:""})),Oe.success("Logo uploaded!")}catch{Oe.error("Failed to upload logo")}finally{a(null),w.target.value=""}}},_=w=>{e(S=>({...S,[w]:""}))};return r.jsx(Ke,{children:r.jsxs(et,{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx(qe,{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(qe,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("name"),children:"Use Name"}),r.jsx(te,{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(qe,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),r.jsx(ot,{value:t.brokerage_display_name,onChange:w=>e(S=>({...S,brokerage_display_name:w.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{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(Ng,{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:w=>y(w,"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(qe,{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(gm,{value:[t.brokerage_logo_size||56],onValueChange:([w])=>e(S=>({...S,brokerage_logo_size:w})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(qe,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{type:"button",variant:i==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("name"),children:"Use Name"}),r.jsx(te,{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(qe,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),r.jsx(ot,{value:t.team_name,onChange:w=>e(S=>({...S,team_name:w.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{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(Ng,{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:w=>y(w,"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(qe,{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(gm,{value:[t.team_logo_size||56],onValueChange:([w])=>e(S=>({...S,team_logo_size:w})),min:24,max:120,step:4})]})]})]})]})})}function bZt({form:t,setForm:e}){const n={accent:"#ff5722",dark:"#1a1a2e",button:"#ff5722"},s=t.bold_theme_colors||n,a=(i,u)=>{e(p=>({...p,bold_theme_colors:{...n,...p.bold_theme_colors,[i]:u}}))},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(qe,{className:"text-sm font-semibold flex items-center gap-1.5",children:[r.jsx(Rc,{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(te,{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:u,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:u}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p})]}),r.jsx(ot,{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 wZt({card:t,form:e,setForm:n}){var _;const s=uOe(),a=qr(),{data:o}=hOe(t.id),[l,i]=I.useState(t.slug),[u,p]=I.useState(!1),x=async()=>{const w=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!w){Oe.error("Please enter a valid URL");return}if(w===t.slug){Oe.info("No changes to save");return}p(!0);try{const{data:S}=await Q.from("agent_cards").select("id").eq("slug",w).neq("id",t.id).maybeSingle();if(S){Oe.error("This URL is already taken. Try another one.");return}const{error:N}=await Q.from("agent_cards").update({slug:w}).eq("id",t.id);if(N)throw N;i(w),a.invalidateQueries({queryKey:["agent-card"]}),Oe.success("Card address updated!")}catch{Oe.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:()=>Oe.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ki,{defaultValue:"content",children:[r.jsxs(pi,{className:"w-full h-11 p-1",children:[r.jsxs(rn,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(bm,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(rn,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx($o,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(rn,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Ig,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(rn,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(nA,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(rn,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Tj,{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(vZt,{userId:t.user_id}),r.jsx(_Zt,{form:e,setForm:n,userId:t.user_id}),r.jsx(Ke,{children:r.jsxs(et,{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(qe,{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(Ss,{checked:e.is_published,onCheckedChange:w=>n(S=>({...S,is_published:w}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{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(ot,{value:l,onChange:w=>i(w.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),r.jsx(te,{variant:"outline",size:"sm",onClick:x,disabled:u||l===t.slug,className:"shrink-0",children:u?"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(qe,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(xn,{value:e.theme,onValueChange:w=>n(S=>({...S,theme:w})),children:[r.jsx(fn,{className:"h-11",children:r.jsx(vn,{})}),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(bZt,{form:e,setForm:n}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(ot,{value:e.title,onChange:w=>n(S=>({...S,title:w.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(qe,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(ot,{value:e.positioning_statement,onChange:w=>n(S=>({...S,positioning_statement:w.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{className:"text-sm font-medium",children:"Bio"}),r.jsx(ss,{value:e.bio,onChange:w=>n(S=>({...S,bio:w.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(qe,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(ot,{value:e.review_snippet,onChange:w=>n(S=>({...S,review_snippet:w.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(ot,{value:e.review_source_url,onChange:w=>n(S=>({...S,review_source_url:w.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(qe,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(ot,{value:e.booking_url,onChange:w=>n(S=>({...S,booking_url:w.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(qe,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(ot,{value:e.custom_cta_label,onChange:w=>n(S=>({...S,custom_cta_label:w.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(Sn,{value:"sections",className:"mt-4",children:r.jsx(Ke,{children:r.jsx(et,{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:w,label:S,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(qe,{className:"text-sm font-medium",children:S}),r.jsx("p",{className:"text-xs text-muted-foreground",children:N})]}),r.jsx(Ss,{checked:e[w],onCheckedChange:M=>n(E=>({...E,[w]:M}))})]},w))})})}),r.jsx(Sn,{value:"blocks",className:"mt-4",children:r.jsx(RUe,{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:$o,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:Tj,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:hf,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(w=>r.jsx(Ke,{className:"overflow-hidden",children:r.jsxs(et,{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 ${w.color}`,children:r.jsx(w.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:w.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:w.value})]})},w.label))}),o&&o.leads.length>0&&r.jsxs(Ke,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsx(Zt,{className:"text-base",children:"Recent Leads"})}),r.jsx(et,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(w=>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:w.name}),w.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:w.phone})]}),w.intent&&r.jsx(Lt,{variant:"secondary",className:"text-xs",children:w.intent})]},w.id))})]}),(!o||o.leads.length===0)&&r.jsx(Ke,{children:r.jsxs(et,{className:"p-8 text-center",children:[r.jsx(Tj,{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(Ke,{children:r.jsx(et,{className:"p-6",children:r.jsx(pZt,{slug:t.slug})})})})]}),r.jsx(te,{onClick:y,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:s.isPending?"Saving...":"Save Changes"})]})}function jZt(){const{isAdmin:t}=Qr(),e=qr(),[n,s]=I.useState(!1),{data:a,isLoading:o}=Kt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:p,error:x}=await Q.from("gmail_integrations").select("*").maybeSingle();if(x)throw x;return p}}),l=async()=>{s(!0);try{const{data:p,error:x}=await Q.functions.invoke("gmail-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("Gmail OAuth error:",p),Oe.error("Failed to start Gmail connection"),s(!1)}},i=or({mutationFn:async p=>{const{error:x}=await Q.from("gmail_integrations").delete().eq("id",p);if(x)throw x},onSuccess:()=>{e.invalidateQueries({queryKey:["gmail-integration"]}),Oe.success("Gmail disconnected")},onError:()=>{Oe.error("Failed to disconnect Gmail")}}),u=!!(a!=null&&a.is_active);return r.jsx(Lr,{children:r.jsxs("div",{className:"max-w-3xl mx-auto space-y-6 animate-fade-in",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Integrations"}),r.jsx("p",{className:"text-muted-foreground",children:"Connect third-party services to supercharge your Agent OS workflow."})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx("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-lg bg-red-100 dark:bg-red-950 flex items-center justify-center",children:r.jsx(ws,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),r.jsxs("div",{children:[r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:["Gmail",u&&r.jsx(Lt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(Cn,{children:"Send emails directly from your contact pages and auto-log them as touchpoints."})]})]})})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(Ii,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Send personalized emails from your Gmail account"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(Ii,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Automatically log emails as activity touchpoints"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(Ii,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Quick compose from any contact detail page"})]}),u?r.jsxs("div",{className:"flex items-center justify-between mt-4 p-3 rounded-lg border",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:a.gmail_email}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Gmail account"})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect Gmail?"}),r.jsx(Zd,{children:"This will remove your Gmail connection. You'll need to reconnect to send emails."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:()=>i.mutate(a.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}):r.jsxs(te,{className:"mt-4",onClick:l,disabled:n||o,children:[n?r.jsx(Ll,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Connect Gmail",r.jsx(Jo,{className:"h-4 w-4 ml-2"})]})]})})]})]})})}function kZt(){const[t]=rd(),e=Gn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your Gmail account...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),u=t.get("error"),p=t.get("error_description"),x=t.get("state");if(u){s("error"),o(p||"Authorization was denied"),Oe.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Oe.error("No authorization code received");return}try{const{data:y,error:_}=await Q.functions.invoke("gmail-oauth",{body:{action:"exchange_code",code:i,state:x}});if(_)throw _;if(y!=null&&y.success)s("success"),o(y.message||"Gmail connected successfully!"),Oe.success("Gmail connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Gmail OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Gmail"),Oe.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(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Yr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Ii,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Zt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Cn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/mission-control/integrations"),children:n==="success"?"Back to Integrations":"Try Again"})})]})})}const YUe=new Date().getFullYear(),NZt=Array.from({length:5},(t,e)=>YUe-e);function SZt(){const[t,e]=I.useState(YUe),n=Gn(),{data:s,isLoading:a}=hmt();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(xn,{value:String(t),onValueChange:o=>e(Number(o)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(vn,{})}),r.jsx(pn,{children:NZt.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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(gc,{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(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Agents with Scorecards"}),r.jsx(Cn,{children:"Click to view individual agent scorecards"})]}),r.jsx(et,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(gc,{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(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-medium",children:o.name}),r.jsx(jt,{className:"text-muted-foreground",children:o.email}),r.jsx(jt,{className:"text-right",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const XUe=new Date().getFullYear(),CZt=Array.from({length:10},(t,e)=>XUe-e);function MZt(){var _;const{userId:t}=td(),e=Gn(),[n,s]=I.useState(XUe),{data:a,isLoading:o}=Kt({queryKey:["agent-profile",t],queryFn:async()=>{const{data:w,error:S}=await Q.from("profiles").select("id, name, email").eq("id",t).single();if(S)throw S;return w},enabled:!!t}),{data:l,isLoading:i}=Wxe(n,t),{yearStats:u,lifetimeStats:p,showCommission:x}=bDe(n,t),{data:y}=_De(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(w=>r.jsx(Ir,{className:"h-24"},w))})]})}):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(te,{variant:"ghost",size:"icon",onClick:()=>e("/admin/scorecard"),children:r.jsx(io,{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(xn,{value:String(n),onValueChange:w=>s(Number(w)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(vn,{})}),r.jsx(pn,{children:CZt.map(w=>r.jsx(qt,{value:String(w),children:w},w))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ua,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:u.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.totalTransactions," lifetime"]})]})}),r.jsx(Ke,{children:r.jsxs(et,{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:[u.buyerCount,"/",u.sellerCount]})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(wd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ud(u.totalVolume,!0)})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ap,{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:Ud(u.averagePrice,!0)})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Rl,{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:((_=u.topLeadSource)==null?void 0:_.name)||"-"})]})})]}),y&&r.jsx(D7e,{goals:y,stats:u,year:n,showCommission:x}),r.jsxs(ki,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"transactions",children:"Transactions"}),r.jsx(rn,{value:"charts",children:"Charts"}),r.jsxs(rn,{value:"map",children:[r.jsx(To,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Sn,{value:"transactions",children:r.jsx(O7e,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(Sn,{value:"charts",children:r.jsx(SUe,{stats:u,year:n})}),r.jsx(Sn,{value:"map",children:r.jsx(CUe,{transactions:l||[],isLoading:i})})]})]})})}function TZt(){const t=qr(),[e,n]=I.useState(""),[s,a]=I.useState("all");vOe();const{data:o,refetch:l}=Kt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:A}=await Q.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(A==null?void 0:A.enabled)??!1}}),{data:i,isLoading:u}=Kt({queryKey:["admin-listings"],queryFn:async()=>{const{data:A,error:P}=await Q.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 A}}),{data:p}=Kt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:A}=await Q.from("listings").select("id, is_approved, status"),{data:P}=await Q.from("listing_shares").select("id"),{data:z}=await Q.from("listing_views").select("id");return{total:(A==null?void 0:A.length)||0,pending:(A==null?void 0:A.filter(R=>!R.is_approved).length)||0,active:(A==null?void 0:A.filter(R=>R.status==="active").length)||0,totalShares:(P==null?void 0:P.length)||0,totalViews:(z==null?void 0:z.length)||0}}}),x=or({mutationFn:async({id:A,approved:P})=>{const{error:z}=await Q.from("listings").update({is_approved:P}).eq("id",A);if(z)throw z},onSuccess:(A,{approved:P})=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),Oe.success(P?"Listing approved":"Listing unapproved")}}),y=or({mutationFn:async({id:A,featured:P})=>{const{error:z}=await Q.from("listings").update({is_featured:P}).eq("id",A);if(z)throw z},onSuccess:(A,{featured:P})=>{t.invalidateQueries({queryKey:["admin-listings"]}),Oe.success(P?"Listing featured":"Listing unfeatured")}}),_=or({mutationFn:async A=>{const{error:P}=await Q.from("listings").delete().eq("id",A);if(P)throw P},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),Oe.success("Listing deleted")}}),w=or({mutationFn:async A=>{const{error:P}=await Q.from("feature_flags").update({enabled:A}).eq("key","listing_exchange_enabled");if(P)throw P},onSuccess:()=>{l(),Oe.success("Feature flag updated")}}),S=o??!1,N=i==null?void 0:i.filter(A=>{var R,U,V,K;const P=((R=A.city)==null?void 0:R.toLowerCase().includes(e.toLowerCase()))||((V=(U=A.agent)==null?void 0:U.name)==null?void 0:V.toLowerCase().includes(e.toLowerCase()))||((K=A.property_address)==null?void 0:K.toLowerCase().includes(e.toLowerCase())),z=s==="all"||s==="pending"&&!A.is_approved||s==="approved"&&A.is_approved;return P&&z}),M=A=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(A),E=A=>{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[A]||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(Ss,{checked:S,onCheckedChange:A=>w.mutate(A)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(Ke,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{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(Ke,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ap,{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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($o,{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(Ke,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_c,{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(Ke,{children:r.jsx(et,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by city, address, or agent...",value:e,onChange:A=>n(A.target.value),className:"pl-9"})]}),r.jsx(ki,{value:s,onValueChange:A=>a(A),children:r.jsxs(pi,{children:[r.jsx(rn,{value:"all",children:"All"}),r.jsx(rn,{value:"pending",children:"Pending"}),r.jsx(rn,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{children:["Listings (",(N==null?void 0:N.length)||0,")"]})}),r.jsx(et,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:u?r.jsx(Mr,{children:r.jsx(jt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(N==null?void 0:N.length)===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):N==null?void 0:N.map(A=>{var P,z,R,U,V;return r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(z=(P=A.photos)==null?void 0:P[0])!=null&&z.photo_url?r.jsx("img",{src:A.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(li,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:A.property_address||`${A.city}, ${A.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(R=A.property_type)==null?void 0:R.replace("_"," ")})]})]})}),r.jsx(jt,{children:r.jsx("p",{className:"text-sm",children:((U=A.agent)==null?void 0:U.name)||"Unknown"})}),r.jsx(jt,{className:"font-medium",children:M(A.price)}),r.jsx(jt,{children:r.jsx(Lt,{variant:"outline",className:E(A.status),children:(V=A.status)==null?void 0:V.replace("_"," ")})}),r.jsx(jt,{className:"text-center",children:r.jsx(Ss,{checked:A.is_approved??!1,onCheckedChange:K=>x.mutate({id:A.id,approved:K})})}),r.jsx(jt,{className:"text-center",children:r.jsx(Ss,{checked:A.is_featured??!1,onCheckedChange:K=>y.mutate({id:A.id,featured:K})})}),r.jsx(jt,{children:A.view_count||0}),r.jsx(jt,{children:A.share_count||0}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:mn(new Date(A.created_at),"MMM d, yyyy")}),r.jsx(jt,{children:r.jsxs(Th,{children:[r.jsx(Ah,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(lm,{className:"h-4 w-4"})})}),r.jsxs(eh,{align:"end",children:[r.jsxs(ri,{onClick:()=>window.open(`/mission-control/listings/${A.id}`,"_blank"),children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(ri,{onClick:()=>y.mutate({id:A.id,featured:!A.is_featured}),children:[r.jsx(_s,{className:"h-4 w-4 mr-2"}),A.is_featured?"Unfeature":"Feature"]}),r.jsxs(ri,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&_.mutate(A.id)},children:[r.jsx(gs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},A.id)})})]})})})]})]})})}const AZt=()=>{var y,_;const[t,e]=I.useState(""),[n,s]=I.useState(null),{data:a,isLoading:o}=Kt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:w,error:S}=await Q.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(S)throw S;const N=(w==null?void 0:w.map(A=>A.user_id))||[],{data:M}=await Q.from("profiles").select("id, name, email").in("id",N);return w==null?void 0:w.map(A=>({...A,profiles:(M==null?void 0:M.find(P=>P.id===A.user_id))||null}))}}),l=a==null?void 0:a.filter(w=>{var N,M,E,A,P;const S=t.toLowerCase();return((M=(N=w.profiles)==null?void 0:N.name)==null?void 0:M.toLowerCase().includes(S))||((A=(E=w.profiles)==null?void 0:E.email)==null?void 0:A.toLowerCase().includes(S))||((P=w.review_text)==null?void 0:P.toLowerCase().includes(S))}),i=a!=null&&a.length?(a.reduce((w,S)=>w+S.rating,0)/a.length).toFixed(1):"0.0",u=a==null?void 0:a.reduce((w,S)=>(w[S.rating]=(w[S.rating]||0)+1,w),{}),p=(a==null?void 0:a.filter(w=>w.posted_to_google).length)||0,x=w=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(S=>r.jsx(_s,{className:zt("h-4 w-4",w>=S?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},S))});return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ju,{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(Ke,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Cn,{children:"Total Reviews"}),r.jsx(Zt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),r.jsx(Ke,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Cn,{children:"Average Rating"}),r.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(_s,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ke,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Cn,{children:"5-Star Reviews"}),r.jsx(Zt,{className:"text-3xl",children:(u==null?void 0:u[5])||0})]})}),r.jsx(Ke,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Cn,{children:"Posted to Google"}),r.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[p,r.jsx(Os,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or review...",value:t,onChange:w=>e(w.target.value),className:"pl-9"})]}),r.jsx(Ke,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Mr,{children:r.jsx(jt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(w=>{var S,N;return r.jsxs(Mr,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(w),children:[r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((S=w.profiles)==null?void 0:S.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(N=w.profiles)==null?void 0:N.email})]})}),r.jsx(jt,{children:x(w.rating)}),r.jsx(jt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:w.review_text||"-"})}),r.jsx(jt,{children:w.posted_to_google?r.jsx(Lt,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Lt,{variant:"outline",children:"No"})}),r.jsx(jt,{className:"text-sm text-muted-foreground",children:mn(new Date(w.created_at),"MMM d, yyyy")})]},w.id)})})]})})}),r.jsx(Dr,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsx(Br,{children:r.jsx(zr,{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(ws,{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(Ds,{className:"h-4 w-4"}),mn(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Lt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Os,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Lt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},EZt=[{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"}],IZt=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 PZt(){const t=qr(),{user:e}=Qr(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(!1),{data:u,isLoading:p}=Kt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:K,error:W}=await Q.from("weekly_digest_settings").select("*").single();if(W)throw W;return K}}),{data:x,isLoading:y}=Kt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:K,error:W}=await Q.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(W)throw W;return K}}),{data:_}=Kt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:K,error:W}=await Q.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(W)throw W;return K||0}}),{data:w,refetch:S}=Kt({queryKey:["digest-queue-status"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[W,J,ae,oe]=await Promise.all([Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",K.toISOString()),Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",K.toISOString()),Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",K.toISOString()),Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",K.toISOString())]);return{pending:W.count||0,processing:J.count||0,sent:ae.count||0,failed:oe.count||0,total:(W.count||0)+(J.count||0)+(ae.count||0)+(oe.count||0)}},refetchInterval:5e3});I.useEffect(()=>{if(w&&(w.pending>0||w.processing>0)){const K=setInterval(()=>{S(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(K)}},[w,S,t]);const{data:N=0}=Kt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const{count:W,error:J}=await Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString());if(J)throw J;return W||0}}),M=or({mutationFn:async K=>{const{error:W}=await Q.from("weekly_digest_settings").update(K).eq("id",u==null?void 0:u.id);if(W)throw W},onSuccess:()=>{t.invalidateQueries({queryKey:["weekly-digest-settings"]}),Oe.success("Settings updated")},onError:K=>{Oe.error("Failed to update settings: "+K.message)}}),E=async()=>{s(!0);try{const{data:K,error:W}=await Q.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(W)throw W;K.queued?Oe.success(`${K.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):K.sent!==void 0&&Oe.success(`Digest sent! ${K.sent} emails delivered, ${K.failed} failed`),S(),t.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(K){Oe.error("Failed to send digest: "+K.message)}finally{s(!1)}},A=async()=>{var K,W,J,ae,oe,xe;if(!(e!=null&&e.email)){Oe.error("No email found for your account");return}o(!0);try{const{data:ie,error:pe}=await Q.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:e.email}});if(pe)throw pe;const se=ie==null?void 0:ie.resendId,fe=ie==null?void 0:ie.resendDetails,he=fe==null?void 0:fe.status,ye=((K=fe==null?void 0:fe.body)==null?void 0:K.status)||((J=(W=fe==null?void 0:fe.body)==null?void 0:W.data)==null?void 0:J.status),Ce=((oe=(ae=fe==null?void 0:fe.body)==null?void 0:ae.error)==null?void 0:oe.message)||((xe=fe==null?void 0:fe.body)==null?void 0:xe.message);Oe.success(se?`Preview accepted by email provider (id: ${se})${he?`, status check: ${he}`:""}${ye?`, provider: ${ye}`:""}${Ce?` (${Ce})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(ie){Oe.error("Failed to send preview: "+ie.message)}finally{o(!1)}},P=async()=>{i(!0);try{const{data:K,error:W}=await Q.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(W)throw W;K.queued===0||K.sent===0&&K.failed===0&&!K.queued?Oe.info("No failed emails to retry"):K.queued?Oe.success(`${K.queued} emails queued for retry!`):Oe.success(`Retry complete! ${K.sent} emails delivered, ${K.failed} failed`),S(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(K){Oe.error("Failed to retry: "+K.message)}finally{i(!1)}},z=w!=null&&w.total?Math.round((w.sent+w.failed)/w.total*100):0,R=((w==null?void 0:w.pending)||0)>0||((w==null?void 0:w.processing)||0)>0,{data:U}=Kt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var xe,ie;const K=new Date;K.setUTCHours(0,0,0,0);const[W,J,ae,oe]=await Promise.all([Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",K.toISOString()),Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString()),Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",K.toISOString()),Q.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:W.count||0,totalFailed:J.count||0,agentOsEngaged:ae.count||0,lastSent:((ie=(xe=oe.data)==null?void 0:xe[0])==null?void 0:ie.sent_at)||null}},refetchInterval:R?5e3:!1}),V={totalSent:(U==null?void 0:U.totalSent)||0,totalFailed:(U==null?void 0:U.totalFailed)||0,lastSent:U==null?void 0:U.lastSent,agentOsEngaged:(U==null?void 0:U.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(ki,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(pi,{children:[r.jsxs(rn,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(jd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(rn,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(gc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Sn,{value:"settings",className:"space-y-6",children:[R&&w&&r.jsx(Ke,{className:"border-primary/50 bg-primary/5",children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(Yr,{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:[w.sent.toLocaleString()," sent, ",w.pending.toLocaleString()," pending",w.failed>0&&`, ${w.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[z,"%"]})]}),r.jsx(Jc,{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(w.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsx(et,{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(Ke,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(Lc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(Ke,{children:r.jsx(et,{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(Wa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.lastSent?mn(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(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(Cn,{children:"Configure when the digest is sent"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(qe,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Ss,{checked:u==null?void 0:u.is_enabled,onCheckedChange:K=>M.mutate({is_enabled:K})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Cron Frequency"}),r.jsxs(xn,{value:(u==null?void 0:u.cron_frequency)||"daily",onValueChange:K=>M.mutate({cron_frequency:K}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),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:(u==null?void 0:u.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Day of Week"}),r.jsxs(xn,{value:String(u==null?void 0:u.send_day),onValueChange:K=>M.mutate({send_day:parseInt(K)}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:EZt.map(K=>r.jsx(qt,{value:K.value,children:K.label},K.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Time (UTC)"}),r.jsxs(xn,{value:String(u==null?void 0:u.send_hour),onValueChange:K=>M.mutate({send_hour:parseInt(K)}),disabled:(u==null?void 0:u.cron_frequency)==="daily",children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:IZt.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(te,{onClick:A,disabled:a,variant:"outline",className:"flex-1",children:[r.jsx($o,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),r.jsxs(te,{onClick:E,disabled:n,className:"flex-1",children:[r.jsx(eo,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),N>0&&r.jsxs(te,{onClick:P,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Ll,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${N} Failed`]})]})]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ka,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(Cn,{children:"Choose what to include in the digest"})]}),r.jsxs(et,{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(ka,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(qe,{children:"New Resources"})]}),r.jsx(Ss,{checked:u==null?void 0:u.include_new_resources,onCheckedChange:K=>M.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(qe,{children:"Community Highlights"})]}),r.jsx(Ss,{checked:u==null?void 0:u.include_community_posts,onCheckedChange:K=>M.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(gc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(qe,{children:"Agent OS Stats"})]}),r.jsx(Ss,{checked:u==null?void 0:u.include_agent_os_stats,onCheckedChange:K=>M.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(Ds,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(qe,{children:"Upcoming Events"})]}),r.jsx(Ss,{checked:u==null?void 0:u.include_upcoming_events,onCheckedChange:K=>M.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(sy,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(qe,{children:"Goals Progress"})]}),r.jsx(Ss,{checked:u==null?void 0:u.include_goals_progress,onCheckedChange:K=>M.mutate({include_goals_progress:K})})]})]})]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Custom Introduction"}),r.jsx(Cn,{children:"Personalize the intro message (optional)"})]}),r.jsx(et,{children:r.jsx(ss,{placeholder:"Here's what's new this week to help you grow your business...",value:(u==null?void 0:u.custom_intro_text)||"",onChange:K=>M.mutate({custom_intro_text:K.target.value||null}),rows:3})})]})]}),r.jsx(Sn,{value:"stats",children:r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(Cn,{children:"Recent digest emails sent to members"})]}),r.jsx(et,{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(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-medium",children:K.email_sent_to}),r.jsx(jt,{children:mn(new Date(K.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(jt,{children:r.jsx(Lt,{variant:K.delivery_status==="sent"?"default":"destructive",children:K.delivery_status})}),r.jsx(jt,{children:K.resources_count}),r.jsx(jt,{children:K.has_agent_os_activity?r.jsx(Lt,{variant:"secondary",children:"Active"}):r.jsx(Lt,{variant:"outline",children:"Not Started"})})]},K.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ws,{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 LZt={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 OZt(){var Ne,be,rt;const t=qr(),[e,n]=I.useState(""),[s,a]=I.useState(null),[o,l]=I.useState(!1),[i,u]=I.useState(!1),[p,x]=I.useState(""),[y,_]=I.useState(""),[w,S]=I.useState(!0),[N,M]=I.useState(!1),[E,A]=I.useState(""),[P,z]=I.useState(null),{data:R,isLoading:U}=Kt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Te,error:Pe}=await Q.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Pe)throw Pe;const Ue=(Te==null?void 0:Te.map(Ye=>Ye.user_id))||[],{data:Re}=await Q.from("profiles").select("id, name, email").in("id",Ue),Be=new Map((Re==null?void 0:Re.map(Ye=>[Ye.id,{name:Ye.name,email:Ye.email}]))||[]);return Te==null?void 0:Te.map(Ye=>({...Ye,profile:Be.get(Ye.user_id)||null}))}}),{data:V}=Kt({queryKey:["all-profiles-for-points",R],queryFn:async()=>{const{data:Te,error:Pe}=await Q.from("profiles").select("id, name, email").order("name");if(Pe)throw Pe;return Te}}),W=((V==null?void 0:V.filter(Te=>!(R!=null&&R.some(Pe=>Pe.user_id===Te.id))))||[]).filter(Te=>{var Ue,Re;if(!E)return!0;const Pe=E.toLowerCase();return((Ue=Te.name)==null?void 0:Ue.toLowerCase().includes(Pe))||((Re=Te.email)==null?void 0:Re.toLowerCase().includes(Pe))}),{data:J,isLoading:ae}=Kt({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Te,error:Pe}=await Q.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Pe)throw Pe;return Te},enabled:!!(s!=null&&s.user_id)&&i}),{data:oe}=Kt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Te,error:Pe}=await Q.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Pe)throw Pe;return Te},enabled:!!(s!=null&&s.user_id)}),xe=or({mutationFn:async({userId:Te,points:Pe,reason:Ue})=>{const{error:Re}=await Q.from("agent_points").insert({user_id:Te,points:Pe,reason:Ue});if(Re)throw Re;const{data:Be}=await Q.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Te).maybeSingle(),Ye=((Be==null?void 0:Be.total_points)||0)+Pe,ht=((Be==null?void 0:Be.spendable_points)||0)+Pe,{error:Me}=await Q.from("agent_attendance_stats").upsert({user_id:Te,total_points:Math.max(0,Ye),spendable_points:Math.max(0,ht),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Me)throw Me},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-agent-points"]}),t.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),_(""),Oe.success(w?"Points awarded successfully!":"Points deducted successfully!")},onError:Te=>{console.error("Error modifying points:",Te),Oe.error("Failed to modify points")}}),ie=()=>{if(!s||!p||!y){Oe.error("Please fill in all fields");return}const Te=parseInt(p);if(isNaN(Te)||Te<=0){Oe.error("Please enter a valid positive number");return}xe.mutate({userId:s.user_id,points:w?Te:-Te,reason:y})},pe=()=>{if(!P||!p||!y){Oe.error("Please fill in all fields");return}const Te=parseInt(p);if(isNaN(Te)||Te<=0){Oe.error("Please enter a valid positive number");return}xe.mutate({userId:P.id,points:Te,reason:y},{onSuccess:()=>{M(!1),z(null),A("")}})},se=(Te,Pe)=>{a(Te),S(Pe),l(!0)},fe=Te=>{a(Te),u(!0)},he=R==null?void 0:R.filter(Te=>{var Be,Ye,ht,Me;const Pe=((Ye=(Be=Te.profile)==null?void 0:Be.name)==null?void 0:Ye.toLowerCase())||"",Ue=((Me=(ht=Te.profile)==null?void 0:ht.email)==null?void 0:Me.toLowerCase())||"",Re=e.toLowerCase();return Pe.includes(Re)||Ue.includes(Re)}),ye=(R==null?void 0:R.reduce((Te,Pe)=>Te+Pe.total_points,0))||0,Ce=(R==null?void 0:R.length)||0,Se=Ce>0?Math.round(ye/Ce):0;return U?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(Te=>r.jsx(Ir,{className:"h-24"},Te))}),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(Ke,{children:r.jsxs(et,{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:Ce}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Yi,{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:ye.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ap,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Se}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:e,onChange:Te=>n(Te.target.value),className:"pl-10"})]}),r.jsxs(te,{onClick:()=>M(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{children:"Agent Leaderboard"}),r.jsx(Cn,{children:"All agents with their points, events, and streaks"})]}),r.jsx(et,{children:!he||he.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Yi,{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(Mr,{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:he.map((Te,Pe)=>{var Ue,Re,Be,Ye;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-medium",children:Pe<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Pe===0?"bg-yellow-100 text-yellow-700":Pe===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Pe+1}):r.jsx("span",{className:"text-muted-foreground",children:Pe+1})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{children:((Re=(Ue=Te.profile)==null?void 0:Ue.name)==null?void 0:Re.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Be=Te.profile)==null?void 0:Be.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(Ye=Te.profile)==null?void 0:Ye.email})]})]})}),r.jsx(jt,{className:"text-center",children:r.jsxs(Lt,{variant:"secondary",className:"font-bold",children:[r.jsx(_s,{className:"h-3 w-3 mr-1"}),Te.total_points]})}),r.jsx(jt,{className:"text-center",children:r.jsxs(Lt,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Zi,{className:"h-3 w-3 mr-1"}),Te.spendable_points||0]})}),r.jsx(jt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Ds,{className:"h-3 w-3 text-muted-foreground"}),Te.total_events_attended]})}),r.jsx(jt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(lf,{className:"h-3 w-3 text-orange-500"}),Te.current_streak]})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>se(Te,!0),title:"Award points",children:r.jsx(_n,{className:"h-4 w-4 text-green-600"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>se(Te,!1),title:"Deduct points",children:r.jsx(F1,{className:"h-4 w-4 text-red-600"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>fe(Te),title:"View history",children:r.jsx(pS,{className:"h-4 w-4"})})]})})]},Te.user_id)})})]})})]}),r.jsx(Dr,{open:o,onOpenChange:l,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:w?"Award Points":"Deduct Points"}),r.jsxs(Jn,{children:[w?"Award":"Deduct"," points ",w?"to":"from"," ",((Ne=s==null?void 0:s.profile)==null?void 0:Ne.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"points",children:"Points Amount"}),r.jsx(ot,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Te=>x(Te.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"reason",children:"Reason"}),r.jsx(ss,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Te=>_(Te.target.value)})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(te,{onClick:ie,disabled:xe.isPending,className:w?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:xe.isPending?"Saving...":w?"Award Points":"Deduct Points"})]})]})}),r.jsx(Dr,{open:i,onOpenChange:u,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsxs(Br,{children:[r.jsxs(zr,{children:["Point History: ",(be=s==null?void 0:s.profile)==null?void 0:be.name]}),r.jsx(Jn,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(ki,{defaultValue:"history",className:"w-full",children:[r.jsxs(pi,{className:"grid w-full grid-cols-2",children:[r.jsx(rn,{value:"history",children:"Point History"}),r.jsx(rn,{value:"badges",children:"Badges"})]}),r.jsx(Sn,{value:"history",className:"mt-4",children:ae?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Te=>r.jsx(Ir,{className:"h-12"},Te))}):!J||J.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(pS,{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:J.map(Te=>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:Te.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:mn(new Date(Te.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Lt,{variant:Te.points>=0?"default":"destructive",className:Te.points>=0?"bg-green-100 text-green-800":"",children:[Te.points>=0?"+":"",Te.points]})]},Te.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(Rl,{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(Te=>r.jsxs("div",{className:`p-3 rounded-lg ${LZt[Te.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rl,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Te.badge_name})]}),Te.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Te.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",mn(new Date(Te.earned_at),"MMM d, yyyy")]})]},Te.id))})})]})]})}),r.jsx(Dr,{open:N,onOpenChange:Te=>{M(Te),Te||(z(null),A(""),x(""),_(""))},children:r.jsxs(Or,{className:"max-w-md",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Award Points to New Agent"}),r.jsx(Jn,{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(Ys,{className:"h-10 w-10",children:r.jsx(Xs,{children:((rt=P.name)==null?void 0:rt.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(te,{variant:"ghost",size:"sm",onClick:()=>z(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(ot,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Te=>x(Te.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"new-reason",children:"Reason"}),r.jsx(ss,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Te=>_(Te.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:E,onChange:Te=>A(Te.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:W.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"})]}):W.slice(0,20).map(Te=>{var Pe;return r.jsxs("button",{onClick:()=>z(Te),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(Ys,{className:"h-8 w-8",children:r.jsx(Xs,{children:((Pe=Te.name)==null?void 0:Pe.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Te.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Te.email})]})]},Te.id)})})]})}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),P&&r.jsxs(te,{onClick:pe,disabled:xe.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function DZt(){const{data:t,isLoading:e}=$ot(),[n,s]=I.useState(null),[a,o]=I.useState(!1),[l,i]=I.useState(""),[u,p]=I.useState("all"),[x,y]=I.useState("newest"),[_,w]=I.useState("table"),S=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:M}=Kt({queryKey:["card-profiles-lookup",S],queryFn:async()=>{if(S.length===0)return{};const{data:P}=await Q.from("profiles").select("id, name, email").in("id",S),z={};return P==null||P.forEach(R=>{z[R.id]={name:R.name||"",email:R.email||""}}),z},enabled:S.length>0}),{data:E}=Kt({queryKey:["card-stats-all",N],queryFn:async()=>{if(N.length===0)return{};const P={};N.forEach(U=>{P[U]={views:0,leads:0}});const{data:z}=await Q.from("agent_card_interactions").select("card_id").in("card_id",N).eq("interaction_type","card_view");z==null||z.forEach(U=>{P[U.card_id]&&P[U.card_id].views++});const{data:R}=await Q.from("agent_card_leads").select("card_id").in("card_id",N);return R==null||R.forEach(U=>{P[U.card_id]&&P[U.card_id].leads++}),P},enabled:N.length>0}),A=I.useMemo(()=>{if(!t)return[];let P=[...t];if(u==="live"?P=P.filter(z=>z.is_published):u==="draft"&&(P=P.filter(z=>!z.is_published)),l.trim()){const z=l.toLowerCase();P=P.filter(R=>{var V,K;const U=M==null?void 0:M[R.user_id];return R.slug.toLowerCase().includes(z)||((V=U==null?void 0:U.name)==null?void 0:V.toLowerCase().includes(z))||((K=U==null?void 0:U.email)==null?void 0:K.toLowerCase().includes(z))})}return x==="newest"?P.sort((z,R)=>new Date(R.created_at).getTime()-new Date(z.created_at).getTime()):x==="oldest"?P.sort((z,R)=>new Date(z.created_at).getTime()-new Date(R.created_at).getTime()):x==="name"?P.sort((z,R)=>{var U,V;return(((U=M==null?void 0:M[z.user_id])==null?void 0:U.name)||"").localeCompare(((V=M==null?void 0:M[R.user_id])==null?void 0:V.name)||"")}):x==="slug"?P.sort((z,R)=>z.slug.localeCompare(R.slug)):x==="views_desc"?P.sort((z,R)=>{var U,V;return(((U=E==null?void 0:E[R.id])==null?void 0:U.views)||0)-(((V=E==null?void 0:E[z.id])==null?void 0:V.views)||0)}):x==="views_asc"?P.sort((z,R)=>{var U,V;return(((U=E==null?void 0:E[z.id])==null?void 0:U.views)||0)-(((V=E==null?void 0:E[R.id])==null?void 0:V.views)||0)}):x==="leads_desc"?P.sort((z,R)=>{var U,V;return(((U=E==null?void 0:E[R.id])==null?void 0:U.leads)||0)-(((V=E==null?void 0:E[z.id])==null?void 0:V.leads)||0)}):x==="leads_asc"&&P.sort((z,R)=>{var U,V;return(((U=E==null?void 0:E[z.id])==null?void 0:U.leads)||0)-(((V=E==null?void 0:E[R.id])==null?void 0:V.leads)||0)}),P},[t,u,l,x,M]);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(te,{onClick:()=>o(!0),children:[r.jsx(_n,{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(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or slug...",value:l,onChange:P=>i(P.target.value),className:"pl-9"})]}),r.jsxs(xn,{value:u,onValueChange:p,children:[r.jsx(fn,{className:"w-full sm:w-36",children:r.jsx(vn,{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(xn,{value:x,onValueChange:y,children:[r.jsx(fn,{className:"w-full sm:w-44",children:r.jsx(vn,{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(te,{variant:_==="table"?"default":"ghost",size:"sm",onClick:()=>w("table"),className:"rounded-r-none",children:r.jsx(SS,{className:"h-4 w-4"})}),r.jsx(te,{variant:_==="grid"?"default":"ghost",size:"sm",onClick:()=>w("grid"),className:"rounded-l-none",children:r.jsx(tp,{className:"h-4 w-4"})})]})]}),!e&&t&&t.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",A.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))}):A.length>0?_==="table"?r.jsx(RZt,{cards:A,cardProfiles:M,cardStats:E,onEdit:s,sortBy:x,setSortBy:y}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:A.map(P=>r.jsx(FZt,{card:P,onEdit:()=>s(P),stats:E==null?void 0:E[P.id]},P.id))}):t&&t.length>0?r.jsx(Ke,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(ya,{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(Ke,{children:r.jsxs(et,{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(te,{onClick:()=>o(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(zZt,{open:a,onOpenChange:o}),n&&r.jsx(BZt,{card:n,open:!!n,onOpenChange:P=>!P&&s(null)})]})}function RZt({cards:t,cardProfiles:e,cardStats:n,onEdit:s,sortBy:a,setSortBy:o}){const l=u=>{a===`${u}_desc`?o(`${u}_asc`):o(`${u}_desc`)},i=({field:u})=>a===`${u}_desc`?r.jsx(Xx,{className:"h-3 w-3"}):a===`${u}_asc`?r.jsx(ep,{className:"h-3 w-3"}):r.jsx(jg,{className:"h-3 w-3 opacity-40"});return r.jsx(Ke,{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(ep,{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(u=>{const p=e==null?void 0:e[u.user_id],x=n==null?void 0:n[u.id],y=`https://cards.relevelup.com/${u.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:["/",u.slug]})}),r.jsx("td",{className:"p-3 text-center",children:r.jsx(Lt,{variant:u.is_published?"default":"secondary",className:"text-xs",children:u.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(te,{variant:"ghost",size:"sm",onClick:()=>s(u),className:"h-8 w-8 p-0",children:r.jsx(ni,{className:"h-3.5 w-3.5"})}),r.jsx(te,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(y),Oe.success("Link copied!")},children:r.jsx(tl,{className:"h-3.5 w-3.5"})}),r.jsx(te,{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(Os,{className:"h-3.5 w-3.5"})})})]})})]},u.id)})})]})})})}function FZt({card:t,onEdit:e,stats:n}){const[s,a]=I.useState(null);I.useEffect(()=>{(async()=>{const{data:u}=await Q.from("profiles").select("name").eq("id",t.user_id).single();let p=null;try{const{data:x}=await Q.storage.from("avatars").list(`${t.user_id}`);if(x&&x.length>0){const{data:y}=Q.storage.from("avatars").getPublicUrl(`${t.user_id}/${x[0].name}`);p=y.publicUrl}}catch{}a({name:(u==null?void 0:u.name)||"Unknown",avatar_url:p})})()},[t.user_id]);const o=`https://cards.relevelup.com/${t.slug}`,l=()=>{navigator.clipboard.writeText(o),Oe.success("Link copied!")};return r.jsx(Ke,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:(s==null?void 0:s.avatar_url)||void 0}),r.jsx(Xs,{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(Lt,{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($o,{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(te,{variant:"outline",size:"sm",onClick:e,className:"flex-1",children:[r.jsx(ni,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(te,{variant:"outline",size:"sm",onClick:l,children:r.jsx(tl,{className:"h-3 w-3"})}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Os,{className:"h-3 w-3"})})})]})]})})}function zZt({open:t,onOpenChange:e}){const[n,s]=I.useState(""),[a,o]=I.useState(""),[l,i]=I.useState(""),[u,p]=I.useState(!1),x=dOe(),y=l.trim(),{data:_}=Kt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let A=Q.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(A=A.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:P}=await A;return P||[]},enabled:t}),[w,S]=I.useState(null),N=(_==null?void 0:_.find(A=>A.id===n))||w,M=()=>{if(!n||!a.trim()){Oe.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=A=>{var z;s(A),p(!1);const P=_==null?void 0:_.find(R=>R.id===A);P&&(S(P),o(((z=P.name)==null?void 0:z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Dr,{open:t,onOpenChange:e,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Create Agent Card"}),r.jsx(Jn,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(qe,{children:"Agent"}),r.jsxs(Cd,{open:u,onOpenChange:p,children:[r.jsx(Md,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between font-normal",children:[N?`${N.name} (${N.email})`:"Search for an agent...",r.jsx(Qx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(ed,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs(by,{shouldFilter:!1,children:[r.jsx(wy,{placeholder:"Search by name or email...",value:l,onValueChange:i}),r.jsxs(jy,{children:[r.jsx(ky,{children:"No agents found."}),r.jsx(Ny,{children:(_||[]).map(A=>r.jsxs(Sy,{value:A.id,onSelect:E,children:[r.jsx(_i,{className:zt("mr-2 h-4 w-4",n===A.id?"opacity-100":"opacity-0")}),A.name," (",A.email,")"]},A.id))})]})]})})]})]}),r.jsxs("div",{children:[r.jsx(qe,{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(ot,{value:a,onChange:A=>o(A.target.value),placeholder:"john-doe"})]})]}),r.jsx(te,{onClick:M,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function BZt({card:t,open:e,onOpenChange:n}){const s=uOe(),{data:a}=hOe(t.id),o=qr(),[l,i]=I.useState(null),[u,p]=I.useState(!1),[x,y]=I.useState(!1),[_,w]=I.useState(""),[S,N]=I.useState(t.slug),[M,E]=I.useState(!1),[A,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:J}=await Q.storage.from("avatars").list(`${t.user_id}`);if(J&&J.length>0){const{data:ae}=Q.storage.from("avatars").getPublicUrl(`${t.user_id}/${J[0].name}`);i(`${ae.publicUrl}?t=${Date.now()}`)}}catch{}})()},[t.user_id,e]);const z=W=>{var oe;const J=(oe=W.target.files)==null?void 0:oe[0];if(!J)return;if(!J.type.startsWith("image/")){Oe.error("Please select an image file");return}if(J.size>5*1024*1024){Oe.error("Image must be under 5MB");return}const ae=new FileReader;ae.onloadend=()=>{w(ae.result),y(!0)},ae.readAsDataURL(J),W.target.value=""},R=async W=>{p(!0);try{const{data:J}=await Q.storage.from("avatars").list(`${t.user_id}`);J&&J.length>0&&await Q.storage.from("avatars").remove(J.map(pe=>`${t.user_id}/${pe.name}`));const ae=`${t.user_id}/avatar.jpg`,{error:oe}=await Q.storage.from("avatars").upload(ae,W,{upsert:!0,contentType:"image/jpeg"});if(oe)throw oe;const{data:xe}=Q.storage.from("avatars").getPublicUrl(ae),ie=`${xe.publicUrl}?t=${Date.now()}`;i(ie),await Q.from("profiles").update({avatar_url:ie}).eq("id",t.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),Oe.success("Photo updated!")}catch(J){Oe.error(J.message||"Upload failed")}finally{p(!1)}},U=async()=>{const W=S.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!W){Oe.error("Please enter a valid URL");return}if(W===t.slug){Oe.info("No changes to save");return}E(!0);try{const{data:J}=await Q.from("agent_cards").select("id").eq("slug",W).neq("id",t.id).maybeSingle();if(J){Oe.error("This URL is already taken. Try another one.");return}const{error:ae}=await Q.from("agent_cards").update({slug:W}).eq("id",t.id);if(ae)throw ae;N(W),o.invalidateQueries({queryKey:["agent-cards-admin"]}),Oe.success("Card address updated!")}catch{Oe.error("Failed to update card address")}finally{E(!1)}},V=async(W,J)=>{var oe;const ae=(oe=W.target.files)==null?void 0:oe[0];if(ae){if(!ae.type.startsWith("image/")){Oe.error("Please select an image file");return}try{const xe=ae.name.split(".").pop()||"png",ie=J==="brokerage_logo_url"?"brokerage-logo":"team-logo",pe=`${t.user_id}/${ie}.${xe}`,{error:se}=await Q.storage.from("card-logos").upload(pe,ae,{upsert:!0});if(se)throw se;const{data:fe}=Q.storage.from("card-logos").getPublicUrl(pe),he=fe.publicUrl+"?t="+Date.now();P(J==="brokerage_logo_url"?ye=>({...ye,[J]:he,brokerage_display_name:""}):ye=>({...ye,[J]:he,team_name:""})),Oe.success("Logo uploaded!")}catch{Oe.error("Failed to upload logo")}finally{W.target.value=""}}},K=()=>{s.mutate({id:t.id,...A,title:A.title||null,positioning_statement:A.positioning_statement||null,bio:A.bio||null,review_snippet:A.review_snippet||null,review_source_url:A.review_source_url||null,booking_url:A.booking_url||null,custom_cta_label:A.custom_cta_label||null,custom_cta_url:A.custom_cta_url||null,brokerage_display_name:A.brokerage_display_name||null,brokerage_logo_url:A.brokerage_logo_url||null,brokerage_logo_size:A.brokerage_logo_size,team_name:A.team_name||null,team_logo_url:A.team_logo_url||null,team_logo_size:A.team_logo_size},{onSuccess:()=>n(!1)})};return r.jsxs(r.Fragment,{children:[r.jsx(Dr,{open:e,onOpenChange:n,children:r.jsxs(Or,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Edit Agent Card"}),r.jsxs(Jn,{children:["/card/",t.slug]})]}),r.jsxs(ki,{defaultValue:"content",children:[r.jsxs(pi,{className:"w-full",children:[r.jsx(rn,{value:"content",className:"flex-1",children:"Content"}),r.jsx(rn,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(rn,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(rn,{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(qe,{children:"Published"}),r.jsx(Ss,{checked:A.is_published,onCheckedChange:W=>P(J=>({...J,is_published:W}))})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(Ys,{className:"h-16 w-16",children:[r.jsx(Pi,{src:l||void 0}),r.jsx(Xs,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:z,disabled:u}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,disabled:u,children:r.jsx("span",{children:u?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ho,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx(qe,{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(ot,{value:S,onChange:W=>N(W.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),r.jsx(te,{variant:"outline",size:"sm",onClick:U,disabled:M||S===t.slug,className:"shrink-0",children:M?"Saving...":"Update"})]})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Theme"}),r.jsxs(xn,{value:A.theme,onValueChange:W=>P(J=>({...J,theme:W})),children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(qe,{children:"Title / Tagline"}),r.jsx(ot,{value:A.title,onChange:W=>P(J=>({...J,title:W.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(qe,{children:"Positioning Statement"}),r.jsx(ot,{value:A.positioning_statement,onChange:W=>P(J=>({...J,positioning_statement:W.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Bio"}),r.jsx(ss,{value:A.bio,onChange:W=>P(J=>({...J,bio:W.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Review Snippet"}),r.jsx(ot,{value:A.review_snippet,onChange:W=>P(J=>({...J,review_snippet:W.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Review Source URL"}),r.jsx(ot,{value:A.review_source_url,onChange:W=>P(J=>({...J,review_source_url:W.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(ot,{value:A.booking_url,onChange:W=>P(J=>({...J,booking_url:W.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Custom CTA Label (optional)"}),r.jsx(ot,{value:A.custom_cta_label,onChange:W=>P(J=>({...J,custom_cta_label:W.target.value})),placeholder:"Book a Call"})]}),r.jsxs("div",{children:[r.jsx(qe,{children:"Custom CTA URL (optional)"}),r.jsx(ot,{value:A.custom_cta_url,onChange:W=>P(J=>({...J,custom_cta_url:W.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(qe,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{value:A.brokerage_display_name,onChange:W=>P(J=>({...J,brokerage_display_name:W.target.value,brokerage_logo_url:""})),placeholder:"Brokerage name (or upload logo below)",disabled:!!A.brokerage_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[A.brokerage_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:A.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${A.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>P(W=>({...W,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(ho,{className:"h-3.5 w-3.5"}),A.brokerage_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:W=>V(W,"brokerage_logo_url")})]})]}),A.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[A.brokerage_logo_size||56,"px"]})]}),r.jsx(gm,{value:[A.brokerage_logo_size||56],onValueChange:([W])=>P(J=>({...J,brokerage_logo_size:W})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(qe,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{value:A.team_name,onChange:W=>P(J=>({...J,team_name:W.target.value,team_logo_url:""})),placeholder:"Team name (or upload logo below)",disabled:!!A.team_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[A.team_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:A.team_logo_url,alt:"Team logo",style:{height:`${A.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>P(W=>({...W,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(ho,{className:"h-3.5 w-3.5"}),A.team_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:W=>V(W,"team_logo_url")})]})]}),A.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qe,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[A.team_logo_size||56,"px"]})]}),r.jsx(gm,{value:[A.team_logo_size||56],onValueChange:([W])=>P(J=>({...J,team_logo_size:W})),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:W,label:J,hint:ae})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(qe,{children:J}),ae&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ae," ",W==="show_photo"&&r.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),r.jsx(Ss,{checked:A[W],onCheckedChange:oe=>P(xe=>({...xe,[W]:oe}))})]},W))}),r.jsx(Sn,{value:"blocks",className:"mt-4",children:r.jsx(RUe,{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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{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(Ke,{children:r.jsxs(et,{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(W=>r.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[r.jsx("span",{className:"font-medium",children:W.name}),W.phone&&r.jsxs("span",{className:"text-muted-foreground",children:[" · ",W.phone]}),W.intent&&r.jsx(Lt,{variant:"secondary",className:"ml-2 text-xs",children:W.intent})]},W.id))})]})]}):r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),r.jsx(te,{onClick:K,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})}),r.jsx(Oye,{open:x,onClose:()=>y(!1),imageSrc:_,onCropComplete:R,aspectRatio:1})]})}const KS={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"},o1e={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 l1e(t=!0){return Kt({queryKey:["marketplace-categories",t],queryFn:async()=>{let e=Q.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 $Zt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.from("marketplace_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Oe.success("Category created successfully")},onError:e=>{Oe.error("Failed to create category: "+e.message)}})}function UZt(){const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.from("marketplace_categories").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Oe.success("Category updated successfully")},onError:e=>{Oe.error("Failed to update category: "+e.message)}})}function qZt(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("marketplace_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Oe.success("Category deleted successfully")},onError:e=>{Oe.error("Failed to delete category: "+e.message)}})}function QUe(t,e=!0){return Kt({queryKey:["marketplace-products",t,e],queryFn:async()=>{let n=Q.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 VZt(t){return Kt({queryKey:["marketplace-product",t],queryFn:async()=>{const{data:e,error:n}=await Q.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 HZt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.from("marketplace_products").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),Oe.success("Product created successfully")},onError:e=>{Oe.error("Failed to create product: "+e.message)}})}function WZt(){const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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]}),Oe.success("Product updated successfully")},onError:e=>{Oe.error("Failed to update product: "+e.message)}})}function GZt(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("marketplace_products").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),Oe.success("Product deleted successfully")},onError:e=>{Oe.error("Failed to delete product: "+e.message)}})}function KZt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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 ZZt(){const t=qr();return or({mutationFn:async({id:e,productId:n})=>{const{error:s}=await Q.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]}),Oe.success("Image deleted successfully")},onError:e=>{Oe.error("Failed to delete image: "+e.message)}})}function YZt(){const t=qr();return or({mutationFn:async({imageId:e,productId:n})=>{const{error:s}=await Q.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:a}=await Q.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]}),Oe.success("Primary image updated")},onError:e=>{Oe.error("Failed to set primary image: "+e.message)}})}function XZt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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]}),Oe.success("Variant added successfully")}})}function QZt(){const t=qr();return or({mutationFn:async({id:e,productId:n})=>{const{error:s}=await Q.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]}),Oe.success("Variant deleted successfully")}})}function JZt(){const t=qr();return or({mutationFn:async({productId:e,videoUrl:n})=>{await Q.from("marketplace_product_videos").delete().eq("product_id",e);const{data:s,error:a}=await Q.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]}),Oe.success("Video updated successfully")}})}function eYt(t){const{isAdmin:e}=Qr();return Kt({queryKey:["marketplace-orders",t,e],queryFn:async()=>{let n=Q.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(u=>u.user_id))],{data:l}=await Q.from("profiles").select("id, name, email").in("id",o),i=new Map((l==null?void 0:l.map(u=>[u.id,u]))||[]);return s.map(u=>({...u,user:i.get(u.user_id)}))}return s}})}function tYt(){const{user:t}=Qr();return Kt({queryKey:["my-marketplace-orders",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await Q.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 rYt(t){return Kt({queryKey:["marketplace-order",t],queryFn:async()=>{const{data:e,error:n}=await Q.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 nYt(){const t=qr(),{user:e}=Qr();return or({mutationFn:async({orderId:n,status:s,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const u={status:s};o!==void 0&&(u.tracking_number=o),l!==void 0&&(u.tracking_url=l);const{error:p}=await Q.from("marketplace_orders").update(u).eq("id",n);if(p)throw p;const{error:x}=await Q.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 Q.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"]}),Oe.success("Order status updated")},onError:n=>{Oe.error("Failed to update order: "+n.message)}})}function sYt(){const t=qr();return or({mutationFn:async({itemId:e,proofUrl:n,proofNotes:s,orderId:a})=>{const{error:o}=await Q.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",e);if(o)throw o;await Q.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",a);try{await Q.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"]}),Oe.success("Proof uploaded & customer notified")}})}function aYt(){const t=qr();return or({mutationFn:async({itemId:e,orderId:n})=>{const{error:s}=await Q.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"]}),Oe.success("Proof approved")}})}function iYt(){const t=qr();return or({mutationFn:async({itemId:e,orderId:n,reason:s})=>{const{error:a}=await Q.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"]}),Oe.success("Proof rejected - please upload a new proof")}})}function oYt(){const{data:t,isLoading:e}=l1e(!1),n=$Zt(),s=UZt(),a=qZt(),[o,l]=I.useState(!1),[i,u]=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}),u(null)},_=N=>{u(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)},w=async N=>{N.preventDefault(),i?await s.mutateAsync({id:i.id,...p}):await n.mutateAsync(p),l(!1),y()},S=async N=>{confirm("Are you sure you want to delete this category?")&&await a.mutateAsync(N)};return e?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Categories"}),r.jsxs(Dr,{open:o,onOpenChange:N=>{l(N),N||y()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsx(zr,{children:i?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:w,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"name",children:"Name"}),r.jsx(ot,{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(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",value:p.description,onChange:N=>x({...p,description:N.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"image_url",children:"Image URL"}),r.jsx(ot,{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(qe,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(ot,{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(Ss,{id:"is_active",checked:p.is_active,onCheckedChange:N=>x({...p,is_active:N})}),r.jsx(qe,{htmlFor:"is_active",children:"Active"})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),r.jsx(et,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(Mr,{children:[r.jsx(jt,{className:"font-medium",children:N.name}),r.jsx(jt,{className:"max-w-xs truncate",children:N.description}),r.jsx(jt,{children:N.sort_order}),r.jsx(jt,{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(jt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>_(N),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>S(N.id),disabled:a.isPending,children:r.jsx($n,{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 lYt(){var Se,Ne;const{data:t,isLoading:e}=QUe(void 0,!1),{data:n}=l1e(!1),s=HZt(),a=WZt(),o=GZt(),l=KZt(),i=ZZt(),u=YZt(),p=XZt(),x=QZt(),y=JZt(),[_,w]=I.useState(!1),[S,N]=I.useState(!1),[M,E]=I.useState(!1),[A,P]=I.useState(null),[z,R]=I.useState(null),[U,V]=I.useState(!1),[K,W]=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}),[J,ae]=I.useState({name:"",price_adjustment:0}),[oe,xe]=I.useState(""),ie=()=>{W({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=be=>{P(be),W({name:be.name,description:be.description||"",base_price:Number(be.base_price),shipping_fee:Number(be.shipping_fee),category_id:be.category_id||"",allow_artwork_upload:be.allow_artwork_upload,requires_proof_approval:be.requires_proof_approval,is_active:be.is_active,sort_order:be.sort_order}),w(!0)},se=async be=>{be.preventDefault();const rt={...K,category_id:K.category_id||null};A?await a.mutateAsync({id:A.id,...rt}):await s.mutateAsync(rt),w(!1),ie()},fe=async be=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(be)},he=async be=>{if(!z||!be.target.files||be.target.files.length===0)return;V(!0);const rt=be.target.files[0],Te=rt.name.split(".").pop(),Pe=`products/${z.id}/${Date.now()}.${Te}`;try{const{error:Ue}=await Q.storage.from("marketplace").upload(Pe,rt);if(Ue)throw Ue;const{data:{publicUrl:Re}}=Q.storage.from("marketplace").getPublicUrl(Pe);await l.mutateAsync({product_id:z.id,image_url:Re,is_primary:!z.images||z.images.length===0}),Oe.success("Image uploaded successfully")}catch(Ue){Oe.error("Failed to upload image: "+Ue.message)}finally{V(!1)}},ye=async be=>{be.preventDefault(),z&&(await p.mutateAsync({product_id:z.id,name:J.name,price_adjustment:J.price_adjustment}),ae({name:"",price_adjustment:0}))},Ce=async()=>{!z||!oe||(await y.mutateAsync({productId:z.id,videoUrl:oe}),xe(""))};return e?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(be=>r.jsx(Ir,{className:"h-64 w-full"},be))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Products"}),r.jsxs(Dr,{open:_,onOpenChange:be=>{w(be),be||ie()},children:[r.jsx(Uo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Or,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsx(zr,{children:A?"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(qe,{htmlFor:"name",children:"Product Name"}),r.jsx(ot,{id:"name",value:K.name,onChange:be=>W({...K,name:be.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"category",children:"Category"}),r.jsxs(xn,{value:K.category_id,onValueChange:be=>W({...K,category_id:be}),children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select category"})}),r.jsx(pn,{children:n==null?void 0:n.map(be=>r.jsx(qt,{value:be.id,children:be.name},be.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"description",children:"Description"}),r.jsx(ss,{id:"description",value:K.description,onChange:be=>W({...K,description:be.target.value}),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(ot,{id:"base_price",type:"number",step:"0.01",min:"0",value:K.base_price,onChange:be=>W({...K,base_price:parseFloat(be.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(ot,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:K.shipping_fee,onChange:be=>W({...K,shipping_fee:parseFloat(be.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(ot,{id:"sort_order",type:"number",value:K.sort_order,onChange:be=>W({...K,sort_order:parseInt(be.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{id:"allow_artwork_upload",checked:K.allow_artwork_upload,onCheckedChange:be=>W({...K,allow_artwork_upload:be})}),r.jsx(qe,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{id:"requires_proof_approval",checked:K.requires_proof_approval,onCheckedChange:be=>W({...K,requires_proof_approval:be})}),r.jsx(qe,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{id:"is_active",checked:K.is_active,onCheckedChange:be=>W({...K,is_active:be})}),r.jsx(qe,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:s.isPending||a.isPending,children:A?"Update Product":"Create Product"})]})]})]})]}),r.jsx(et,{children:t&&t.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(be=>{var rt,Te;return r.jsxs(Ke,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[be.images&&be.images.length>0?r.jsx("img",{src:((rt=be.images.find(Pe=>Pe.is_primary))==null?void 0:rt.image_url)||be.images[0].image_url,alt:be.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"}),!be.is_active&&r.jsx(Lt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:be.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Te=be.category)==null?void 0:Te.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(be.base_price).toFixed(2)]}),Number(be.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(be.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[be.allow_artwork_upload&&r.jsx(Lt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),be.requires_proof_approval&&r.jsx(Lt,{variant:"outline",className:"text-xs",children:"Proof Required"}),be.variants&&be.variants.length>0&&r.jsxs(Lt,{variant:"outline",className:"text-xs",children:[be.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>pe(be),children:[r.jsx(ni,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{R(be),N(!0)},children:[r.jsx(mS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{R(be),E(!0)},children:[r.jsx(Eg,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>fe(be.id),children:r.jsx($n,{className:"h-3 w-3 text-destructive"})})]})]})]},be.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(Dr,{open:S,onOpenChange:N,children:r.jsxs(Or,{className:"max-w-2xl",children:[r.jsx(Br,{children:r.jsxs(zr,{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:(Se=z==null?void 0:z.images)==null?void 0:Se.map(be=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:be.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),be.is_primary&&r.jsx(Lt,{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:[!be.is_primary&&r.jsx(te,{variant:"secondary",size:"icon",onClick:async()=>{var rt;await u.mutateAsync({imageId:be.id,productId:z.id}),R({...z,images:(rt=z.images)==null?void 0:rt.map(Te=>({...Te,is_primary:Te.id===be.id}))})},disabled:u.isPending,title:"Set as primary",children:r.jsx(_s,{className:"h-4 w-4"})}),r.jsx(te,{variant:"destructive",size:"icon",onClick:async()=>{var Te;await i.mutateAsync({id:be.id,productId:z.id});const rt=t==null?void 0:t.find(Pe=>Pe.id===z.id);rt&&R({...rt,images:(Te=rt.images)==null?void 0:Te.filter(Pe=>Pe.id!==be.id)})},disabled:i.isPending,children:r.jsx($n,{className:"h-4 w-4"})})]})]},be.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:he,className:"hidden",id:"image-upload",disabled:U}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(mS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:U?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(qe,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(ot,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:oe,onChange:be=>xe(be.target.value)}),r.jsxs(te,{onClick:Ce,disabled:!oe,children:[r.jsx(Da,{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(Dr,{open:M,onOpenChange:E,children:r.jsxs(Or,{children:[r.jsx(Br,{children:r.jsxs(zr,{children:["Manage Variants - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:ye,className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Variant name (e.g., 500 count)",value:J.name,onChange:be=>ae({...J,name:be.target.value}),required:!0}),r.jsx(ot,{type:"number",step:"0.01",placeholder:"Price adj.",value:J.price_adjustment,onChange:be=>ae({...J,price_adjustment:parseFloat(be.target.value)||0}),className:"w-32"}),r.jsx(te,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(Ne=z==null?void 0:z.variants)==null?void 0:Ne.map(be=>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:be.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(be.price_adjustment)>=0?"+":"","$",Number(be.price_adjustment).toFixed(2)]})]}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:be.id,productId:z.id}),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]},be.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 cYt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function dYt(){var N,M,E;const{data:t,isLoading:e}=eYt(),n=nYt(),s=sYt(),[a,o]=I.useState(null),[l,i]=I.useState(!1),[u,p]=I.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=I.useState(!1),_=A=>{o(A),p({status:A.status,notes:"",trackingNumber:A.tracking_number||"",trackingUrl:A.tracking_url||""}),i(!0)},w=async()=>{a&&(await n.mutateAsync({orderId:a.id,status:u.status,notes:u.notes,trackingNumber:u.trackingNumber,trackingUrl:u.trackingUrl,previousStatus:a.status}),i(!1))},S=async(A,P)=>{if(!a||!A.target.files||A.target.files.length===0)return;y(!0);const z=A.target.files[0],R=z.name.split(".").pop(),U=`proofs/${a.id}/${P}/${Date.now()}.${R}`;try{const{error:V}=await Q.storage.from("marketplace").upload(U,z);if(V)throw V;const{data:{publicUrl:K}}=Q.storage.from("marketplace").getPublicUrl(U);await s.mutateAsync({itemId:P,proofUrl:K,orderId:a.id}),Oe.success("Proof uploaded successfully")}catch(V){Oe.error("Failed to upload proof: "+V.message)}finally{y(!1)}};return e?r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(A=>r.jsx(Ir,{className:"h-16 w-full"},A))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Orders"})}),r.jsx(et,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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(A=>{var P,z;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"font-mono",children:A.order_number}),r.jsx(jt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((P=A.user)==null?void 0:P.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(z=A.user)==null?void 0:z.email})]})}),r.jsx(jt,{children:mn(new Date(A.created_at),"MMM d, yyyy")}),r.jsxs(jt,{className:"font-bold",children:["$",Number(A.total).toFixed(2)]}),r.jsx(jt,{children:r.jsx(Lt,{className:o1e[A.status],children:KS[A.status]})}),r.jsx(jt,{className:"text-right",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>_(A),children:[r.jsx($o,{className:"h-4 w-4 mr-1"}),"View"]})})]},A.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx(Dr,{open:l,onOpenChange:i,children:r.jsxs(Or,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Br,{children:r.jsxs(zr,{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:(M=a.user)==null?void 0:M.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(A=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.product_name}),A.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:A.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(A.unit_price).toFixed(2)," x ",A.quantity]})]}),A.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:A.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(Lt,{variant:A.proof_status==="approved"?"default":"secondary",children:A.proof_status||"No proof yet"})]}),A.proof_url?r.jsx("a",{href:A.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):r.jsxs("div",{children:[r.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:P=>S(P,A.id),className:"hidden",id:`proof-${A.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${A.id}`,children:r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(ho,{className:"h-4 w-4 mr-1"}),x?"Uploading...":"Upload Proof"]})})})]})]})})]},A.id))})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(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(qe,{children:"Status"}),r.jsxs(xn,{value:u.status,onValueChange:A=>p({...u,status:A}),children:[r.jsx(fn,{children:r.jsx(vn,{})}),r.jsx(pn,{children:cYt.map(A=>r.jsx(qt,{value:A,children:KS[A]},A))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Tracking Number"}),r.jsx(ot,{value:u.trackingNumber,onChange:A=>p({...u,trackingNumber:A.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Tracking URL"}),r.jsx(ot,{value:u.trackingUrl,onChange:A=>p({...u,trackingUrl:A.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Notes (optional)"}),r.jsx(ss,{value:u.notes,onChange:A=>p({...u,notes:A.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(te,{onClick:w,disabled:n.isPending,className:"w-full",children:[r.jsx($l,{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(A=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Lt,{variant:"outline",children:KS[A.status]}),A.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:A.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:mn(new Date(A.created_at),"MMM d, h:mm a")})]},A.id))})]})]})]})})]})}function uYt(){const[t,e]=I.useState("products"),n=Gn();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(te,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(ki,{value:t,onValueChange:e,children:[r.jsxs(pi,{className:"grid w-full grid-cols-3",children:[r.jsxs(rn,{value:"products",className:"flex items-center gap-2",children:[r.jsx($l,{className:"h-4 w-4"}),"Products"]}),r.jsxs(rn,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(Sg,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(rn,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(_h,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Sn,{value:"products",children:r.jsx(lYt,{})}),r.jsx(Sn,{value:"categories",children:r.jsx(oYt,{})}),r.jsx(Sn,{value:"orders",children:r.jsx(dYt,{})})]})]})})}function JUe(){return Kt({queryKey:["reward-categories"],queryFn:async()=>{const{data:t,error:e}=await Q.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(e)throw e;return t}})}function hYt(t){return Kt({queryKey:["reward-items",t],queryFn:async()=>{let e=Q.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 fYt(t){return Kt({queryKey:["active-reward-items",t],queryFn:async()=>{let e=Q.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 pYt(t){return Kt({queryKey:["user-purchases",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await Q.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 mYt(){return Kt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:t,error:e}=await Q.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 Q.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 gYt(t){return Kt({queryKey:["spendable-points",t],queryFn:async()=>{if(!t)return 0;const{data:e,error:n}=await Q.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 xYt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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 yYt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.from("reward_store_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function vYt(){const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.from("reward_store_categories").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function _Yt(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.from("reward_store_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function bYt(){const t=qr();return or({mutationFn:async e=>{const{data:n,error:s}=await Q.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 wYt(){const t=qr();return or({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await Q.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 jYt(){const t=qr();return or({mutationFn:async e=>{const{error:n}=await Q.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 kYt(t){const e=t.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return e?{bucket:e[1],path:e[2]}:null}async function Ide(t,e){const n=kYt(t);if(n)try{const{data:s,error:a}=await Q.storage.from(n.bucket).download(n.path);if(a){console.error("Error downloading file:",a),Oe.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),Oe.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),Oe.error("Failed to download file")}}function eqe(){return Kt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:t,error:e}=await Q.from("point_reward_settings").select("*").order("action_name");if(e)throw e;return t}})}function NYt(){const t=qr();return or({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 Q.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 SYt(){const{user:t}=Qr(),[e,n]=I.useState("items"),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,u]=I.useState(""),[p,x]=I.useState(""),[y,_]=I.useState(""),[w,S]=I.useState(null),[N,M]=I.useState(!1),[E,A]=I.useState(null),[P,z]=I.useState(""),[R,U]=I.useState(""),[V,K]=I.useState(null),[W,J]=I.useState(""),[ae,oe]=I.useState("file"),[xe,ie]=I.useState(""),[pe,se]=I.useState(""),[fe,he]=I.useState(""),[ye,Ce]=I.useState(!0),[Se,Ne]=I.useState(null),[be,rt]=I.useState(!1),[Te,Pe]=I.useState(!1),Ue=I.useRef(null),Re=I.useRef(null),{data:Be,isLoading:Ye}=JUe(),{data:ht,isLoading:Me}=hYt(),{data:Qe,isLoading:le}=mYt(),{data:Ve,isLoading:Le}=eqe(),We=yYt(),_e=vYt(),st=_Yt(),ze=bYt(),Ee=wYt(),Je=jYt(),at=NYt(),[pt,gt]=I.useState({}),Mt=hr=>{hr?(l(hr),u(hr.name),x(hr.description||""),_(hr.icon||"")):(l(null),u(""),x(""),_("")),a(!0)},wt=async()=>{if(!i.trim()){Oe.error("Please enter a category name");return}try{o?(await _e.mutateAsync({id:o.id,name:i,description:p||null,icon:y||null}),Oe.success("Category updated successfully")):(await We.mutateAsync({name:i,description:p||null,icon:y||null,sort_order:((Be==null?void 0:Be.length)||0)+1}),Oe.success("Category created successfully")),a(!1)}catch(hr){console.error("Error saving category:",hr),Oe.error("Failed to save category")}},Xt=async()=>{if(w)try{await st.mutateAsync(w),Oe.success("Category deleted successfully"),S(null)}catch(hr){console.error("Error deleting category:",hr),Oe.error("Failed to delete category")}},Sr=hr=>{var ys;hr?(A(hr),z(hr.name),U(hr.description||""),K(hr.category_id),J(hr.points_cost.toString()),oe(hr.item_type),ie(hr.file_url||""),se(hr.preview_image_url||""),he(((ys=hr.max_quantity)==null?void 0:ys.toString())||""),Ce(hr.is_active)):(A(null),z(""),U(""),K(null),J(""),oe("file"),ie(""),se(""),he(""),Ce(!0)),M(!0)},an=async(hr,ys)=>{ys==="file"?rt(!0):Pe(!0);try{const Ca=hr.name.split(".").pop(),va=`${Date.now()}-${Math.random().toString(36).substring(7)}.${Ca}`,$i=`${ys==="file"?"items":"previews"}/${va}`,{error:Ui}=await Q.storage.from("reward-store").upload($i,hr);if(Ui)throw Ui;const{data:{publicUrl:al}}=Q.storage.from("reward-store").getPublicUrl($i);ys==="file"?ie(al):se(al),Oe.success("File uploaded successfully")}catch(Ca){console.error("Error uploading file:",Ca),Oe.error("Failed to upload file")}finally{ys==="file"?rt(!1):Pe(!1)}},wn=async()=>{if(!P.trim()){Oe.error("Please enter an item name");return}if(!W||parseInt(W)<0){Oe.error("Please enter a valid points cost");return}try{const hr={name:P,description:R||null,category_id:V,points_cost:parseInt(W),item_type:ae,file_url:xe||null,preview_image_url:pe||null,max_quantity:fe?parseInt(fe):null,current_quantity:fe?parseInt(fe):null,is_active:ye,created_by:t==null?void 0:t.id};E?(await Ee.mutateAsync({id:E.id,...hr,current_quantity:E.max_quantity!==(fe?parseInt(fe):null)?fe?parseInt(fe):null:E.current_quantity}),Oe.success("Item updated successfully")):(await ze.mutateAsync(hr),Oe.success("Item created successfully")),M(!1)}catch(hr){console.error("Error saving item:",hr),Oe.error("Failed to save item")}},Xr=async()=>{if(Se)try{await Je.mutateAsync(Se),Oe.success("Item deleted successfully"),Ne(null)}catch(hr){console.error("Error deleting item:",hr),Oe.error("Failed to delete item")}},Pn=async(hr,ys)=>{const Ca=pt[hr];if(Ca===void 0||Ca===ys.toString())return;const va=parseInt(Ca);if(isNaN(va)||va<0){Oe.error("Please enter a valid positive number");return}try{await at.mutateAsync({id:hr,points:va}),Oe.success("Points updated successfully"),gt($i=>{const Ui={...$i};return delete Ui[hr],Ui})}catch($i){console.error("Error updating points:",$i),Oe.error("Failed to update points")}};return Ye||Me||le||Le?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(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($l,{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:(ht==null?void 0:ht.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(ht==null?void 0:ht.filter(hr=>hr.is_active).length)||0," active"]})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Sg,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Be==null?void 0:Be.length)||0})]})}),r.jsx(Ke,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(_s,{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:[ht&&ht.length>0?Math.round(ht.reduce((hr,ys)=>hr+ys.points_cost,0)/ht.length):0," pts"]})]})})]}),r.jsxs(ki,{value:e,onValueChange:n,children:[r.jsxs(pi,{children:[r.jsx(rn,{value:"items",children:"Items"}),r.jsx(rn,{value:"categories",children:"Categories"}),r.jsx(rn,{value:"purchases",children:"Purchases"}),r.jsx(rn,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Sn,{value:"items",className:"mt-4",children:r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Store Items"}),r.jsx(Cn,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(te,{onClick:()=>Sr(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(et,{children:!ht||ht.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 items yet. Add your first reward item!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Mr,{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:ht.map(hr=>r.jsxs(Mr,{children:[r.jsx(jt,{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(Zi,{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(jt,{children:hr.category?r.jsx(Lt,{variant:"outline",children:hr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(jt,{className:"text-center",children:r.jsxs(Lt,{variant:"secondary",className:"font-bold",children:[r.jsx(_s,{className:"h-3 w-3 mr-1"}),hr.points_cost]})}),r.jsx(jt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[hr.item_type==="file"?r.jsx(ka,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:hr.item_type})]})}),r.jsx(jt,{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(jt,{className:"text-center",children:r.jsx(Lt,{variant:hr.is_active?"default":"secondary",children:hr.is_active?"Active":"Inactive"})}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Sr(hr),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ne(hr.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},hr.id))})]})})]})}),r.jsx(Sn,{value:"categories",className:"mt-4",children:r.jsxs(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Categories"}),r.jsx(Cn,{children:"Organize your store items into categories"})]}),r.jsxs(te,{onClick:()=>Mt(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(et,{children:!Be||Be.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Sg,{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(Mr,{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:Be.map(hr=>r.jsxs(Mr,{children:[r.jsxs(jt,{className:"font-medium",children:[hr.icon&&r.jsx("span",{className:"mr-2",children:hr.icon}),hr.name]}),r.jsx(jt,{className:"text-muted-foreground",children:hr.description||"—"}),r.jsx(jt,{className:"text-center",children:(ht==null?void 0:ht.filter(ys=>ys.category_id===hr.id).length)||0}),r.jsx(jt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Mt(hr),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>S(hr.id),children:r.jsx($n,{className:"h-4 w-4 text-destructive"})})]})})]},hr.id))})]})})]})}),r.jsx(Sn,{value:"purchases",className:"mt-4",children:r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(_h,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(Cn,{children:"View all reward redemptions by agents"})]}),r.jsx(et,{children:!Qe||Qe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(_h,{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(Mr,{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:Qe.map(hr=>{var ys,Ca,va,$i;return r.jsxs(Mr,{children:[r.jsx(jt,{className:"text-muted-foreground",children:mn(new Date(hr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(jt,{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(ac,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((ys=hr.user)==null?void 0:ys.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((Ca=hr.user)==null?void 0:Ca.email)||"—"})]})]})}),r.jsx(jt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(va=hr.item)!=null&&va.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(Zi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:(($i=hr.item)==null?void 0:$i.name)||"Deleted item"})]})}),r.jsx(jt,{className:"text-center",children:r.jsxs(Lt,{variant:"secondary",className:"font-bold",children:[r.jsx(_s,{className:"h-3 w-3 mr-1"}),hr.points_spent]})})]},hr.id)})})]})})]})})]})]}),r.jsx(Dr,{open:s,onOpenChange:a,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:o?"Edit Category":"Add Category"}),r.jsx(Jn,{children:o?"Update the category details":"Create a new category for your store items"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"categoryName",children:"Name"}),r.jsx(ot,{id:"categoryName",value:i,onChange:hr=>u(hr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(ss,{id:"categoryDescription",value:p,onChange:hr=>x(hr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(ot,{id:"categoryIcon",value:y,onChange:hr=>_(hr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{onClick:wt,disabled:We.isPending||_e.isPending,children:We.isPending||_e.isPending?"Saving...":"Save"})]})]})}),r.jsx(Dr,{open:N,onOpenChange:M,children:r.jsxs(Or,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Br,{children:[r.jsx(zr,{children:E?"Edit Item":"Add Item"}),r.jsx(Jn,{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(qe,{htmlFor:"itemName",children:"Name *"}),r.jsx(ot,{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(qe,{htmlFor:"itemDescription",children:"Description"}),r.jsx(ss,{id:"itemDescription",value:R,onChange:hr=>U(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(qe,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(xn,{value:V||"none",onValueChange:hr=>K(hr==="none"?null:hr),children:[r.jsx(fn,{children:r.jsx(vn,{placeholder:"Select category"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No category"}),Be==null?void 0:Be.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(qe,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(ot,{id:"itemPointsCost",type:"number",min:"0",value:W,onChange:hr=>J(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(qe,{htmlFor:"itemType",children:"Type"}),r.jsxs(xn,{value:ae,onValueChange:oe,children:[r.jsx(fn,{children:r.jsx(vn,{})}),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(qe,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(ot,{id:"itemMaxQuantity",type:"number",min:"1",value:fe,onChange:hr=>he(hr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:xe,onChange:hr=>ie(hr.target.value),placeholder:ae==="file"?"Upload a file or paste URL":"Paste external link"}),ae==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>{var hr;return(hr=Ue.current)==null?void 0:hr.click()},disabled:be,children:r.jsx(ho,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ue,type:"file",className:"hidden",onChange:hr=>{var Ca;const ys=(Ca=hr.target.files)==null?void 0:Ca[0];ys&&an(ys,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:pe,onChange:hr=>se(hr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>{var hr;return(hr=Re.current)==null?void 0:hr.click()},disabled:Te,children:r.jsx(Ol,{className:"h-4 w-4"})}),r.jsx("input",{ref:Re,type:"file",accept:"image/*",className:"hidden",onChange:hr=>{var Ca;const ys=(Ca=hr.target.files)==null?void 0:Ca[0];ys&&an(ys,"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(Ss,{id:"itemIsActive",checked:ye,onCheckedChange:Ce}),r.jsx(qe,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsx(te,{onClick:wn,disabled:ze.isPending||Ee.isPending,children:ze.isPending||Ee.isPending?"Saving...":"Save"})]})]})}),r.jsx(pu,{open:!!w,onOpenChange:()=>S(null),children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Delete Category"}),r.jsx(Zd,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:Xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(pu,{open:!!Se,onOpenChange:()=>Ne(null),children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Delete Item"}),r.jsx(Zd,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:Xr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e==="point-settings"&&r.jsxs(Ke,{className:"mt-4",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jd,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Point Reward Settings"}),r.jsx(Cn,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(et,{children:!Ve||Ve.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(jd,{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(Mr,{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:Ve.map(hr=>r.jsxs(Mr,{children:[r.jsx(jt,{children:r.jsx("p",{className:"font-medium",children:hr.action_name})}),r.jsx(jt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:hr.description})}),r.jsx(jt,{className:"text-center",children:r.jsx(ot,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:pt[hr.id]??hr.points.toString(),onChange:ys=>gt(Ca=>({...Ca,[hr.id]:ys.target.value}))})}),r.jsx(jt,{className:"text-right",children:r.jsx(te,{size:"sm",variant:"outline",disabled:pt[hr.id]===void 0||pt[hr.id]===hr.points.toString()||at.isPending,onClick:()=>Pn(hr.id,hr.points),children:r.jsx(km,{className:"h-4 w-4"})})})]},hr.id))})]})})]})]})}function CYt(){const t=qr(),[e,n]=I.useState(!1),{data:s,isLoading:a}=Kt({queryKey:["social-accounts"],queryFn:async()=>{const{data:p,error:x}=await Q.from("social_accounts").select("*").order("created_at",{ascending:!1});if(x)throw x;return p}}),o=or({mutationFn:async p=>{const{error:x}=await Q.from("social_accounts").delete().eq("id",p);if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),Oe.success("Account disconnected successfully")},onError:()=>{Oe.error("Failed to disconnect account")}}),l=async()=>{n(!0);try{const{data:p,error:x}=await Q.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),Oe.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"))||[],u=(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(ju,{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(Ke,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-2",children:r.jsx(Jd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Facebook"}),r.jsx(Cn,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(et,{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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:p.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(Jd,{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(Lt,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect Facebook?"}),r.jsx(Zd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{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(te,{onClick:l,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Ll,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-2",children:r.jsx(mu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Instagram"}),r.jsx(Cn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[u.length>0?r.jsx("div",{className:"space-y-3",children:u.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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:p.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(mu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",p.platform_username||"Instagram Account"]}),r.jsx(Lt,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect Instagram?"}),r.jsx(Zd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{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(te,{onClick:l,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Ll,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{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(Ke,{children:[r.jsxs(Ht,{children:[r.jsx(Zt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(Cn,{children:"Follow these steps to set up Meta integration"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Create a Meta App"}),r.jsx("p",{className:"text-muted-foreground",children:"Go to developers.facebook.com and create a new app"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Add Facebook Login Product"}),r.jsx("p",{className:"text-muted-foreground",children:"Enable Facebook Login and configure OAuth redirect URLs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Configure API Keys"}),r.jsx("p",{className:"text-muted-foreground",children:"Add META_APP_ID and META_APP_SECRET to your environment"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"4"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Request Permissions"}),r.jsx("p",{className:"text-muted-foreground",children:"Request pages_manage_posts, pages_read_engagement, instagram_basic, and instagram_content_publish"})]})]})]}),r.jsx(te,{variant:"outline",className:"gap-2",asChild:!0,children:r.jsxs("a",{href:"https://developers.facebook.com/apps",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Os,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const MYt={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 hT(t,e=18,n=10){return t.length<=e+n+3?t:`${t.slice(0,e)}…${t.slice(-n)}`}function TYt(){var ae,oe,xe,ie,pe;const t=qr(),[e,n]=I.useState("Test Push"),[s,a]=I.useState("Testing web push notification"),[o,l]=I.useState("/community"),[i,u]=I.useState(!1),[p,x]=I.useState(!1),[y,_]=I.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[w,S]=I.useState(null),[N,M]=I.useState(null),{data:E,isLoading:A}=Kt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:se,error:fe}=await Q.from("push_notification_settings").select("*").order("setting_key");if(fe)throw fe;return se}}),{data:P,isLoading:z}=Kt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:se,error:fe}=await Q.from("push_subscriptions").select("*",{count:"exact",head:!0});if(fe)throw fe;return{totalSubscriptions:se||0}}}),R=or({mutationFn:async({settingKey:se,isEnabled:fe})=>{const{error:he}=await Q.from("push_notification_settings").update({is_enabled:fe}).eq("setting_key",se);if(he)throw he},onSuccess:()=>{t.invalidateQueries({queryKey:["push-notification-settings"]}),Oe.success("Notification setting updated")},onError:se=>{Oe.error("Failed to update setting: "+se.message)}}),U=I.useMemo(()=>{var se,fe;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((se=y.serviceWorker)==null?void 0:se.activeState)??"unknown"} · sub=${(fe=y.subscription)!=null&&fe.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);I.useEffect(()=>{let se=!0;const fe=async()=>{var Se,Ne,be,rt,Te,Pe,Ue;const ye="serviceWorker"in navigator&&"PushManager"in window,Ce={isSupported:ye,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((Se=navigator.serviceWorker)!=null&&Se.controller)};if(!ye){se&&_(Ce);return}try{const{data:Re,error:Be}=await Q.functions.invoke("get-vapid-public-key",{body:{}});if(Be)throw Be;Ce.vapidPublicKey=Re==null?void 0:Re.vapidPublicKey;const ht=(await navigator.serviceWorker.getRegistrations()).find(Me=>{var le,Ve,Le;return(((le=Me.active)==null?void 0:le.scriptURL)||((Ve=Me.waiting)==null?void 0:Ve.scriptURL)||((Le=Me.installing)==null?void 0:Le.scriptURL)||"").includes("/sw.js")});if(ht){Ce.pushWorkerScriptUrl=((Ne=ht.active)==null?void 0:Ne.scriptURL)||((be=ht.waiting)==null?void 0:be.scriptURL)||((rt=ht.installing)==null?void 0:rt.scriptURL),Ce.serviceWorker={scope:ht.scope,activeState:(Te=ht.active)==null?void 0:Te.state};const Me=await ht.pushManager.getSubscription();if(Me){const Qe=Me.toJSON();Ce.subscription={endpoint:Qe.endpoint,p256dh:(Pe=Qe.keys)==null?void 0:Pe.p256dh,auth:(Ue=Qe.keys)==null?void 0:Ue.auth}}}}catch(Re){Ce.error=(Re==null?void 0:Re.message)||String(Re)}se&&_(Ce)};fe();const he=window.setInterval(fe,4e3);return()=>{se=!1,window.clearInterval(he)}},[]);const V=async()=>{if(typeof Notification>"u"){Oe.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){Oe.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),Oe.success("Triggered a local notification (not push).")}catch(se){Oe.error(`Local notification failed: ${(se==null?void 0:se.message)||String(se)}`)}},K=async()=>{u(!0),S(null);try{const{data:se,error:fe}=await Q.functions.invoke("send-push-notification",{body:{title:e,body:s,url:o}});if(fe)throw fe;S({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?Oe.success(`Test notification sent to ${se.sent} subscriber(s)`):(se==null?void 0:se.failed)>0?Oe.warning(`Notification failed for ${se.failed} subscriber(s). ${se.expired||0} expired subscriptions cleaned up.`):Oe.info("No active subscriptions to send to")}catch(se){console.error("Error sending test notification:",se),S({error:(se==null?void 0:se.message)||String(se)}),Oe.error("Failed to send test notification: "+(se.message||"Unknown error"))}finally{u(!1)}},W=async()=>{x(!0),M(null);try{const{data:se,error:fe}=await Q.functions.invoke("generate-vapid-keys",{body:{}});if(fe)throw fe;const he=se==null?void 0:se.publicKey,ye=se==null?void 0:se.privateKey;if(!he||!ye)throw new Error("generate-vapid-keys did not return keys");M({publicKey:he,privateKey:ye}),Oe.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(se){console.error("Error generating VAPID keys:",se),Oe.error("Failed to generate VAPID keys: "+((se==null?void 0:se.message)||"Unknown error"))}finally{x(!1)}},J=or({mutationFn:async()=>{const{error:se}=await Q.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(se)throw se},onSuccess:()=>{Oe.success("All subscriptions cleared. Users will need to re-enable notifications."),t.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:se=>{Oe.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(ju,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(Cn,{children:"Current active push notification subscriptions"})]}),r.jsx(et,{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(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(jd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(Cn,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(et,{children:A?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 fe=MYt[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:fe.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:fe.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:se.description})]})]}),r.jsx(Ss,{checked:se.is_enabled,onCheckedChange:he=>R.mutate({settingKey:se.setting_key,isEnabled:he}),disabled:R.isPending})]},se.id)})})})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(kg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(Cn,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(et,{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:U}),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?hT(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: ",(ae=y.serviceWorker)!=null&&ae.scope?hT(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: ",(xe=y.subscription)!=null&&xe.endpoint?hT(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ie=y.subscription)!=null&&ie.p256dh?hT(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(pe=y.subscription)!=null&&pe.auth?hT(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(te,{variant:"outline",onClick:V,children:"Local notification test"}),r.jsx(te,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(ot,{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(qe,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(ss,{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(qe,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(ot,{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(te,{onClick:K,disabled:i||!e||!s,className:"w-full sm:w-auto",children:[r.jsx(eo,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Test Notification"]}),w&&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"}),w.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",w.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",w.sent??0," sent, ",w.failed??0," failed, ",w.expiredCleaned??0," expired cleaned"]}),w.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:w.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ke,{children:[r.jsxs(Ht,{children:[r.jsxs(Zt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx($n,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(Cn,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(te,{variant:"destructive",onClick:()=>J.mutate(),disabled:J.isPending,children:[r.jsx($n,{className:"h-4 w-4 mr-2"}),J.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(te,{variant:"outline",onClick:W,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 AYt(){const[t]=rd(),e=Gn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Processing connection...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),u=t.get("error"),p=t.get("error_description"),x=t.get("state");if(u){s("error"),o(p||"Authorization was denied"),Oe.error("Failed to connect: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Oe.error("Failed to connect: No authorization code");return}try{const{data:y,error:_}=await Q.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!"),Oe.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"),Oe.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(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(Yr,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(Ii,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Zt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Cn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(te,{onClick:()=>e("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function EYt(){const t=Gn(),e=qr(),{isAdmin:n}=Qr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,u]=I.useState(null),{data:p,isLoading:x}=Kt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:R},error:U}=await Q.auth.getUser();if(U)throw U;if(!R)return[];const{data:V,error:K}=await Q.from("social_accounts").select("*").eq("user_id",R.id).order("created_at",{ascending:!1});if(K)throw K;return V}}),y=or({mutationFn:async R=>{const{data:{user:U},error:V}=await Q.auth.getUser();if(V)throw V;if(!U)throw new Error("Not authenticated");const{error:K}=await Q.from("social_accounts").delete().eq("id",R).eq("user_id",U.id);if(K)throw K},onSuccess:()=>{e.invalidateQueries({queryKey:["my-social-accounts"]}),e.invalidateQueries({queryKey:["social-accounts-for-post"]}),Oe.success("Account disconnected successfully")},onError:()=>{Oe.error("Failed to disconnect account")}}),_=async()=>{a(!0);try{const{data:R,error:U}=await Q.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(U)throw U;if(R!=null&&R.authUrl)window.location.href=R.authUrl;else throw new Error("Failed to get authorization URL")}catch(R){console.error("Meta OAuth error:",R),Oe.error("Failed to start connection. Please try again."),a(!1)}},w=async()=>{a(!0);try{const{data:R,error:U}=await Q.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(U)throw U;if(R!=null&&R.authUrl)window.location.href=R.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(R){console.error("LinkedIn OAuth error:",R),Oe.error("Failed to start LinkedIn connection. Please try again."),a(!1)}},S=async()=>{a(!0);try{const{data:R,error:U}=await Q.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(U)throw U;if(R!=null&&R.authUrl)window.location.href=R.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(R){console.error("Google OAuth error:",R),Oe.error("Failed to start Google connection. Please try again."),a(!1)}},N=(p==null?void 0:p.filter(R=>R.platform==="facebook"))||[],M=(p==null?void 0:p.filter(R=>R.platform==="instagram"))||[],E=(p==null?void 0:p.filter(R=>R.platform==="linkedin"))||[],A=(p==null?void 0:p.filter(R=>R.platform==="google_business"))||[],P=((p==null?void 0:p.length)||0)>0,z=async(R,U)=>{l(R),u(null);try{const{data:V,error:K}=await Q.functions.invoke("meta-api-test",{body:{testType:"all",accountId:R}});if(K)throw K;u(V.results||[]),Oe.success(V.summary||"API tests completed")}catch(V){console.error("Meta API test error:",V),Oe.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(Lt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),r.jsx("p",{className:"text-white/90 max-w-xl",children:"Link your Facebook Pages and Instagram Business accounts to post content directly from Social Swag with one click."})]})]}),r.jsxs(te,{variant:"ghost",onClick:()=>t("/social-swag-2"),className:"gap-2",children:[r.jsx(io,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(Ke,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(et,{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(Wa,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Lt,{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(Ke,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(et,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(Ii,{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(Ke,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:r.jsx(Jd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Facebook"}),r.jsx(Cn,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Ll,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):N.length>0?r.jsx("div",{className:"space-y-3",children:N.map(R=>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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:R.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(Jd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:R.page_name||R.platform_username||"Facebook Page"}),r.jsx(Lt,{variant:R.is_active?"default":"secondary",className:"text-xs",children:R.is_active?"Connected":"Inactive"})]})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect Facebook?"}),r.jsx(Zd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:()=>y.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(te,{onClick:_,disabled:s,className:"w-full gap-2",variant:N.length>0?"outline":"default",children:[s?r.jsx(Ll,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),N.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:r.jsx(mu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Instagram"}),r.jsx(Cn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Ll,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length>0?r.jsx("div",{className:"space-y-3",children:M.map(R=>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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:R.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(mu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",R.platform_username||"Instagram Account"]}),r.jsx(Lt,{variant:R.is_active?"default":"secondary",className:"text-xs",children:R.is_active?"Connected":"Inactive"})]})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect Instagram?"}),r.jsx(Zd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:()=>y.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(te,{onClick:_,disabled:s,className:"w-full gap-2",variant:M.length>0?"outline":"default",children:[s?r.jsx(Ll,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),M.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(Ke,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:r.jsx(wm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"LinkedIn"}),r.jsx(Cn,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Ll,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):E.length>0?r.jsx("div",{className:"space-y-3",children:E.map(R=>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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:R.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(wm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:R.platform_username||"LinkedIn Account"}),r.jsx(Lt,{variant:R.is_active?"default":"secondary",className:"text-xs",children:R.is_active?"Connected":"Inactive"})]})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect LinkedIn?"}),r.jsx(Zd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:()=>y.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(te,{onClick:w,disabled:s,className:"w-full gap-2",variant:E.length>0?"outline":"default",children:[s?r.jsx(Ll,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{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(Ke,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Lt,{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(Lt,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:r.jsx(To,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Google Business"}),r.jsx(Cn,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Ll,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?r.jsx("div",{className:"space-y-3",children:A.map(R=>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(Ys,{className:"h-10 w-10",children:[r.jsx(Pi,{src:R.profile_picture_url||""}),r.jsx(Xs,{children:r.jsx(To,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:R.page_name||R.platform_username||"Google Business"}),r.jsx(Lt,{variant:R.is_active?"default":"secondary",className:"text-xs",children:R.is_active?"Connected":"Inactive"})]})]}),r.jsxs(pu,{children:[r.jsx(Hx,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx($n,{className:"h-4 w-4"})})}),r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Disconnect Google Business?"}),r.jsx(Zd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:()=>y.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:n?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(te,{onClick:n?S:void 0,disabled:!n||s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(Ll,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),A.length>0?"Reconnect Google Business":"Connect Google Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),n&&(N.length>0||M.length>0)&&r.jsxs(Ke,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:r.jsx(jj,{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(Cn,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(et,{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(R=>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(Jd,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:R.page_name||"Facebook Page"})]}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>z(R.id),disabled:o===R.id,children:o===R.id?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(jj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${R.id}`)),M.map(R=>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(mu,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",R.platform_username||"Instagram"]})]}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>z(R.id),disabled:o===R.id,children:o===R.id?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(jj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${R.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((R,U)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[R.status==="success"?r.jsx(Xi,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):R.status==="pending"?r.jsx(Yr,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(Lc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:R.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:R.details})]})]},U))})]}),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(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{className:"text-lg",children:"How it works"})}),r.jsx(et,{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 IYt(){const[t]=rd(),e=Gn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Processing your connection...");return I.useEffect(()=>{(async()=>{var y;const i=t.get("code"),u=t.get("error"),p=t.get("error_description"),x=t.get("state");if(u){s("error"),o(p||"Authorization was denied"),Oe.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Oe.error("No authorization code received");return}try{const{data:_,error:w}=await Q.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/social-connections/callback"}});if(w)throw w;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||0} account(s)!`),Oe.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"),Oe.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(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Yr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Ii,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Zt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Cn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function PYt(){const[t]=rd(),e=Gn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your Google Business Profile...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),u=t.get("error"),p=t.get("error_description"),x=t.get("state");if(u){s("error"),o(p||"Authorization was denied"),Oe.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Oe.error("No authorization code received");return}try{const{data:y,error:_}=await Q.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!"),Oe.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"),Oe.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(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Yr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Ii,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Zt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Cn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function LYt(){const[t]=rd(),e=Gn(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your LinkedIn account...");return I.useEffect(()=>{(async()=>{var y;const i=t.get("code"),u=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"),Oe.error(x||"Failed to connect LinkedIn");return}if(!i){s("error"),o("No authorization code received"),Oe.error("No authorization code received");return}try{const{data:_,error:w}=await Q.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:i,state:u,callbackPath:"/social-connections/linkedin-callback"}});if(w)throw w;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||1} LinkedIn account`),Oe.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"),Oe.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(Ke,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[n==="loading"&&r.jsx(Yr,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(Ii,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(Lc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Zt,{className:"flex items-center justify-center gap-2",children:[r.jsx(wm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Cn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(te,{onClick:()=>e("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function OYt(){const t=Gn(),[e,n]=I.useState(null),{data:s,isLoading:a}=QUe(e||void 0,!0),{data:o,isLoading:l}=l1e(!0),{cartItems:i}=Ose(),u=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(te,{variant:"outline",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(_h,{className:"h-4 w-4 mr-2"}),"Cart",u>0&&r.jsx(Lt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:u})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(te,{variant:e===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(te,{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(Ke,{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($l,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Lt,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(et,{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($l,{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 tqe=I.forwardRef(({...t},e)=>r.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));tqe.displayName="Breadcrumb";const rqe=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}));rqe.displayName="BreadcrumbList";const Eee=I.forwardRef(({className:t,...e},n)=>r.jsx("li",{ref:n,className:zt("inline-flex items-center gap-1.5",t),...e}));Eee.displayName="BreadcrumbItem";const ume=I.forwardRef(({asChild:t,className:e,...n},s)=>{const a=t?cge:"a";return r.jsx(a,{ref:s,className:zt("transition-colors hover:text-foreground",e),...n})});ume.displayName="BreadcrumbLink";const nqe=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}));nqe.displayName="BreadcrumbPage";const hme=({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(Bi,{})});hme.displayName="BreadcrumbSeparator";function DYt(){var xe,ie;const{productId:t}=td(),e=Gn(),{data:n,isLoading:s}=VZt(t||""),{addToCart:a,cartItems:o}=Ose(),[l,i]=I.useState(null),[u,p]=I.useState(1),[x,y]=I.useState(0),[_,w]=I.useState(null),[S,N]=I.useState(!1),[M,E]=I.useState(!1),A=(xe=n==null?void 0:n.variants)==null?void 0:xe.find(pe=>pe.id===l),P=((ie=n==null?void 0:n.variants)==null?void 0:ie.filter(pe=>pe.is_active))||[],z=Number((n==null?void 0:n.base_price)||0),R=A?Number(A.price_adjustment):0,U=z+R,V=Number((n==null?void 0:n.shipping_fee)||0),K=o.reduce((pe,se)=>pe+se.quantity,0),W=async pe=>{if(!pe.target.files||pe.target.files.length===0)return;N(!0);const se=pe.target.files[0],fe=se.name.split(".").pop(),he=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`;try{const{error:ye}=await Q.storage.from("marketplace").upload(he,se);if(ye)throw ye;const{data:{publicUrl:Ce}}=Q.storage.from("marketplace").getPublicUrl(he);w(Ce),Oe.success("Artwork uploaded successfully")}catch(ye){Oe.error("Failed to upload artwork: "+ye.message)}finally{N(!1)}},J=()=>{if(n){if(P.length>0&&!l){Oe.error("Please select an option");return}a(n,A||void 0,u,_||void 0),E(!0),Oe.success("Added to cart!"),setTimeout(()=>E(!1),2e3)}},ae=()=>{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(tqe,{className:"mb-6",children:r.jsxs(rqe,{children:[r.jsx(Eee,{children:r.jsx(ume,{asChild:!0,children:r.jsx(Ji,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(hme,{}),r.jsx(Eee,{children:r.jsx(ume,{asChild:!0,children:r.jsx(Ji,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(hme,{}),r.jsx(Eee,{children:r.jsx(nqe,{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(te,{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(vc,{className:"h-6 w-6"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ae,children:r.jsx(Bi,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx($l,{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(Ke,{children:r.jsxs(et,{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(Lt,{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:["$",U.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(qe,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:P.map(pe=>r.jsxs(te,{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(qe,{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(te,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>w(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:W,className:"hidden",id:"artwork-upload",disabled:S}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(ho,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:S?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(qe,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>p(pe=>Math.max(1,pe-1)),children:"-"}),r.jsx(ot,{type:"number",value:u,onChange:pe=>p(Math.max(1,parseInt(pe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>p(pe=>pe+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(te,{size:"lg",className:"flex-1",onClick:J,disabled:M,children:M?r.jsxs(r.Fragment,{children:[r.jsx(_i,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(_h,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(te,{variant:"outline",size:"lg",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(_h,{className:"h-5 w-5"}),K>0&&r.jsx(Lt,{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($l,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),r.jsx(te,{onClick:()=>e("/marketplace"),children:"Back to Marketplace"})]})})}function RYt(){const t=Gn(),{cartItems:e,removeFromCart:n,updateQuantity:s,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:u}=Ose(),[p,x]=I.useState(!1),[y,_]=I.useState(""),w=async()=>{if(e.length===0){Oe.error("Your cart is empty");return}x(!0);try{const{data:S,error:N}=await Q.functions.invoke("marketplace-checkout",{body:{items:e.map(M=>{var E;return{product_id:M.product.id,variant_id:((E=M.variant)==null?void 0:E.id)||null,quantity:M.quantity,artwork_url:M.artworkUrl||null}}),notes:y.trim()||null}});if(N)throw N;if(S!=null&&S.url)u(),window.open(S.url,"_blank");else throw new Error("No checkout URL received")}catch(S){Oe.error("Checkout failed: "+S.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(Mg,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),r.jsx(te,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(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(S=>{var N,M;return r.jsx(Ke,{children:r.jsx(et,{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:S.product.images&&S.product.images.length>0?r.jsx("img",{src:((N=S.product.images.find(E=>E.is_primary))==null?void 0:N.image_url)||S.product.images[0].image_url,alt:S.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Mg,{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:S.product.name}),S.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:S.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",a(S).toFixed(2),Number(S.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(S.product.shipping_fee).toFixed(2)," shipping"]})]}),S.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return n(S.product.id,(E=S.variant)==null?void 0:E.id)},children:r.jsx($n,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(S.product.id,(E=S.variant)==null?void 0:E.id,S.quantity-1)},disabled:S.quantity<=1,children:r.jsx(F1,{className:"h-3 w-3"})}),r.jsx(ot,{type:"number",value:S.quantity,onChange:E=>{var A;return s(S.product.id,(A=S.variant)==null?void 0:A.id,parseInt(E.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(S.product.id,(E=S.variant)==null?void 0:E.id,S.quantity+1)},children:r.jsx(_n,{className:"h-3 w-3"})})]})]})]})})},`${S.product.id}-${((M=S.variant)==null?void 0:M.id)||"base"}`)}),r.jsx(te,{variant:"ghost",className:"text-destructive",onClick:u,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ke,{className:"sticky top-4",children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",e.reduce((S,N)=>S+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(_d,{}),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(_d,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(qe,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(ss,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:S=>_(S.target.value),rows:3,className:"resize-none"})]}),r.jsx(te,{className:"w-full",size:"lg",onClick:w,disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(Yr,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(Jo,{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 FYt(){const t=Gn(),{data:e,isLoading:n}=tYt();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($l,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),r.jsx(te,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Lr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:e.map(s=>{var a,o,l;return r.jsx(Ke,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t(`/marketplace/orders/${s.id}`),children:r.jsxs(et,{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:mn(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Lt,{className:o1e[s.status],children:KS[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,u)=>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-u},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(te,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Os,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Bi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const uMe=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function zYt({currentStatus:t,statusHistory:e}){const n=uMe.indexOf(t);return r.jsx("div",{className:"space-y-3",children:uMe.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(Wa,{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 ${u?"text-muted-foreground":""}`,children:KS[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[mn(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function BYt(){var E;const{orderId:t}=td(),e=Gn(),{data:n,isLoading:s,refetch:a}=rYt(t||""),o=aYt(),l=iYt(),[i,u]=I.useState(!1),[p,x]=I.useState(null),[y,_]=I.useState(""),[w,S]=I.useState(null),N=async A=>{S(A);try{await o.mutateAsync({orderId:t,itemId:A}),Oe.success("Proof approved!"),a()}catch{Oe.error("Failed to approve proof")}finally{S(null)}},M=async()=>{if(p){S(p);try{await l.mutateAsync({orderId:t,itemId:p,reason:y}),Oe.success("Revision requested"),u(!1),_(""),x(null),a()}catch{Oe.error("Failed to request revision")}finally{S(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(Ke,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Order Status"}),r.jsx(Lt,{className:o1e[n.status],children:KS[n.status]})]}),r.jsx(et,{children:r.jsx(zYt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Items"})}),r.jsx(et,{className:"space-y-4",children:(E=n.items)==null?void 0:E.map(A=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:A.product_name}),A.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:A.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",A.quantity," × $",Number(A.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(A.unit_price)*A.quantity).toFixed(2)]})]}),A.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:A.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(I1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Os,{className:"h-3 w-3"})]})]}),A.proof_url&&r.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),r.jsxs("a",{href:A.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(I1,{className:"h-4 w-4"}),"View Proof",r.jsx(Os,{className:"h-3 w-3"})]}),A.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(te,{size:"sm",onClick:()=>N(A.id),disabled:w===A.id,children:[w===A.id?r.jsx(Yr,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(kd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>{x(A.id),u(!0)},disabled:w===A.id,children:[r.jsx(uA,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),A.proof_status==="approved"&&r.jsxs(Lt,{className:"bg-green-100 text-green-800",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),A.proof_status==="rejected"&&A.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Lt,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:A.proof_notes})]})]})]},A.id))})]}),n.shipping_name&&r.jsxs(Ke,{children:[r.jsx(Ht,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(fA,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(te,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Os,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ke,{className:"sticky top-4",children:[r.jsx(Ht,{children:r.jsx(Zt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",mn(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(_d,{}),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(_d,{}),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(_d,{}),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(Dr,{open:i,onOpenChange:u,children:r.jsxs(Or,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Request Changes"}),r.jsx(Jn,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(ss,{placeholder:"Describe the changes needed...",value:y,onChange:A=>_(A.target.value),rows:4}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(te,{onClick:M,disabled:!y.trim()||w!==null,children:[w?r.jsx(Yr,{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($l,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),r.jsx(te,{onClick:()=>e("/marketplace/orders"),children:"View All Orders"})]})})}function $Yt(){const t=Gn(),[e]=rd();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(Ke,{children:r.jsxs(et,{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($l,{className:"h-4 w-4"}),"What happens next?"]}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("li",{children:"• We'll review your order and prepare it for production"}),r.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),r.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),r.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(te,{className:"flex-1",onClick:()=>t("/marketplace/orders"),children:["View My Orders",r.jsx(Jo,{className:"h-4 w-4 ml-2"})]}),r.jsx(te,{variant:"outline",className:"flex-1",onClick:()=>t("/marketplace"),children:"Continue Shopping"})]})]})})})})}function UYt(){const{user:t}=Qr(),[e,n]=I.useState("store"),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,u]=I.useState(!1),[p,x]=I.useState(5),[y,_]=I.useState(""),[w,S]=I.useState(!1),[N,M]=I.useState(!1),[E,A]=I.useState(""),[P,z]=I.useState(null),[R,U]=I.useState(!1),{hasSubmittedReview:V,submitReview:K,markPostedToGoogle:W}=H8e(),{data:J}=eqe(),{data:ae,isLoading:oe}=JUe(),{data:xe,isLoading:ie}=fYt(s),{data:pe,isLoading:se}=pYt(t==null?void 0:t.id),{data:fe=0}=gYt(t==null?void 0:t.id),he=xYt(),ye=new Set((pe==null?void 0:pe.map(Pe=>Pe.item_id))||[]),Ce=async()=>{if(o)try{await he.mutateAsync(o.id),Oe.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Pe){Oe.error(Pe.message||"Failed to purchase item")}},Se=async()=>{if(!y.trim()){Oe.error("Please write a review");return}S(!0);const Pe=await K(p,y);S(!1),Pe.success?(Oe.success("Thank you for your review! You earned 25 points!"),A(y),M(!0),_(""),x(5)):Oe.error(Pe.error||"Failed to submit review")},Ne=()=>{navigator.clipboard.writeText(E),Oe.success("Review copied to clipboard!")},be=()=>{W(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},rt=()=>{M(!1),u(!1),A("")};return oe||ie||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(Pe=>r.jsx(Ir,{className:"h-64"},Pe))})]})}):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(Ke,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{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(_s,{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:fe.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(Yi,{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(lf,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(DS,{open:R,onOpenChange:U,children:r.jsxs(Ke,{className:"border-primary/20",children:[r.jsx(RS,{asChild:!0,children:r.jsx(Ht,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Yi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-base",children:"How to Earn Points"}),r.jsx(Cn,{children:"See all the ways you can earn spendable points"})]})]}),R?r.jsx(T1,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Qd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(FS,{children:r.jsx(et,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[J==null?void 0:J.filter(Pe=>Pe.is_active).map(Pe=>{const Ue=Re=>{switch(Re){case"event_attendance":return r.jsx(Ds,{className:"h-5 w-5"});case"leave_review":return r.jsx(_s,{className:"h-5 w-5"});case"add_listing":return r.jsx(ua,{className:"h-5 w-5"});case"first_contact":return r.jsx(Bn,{className:"h-5 w-5"});case"first_video":return r.jsx(Da,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Do,{className:"h-5 w-5"});default:return r.jsx(Zi,{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:Ue(Pe.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Pe.action_name}),Pe.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Pe.description})]}),r.jsxs(Lt,{variant:"secondary",className:"font-bold shrink-0",children:["+",Pe.points]})]},Pe.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(lf,{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(Lt,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!V&&r.jsx(Ke,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(et,{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(Do,{className:"h-6 w-6 text-yellow-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),r.jsxs(te,{onClick:()=>u(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(_s,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(ki,{value:e,onValueChange:n,children:[r.jsxs(pi,{children:[r.jsxs(rn,{value:"store",className:"flex items-center gap-2",children:[r.jsx(Mg,{className:"h-4 w-4"}),"Store"]}),r.jsxs(rn,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx($l,{className:"h-4 w-4"}),"My Rewards",pe&&pe.length>0&&r.jsx(Lt,{variant:"secondary",className:"ml-1",children:pe.length})]})]}),r.jsxs(Sn,{value:"store",className:"mt-6",children:[ae&&ae.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(te,{variant:s===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),ae.map(Pe=>r.jsxs(te,{variant:s===Pe.id?"default":"outline",size:"sm",onClick:()=>a(Pe.id),children:[Pe.icon&&`${Pe.icon} `,Pe.name]},Pe.id))]}),!xe||xe.length===0?r.jsx(Ke,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Zi,{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:xe.map(Pe=>{const Ue=ye.has(Pe.id),Re=Pe.max_quantity!==null&&Pe.current_quantity===0,Be=fe>=Pe.points_cost;return r.jsxs(Ke,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ue?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>z(Pe),children:[Pe.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Pe.preview_image_url,alt:Pe.name,className:"w-full h-full object-cover"}),Ue&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Lt,{className:"bg-green-500 text-white",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Re&&!Ue&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Lt,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Zi,{className:"h-12 w-12 text-muted-foreground/50"}),Ue&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Lt,{className:"bg-green-500 text-white",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Zt,{className:"text-lg",children:Pe.name}),r.jsxs(Lt,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(_s,{className:"h-3 w-3 mr-1"}),Pe.points_cost]})]}),Pe.category&&r.jsxs(Lt,{variant:"outline",className:"w-fit",children:[Pe.category.icon&&`${Pe.category.icon} `,Pe.category.name]})]}),r.jsxs(et,{children:[r.jsx(Cn,{className:"mb-4 line-clamp-2",children:Pe.description||"No description available"}),Pe.max_quantity!==null&&!Ue&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Pe.current_quantity," of ",Pe.max_quantity," remaining"]}),Ue?r.jsx(te,{className:"w-full",onClick:Ye=>{Ye.stopPropagation(),Pe.file_url&&Ide(Pe.file_url,Pe.name)},disabled:!Pe.file_url,children:Pe.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(te,{className:"w-full",onClick:Ye=>{Ye.stopPropagation(),l(Pe)},disabled:Re||!Be,children:Re?"Sold Out":Be?r.jsxs(r.Fragment,{children:[r.jsx(Mg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Pe.points_cost-fe} more pts`})]})]},Pe.id)})})]}),r.jsx(Sn,{value:"my-rewards",className:"mt-6",children:!pe||pe.length===0?r.jsx(Ke,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx($l,{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(Pe=>{var Ue,Re,Be,Ye,ht;return r.jsxs(Ke,{className:"overflow-hidden",children:[(Ue=Pe.item)!=null&&Ue.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Pe.item.preview_image_url,alt:((Re=Pe.item)==null?void 0:Re.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(Zi,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Zt,{className:"text-lg",children:((Be=Pe.item)==null?void 0:Be.name)||"Unknown Item"}),r.jsxs(Cn,{className:"text-xs",children:["Purchased for ",Pe.points_spent," points • ",new Date(Pe.purchased_at).toLocaleDateString()]})]}),r.jsx(et,{children:r.jsx(te,{className:"w-full",onClick:()=>{var Me,Qe;(Me=Pe.item)!=null&&Me.file_url&&Ide(Pe.item.file_url,(Qe=Pe.item)==null?void 0:Qe.name)},disabled:!((Ye=Pe.item)!=null&&Ye.file_url),children:((ht=Pe.item)==null?void 0:ht.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Pe.id)})})})]})]}),r.jsx(pu,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(Hd,{children:[r.jsxs(Wd,{children:[r.jsx(Kd,{children:"Confirm Purchase"}),r.jsxs(Zd,{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:[fe," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[fe-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(Gd,{children:[r.jsx(Yd,{children:"Cancel"}),r.jsx(yd,{onClick:Ce,disabled:he.isPending,children:he.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Dr,{open:i,onOpenChange:Pe=>{!Pe&&N?rt():u(Pe)},children:r.jsx(Or,{children:N?r.jsxs(r.Fragment,{children:[r.jsxs(Br,{children:[r.jsxs(zr,{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(Jn,{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(te,{variant:"outline",className:"w-full",onClick:Ne,children:[r.jsx(tl,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(Ws,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(te,{variant:"outline",onClick:rt,children:"Maybe Later"}),r.jsxs(te,{onClick:be,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Br,{children:[r.jsx(zr,{children:"Leave a Review"}),r.jsx(Jn,{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(Pe=>r.jsx("button",{type:"button",onClick:()=>x(Pe),className:"focus:outline-none",children:r.jsx(_s,{className:`h-8 w-8 transition-colors ${p>=Pe?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Pe))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(ss,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Pe=>_(Pe.target.value),rows:4})]})]}),r.jsxs(Ws,{children:[r.jsx(te,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(te,{onClick:Se,disabled:w,className:"bg-yellow-600 hover:bg-yellow-700",children:w?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Dr,{open:!!P,onOpenChange:()=>z(null),children:r.jsxs(Or,{className:"max-w-lg",children:[r.jsxs(Br,{children:[r.jsxs(zr,{className:"flex items-center gap-2",children:[P==null?void 0:P.name,r.jsxs(Lt,{variant:"secondary",className:"font-bold",children:[r.jsx(_s,{className:"h-3 w-3 mr-1"}),P==null?void 0:P.points_cost]})]}),(P==null?void 0:P.category)&&r.jsxs(Lt,{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&&!ye.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(Ws,{children:P&&ye.has(P.id)?r.jsx(te,{className:"w-full",onClick:()=>{P.file_url&&Ide(P.file_url,P.name)},disabled:!P.file_url,children:P.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Access"]})}):P&&r.jsx(te,{className:"w-full",onClick:()=>{z(null),l(P)},disabled:P.max_quantity!==null&&P.current_quantity===0||fe{const t=Em();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"})]})})},VYt=new CJe,HYt=()=>{const t=window.location.hostname;return t==="listings.relevelup.com"||t.startsWith("listings.")},WYt=()=>{const t=window.location.hostname;return t==="cards.relevelup.com"||t.startsWith("cards.")},GYt=()=>r.jsx(IJe,{client:VYt,children:r.jsx(MIe,{children:r.jsxs(AI,{children:[r.jsx(GYe,{}),r.jsx(NXe,{}),r.jsx(Get,{children:r.jsx(Qnt,{children:r.jsx(Jnt,{children:r.jsxs(tst,{children:[r.jsx(est,{}),r.jsx(Pit,{}),r.jsx(Zit,{}),WYt()?r.jsx(plt,{}):HYt()?r.jsx(Dot,{}):r.jsxs(zet,{children:[r.jsx(tn,{path:"/",element:r.jsx(Nlt,{})}),r.jsx(tn,{path:"/privacy-policy",element:r.jsx(Slt,{})}),r.jsx(tn,{path:"/terms-of-service",element:r.jsx(Clt,{})}),r.jsx(tn,{path:"/data-deletion",element:r.jsx(Mlt,{})}),r.jsx(tn,{path:"/public/listings",element:r.jsx(iOe,{})}),r.jsx(tn,{path:"/public/listing/:slugOrId",element:r.jsx(hpt,{})}),r.jsx(tn,{path:"/card/:slug",element:r.jsx(fpt,{})}),r.jsx(tn,{path:"/auth",element:r.jsx(nct,{})}),r.jsx(tn,{path:"/subscription-success",element:r.jsx(sct,{})}),r.jsx(tn,{path:"/subscription",element:r.jsx(Nn,{children:r.jsx(_ft,{})})}),r.jsx(tn,{path:"/share/video",element:r.jsx(lpt,{}),children:r.jsx(tn,{path:":shareToken",element:r.jsx(opt,{})})}),r.jsx(tn,{path:"/og/video/:token",element:r.jsx(cpt,{})}),r.jsx(tn,{path:"/setup-brokerage",element:r.jsx(Nn,{children:r.jsx(bft,{})})}),r.jsx(tn,{path:"/claim-account",element:r.jsx(qke,{})}),r.jsx(tn,{path:"/claim",element:r.jsx(qke,{})}),r.jsx(tn,{path:"/join",element:r.jsx(wft,{})}),r.jsx(tn,{path:"/trial",element:r.jsx(Pft,{})}),r.jsx(tn,{path:"/trial/success",element:r.jsx(Lft,{})}),r.jsx(tn,{path:"/dashboard",element:r.jsx(Nn,{children:r.jsx(ymt,{})})}),r.jsx(tn,{path:"/profile",element:r.jsx(Nn,{children:r.jsx(obt,{})})}),r.jsx(tn,{path:"/apps",element:r.jsx(Nn,{children:r.jsx(_bt,{})})}),r.jsx(tn,{path:"/admin",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(akt,{})})}),r.jsx(tn,{path:"/admin/apps",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(lkt,{})})}),r.jsx(tn,{path:"/admin/members",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ukt,{})})}),r.jsx(tn,{path:"/admin/invite-codes",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(hkt,{})})}),r.jsx(tn,{path:"/admin/events",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(xkt,{})})}),r.jsx(tn,{path:"/events",element:r.jsx(Nn,{children:r.jsx(xbt,{})})}),r.jsx(tn,{path:"/events/:eventId",element:r.jsx(Nn,{children:r.jsx(vbt,{})})}),r.jsx(tn,{path:"/templates",element:r.jsx(Nn,{children:r.jsx(bbt,{})})}),r.jsx(tn,{path:"/templates/:templateId",element:r.jsx(Nn,{children:r.jsx(Nbt,{})})}),r.jsx(tn,{path:"/admin/templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ykt,{})})}),r.jsx(tn,{path:"/academy",element:r.jsx(Nn,{children:r.jsx(Sbt,{})})}),r.jsx(tn,{path:"/academy/:videoId",element:r.jsx(Nn,{children:r.jsx(Mbt,{})})}),r.jsx(tn,{path:"/admin/academy",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(_kt,{})})}),r.jsx(tn,{path:"/toolbox",element:r.jsx(Nn,{children:r.jsx(Tbt,{})})}),r.jsx(tn,{path:"/toolbox/:kitId",element:r.jsx(Nn,{children:r.jsx(Abt,{})})}),r.jsx(tn,{path:"/admin/toolbox",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(bkt,{})})}),r.jsx(tn,{path:"/social-swag",element:r.jsx(Nn,{children:r.jsx(Ebt,{})})}),r.jsx(tn,{path:"/social-swag-2",element:r.jsx(Nn,{children:r.jsx(Tjt,{})})}),r.jsx(tn,{path:"/social-swag/:swagId",element:r.jsx(Nn,{children:r.jsx(Ajt,{})})}),r.jsx(tn,{path:"/social-connections",element:r.jsx(Nn,{children:r.jsx(EYt,{})})}),r.jsx(tn,{path:"/social-connections/callback",element:r.jsx(Nn,{children:r.jsx(IYt,{})})}),r.jsx(tn,{path:"/social-connections/linkedin-callback",element:r.jsx(Nn,{children:r.jsx(LYt,{})})}),r.jsx(tn,{path:"/social-connections/google-callback",element:r.jsx(Nn,{children:r.jsx(PYt,{})})}),r.jsx(tn,{path:"/admin/social-swag",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(wkt,{})})}),r.jsx(tn,{path:"/admin/social-swag-2",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(jkt,{})})}),r.jsx(tn,{path:"/community",element:r.jsx(Nn,{children:r.jsx(Zjt,{})})}),r.jsx(tn,{path:"/support",element:r.jsx(Nn,{children:r.jsx(Yjt,{})})}),r.jsx(tn,{path:"/admin/community",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(kkt,{})})}),r.jsx(tn,{path:"/admin/support-tickets",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Ikt,{})})}),r.jsx(tn,{path:"/admin/email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Okt,{})})}),r.jsx(tn,{path:"/admin/agent-email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Dkt,{})})}),r.jsx(tn,{path:"/admin/analytics",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Tkt,{})})}),r.jsx(tn,{path:"/admin/brokerage-resources",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Akt,{})})}),r.jsx(tn,{path:"/admin/dashboard-management",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Ekt,{})})}),r.jsx(tn,{path:"/brokerage/dashboard",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(Gkt,{})})}),r.jsx(tn,{path:"/my-brokerage",element:r.jsx(Nn,{children:r.jsx(Jkt,{})})}),r.jsx(tn,{path:"/brokerage-resources",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(rkt,{})})}),r.jsx(tn,{path:"/brokerage-resources/:resourceId",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(nkt,{})})}),r.jsx(tn,{path:"/newsletters",element:r.jsx(Nn,{children:r.jsx(eNt,{})})}),r.jsx(tn,{path:"/newsletters/:id",element:r.jsx(Nn,{children:r.jsx(rNt,{})})}),r.jsx(tn,{path:"/wishlist",element:r.jsx(Nn,{children:r.jsx(aNt,{})})}),r.jsx(tn,{path:"/wishlist/:itemId",element:r.jsx(Nn,{children:r.jsx(iNt,{})})}),r.jsx(tn,{path:"/admin/wishlist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(oNt,{})})}),r.jsx(tn,{path:"/admin/levelup-brief",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(lNt,{})})}),r.jsx(tn,{path:"/admin/newsletters",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(sNt,{})})}),r.jsx(tn,{path:"/admin/additional-services",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(cNt,{})})}),r.jsx(tn,{path:"/admin/discounts",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(dNt,{})})}),r.jsx(tn,{path:"/admin/subscriptions",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(uNt,{})})}),r.jsx(tn,{path:"/admin/referrals",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(hNt,{})})}),r.jsx(tn,{path:"/admin/onboarding-checklist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(pNt,{})})}),r.jsx(tn,{path:"/admin/marketplace",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(uYt,{})})}),r.jsx(tn,{path:"/admin/agent-points",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(OZt,{})})}),r.jsx(tn,{path:"/admin/reward-store",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(SYt,{})})}),r.jsx(tn,{path:"/admin/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(CYt,{})})}),r.jsx(tn,{path:"/admin/integrations/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(AYt,{})})}),r.jsx(tn,{path:"/reward-store",element:r.jsx(Nn,{children:r.jsx(UYt,{})})}),r.jsx(tn,{path:"/additional-services",element:r.jsx(Nn,{children:r.jsx(NNt,{})})}),r.jsx(tn,{path:"/additional-services/:serviceId",element:r.jsx(Nn,{children:r.jsx(SNt,{})})}),r.jsx(tn,{path:"/ai-toolkit",element:r.jsx(Nn,{children:r.jsx(CNt,{})})}),r.jsx(tn,{path:"/mission-control",element:r.jsx(Nn,{children:r.jsx(RNt,{})})}),r.jsx(tn,{path:"/mission-control/contacts",element:r.jsx(Nn,{children:r.jsx(r4t,{})})}),r.jsx(tn,{path:"/mission-control/contacts/:contactId",element:r.jsx(Nn,{children:r.jsx(x4t,{})})}),r.jsx(tn,{path:"/mission-control/plans",element:r.jsx(Nn,{children:r.jsx(y4t,{})})}),r.jsx(tn,{path:"/mission-control/popbys",element:r.jsx(Nn,{children:r.jsx(b4t,{})})}),r.jsx(tn,{path:"/mission-control/popbys/map",element:r.jsx(Nn,{children:r.jsx(w4t,{})})}),r.jsx(tn,{path:"/admin/notification-settings",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(TYt,{})})}),r.jsx(tn,{path:"/admin/agent-os",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(gNt,{})})}),r.jsx(tn,{path:"/mission-control/listings",element:r.jsx(Nn,{children:r.jsx(oKt,{})})}),r.jsx(tn,{path:"/mission-control/listings/new",element:r.jsx(Nn,{children:r.jsx(oMe,{})})}),r.jsx(tn,{path:"/mission-control/listings/:listingId",element:r.jsx(Nn,{children:r.jsx(wKt,{})})}),r.jsx(tn,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Nn,{children:r.jsx(oMe,{})})}),r.jsx(tn,{path:"/admin/listing-exchange",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(TZt,{})})}),r.jsx(tn,{path:"/mission-control/pipeline",element:r.jsx(Nn,{children:r.jsx(ZKt,{})})}),r.jsx(tn,{path:"/mission-control/my-card",element:r.jsx(Nn,{children:r.jsx(mZt,{})})}),r.jsx(tn,{path:"/mission-control/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(jZt,{})})}),r.jsx(tn,{path:"/mission-control/integrations/gmail/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(kZt,{})})}),r.jsx(tn,{path:"/mission-control/scorecard",element:r.jsx(Nn,{children:r.jsx(XGt,{})})}),r.jsx(tn,{path:"/admin/scorecard",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(SZt,{})})}),r.jsx(tn,{path:"/admin/scorecard/:userId",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(MZt,{})})}),r.jsx(tn,{path:"/admin/membership-reviews",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(AZt,{})})}),r.jsx(tn,{path:"/admin/weekly-digest",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(PZt,{})})}),r.jsx(tn,{path:"/mission-control/video/record",element:r.jsx(Nn,{children:r.jsx(AKt,{})})}),r.jsx(tn,{path:"/mission-control/video-library",element:r.jsx(Nn,{children:r.jsx(OKt,{})})}),r.jsx(tn,{path:"/marketplace",element:r.jsx(Nn,{children:r.jsx(OYt,{})})}),r.jsx(tn,{path:"/marketplace/:productId",element:r.jsx(Nn,{children:r.jsx(DYt,{})})}),r.jsx(tn,{path:"/marketplace/cart",element:r.jsx(Nn,{children:r.jsx(RYt,{})})}),r.jsx(tn,{path:"/marketplace/orders",element:r.jsx(Nn,{children:r.jsx(FYt,{})})}),r.jsx(tn,{path:"/marketplace/orders/:orderId",element:r.jsx(Nn,{children:r.jsx(BYt,{})})}),r.jsx(tn,{path:"/marketplace/success",element:r.jsx(Nn,{children:r.jsx($Yt,{})})}),r.jsx(tn,{path:"/admin/agent-cards",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(DZt,{})})}),r.jsx(tn,{path:"*",element:r.jsx(qYt,{})})]}),")"]})})})})]})})});OAe(document.getElementById("root")).render(r.jsx(GYt,{}));